Skip to content
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

recognize from and to block parameters in eth subscribe #826

Merged
merged 10 commits into from
May 3, 2020

Conversation

RatanRSur
Copy link
Contributor

@RatanRSur RatanRSur commented May 1, 2020

PR description

Geth sneakily accepts from and to blocks in its websocket log subscriptions parameters. This extends the websocket subscription to be able to take block parameters. That makes us compatible with their implementation and also our http and ws filter parameters align.

Fixed Issue(s)

fixes #654

@RatanRSur RatanRSur marked this pull request as draft May 1, 2020 02:09
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
@RatanRSur RatanRSur marked this pull request as ready for review May 1, 2020 18:06
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Copy link
Contributor

@shemnon shemnon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. @lucassaldanha may want to take a quick pass to make sure we don't break the new privacy filtering.

Copy link
Member

@lucassaldanha lucassaldanha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT

.map(blockHash -> blockchain.matchingLogs(blockHash, filter.getLogsQuery()))
.orElseGet(
() -> {
final long fromBlockNumber = filter.getFromBlock().getNumber().orElse(0);
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 we should update this to be the headBlockNumber as well. This seems to be the "default" for Geth APIs. And probably update the PrivGetLogs as well.

I'm happy to do this in another PR is you don't wanna mix up with the other changes! :)

https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

golang ethereum client: github.com/ethereum/go-ethereum cannot subscribe to log events via websocket
3 participants