feat(cketh): scan and detect ETH deposits - #11508
Draft
gregorydemay wants to merge 2 commits into
Draft
Conversation
The native-ETH sibling of the ERC-20 balance batcher: a 78-byte create-style eth_call program that reads [n][holder x n] appended after its code and returns each holder's ETH balance via the BALANCE opcode, in the same flat n x 32 layout so the decoder is shared. No sub-calls, so unlike the ERC-20 batcher it has no revert path. Validated against a live anvil node, including agreement with the node's own view of every balance. The ERC-20 program is untouched. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016Yv31YXb6YH1Gp71G54cL9
The balance-scan tick now partitions its due pairs by asset and sends two batched eth_calls pinned to the same latest block: the untouched ERC-20 batcher first, then the new ETH batcher. An ETH balance at or above the 0.005 ETH minimum is detected and queued for sweeping exactly like a token balance, so deposit_eth reports AwaitingSweep. Queued ETH entries are not batched into sweeps yet: the sweepEthBatch lane comes in a follow-up, which is also why the reachable-from-now todo in the sweep batching becomes an explicit skip. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016Yv31YXb6YH1Gp71G54cL9
gregorydemay
added this pull request to stack #11500
September 9, 2026 07:04
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Low-level EVM bytecode and mixed-asset deposit processing require final human review.
Pull request overview
Adds native ETH deposit scanning and queues qualifying deposits for future sweeping.
Changes:
- Adds a deployless EVM batcher for ETH balances.
- Splits ETH and ERC-20 scans while pinning them to the same block.
- Detects qualifying ETH deposits but excludes them from current sweep batches.
File summaries
| File | Description |
|---|---|
rs/ethereum/cketh/test_utils/src/ckerc20.rs |
Supports mocked mixed-asset scans. |
rs/ethereum/cketh/test_utils/src/anvil.rs |
Adds an ETH transfer helper. |
rs/ethereum/cketh/minter/tests/deposit_from_cex.rs |
Validates the ETH batcher against Anvil. |
rs/ethereum/cketh/minter/tests/ckerc20.rs |
Tests ETH detection and mixed scans. |
rs/ethereum/cketh/minter/src/state/automatic_deposits/tests.rs |
Tests ETH targets and sweep exclusion. |
rs/ethereum/cketh/minter/src/state/automatic_deposits/mod.rs |
Enables ETH targets and skips ETH sweeping. |
rs/ethereum/cketh/minter/src/balance_scan/tests.rs |
Adapts ERC-20 scan tests. |
rs/ethereum/cketh/minter/src/balance_scan/mod.rs |
Implements partitioned ETH/ERC-20 scanning. |
rs/ethereum/cketh/minter/src/balance_scan/batcher/tests.rs |
Verifies ETH bytecode and encoding. |
rs/ethereum/cketh/minter/src/balance_scan/batcher/mod.rs |
Implements the ETH balance batcher. |
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #11499. Third step of the
deposit_ethflow per the spec: an armed(account, ETH)pair is now actually scanned and, when funded with at least 0.005 ETH, detected and queued for sweeping —deposit_ethreportsAwaitingSweep.BALANCEopcode and returns them in the same flat layout as the ERC-20 batcher, so the decoder is shared. The validated ERC-20 program is byte-identical — chosen over extending it with a zero-token-slot branch, which would have re-assembled the whole program. Validated against a live anvil node, including agreement with the node's own view of every balance.sweepEthBatchlane comes in a follow-up (behind the delegation-record work per the spec's delivery order), which is also why the sweep-batchingtodo!became an explicit skip. The spec's phase-2 wording (zero address in the token slot) needs a small amendment in docs(cketh): specify ETH deposits on the shared address and sweeper delegate rotation #11491 to record the separate-program choice.🤖 Generated with Claude Code
https://claude.ai/code/session_016Yv31YXb6YH1Gp71G54cL9