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

generic (smart contract) event listener #921

Closed
wants to merge 1 commit into from

Conversation

zelig
Copy link
Member

@zelig zelig commented Nov 7, 2020

The PR implements an event listener as per the appendix of https://hackmd.io/o8RGsNwZSN6IE0lkBAZCPw?both (#920)
this is a prerequisite of #922 and #934 (#896).

@zelig zelig self-assigned this Nov 7, 2020
@zelig zelig changed the title postage: contract/events and listener initial commit postage: contract/events and listener Nov 7, 2020
@zelig zelig force-pushed the postage-listener branch 2 times, most recently from 3aae8ad to 0112f43 Compare November 8, 2020 23:32
@zelig zelig changed the title postage: contract/events and listener generic event listener Nov 10, 2020
@zelig zelig changed the title generic event listener generic (smart contract) event listener Nov 10, 2020
// using an event channel, we subscribe to filter logs emmitted by the postage contract(s)
// since the last block recorded that had a relevant event
events := make(chan types.Log)
sub, err := lis.client.SubscribeFilterLogs(ctx, query(from, lis.addrs...), events)
Copy link
Member

Choose a reason for hiding this comment

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

Note that this means dropping support for http and https rpc connections as the underlying eth_subscribe call is only avail on ws and ipc. (which should not be an issue, our integration tests use geth and can be switched over easily. infura also supports wss endpoints).

Copy link
Member Author

Choose a reason for hiding this comment

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

otherwise we cannot do subscription since there is no push notiffications, so what to do?

// using an event channel, we subscribe to filter logs emmitted by the postage contract(s)
// since the last block recorded that had a relevant event
events := make(chan types.Log)
sub, err := lis.client.SubscribeFilterLogs(ctx, query(from, lis.addrs...), events)
Copy link
Member

Choose a reason for hiding this comment

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

The fromBlock used to be ignored in the past (see ethereum/go-ethereum#15063). Not sure if this was fixed, will have to check this.

Copy link
Member Author

Choose a reason for hiding this comment

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

if that is the case we may need to read the historical logs to catch up
https://goethereumbook.org/event-read/

Base automatically changed from stamper to storage-incentives November 12, 2020 05:27
@acud acud force-pushed the storage-incentives branch 2 times, most recently from 134fa9a to cbd4d4a Compare December 7, 2020 15:55
@zelig zelig force-pushed the storage-incentives branch from cbd4d4a to 97b2a15 Compare December 7, 2020 19:26
@acud
Copy link
Member

acud commented Jan 11, 2021

closed in favor of #1099

@acud acud closed this Jan 11, 2021
@acud acud deleted the postage-listener branch June 19, 2021 20:02
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.

3 participants