Skip to content

tests: add seed script to improve resolution tests#1994

Draft
sevenzing wants to merge 11 commits intomainfrom
ll/ensnode-tests
Draft

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

Conversation

@sevenzing
Copy link
Copy Markdown
Member

Lite PR

Tip: Review docs on the ENSNode PR process

Summary

  • What changed (1-3 bullets, no essays).

Why

  • Why this change exists. Link to related GitHub issues where relevant.

Testing

  • How this was tested.
  • If you didn't test it, say why.

Notes for Reviewer (Optional)

  • Anything non-obvious or worth a heads-up.

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 Apr 25, 2026 6:47pm
ensnode.io Ready Ready Preview, Comment Apr 25, 2026 6:47pm
ensrainbow.io Ready Ready Preview, Comment Apr 25, 2026 6:47pm

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 24, 2026

⚠️ No Changeset found

Latest commit: 224ae50

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

Warning

Rate limit exceeded

@sevenzing has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 30 minutes and 9 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 30 minutes and 9 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9772248d-a42f-4fd4-a5ef-768a6064980b

📥 Commits

Reviewing files that changed from the base of the PR and between d985bf0 and 224ae50.

📒 Files selected for processing (15)
  • 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/package.json
  • packages/datasources/src/devnet/constants.ts
  • packages/datasources/src/devnet/index.ts
  • packages/datasources/src/devnet/namespace.ts
  • packages/datasources/src/namespaces.ts
  • packages/datasources/tsup.config.ts
  • packages/ensnode-sdk/src/internal.ts
  • packages/ensnode-sdk/src/omnigraph-api/example-queries.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
📝 Walkthrough

Walkthrough

The PR refactors devnet account exports into separate address/data modules, changes the devnet chain id to 1, adds devnet seeding (primary name and resolver records), updates the orchestrator to run seeding, adjusts Docker devnet image, and updates integration tests to use DEVNET_ACCOUNTS with updated expectations.

Changes

Cohort / File(s) Summary
Devnet address/data refactor
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/ensnode-sdk/src/internal.ts
Remove monolithic devnet-accounts.ts; add addresses.ts (exports DEVNET_ACCOUNTS, DEVNET_CONTRACTS, DEVNET_ADDRESSES) and data.ts (DEVNET_BYTES); update internal re-exports.
Integration tests — ENS API / Omnigraph
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/ensnode-sdk/src/omnigraph-api/example-queries.ts
Tests switched to DEVNET_ACCOUNTS.*.address; expectations updated (primary name now resolves to "test.eth" for chainId 1); added/expanded record-resolution test cases (text, multi-coin, comprehensive records).
Devnet seeding & ABI
packages/integration-test-env/src/seed/index.ts, .../seed/primary-names.ts, .../seed/resolver-records.ts, .../seed/abi.ts
New seeding entrypoint seedDevnet(rpcUrl) creating Viem wallet clients and executing seedPrimaryNameRecords and seedResolverRecords; ABI constants added for reverse registrar, public resolver, universal resolver V2.
Orchestrator & env
packages/integration-test-env/src/orchestrator.ts, packages/integration-test-env/package.json, docker/services/devnet.yml
Orchestrator now calls seedDevnet after devnet readiness; viem dependency added; devnet Docker image tag updated (image hash change only).
Chains / config changes
packages/datasources/src/lib/chains.ts, packages/ensnode-sdk/src/shared/config/rpc-configs-from-env.ts, apps/ensindexer/src/lib/ponder-helpers.ts, apps/ensindexer/src/plugins/tokenscope/plugin.ts
ensTestEnvChain.id changed to literal 1; RPC config and chain-connection logic gated by namespace (ENS test-env aware); helpers updated to pass namespace through.

Sequence Diagram

