Struct jmt::proof::UpdateMerkleProof

source ·
pub struct UpdateMerkleProof<H: SimpleHasher>(/* private fields */);

Implementations§

source§

impl<H: SimpleHasher> UpdateMerkleProof<H>

source

pub fn new(merkle_proofs: Vec<SparseMerkleProof<H>>) -> Self

source

pub fn verify_update<V: AsRef<[u8]>>( self, old_root_hash: RootHash, new_root_hash: RootHash, updates: impl AsRef<[(KeyHash, Option<V>)]> ) -> Result<()>

Verifies an update of the [JellyfishMerkleTree], proving the transition from an old_root_hash to a new_root_hash (RootHash) Multiple cases to handle:

  • Insert a tuple new_element_key, new_element_value
  • Update a tuple new_element_key, new_element_value
  • Delete the new_element_key This function does the following high level operations:
  1. Verify the Merkle path provided against the old_root_hash
  2. Use the provided Merkle path and the tuple (new_element_key, new_element_value) to compute the new Merkle path.
  3. Compare the new Merkle path against the new_root_hash If these steps are verified then the [JellyfishMerkleTree] has been soundly updated

This function consumes the Merkle proof to avoid uneccessary copying.

Trait Implementations§

source§

impl<H> BorshDeserialize for UpdateMerkleProof<H>
where H: BorshDeserialize + SimpleHasher,

source§

fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>

§

fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>

Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes.
§

fn try_from_slice(v: &[u8]) -> Result<Self, Error>

Deserialize this instance from a slice of bytes.
§

fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>
where R: Read,

source§

impl<H> BorshSerialize for UpdateMerkleProof<H>
where H: BorshSerialize + SimpleHasher,

source§

fn serialize<W: Write>(&self, writer: &mut W) -> Result<(), Error>

source§

impl<H: Debug + SimpleHasher> Debug for UpdateMerkleProof<H>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de, H> Deserialize<'de> for UpdateMerkleProof<H>
where H: Deserialize<'de> + SimpleHasher,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<H> Serialize for UpdateMerkleProof<H>

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<H> Freeze for UpdateMerkleProof<H>

§

impl<H> RefUnwindSafe for UpdateMerkleProof<H>
where H: RefUnwindSafe,

§

impl<H> Send for UpdateMerkleProof<H>
where H: Send,

§

impl<H> Sync for UpdateMerkleProof<H>
where H: Sync,

§

impl<H> Unpin for UpdateMerkleProof<H>
where H: Unpin,

§

impl<H> UnwindSafe for UpdateMerkleProof<H>
where H: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,