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: proof verification #8220

Merged
merged 5 commits into from
May 14, 2024
Merged

feat: proof verification #8220

merged 5 commits into from
May 14, 2024

Conversation

rkrasiuk
Copy link
Member

@rkrasiuk rkrasiuk commented May 13, 2024

Description

Integrate proof verification introduced in alloy-rs/trie#13. Closes #8175

@rkrasiuk rkrasiuk marked this pull request as ready for review May 13, 2024 18:25
Copy link
Member

@gakonst gakonst left a comment

Choose a reason for hiding this comment

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

lgtm

/// Verify the proof against the provided storage root.
pub fn verify(&self, root: B256) -> Result<(), ProofVerificationError> {
let expected =
if self.value.is_zero() { None } else { Some(encode_fixed_size(&self.value).to_vec()) };
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if self.value.is_zero() { None } else { Some(encode_fixed_size(&self.value).to_vec()) };
// If the storage `value` is Zero then it's no longer part of the trie
if self.value.is_zero() { None } else { Some(encode_fixed_size(&self.value).to_vec()) };

this could also probably be self.value.encode() given U256: RlpEncodable seems like footgun

address,
info: None,
proof: Vec::new(),
storage_root: EMPTY_ROOT_HASH,
Copy link
Member

Choose a reason for hiding this comment

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

This was a bug

@rkrasiuk rkrasiuk force-pushed the rkrasiuk/account-proof-verification branch from c074975 to 2910d21 Compare May 14, 2024 15:14
@rkrasiuk rkrasiuk enabled auto-merge May 14, 2024 15:26
@rkrasiuk rkrasiuk added this pull request to the merge queue May 14, 2024
Merged via the queue into main with commit d1f38f1 May 14, 2024
29 checks passed
@rkrasiuk rkrasiuk deleted the rkrasiuk/account-proof-verification branch May 14, 2024 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EIP1186AccountProofResponse verification against state root
2 participants