Skip to content

tests: add seed script to improve resolution tests#1994

Open
sevenzing wants to merge 23 commits intomainfrom
ll/ensnode-tests
Open

tests: add seed script to improve resolution tests#1994
sevenzing wants to merge 23 commits intomainfrom
ll/ensnode-tests

Conversation

@sevenzing
Copy link
Copy Markdown
Member

@sevenzing sevenzing commented Apr 24, 2026

Summary

Add seeding mechanism for devnet to improve our testing


Why

We cannot test ensapi right now


Pre-Review Checklist (Blocking)

  • This PR does not introduce significant changes and is low-risk to review quickly.
  • Relevant changesets are included (or are not required)

@sevenzing sevenzing requested a review from a team as a code owner April 24, 2026 13:23
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 24, 2026

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

Project Deployment Actions Updated (UTC)
admin.ensnode.io Ready Ready Preview, Comment May 8, 2026 2:01pm
ensnode-enskit-react-example Ready Ready Preview, Comment May 8, 2026 2:01pm
ensnode.io Ready Ready Preview, Comment May 8, 2026 2:01pm
ensrainbow.io Ready Ready Preview, Comment May 8, 2026 2:01pm

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 24, 2026

⚠️ No Changeset found

Latest commit: c52de21

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 24, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This pull request consolidates devnet account management by migrating account definitions from the SDK to a shared datasources module, establishes devnet seeding infrastructure to populate primary names and resolver records, updates chain configuration from custom ID to chainId 1, and refactors integration tests and SDK internals accordingly.

Changes

Cohort / File(s) Summary
Integration Test Updates
apps/ensapi/src/handlers/api/resolution/resolve-primary-name.integration.test.ts, apps/ensapi/src/handlers/api/resolution/resolve-primary-names.integration.test.ts, apps/ensapi/src/handlers/api/resolution/resolve-records.integration.test.ts, apps/omnigraph-api/schema/account.integration.test.ts
Tests now reference accounts from devnet datasource instead of DEVNET_* constants; expected primary name for chain 1 changes from null to "test.eth"; resolver records test expanded with text records, multicoin addresses, and comprehensive record-type coverage.
Devnet Account Relocation
packages/ensnode-sdk/src/shared/devnet-accounts.ts, packages/datasources/src/devnet/constants.ts, packages/datasources/src/devnet/index.ts
Removes account exports from SDK; establishes new centralized constants module in datasources exporting accounts (deployer/owner/user/user2), contracts, addresses, and fixtures for deterministic devnet values.
Devnet Seeding Infrastructure
packages/integration-test-env/src/seed/index.ts, packages/integration-test-env/src/seed/primary-names.ts, packages/integration-test-env/src/seed/resolver-records.ts, packages/integration-test-env/src/orchestrator.ts
New seeding modules build viem wallet clients per account, call ethReverseRegistrar.setName("test.eth") for primary names, configure resolver records (text, multicoin addresses, ABI, pubkey, contentHash, interfaces), and integrate seeding into orchestrator after devnet readiness.
SDK and Example Updates
packages/ensnode-sdk/src/internal.ts, packages/ensnode-sdk/src/omnigraph-api/example-queries.ts
Removes devnet-accounts re-export from SDK barrel; updates example-queries to source devnet addresses from the new consolidated datasources module instead of local constants.
Chain Configuration and Namespace Logic
packages/datasources/src/lib/chains.ts, apps/ensindexer/src/lib/ponder-helpers.ts, apps/ensindexer/src/plugins/tokenscope/plugin.ts, packages/ensnode-sdk/src/shared/config/rpc-configs-from-env.ts
ensTestEnvChain.id changes from 0xeeeeed to 1; ponder-helpers replaces chain-id-based cache-disable logic with namespace-based check (ENSNamespaceIds.EnsTestEnv); tokenscope plugin passes namespace to chainsConnectionConfig; RPC config builder gates special case on namespace match.
Datasources Package Restructuring
packages/datasources/package.json, packages/datasources/tsup.config.ts, packages/datasources/src/namespaces.ts
Exposes new subpath export "./devnet"; updates publishConfig.exports to per-path mapping; adds enssdk to dependencies; adjusts tsup to compile devnet entry; routes ensTestEnv namespace import from ./ens-test-env to ./devnet/namespace.
L2 Reverse Registrar ABI
packages/datasources/src/abis/root/L2ReverseRegistrar.ts, packages/datasources/src/index.ts
Adds comprehensive L2ReverseRegistrar contract ABI definition (643 lines) with constructor, functions, events, and errors; exports as L2ReverseRegistrarABI from package root.
Dependencies and Image Update
packages/integration-test-env/package.json, docker/services/devnet.yml
Adds viem to integration-test-env dependencies; updates devnet docker image from main-e8696c6 to main-9f26a8f.

Sequence Diagram

sequenceDiagram
    participant Orchestrator as Orchestrator
    participant Seeder as Seeding Module
    participant VClient as Viem Wallet Clients
    participant DevNet as Devnet Contracts
    participant Registry as ethReverseRegistrar
    participant Resolver as Resolver

    Orchestrator->>Seeder: seedDevnet(rpcUrl)
    Seeder->>VClient: Build wallet clients (deployer, owner, user, user2)
    VClient-->>Seeder: Configured clients with accounts
    
    Seeder->>Seeder: seedPrimaryNameRecords(clients)
    Seeder->>Registry: clients.owner → setName("test.eth")
    Registry-->>Seeder: tx hash
    Seeder->>DevNet: waitForTransactionReceipt()
    
    Seeder->>Seeder: seedResolverRecords(clients)
    Seeder->>DevNet: findResolver("test.eth")
    DevNet-->>Seeder: resolver address
    
    Seeder->>Resolver: setText (avatar, twitter, github, etc.)
    Seeder->>Resolver: setAddr (BTC, LTC coin types)
    Seeder->>Resolver: setContenthash()
    Seeder->>Resolver: setPubkey()
    Seeder->>Resolver: setABI()
    Seeder->>Resolver: setInterface()
    Resolver-->>Seeder: tx receipts
    
    Seeder-->>Orchestrator: Complete
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

ensnode-sdk, devnet, testing, integration-tests

Poem

🐰 From constant chaos, order takes its hop,
Devnet accounts now centralized—they don't stop!
Seeding records with viem and care,
Primary names and resolvers everywhere.
Test.eth blooms where chainId once did creep!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete. It lacks the 'Testing' and 'Why' sections required by the template and provides only minimal information about the changes. Add 'Testing' section explaining how changes were tested, and expand 'Why' section with GitHub issue link and detailed motivation for the seeding mechanism.
Docstring Coverage ⚠️ Warning Docstring coverage is 15.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding a seed script to improve resolution tests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ll/ensnode-tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread packages/datasources/src/lib/chains.ts Outdated
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 24, 2026

Greptile Summary

This PR adds a seeding mechanism for the devnet integration test environment, bootstrapping primary name records and resolver records for test.eth before the ENSIndexer runs, enabling meaningful end-to-end assertion of resolution results rather than null/empty checks.

  • Extracts devnet contract addresses, accounts, and test fixtures into a new packages/datasources/src/devnet/constants.ts, published under the ./devnet subpath export, replacing the old DevnetAccounts in @ensnode/ensnode-sdk/internal.
  • Adds a seed phase (Phase 2) in the orchestrator that writes primary name and resolver records on-chain before indexing starts, and expands the integration test suite with comprehensive multi-coin, text-record, pubkey, ABI, contenthash, and interface assertions.

Confidence Score: 4/5

Safe to merge with awareness that the primary-name seeding calls a contract not watched by the ENSIndexer, which will cause primary-name integration tests to fail

The resolver-records seeding is correct and comprehensive. The orchestrator integration is sound (chain-ID check runs before seeding, all receipts are awaited). However, primary-names.ts calls setName on contracts.ETHReverseRegistrar, while the ENSIndexer only indexes events from contracts.DefaultReverseRegistrar — a different address. The seeded primary name will silently succeed on-chain but the event will never reach the indexer, so resolve-primary-name and resolve-primary-names tests asserting "test.eth" will fail in CI.

packages/integration-test-env/src/seed/primary-names.ts — the contract address passed to writeContract needs to match the contract that the ENSIndexer is actually watching for reverse-registrar events

Important Files Changed

