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

fix(trie): check branch node masks if store_in_db_trie is None #13828

Merged
merged 2 commits into from
Jan 17, 2025

Conversation

shekhirin
Copy link
Collaborator

@shekhirin shekhirin commented Jan 16, 2025

Returning false is not correct here

const fn store_in_db_trie(&self) -> bool {
match *self {
Self::Extension { store_in_db_trie } | Self::Branch { store_in_db_trie } => {
store_in_db_trie
}
_ => false,
}
}

Imagine we have the following situation:

Branch (revealed) -> Extension (revealed) -> Hash (blinded, so it's a Hash)

On a call to rlp_node, the extension node will have its store_in_db_trie set to false because its child node is a Hash node that returned false on a call to store_in_db_trie(). This will result in incorrect tree mask for the root branch node.

This PR fixes the trie updates mismatch on Mainnet block 21638721.

@shekhirin shekhirin added C-bug An unexpected or incorrect behavior A-trie Related to Merkle Patricia Trie implementation labels Jan 16, 2025
@shekhirin shekhirin marked this pull request as ready for review January 16, 2025 18:45
@shekhirin shekhirin added this pull request to the merge queue Jan 17, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 17, 2025
@shekhirin shekhirin added this pull request to the merge queue Jan 17, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 17, 2025
@DaniPopes DaniPopes added this pull request to the merge queue Jan 17, 2025
Merged via the queue into main with commit 12d3fbe Jan 17, 2025
43 checks passed
@DaniPopes DaniPopes deleted the alexey/sparse-store-in-db-trie-none branch January 17, 2025 13:12
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-bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants