Skip to content

test(cketh): derive e2e sweep parameters from get_minter_info and re-send a stale authorization - #11374

Merged
gregorydemay merged 11 commits into
masterfrom
greg/DEFI-2926-deposit-e2e-follow-ups
Sep 4, 2026
Merged

test(cketh): derive e2e sweep parameters from get_minter_info and re-send a stale authorization#11374
gregorydemay merged 11 commits into
masterfrom
greg/DEFI-2926-deposit-e2e-follow-ups

Conversation

@gregorydemay

@gregorydemay gregorydemay commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Follow-ups to #11363:

  • The e2e tests no longer hard-code sweep parameters. The sweeper address and the per-token minimum deposit amounts are retrieved via get_minter_info (feat(cketh): expose the sweeper address in MinterInfo #11240).
  • A new test runs two deposit flows for the same deposit address. It shows that re-sending the EIP-7702 authorization with a stale nonce is harmless: the second sweep lands and the funds are credited exactly once.
  • The live e2e tests now read as fluent action-expectation chains, matching cketh.rs and ckerc20.rs. State-changing steps (funding the fee account, upgrading the minter) and minter endpoint calls (deposit_erc20) are visible in each test instead of being buried in the test fixtures.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YK3ggw1xtE3HZTGGBu66oD

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates ckETH end-to-end sweep tests to derive runtime configuration from get_minter_info and verify stale EIP-7702 authorization reuse.

Changes:

  • Derives sweeper addresses and deposit minimums dynamically.
  • Adds a repeated-deposit stale-authorization test.
  • Adds Anvil helpers for authorization nonce and delegation inspection.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
rs/ethereum/cketh/test_utils/src/live.rs Adds runtime minter-info lookups and deposit detection helpers.
rs/ethereum/cketh/test_utils/src/lib.rs Updates sweeper-address documentation.
rs/ethereum/cketh/test_utils/src/anvil.rs Adds authorization nonce and delegation designator helpers.
rs/ethereum/cketh/minter/tests/deposit_from_cex.rs Derives test parameters dynamically and adds the repeated-deposit scenario.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@gregorydemay
gregorydemay force-pushed the greg/DEFI-2926-deposit-e2e-follow-ups branch from 83b23e1 to 33e32cd Compare August 31, 2026 14:10
Base automatically changed from greg/DEFI-2933-provision-sweep-gas to master August 31, 2026 15:20
@gregorydemay
gregorydemay force-pushed the greg/DEFI-2926-deposit-e2e-follow-ups branch from 33e32cd to 183d86c Compare August 31, 2026 15:20
gregorydemay and others added 3 commits August 31, 2026 15:29
@gregorydemay
gregorydemay marked this pull request as ready for review August 31, 2026 19:19
@gregorydemay
gregorydemay requested a review from a team as a code owner August 31, 2026 19:19
@github-actions github-actions Bot added the @defi label Aug 31, 2026
@zeropath-ai

zeropath-ai Bot commented Aug 31, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to e6af0af.

Security Overview
Detected Code Changes
Change Type Relevant files
Refactor ► rs/ethereum/cketh/minter/tests/deposit_from_cex.rs
    Refactor tests to use new CkErc20Setup/live fixtures and updated token handling
► rs/ethereum/cketh/test_utils/src/anvil.rs
    Add authorization_nonces helper for transactions
► rs/ethereum/cketh/test_utils/src/lib.rs
    Update comments and adjust sweeper address description
Enhancement ► rs/ethereum/cketh/test_utils/src/live.rs
    Introduce DepositPlan and CexDeposit structs
► rs/ethereum/cketh/test_utils/src/live.rs
    Expand LiveSetup with new balance-scan/sweep/testing helpers (deposit wiring, assertions, and minting verifications)
► rs/ethereum/cketh/test_utils/src/live.rs
    Add functionality to perform batched sweeps per token and assertions around delegations and swept totals
► rs/ethereum/cketh/test_utils/src/live.rs
    Add methods to coordinate minter deposits via deposit plans and to validate detection/await status
Bug Fix / Other ► rs/ethereum/cketh/test_utils/src/live.rs
    Adjust LiveSetup default implementations and constructor names for balance_scan and general setup
► rs/ethereum/cketh/test_utils/src/live.rs
    Introduce get_minter_info usage path for minimum deposits and related checks
► rs/ethereum/cketh/test_utils/src/live.rs
    Adjust designator helper usage and delegation designator integration

@mbjorkqvist mbjorkqvist left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @gregorydemay!

Comment thread rs/ethereum/cketh/minter/tests/deposit_from_cex.rs
…ng its pair

The mint follows the log scrape while a swept pair only leaves the sweep
queue on finalization, one timer apart. Re-registering while the pair is
still queued reports the stale detection instead of arming it afresh, so
the second deposit would never be scanned.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PmyHh2sx7x38LEgHGkmNud
@gregorydemay

Copy link
Copy Markdown
Contributor Author

🤖 Flakiness check on a36588b: ran //rs/ethereum/cketh/minter:deposit_from_cex 10 times (--runs_per_test=10 --local_test_jobs=1 --cache_test_results=no, so every run executed all 7 tests against a fresh live PocketIC + anvil, one at a time).

Runs Tests per run Failures Duration per run
10/10 passed 7 0 198s–200s

The per-run durations are tightly clustered, so the tick-driven waits (including the new expect_sweeps_finalized before re-registering the pair) are settling on the same schedule each time rather than burning spare ticks.

…sit-e2e-follow-ups

# Conflicts:
#	rs/ethereum/cketh/test_utils/src/live.rs
@gregorydemay
gregorydemay added this pull request to the merge queue Sep 4, 2026
Merged via the queue into master with commit 51d0044 Sep 4, 2026
42 checks passed
@gregorydemay
gregorydemay deleted the greg/DEFI-2926-deposit-e2e-follow-ups branch September 4, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants