Merge branch 'main' into next
This commit is contained in:
commit
a424652ba7
3 changed files with 22 additions and 5 deletions
|
@ -2,6 +2,11 @@
|
||||||
|
|
||||||
- [BREAKING] Increment minimum supported Rust version to 1.84.
|
- [BREAKING] Increment minimum supported Rust version to 1.84.
|
||||||
|
|
||||||
|
## 0.13.2 (2025-01-24)
|
||||||
|
|
||||||
|
- Made `InnerNode` and `NodeMutation` public. Implemented (de)serialization of `LeafIndex` (#367).
|
||||||
|
|
||||||
|
|
||||||
## 0.13.1 (2024-12-26)
|
## 0.13.1 (2024-12-26)
|
||||||
|
|
||||||
- Generate reverse mutations set on applying of mutations set, implemented serialization of `MutationsSet` (#355).
|
- Generate reverse mutations set on applying of mutations set, implemented serialization of `MutationsSet` (#355).
|
||||||
|
|
|
@ -24,8 +24,8 @@ mod smt;
|
||||||
#[cfg(feature = "internal")]
|
#[cfg(feature = "internal")]
|
||||||
pub use smt::build_subtree_for_bench;
|
pub use smt::build_subtree_for_bench;
|
||||||
pub use smt::{
|
pub use smt::{
|
||||||
LeafIndex, MutationSet, SimpleSmt, Smt, SmtLeaf, SmtLeafError, SmtProof, SmtProofError,
|
InnerNode, LeafIndex, MutationSet, NodeMutation, SimpleSmt, Smt, SmtLeaf, SmtLeafError,
|
||||||
SubtreeLeaf, SMT_DEPTH, SMT_MAX_DEPTH, SMT_MIN_DEPTH,
|
SmtProof, SmtProofError, SubtreeLeaf, SMT_DEPTH, SMT_MAX_DEPTH, SMT_MIN_DEPTH,
|
||||||
};
|
};
|
||||||
|
|
||||||
mod mmr;
|
mod mmr;
|
||||||
|
|
|
@ -643,17 +643,29 @@ impl<const DEPTH: u8> TryFrom<NodeIndex> for LeafIndex<DEPTH> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<const DEPTH: u8> Serializable for LeafIndex<DEPTH> {
|
||||||
|
fn write_into<W: ByteWriter>(&self, target: &mut W) {
|
||||||
|
self.index.write_into(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<const DEPTH: u8> Deserializable for LeafIndex<DEPTH> {
|
||||||
|
fn read_from<R: ByteReader>(source: &mut R) -> Result<Self, DeserializationError> {
|
||||||
|
Ok(Self { index: source.read()? })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// MUTATIONS
|
// MUTATIONS
|
||||||
// ================================================================================================
|
// ================================================================================================
|
||||||
|
|
||||||
/// A change to an inner node of a [`SparseMerkleTree`] that hasn't yet been applied.
|
/// A change to an inner node of a sparse Merkle tree that hasn't yet been applied.
|
||||||
/// [`MutationSet`] stores this type in relation to a [`NodeIndex`] to keep track of what changes
|
/// [`MutationSet`] stores this type in relation to a [`NodeIndex`] to keep track of what changes
|
||||||
/// need to occur at which node indices.
|
/// need to occur at which node indices.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum NodeMutation {
|
pub enum NodeMutation {
|
||||||
/// Corresponds to [`SparseMerkleTree::remove_inner_node()`].
|
/// Node needs to be removed.
|
||||||
Removal,
|
Removal,
|
||||||
/// Corresponds to [`SparseMerkleTree::insert_inner_node()`].
|
/// Node needs to be inserted.
|
||||||
Addition(InnerNode),
|
Addition(InnerNode),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue