fix(exit-certificate): AET-04: fail-fast when a token balanceOf batch errors in Step B#1675
Conversation
…in Step B fetchAllTokenBalances swallowed per-token RPC errors (log.Warnf + return), leaving the failed token absent from the balance map. Step C then treated its entire LBT supply as SC-locked and Step D routed the whole supply to exitAddress, excluding the real EOA holders from the certificate. Make it fail-fast like its sibling helpers: fetchAllTokenBalances now returns an error and uses errgroup.WithContext to cancel remaining scans on the first failure; RunStepB1 propagates it and aborts the pipeline. Add a regression test (TestFetchAllTokenBalancesFailFast) and update the existing test signature. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Claude finished @joanestebanr's task in 1m 11s —— View job Code Review Complete ✅🚀 What's NewThis PR fixes a critical bug in Step B1 of the exit-certificate tool where token balance fetch errors were silently ignored (logged as warnings and dropped). The fix makes 🐛 Bug Fixes
📋 Config UpdatesNone.
|
|
5c2fde5
into
feature/exit-certificate-tool
…in Step B (#1675) ## 🔄 Changes Summary - **Fix (High):** `fetchAllTokenBalances` (Step B1) silently discarded per-token RPC errors (`log.Warnf` + `return`), leaving the failed token absent from the balance map. Step C then treated its entire LBT supply as SC-locked and Step D routed the whole supply to `exitAddress`, excluding the real EOA holders from the certificate. - Made it **fail-fast**, consistent with its sibling helpers (`classifyAddresses`, `fetchETHBalances`): `fetchAllTokenBalances` now returns an `error` and uses `errgroup.WithContext` (limited to `tokenConcurrency`) to cancel the remaining scans on the first failure. `RunStepB1` propagates it and aborts the pipeline. - Added a doc comment explaining why the error must not be dropped. ##⚠️ Breaking Changes - None. No config, API, or CLI changes. Behaviour change only: a persistent per-token RPC failure now aborts the pipeline (after the existing RPC retries) instead of producing a misrouted certificate. ## 📋 Config Updates - None. ## ✅ Testing - 🤖 **Automatic:** Added `TestFetchAllTokenBalancesFailFast` (a failing `balanceOf` batch must return an error, never omit the token). Updated `TestFetchAllTokenBalances` to the new signature. Full package suite passes (`go test ./tools/exit_certificate/`) and `golangci-lint` reports 0 issues. ## 🐞 Issues - Closes #1679 ## 🔗 Related PRs - N/A ## 📝 Notes - Chose fail-fast as the default without adding an opt-out flag (e.g. `ignoreTokenBalanceFetchError`) to keep the config surface minimal; can add one if a knowingly-degraded test mode is desired. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
|
AET-04 Silent Token Balance Fetch Failure In fetchAllTokenBalances |
…in Step B (#1675) ## 🔄 Changes Summary - **Fix (High):** `fetchAllTokenBalances` (Step B1) silently discarded per-token RPC errors (`log.Warnf` + `return`), leaving the failed token absent from the balance map. Step C then treated its entire LBT supply as SC-locked and Step D routed the whole supply to `exitAddress`, excluding the real EOA holders from the certificate. - Made it **fail-fast**, consistent with its sibling helpers (`classifyAddresses`, `fetchETHBalances`): `fetchAllTokenBalances` now returns an `error` and uses `errgroup.WithContext` (limited to `tokenConcurrency`) to cancel the remaining scans on the first failure. `RunStepB1` propagates it and aborts the pipeline. - Added a doc comment explaining why the error must not be dropped. ##⚠️ Breaking Changes - None. No config, API, or CLI changes. Behaviour change only: a persistent per-token RPC failure now aborts the pipeline (after the existing RPC retries) instead of producing a misrouted certificate. ## 📋 Config Updates - None. ## ✅ Testing - 🤖 **Automatic:** Added `TestFetchAllTokenBalancesFailFast` (a failing `balanceOf` batch must return an error, never omit the token). Updated `TestFetchAllTokenBalances` to the new signature. Full package suite passes (`go test ./tools/exit_certificate/`) and `golangci-lint` reports 0 issues. ## 🐞 Issues - Closes #1679 ## 🔗 Related PRs - N/A ## 📝 Notes - Chose fail-fast as the default without adding an opt-out flag (e.g. `ignoreTokenBalanceFetchError`) to keep the config surface minimal; can add one if a knowingly-degraded test mode is desired. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>



🔄 Changes Summary
fetchAllTokenBalances(Step B1) silently discarded per-token RPC errors (log.Warnf+return), leaving the failed token absent from the balance map. Step C then treated its entire LBT supply as SC-locked and Step D routed the whole supply toexitAddress, excluding the real EOA holders from the certificate.classifyAddresses,fetchETHBalances):fetchAllTokenBalancesnow returns anerrorand useserrgroup.WithContext(limited totokenConcurrency) to cancel the remaining scans on the first failure.RunStepB1propagates it and aborts the pipeline.📋 Config Updates
✅ Testing
TestFetchAllTokenBalancesFailFast(a failingbalanceOfbatch must return an error, never omit the token). UpdatedTestFetchAllTokenBalancesto the new signature. Full package suite passes (go test ./tools/exit_certificate/) andgolangci-lintreports 0 issues.🐞 Issues
🔗 Related PRs
📝 Notes
ignoreTokenBalanceFetchError) to keep the config surface minimal; can add one if a knowingly-degraded test mode is desired.🤖 Generated with Claude Code