Skip to content

Harden ENSJobPages resolver handling, portable ENS audit tooling, and docs/artifacts refresh#154

Open
MontrealAI wants to merge 3 commits into
mainfrom
codex/patch-ens-job-page-subsystem-for-mainnet-readiness
Open

Harden ENSJobPages resolver handling, portable ENS audit tooling, and docs/artifacts refresh#154
MontrealAI wants to merge 3 commits into
mainfrom
codex/patch-ens-job-page-subsystem-for-mainnet-readiness

Conversation

@MontrealAI

Copy link
Copy Markdown
Owner

Motivation

  • Make ENS job-page authority/status and repair flows production-ready without changing AGIJobManagerPrime bytecode, and reconcile repo docs/tooling with live mainnet state.
  • Ensure audit/migration/repair scripts run in varied environments (do not assume hardhat/node_modules/ethers) and emit machine-readable chain-backed artifacts.
  • Treat missing ERC-165 write-interface bits on real-world resolvers as diagnostics while keeping guarded best-effort writes so ENS failures remain observable and non-blocking.

Description

  • Relaxed ENSJobPages.validateConfiguration() so resolver readability (text() probe) is a hard signal while ERC-165 write-interface bits (setText/setAuthorisation) are diagnostic only.
  • Removed pre-check gating for setText / setAuthorisation and kept guarded write attempts that emit ENSHookBestEffortFailure on failure.
  • Added _supportsTextLookup(address) probe and adapted _resolverCapabilities() to detect resolvers that respond to text(bytes32,string) even if they omit ERC-165 adverts.
  • Added a portable ethers compatibility shim at scripts/ens/lib/ethers.js and rewired ENS scripts (audit-mainnet.ts, inventory-job-pages.ts, repair-job-page.ts, migrate-legacy-batch.ts, phase0-mainnet-snapshot.mjs) to use it.
  • Regenerated live-chain JSON artifacts under scripts/ens/output/ from mainnet (audit, inventory, repair planner).
  • Clarified/updated documentation to explicitly separate preview* (projections) vs effective* (authoritative snapshots) terminology, and quarantine useEnsJobTokenURI for Prime docs.
  • Extended test/ensAuthoritySnapshot.test.js to cover live-style resolvers that implement readable text() but do not advertise write interfaces, and to assert explicit configuration flags in configurationStatus().

Testing

  • Ran chain-backed tooling: node scripts/ens/audit-mainnet.ts, MAX_JOBS=32 node scripts/ens/inventory-job-pages.ts, and JOB_ID=0 node scripts/ens/repair-job-page.ts, which completed and produced updated JSON artifacts under scripts/ens/output/ (success).
  • Updated and executed unit/regression tests: added resolver-compat cases in test/ensAuthoritySnapshot.test.js; test run was started in this environment but the full Truffle/Hardhat test/compile suite did not complete before handoff (in-progress).
  • Attempted cd hardhat && npm run compile and node scripts/check-bytecode-size.js to remeasure bytecode; compilation was started but the environment did not produce final size reports before handoff (pending).
  • Summary of automated status: ENS scripts and new tests run path validated; full compile/bytecode size verification remains to be completed in an operator environment and is a required final verification step.

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: bbef105d8c

ℹ️ 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 contracts/ens/ENSJobPages.sol Outdated
Comment on lines 443 to 444
(bool supportsText,,) = _resolverCapabilities();
if (!supportsText) failures |= CONFIG_ERR_RESOLVER_TEXT;

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 Restore write-capability gating in validateConfiguration

Any resolver that exposes a readable text(bytes32,string) surface but does not actually implement setText/setAuthorisation now passes validateConfiguration(). In that setup handleHook() will proceed, create/adopt the subname, and emit ENSHookProcessed(..., configured=true, success=true) because _setTextBestEffort() and _setAuthorisationBestEffort() swallow the missing-function reverts, but the page never gets metadata or permissions and jobEnsReady() stays false. Before this change the ERC-165 write-interface checks prevented that silent misconfiguration.

Useful? React with 👍 / 👎.

