-
Notifications
You must be signed in to change notification settings - Fork 41
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
feat: add rpc endpoints eth_getBlockByNumber
& eth_getBlockByHash
#145
Merged
Conversation
This file contains 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
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_getBlockByHash
eth_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
30aee3c
to
17161d0
Compare
MegaRedHand
approved these changes
Jul 18, 2024
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.
Great work!!
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>
mpaulucci
pushed a commit
to mpaulucci/lambda_ethereum_rust
that referenced
this pull request
Oct 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 lambdaclass#111, Resolves lambdaclass#222 --> Closes None, but is needed for lambdaclass#145
mpaulucci
pushed a commit
to mpaulucci/lambda_ethereum_rust
that referenced
this pull request
Oct 16, 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 lambdaclass#111, Resolves lambdaclass#222 --> Closes None, but addresses comment on lambdaclass#145
mpaulucci
pushed a commit
to mpaulucci/lambda_ethereum_rust
that referenced
this pull request
Oct 16, 2024
…lambdaclass#145) Based on lambdaclass#150, please merge it first **Motivation** Comply with rpc spec for `eth_getBlockByNumber` & `eth_getBlockByHash` <!-- Why does this pull request exist? What are its goals? --> **Description** * Integrate `Store` as a state for the rpc api * Add RPC endpoints `eth_getBlockByNumber` & `eth_getBlockByHash` <!-- A clear and concise general description of the changes this PR introduces --> <!-- Link to issues: Resolves lambdaclass#111, Resolves lambdaclass#222 --> Closes lambdaclass#31
mpaulucci
pushed a commit
to mpaulucci/lambda_ethereum_rust
that referenced
this pull request
Oct 16, 2024
…class#152) Based on lambdaclass#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 lambdaclass#111, Resolves lambdaclass#222 --> Closes lambdaclass#33 --------- Co-authored-by: Tomás Grüner <47506558+MegaRedHand@users.noreply.github.com>
mpaulucci
pushed a commit
to mpaulucci/lambda_ethereum_rust
that referenced
this pull request
Oct 16, 2024
Based on lambdaclass#145 **Motivation** Support rpc endpoint `eth_getBalance` **Description** Add rpc endpoint `eth_getBalance` <!-- A clear and concise general description of the changes this PR introduces --> <!-- Link to issues: Resolves lambdaclass#111, Resolves lambdaclass#222 --> Closes lambdaclass#36
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
ð_getBlockByHash
Description
Integrate
Store
as a state for the rpc apiAdd RPC endpoints
eth_getBlockByNumber
ð_getBlockByHash
Closes #31