Filename Overview
packages/integration-test-env/src/seed/primary-names.ts Seeds primary names using contracts.ETHReverseRegistrar with L2ReverseRegistrarABI — a contract/ABI mismatch; the indexer watches contracts.DefaultReverseRegistrar (different address), so seeded events may not be indexed
packages/integration-test-env/src/seed/resolver-records.ts Comprehensively seeds text records, multi-coin addresses, contenthash, pubkey, ABI, and interface records for test.eth; all writes properly awaited via waitForTransactionReceipt; resolver mismatch guard added
packages/integration-test-env/src/seed/index.ts Clean orchestration of seed phases; wallet clients created from ensTestEnvChain (chain ID 31337); waitForTransactionReceipt helper correctly wired
packages/datasources/src/devnet/constants.ts New file centralising deterministic devnet contract addresses, accounts (mnemonic-derived), and test fixtures; well-typed with as const satisfies patterns
packages/integration-test-env/src/orchestrator.ts Adds Phase 2 seed step before indexing; uses the already-validated RPC_URL constant; devnet chain-ID check runs before seeding
packages/datasources/src/lib/chains.ts Minor: inline comment moved to JSDoc; chain ID remains 31337, consistent with Anvil default
apps/ensapi/src/handlers/api/resolution/resolve-records.integration.test.ts Significantly expanded: new assertions for multi-coin addresses, text records, pubkey, ABI, contenthash, and interface records against seeded devnet state
packages/datasources/src/abis/root/L2ReverseRegistrar.ts New ABI file for the ENSv2 L2ReverseRegistrar contract; accurately reflects the on-chain interface including setName, setNameForAddr, and signature-based variants

Sequence Diagram

sequenceDiagram
    participant O as Orchestrator
    participant DC as Docker Compose
    participant S as Seed Script
    participant D as Devnet (Anvil)
    participant I as ENSIndexer
    participant A as ENSApi
    participant T as Integration Tests

    O->>DC: Start ENSDb + Devnet containers
    DC-->>O: Devnet ready (chain ID verified)

    O->>S: seedDevnet(rpcUrl)
    S->>D: setPrimaryNameRecord("test.eth") via ETHReverseRegistrar
    D-->>S: tx receipt
    S->>D: seedResolverRecords for test.eth (texts, addrs, contenthash, pubkey, ABI, interfaces)
    D-->>S: tx receipts (all awaited)
    S-->>O: Devnet seeded

    O->>I: Start ENSIndexer (pnpm start)
    I->>D: Index on-chain events from block 0
    I-->>O: omnichain-following / omnichain-completed

    O->>A: Start ENSApi (pnpm start)
    A-->>O: /health 200

    O->>T: pnpm test:integration
    T->>A: GET /api/resolve/primary-name/:address/1
    T->>A: GET /api/resolve/records/test.eth
    A-->>T: Assertions pass
Loading

Reviews (10): Last reviewed commit: "fix cicd" | Re-trigger Greptile

