-
Notifications
You must be signed in to change notification settings - Fork 833
client: add blockTimestamp to eth_getLogs, add tests #4074
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
client: add blockTimestamp to eth_getLogs, add tests #4074
Conversation
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.
Heya, thanks for opening this PR! I got some comments regarding the tests 😄 👍
assert.fail(`should return the correct logs (fromBlock/toBlock as 'earliest' and 'latest')`) | ||
} | ||
|
||
if (hexToBigInt(res.result[0].blockTimestamp) === block.header.timestamp) { |
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.
I think this test should assert.isEqual
or something similar here, right? The if/else statement together with assert.fail
/ assert.isTrue(true
simulates the behavior of the equal check
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.
Agreed, was just following the style of the surrounding tests, which did this a fair bit
res.result[0].blockTimestamp === oldTimestamp && | ||
res.result[10].blockTimestamp === oldTimestamp && | ||
res.result[20].blockTimestamp === newTimestamp && | ||
res.result[30].blockTimestamp === newTimestamp |
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.
This test is not very intuitive. Why should these values be these values? It seems like a range for eth_getLogs
is tested but it is not clear to me why index 10 is oldTimestamp and 20 newTimestamp for instance
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.
Pushed some changes, hopefully its clearer
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.
This LGTM. @jochem-brouwer will leave it here for you to have another round of review before we merge though.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
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.
LGTM, thanks a lot!
This PR adds
blockTimestamp
as a parameter foreth_getLogs
This is a non-standard but non-breaking change from the execution-api specs, there's an open PR for it currently: ethereum/execution-apis#639
The reth team have already gone ahead with this change over a year ago: https://github.com/paradigmxyz/reth/pull/7606/files
So I don't see any downsides in supporting this feature to signal more general support for it.
This is my first PR for ethJS, so feel free to critique / nitpick / educate me on anything that needs changing.
Thanks!