-
Notifications
You must be signed in to change notification settings - Fork 412
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
Fix eth_getlogs not returning error when receipt is unavailable #4056
Fix eth_getlogs not returning error when receipt is unavailable #4056
Conversation
Generally fine, but I think here we are clipping to block, do we want to do that? Other small thing not sure if it should be ResourceNotFound or ResourceUnavailable? |
Missed the clip thing. As for the ResourceNotFound or ResourceUnavailable, it seems that other RPC that can't run when state is unavailable respond with ResourceUnavailable, but currently, if the block is not found (as in header not found, not just receipt), it returns, resourceNotFound. So.. I don't know. |
@@ -63,18 +63,29 @@ public class LogFinder : ILogFinder | |||
public IEnumerable<FilterLog> FindLogs(LogFilter filter, CancellationToken cancellationToken = default) | |||
{ | |||
BlockHeader FindHeader(BlockParameter blockParameter, string name, bool headLimit) => | |||
_blockFinder.FindHeader(blockParameter, headLimit) ?? throw new ArgumentException("Block not found.", name); | |||
_blockFinder.FindHeader(blockParameter, headLimit) ?? throw new ResourceNotFoundException($"Block not found: {name}"); |
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.
Can we also include BlockParameter in error message?
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.
Seems to already do it via the name
parameter.
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.
No its just nameof(filter.ToBlock), lets add what was that what we are missing (blocknumber, hash)
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.
Ok, I suppose a simple .ToString()
is enough?
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.
yes just drop it somewhere in the pattern in some good way
baf2c64
to
5584d97
Compare
Fixes #3983
Changes:
HasBlock
method toIReceiptStorage
.ReceiptPersistentStorage
implemented it by checking its cache first, then the blocks column.LogFinder
will checkHasBlock
on first and last block and will throwResourceNotFoundException
if receipt not found.EthRpcModule
will return resource not found code whenResourceNotFoundException
is encountered.Types of changes
Testing
In case you checked yes, did you write tests??
Comments about testing , should you have some (optional)