diff --git a/.changeset/large-cameras-cross.md b/.changeset/large-cameras-cross.md new file mode 100644 index 0000000000..d005446c91 --- /dev/null +++ b/.changeset/large-cameras-cross.md @@ -0,0 +1,6 @@ +--- +"ensindexer": minor +"ensapi": minor +--- + +The `ens-test-env` namespace now functions against devnet commit `762de44`, which includes the major refactor of ENSv2 onto the ENS Root Chain, away from Namechain. diff --git a/apps/ensapi/src/graphql-api/lib/get-domain-by-fqdn.ts b/apps/ensapi/src/graphql-api/lib/get-domain-by-fqdn.ts index 7d44ba63d5..4bf1b7c3c6 100644 --- a/apps/ensapi/src/graphql-api/lib/get-domain-by-fqdn.ts +++ b/apps/ensapi/src/graphql-api/lib/get-domain-by-fqdn.ts @@ -1,52 +1,23 @@ import config from "@/config"; -import { getUnixTime } from "date-fns"; import { Param, sql } from "drizzle-orm"; import { namehash } from "viem"; -import { DatasourceNames } from "@ensnode/datasources"; import * as schema from "@ensnode/ensnode-schema"; import { type DomainId, type ENSv2DomainId, - ETH_NODE, getENSv2RootRegistryId, type InterpretedName, - interpretedLabelsToInterpretedName, interpretedLabelsToLabelHashPath, interpretedNameToInterpretedLabels, - isRegistrationFullyExpired, type LabelHash, - type LiteralLabel, - labelhashLiteralLabel, makeENSv1DomainId, - makeRegistryId, - makeSubdomainNode, - maybeGetDatasourceContract, type RegistryId, } from "@ensnode/ensnode-sdk"; -import { getLatestRegistration } from "@/graphql-api/lib/get-latest-registration"; import { db } from "@/lib/db"; -import { makeLogger } from "@/lib/logger"; -const logger = makeLogger("get-domain-by-fqdn"); - -// TODO(ensv2): can make this getDatasourceContract once ENSv2 Datasources are available in all namespaces -const V2_ROOT_ETH_REGISTRY = maybeGetDatasourceContract( - config.namespace, - DatasourceNames.ENSv2Root, - "ETHRegistry", -); - -// TODO(ensv2): can make this getDatasourceContract once ENSv2 Datasources are available in all namespaces -const V2_NAMECHAIN_ETH_REGISTRY = maybeGetDatasourceContract( - config.namespace, - DatasourceNames.ENSv2ETHRegistry, - "ETHRegistry", -); - -const ETH_LABELHASH = labelhashLiteralLabel("eth" as LiteralLabel); const ROOT_REGISTRY_ID = getENSv2RootRegistryId(config.namespace); /** @@ -61,7 +32,7 @@ export async function getDomainIdByInterpretedName( v2_getDomainIdByFqdn(ROOT_REGISTRY_ID, name), ]); - // prefer v2DomainId + // prefer v2Domain over v1Domain return v2DomainId || v1DomainId || null; } @@ -77,15 +48,12 @@ async function v1_getDomainIdByFqdn(name: InterpretedName): Promise { const labelHashPath = interpretedLabelsToLabelHashPath(interpretedNameToInterpretedLabels(name)); @@ -102,7 +70,7 @@ async function v2_getDomainIdByFqdn( NULL::text AS label_hash, 0 AS depth FROM ${schema.registry} r - WHERE r.id = ${registryId} + WHERE r.id = ${rootRegistryId} UNION ALL @@ -131,80 +99,16 @@ async function v2_getDomainIdByFqdn( depth: number; }[]; - // this was a query for a TLD and it does not exist in ENS Root Chain ENSv2 + // this was a query for a TLD and it does not exist within the ENSv2 namegraph if (rows.length === 0) return null; // biome-ignore lint/style/noNonNullAssertion: length check above const leaf = rows[rows.length - 1]!; - ///////////////////////////////////////////////////////////////////////////////// - // 1. An exact match was found for the Domain within ENSv2 on the ENS Root Chain. - ///////////////////////////////////////////////////////////////////////////////// + // the v2Domain was found iff there is an exact match within the ENSv2 namegraph const exact = rows.length === labelHashPath.length; - if (exact) { - logger.debug(`Found '${name}' in ENSv2 from Registry ${registryId}`); - return leaf.domain_id; - } - - ///////////////////////////////////////////////////////////////////////////////// - // 2. ETHTLDResolver - // if the path terminates at the .eth Registry, we must implement the logic in ETHTLDResolver - // TODO: we could add an additional invariant that the .eth v2 Registry does indeed have the ETHTLDResolver - // set as its resolver, but that is unnecessary at the moment and incurs additional db requests or a join against - // domain_resolver_relationships - // TODO: generalize this into other future bridging resolvers depending on how basenames etc do it - ///////////////////////////////////////////////////////////////////////////////// - - if (!V2_ROOT_ETH_REGISTRY) return null; - - // 2.1: if the path did not terminate at the .eth Registry, then the domain was not found - if (leaf.registry_id !== makeRegistryId(V2_ROOT_ETH_REGISTRY)) return null; - - logger.debug({ name, rows }); - - // Invariant: must be >= 2LD - if (labelHashPath.length < 2) { - throw new Error(`Invariant: '${name}' is not >= 2LD (has depth ${labelHashPath.length})!`); - } - - // Invariant: LabelHashPath must originate at 'eth' - if (labelHashPath[0] !== ETH_LABELHASH) { - throw new Error( - `Invariant: '${name}' terminated at .eth Registry but the queried labelHashPath (${JSON.stringify(labelHashPath)}) does not originate with 'eth' (${ETH_LABELHASH}).`, - ); - } - - // Invariant: The path must terminate at 'eth' as well. - if (leaf.label_hash !== ETH_LABELHASH) { - throw new Error( - `Invariant: the leaf identified (${leaf.label_hash}) does not match 'eth' (${ETH_LABELHASH}).`, - ); - } - - // construct the node of the 2ld - const dotEth2LDNode = makeSubdomainNode(labelHashPath[1], ETH_NODE); - - // 2.2: if there's an active registration in ENSv1 for the .eth 2LD, then resolve from ENSv1 - const ensv1DomainId = makeENSv1DomainId(dotEth2LDNode); - const registration = await getLatestRegistration(ensv1DomainId); - - if (registration && !isRegistrationFullyExpired(registration, now)) { - logger.debug( - `ETHTLDResolver deferring to actively registered name ${dotEth2LDNode} in ENSv1...`, - ); - return await v1_getDomainIdByFqdn(name); - } - - // 2.3: otherwise, direct to Namechain ENSv2 .eth Registry - // if there's no ETHRegistry on Namechain, the domain was not found - if (!V2_NAMECHAIN_ETH_REGISTRY) return null; - - const nameWithoutTld = interpretedLabelsToInterpretedName( - interpretedNameToInterpretedLabels(name).slice(0, -1), - ); - logger.debug( - `ETHTLDResolver deferring '${nameWithoutTld}' to ENSv2 .eth Registry on Namechain...`, - ); - - return v2_getDomainIdByFqdn(makeRegistryId(V2_NAMECHAIN_ETH_REGISTRY), nameWithoutTld, { now }); + if (exact) return leaf.domain_id; + + // otherwise, the v2 domain was not found + return null; } diff --git a/apps/ensapi/src/lib/public-client.ts b/apps/ensapi/src/lib/public-client.ts index 7cfa125e92..b726162e4f 100644 --- a/apps/ensapi/src/lib/public-client.ts +++ b/apps/ensapi/src/lib/public-client.ts @@ -1,8 +1,7 @@ import config from "@/config"; -import { ccipRequest, createPublicClient, fallback, http, type PublicClient } from "viem"; +import { createPublicClient, fallback, http, type PublicClient } from "viem"; -import { ensTestEnvL1Chain } from "@ensnode/datasources"; import type { ChainId } from "@ensnode/ensnode-sdk"; const _cache = new Map(); @@ -24,21 +23,6 @@ export function getPublicClient(chainId: ChainId): PublicClient { // Create an viem#PublicClient that uses a fallback() transport with all specified HTTP RPCs createPublicClient({ transport: fallback(rpcConfig.httpRPCs.map((url) => http(url.toString()))), - ccipRead: { - async request({ data, sender, urls }) { - // When running in Docker, ENSApi's viem should fetch the UniversalResolverGateway at - // http://devnet:8547 rather than the default of http://localhost:8547, which is unreachable - // from within the Docker container. So here, if we're handling a CCIP-Read request on - // the ens-test-env L1 Chain, we add the ens-test-env's docker-compose-specific url as - // a fallback if the default (http://localhost:8547) fails. - if (chainId === ensTestEnvL1Chain.id) { - return ccipRequest({ data, sender, urls: [...urls, "http://devnet:8547"] }); - } - - // otherwise, handle as normal - return ccipRequest({ data, sender, urls }); - }, - }, }), ); } diff --git a/apps/ensindexer/src/config/config.test.ts b/apps/ensindexer/src/config/config.test.ts index 43f6ffb052..4fe4ff5fda 100644 --- a/apps/ensindexer/src/config/config.test.ts +++ b/apps/ensindexer/src/config/config.test.ts @@ -1,6 +1,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; -import { ensTestEnvL1Chain, ensTestEnvL2Chain } from "@ensnode/datasources"; +import { ensTestEnvChain } from "@ensnode/datasources"; import { ENSNamespaceIds, PluginName } from "@ensnode/ensnode-sdk"; import type { RpcConfig } from "@ensnode/ensnode-sdk/internal"; @@ -661,8 +661,7 @@ describe("config (minimal base env)", () => { stubEnv({ NAMESPACE: "ens-test-env", PLUGINS: "subgraph" }); const config = await getConfig(); - expect(config.rpcConfigs.has(ensTestEnvL1Chain.id)).toBe(true); - expect(config.rpcConfigs.has(ensTestEnvL2Chain.id)).toBe(true); + expect(config.rpcConfigs.has(ensTestEnvChain.id)).toBe(true); }); }); @@ -744,7 +743,7 @@ describe("config (minimal base env)", () => { NAMESPACE: "ens-test-env", LABEL_SET_ID: "ens-test-env", LABEL_SET_VERSION: "0", - RPC_URL_15658733: VALID_RPC_URL, + [`RPC_URL_${ensTestEnvChain.id}`]: VALID_RPC_URL, }); await expect(getConfig()).resolves.toMatchObject({ namespace: ENSNamespaceIds.EnsTestEnv, diff --git a/apps/ensindexer/src/lib/ponder-helpers.ts b/apps/ensindexer/src/lib/ponder-helpers.ts index 50e1a6d645..1eb797b9dd 100644 --- a/apps/ensindexer/src/lib/ponder-helpers.ts +++ b/apps/ensindexer/src/lib/ponder-helpers.ts @@ -12,8 +12,7 @@ import { z } from "zod/v4"; import { type ContractConfig, type DatasourceName, - ensTestEnvL1Chain, - ensTestEnvL2Chain, + ensTestEnvChain, maybeGetDatasource, } from "@ensnode/datasources"; import type { Blockrange, ChainId, ENSNamespaceId } from "@ensnode/ensnode-sdk"; @@ -305,12 +304,8 @@ export function chainsConnectionConfig( ); } - // NOTE: disable cache on local chains (e.g. ens-test-env, devnet) - const disableCache = - chainId === 31337 || - chainId === 1337 || - chainId === ensTestEnvL1Chain.id || - chainId === ensTestEnvL2Chain.id; + // NOTE: disable cache on local chains (e.g. ganache, anvil, ens-test-env) + const disableCache = chainId === 31337 || chainId === 1337 || chainId === ensTestEnvChain.id; return { [chainId.toString()]: { diff --git a/apps/ensindexer/src/plugins/ensv2/handlers/ensv2/ENSv2Registry.ts b/apps/ensindexer/src/plugins/ensv2/handlers/ensv2/ENSv2Registry.ts index ad7ea7a281..459a56422e 100644 --- a/apps/ensindexer/src/plugins/ensv2/handlers/ensv2/ENSv2Registry.ts +++ b/apps/ensindexer/src/plugins/ensv2/handlers/ensv2/ENSv2Registry.ts @@ -1,20 +1,13 @@ -import config from "@/config"; - import { type Context, ponder } from "ponder:registry"; import schema from "ponder:schema"; import { type Address, hexToBigInt, labelhash } from "viem"; -import { DatasourceNames } from "@ensnode/datasources"; import { type AccountId, - accountIdEqual, getCanonicalId, - getDatasourceContract, - getENSv2RootRegistry, interpretAddress, isRegistrationFullyExpired, type LiteralLabel, - labelhashLiteralLabel, makeENSv2DomainId, makeRegistryId, PluginName, @@ -32,8 +25,6 @@ import { toJson } from "@/lib/json-stringify-with-bigints"; import { namespaceContract } from "@/lib/plugin-helpers"; import type { EventWithArgs } from "@/lib/ponder-helpers"; -const ETH_LABELHASH = labelhashLiteralLabel("eth" as LiteralLabel); - const pluginName = PluginName.ENSv2; export default function () { @@ -86,23 +77,7 @@ export default function () { }) .onConflictDoNothing(); - // TODO(ensv2): hoist this access once all namespaces declare ENSv2 contracts - const ENSV2_ROOT_REGISTRY = getENSv2RootRegistry(config.namespace); - const ENSV2_L2_ETH_REGISTRY = getDatasourceContract( - config.namespace, - DatasourceNames.ENSv2ETHRegistry, - "ETHRegistry", - ); - - // if this Registry is Bridged, we know its Canonical Domain and can set it here - // TODO(bridged-registries): generalize this to future ENSv2 Bridged Resolvers - if (accountIdEqual(registry, ENSV2_L2_ETH_REGISTRY)) { - const domainId = makeENSv2DomainId(ENSV2_ROOT_REGISTRY, getCanonicalId(ETH_LABELHASH)); - await context.db - .insert(schema.registryCanonicalDomain) - .values({ registryId: registryId, domainId }) - .onConflictDoUpdate({ domainId }); - } + // TODO(bridged-registries): upon registry creation, write the registry's canonical domain here // ensure discovered Label await ensureLabel(context, label); @@ -182,11 +157,6 @@ export default function () { // update Registration await context.db.update(schema.registration, { id: registration.id }).set({ expiry }); - - // if newExpiry is 0, this is an `unregister` call, related to ejecting - // https://github.com/ensdomains/namechain/blob/9e31679f4ee6d8abb4d4e840cdf06f2d653a706b/contracts/src/L1/bridge/L1BridgeController.sol#L141 - // TODO(migration): maybe do something special with this state? - // if (expiry === 0n) return; }, ); diff --git a/apps/ensindexer/src/plugins/ensv2/plugin.ts b/apps/ensindexer/src/plugins/ensv2/plugin.ts index e8fa3f816a..da7162a646 100644 --- a/apps/ensindexer/src/plugins/ensv2/plugin.ts +++ b/apps/ensindexer/src/plugins/ensv2/plugin.ts @@ -1,29 +1,19 @@ /** * TODO * - root can be inserted on setup or could be discovered naturally — see how that affects traversal/graphql api - * - probably easier to just insert it ahead of time like previously - * - move registration expiration shared logic to sdk/ens - * - update isRegistrationFullyExpired todo in ensapi somewhere + * - probably easier to just insert it ahead of time like previously? * - RequiredAndNotNull opposite type: RequiredToBeNull for constraining polymorphic entities in graphql schema * - re-asses NameWrapper expiry logic — compare to subgraph implementation & see if we can simplify * - indexes based on graphql queries, ask claude to compile recommendations * - ThreeDNS - * - Migration - * - need to understand migration pattern better - * - individual names are migrated to v2 and can choose to move to an ENSv2 Registry on L1 or L2 - * - locked names (wrapped and not unwrappable) are 'frozen' by having their fuses burned - * - will need to observe the correct event and then override the existing domain/registratioon info - * - for MigratedWrappedNameRegistries, need to check name expiry during resolution and avoid resolving expired names - * - autocomplete api - * - Query.permissions(by: { contract: { } }) + * - Migration status/state * - custom wrapper for resolveCursorConnection with typesafety that applies defaults and auto-decodes cursors to the indicated type * - Pothos envelop plugins (aliases, depth, tokens, whatever) * * PENDING ENS TEAM - * - Domain.canonical/Domain.canonicalPath/Domain.fqdn depends on: - * - depends on: Registry.canonicalName implementation + indexing + * - Canonical Domain tracking * - Signal Pattern for Registry contracts - * - depends on: ens team implementing in namechain contracts + * - depends on: ens team implementing in v2 contracts * * MAYBE DO LATER? * - ? better typechecking for polymorphic entities in drizzle schema @@ -69,7 +59,6 @@ const ALL_DATASOURCE_NAMES = [ DatasourceNames.Basenames, DatasourceNames.Lineanames, DatasourceNames.ENSv2Root, - DatasourceNames.ENSv2ETHRegistry, ]; export default createPlugin({ @@ -81,8 +70,8 @@ export default createPlugin({ } = getRequiredDatasources(config.namespace, REQUIRED_DATASOURCE_NAMES); const { - ENSv2ETHRegistry, // - basenames, + ENSv2Root, // + basenames, // lineanames, } = maybeGetDatasources(config.namespace, ALL_DATASOURCE_NAMES); @@ -138,11 +127,11 @@ export default createPlugin({ [namespaceContract(pluginName, "ETHRegistrar")]: { abi: ETHRegistrarABI, chain: { - ...(ENSv2ETHRegistry && + ...(ENSv2Root && chainConfigForContract( config.globalBlockrange, - ENSv2ETHRegistry.chain.id, - ENSv2ETHRegistry.contracts.ETHRegistrar, + ENSv2Root.chain.id, + ENSv2Root.contracts.ETHRegistrar, )), }, }, diff --git a/packages/datasources/src/ens-test-env.ts b/packages/datasources/src/ens-test-env.ts index 2b7f4a37f2..30ba185670 100644 --- a/packages/datasources/src/ens-test-env.ts +++ b/packages/datasources/src/ens-test-env.ts @@ -13,7 +13,7 @@ import { UniversalResolver as root_UniversalResolver } from "./abis/root/Univers import { UnwrappedEthRegistrarController as root_UnwrappedEthRegistrarController } from "./abis/root/UnwrappedEthRegistrarController"; import { WrappedEthRegistrarController as root_WrappedEthRegistrarController } from "./abis/root/WrappedEthRegistrarController"; import { StandaloneReverseRegistrar } from "./abis/shared/StandaloneReverseRegistrar"; -import { ensTestEnvL1Chain, ensTestEnvL2Chain } from "./lib/chains"; +import { ensTestEnvChain } from "./lib/chains"; // Shared ABIs import { ResolverABI } from "./lib/ResolverABI"; // Types @@ -26,7 +26,7 @@ import { DatasourceNames, type ENSNamespace } from "./lib/types"; * for development and testing. * * @see https://github.com/ensdomains/ens-test-env - * @see https://github.com/ensdomains/namechain + * @see https://github.com/ensdomains/contracts-v2 * * NOTE: The ens-test-env ENS namespace does not support Basenames, Lineanames, or 3DNS. * NOTE: The ens-test-env ENS namespace does not (yet) support ENSIP-19 Reverse Resolvers. @@ -35,20 +35,20 @@ export default { /** * ENSRoot Datasource * - * Addresses and Start Blocks from Namechain devnet - * https://github.com/ensdomains/namechain + * Addresses and Start Blocks from ENSv2 devnet + * https://github.com/ensdomains/contracts-v2 */ [DatasourceNames.ENSRoot]: { - chain: ensTestEnvL1Chain, + chain: ensTestEnvChain, contracts: { ENSv1RegistryOld: { abi: root_Registry, // Registry was redeployed, same abi - address: "0x5fc8d32690cc91d4c39d9d3abcbd16989f875707", + address: "0x9fe46736679d2d9a65f0992f2272de9f3c7fa6e0", startBlock: 0, }, ENSv1Registry: { abi: root_Registry, // Registry was redeployed, same abi - address: "0x0165878a594ca255338adfa4d48449f69242eb8f", + address: "0xcf7ed3acca5a467e9e704c703e8d87f634fb0fc9", startBlock: 0, }, Resolver: { @@ -62,7 +62,7 @@ export default { }, LegacyEthRegistrarController: { abi: root_LegacyEthRegistrarController, - address: "0xbec49fa140acaa83533fb00a2bb19bddd0290f25", + address: "0x2e2ed0cfd3ad2f1d34481277b3204d807ca2f8c2", startBlock: 0, }, WrappedEthRegistrarController: { @@ -72,7 +72,7 @@ export default { }, UnwrappedEthRegistrarController: { abi: root_UnwrappedEthRegistrarController, - address: "0xfbc22278a96299d91d41c453234d97b4f5eb9b2d", + address: "0x51a1ceb83b83f1985a81c295d1ff28afef186e02", startBlock: 0, }, UniversalRegistrarRenewalWithReferrer: { @@ -87,74 +87,65 @@ export default { }, UniversalResolver: { abi: root_UniversalResolver, - address: "0xdc11f7e700a4c898ae5caddb1082cffa76512add", + address: "0xbec49fa140acaa83533fb00a2bb19bddd0290f25", + startBlock: 0, + }, + UniversalResolverV2: { + abi: root_UniversalResolver, + address: "0xb0d4afd8879ed9f52b28595d31b441d079b2ca07", startBlock: 0, }, }, }, [DatasourceNames.ENSv2Root]: { - chain: ensTestEnvL1Chain, + chain: ensTestEnvChain, contracts: { Resolver: { abi: ResolverABI, startBlock: 0 }, Registry: { abi: Registry, startBlock: 0 }, EnhancedAccessControl: { abi: EnhancedAccessControl, startBlock: 0 }, RootRegistry: { abi: Registry, - address: "0x9a676e781a523b5d0c0e43731313a708cb607508", - startBlock: 0, - }, - ETHRegistry: { - abi: Registry, - address: "0x0b306bf915c4d645ff596e518faf3f9669b97016", + address: "0x8a791620dd6260079bf849dc5567adc3f2fdc318", startBlock: 0, }, - }, - }, - - [DatasourceNames.ENSv2ETHRegistry]: { - chain: ensTestEnvL2Chain, - contracts: { - Resolver: { abi: ResolverABI, startBlock: 0 }, - Registry: { abi: Registry, startBlock: 0 }, - EnhancedAccessControl: { abi: EnhancedAccessControl, startBlock: 0 }, ETHRegistry: { abi: Registry, - address: "0xdc64a140aa3e981100a9beca4e685f962f0cf6c9", + address: "0x84ea74d481ee0a5332c457a4d796187f6ba67feb", startBlock: 0, }, ETHRegistrar: { abi: ETHRegistrar, - address: "0xa51c1fc2f0d1a1b8494ed1fe312d7c3a78ed91c0", + address: "0x1291be112d480055dafd8a610b7d1e203891c274", startBlock: 0, }, }, }, [DatasourceNames.ReverseResolverRoot]: { - chain: ensTestEnvL1Chain, + chain: ensTestEnvChain, contracts: { DefaultReverseRegistrar: { abi: StandaloneReverseRegistrar, - address: "0x8f86403a4de0bb5791fa46b8e795c547942fe4cf", + address: "0x95401dc811bb5740090279ba06cfa8fcf6113778", startBlock: 0, }, DefaultReverseResolver3: { abi: ResolverABI, - address: "0x5eb3bc0a489c5a8288765d2336659ebca68fcd00", + address: "0x70e0ba845a1a0f2da3359c97e0285013525ffc49", startBlock: 0, }, DefaultPublicResolver4: { abi: ResolverABI, - address: "0x367761085bf3c12e5da2df99ac6e1a824612b8fb", + address: "0x172076e0166d1f9cc711c77adf8488051744980c", startBlock: 0, }, DefaultPublicResolver5: { abi: ResolverABI, - address: "0x4c2f7092c2ae51d986befee378e50bd4db99c901", + address: "0x4ee6ecad1c2dae9f525404de8555724e3c35d07b", startBlock: 0, }, }, diff --git a/packages/datasources/src/lib/chains.ts b/packages/datasources/src/lib/chains.ts index 6199a59d08..851dfff825 100644 --- a/packages/datasources/src/lib/chains.ts +++ b/packages/datasources/src/lib/chains.ts @@ -1,27 +1,14 @@ import { type Chain, localhost } from "viem/chains"; /** - * The Namechain Devnet Default L2 Chain Id - * @see https://github.com/ensdomains/namechain/blob/26ad1550f6a119728d56f96b70326e42d6a4bdde/contracts/script/setup.ts#L47 + * The Default Chain Id for Devnet + * @see https://github.com/ensdomains/contracts-v2/blob/762de44d60b2588b2e92a6d29df941c4de821ae6/contracts/script/setup.ts#L40 */ -const l2ChainId = 0xeeeeee; +const DEVNET_DEFAULT_CHAIN_ID = 0xeeeeed; -/** - * The Namechain Devnet Default L1 Chain Id - * @see https://github.com/ensdomains/namechain/blob/26ad1550f6a119728d56f96b70326e42d6a4bdde/contracts/script/setup.ts#L48 - */ -const l1ChainId = l2ChainId - 1; - -export const ensTestEnvL1Chain = { +export const ensTestEnvChain = { ...localhost, - id: l1ChainId, - name: "ens-test-env L1", + id: DEVNET_DEFAULT_CHAIN_ID, + name: "ens-test-env", rpcUrls: { default: { http: ["http://localhost:8545"] } }, } as const satisfies Chain; - -export const ensTestEnvL2Chain = { - ...localhost, - id: l2ChainId, - name: "ens-test-env L2", - rpcUrls: { default: { http: ["http://localhost:8546"] } }, -} as const satisfies Chain; diff --git a/packages/datasources/src/lib/types.ts b/packages/datasources/src/lib/types.ts index 64cc1ee776..027974dbf9 100644 --- a/packages/datasources/src/lib/types.ts +++ b/packages/datasources/src/lib/types.ts @@ -65,7 +65,6 @@ export const DatasourceNames = { ReverseResolverArbitrum: "rrArbitrum", ReverseResolverScroll: "rrScroll", ENSv2Root: "ENSv2Root", - ENSv2ETHRegistry: "ENSv2ETHRegistry", } as const; export type DatasourceName = (typeof DatasourceNames)[keyof typeof DatasourceNames]; diff --git a/packages/datasources/src/sepolia-v2.ts b/packages/datasources/src/sepolia-v2.ts index 7b31eec3b3..043a0c5da9 100644 --- a/packages/datasources/src/sepolia-v2.ts +++ b/packages/datasources/src/sepolia-v2.ts @@ -25,7 +25,6 @@ import { DatasourceNames, type ENSNamespace } from "./lib/types"; * * This represents a testing deployment of ENSv1 w/ ENSv2 on Sepolia. * - * @dev the ENSv2ETHRegistry Datasource contracts are deployed to Sepolia (rather than an L2). * @dev we use the earliest start block for simplicity (it's just for efficiency re: log fetches). */ export default { @@ -106,20 +105,6 @@ export default { address: "0x3f0920aa92c5f9bce54643c09955c5f241f1f763", startBlock: 9374708, }, - }, - }, - - [DatasourceNames.ENSv2ETHRegistry]: { - chain: sepolia, - contracts: { - Resolver: { abi: ResolverABI, startBlock: 9374708 }, - Registry: { abi: Registry, startBlock: 9374708 }, - EnhancedAccessControl: { abi: EnhancedAccessControl, startBlock: 9374708 }, - ETHRegistry: { - abi: Registry, - address: "0xf332544e6234f1ca149907d0d4658afd5feb6831", - startBlock: 9374708, - }, ETHRegistrar: { abi: ETHRegistrar, address: "0x3334f0ebcbc4b5b7067f3aff25c6da8973690d54", diff --git a/packages/ensnode-sdk/src/rpc/is-dedicated-resolver.ts b/packages/ensnode-sdk/src/rpc/is-dedicated-resolver.ts index fe52179c5d..9cd904b5db 100644 --- a/packages/ensnode-sdk/src/rpc/is-dedicated-resolver.ts +++ b/packages/ensnode-sdk/src/rpc/is-dedicated-resolver.ts @@ -2,7 +2,7 @@ import { makeSupportsInterfaceReader } from "./eip-165"; /** * DedicatedResolver InterfaceId - * @see https://github.com/ensdomains/namechain/blob/main/contracts/src/common/resolver/interfaces/IDedicatedResolverSetters.sol#L9 + * @see https://github.com/ensdomains/contracts-v2/blob/main/contracts/src/resolver/interfaces/IDedicatedResolverSetters.sol */ const IDedicatedResolverInterfaceId = "0x92349baa"; diff --git a/packages/ensnode-sdk/src/shared/config/build-rpc-urls.test.ts b/packages/ensnode-sdk/src/shared/config/build-rpc-urls.test.ts index 5ed22714ae..8b87a037b6 100644 --- a/packages/ensnode-sdk/src/shared/config/build-rpc-urls.test.ts +++ b/packages/ensnode-sdk/src/shared/config/build-rpc-urls.test.ts @@ -4,16 +4,16 @@ import { describe, expect, it } from "vitest"; import { type ENSNamespace, ENSNamespaceIds, - ensTestEnvL1Chain, - ensTestEnvL2Chain, + ensTestEnvChain, getENSNamespace, } from "@ensnode/datasources"; +import type { ChainId } from "../types"; import { buildAlchemyBaseUrl, buildDRPCUrl, buildQuickNodeURL } from "./build-rpc-urls"; const KEY = "whatever"; -const LOCAL_CHAIN_IDS = [ensTestEnvL1Chain.id, ensTestEnvL2Chain.id]; +const LOCAL_CHAIN_IDS: ChainId[] = [ensTestEnvChain.id]; const ALL_KNOWN_PUBLIC_CHAIN_IDS = Object.values(ENSNamespaceIds) .map((namespace) => getENSNamespace(namespace)) .flatMap((namespace: ENSNamespace) => Object.values(namespace)) diff --git a/packages/ensnode-sdk/src/shared/config/rpc-configs-from-env.ts b/packages/ensnode-sdk/src/shared/config/rpc-configs-from-env.ts index 8314d0ab3a..ad5712e16e 100644 --- a/packages/ensnode-sdk/src/shared/config/rpc-configs-from-env.ts +++ b/packages/ensnode-sdk/src/shared/config/rpc-configs-from-env.ts @@ -1,8 +1,7 @@ import { type Datasource, type ENSNamespaceId, - ensTestEnvL1Chain, - ensTestEnvL2Chain, + ensTestEnvChain, getENSNamespace, } from "@ensnode/datasources"; @@ -74,17 +73,9 @@ export function buildRpcConfigsFromEnv( continue; } - // ens-test-env L1 Chain - if (chain.id === ensTestEnvL1Chain.id) { - rpcConfigs[serializeChainId(ensTestEnvL1Chain.id)] = - ensTestEnvL1Chain.rpcUrls.default.http[0]; - continue; - } - - // ens-test-env L2 Chain - if (chain.id === ensTestEnvL2Chain.id) { - rpcConfigs[serializeChainId(ensTestEnvL2Chain.id)] = - ensTestEnvL2Chain.rpcUrls.default.http[0]; + // ens-test-env Chain + if (chain.id === ensTestEnvChain.id) { + rpcConfigs[serializeChainId(ensTestEnvChain.id)] = ensTestEnvChain.rpcUrls.default.http[0]; continue; } diff --git a/packages/ensnode-sdk/src/shared/datasources-with-ensv2-contracts.ts b/packages/ensnode-sdk/src/shared/datasources-with-ensv2-contracts.ts index 02446c8836..1d73532e20 100644 --- a/packages/ensnode-sdk/src/shared/datasources-with-ensv2-contracts.ts +++ b/packages/ensnode-sdk/src/shared/datasources-with-ensv2-contracts.ts @@ -9,7 +9,6 @@ import { export const DATASOURCE_NAMES_WITH_ENSv2_CONTRACTS = [ DatasourceNames.ENSv2Root, - DatasourceNames.ENSv2ETHRegistry, ] as const satisfies DatasourceName[]; // avoids 'The inferred type of this node exceeds the maximum length the compiler will serialize' diff --git a/packages/namehash-ui/src/components/chains/ChainIcon.tsx b/packages/namehash-ui/src/components/chains/ChainIcon.tsx index 8af5c5828d..97e5fb307b 100644 --- a/packages/namehash-ui/src/components/chains/ChainIcon.tsx +++ b/packages/namehash-ui/src/components/chains/ChainIcon.tsx @@ -13,7 +13,7 @@ import { sepolia, } from "viem/chains"; -import { ensTestEnvL1Chain } from "@ensnode/datasources"; +import { ensTestEnvChain } from "@ensnode/datasources"; import type { ChainId } from "@ensnode/ensnode-sdk"; import { ArbitrumIcon } from "./icons/ArbitrumIcon"; @@ -58,7 +58,7 @@ const chainIcons = new Map([ - [ensTestEnvL1Chain.id, "Ethereum Local (ens-test-env)"], + [ensTestEnvChain.id, "Ethereum Local (ens-test-env)"], [mainnet.id, "Mainnet"], [sepolia.id, "Ethereum Sepolia"], [base.id, "Base"],