Struct ics23::ExistenceProof
source · pub struct ExistenceProof {
pub key: Vec<u8>,
pub value: Vec<u8>,
pub leaf: Option<LeafOp>,
pub path: Vec<InnerOp>,
}
Expand description
ExistenceProof takes a key and a value and a set of steps to perform on it. The result of peforming all these steps will provide a “root hash”, which can be compared to the value in a header.
Since it is computationally infeasible to produce a hash collission for any of the used cryptographic hash functions, if someone can provide a series of operations to transform a given key and value into a root hash that matches some trusted root, these key and values must be in the referenced merkle tree.
The only possible issue is maliablity in LeafOp, such as providing extra prefix data, which should be controlled by a spec. Eg. with lengthOp as NONE, prefix = FOO, key = BAR, value = CHOICE and prefix = F, key = OOBAR, value = CHOICE would produce the same value.
With LengthOp this is tricker but not impossible. Which is why the “leafPrefixEqual” field in the ProofSpec is valuable to prevent this mutability. And why all trees should length-prefix the data before hashing it.
Fields§
§key: Vec<u8>
§value: Vec<u8>
§leaf: Option<LeafOp>
§path: Vec<InnerOp>
Trait Implementations§
source§impl Clone for ExistenceProof
impl Clone for ExistenceProof
source§fn clone(&self) -> ExistenceProof
fn clone(&self) -> ExistenceProof
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ExistenceProof
impl Debug for ExistenceProof
source§impl Default for ExistenceProof
impl Default for ExistenceProof
§impl<'de> Deserialize<'de> for ExistenceProof
impl<'de> Deserialize<'de> for ExistenceProof
§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 ExistenceProof
impl Message for ExistenceProof
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
.source§impl PartialEq for ExistenceProof
impl PartialEq for ExistenceProof
source§fn eq(&self, other: &ExistenceProof) -> bool
fn eq(&self, other: &ExistenceProof) -> bool
self
and other
values to be equal, and is used
by ==
.