Include internal admin-call handling in legacy snapshot extraction#855
Include internal admin-call handling in legacy snapshot extraction#855MontrealAI wants to merge 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5bf2669483
ℹ️ 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".
| const ownerAddr = viewValues.owner ? toChecksumAddress(viewValues.owner) : null; | ||
| const ownerCode = ownerAddr ? rpcCall(rpcUrl, 'eth_getCode', [ownerAddr, snapshotBlockHex]) : '0x'; | ||
| if (ownerCode && ownerCode !== '0x') { | ||
| throw new Error( |
There was a problem hiding this comment.
Require API replay when fallback cannot prove full history
The HTML fallback gate only checks whether owner is a contract at the snapshot block, but internal admin calls can still exist from earlier periods when ownership was a multisig/contract wallet; those calls are not discoverable via /txs?a=... scraping and will be silently omitted from replayed mutator state. This means the script can report success while producing an incomplete snapshot whenever historical owner type changed over time, so deterministic migration is not guaranteed unless txlistinternal data is required (or historical ownership is fully validated).
Useful? React with 👍 / 👎.
Motivation
Description
scripts/snapshotLegacyMainnetConfig.js:parseTraceId(traceId)andcompareReplayOrder(a, b), and includedtraceIdin replay provenance so internal calls can be traced back to their context.ETHERSCAN_API_KEYis present the script now fetches bothaccount.txlistandaccount.txlistinternal, filters internals to those targeting the legacy address, merges + de-duplicates entries, and sorts by block/tx/index/trace order for deterministic replay.txlistinternalcontains internal calls to the legacy contract without calldata, and the HTML-scrape fallback will refuse to proceed when the snapshot owner is a contract wallet (enforcingETHERSCAN_API_KEYin that case).23200000(migrations/snapshots/legacy.mainnet.0x0178B6baD606aaF908f72135B8eC32Fc1D5bA477.json), added a migrationmigrations/2_deploy_agijobmanager_from_legacy_snapshot.js, renamed the deployment entrypoint tomigrations/1_deploy_contracts.js, and updated docs andscripts/docs/generate-repo-map.mjsto reflect the migration rename.Testing
MAINNET_RPC_URL=https://ethereum-rpc.publicnode.com node scripts/snapshotLegacyMainnetConfig.js --block 23200000and it completed and wrote the snapshot JSON. (success)npm run build(Truffle compile) which completed successfully albeit with a bytecode-size warning for a test harness. (success)npm run docs:checkwhich passed. (success)Codex Task