fix: eth api: current_block can be a BlockV0 #1269
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does it do?
If the call to runtime API
EthereumRuntimeRPCApi _current_block
fail in v2, just redo the API call in v1.This is because current_block actually contains the information of the previous block (perhaps the name should be changed to make it clearer).
What important points reviewers should know?
Ideally we should use the previous block to ask for the version of the runtime API, but in this part of the code we don't have easy access to the hash of the previous block, so it's easier to just recall the runtime API in v1 in case of failure.
Is there something left for follow-up PRs?
What alternative implementations were considered?
Are there relevant PRs or issues in other repositories (Substrate, Polkadot, Frontier, Cumulus)?
What value does it bring to the blockchain users?