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

Failed to deserialize the empty key of storage proof in EIP1186ProofResponse (for Mainnet) #2753

Closed
silathdiir opened this issue Mar 3, 2024 · 0 comments · Fixed by #2754
Labels
bug Something isn't working

Comments

@silathdiir
Copy link
Contributor

Version
ethers v2.0.11

Platform
MacOS

Description

Download the EIP1186ProofResponse data to deserialize:

curl https://eth.llamarpc.com \
  -X POST \
  -H "Content-Type: application/json" \
V  --data '{"method":"eth_getProof","params":["0x105dD0eF26b92a3698FD5AaaF688577B9Cafd970",["0"],"latest"],"id":1,"jsonrpc":"2.0"}' > tmp_proof_empty_key.json

# Unnecessary to format the JSON.
cat tmp_proof_empty_key.json | jq > proof_empty_key.json
cp proof_empty_key.json ethers-core/testdata/proof_empty_key.json

Edit ethers-core/testdata/proof_empty_key.json to delete JSON RPC header:

{
-   "jsonrpc": "2.0",
-   "id": 1,
-   "result": {
  "accountProof": [
...
-  }
}

Add this test cases to ethers-core/src/types/proof.rs:

#[test]
fn can_deserialize_proof_empty_key() {
    serde_json::from_str::<EIP1186ProofResponse>(include_str!(
        "../../testdata/proof_empty_key.json"
    ))
    .unwrap();
}

And run the test:

cargo test -- can_deserialize_proof_empty_key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant