You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7387ebf
Browse filesBrowse the repository at this point in the historyBrowse files
authored
Stop log filters failing forever once their cursor is pruned (#4591)
A log filter whose cursor is below the earliest available block fails
every `eth_getFilterChanges` with "requested fromBlock N is before
earliest available block M" and never recovers. That happens for
`fromBlock: "earliest"` (block 0, so even on a node that never pruned),
for a numeric `fromBlock` older than the node's earliest block, and for
a filter that pruning overtakes between polls. `eth_subscribe("logs")`
errors and ends the same way. The cursor is handed to the strict bounds
check as is, and since a failed poll does not move it, every later poll
fails on the same height.
`eth_newFilter` and `eth_subscribe` now reject a numeric `fromBlock`
above 0 that is already below the earliest available block, with the
same error `eth_getLogs` gives for that range, so the client learns at
creation that the history it asked for is gone. A `fromBlock` of 0,
which is also what `earliest` resolves to, asks for whatever the node
has and polls from the earliest block. When pruning passes the cursor of
a live filter, the next poll fails once with "logs of blocks X to Y were
pruned before the filter read them" and moves the cursor to the earliest
block, so the following poll carries on from there; a subscription
notifies that error and ends. The evmrpc guide describes the new
behaviour.
Fixes PLT-1520
---------
Co-authored-by: alexander-sei <alexanderh@seinetwork.io>
Co-authored-by: Cursor <cursoragent@cursor.com>
Copy file name to clipboardExpand all lines: evmrpc/AGENTS.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ EVM RPCs prefixed by `eth_` and `debug_` on Sei generally follows [Ethereum's sp
42
42
-`eth_newPendingTransactionFilter`
43
43
-`eth_syncing`
44
44
-`eth_getProof` — deprecated rather than permanently incompatible; the message directs callers who need proofs to the Sei team.
45
-
- **Log filters poll from a cursor.** `eth_newFilter` fixes where its polls start, once: a numeric `fromBlock` as given, otherwise the block after the head at creation; a numeric `toBlock` below that start is rejected. Each `eth_getFilterChanges` scans from that cursor to the head, or to a numeric `toBlock` below it; a tag `toBlock` such as `latest` follows the head and never ends the filter. A poll covers at most `max_blocks_for_log` blocks, and fewer when its logs exceed the log caps; later polls return the rest. A block whose logs alone exceed the caps fails the poll that reaches it with an error naming the block, and the filter or subscription continues after it. Unlike geth, a numeric `fromBlock` in the past makes the first poll return that history. `eth_getFilterLogs` resolves tags when called and never moves the cursor. `eth_subscribe("logs")` polls through the same cursor logic, and treats a `fromBlock` of 0 with a tag `toBlock`, which ethclient sends for an open-ended query, as an omitted `fromBlock`. A failed subscription poll notifies `{"error": message}` in place of logs, adding the skipped block's `blockNumber` when the subscription continues past an oversized block; any other failure ends the subscription.
45
+
- **Log filters poll from a cursor.** `eth_newFilter` fixes where its polls start, once: a numeric `fromBlock` (or `earliest`, which is block 0) as given, otherwise the block after the head at creation; a numeric `toBlock` below that start is rejected. Each `eth_getFilterChanges` scans from that cursor to the head, or to a numeric `toBlock` below it; a tag `toBlock` such as `latest` follows the head and never ends the filter. A numeric `fromBlock` above 0 that is below the earliest available block is rejected, while a `fromBlock` of 0 polls from that block. When pruning passes the cursor of a filter, its next poll fails with an error naming the pruned blocks, and the filter continues from the earliest block. A poll covers at most `max_blocks_for_log` blocks, and fewer when its logs exceed the log caps; later polls return the rest. A block whose logs alone exceed the caps fails the poll that reaches it with an error naming the block, and the filter or subscription continues after it. Unlike geth, a numeric `fromBlock` in the past makes the first poll return that history. `eth_getFilterLogs` resolves tags when called and never moves the cursor. `eth_subscribe("logs")` polls through the same cursor logic, and treats a `fromBlock` of 0 with a tag `toBlock`, which ethclient sends for an open-ended query, as an omitted `fromBlock`. A failed subscription poll notifies `{"error": message}` in place of logs, adding the skipped block's `blockNumber` when the subscription continues past an oversized block; any other failure, pruned blocks included, ends the subscription.
46
46
47
47
## `sei_` prefixed endpoints
48
48
The legacy `sei_` namespace contains address and Cosmos transaction helpers.
0 commit comments