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 9272d31
Browse filesBrowse the repository at this point in the historyBrowse files
authored
Backport release/v6.8: EvmRpc: add admission checks for eth_getFilterLogs and eth_getFilterChanges (#4705)
Backport of #4701 to `release/v6.8`.
Co-authored-by: Yasin <64729564+kollegian@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.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` (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.
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_getLogs`, `eth_getFilterLogs` and each `eth_getFilterChanges` poll pass the same admission before reading anything: `eth_getLogs` and `eth_getFilterLogs` are refused for a range over `max_blocks_for_log`, which a poll never covers; a range over 100 blocks takes a token from one large-query rate limit shared by all three, and without one `eth_getLogs` and `eth_getFilterLogs` are refused while a poll scans only the next 100 blocks, so a filter that has fallen behind keeps advancing and catches up as long as it is polled more often than every 100 blocks of chain time (a slower poller falls further behind, and a cut poll looks like any other on the wire); and any read is refused while the worker queue or the DB read semaphore is 80% used, as seen when it arrives, so a burst of concurrent reads can pass together and only the worker queue's capacity bounds it. The rate and load refusals carry code `-32005` (limit exceeded, retry later). A refused poll leaves the cursor where it was, so the next poll retries the same blocks. Subscription polls are not admitted. `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
-**Block filters.** Under Autobahn, `eth_newBlockFilter` collects hashes from the `BlockHeaderNotifier`, and a filter holding `max_block_filter_hashes` unpolled hashes is removed. Otherwise there is no notifier, and the filter polls the CometBFT block store from a cursor that starts at the block after the head at creation, so no poll returns a block from before the filter existed. Each `eth_getFilterChanges` covers at most `max_block_filter_hashes` heights from the cursor up to the head and returns their hashes oldest first; later polls cover the rest. A block store read failure leaves the cursor where it was, so the next poll retries the same heights. When pruning passes the cursor, before or during a poll, that poll fails with a `-32000` error naming the pruned blocks, and the filter continues from the earliest block. Concurrent polls of one filter may return the same hashes. `eth_getFilterLogs` rejects a block filter as not existing, as geth does.
0 commit comments