Skip to content
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2e5c6a6
Move `ensdb` module contents from ENSNode SDK to ENSDb SDK
tk-o Mar 18, 2026
d3329fd
Add `EnsNodeDbMigrations` interface to ENSDb SDK
tk-o Mar 18, 2026
a844af0
Introduce ENSDb Reader
tk-o Mar 19, 2026
316fe67
Introduce ENSDb Writer
tk-o Mar 19, 2026
90ff103
Setup exports fro ENSDb client module
tk-o Mar 19, 2026
72e1f9b
Replace ENSDb Client implementation in ENSIndexer
tk-o Mar 19, 2026
2df0ab2
Make ENSIndexer to execute ENSNode Schema migrations in ENSDb
tk-o Mar 19, 2026
8357285
Update tests for ENSDb Writer Worker
tk-o Mar 19, 2026
b66c443
docs(changeset): Moved `ensdb` module from ENSNode SDK into ENSDb SDK.
tk-o Mar 19, 2026
187a3b5
docs(changeset): Introduced two client implementations for ENSDb: `En…
tk-o Mar 19, 2026
bcc1784
docs(changeset): Replaced a bespoke `EnsDbClient` implementation with…
tk-o Mar 19, 2026
6c82714
docs(changeset): Added running database migrations for ENSDb as a res…
tk-o Mar 19, 2026
8edabdd
Code cleanup
tk-o Mar 19, 2026
24f2d1b
Introduce testing suite to ENSDb SDK
tk-o Mar 19, 2026
45eea13
Merge remote-tracking branch 'origin/main' into feat/integrate-ensdb-…
tk-o Mar 19, 2026
4b20c50
Fix typo
tk-o Mar 19, 2026
4e216f4
Apply AI PR feedback
tk-o Mar 19, 2026
3b3882b
Merge remote-tracking branch 'origin/main' into feat/integrate-ensdb-…
tk-o Mar 19, 2026
83cf6cf
Apply suggestions from code review
tk-o Mar 20, 2026
f03192e
Apply PR feedback
tk-o Mar 20, 2026
f0c7f1f
Improve layers of responsibility in ENSDb Drizzle Client file
tk-o Mar 20, 2026
54301fc
Improve layers of responsibility in ENSDb SDK clients
tk-o Mar 20, 2026
a3dbb6b
Update testing suite for ENSDb SDK
tk-o Mar 20, 2026
9eeb935
Update docs in `ponder.schema.ts` file
tk-o Mar 20, 2026
0534ef3
Update packages/ensdb-sdk/src/client/ensdb-reader.test.ts
tk-o Mar 20, 2026
132eca8
Rename `ensindexer` file to `ensindexer-abstract` in ENSDb SDK
tk-o Mar 20, 2026
e527292
Improve the method for cloning drizzle table objects
tk-o Mar 20, 2026
121efd5
Allow using individual ENSDb Schema defintions for Drizzle querires
tk-o Mar 20, 2026
6145e50
Update test files
tk-o Mar 20, 2026
d5f7c3f
Handle database migrations execution failure
tk-o Mar 20, 2026
c5397bc
Rename `ensDbWriter` consts to `ensDbClient`
tk-o Mar 21, 2026
5ac0060
Make usage of ENSIndexer Schema explicitly "concrete"
tk-o Mar 21, 2026
593cbb8
Make `drizzle` module abstractions from ENSDb SDK not to be shared pu…
tk-o Mar 21, 2026
ba48daa
Make `EnsDbReader` constructor to build Drizzle client
tk-o Mar 21, 2026
0adcd14
Update test files
tk-o Mar 21, 2026
219b7bd
fix npm audit issues
tk-o Mar 21, 2026
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/beige-brooms-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ensindexer": minor
---

Replaced a bespoke `EnsDbClient` implementation with `EnsDbWriter` from ENSDb SDK.
5 changes: 5 additions & 0 deletions .changeset/common-mangos-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ensindexer": minor
---

Added running database migrations for ENSDb as a responsibility for ENSIndexer.
6 changes: 6 additions & 0 deletions .changeset/quick-years-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@ensnode/ensnode-sdk": minor
Comment thread
tk-o marked this conversation as resolved.
"@ensnode/ensdb-sdk": minor
---

Moved `ensdb` module from ENSNode SDK into ENSDb SDK.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Comment thread
tk-o marked this conversation as resolved.
5 changes: 5 additions & 0 deletions .changeset/thin-humans-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ensnode/ensdb-sdk": minor
---

Introduced two client implementations for ENSDb: `EnsDbReader` and `EnsDbWriter`.
8 changes: 6 additions & 2 deletions apps/ensindexer/ponder/ponder.schema.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
// export database schema definition for ENSIndexer
export * from "@ensnode/ensdb-sdk/ensindexer";
/**
* We re-export (just) the "abstract" ENSIndexer Schema from ENSDb for Ponder to manage.
* Ponder will internally build a "concrete" ENSIndexer Schema using
* the "abstract" ENSIndexer Schema and the ENSIndexer Schema name.
**/
export * from "@ensnode/ensdb-sdk/ensindexer-abstract";
6 changes: 3 additions & 3 deletions apps/ensindexer/ponder/src/api/handlers/ensnode-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import {
serializeIndexingStatusResponse,
} from "@ensnode/ensnode-sdk";

import { ensDbClient } from "@/lib/ensdb-client/singleton";
import { ensDbWriter } from "@/lib/ensdb/singleton";
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.

i realize that the writer inherits reader, but it still reads oddly to see ensDbWriter.get* — maybe we can just call any instance of a reader (or writer) an ensDbClient so operations read more clearly? up to you, as the current naming is technically more precise.

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.

I tried ensDbClient before, but got feedback that is should be simply ensDbWriter feels a bit weird to read something from the writer, but since the writer class extends the reader class, it's technically correct.

Alternative approach would be for the writer class to use the reader class for internal reads. So it'd be composition over inheritance. In that case, we'd have two objects: ensDbReader for all reads, and ensDbWriter for all writes.

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.

@shrugs Agreed with your feedback here.

@tk-o I'm trying to remember what the motivation was for us to split the reader / writer into different classes? Was it because of something related to how only the writer needs to do database migrations? But I think the database migrations is already extracted out of the class now?

If there's a nice way to merge the reader / writer into the same class then I'm happy to do it.

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.

@lightwalker-eth the original motivation was described in this slack message.

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.

I think we could just update the const name that is exported from @/lib/ensdb/singleton. It should be simply ensDbClient. In this case, it will be a client that can read from ENSDb and write into ENSDb.

ensDbClient will be also a useful name for ENSDb Reader instance when we integrate ENSDb SDK into ENSApi.

How does that sound?

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.

That sounds good 👍


const app = new Hono();

// include ENSIndexer Public Config endpoint
app.get("/config", async (c) => {
const publicConfig = await ensDbClient.getEnsIndexerPublicConfig();
const publicConfig = await ensDbWriter.getEnsIndexerPublicConfig();

// Invariant: the public config is guaranteed to be available in ENSDb after
// application startup.
Expand All @@ -30,7 +30,7 @@ app.get("/config", async (c) => {

app.get("/indexing-status", async (c) => {
try {
const crossChainSnapshot = await ensDbClient.getIndexingStatusSnapshot();
const crossChainSnapshot = await ensDbWriter.getIndexingStatusSnapshot();

// Invariant: the Indexing Status Snapshot is expected to be available in
// ENSDb shortly after application startup. There is a possibility that
Expand Down
10 changes: 9 additions & 1 deletion apps/ensindexer/ponder/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { cors } from "hono/cors";

import type { ErrorResponse } from "@ensnode/ensnode-sdk";

import { migrateEnsNodeSchema } from "@/lib/ensdb/migrate-ensnode-schema";
import { startEnsDbWriterWorker } from "@/lib/ensdb-writer-worker/singleton";

import ensNodeApi from "./handlers/ensnode-api";
Expand All @@ -13,7 +14,14 @@ import ensNodeApi from "./handlers/ensnode-api";
// the `api` directory of the Ponder app to avoid the following build issue:
// Error: Invalid dependency graph. Config, schema, and indexing function files
// cannot import objects from the API function file "src/api/index.ts".
startEnsDbWriterWorker();
// Before starting the ENSDb Writer Worker, we need to ensure that
// the ENSNode Schema in ENSDb is up to date by running any pending migrations.
migrateEnsNodeSchema()
.then(startEnsDbWriterWorker)
.catch((error) => {
console.error("Failed to migrate ENSNode Schema — ", error);
process.exit(1);
});

const app = new Hono();

Comment thread
tk-o marked this conversation as resolved.
Expand Down
26 changes: 0 additions & 26 deletions apps/ensindexer/src/lib/ensdb-client/drizzle.ts

This file was deleted.

207 changes: 0 additions & 207 deletions apps/ensindexer/src/lib/ensdb-client/ensdb-client.test.ts

This file was deleted.

Loading
Loading