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: eth_getProof response #12370

Merged
merged 3 commits into from
Nov 7, 2024
Merged

fix: eth_getProof response #12370

merged 3 commits into from
Nov 7, 2024

Conversation

klkvr
Copy link
Member

@klkvr klkvr commented Nov 7, 2024

keys should always be serialized as uints

@@ -7,7 +7,7 @@ use reth_trie_common::{AccountProof, StorageProof};
/// Creates a new rpc storage proof from a primitive storage proof type.
pub fn from_primitive_storage_proof(proof: StorageProof) -> EIP1186StorageProof {
EIP1186StorageProof {
key: JsonStorageKey::Hash(proof.key),
key: JsonStorageKey::Number(proof.key.into()),
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm, I think this is more nuanced than that, because the reason why this even is an enum is so we can mirror the input:

https://github.com/ethereum/go-ethereum/blob/00a73fbcce3250b87fc4160f3deddc44390848f4/internal/ethapi/api.go#L680C25-L693

so i guess we'd need to take this into account here:

https://github.com/paradigmxyz/reth/blob/main/crates/rpc/rpc-eth-api/src/helpers/state.rs#L120-L125

@mattsse mattsse added this pull request to the merge queue Nov 7, 2024
@mattsse mattsse removed this pull request from the merge queue due to a manual request Nov 7, 2024
.storage_proofs
.into_iter()
.zip(slots)
.map(|(proof, slot)| from_primitive_storage_proof(proof, slot))
Copy link
Member Author

@klkvr klkvr Nov 7, 2024

Choose a reason for hiding this comment

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

@rkrasiuk is it OK to assume same order of input slots and outputted proofs here?

Copy link
Member

Choose a reason for hiding this comment

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

it is the case rn, but i'd rather avoid such assumption since it's not documented anywhere, not covered in tests and there is no such expectation atm to proof generation

@klkvr klkvr enabled auto-merge November 7, 2024 19:16
@klkvr klkvr added this pull request to the merge queue Nov 7, 2024
Merged via the queue into main with commit 29da7d7 Nov 7, 2024
40 checks passed
@klkvr klkvr deleted the klkvr/fix-get-proof-serde branch November 7, 2024 19:46
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.

3 participants