pub struct ProofSpec {
pub leaf_spec: Option<LeafOp>,
pub inner_spec: Option<InnerSpec>,
pub max_depth: i32,
pub min_depth: i32,
pub prehash_key_before_comparison: bool,
}
Expand description
ProofSpec defines what the expected parameters are for a given proof type. This can be stored in the client and used to validate any incoming proofs.
verify(ProofSpec, Proof) -> Proof | Error
As demonstrated in tests, if we don’t fix the algorithm used to calculate the LeafHash for a given tree, there are many possible key-value pairs that can generate a given hash (by interpretting the preimage differently). We need this for proper security, requires client knows a priori what tree format server uses. But not in code, rather a configuration object.
Fields§
§leaf_spec: Option<LeafOp>
any field in the ExistenceProof must be the same as in this spec. except Prefix, which is just the first bytes of prefix (spec can be longer)
inner_spec: Option<InnerSpec>
§max_depth: i32
max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries)
min_depth: i32
min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries)
prehash_key_before_comparison: bool
prehash_key_before_comparison is a flag that indicates whether to use the prehash_key specified by LeafOp to compare lexical ordering of keys for non-existence proofs.
Trait Implementations§
§impl<'de> Deserialize<'de> for ProofSpec
impl<'de> Deserialize<'de> for ProofSpec
§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
source§impl Message for ProofSpec
impl Message for ProofSpec
source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
source§fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
source§fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
source§fn decode<B>(buf: B) -> Result<Self, DecodeError>
fn decode<B>(buf: B) -> Result<Self, DecodeError>
source§fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
source§fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
self
. Read moresource§fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
self
.