-
Notifications
You must be signed in to change notification settings - Fork 20.5k
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
eth_getProof
implementation does not conform to EIP-1186
#27306
Comments
It is what it is. The API spec at https://github.com/ethereum/execution-apis defines the storage keys as bytes (not QUANTITY). The EIP might be more correct but it's old, slightly inconsistent and can't be changed anymore. The confusion about this has unfortunately leaked into the spec a little bit, but let's just leave it how it is. |
If there is a specific hive test that should be changed to better reflect the spec's intended meaning, we could do that. |
Spec links: |
Changing output to |
Geth is a bit more lenient than the spec, mostly for historical reasons. So you can, for example, submit a request for storage key However Geth's behavior should not be used as the example here. Again, if there is a specific RPC test containing the Geth behavior of mirroring an invalid value, we could always change the test. I don't think it's a good idea to change Geth's handling of input for this request, because that would be an incompatible API change. In our internal discussion about this issue, I was in favor of changing the behavior to mirror the 'sanitized' value into the output, but other people in the team were against it. |
To add some context, I've already encountered this with stored JSON proofs in the wild. I'm not sure which RPC client is sending invalid input, but it results in either Geth's incorrect return types propagating through client libraries, or a set of real-world proof JSON response which ethers-rs cannot parse. In addition, I've already pointed out one case above where the poor specification and incorrect behavior caused incorrect changes in another execution client. So the idea that Geth's behavior should not be used as an example is a bit ivory-tower-y. RPC client implementers must handle the behavior, and EL implementers must encounter it during compatibility testing Okay to recap, (and please correct any of these points if i've misread)
Please tag |
I closed this because we got stuck on the However, there is a legitimate issue here where geth can create outputs that do not match the
|
Yes, I am not married to either quantity or bytes, but I would really appreciate it if the output were canonical for one of those formats |
A spec-compliant server implementation should validate the parameter as |
#27309) This changes the eth_getProof method implementation to re-encode the requested storage keys, canonicalizing them in the response. For backwards-compatibility reasons, go-ethereum accepts non-canonical hex keys. Accepting them is fine, but we should not mirror invalid inputs into the output. Closes #27306 --------- Co-authored-by: Martin Holst Swende <[email protected]> Co-authored-by: Felix Lange <[email protected]>
The hive test looks like it's fixed (aka does not require the mirrored |
ethereum#27309) This changes the eth_getProof method implementation to re-encode the requested storage keys, canonicalizing them in the response. For backwards-compatibility reasons, go-ethereum accepts non-canonical hex keys. Accepting them is fine, but we should not mirror invalid inputs into the output. Closes ethereum#27306 --------- Co-authored-by: Martin Holst Swende <[email protected]> Co-authored-by: Felix Lange <[email protected]>
Apologies for excessive links, have tried to cite all sources
Description
1186 is inconsistent wrt specification of input to
eth_getProof
. It specifies the 2nd element of the param array a an array of 32-byte keys, and refers to theeth_getStorageAt
call, which is specced in 1474 and on the ethereum website. 1474 specifies the input as a Quantity.Currently Geth accepts as input all of:
eth_getProof
spec)eth_getStorageAt
spec)The issue arises because
response.storageProof.key
is specced as a Quantity, however, geth simply mirrors the input into the response object. When the input is a non-Quantity hex string (e.g.0x000000005
, the returnedresponse.storageProof[].key
is also not minimal. This is outside the spec for Quantity, and is off-spec for 1186Both 1186 and 1474 are currently status Stagnant, and may not be reliable. Permissive deserialization seems desirable. Providing non-canonical returns to the user seems undesirable
This was previously mentioned in a besu issue as a result of failing hive tests with geth producing non-canonical Quantities in responses. I am unsure if it was ever brought up here. The Besu team opted to change their RPC behavior to always represent this value as an even-length hex string, which is also off-spec.
Requested change is to always Quantity-serialize the
key
element in the response, rather than simply mirroring the input.Expected behaviour
eth_getProof
response object should Quantity-encode `storageProof.keys, regardless of whether the input was quantity-encodedExpected output :
Steps to reproduce the behaviour
Actual behaviour
see the
0x000000005
storageProof.key`. This is not a Quantity, and is outside of spec for the endpointThe text was updated successfully, but these errors were encountered: