Skip to content

Harden ENS cutover preflight and keeper-mode lock safety#167

Open
MontrealAI wants to merge 1 commit into
mainfrom
codex/audit-ensjobmanagerprime-for-authoritative-ens-exposure
Open

Harden ENS cutover preflight and keeper-mode lock safety#167
MontrealAI wants to merge 1 commit into
mainfrom
codex/audit-ensjobmanagerprime-for-authoritative-ens-exposure

Conversation

@MontrealAI

Copy link
Copy Markdown
Owner

Motivation

  • ENS authority model in ENSJobPages was already broadly correct but deployment/cutover tooling could wire incompatible manager/ENS pairs or lock configuration unsafely in keeper-required modes.
  • The goal is to make cutover honest and operator-safe without touching AGIJobManagerPrime runtime or increasing its bytecode.
  • Provide machine-readable manager compatibility signals and fail-fast preflight checks so operators never treat preview values as authoritative when manager capabilities are inadequate.

Description

  • Added manager compatibility classification and lock-safety gates to the ENS deployment helper in hardhat/scripts/deploy-ens-job-pages.js, emitting managerMode (rich/lean/none), keeperRequired, and refusing LOCK_CONFIG when manager/ENS compatibility is unsafe unless explicitly overridden (ALLOW_LOCK_WITH_KEEPER).
  • Added a semantic ENS-target preflight to hardhat/scripts/deploy.js that verifies the ENSJobPages target exposes validateConfiguration(), that jobManager() on the ENS target matches the freshly-deployed Prime manager, and that the manager compatibility mode is safe before calling setEnsJobPages(...).
  • Updated operator-facing artifacts and docs: hardhat/README.md, hardhat/deploy.config.example.js, and ENS audit/change-plan docs to reflect keeper-assisted mode and preflight requirements.
  • Updated machine-readable audit outputs in scripts/ens/output/ to reflect the selected Option B architecture (Prime unchanged, keeper-assisted metadata repair) and that deploy preflight is implemented.

Testing

  • Ran bytecode/size gates with npm run test:size and npm run test:size:benchmark, confirming AGIJobManagerPrime runtime remains 24472 bytes (headroom 104) and no Prime runtime change occurred; ENS-side and inspector sizes reported and are report-only. (succeeded)
  • Executed targeted contract tests: npx truffle test --network test test/ensAuthoritySnapshot.test.js test/ensAbiCompatibility.test.js test/ensKeeperAssistedPrimePath.test.js and observed the ENS/keeper-assisted tests pass (tests reported as passing; contract suite output: 18 passing). (succeeded)
  • Validated ENS docs with npm run docs:ens:check. (succeeded)
  • Verified deployment helpers syntax with node --check hardhat/scripts/deploy.js and node --check hardhat/scripts/deploy-ens-job-pages.js. (succeeded)
  • Commands run (representative): 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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread hardhat/scripts/deploy.js

async function preflightEnsWiring(managerAddress, ensJobPagesAddress) {
const [managerCompat, targetValidationMask, targetJobManager] = await Promise.all([
classifyManagerCompatibility(managerAddress, 1n),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +106 to +109
const leanReadable = await Promise.all([
surfaceReadable(managerAddress, "jobEmployerOf(uint256) view returns (address)", [probeJobId]),
surfaceReadable(managerAddress, "jobAssignedAgentOf(uint256) view returns (address)", [probeJobId]),
]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant