feat: add rpc endpoints eth_getBlockByNumber & eth_getBlockByHash#145
Merged
Conversation
b9007c3 to
71eabb8
Compare
71eabb8 to
af6c894
Compare
eth_getBlockByNumber & eth_getBlockByHash
fmoletta
added a commit
that referenced
this pull request
Jul 16, 2024
**Motivation** Being able to store and fetch blocks from the db via `Store` api **Description** * Replace `Transaction::encode` with `Transaction::encode_with_type` logic (Reasoning: We cannot decode the transactions without knowing their type with the current behaviour, making it impossible to implement `RLPDecode` for `Transaction`) * Implement `RLPDecode` for `Transaction` (Using the logic that was previoulsy used in `EncodedTransaction::decode` (payload module)) * Implement `RLPDecode` for `Withdrawal`, `BlockHeader` and `BlockBody` * Add the folloewng methods to `Store` and `StoreEngine`: `add_block_header`, `add_block_body`, `get_block_header`, `get_block_body`, and implement them for `InMemory` and `Libmdbx` engine types <!-- A clear and concise general description of the changes this PR introduces --> <!-- Link to issues: Resolves #111, Resolves #222 --> Closes None, but is needed for #145
…-block-number-table
…-block-number-table
7969462 to
b5051ff
Compare
c97a18d to
631dfa7
Compare
eth_getBlockByNumber & eth_getBlockByHasheth_getBlockByNumber & eth_getBlockByHash
mpaulucci
reviewed
Jul 17, 2024
fmoletta
added a commit
that referenced
this pull request
Jul 17, 2024
**Motivation** Currently, the `handle_http_requests` doesn't allow us to return an error when handling requests. This can be solved by handling them via a `map_requests` function like in `handle_authrpc_requests`. While `handle_authrpc_requests` handles comunication between clients and `handle_http_requests` handles comunication between the client and users, there are a lot of requests that are handled by both of them. As they both use the same request format, there is little reason to implement two different functions to handle the same requests in the same way. We can use `map_requests` to handle both auth_rpc and http requests, and then implement a second handler (such as `map_internal_requests`) to handle auth_prc-specific requests. <!-- Why does this pull request exist? What are its goals? --> **Description** Replaces `handle_http_requests` request handling with a call to `map_requests` <!-- A clear and concise general description of the changes this PR introduces --> <!-- Link to issues: Resolves #111, Resolves #222 --> Closes None, but addresses comment on #145
…_block_by_number
30aee3c to
17161d0
Compare
MegaRedHand
added a commit
that referenced
this pull request
Jul 18, 2024
Based on #145 **Motivation** Being able to respond to `eth_getBlockTransactionCountByNumber` requests via rpc <!-- Why does this pull request exist? What are its goals? --> **Description** Add rpc endpoint `eth_getBlockTransactionCountByNumber` <!-- A clear and concise general description of the changes this PR introduces --> <!-- Link to issues: Resolves #111, Resolves #222 --> Closes #33 --------- Co-authored-by: Tomás Grüner <47506558+MegaRedHand@users.noreply.github.com>
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.
Based on #150, please merge it first
Motivation
Comply with rpc spec for
eth_getBlockByNumberð_getBlockByHashDescription
Integrate
Storeas a state for the rpc apiAdd RPC endpoints
eth_getBlockByNumberð_getBlockByHashCloses #31