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
Returns the enum value of hash
, or the default if the field is set to an invalid enum value.
Returns the enum value of prehash_key
, or the default if the field is set to an invalid enum value.
Sets prehash_key
to the provided enum value.
Returns the enum value of prehash_value
, or the default if the field is set to an invalid enum value.
Sets prehash_value
to the provided enum value.
Returns the enum value of length
, or the default if the field is set to an invalid enum value.
Sets length
to the provided enum value.
Trait Implementations
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>,
Deserialize this value from the given Serde deserializer. Read more
Returns the encoded length of the message without a length delimiter.
Encodes the message to a buffer. Read more
Encodes the message to a newly allocated buffer.
Encodes the message with a length-delimiter to a buffer. Read more
Encodes the message with a length-delimiter to a newly allocated buffer.
Decodes an instance of the message from a buffer. Read more
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError> where
B: Buf,
Self: Default,
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError> where
B: Buf,
Self: Default,
Decodes a length-delimited instance of the message from the buffer.
Decodes an instance of the message from a buffer, and merges it into self
. Read more
Decodes a length-delimited instance of the message from buffer, and
merges it into self
. Read more
Auto Trait Implementations
impl RefUnwindSafe for LeafOp
impl UnwindSafe for LeafOp
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.
Wrap the input message T
in a tonic::Request
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more