feat(exit-certificate): subtract genesis preload from EOA balances in Step B#1654
Conversation
… Step B Step B1 now always subtracts each EOA's genesis (block 0) ETH balance from its live balance, since genesis-preloaded ETH was never bridged in and would otherwise inflate the exit certificate totals. - checkGenesisBalances now returns the set of EOAs preloaded at genesis (instead of aborting on any non-zero genesis balance); the diagnostic breakdown is kept and the error is reserved for RPC failures. - New subtractGenesisBalances removes the genesis amount from each live balance, dropping EOAs reduced to 0. When the genesis balance exceeds the live balance the EOA is capped to 0 and flagged. - ignoreGenesisBalance now only governs the negative case: abort by default, or cap-to-0-and-continue with a warning when true. - Subtraction runs before building EOA balances/accumulations so outputs are genesis-adjusted. Updated unit tests (subtractGenesisBalances + Step B1 subtract/abort paths) and aligned CLAUDE.md/README.md docs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Claude finished @joanestebanr's task in 2m 9s —— View job 📋 Review Complete ✅🚀 What's NewThis PR changes the genesis preload handling logic from an abort-on-detect guard to an always-subtract adjustment. Previously, any non-zero genesis (block 0) ETH balance would abort Step B1. Now the genesis balance is always subtracted from each EOA's live balance (since preloaded ETH was never bridged in), and 🐛 Bug FixesNone - this is a feature change, not a bug fix. 📋 Config Updates
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 22a92f2fff
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if live == nil { | ||
| live = new(big.Int) | ||
| } | ||
| remaining := new(big.Int).Sub(live, genesisBal) |
There was a problem hiding this comment.
Preserve bridged ETH recipients when subtracting preloads
When a prefunded EOA has moved any of its block-0 ETH to another EOA and later receives a real L1→L2 native deposit, this subtracts the entire genesis balance from that EOA's current balance based only on the address. In a case like genesis A=100, A sends 100 to B, then A receives a 100 native bridge deposit, remaining is non-negative so Step B does not abort, but the certificate drops A's legitimate bridged funds while B still receives the genesis-funded balance; Step C can also reclassify the missing native total as SC-locked to exitAddress. Keep aborting on genesis preloads or account for value flows before doing per-address subtraction.
Useful? React with 👍 / 👎.
322490f to
22a92f2
Compare
|
…and CI workflow (#1655) ## 🔄 Changes Summary - Add the **exit-certificate E2E test harness** under `test/e2e-exit_certificate/`: spins up a Kurtosis CDK network (`run_network.sh`), prepares a settled certificate (`prepare_network.sh`), and runs the `exit_certificate` tool (`run_exit_tool.sh`), orchestrated by `run_e2e_test.sh` (+ `helper.sh`, `single_op_pessimistic_args.json`, `README.md`). - Add supporting scripts under `tools/exit_certificate/scripts/`: - `bridge_l2_to_l1.sh` — L2→L1 bridge to produce a certificate. - `agglayer_certificate_status.sh` — poll/wait for certificate settlement. - `export_kurtosis_env.sh` — export Kurtosis env vars for the scripts. - `agglayer_status/main.go` — agglayer status helper. - Update `bridge_l1_to_l2.sh`. - Add CI workflow `.github/workflows/test-e2e-exit_cenrtificate_tool.yml` that runs the E2E test on PRs touching `tools/exit_certificate/**` (also `workflow_dispatch`). ##⚠️ Breaking Changes - None. ## 📋 Config Updates - None. ## ✅ Testing - 🤖 **Automatic**: New GitHub Actions workflow runs `test/e2e-exit_certificate/run_e2e_test.sh` on PRs that modify `tools/exit_certificate/**` (Kurtosis CDK network → settled certificate → exit_certificate tool). - 🖱️ **Manual**: `./test/e2e-exit_certificate/run_e2e_test.sh` locally (requires Docker, Kurtosis CLI, Foundry `cast`, Go). ## 🐞 Issues - N/A ## 🔗 Related PRs - #1654 (feat: subtract genesis preload from EOA balances in Step B) ## 📝 Notes - The E2E harness clones a pinned Kurtosis CDK commit and manages its own `aggkit` enclave; the workflow stops the enclave on completion. --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>



🔄 Changes Summary
checkGenesisBalancesreturns the set of EOAs preloaded at genesis (no longer aborts on any non-zero genesis balance); keeps the diagnostic breakdown, reserves its error for RPC failures.subtractGenesisBalancesremoves the genesis amount per EOA, drops EOAs reduced to 0, and caps to 0 + flags any EOA whose genesis balance exceeds its live balance.ignoreGenesisBalancesemantics changed. It no longer gates "any genesis preload aborts"; the preload is always subtracted, and the flag now only governs the case where the genesis balance exceeds the live balance (abort by default vs cap-to-0-and-continue).📋 Config Updates
options.ignoreGenesisBalance(defaultfalse) meaning updated as above.✅ Testing
go test ./tools/exit_certificate/...(addedTestSubtractGenesisBalances,TestRunStepB1GenesisPreloadSubtracted,TestRunStepB1GenesisPreloadExceedsBalanceAborts).golangci-lint run ./tools/exit_certificate/...→ 0 issues.🐞 Issues
📝 Notes
feature/exit-certificate-tool(the tool is not yet indevelop).🤖 Generated with Claude Code