go-ethereum icon indicating copy to clipboard operation
go-ethereum copied to clipboard

eth/filters: subscribe history logs

Open jsvisa opened this issue 1 year ago • 5 comments

This is the second part of #15063

jsvisa avatar Jun 08 '23 09:06 jsvisa

I have some misgivings about how we handle block ranges right now. IMO block ranges specifically for the live mode are not necessary. I.e. when you subscribe you get the logs for all new blocks. To make my case web3.js only lets you specify FromBlock (no ToBlock) and ethers.js doesn't support any of those parameters. These are 2 of the biggest web3 libraries.

My suggestion is we can simplify this greatly by: only allowing FromBlock and only for specifying historical blocks. I.e. FromBlock should be either a number below head block or safe or finalized. Later on we can allow ToBlock (for historical range queries).

s1na avatar Jun 15 '23 14:06 s1na

@s1na lgtm, and as we discussed offline, seems we have more work to do, I'll post them here(in case I forget).

  • [ ] support block range subscription;
  • [ ] support server active close connection;

jsvisa avatar Jun 19 '23 02:06 jsvisa

I like @s1na's idea to not allow toBlock for subscription queries. The problem with using our subscription model is that there is no way for the server to signal the end of a subscription. We can fix that by changing how subscriptions work, but I think that will be a lot of work for everyone to support. Let's try the simple solution for now.

fjl avatar Jun 22 '23 14:06 fjl

why not merge it ?

cong08 avatar Feb 01 '24 08:02 cong08

why not merge it ?

@karalabe @rjl493456442

cong08 avatar Feb 20 '24 08:02 cong08