pub struct LeafOp {
pub hash: i32,
pub prehash_key: i32,
pub prehash_value: i32,
pub length: i32,
pub prefix: Vec<u8>,
}Expand description
LeafOp represents the raw key-value data we wish to prove, and must be flexible to represent the internal transformation from the original key-value pairs into the basis hash, for many existing merkle trees.
key and value are passed in. So that the signature of this operation is: leafOp(key, value) -> output
To process this, first prehash the keys and values if needed (ANY means no hash in this case): hkey = prehashKey(key) hvalue = prehashValue(value)
Then combine the bytes, and hash it output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue)
Fields§
§hash: i32§prehash_key: i32§prehash_value: i32§length: i32§prefix: Vec<u8>prefix is a fixed bytes that may optionally be included at the beginning to differentiate a leaf node from an inner node.
Implementations§
Source§impl LeafOp
impl LeafOp
Sourcepub fn hash(&self) -> HashOp
pub fn hash(&self) -> HashOp
Returns the enum value of hash, or the default if the field is set to an invalid enum value.
Sourcepub fn prehash_key(&self) -> HashOp
pub fn prehash_key(&self) -> HashOp
Returns the enum value of prehash_key, or the default if the field is set to an invalid enum value.
Sourcepub fn set_prehash_key(&mut self, value: HashOp)
pub fn set_prehash_key(&mut self, value: HashOp)
Sets prehash_key to the provided enum value.
Sourcepub fn prehash_value(&self) -> HashOp
pub fn prehash_value(&self) -> HashOp
Returns the enum value of prehash_value, or the default if the field is set to an invalid enum value.
Sourcepub fn set_prehash_value(&mut self, value: HashOp)
pub fn set_prehash_value(&mut self, value: HashOp)
Sets prehash_value to the provided enum value.
Sourcepub fn length(&self) -> LengthOp
pub fn length(&self) -> LengthOp
Returns the enum value of length, or the default if the field is set to an invalid enum value.
Sourcepub fn set_length(&mut self, value: LengthOp)
pub fn set_length(&mut self, value: LengthOp)
Sets length to the provided enum value.
Trait Implementations§
Source§impl Message for LeafOp
impl Message for LeafOp
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.