sequenceDiagram
    participant Orchestrator
    participant DevNetContainer
    participant SeedDevnet
    participant SeedPrimary
    participant SeedResolver
    participant SmartContracts

    Orchestrator->>DevNetContainer: wait for container ready
    DevNetContainer-->>Orchestrator: ready (port mapped)
    Orchestrator->>SeedDevnet: seedDevnet(rpcUrl)

    SeedDevnet->>SeedDevnet: create Viem wallet clients (deployer, owner, user, user2)
    SeedDevnet->>SeedPrimary: seedPrimaryNameRecords(clients)

    SeedPrimary->>SmartContracts: writeContract(setName("test.eth"))
    SmartContracts-->>SeedPrimary: tx hash
    SeedPrimary-->>SeedDevnet: complete

    SeedDevnet->>SeedResolver: seedResolverRecords(clients)

    SeedResolver->>SmartContracts: findResolver("test.eth")
    SmartContracts-->>SeedResolver: resolver address
    SeedResolver->>SmartContracts: writeContract(setText/setAddr/setContenthash/setPubkey/setABI/setInterface)
    SmartContracts-->>SeedResolver: tx hashes
    SeedResolver-->>SeedDevnet: complete

    SeedDevnet-->>Orchestrator: complete
    Orchestrator->>Orchestrator: continue startup/tests
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 Hop, hop, the devnet seeds are sown,
Primary names set, resolver records grown.
From module splits to chainId one,
Tests updated, and seeding done —
Tiny rabbit cheers: the devnet’s won! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description contains only the empty template with no actual content filled in—no summary bullets, rationale, testing details, or reviewer notes are provided. Required sections lack substantive information. Complete all template sections: add 1-3 bullets summarizing changes, explain why these changes exist, describe how testing was performed, and check the blocking pre-review checklist items.
Docstring Coverage ⚠️ Warning Docstring coverage is 15.79% 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 'tests: add seed script to improve resolution tests' accurately reflects the main purpose of the PR, which adds new seed scripts (in packages/integration-test-env/src/seed/) to populate devnet data for resolution-related integration 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 introduces a devnet seed script that populates resolver records (text, multi-coin addresses, contenthash, pubkey, ABI, interface) and a primary name for test.eth before integration tests run, and refactors the flat devnet-accounts.ts into a structured devnet/ module. Integration tests are updated to assert on the newly seeded data.

  • The DEVNET_DEFAULT_CHAIN_ID change from 0xeeeeed to 1 in chains.ts is the highest-risk change: if the devnet Anvil node is not explicitly started with --chain-id 1, every seed transaction will use the wrong chain ID and the seeding step will silently or noisily fail, causing all downstream integration tests to assert against un-seeded data.

Confidence Score: 3/5

Not safe to merge without confirming the chain ID change matches the actual devnet Anvil configuration.

One P1 finding: DEVNET_DEFAULT_CHAIN_ID changed from 0xeeeeed to 1 without any visible accompanying change to the devnet startup configuration. If Anvil is not running with --chain-id 1, all seed transactions will fail and every downstream integration test will fail with confusing assertion mismatches.

packages/datasources/src/lib/chains.ts — chain ID change needs verification against the actual Anvil devnet startup flags.

Important Files Changed

Filename Overview
packages/integration-test-env/src/seed/index.ts New seed orchestrator that derives wallet clients from DEVNET_MNEMONIC and chains seedPrimaryNameRecords + seedResolverRecords; clean but inherits the unawaited-receipt issue flagged in other seed files
packages/integration-test-env/src/seed/resolver-records.ts Seeds all resolver record types (text, multi-coin, contenthash, pubkey, ABI, interface); transactions not awaited for confirmation and uses internal transport.url — both flagged in previous threads
packages/integration-test-env/src/seed/primary-names.ts Seeds the owner's primary name to "test.eth" via ethReverseRegistrar; transaction hash is logged but not awaited for confirmation (same pattern as resolver-records.ts)
packages/datasources/src/lib/chains.ts DEVNET_DEFAULT_CHAIN_ID changed from 0xeeeeed to 1; breaks chain-id contract with the running Anvil instance unless the devnet is explicitly started with --chain-id 1
packages/ensnode-sdk/src/shared/devnet/accounts.ts Replaces flat devnet-accounts.ts with a grouped DEVNET_ACCOUNTS object; adds DEVNET_MNEMONIC constant; synthetic "one" address is misplaced among signable HD-wallet accounts
packages/ensnode-sdk/src/shared/devnet/data.ts New DEVNET_BYTES with test hex blobs; typed as Record<string, Hex> rather than as const — loses literal key types (flagged in previous threads)
packages/integration-test-env/src/orchestrator.ts Adds Phase 1.5 seed step that resolves devnet port and calls seedDevnet before indexing; straightforward integration
apps/ensapi/src/handlers/api/resolution/resolve-records.integration.test.ts Significantly expanded with new test cases covering text records, multi-coin addresses, all record types combined, and acceleration; uses DEVNET_BYTES and DEVNET_ACCOUNTS correctly

Sequence Diagram