Comment thread apps/ensapi/src/handlers/api/resolution/resolve-primary-names.integration.test.ts Outdated
Comment thread packages/integration-test-env/src/seed/resolver-records.ts
Comment thread packages/ensnode-sdk/src/shared/devnet/data.ts Outdated
Comment thread packages/integration-test-env/src/seed/resolver-records.ts Outdated
@@ -0,0 +1,97 @@
/**
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

decided to keep all addresses from pnpm devnet logs

@vercel vercel Bot temporarily deployed to Preview – ensnode.io April 24, 2026 13:29 Inactive
@vercel vercel Bot temporarily deployed to Preview – admin.ensnode.io April 24, 2026 13:29 Inactive
@vercel vercel Bot temporarily deployed to Preview – ensrainbow.io April 24, 2026 13:29 Inactive
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@apps/ensapi/src/handlers/api/resolution/resolve-primary-names.integration.test.ts`:
- Around line 16-22: Update the test description string in the
resolve-primary-names integration test to reflect that a primary name is now
seeded for DEVNET_ACCOUNTS.owner on chain 1; locate the test case that currently
has description "resolves primary names for owner address on chain 1 (no primary
name set in devnet)" and change it to mention that test.eth is the seeded
primary (e.g., "resolves primary name test.eth for owner address on chain 1") so
the description matches expectedBody.names["1"] === "test.eth".

In `@packages/ensnode-sdk/src/shared/devnet/accounts.ts`:
- Line 26: The entry named one in DEVNET_ACCOUNTS is an undocumented hardcoded
address (toNormalizedAddress(`0x${"1".repeat(40)}`)) and is inconsistent with
sibling entries derived from DEVNET_MNEMONIC; either add a comment explaining
its purpose and why it’s included alongside mnemonic-derived signers (e.g.,
"Placeholder address used for X — not a signer") or remove/move it out of
DEVNET_ACCOUNTS into a clearer constant (e.g., DEVNET_BYTES or
DEVNET_PLACEHOLDER_ADDRESSES) and update any consumers to reference the new
constant so DEVNET_ACCOUNTS only contains mnemonic-derived signers. Ensure
references to DEVNET_MNEMONIC and toNormalizedAddress remain correct if you keep
it.

In `@packages/ensnode-sdk/src/shared/devnet/data.ts`:
- Around line 3-11: The DEVNET_BYTES object is currently annotated as
Record<string, Hex>, which widens and loses its literal keys; replace the
explicit type annotation with a satisfies clause so keys are preserved while
values remain constrained to Hex. Concretely, remove ": Record<string, Hex>" and
export the object as a constant using the satisfies operator, e.g. declare
DEVNET_BYTES with "export const DEVNET_BYTES = { ... } as const satisfies
Record<string, Hex>;" (or at minimum "export const DEVNET_BYTES = { ... }
satisfies Record<string, Hex>;") so IDE autocomplete and key-level type
narrowing for DEVNET_BYTES is retained.

In `@packages/integration-test-env/src/seed/index.ts`:
- Around line 19-24: Update the stale inline comments on the DevnetWalletClients
type so they no longer reference legacy constants
DEVNET_OWNER/DEVNET_USER/DEVNET_USER2; instead, describe each wallet's
role/purpose consistent with DEVNET_ACCOUNTS and the comments in
packages/ensnode-sdk/src/shared/devnet/accounts.ts (e.g., deployer — index 0 has
REGISTRAR role on ETHRegistry; owner — index 1 owns test.eth; user — index 2
general test user; user2 — index 3 secondary test user). Locate these comments
next to the DevnetWalletClients type and replace the old constant names with the
role/purpose descriptions.

In `@packages/integration-test-env/src/seed/primary-names.ts`:
- Around line 10-18: The setPrimaryNameRecord function (and all set*Record
functions in resolver-records.ts such as setTextRecord, setMulticoinAddress,
setContenthash, setPubkey, setAbi, setInterfaceImplementer) currently returns
immediately after walletClient.writeContract (which only submits to mempool);
modify each seeding function to await transaction finality by calling
publicClient.waitForTransactionReceipt({ hash }) after writeContract returns its
hash and before returning (use the returned hash from walletClient.writeContract
and ensure the wait call is awaited so seedPrimaryNameRecords and seedDevnet
only proceed after the tx is mined).

In `@packages/integration-test-env/src/seed/resolver-records.ts`:
- Around line 144-152: Remove the commented-out dead block for
clearResolverRecords (the async function referencing PUBLIC_RESOLVER) since it
uses an undefined symbol and clutters the file; either delete the entire
commented section or restore it as a working helper by updating the symbol to
the file's RESOLVER constant, import/define any missing types/abi
(DevnetWalletClient, Hex, publicResolverAbi) and adjust the writeContract call
to use RESOLVER and valid args so it compiles and works for local debugging.
- Around line 12-40: seedResolverRecords currently fires many writeContract
calls (via helpers like setTextRecord, setMulticoinAddress, setContenthash,
setPubkey, setAbi, setInterfaceImplementer) which return RPC tx hashes but do
not wait for mining; collect the returned tx hashes (or receipts) from those
helper calls and then use the public client's waitForTransactionReceipt (e.g.,
clients.owner.publicClient.waitForTransactionReceipt) to await the last tx (or
await each hash) before returning from seedResolverRecords so indexing cannot
start before transactions are mined and reverted txs surface.
- Line 14: The call to assertTestEthResolver is reaching into viem internals via
clients.owner.transport.url; instead, add an explicit rpcUrl parameter to
seedResolverRecords and assertTestEthResolver, replace uses of
clients.owner.transport.url with the rpcUrl argument inside seedResolverRecords
and assertTestEthResolver, and update the caller (from seedDevnet/seed/index.ts)
to pass the existing rpcUrl value through to seedResolverRecords so no transport
internals are accessed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 96a22959-433e-410a-95be-35ae2754d0b0

📥 Commits

Reviewing files that changed from the base of the PR and between 0d8a4b4 and 65f083f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (17)
  • apps/ensapi/src/handlers/api/resolution/resolve-primary-name.integration.test.ts
  • apps/ensapi/src/handlers/api/resolution/resolve-primary-names.integration.test.ts
  • apps/ensapi/src/handlers/api/resolution/resolve-records.integration.test.ts
  • apps/ensapi/src/omnigraph-api/schema/account.integration.test.ts
  • packages/datasources/src/lib/chains.ts
  • packages/ensnode-sdk/src/internal.ts
  • packages/ensnode-sdk/src/omnigraph-api/example-queries.ts
  • packages/ensnode-sdk/src/shared/devnet-accounts.ts
  • packages/ensnode-sdk/src/shared/devnet/accounts.ts
  • packages/ensnode-sdk/src/shared/devnet/addresses.ts
  • packages/ensnode-sdk/src/shared/devnet/data.ts
  • packages/integration-test-env/package.json
  • packages/integration-test-env/src/orchestrator.ts
  • packages/integration-test-env/src/seed/abi.ts
  • packages/integration-test-env/src/seed/index.ts
  • packages/integration-test-env/src/seed/primary-names.ts
  • packages/integration-test-env/src/seed/resolver-records.ts
💤 Files with no reviewable changes (1)
  • packages/ensnode-sdk/src/shared/devnet-accounts.ts

Comment thread apps/ensapi/src/handlers/api/resolution/resolve-primary-names.integration.test.ts Outdated
Comment thread packages/ensnode-sdk/src/shared/devnet/accounts.ts Outdated
Comment thread packages/ensnode-sdk/src/shared/devnet/data.ts Outdated
Comment thread packages/integration-test-env/src/seed/index.ts
Comment thread packages/integration-test-env/src/seed/primary-names.ts
Comment thread packages/integration-test-env/src/seed/resolver-records.ts
Comment thread packages/integration-test-env/src/seed/resolver-records.ts Outdated
Comment thread packages/integration-test-env/src/seed/resolver-records.ts Outdated
Comment thread packages/ensnode-sdk/src/shared/devnet/data.ts Outdated
Comment thread apps/ensapi/src/handlers/api/resolution/resolve-primary-names.integration.test.ts Outdated
Comment thread packages/ensnode-sdk/src/shared/devnet/accounts.ts Outdated
Comment thread packages/integration-test-env/src/seed/resolver-records.ts Outdated
Comment thread packages/integration-test-env/src/seed/resolver-records.ts
Comment thread packages/integration-test-env/src/seed/index.ts Outdated
@sevenzing sevenzing marked this pull request as draft April 24, 2026 14:34
Copy link
Copy Markdown
Member

@shrugs shrugs left a comment

Choose a reason for hiding this comment

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

LOVE the direction, way better than forking; i'd forgotten that we just know the test mnemonic and can hook in like that. definitely the correct direction, thanks for prototyping this

Comment thread packages/integration-test-env/src/seed/index.ts Outdated
Comment thread packages/integration-test-env/src/seed/abi.ts Outdated
Comment thread packages/ensnode-sdk/src/shared/devnet/addresses.ts Outdated
Comment thread packages/ensnode-sdk/src/shared/devnet/accounts.ts Outdated
Comment thread packages/ensnode-sdk/src/shared/devnet/data.ts Outdated
Comment thread packages/integration-test-env/src/seed/index.ts Outdated
Comment thread packages/integration-test-env/src/seed/resolver-records.ts Outdated
Comment thread packages/integration-test-env/src/seed/resolver-records.ts
Comment thread packages/integration-test-env/src/seed/resolver-records.ts Outdated
Comment thread packages/integration-test-env/src/orchestrator.ts Outdated
@shrugs
Copy link
Copy Markdown
Member

shrugs commented Apr 24, 2026

i didn't see the devnet commit version be updated in this pr, make sure that's done in the docker-compose so that the orchestrator is definitely using the correct version and the chain id update is locked in. all devnet-specific stuff must be pinned to a specific commit or we're going to have a really annoying time when things change behind the scenes (as they do a LOT)

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/integration-test-env/src/orchestrator.ts (1)

7-13: ⚠️ Potential issue | 🟡 Minor

File-level phase docstring is out of sync with code.

The header still lists 5 phases, but the implementation now has 7 phases (Phase 2 = seed devnet, Phase 5 = poll indexing status, Phase 6 = ENSApi, Phase 7 = tests). New readers will miss that seeding is part of the orchestration.

📝 Proposed update
  * Phases:
  *   1. Postgres + devnet via docker-compose (testcontainers DockerComposeEnvironment)
- *   2. Download pre-built ENSRainbow LevelDB, extract, start ENSRainbow from source
- *   3. Start ENSIndexer, wait for omnichain-following / omnichain-completed
- *   4. Start ENSApi
- *   5. Run `pnpm test:integration` at the monorepo root
+ *   2. Seed devnet with primary names and resolver records
+ *   3. Download pre-built ENSRainbow LevelDB, extract, start ENSRainbow from source
+ *   4. Start ENSIndexer
+ *   5. Wait for omnichain-following / omnichain-completed
+ *   6. Start ENSApi
+ *   7. Run `pnpm test:integration` at the monorepo root
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/integration-test-env/src/orchestrator.ts` around lines 7 - 13,
Update the top-of-file phase docstring in orchestrator.ts to match the current
implementation: replace the old 5-phase list with the accurate 7-phase sequence
and explicitly include the new "seed devnet" and "poll indexing status" steps
(which correspond to the code paths that perform devnet seeding and polling for
omnichain-following/omnichain-completed before starting ENSApi and running
tests); reference the existing phase logic implemented in the orchestration
functions (the devnet seed routine, the indexing poll routine, the ENSApi start
routine, and the final test-run invocation) and reorder the docstring so each
implemented phase is described in the same order the code executes.
♻️ Duplicate comments (1)
packages/ensnode-sdk/src/shared/devnet/addresses.ts (1)

13-100: 🧹 Nitpick | 🔵 Trivial

DEVNET_CONTRACTS values are not normalized (lowercase) addresses.

These are checksummed Address literals, not NormalizedAddress. Consumers like seedResolverRecordsForName already work around this with actualResolver.toLowerCase() !== resolver.toLowerCase() (resolver-records.ts line 29), but any future strict equality / set membership comparison against another NormalizedAddress will silently mismatch. Recommend normalizing once at definition (and ideally typing via toNormalizedAddress so the type alias enforces the invariant).

♻️ Proposed change
+import { type NormalizedAddress, toNormalizedAddress } from "enssdk";
+
+const n = toNormalizedAddress;
+
-export const DEVNET_CONTRACTS = {
+export const DEVNET_CONTRACTS = {
   // -- DNS --
-  dnssecGatewayProvider: "0x5FbDB2315678afecb367f032d93F642f64180aa3",
+  dnssecGatewayProvider: n("0x5FbDB2315678afecb367f032d93F642f64180aa3"),
   // …apply to each entry…
-} as const;
+} as const satisfies Record<string, NormalizedAddress>;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ensnode-sdk/src/shared/devnet/addresses.ts` around lines 13 - 100,
DEVNET_CONTRACTS currently contains checksummed Address literals which can
mismatch NormalizedAddress comparisons (see seedResolverRecordsForName’s
toLowerCase workaround); update the DEVNET_CONTRACTS object so every contract
address value is normalized (lowercase) at definition and typed as a
NormalizedAddress (use the existing toNormalizedAddress helper or equivalent) so
the invariant is enforced (refer to DEVNET_CONTRACTS,
seedResolverRecordsForName, and toNormalizedAddress for locating spots to
change).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/datasources/src/lib/chains.ts`:
- Around line 3-7: Update the JSDoc comment in
packages/datasources/src/lib/chains.ts to remove the trailing colon and clearly
state that the ens-test-env intentionally uses chain id 1 to mirror mainnet (so
callers should not treat id==1 as a sentinel for real mainnet), and mention the
potential for mainnet-collision to discourage future sentinel-style checks
against the value; update the comment text above the file/module (where the
current /** The ens-test-env chain id is 1: */ block appears) accordingly.
- Around line 8-13: The current gate that disables Ponder's cache uses a numeric
comparison against ensTestEnvChain.id (e.g., `chainId === 31337 || chainId ===
1337 || chainId === ensTestEnvChain.id`) which collides with mainnet id; change
that logic to use the namespace instead — replace the `... || chainId ===
ensTestEnvChain.id` check with a namespace check such as `config.namespace ===
ENSNamespaceIds.EnsTestEnv` (use the existing ENSNamespaceIds enum/const and the
`config.namespace` value) so local-dev detection relies on `config.namespace`
rather than the numeric `ensTestEnvChain.id`, leaving other chainId checks
intact.

