fix(flows): verify Bob funding confirms + eRPC reflects it before buy#368
Merged
fix(flows): verify Bob funding confirms + eRPC reflects it before buy#368
Conversation
Flow-11's step 28 submitted a USDC transfer from the .env key to Bob's remote-signer wallet but: 1. Marked the step PASS unconditionally (the `... 2>&1 | grep status || true` pipe masked cast-send failures), so a silently-dropped tx still looked green. 2. Moved straight to step 32 where the AI agent's buy.py queries balance through eRPC. eRPC's eth_call cache TTL is 10s, so even when the tx confirmed, the agent could still see 0 USDC for the first poll — and the agent's LLM, faced with "0 USDC, needs 0.005 USDC", declined the purchase with a verbose explanation, which step 32's `>100 chars` heuristic mistook for success. Step 33 then failed because no PurchaseRequest CR was ever created. This caused a 32/33 false-green on the first two runs. Fix: - Capture cast-send output, require `status 1 (success)` in the receipt, fail-fast otherwise. - Poll the direct Base Sepolia RPC until Bob's on-chain USDC >= 50000 (bypasses eRPC cache — confirms the tx is actually mined). - Then add a new step that polls Bob's in-pod buy.py `balance` via eRPC until it reports 0.05 USDC — this is the same path the AI agent will take in step 32, so passing here guarantees the agent won't see zero. With the patch, flow-11 runs 42/42 green. Without it, ~50% of runs hit the eRPC cache and fail on step 33.
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.
Summary
Flow-11 step 28 (fund Bob's remote-signer with 0.05 USDC) had two bugs that caused a
32/33false-green ~50% of the time:cast send ... | grep status || truepipe masked silently-dropped funding txs. Thepassline ran regardless.buy.pyin step 32 queries balance through eRPC, which has a 10seth_callcache TTL. If the agent polled during the cache window it saw0 USDC, declined the buy verbosely, and step 32's>100 charsheuristic mistook the refusal for success. Step 33 then failed:PurchaseRequest CR not ready: No resources found.Fix
cast sendoutput; requirestatus 1 (success)in the receipt, fail-fast otherwise.buy.py balancevia eRPC until it reports0.05. This is the exact path the AI agent will take in step 32, so passing here guarantees no zero-balance race.Verification
FAIL: [33]with theBalance: 0 USDCrefusal in the agent response.Test plan
./flows/flow-11-dual-stack.shwith a fresh.envkey — 42/42.