Comment thread scripts/ens/lib/ethers.js
Comment on lines +25 to +37
function compat() {
if (isV6) return raw;
const utils = raw.utils;
return {
...raw,
ZeroAddress: raw.constants.AddressZero,
ZeroHash: raw.constants.HashZero,
Interface: utils.Interface,
Wallet: raw.Wallet,
id: utils.id,
namehash: utils.namehash,
ensNormalize: (value) => value.trim().toLowerCase(),
solidityPackedKeccak256: (types, values) => utils.solidityKeccak256(types, values),

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 Complete the v5 compatibility shim before using it in phase0

When loadEthers() falls back to an ethers v5 install, compat() only aliases Interface, Wallet, hashing helpers, and constants. scripts/ens/phase0-mainnet-snapshot.mjs now consumes this helper but immediately calls new ethers.JsonRpcProvider(...) and new ethers.Contract(...), which do not exist on the v5-shaped object returned here. In the portability scenario this helper is meant to support (no hardhat/node_modules/ethers, only a standalone ethers install), the phase0 snapshot script will still crash before it can query mainnet.

Useful? React with 👍 / 👎.

@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: bb95e7e129

ℹ️ 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 scripts/ens/lib/ethers.js
Comment on lines +7 to +10
const candidates = [
path.resolve(__dirname, '../../../hardhat/node_modules/ethers'),
'ethers',
];

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 Finish the portable ethers fallback for RPC-based tools

This new helper does not make the ENS operator scripts portable end-to-end yet. audit-mainnet.ts, inventory-job-pages.ts, migrate-legacy-batch.ts, and repair-job-page.ts now import ./lib/ethers, but they still instantiate CurlJsonRpcProvider, and scripts/ens/lib/json_rpc.js:5 still does a hard require('../../../hardhat/node_modules/ethers'). In the exact fallback scenario this change is meant to support (no hardhat/node_modules/ethers, only a standalone ethers install), those scripts will still fail during module load before any RPC call.

Useful? React with 👍 / 👎.

@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: 73fcfbfb7b

ℹ️ 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 scripts/ens/lib/ethers.js
Comment on lines +28 to +40
return {
...raw,
ZeroAddress: raw.constants.AddressZero,
ZeroHash: raw.constants.HashZero,
Contract: raw.Contract,
JsonRpcProvider: raw.providers.JsonRpcProvider,
Interface: utils.Interface,
Wallet: raw.Wallet,
id: utils.id,
namehash: utils.namehash,
ensNormalize: (value) => value.trim().toLowerCase(),
solidityPackedKeccak256: (types, values) => utils.solidityKeccak256(types, values),
};

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 Provide toBeHex in the v5 ethers shim

In the standalone ethers v5 fallback this helper is supposed to support, compat() never defines toBeHex, but scripts/ens/lib/json_rpc.js now unconditionally calls ethers.toBeHex(...) when formatting block tags, nonces, gas, and values. That means audit-mainnet.ts, inventory-job-pages.ts, repair-job-page.ts, and migrate-legacy-batch.ts will still die with TypeError: ethers.toBeHex is not a function as soon as CurlJsonRpcProvider needs any quantity conversion, so the new portability path remains broken for every RPC-backed ENS tool.

Useful? React with 👍 / 👎.

Comment thread scripts/ens/lib/ethers.js
Comment on lines +34 to +39
Interface: utils.Interface,
Wallet: raw.Wallet,
id: utils.id,
namehash: utils.namehash,
ensNormalize: (value) => value.trim().toLowerCase(),
solidityPackedKeccak256: (types, values) => utils.solidityKeccak256(types, values),

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 Normalize v5 decoded integers before exposing the compat shim

The v5 branch returns utils.Interface unchanged, so decodeFunctionResult() still yields v5 BigNumber objects, while the scripts you just rewired assume v6-style native bigints. For example, inventory-job-pages.ts does Number(nextJobIdRead), phase0-mainnet-snapshot.mjs calls BigInt(value) in asNumber(), and audit-mainnet.ts only stringifies values whose type is bigint. In the exact fallback scenario this shim targets, those reads will either throw or serialize malformed JSON, so the ENS audit/snapshot tooling still cannot run end-to-end on an ethers v5 install.

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