sequenceDiagram
    participant Orch as orchestrator.ts
    participant Seed as seedDevnet()
    participant PN as seedPrimaryNameRecords()
    participant RR as seedResolverRecords()
    participant Anvil as Devnet (Anvil RPC)
    participant ENSNode as ENSNode Indexer

    Orch->>Anvil: resolve devnet port
    Orch->>Seed: seedDevnet(devnetRpcUrl)
    Seed->>PN: seedPrimaryNameRecords(clients)
    PN->>Anvil: writeContract(ethReverseRegistrar.setName("test.eth"))
    Anvil-->>PN: txHash (not awaited)
    Seed->>RR: seedResolverRecords(clients)
    RR->>Anvil: readContract(universalResolverV2.findResolver)
    Anvil-->>RR: activeResolver
    RR->>Anvil: writeContract(permissionedResolver.setText×6)
    RR->>Anvil: writeContract(permissionedResolver.setAddr×2)
    RR->>Anvil: writeContract(permissionedResolver.setContenthash)
    RR->>Anvil: writeContract(permissionedResolver.setPubkey)
    RR->>Anvil: writeContract(permissionedResolver.setABI)
    RR->>Anvil: writeContract(permissionedResolver.setInterface)
    Anvil-->>RR: txHashes (not awaited)
    Seed-->>Orch: done
    Orch->>ENSNode: start indexer (Phase 2+)
Loading

Comments Outside Diff (1)

  1. packages/datasources/src/lib/chains.ts, line 443-444 (link)

    P1 Chain ID changed from devnet-specific value to mainnet ID

    DEVNET_DEFAULT_CHAIN_ID was 0xeeeeed (15728109) and is now 1. ensTestEnvChain (used by all seed wallet clients) now advertises chain ID 1. If the Anvil/devnet RPC is still running with the old chain ID, every seed transaction will fail with a chain-id mismatch or signature error. If the devnet is explicitly started with --chain-id 1, this is intentional — but the change deserves an inline comment explaining why, since "chain ID 1" normally means Ethereum Mainnet and is surprising in a test-env context.

Reviews (2): Last reviewed commit: "remove used code" | Re-trigger Greptile

Comment thread apps/ensapi/src/handlers/api/resolution/resolve-primary-names.integration.test.ts Outdated
Comment on lines +61 to +68
const hash = await walletClient.writeContract({
address: RESOLVER,
abi: publicResolverAbi,
functionName: "setText",
args: [node, key, value],
});
console.log(`[seed] setText("${key}", "${value}") tx: ${hash}`);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Seed transactions are not awaited for confirmation

Every writeContract call captures a hash but never calls waitForTransactionReceipt. While Anvil's default auto-mine mode makes this effectively safe, a silently-reverted transaction (e.g. the owner lacks permission on the permissionedResolver) would only show up as a console-logged hash with no error thrown. If devnet mining mode ever changes, or a contract call fails, seedDevnet will return successfully and the integration tests will fail with confusing assertion mismatches rather than a meaningful seed error.

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

import { mnemonicToAccount } from "viem/accounts";

import { ensTestEnvChain } from "@ensnode/datasources";
import { DEVNET_MNEMONIC } from "@ensnode/ensnode-sdk/internal";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

imo move this to the integration test env, no need for it to be shared, right?

]);

