fix: block parsing for account-related etc rpc endpoints#256
Merged
Conversation
This was referenced Aug 15, 2024
ElFantasma
reviewed
Aug 16, 2024
ElFantasma
left a comment
Contributor
There was a problem hiding this comment.
Is it not possible to include the Hash variant within BlockIdentifier instead of creating a new enum?
Or there are cases where BlockHash is not allowed?
Contributor
Author
Yes, not all enpoints allow block hash as a valid input |
ElFantasma
approved these changes
Aug 16, 2024
…rpc-requests-block-parsing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
Rpc endpoints such as
etc_getBalance,eth_getStorageAt, etc can receive either the block number, block hash, or tag as theblockfield. We are currently using the sameBlockIdentifierstruct that we use on other rpc endpoints that only accept block number or block tag, leading to failures when parsing hive rpc requests.This PR aims to fix this issue by introducing a
BlockIdentifierOrHashstruct which leverages the functionality ofBlockIdentifierand adds the hash variantDescription
BlockIdentifierOrHashto parse block values in account-related rpc endpointsresolve_block_numberto aBlockIdentifiermethod to avoid name clashesresolve_block_numberforBlockIdentifierOrHashCloses None, but fixes parsing errors on hive tests