Skip to content
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

Merged
merged 22 commits into from
Dec 6, 2024

Conversation

shekhirin
Copy link
Collaborator

@shekhirin shekhirin commented Dec 4, 2024

Integrates #13129 into the sparse trie, revealing the hash masks of branch nodes along with the proofs.

@shekhirin shekhirin added C-enhancement New feature or request A-trie Related to Merkle Patricia Trie implementation labels Dec 4, 2024
@shekhirin shekhirin marked this pull request as ready for review December 4, 2024 17:16
Base automatically changed from alexey/trie-proofs-branch-node-hash-masks to main December 4, 2024 20:49
@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo?

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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(
Copy link
Member

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)

Copy link
Collaborator Author

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

@shekhirin shekhirin requested a review from rkrasiuk December 5, 2024 12:34
@shekhirin shekhirin added this pull request to the merge queue Dec 5, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Dec 5, 2024
@shekhirin shekhirin added this pull request to the merge queue Dec 5, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Dec 5, 2024
@shekhirin shekhirin added this pull request to the merge queue Dec 6, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 6, 2024
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 {
Copy link
Collaborator

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

@rkrasiuk rkrasiuk added this pull request to the merge queue Dec 6, 2024
Merged via the queue into main with commit 6453b62 Dec 6, 2024
41 checks passed
@rkrasiuk rkrasiuk deleted the alexey/proofs-branch-node-hash-masks branch December 6, 2024 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-trie Related to Merkle Patricia Trie implementation C-enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants