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<'de> Deserialize<'de> for LeafOp
impl<'de> Deserialize<'de> for LeafOp
source§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 JsonSchema for LeafOp
impl JsonSchema for LeafOp
source§fn schema_name() -> String
fn schema_name() -> String
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moresource§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>where
B: BufMut,
Self: Sized,
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>where B: BufMut, Self: Sized,
source§fn encode_to_vec(&self) -> Vec<u8, Global>where
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8, Global>where Self: Sized,
source§fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
Self: Sized,
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>where B: BufMut, Self: Sized,
source§fn encode_length_delimited_to_vec(&self) -> Vec<u8, Global>where
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8, Global>where Self: Sized,
source§fn decode<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
fn decode<B>(buf: B) -> Result<Self, DecodeError>where B: Buf, Self: Default,
source§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,
source§fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>where B: Buf, Self: Sized,
self
. Read moresource§fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>where B: Buf, Self: Sized,
self
.source§impl PartialEq<LeafOp> for LeafOp
impl PartialEq<LeafOp> for LeafOp
impl Eq for LeafOp
impl StructuralEq for LeafOp
impl StructuralPartialEq for LeafOp
Auto Trait Implementations§
impl RefUnwindSafe for LeafOp
impl Send for LeafOp
impl Sync for LeafOp
impl Unpin for LeafOp
impl UnwindSafe for LeafOp
Blanket Implementations§
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request