You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Requesting a block by hash AND number using graphql should only return the block if both are valid.
Actual behaviour
If both arguments are set Go-Ethereum only cares about the number and ignores the hash argument. This could cause an unsuspecting user to assume he got the block he wants.
The query description does not inform the user about this (non-intuitive in my opinion) behavior either:
Block fetches an Ethereum block by number or by hash. If neither is supplied, the most recent known block is returned.
Steps to reproduce the behaviour
Submit the following GraphQL request to Go-Ethereum (with hash beeing different from the real hash at that number, this is on Goerli):
query testBlockWithConflictingHashAndNumber {
conflicting:block(number:7670343, hash:"0x37bea088a214c679358d6af9d54442151ec34cb5dcc58f0f5b6e572e01e6ed1f") {
number
hash
parent{hash}
}
number:block(number:7670343) {
number
hash
parent{hash}
}
hash:block(hash:"0x37bea088a214c679358d6af9d54442151ec34cb5dcc58f0f5b6e572e01e6ed1f") {
number
hash
parent{hash}
}
}
Look at the response. The first entry returns a block with the expected number but a different hash, completely ignoring the hash argument instead of detecting this and returning there is no block with this hash and number.
System information
Geth version:
1.10.25-stable
(and current master)Expected behaviour
Requesting a block by hash AND number using graphql should only return the block if both are valid.
Actual behaviour
If both arguments are set Go-Ethereum only cares about the number and ignores the hash argument. This could cause an unsuspecting user to assume he got the block he wants.
The query description does not inform the user about this (non-intuitive in my opinion) behavior either:
Steps to reproduce the behaviour
Edit:
This becomes even clearer when setting hash to 0x0000..0000:
Results in:
And happily returns the "conflicting" block.
The text was updated successfully, but these errors were encountered: