Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/kind-ducks-stop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ensindexer": minor
---

ENSIndexer now requires the NAMESPACE env variable, no longer defaulting to 'mainnet'.
1 change: 1 addition & 0 deletions .github/workflows/test_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
# We use private RPC URLs from GitHub Secrets to avoid rate limits.
# Public RPC URLs are used as fallbacks for repository forks
# that don't have the relevant secrets configured.
NAMESPACE: mainnet
PLUGINS: subgraph,basenames,lineanames,threedns,reverse-resolvers,referrals,tokenscope
RPC_URL_1: ${{ secrets.MAINNET_RPC_URL || 'https://eth.drpc.org' }}
RPC_URL_10: ${{ secrets.OPTIMISM_RPC_URL || 'https://optimism.drpc.org' }}
Expand Down
13 changes: 5 additions & 8 deletions apps/ensindexer/src/config/config.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
DEFAULT_ENSADMIN_URL,
DEFAULT_HEAL_REVERSE_ADDRESSES,
DEFAULT_INDEX_ADDITIONAL_RESOLVER_RECORDS,
DEFAULT_NAMESPACE,
DEFAULT_PORT,
DEFAULT_REPLACE_UNNORMALIZED,
DEFAULT_RPC_RATE_LIMIT,
Expand Down Expand Up @@ -56,13 +55,11 @@ const RpcConfigSchema = z.object({
.default(DEFAULT_RPC_RATE_LIMIT),
});

const ENSNamespaceSchema = z
.enum(ENSNamespaceIds, {
error: (issue) => {
return `Invalid NAMESPACE. Supported ENS namespaces are: ${Object.keys(ENSNamespaceIds).join(", ")}`;
},
})
.default(DEFAULT_NAMESPACE);
Comment thread
shrugs marked this conversation as resolved.
const ENSNamespaceSchema = z.enum(ENSNamespaceIds, {
error: (issue) => {
return `Invalid NAMESPACE. Supported ENS namespaces are: ${Object.keys(ENSNamespaceIds).join(", ")}`;
},
});

const BlockrangeSchema = z
.object({
Expand Down
2 changes: 1 addition & 1 deletion apps/ensindexer/src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface RpcConfig {
*/
export interface ENSIndexerConfig {
/**
* The ENS namespace that ENSNode operates in the context of, defaulting to 'mainnet' (DEFAULT_NAMESPACE).
* The ENS namespace that ENSNode operates in the context of.
*
* See {@link ENSNamespaceIds} for available namespace identifiers.
*/
Expand Down
1 change: 0 additions & 1 deletion apps/ensindexer/src/lib/lib-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const DEFAULT_PORT = 42069;
export const DEFAULT_HEAL_REVERSE_ADDRESSES = true;
export const DEFAULT_INDEX_ADDITIONAL_RESOLVER_RECORDS = true;
export const DEFAULT_REPLACE_UNNORMALIZED = true;
export const DEFAULT_NAMESPACE = ENSNamespaceIds.Mainnet;

/**
* Extracts dynamic chain configuration from environment variables.
Expand Down
6 changes: 2 additions & 4 deletions apps/ensindexer/test/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { RpcConfig } from "@/config/types";
import {
DEFAULT_ENSADMIN_URL,
DEFAULT_HEAL_REVERSE_ADDRESSES,
DEFAULT_NAMESPACE,
DEFAULT_PORT,
DEFAULT_RPC_RATE_LIMIT,
} from "@/lib/lib-config";
Expand Down Expand Up @@ -327,10 +326,9 @@ describe("config", () => {
expect(config.namespace).toBe("sepolia");
});

it("returns the default NAMESPACE if it is not set", async () => {
it("throws if NAMESPACE is not set", async () => {
vi.stubEnv("NAMESPACE", undefined);
const config = await getConfig();
expect(config.namespace).toBe(DEFAULT_NAMESPACE);
await expect(getConfig()).rejects.toThrow(/NAMESPACE/);
});

it("throws if NAMESPACE is an invalid string value", async () => {
Expand Down