-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(trie): use branch node hash masks in sparse trie #13135
Conversation
…ash-masks' into alexey/proofs-branch-node-hash-masks
…ash-masks' into alexey/proofs-branch-node-hash-masks
This reverts commit b1424b1.
…ash-masks' into alexey/proofs-branch-node-hash-masks
crates/trie/sparse/src/trie.rs
Outdated
@@ -933,7 +976,8 @@ where | |||
if let Some(node) = self.provider.blinded_node(child_path.clone())? { | |||
let decoded = TrieNode::decode(&mut &node[..])?; | |||
trace!(target: "trie::sparse", ?child_path, ?decoded, "Revealing remaining blinded branch child"); | |||
self.reveal_node(child_path.clone(), decoded)?; | |||
// TODO: fetch hash mask |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plan to address it in the next PR, as it requires modifying the BlindedProvider
trait
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replaced with a comment
@@ -102,75 +102,6 @@ impl<F: BlindedProviderFactory> SparseStateTrie<F> { | |||
self.storages.get_mut(account).and_then(|e| e.as_revealed_mut()) | |||
} | |||
|
|||
/// Reveal unknown trie paths from provided leaf path and its proof for the account. | |||
/// NOTE: This method does not extensively validate the proof. | |||
pub fn reveal_account( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'd prefer to keep this methods, they are still useful. mb with debug_assert!(!self.updates_enabled)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair, useful at least for tests
let node = TrieNode::decode(&mut &bytes[..])?; | ||
trace!(target: "trie::sparse", ?account, ?path, ?node, "Revealing storage node"); | ||
trie.reveal_node(path, node)?; | ||
let hash_mask = if let TrieNode::Branch(_) = node { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like we could use fn is_branch()
suggestion for followup
Integrates #13129 into the sparse trie, revealing the hash masks of branch nodes along with the proofs.