Skip to content

Use shared mainnet RPC env helper for verifier ENS TXT resolution#328

Merged
GsCommand merged 1 commit into
mainfrom
codex/patch-ens-txt-resolution-in-verify-endpoint
May 24, 2026
Merged

Use shared mainnet RPC env helper for verifier ENS TXT resolution#328
GsCommand merged 1 commit into
mainfrom
codex/patch-ens-txt-resolution-in-verify-endpoint

Conversation

@GsCommand
Copy link
Copy Markdown
Contributor

Motivation

  • lib/verifyReceipt.js previously did not build a provider from production RPC env vars, causing ENS TXT lookups (used by /api/verify) to miss configured RPC endpoints and report ens_key_unavailable despite RPC envs being present.
  • Centralize RPC env resolution to avoid duplicated provider logic and ensure both ENS-owned lookup and receipt verification use the same configured mainnet RPC.

Description

  • Added lib/mainnetRpc.js exporting getMainnetRpcUrl(env = process.env) and createMainnetProvider(env = process.env) with the requested resolution order: ETHEREUM_RPC_URL, MAINNET_RPC_URL, ALCHEMY_ETHEREUM_RPC_URL, ALCHEMY_ETH_RPC_URL, ETH_RPC_URL, and finally mapping ALCHEMY_API_KEY to https://eth-mainnet.g.alchemy.com/v2/<key>.
  • Updated lib/verifyReceipt.js to use a default ENS TXT resolver that constructs a provider via createMainnetProvider (or uses an injected provider/textResolver) so ENS TXT fields (cl.sig.pub, cl.sig.kid, cl.sig.canonical, cl.receipt.signer) are resolved via configured RPC by default while preserving ENS-first semantics and local fallback gating.
  • Rewired api/ens/owned.js to consume the shared getMainnetRpcUrl/createMainnetProvider helper and removed duplicate env/provider logic there, and allowed deterministic test injection by forwarding req.verifyOptions from api/verify.js and api/agents/verifyagent.js into verifyReceipt.
  • Updated ops docs docs/ops/environment.md to note ETHEREUM_RPC_URL is used by both ENS owned lookup and verifier, and added/adjusted tests tests/mainnet-rpc.test.js, tests/verifyReceipt-runtime.test.js, and tests/api-verify.test.js to cover RPC precedence, Alchemy key mapping, provider-path ENS TXT resolution, injected resolver verification, missing TXT, resolver errors, and fallback gating.

Testing

  • Ran npm test and all automated tests passed (117 tests run, 117 passed, 0 failed).
  • Ran npm run check:links and it completed successfully with local link checks passing.
  • Searched for erc8211.merkle.v1 and found no matches (no occurrences).

Codex Task

@vercel
Copy link
Copy Markdown

vercel Bot commented May 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
commandlayer-commandlayer-org Ready Ready Preview, Comment May 24, 2026 3:24am
commandlayer-org Ready Ready Preview, Comment May 24, 2026 3:24am
commandlayer-org111 Ready Ready Preview, Comment May 24, 2026 3:24am

Request Review

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