Compare commits
3 commits
1795ef4ba3
...
1662a0a8da
Author | SHA1 | Date | |
---|---|---|---|
1662a0a8da | |||
2eb7a84543 | |||
0f67239bd3 |
3 changed files with 1 additions and 4 deletions
|
@ -336,7 +336,7 @@ impl SparseMerkleTree<SMT_DEPTH> for Smt {
|
||||||
|
|
||||||
let (before_pos, rest) = pairs.split_at(pos);
|
let (before_pos, rest) = pairs.split_at(pos);
|
||||||
let with_pos_removed = rest.iter().copied().skip(1);
|
let with_pos_removed = rest.iter().copied().skip(1);
|
||||||
let middle = if !is_removal { Some(new_pair) } else { None };
|
let middle = iter::once(new_pair).filter(|_| !is_removal);
|
||||||
let elements: Vec<Felt> = before_pos
|
let elements: Vec<Felt> = before_pos
|
||||||
.iter()
|
.iter()
|
||||||
.copied()
|
.copied()
|
||||||
|
|
|
@ -287,7 +287,6 @@ fn test_checked_insertion() {
|
||||||
assert_eq!(old_value_1, EMPTY_WORD);
|
assert_eq!(old_value_1, EMPTY_WORD);
|
||||||
|
|
||||||
assert_eq!(prospective, smt.get_leaf(&key_1).hash());
|
assert_eq!(prospective, smt.get_leaf(&key_1).hash());
|
||||||
|
|
||||||
assert_eq!(smt.get_leaf(&key_1), SmtLeaf::Single((key_1, value_1)));
|
assert_eq!(smt.get_leaf(&key_1), SmtLeaf::Single((key_1, value_1)));
|
||||||
|
|
||||||
smt.root()
|
smt.root()
|
||||||
|
|
|
@ -259,8 +259,6 @@ pub(crate) trait SparseMerkleTree<const DEPTH: u8> {
|
||||||
/// Inserts a leaf node, and returns the value at the key if already exists
|
/// Inserts a leaf node, and returns the value at the key if already exists
|
||||||
fn insert_value(&mut self, key: Self::Key, value: Self::Value) -> Option<Self::Value>;
|
fn insert_value(&mut self, key: Self::Key, value: Self::Value) -> Option<Self::Value>;
|
||||||
|
|
||||||
/// Returns the value at the specified key. Recall that by definition, any key that hasn't been
|
|
||||||
/// updated is associated with [`Self::EMPTY_VALUE`].
|
|
||||||
fn get_value(&self, key: &Self::Key) -> Self::Value;
|
fn get_value(&self, key: &Self::Key) -> Self::Value;
|
||||||
|
|
||||||
/// Returns the leaf at the specified index.
|
/// Returns the leaf at the specified index.
|
||||||
|
|
Loading…
Add table
Reference in a new issue