In `@packages/ensnode-sdk/src/shared/devnet/addresses.ts`:
- Around line 107-114: The JSDoc describing "Named signer accounts from the
ens-test-env devnet…" is incorrectly attached to the helper
deriveNormalizedAccount; move that doc block to sit directly above the exported
DEVNET_ACCOUNTS constant so the comment documents the export it describes, and
either remove or replace the JSDoc on deriveNormalizedAccount (or add a brief
helper-specific comment) so deriveNormalizedAccount, DEVNET_ACCOUNTS and
DEVNET_MNEMONIC are correctly and clearly documented.

---

Outside diff comments:
In `@packages/integration-test-env/src/orchestrator.ts`:
- Around line 7-13: Update the top-of-file phase docstring in orchestrator.ts to
match the current implementation: replace the old 5-phase list with the accurate
7-phase sequence and explicitly include the new "seed devnet" and "poll indexing
status" steps (which correspond to the code paths that perform devnet seeding
and polling for omnichain-following/omnichain-completed before starting ENSApi
and running tests); reference the existing phase logic implemented in the
orchestration functions (the devnet seed routine, the indexing poll routine, the
ENSApi start routine, and the final test-run invocation) and reorder the
docstring so each implemented phase is described in the same order the code
executes.

---

Duplicate comments:
In `@packages/ensnode-sdk/src/shared/devnet/addresses.ts`:
- Around line 13-100: DEVNET_CONTRACTS currently contains checksummed Address
literals which can mismatch NormalizedAddress comparisons (see
seedResolverRecordsForName’s toLowerCase workaround); update the
DEVNET_CONTRACTS object so every contract address value is normalized
(lowercase) at definition and typed as a NormalizedAddress (use the existing
toNormalizedAddress helper or equivalent) so the invariant is enforced (refer to
DEVNET_CONTRACTS, seedResolverRecordsForName, and toNormalizedAddress for
locating spots to change).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ba17a835-903e-45c1-8fbf-d54b284898b5