// https://github.com/ensdomains/contracts-v2/blob/42f2016e7ba87eb3854afe51ad55186a16b32a74/contracts/test/utils/resolutions.ts#L28
export const publicResolverAbi = parseAbi([
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

all of this should be available through @ensnode/datasourcesResolverABI, UniversalResolverABI — maybe not the reverse registrar abi, but perhaps just export it if not — let's keep the abi defs as centralized as possible.

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
import { publicResolverAbi, universalResolverV2Abi } from "./abi";
import type { DevnetWalletClient, DevnetWalletClients } from "./index";

const RESOLVER = DEVNET_CONTRACTS.permissionedResolver;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the permissionedResolver address exported by the devnet may be a factory not a specific impl; each address gets their own PermRes in ensv2, so it'd be best to make sure we're acting on an instance of a PermRes that's tied to a specific address

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.

this permissionedResolver is a resolver for all names in devnet 👀

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
Comment thread packages/datasources/src/lib/chains.ts
Comment thread packages/ensnode-sdk/src/shared/devnet/addresses.ts Outdated
@vercel vercel Bot temporarily deployed to Preview – ensrainbow.io April 25, 2026 16:51 Inactive
@vercel vercel Bot temporarily deployed to Preview – ensnode.io April 25, 2026 16:51 Inactive
@vercel vercel Bot temporarily deployed to Preview – admin.ensnode.io April 25, 2026 16:51 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.

Caution

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

⚠️ Outside diff range comments (1)
apps/ensindexer/src/lib/ponder-helpers.ts (1)

96-121: 🧹 Nitpick | 🔵 Trivial

Consider making namespace required to prevent silent cache-disable regressions.

namespace?: ENSNamespaceId is optional. Any future caller that forgets to pass it on the EnsTestEnv namespace will silently re-enable the cache for devnet (since the namespace === ENSNamespaceIds.EnsTestEnv predicate evaluates false for undefined), which would corrupt integration test runs. Since the only existing in-tree callers (tokenscope/plugin.ts and chainsConnectionConfigForDatasources) already pass it, making it required has no migration cost and locks in the invariant.

♻️ Proposed change
 export function chainsConnectionConfig(
   rpcConfigs: ENSIndexerConfig["rpcConfigs"],
   chainId: ChainId,
-  namespace?: ENSNamespaceId,
+  namespace: ENSNamespaceId,
 ) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/ensindexer/src/lib/ponder-helpers.ts` around lines 96 - 121, Make the
namespace parameter required on chainsConnectionConfig to avoid silent
cache-disable regressions: change the function signature from namespace?:
ENSNamespaceId to namespace: ENSNamespaceId in chainsConnectionConfig, update
the disableCache predicate that checks namespace === ENSNamespaceIds.EnsTestEnv
accordingly, and adjust all callers (e.g., tokenscope/plugin.ts and
chainsConnectionConfigForDatasources) to pass an explicit ENSNamespaceId so the
ENS test-env cache behavior remains correct.
♻️ Duplicate comments (1)
packages/ensnode-sdk/src/shared/devnet/addresses.ts (1)

13-100: 🧹 Nitpick | 🔵 Trivial

Consider lowercasing DEVNET_CONTRACTS addresses for consistency.

DEVNET_ACCOUNTS and DEVNET_ADDRESSES.one are funneled through toNormalizedAddress (lowercased), but DEVNET_CONTRACTS retains EIP-55 checksum casing. Consumers that compare these against on-chain query results (e.g. the actualResolver.toLowerCase() !== resolver.toLowerCase() check in resolver-records.ts) must remember to normalize each side. Lowercasing the entire DEVNET_CONTRACTS map (or wrapping each value with toNormalizedAddress) would let consumers drop the per-call .toLowerCase() and align this constant with the rest of the SDK's NormalizedAddress convention.

🤖 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 contains mixed-case EIP-55 addresses while other constants
(DEVNET_ACCOUNTS, DEVNET_ADDRESSES.one) use normalized lowercased addresses;
update DEVNET_CONTRACTS so each address is normalized—either by lowercasing all
string literals or by passing each contract value through the existing
toNormalizedAddress helper—so consumers can rely on NormalizedAddress semantics
(refer to DEVNET_CONTRACTS and the toNormalizedAddress usage in
DEVNET_ACCOUNTS/DEVNET_ADDRESSES).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@apps/ensindexer/src/lib/ponder-helpers.ts`:
- Around line 96-121: Make the namespace parameter required on
chainsConnectionConfig to avoid silent cache-disable regressions: change the
function signature from namespace?: ENSNamespaceId to namespace: ENSNamespaceId
in chainsConnectionConfig, update the disableCache predicate that checks
namespace === ENSNamespaceIds.EnsTestEnv accordingly, and adjust all callers
(e.g., tokenscope/plugin.ts and chainsConnectionConfigForDatasources) to pass an
explicit ENSNamespaceId so the ENS test-env cache behavior remains correct.

---

Duplicate comments:
In `@packages/ensnode-sdk/src/shared/devnet/addresses.ts`:
- Around line 13-100: DEVNET_CONTRACTS contains mixed-case EIP-55 addresses
while other constants (DEVNET_ACCOUNTS, DEVNET_ADDRESSES.one) use normalized
lowercased addresses; update DEVNET_CONTRACTS so each address is
normalized—either by lowercasing all string literals or by passing each contract
value through the existing toNormalizedAddress helper—so consumers can rely on
NormalizedAddress semantics (refer to DEVNET_CONTRACTS and the
toNormalizedAddress usage in DEVNET_ACCOUNTS/DEVNET_ADDRESSES).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ec3d6001-59c1-4355-864d-0359d9ee3440

📥 Commits

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

📒 Files selected for processing (8)
  • apps/ensindexer/src/lib/ponder-helpers.ts
  • apps/ensindexer/src/plugins/tokenscope/plugin.ts
  • packages/datasources/src/lib/chains.ts
  • packages/ensnode-sdk/src/shared/config/rpc-configs-from-env.ts
  • packages/ensnode-sdk/src/shared/devnet/addresses.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

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