Harden ENS cutover preflight and keeper-mode lock safety#167
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b0497eeda
ℹ️ 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".
|
|
||
| async function preflightEnsWiring(managerAddress, ensJobPagesAddress) { | ||
| const [managerCompat, targetValidationMask, targetJobManager] = await Promise.all([ | ||
| classifyManagerCompatibility(managerAddress, 1n), |
There was a problem hiding this comment.
Stop probing compatibility with a non-existent job id
preflightEnsWiring always calls classifyManagerCompatibility(..., 1n), and the probe methods in classifyManagerCompatibility execute real reads (getJob* / jobEmployerOf / jobAssignedAgentOf) against job 1. On a freshly deployed manager, those views revert because _job(jobId) requires an existing job, so the manager is misclassified as none and ENS wiring is refused before setEnsJobPages(...) can run. This makes the new preflight block valid first-time deployments that set ENS_JOB_PAGES.
Useful? React with 👍 / 👎.
| const leanReadable = await Promise.all([ | ||
| surfaceReadable(managerAddress, "jobEmployerOf(uint256) view returns (address)", [probeJobId]), | ||
| surfaceReadable(managerAddress, "jobAssignedAgentOf(uint256) view returns (address)", [probeJobId]), | ||
| ]); |
There was a problem hiding this comment.
Avoid job-id-dependent probes in LOCK_CONFIG gating
This compatibility probe also depends on reading job 1, so managers with zero jobs are classified as incompatible even when they implement the required interfaces. As a result, LOCK_CONFIG can be incorrectly refused in deploy-ens-job-pages.js on fresh/test deployments, because the classification logic treats JobNotFound reverts as lack of surface support instead of a valid interface with missing data.
Useful? React with 👍 / 👎.
Motivation
ENSJobPageswas already broadly correct but deployment/cutover tooling could wire incompatible manager/ENS pairs or lock configuration unsafely in keeper-required modes.AGIJobManagerPrimeruntime or increasing its bytecode.Description
hardhat/scripts/deploy-ens-job-pages.js, emittingmanagerMode(rich/lean/none),keeperRequired, and refusingLOCK_CONFIGwhen manager/ENS compatibility is unsafe unless explicitly overridden (ALLOW_LOCK_WITH_KEEPER).hardhat/scripts/deploy.jsthat verifies the ENSJobPages target exposesvalidateConfiguration(), thatjobManager()on the ENS target matches the freshly-deployed Prime manager, and that the manager compatibility mode is safe before callingsetEnsJobPages(...).hardhat/README.md,hardhat/deploy.config.example.js, and ENS audit/change-plan docs to reflect keeper-assisted mode and preflight requirements.scripts/ens/output/to reflect the selected Option B architecture (Prime unchanged, keeper-assisted metadata repair) and that deploy preflight is implemented.Testing
npm run test:sizeandnpm run test:size:benchmark, confirmingAGIJobManagerPrimeruntime remains24472bytes (headroom 104) and no Prime runtime change occurred; ENS-side and inspector sizes reported and are report-only. (succeeded)npx truffle test --network test test/ensAuthoritySnapshot.test.js test/ensAbiCompatibility.test.js test/ensKeeperAssistedPrimePath.test.jsand observed the ENS/keeper-assisted tests pass (tests reported as passing; contract suite output: 18 passing). (succeeded)npm run docs:ens:check. (succeeded)node --check hardhat/scripts/deploy.jsandnode --check hardhat/scripts/deploy-ens-job-pages.js. (succeeded)npm run test:size,npm run test:size:benchmark,npx truffle test --network test test/ensAuthoritySnapshot.test.js test/ensAbiCompatibility.test.js test/ensKeeperAssistedPrimePath.test.js,npm run docs:ens:check,node --check hardhat/scripts/deploy.js,node --check hardhat/scripts/deploy-ens-job-pages.js(all passed).Codex Task