-
Notifications
You must be signed in to change notification settings - Fork 17
Introduce indexing metadata context data model #1997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 17 commits
4b125d0
dcad533
a5a8bd6
c57c2ac
a28b0de
e91bd13
8892dd5
ee1190e
4954e21
2f8532e
361e99d
7595a41
1902bfb
6bda3d6
e3ddda0
4684fb4
1ff960e
41060d0
e1d6d04
98e6c45
eebe386
11711ca
89c974a
292ed35
159c4ff
b36418b
f3355ef
40961af
6279dea
43ef45b
ad1564f
110927d
bcd81fe
698191f
725901f
55ae265
84b52e1
5cc44ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| import pRetry from "p-retry"; | ||
| import { prettifyError, ZodError, z } from "zod/v4"; | ||
|
|
||
| import type { EnsApiPublicConfig } from "@ensnode/ensnode-sdk"; | ||
| import { type EnsApiPublicConfig, IndexingMetadataContextStatusCodes } from "@ensnode/ensnode-sdk"; | ||
| import { | ||
| buildRpcConfigsFromEnv, | ||
| canFallbackToTheGraph, | ||
|
|
@@ -70,13 +70,13 @@ export async function buildConfigFromEnvironment(env: EnsApiEnvironment): Promis | |
| // https://github.com/namehash/ensnode/issues/1806 | ||
| const ensIndexerPublicConfig = await pRetry( | ||
| async () => { | ||
| const config = await ensDbClient.getEnsIndexerPublicConfig(); | ||
| const indexingMetadataContext = await ensDbClient.getIndexingMetadataContext(); | ||
|
|
||
| if (!config) { | ||
| throw new Error("ENSIndexer Public Config not yet available in ENSDb."); | ||
| if (indexingMetadataContext.statusCode !== IndexingMetadataContextStatusCodes.Initialized) { | ||
| throw new Error("Indexing metadata context is uninitialized in ENSDb."); | ||
| } | ||
|
|
||
| return config; | ||
| return indexingMetadataContext.stackInfo.ensIndexer; | ||
| }, | ||
| { | ||
| retries: 13, // This allows for a total of over 1 hour of retries with the exponential backoff strategy | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we keep such a long retry period still? Appreciate your advice!
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should be able to remove this whole async call once #1806 is resolved. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Prefer a runtime assertion over the bare type cast.
deserializeIndexingMetadataContext(...)returns a union, and theas IndexingMetadataContextInitializedcast silently lies if the deserializer ever produces a non-initialized variant (e.g., due to a future shape change in the fixture). A small invariant check (e.g.,if (deserialized.statusCode !== IndexingMetadataContextStatusCodes.Initialized) throw new Error(...)) makes the test fail loudly at the fixture rather than at an assertion deep insidebuildConfigFromEnvironment.🤖 Prompt for AI Agents