DevOps: Idempotent Anvil dev-wallet seeding on re-deploy (e2e-anvil / KEY_EVM_* minter alignment) #281
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#281
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?
Context
Local Anvil workflows (
scripts/e2e-anvil.sh,scripts/start-local-anvil-stack.sh,scripts/lib/anvil_deploy_dev.sh) optionally seedKEY_EVM_1..3wallets afterDeployDevso manual QA, Rabby import, and bot swarms have ETH + DOUB + Play CRED (+ mock CL8Y) without relying solely on the Playwright mock connector.Current codebase
contracts/script/DeployDev.s.soldeployerfromPRIVATE_KEYor default Anvil account #0 (0xac09…). GrantsMINTER_ROLEonDoubloonandPlayCredtodeployer, mintsE2E_MOCK_WALLET(0xf39F…, Anvil #0).scripts/lib/anvil_deploy_dev.shYIELDOMEGA_SEED_EVM_DEV_WALLETS=1(default), callsscripts/seed-evm-dev-wallets-anvil.shwith parsedDOUB,CRED, optionalCL8Y.scripts/seed-evm-dev-wallets-anvil.shDEPLOYER_PKdefaulting toKEY_EVM_1(scripts/lib/evm_dev_keys.sh) tomintDOUB/CRED (and CL8Y) toADDR_EVM_1..3.set -euo pipefail— any revert aborts the script.scripts/e2e-anvil.shnpm run buildand Playwright. Failure in seed prevents build/E2E from running.VITE_E2E_MOCK_WALLET=1, wallet writes use the mock connector; E2E can pass when seed is disabled viaYIELDOMEGA_SEED_EVM_DEV_WALLETS=0.Observed failure (Cloud Agent / re-deploy): second consecutive
bash scripts/e2e-anvil.sh(or re-run deploy on an existing Anvil without chain reset) can fail in seed with:Example caller: address derived from
KEY_EVM_1when it does not match theDeployDevbroadcaster that receivedMINTER_ROLEon the newly deployed token proxies.yieldomega_anvil_deploy_devreturns non-zero;e2e-anvil.shexits before Vite build.Related invariants / docs:
docs/testing/e2e-anvil.md·AGENTS.md(on-chain seed) ·INV-DEPLOY-259-DEV-SEED(DeployDev mock wallet only, not multi-wallet seed).Why this is needed
KEY_EVM_*secrets that differ from Foundry’s defaultPRIVATE_KEY; seed and deploy must stay aligned.YIELDOMEGA_SEED_EVM_DEV_WALLETS=0) is a workaround, not a product fix.Constraints and guardrails
DevOnlyChainGuardsemantics.AGENTS.md).cast+ role checks).AccessControlonDoubloon/PlayCred.VITE_E2E_MOCK_WALLET=1flows.docs/testing/e2e-anvil.mdandAGENTS.mdif behavior changes.Relevant files
scripts/seed-evm-dev-wallets-anvil.shscripts/lib/anvil_deploy_dev.shscripts/lib/evm_dev_keys.shscripts/e2e-anvil.shscripts/start-local-anvil-stack.sh(if it shares deploy helper)contracts/script/DeployDev.s.soldocs/testing/e2e-anvil.mdAGENTS.mdRecommended direction
Pick one primary approach (or combine 1 + 3):
DeployDevgrantsMINTER_ROLE— e.g. seed script defaultsDEPLOYER_PKfromPRIVATE_KEY(same default asDeployDev.s.sol) and only falls back toKEY_EVM_1when explicitly documented; OR grantMINTER_ROLEinDeployDevtoADDR_EVM_1(and optionally 2–3) in addition todeployerwhenvm.envBool("YIELDOMEGA_SEED_DEV_WALLETS")is set.cast callhasRole(MINTER_ROLE, caller)on DOUB/CRED; on failure print actionable message (mismatchedKEY_EVM_1vsPRIVATE_KEY, stale Anvil state, wrongDOUBaddress).grantRoleonly in deploy script, never from seed.Avoid: silently disabling seed on error without logging (hides misconfiguration).
Acceptance criteria
bash scripts/e2e-anvil.shcompletes (build + 6 Playwrightanvil-arena-*specs green) twice in a row on the same machine without settingYIELDOMEGA_SEED_EVM_DEV_WALLETS=0, with default seed enabled.bash scripts/seed-evm-dev-wallets-anvil.shsucceeds when run manually immediately afteryieldomega_anvil_deploy_dev(fromanvil_deploy_dev.sh).KEY_EVM_1intentionally differs from deployer and cannot mint, script exits with a clear error naming env vars to fix (not opaque AccessControl hex).KEY_EVM_1..3are set to non-default secrets iff deploy grants minter to those addresses (document the contract).e2e-anvil.mdtroubleshooting subsection for seed / minter mismatch.Test plan — functional paths
e2e-anvil.shoncee2e-anvil.shagain without manualanvilrestartanvil_deploy_dev.sh→ runseed-evm-dev-wallets-anvil.shADDR_EVM_1..3YIELDOMEGA_SEED_EVM_DEV_WALLETS=0→e2e-anvil.shKEY_EVM_1≠ deployer, no grant to that addressYIELDOMEGA_DEPLOY_KUMBAYA=1+ seedstart-local-anvil-stack.sh(or documented subset) with default seed/arenaTest plan — attack, hack, and abuse vectors
MINTER_ROLEto extra dev addresses inDeployDevDeployProduction; code review + grepgrantRolein production scriptsDEPLOYER_PKDOUB/CREDaddresses in envDevOnlyChainGuardorcast chain-idcheck)DOUB/CREDaddresses match latest deploy log; balance check uses correct contractKEY_EVM_*/DEPLOYER_PK; redact in error messagesVerification criteria
bash scripts/e2e-anvil.shruns withDone.and 6 passed each.cast call $DOUB "balanceOf(address)(uint256)" $ADDR_EVM_1(and 2–3) shows expected balances after seed.cast call $DOUB "hasRole(bytes32,address)(bool)" $(cast call $DOUB "MINTER_ROLE()(bytes32)") $DEPLOYER_ADDRis true for the seeding account.Labels
devops,testing,anvil,e2ementioned in issue #256
mentioned in commit
707e48a704mentioned in commit
ec10a7acb5mentioned in merge request !405
Implementation complete (!405)
Idempotent Anvil dev-wallet seeding with minter identity aligned to
DeployDev— addresses theAccessControlUnauthorizedAccountfailure on consecutive E2E / re-deploy runs (#281).What changed
scripts/lib/anvil_deployer_key.shDEPLOYER_PK→PRIVATE_KEY→ Anvil #0 (same asDeployDev.s.sol), notKEY_EVM_1scripts/seed-evm-dev-wallets-anvil.shMINTER_ROLEwith actionable errorsscripts/lib/anvil_deploy_dev.shPRIVATE_KEY; auto-setsYIELDOMEGA_SEED_MINTER_ADDRESSwhen seed minter ≠ deploy broadcastercontracts/script/DeployDev.s.solMINTER_ROLEon DOUB + PlayCred forYIELDOMEGA_SEED_MINTER_ADDRESS(dev chains only)scripts/verify-evm-dev-wallet-seed-anvil.shINV-DEPLOY-281-*, e2e-anvil.md §281, AGENTS.md, guardrails +skills/cross-linksMerge request: https://gitlab.com/PlasticDigits/yieldomega/-/merge_requests/35
Agent verification (pre-merge)
bash scripts/verify-evm-dev-wallet-seed-anvil.shbash scripts/e2e-anvil.shbash scripts/e2e-anvil.shQA verification checklist
bash scripts/verify-evm-dev-wallet-seed-anvil.sh— idempotent double-seed + re-deploy on same Anvilbash scripts/e2e-anvil.shruns with default seed (YIELDOMEGA_SEED_EVM_DEV_WALLETS=1) — 6 Playwright specs green eachyieldomega_anvil_deploy_dev→seed-evm-dev-wallets-anvil.sh— ETH + DOUB + CRED (+ CL8Y) onADDR_EVM_1..3DEPLOYER_PKto a key withoutMINTER_ROLE— script exits with clearMINTER_ROLE missingmessage (not opaque AccessControl hex)KEY_EVM_1..3secrets with defaultPRIVATE_KEY— wallets funded, Rabby/manual QA balances OKYIELDOMEGA_SEED_EVM_DEV_WALLETS=0→ E2E still passes (mock wallet path)Request
Please verify the checklist above on a fresh Cloud VM or local Foundry setup. Leaving this issue open until QA confirms.
QA agent team: please run the verification checklist when convenient.
mentioned in commit
7f2cce9383mentioned in issue #279
mentioned in merge request !406
mentioned in commit
356c93ed20mentioned in merge request !413
mentioned in merge request !415
mentioned in issue #287
mentioned in issue #289
mentioned in commit
8cca0afba2Implementation verification complete (post-merge !405)
Verified on Cloud Agent VM (
cursor/gitlab-issue-workflow-eca8@mainafter MR !405 merge). All acceptance criteria PASS.Acceptance criteria
e2e-anvil.shwith default seedbash scripts/e2e-anvil.sh× 2Done.verify-evm-dev-wallet-seed-anvil.sh(deploy → seed → balance asserts)verify-evm-dev-wallet-seed-anvil.shdouble-seed stepverify-evm-dev-wallet-seed-anvil.shsecond DeployDev broadcastverify-evm-dev-wallet-seed-anvil.shmismatchedDEPLOYER_PKMINTER_ROLE missing(not opaque AccessControl hex)e2e-anvil.md§ dev-wallet seed +INV-DEPLOY-281-*DEPLOYER_PK→PRIVATE_KEY→ Anvil #0; extra grant viaYIELDOMEGA_SEED_MINTER_ADDRESSdocs/testing/e2e-anvil.md#anvil-dev-wallet-seed-gitlab-281YIELDOMEGA_SEED_EVM_DEV_WALLETS=0 bash scripts/e2e-anvil.shYIELDOMEGA_DEPLOY_KUMBAYA=1ine2e-anvil.shVerification commands (logs)
What shipped (!405)
scripts/lib/anvil_deployer_key.sh— minter PK aligned withDeployDev.s.sol(PRIVATE_KEY/ Anvil #0, notKEY_EVM_1)scripts/seed-evm-dev-wallets-anvil.sh— idempotent mint, loopback + dev chain guards, pre-flightMINTER_ROLEerrorsDeployDev.s.sol— optionalYIELDOMEGA_SEED_MINTER_ADDRESSextra minter grant (dev chains only)scripts/verify-evm-dev-wallet-seed-anvil.sh— smoke for double-seed, re-deploy, mismatched-key diagnosticClosing — no further code changes required on this branch.
mentioned in commit
9ecde04ecbmentioned in commit
748782130c