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§
§impl<'de> Deserialize<'de> for LeafOp
impl<'de> Deserialize<'de> for LeafOp
§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 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
.