-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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): sparse trie #11741
feat(trie): sparse trie #11741
Conversation
ad10200
to
476073e
Compare
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.
LGTM, I didn't notice any problems with the logic. Only questions and nits on comments and code organization.
} | ||
|
||
fn reveal_node_or_hash(&mut self, path: Nibbles, child: &[u8]) -> alloy_rlp::Result<()> { | ||
if child.len() == B256::len_bytes() + 1 { |
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.
can we add a comment here that if the length is 33 bytes, then it's an RLP-encoded string, and we need to skip the first byte that is the length of the string
if root_rlp.len() == B256::len_bytes() + 1 { | ||
B256::from_slice(&root_rlp[1..]) | ||
} else { |
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.
do you think it worths moving this to a separate function in alloy-trie
? this happens often and it's not straight away obvious why is it needed
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.
c42b0a6
to
c147b01
Compare
Description
Initial sketch of
SparseTrie
andStateSparseTrie
representing partially loaded Ethereum state trie.