📥 Commits

Reviewing files that changed from the base of the PR and between 65f083f and 51239ad.

📒 Files selected for processing (13)
  • apps/ensapi/src/handlers/api/resolution/resolve-primary-name.integration.test.ts
  • apps/ensapi/src/handlers/api/resolution/resolve-primary-names.integration.test.ts
  • apps/ensapi/src/handlers/api/resolution/resolve-records.integration.test.ts
  • apps/ensapi/src/omnigraph-api/schema/account.integration.test.ts
  • docker/services/devnet.yml
  • packages/datasources/src/lib/chains.ts
  • packages/ensnode-sdk/src/internal.ts
  • packages/ensnode-sdk/src/omnigraph-api/example-queries.ts
  • packages/ensnode-sdk/src/shared/devnet/addresses.ts
  • packages/ensnode-sdk/src/shared/devnet/data.ts
  • packages/integration-test-env/src/orchestrator.ts
  • packages/integration-test-env/src/seed/index.ts
  • packages/integration-test-env/src/seed/resolver-records.ts

Comment thread packages/datasources/src/lib/chains.ts Outdated
Comment thread packages/datasources/src/lib/chains.ts
Comment thread packages/ensnode-sdk/src/shared/devnet/addresses.ts Outdated
Comment thread packages/integration-test-env/src/seed/primary-names.ts
Copy link
Copy Markdown
Member

@shrugs shrugs left a comment

Choose a reason for hiding this comment

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

Really great direction

Comment thread apps/ensapi/src/handlers/api/resolution/resolve-records.integration.test.ts Outdated
Comment thread packages/datasources/src/devnet/constants.ts Outdated
Comment thread packages/datasources/src/devnet/constants.ts Outdated
Comment thread packages/datasources/src/devnet/constants.ts
Comment thread packages/datasources/src/devnet/constants.ts Outdated
Comment thread packages/datasources/src/devnet/constants.ts Outdated
Comment thread packages/datasources/src/devnet/namespace.ts Outdated
Comment thread packages/datasources/package.json
Comment thread packages/integration-test-env/src/orchestrator.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants