Skip to content

Commit 0caab3e

Browse files
committed
tests/shadow-testing: wait for updateVerifier tx to seal before addProver
The impersonated eth_sendTransaction for updateVerifier could still be in the txpool when addProver signed with the same owner nonce, failing with 'replacement transaction underpriced' (hit twice at bring-up). Poll for the receipt before continuing.
1 parent b85cbb4 commit 0caab3e

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

tests/shadow-testing/lib/01-setup-anvil.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,16 @@ if [[ -n "$DEPLOYED_VERIFIER" && "$DEPLOYED_VERIFIER" != "0x00000000000000000000
265265

266266
# Use eth_sendTransaction directly to avoid cast send --unlocked bugs with impersonation
267267
verifier_calldata=$(cast calldata "updateVerifier(uint256,uint64,address)" "$CODEC_VERSION" "$start_batch_index" "$DEPLOYED_VERIFIER")
268-
cast rpc eth_sendTransaction \
268+
verifier_tx=$(cast rpc eth_sendTransaction \
269269
"{\"from\":\"$OWNER\",\"to\":\"$ROLLUP_VERIFIER\",\"data\":\"$verifier_calldata\",\"gas\":\"0x4c4b40\"}" \
270-
--rpc-url "$ANVIL_RPC" >/dev/null 2>&1
270+
--rpc-url "$ANVIL_RPC" 2>/dev/null | tr -d '"')
271+
# Wait for the tx to seal before continuing: the next step (addProver)
272+
# signs with the owner's pending nonce — if this tx is still in the pool,
273+
# addProver collides with it ("replacement transaction underpriced").
274+
for _ in $(seq 1 20); do
275+
cast receipt "$verifier_tx" --rpc-url "$ANVIL_RPC" >/dev/null 2>&1 && break
276+
sleep 0.5
277+
done
271278

272279
stop_impersonate "$OWNER" "$ANVIL_RPC"
273280

0 commit comments

Comments
 (0)