Skip to content

Conversation

SanLeo461
Copy link
Contributor

This PR adds blockTimestamp as a parameter for eth_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!

Copy link
Member

@jochem-brouwer jochem-brouwer left a 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) {
Copy link
Member

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

Copy link
Contributor Author

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
Copy link
Member

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

Copy link
Contributor Author

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

Copy link
Contributor

@acolytec3 acolytec3 left a 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.

Copy link

codecov bot commented May 12, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 79.39%. Comparing base (539aaed) to head (890d22c).
Report is 3 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 84.33% <ø> (ø)
blockchain 89.32% <ø> (ø)
client 67.58% <0.00%> (-0.01%) ⬇️
common 97.45% <ø> (ø)
devp2p 86.78% <ø> (ø)
evm 73.11% <ø> (ø)
mpt 89.74% <ø> (+0.46%) ⬆️
statemanager 69.06% <ø> (ø)
static 99.11% <ø> (ø)
tx 89.89% <ø> (ø)
util 89.16% <ø> (ø)
vm 55.50% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@jochem-brouwer jochem-brouwer left a 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!

@acolytec3 acolytec3 merged commit e74a502 into ethereumjs:master May 16, 2025
39 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants