Fix e2e-anvil.sh: EXIT trap kill 0 and MockReserveCl8y log extraction #279
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:open_issues
agents
agent:security_audit
agent:verify
area
timecurve
arena
arena-v2
audit
block:feature_review
block:security
bug
contracts
design
devops
docs
documentation
enhancement
epic
feature
frontend
indexer
low priority
megaeth
operations
ops
performance
QA
qa checklist
referrals
removal
security
smart-contracts
tech-debt
testing
time-arena
timecurve
visual-qa
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/yieldomega#279
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fix
scripts/e2e-anvil.shso the Anvil + DeployDev + Playwright pipeline completes reliably. Today the script can exit during the post-deploy dev-wallet seed step whenMockReserveCl8yis not parsed from the deploy log, and the EXIT trap cankill 0(terminate the whole process group) before Playwright runs.Parent / context: Follow-up from #266 verification and !399.
Current codebase
scripts/e2e-anvil.shStarts Anvil, calls
yieldomega_anvil_deploy_devfromscripts/lib/anvil_deploy_dev.sh, builds frontend with Arena v2VITE_*, runsnpm run preview, then Playwrighte2e/anvil-arena-*.spec.ts.EXIT trap (line ~15):
When
PREVIEW_PIDorANVIL_PIDis unset,${VAR:-0}expands to0, andkill 0signals the entire shell process group — observed as abrupt script termination mid-deploy (before Playwright).yieldomega_anvil_deploy_devseed blockAfter DeployDev, when
YIELDOMEGA_SEED_EVM_DEV_WALLETS=1(default) andDOUB/CREDare set:_yieldomega_extract_addrgreps deploy log for lines matching^[[:space:]]*MockReserveCl8y:+ hex address.DeployDev.s.sollogging mismatchWhen no
RESERVE_ASSET_ADDRESS/USDM_ADDRESSis set, DeployDev deploys mock CL8Y and logs:Other contracts use the pattern
console.log("Doubloon:", address(doub));which does match the extractor (Doubloon:).MockReserveCl8y:never appears in the log, soCL8Yis always empty ine2e-anvil.sheven on successful deploy.A separate line
console.log("MockReserveCl8y seeded for E2E mock wallet");has no address.scripts/seed-evm-dev-wallets-anvil.shDOUBandCRED;CL8Ymint is optional (if [[ -n "${CL8Y:-}" ]]).CL8Yalone should not fail seeding — so the “CL8Y absent” symptom is a red herring unless combined with trap/set -eelsewhere.Why this is needed
bash scripts/e2e-anvil.shis the documented gate for Arena Anvil E2E (docs/testing/e2e-anvil.md, optional workflow.github/workflows/e2e-anvil.yml). A silent mid-script exit blocks the full Playwright suite.e2e-anvil.shmeans wallet-write specs are covered; false negatives waste debugging time.KEY_EVM_*wallets should receive mock CL8Y when DeployDev deploysMockReserveCl8y— today the address is never passed to the seed script frome2e-anvil.sh.kill 0on EXIT is a footgun for any early failure (deploy, seed, build), not only CL8Y.Constraints and guardrails
start-local-anvil-stack.shsharesanvil_deploy_dev.sh; keep behavior consistent (or document intentional differences)..cursor/skills/yieldomega-guardrails/SKILL.md.Relevant files
scripts/e2e-anvil.shscripts/lib/anvil_deploy_dev.shscripts/seed-evm-dev-wallets-anvil.sh,scripts/lib/evm_dev_keys.shcontracts/script/DeployDev.s.soldocs/testing/e2e-anvil.md,.github/workflows/e2e-anvil.ymlfrontend/e2e/anvil-arena-*.spec.tsRecommended direction
A. Fix EXIT trap (required)
Replace
kill "${PREVIEW_PID:-0}"/kill "${ANVIL_PID:-0}"with guarded kills, e.g. only kill when PID is set and> 0:Apply the same pattern anywhere else using
${PID:-0}for cleanup.B. Fix MockReserveCl8y address extraction (required)
Pick one (or combine):
console.log("MockReserveCl8y:", reserveAsset);(matches other contracts), or_yieldomega_extract_addrwith an alternate pattern forMockReserveCl8y deployed, orcontracts/broadcast/DeployDev.s.sol/31337/run-latest.jsonwhen log grep fails.Prefer (1) + (3) fallback for robustness across Foundry versions.
C. Seed failure visibility (recommended)
seed-evm-dev-wallets-anvil.shfails, print a clear error before EXIT (trap should not mask the message).set +earound seed with explicit exit code check so trap cleanup does not usekill 0before stderr is flushed.D. Tests / docs
CL8Ynon-empty after extract.docs/testing/e2e-anvil.mdtroubleshooting for trap + CL8Y.Acceptance criteria
bash scripts/e2e-anvil.shruns to completion (Playwrightanvil-arena-*.spec.ts) on a clean VM with Foundry + Node + Chromium.yieldomega_anvil_deploy_devsets non-emptyCL8Y(or seed uses broadcast fallback).kill 0whenPREVIEW_PID/ANVIL_PIDare unset.scripts/start-local-anvil-stack.shpath still seeds wallets when enabled (no regression).bash -x scripts/e2e-anvil.shdoes not terminate between deploy andnpm run buildon success path.Test plan — functional paths
bash scripts/e2e-anvil.shYIELDOMEGA_SEED_EVM_DEV_WALLETS=0 bash scripts/e2e-anvil.shYIELDOMEGA_DEPLOY_KUMBAYA=0 bash scripts/e2e-anvil.shRESERVE_ASSET_ADDRESSset (no mock deploy)Test plan — attack / abuse vectors
e2e-anvil.shin shared tmux session; fail earlykill 0DEPLOY_LOGat attacker-controlled file with fakeMockReserveCl8y:0x…castmint fails loudly; script exits non-zero with messageforge buildVerification criteria
bash scripts/e2e-anvil.shgreen.rg 'kill "\$\{PREVIEW_PID:-0\}"' scripts/→ empty (or documented exception).CL8Yaddress matches DeployDev broadcast.workflow_dispatche2e-anvil workflow green.marked as related to #266
mentioned in commit 0fda44fdcdab35b89e1b2e17f9f080d8bd332d80
mentioned in commit
7f2cce9383Implementation (agent)
Branch:
cursor/e2e-anvil-trap-cl8y-279-222d— MR pending merge to protectedmain.What changed
scripts/e2e-anvil.shuses_e2e_anvil_cleanup+_yieldomega_kill_pid_if_setso unsetPREVIEW_PID/ANVIL_PIDnever invokekill 0.DeployDev.s.sollogsMockReserveCl8y:;anvil_deploy_dev.shresolves CL8Y from log and falls back tocontracts/broadcast/DeployDev.s.sol/31337/run-latest.json.seed-evm-dev-wallets-anvil.shreturns a clear error (works with #281yieldomega_resolve_seed_minter_pk).e2e-anvil.shunsetsKEY_EVM_*overrides so seeding targets Anvil accounts #0–#2.INV-ANVIL-E2E-279-*, manual QA §279, guardrails +skills/README.md.Verification checklist (QA)
bash scripts/verify-e2e-anvil-trap.sh→ OKbash scripts/test-anvil-deploy-cl8y-extract.sh→ okbash scripts/verify-evm-dev-wallet-seed-anvil.sh→ PASS (CL8Y balances)bash scripts/e2e-anvil.sh→ exit 0; Playwright 6/6anvil-arena-*.spec.tsYIELDOMEGA_SEED_EVM_DEV_WALLETS=0 bash scripts/e2e-anvil.shstill completesAgent-run results
verify-e2e-anvil-trap.shtest-anvil-deploy-cl8y-extract.shverify-evm-dev-wallet-seed-anvil.shANVIL_PORT=8549 bash scripts/e2e-anvil.shPlease run the checklist on a clean VM after MR merge.
Request: QA agent team — please verify the checklist above on merge.
Issue left open until MR is merged and QA signs off.
mentioned in merge request !409
mentioned in commit
c373b32777mentioned in merge request !406
mentioned in issue #263