test(cketh): teach the live harness to deploy and drive the sweep contracts - #11259
Closed
gregorydemay wants to merge 2 commits into
Closed
test(cketh): teach the live harness to deploy and drive the sweep contracts#11259gregorydemay wants to merge 2 commits into
gregorydemay wants to merge 2 commits into
Conversation
gregorydemay
force-pushed
the
greg/DEFI-2926-enqueue-batched-sweep
branch
from
August 21, 2026 14:46
6344a8d to
ce8f921
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-anvil-sweep-harness
branch
from
August 21, 2026 14:46
f136aca to
d741cac
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-enqueue-batched-sweep
branch
from
August 25, 2026 07:16
ce8f921 to
21711b3
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-anvil-sweep-harness
branch
from
August 25, 2026 07:16
d741cac to
4d0133d
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-enqueue-batched-sweep
branch
from
August 25, 2026 10:05
21711b3 to
4f2146b
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-anvil-sweep-harness
branch
from
August 25, 2026 10:05
4d0133d to
461eaba
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-enqueue-batched-sweep
branch
from
August 25, 2026 11:21
4f2146b to
32aeffc
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-anvil-sweep-harness
branch
from
August 25, 2026 11:21
461eaba to
954ac72
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-enqueue-batched-sweep
branch
from
August 25, 2026 12:53
32aeffc to
e4933e1
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-anvil-sweep-harness
branch
from
August 25, 2026 12:55
954ac72 to
cd56d0a
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-enqueue-batched-sweep
branch
from
August 25, 2026 13:05
e4933e1 to
68aa462
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-anvil-sweep-harness
branch
from
August 25, 2026 13:05
cd56d0a to
a988856
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-enqueue-batched-sweep
branch
from
August 25, 2026 13:17
68aa462 to
bb73432
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-anvil-sweep-harness
branch
from
August 25, 2026 13:17
a988856 to
b02f84d
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-enqueue-batched-sweep
branch
2 times, most recently
from
August 25, 2026 14:23
54fa93a to
1d54656
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-anvil-sweep-harness
branch
from
August 25, 2026 14:27
b02f84d to
741e33a
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-enqueue-batched-sweep
branch
from
August 25, 2026 14:32
1d54656 to
56569ec
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-anvil-sweep-harness
branch
from
August 25, 2026 14:32
741e33a to
bf87e2e
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-enqueue-batched-sweep
branch
2 times, most recently
from
August 25, 2026 15:44
fca3bc8 to
4ee7b66
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-anvil-sweep-harness
branch
from
August 25, 2026 15:45
bf87e2e to
80c65bb
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-enqueue-batched-sweep
branch
from
August 25, 2026 15:50
4ee7b66 to
f2c5e04
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-anvil-sweep-harness
branch
from
August 25, 2026 15:50
80c65bb to
6814d95
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-enqueue-batched-sweep
branch
from
August 26, 2026 05:55
f2c5e04 to
2624c58
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-anvil-sweep-harness
branch
2 times, most recently
from
August 26, 2026 06:00
104b780 to
f16ec5a
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-enqueue-batched-sweep
branch
from
August 26, 2026 06:00
2624c58 to
a383003
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-anvil-sweep-harness
branch
from
August 26, 2026 07:10
6a777e9 to
3da307d
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-enqueue-batched-sweep
branch
from
August 26, 2026 08:56
f348965 to
f57f592
Compare
gregorydemay
commented
Aug 26, 2026
| /// authorizations can advance it. | ||
| pub async fn enqueue_batched_sweep() { | ||
| let _guard = match TimerGuard::new(TaskType::SweeperSend) { | ||
| let _guard = match TimerGuard::new(TaskType::SweeperEnqueue) { |
Contributor
Author
There was a problem hiding this comment.
why does this change? Why is SweeperEnqueue added?
gregorydemay
force-pushed
the
greg/DEFI-2926-enqueue-batched-sweep
branch
from
August 26, 2026 11:51
f57f592 to
330569e
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-anvil-sweep-harness
branch
from
August 26, 2026 11:51
2295f0b to
2bb495f
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-enqueue-batched-sweep
branch
6 times, most recently
from
August 26, 2026 16:38
b56bfeb to
ece8797
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-anvil-sweep-harness
branch
from
August 26, 2026 16:38
2bb495f to
7dbcf5e
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Extends the ckETH live test harness to deploy and inspect real sweep contracts on Anvil.
Changes:
- Adds sweep-specific fixture setup and minter configuration.
- Adds Anvil transaction, balance, code, and contract deployment utilities.
- Enables interval mining for block progression.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
test_utils/src/live.rs |
Adds the live sweep fixture and inspection APIs. |
test_utils/src/lib.rs |
Wires sweep contracts into minter initialization. |
test_utils/src/ckerc20.rs |
Supports custom subaccount helpers. |
test_utils/src/anvil.rs |
Adds sweep deployment and chain inspection utilities. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| let delegate = anvil.deploy( | ||
| &deployer, | ||
| &deploy_code( | ||
| &compile("CKSWEEPER_ATTESTED_SOL", "CkSweeperAttested"), |
| let Some(transactions) = block["transactions"].as_array() else { | ||
| continue; | ||
| }; | ||
| for transaction in transactions { |
| /// | ||
| /// Funding the sweeper directly is a shortcut: in production its gas comes from a ckETH burn | ||
| /// out of the minter's fee account, which is a separate pipeline from sweeping. | ||
| pub fn new_sweep(sweeper: &Address, sweeper_gas_wei: u128) -> Self { |
gregorydemay
force-pushed
the
greg/DEFI-2926-enqueue-batched-sweep
branch
from
August 26, 2026 17:03
ece8797 to
3991927
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-anvil-sweep-harness
branch
from
August 26, 2026 17:03
7dbcf5e to
76e5ad9
Compare
gregorydemay
changed the base branch from
greg/DEFI-2926-enqueue-batched-sweep
to
greg/DEFI-2926-reuse-signed-authorizations
August 26, 2026 17:04
gregorydemay
force-pushed
the
greg/DEFI-2926-reuse-signed-authorizations
branch
from
August 26, 2026 17:38
b808126 to
135e448
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-anvil-sweep-harness
branch
from
August 26, 2026 17:38
76e5ad9 to
56379f6
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-reuse-signed-authorizations
branch
from
August 27, 2026 07:56
135e448 to
d2cba5a
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-anvil-sweep-harness
branch
from
August 27, 2026 07:56
56379f6 to
4ba45e6
Compare
…EFI-2926-anvil-sweep-harness
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Suppressed comments (2)
rs/ethereum/cketh/test_utils/src/anvil.rs:316
last_transaction_ofsearches block heights newest-first, but transactions within the selected block oldest-first. Interval mining explicitly allows several transactions in one block, so this can return an earlier transaction rather than the most recent one and make failure/gas assertions inspect the wrong sweep.
for transaction in transactions {
rs/ethereum/cketh/test_utils/src/anvil.rs:599
- This new compilation path requires
CKSWEEPER_ATTESTED_SOL, but the live-harness Bazel target//rs/ethereum/cketh/minter:deposit_from_cexneither includesCkSweeperAttested.solindatanor defines that environment variable (its BUILD target currently provides onlyCKDEPOSIT_SOL). CallingLiveSetup::new_sweepfrom the harness therefore panics withcontract source env var not set by Bazel; add the source and env entry to that target.
&compile("CKSWEEPER_ATTESTED_SOL", "CkSweeperAttested"),
Comment on lines
+164
to
+166
| /// Like [`Self::new_balance_scan`], but with the real deposit helper and the attested sweeper | ||
| /// delegate deployed on the node first, so the minter is installed knowing both, and with the | ||
| /// minter's dedicated sweeper address pre-funded with `sweeper_gas_wei` of ETH. |
Comment on lines
+263
to
+271
| pub fn balance(&self, address: &Address) -> u128 { | ||
| let balance = self.rpc( | ||
| "eth_getBalance", | ||
| serde_json::json!([to_hex(address.as_ref()), "latest"]), | ||
| ); | ||
| let balance = balance.as_str().unwrap(); | ||
| u128::from_str_radix(balance.trim_start_matches("0x"), 16) | ||
| .unwrap_or_else(|e| panic!("not a u128 balance {balance}: {e}")) | ||
| } |
Contributor
Author
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.
Why
What
LiveSetup::new_sweepdeploys the real deposit helper and the attested sweeper delegate on the harness' anvil before installing the minter, so the minter starts knowing both, and pre-funds the sweeper address with ETH (a shortcut for the funding pipeline, which has its own end-to-end test).finalizedtag advance on their own instead of freezing whenever no test transaction lands.