-
Notifications
You must be signed in to change notification settings - Fork 20.3k
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, les: add error when accessing missing block state #18346
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This might break the RPC APIs. I did a similar refactor a while back and it borked a lot of higher level client libraries which relied on missing blocks returning |
BTW, there is more recent discussion at #18254 since #3483 had been marked deprecated. @karalabe do you remember which client libraries were impacted? We could look at them and see if a) they still make that assumption and b) any work-arounds that could be implemented. Ideally we can come up with a clever way forward that allows for an explicit error without breaking these clients too badly. |
cloud you please add testing to stub the case. the project missing many testing , please don't miss it anymore. |
I agree that API breaking should be a last resort, and maybe querying the future block can retain its current behavior. The concern raised in #18254 is more general than this method: There is currently inconsistent behavior across different methods when querying future blocks, and some of those error responses are indistinguishable from successful responses, which should be the subject of possible breaking changes here. A good example is the case of calling While returning For that reason I hope this PR's concerns aren't blocking a more general "default to error when querying an unknown block" solution which would only be breaking things that are already broken, for the sake of fixing them. |
any update? i don't clear howto in process doing on this patch? |
This impacts: getBalance, getCode, getStorageAt, getProof, call, getTransactionCount. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change StateAndHeaderByNumber in les/api_backend.go to include the same treatment of header == nil
.
done, ptal @fjl |
ping @fjl to add tests to this one, and merge it in |
rebased and tests added |
Supersedes #15762 . It was not properly goimport-formatted, so I fixed that and refactored it a bit more. Thanks @shbli for the PR!
For release notes:
This change makes getBalance, getCode, getStorageAt, getProof, call, getTransactionCount return an error if the block number in the request doesn't exist. getHeaderByNumber still returns
null
for missing headers.