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
test(taskengine): prove erc20_overrides flip the Uniswap swap revert end-to-end
Strengthen the RPC-level E2E test so it is a real before/after rather than a
revert-string check: assert the control run (no overrides) reverts on the
funding/approval precondition, then assert the same swap succeeds once
erc20_overrides seed USDC balance (slot 9) and the SwapRouter02 allowance
(slot 10) through the request → proto → RunNodeImmediately → SimulationStateMap
→ Tenderly path. Slots confirmed empirically against the deployed Sepolia USDC.
t.Logf("control (no overrides): success=%v error=%q", control.Success, control.Error)
467
468
469
+
// The swap pulls USDC from the runner via transferFrom, so without an
470
+
// approval (and balance) it reverts on the funding/approval precondition.
471
+
// The control run above establishes that baseline; assert it so the
472
+
// override run below is a meaningful before/after, not a no-op.
473
+
require.Falsef(t, control.Success,
474
+
"control run (no overrides) unexpectedly succeeded — the test wallet already has a standing USDC approval for SwapRouter02, so this test no longer proves erc20_overrides did anything. Reset the wallet's approval or use a fresh runner. control.Error=%q", control.Error)
475
+
require.True(t,
476
+
isFundingOrApprovalRevert(control.Error),
477
+
"control run should revert on the allowance/balance precondition the override targets, got: "+control.Error)
478
+
468
479
// Seed the runner's USDC balance and its approval for SwapRouter02 via the
469
-
// request. USDC on Sepolia is a FiatToken (balance slot 9, allowance slot
470
-
// 10); we also cover the standard ERC20 layout (balance 0, allowance 3) so
471
-
// the override lands regardless of the deployed token's storage layout. Each
472
-
// entry drives a distinct slot through the real request → proto →
473
-
// simulation-state path.
480
+
// request. USDC on Sepolia is Circle's FiatToken: balanceOf lives at
481
+
// storage slot 9 and allowance at slot 10 (confirmed empirically against
482
+
// the deployed token). Each entry drives a distinct slot through the real
483
+
// request → proto → RunNodeImmediately → SimulationStateMap → Tenderly
0 commit comments