feat: rpc call 'eth_getLogs'#360
Merged
Merged
Conversation
mpaulucci
reviewed
Sep 10, 2024
mpaulucci
reviewed
Sep 17, 2024
mpaulucci
reviewed
Sep 17, 2024
mpaulucci
reviewed
Sep 19, 2024
mpaulucci
reviewed
Sep 19, 2024
mpaulucci
reviewed
Sep 19, 2024
mpaulucci
reviewed
Sep 19, 2024
mpaulucci
reviewed
Sep 19, 2024
mpaulucci
reviewed
Sep 19, 2024
mpaulucci
left a comment
Collaborator
There was a problem hiding this comment.
looking good! some minor comments
mpaulucci
reviewed
Sep 25, 2024
mpaulucci
reviewed
Sep 25, 2024
mpaulucci
reviewed
Sep 25, 2024
fmoletta
reviewed
Sep 26, 2024
Comment on lines
+88
to
+93
| let Ok(Some(from)) = self.from_block.resolve_block_number(&storage) else { | ||
| return Err(RpcErr::WrongParam("fromBlock".to_string())); | ||
| }; | ||
| let Ok(Some(to)) = self.to_block.resolve_block_number(&storage) else { | ||
| return Err(RpcErr::WrongParam("toBlock".to_string())); | ||
| }; |
Contributor
There was a problem hiding this comment.
Suggested change
| let Ok(Some(from)) = self.from_block.resolve_block_number(&storage) else { | |
| return Err(RpcErr::WrongParam("fromBlock".to_string())); | |
| }; | |
| let Ok(Some(to)) = self.to_block.resolve_block_number(&storage) else { | |
| return Err(RpcErr::WrongParam("toBlock".to_string())); | |
| }; | |
| let Some(from) = self.from_block.resolve_block_number(&storage)? else { | |
| return Err(RpcErr::WrongParam("fromBlock".to_string())); | |
| }; | |
| let Some(to) = self.to_block.resolve_block_number(&storage)? else { | |
| return Err(RpcErr::WrongParam("toBlock".to_string())); | |
| }; |
A StorageError here means failure to read from the DB, it doesn't mean that the parameter in the request is wrong. StorageErrors get mapped to RpcErr::Internal which is the correct error to return for these cases.
Contributor
Author
There was a problem hiding this comment.
But what if we were given a block number higher than what exists? Shouldn't that be a wrong parameter?
We can do the following:
- Return WrongParam if we were given a block number.
- Return an Internal error if we were given a tag.
Collaborator
There was a problem hiding this comment.
I think she is suggesting something like this
let block_number = self
.from_block
.resolve_block_number(&storage)?
.ok_or(RpcErr::WrongParam("fromBlock".to_string())?;
If resolve_block_number returns an error, it will be sent as StoreError and converted into InternalError
mpaulucci
approved these changes
Oct 1, 2024
mpaulucci
pushed a commit
that referenced
this pull request
Oct 16, 2024
**Motivation** - One of the milestones is to have an endpoint to fetch transaction logs, which describe events emitted by certain addresses. **Description** - Add parser and handler for the mentioned endpoint. <!-- A clear and concise general description of the changes this PR introduces --> <!-- Link to issues: Resolves #111, Resolves #222 --> Closes #333
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
by certain addresses.
Description
Closes #333