Skip to content

Commit 1e4be6f

Browse files
Remove assume_added
1 parent 6bb1dac commit 1e4be6f

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

src/proof/added_removed_keys.rs

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,12 @@ use alloy_primitives::{B256, map::B256Set};
66
/// Used by the [`crate::proof::ProofRetainer`] to determine which nodes may be ancestors of newly
77
/// added or removed leaves. This information allows for generation of more complete proofs which
88
/// include the nodes necessary for adding and removing leaves from the trie.
9-
///
10-
/// Note: Currently only removed keys are tracked. Added keys tracking is not yet implemented.
119
#[derive(Debug, Default, Clone)]
1210
pub struct AddedRemovedKeys {
1311
/// Keys which are known to be removed from the trie.
1412
removed_keys: B256Set,
15-
/// Keys which are known to be added to the trie.
13+
/// Keys which are known to be newly added to the trie.
1614
added_keys: B256Set,
17-
/// Assume that all keys have been added.
18-
assume_added: bool,
1915
}
2016

2117
impl AsRef<Self> for AddedRemovedKeys {
@@ -25,14 +21,6 @@ impl AsRef<Self> for AddedRemovedKeys {
2521
}
2622

2723
impl AddedRemovedKeys {
28-
/// Sets the `assume_added` flag, which can be used instead of `insert_added` if exact
29-
/// additions aren't known and you want to optimistically collect all proofs which _might_ be
30-
/// necessary.
31-
pub fn with_assume_added(mut self, assume_added: bool) -> Self {
32-
self.assume_added = assume_added;
33-
self
34-
}
35-
3624
/// Sets the key as being a removed key. This removes the key from the `added_keys` set if it
3725
/// was previously inserted into it.
3826
pub fn insert_removed(&mut self, key: B256) {
@@ -59,16 +47,15 @@ impl AddedRemovedKeys {
5947

6048
/// Returns true if the given key path is marked as added.
6149
pub fn is_added(&self, path: &B256) -> bool {
62-
self.assume_added || self.added_keys.contains(path)
50+
self.added_keys.contains(path)
6351
}
6452

6553
/// Returns true if the given path prefix is the prefix of an added key.
6654
pub fn is_prefix_added(&self, prefix: &Nibbles) -> bool {
67-
self.assume_added
68-
|| self.added_keys.iter().any(|key| {
69-
let key_nibbles = Nibbles::unpack(key);
70-
key_nibbles.starts_with(prefix)
71-
})
55+
self.added_keys.iter().any(|key| {
56+
let key_nibbles = Nibbles::unpack(key);
57+
key_nibbles.starts_with(prefix)
58+
})
7259
}
7360

7461
/// Returns a mask containing a bit set for each child of the branch which is a prefix of a

0 commit comments

Comments
 (0)