Skip to content

Commit b48a599

Browse files
mbjorkqvistclaude
andcommitted
test(cketh): expect the status a failed funding actually reports
The dedicated Failed status was reverted after review: it meant adding a variant to retrieve_eth_status' return type, breaking existing clients, to describe a state mainnet cannot reach — a bare transfer to a code-less address the minter's own key controls has nothing to revert in. This test reaches it anyway, by placing reverting code at the sweeper, so it now expects the pending-reimbursement status and says why that label is tolerated. What it asserts either way is the invariant: no reimbursement, and the burn stays as prepaid gas. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 361a41d commit b48a599

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

rs/ethereum/cketh/minter/tests/sweeper_funding_hardening.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,15 @@ fn should_not_reimburse_a_funding_transaction_that_fails_on_chain() {
163163
// what happens when it fails.
164164
setup.await_funding_finalized(FINALIZATION_DEADLINE);
165165
let status = setup.withdrawal_status(burn_index);
166+
// Pending reimbursement is imprecise here — nothing will ever settle it — and deliberately so:
167+
// a status of its own meant adding a variant to `retrieve_eth_status`, which breaks every
168+
// existing client, to describe a state mainnet cannot reach. This test reaches it only by
169+
// placing code at an address derived from the minter's own key. The invariant that actually
170+
// matters is asserted below: the burn is never paid back.
166171
assert!(
167-
status.starts_with("Failed("),
168-
"a failed funding must report Failed, not a reimbursement that never comes, got {status} \
169-
(sweeper {sweeper}, {} bytes of code, balance {})",
172+
status.starts_with("PendingReimbursement("),
173+
"unexpected status for a failed funding: {status} (sweeper {sweeper}, {} bytes of code, \
174+
balance {})",
170175
setup.code(&sweeper).len(),
171176
setup.anvil_eth_balance(&sweeper),
172177
);

0 commit comments

Comments
 (0)