Skip to content
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

WIP Event Support #33

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6320042
wip: custom graphql schema loaded
shrugs Jan 13, 2025
ba2e4db
wip: basic collection queries working
shrugs Jan 13, 2025
439846e
wip: literally encode ids instead of eq conditions
shrugs Jan 13, 2025
be24d63
fix: store labelhash in domains
shrugs Jan 13, 2025
cb5c2bd
fix: resolvedAddress is a relationship not an address
shrugs Jan 13, 2025
8e49374
fix: lowercase resolver address in resolverId
shrugs Jan 13, 2025
78cd07f
fix: (in)correctly mark root as migrated and include exception in New…
shrugs Jan 13, 2025
bf99f3c
fix: default null array fields for backwards compat
shrugs Jan 14, 2025
b71c8e0
docs: add documentation to graphql.ts
shrugs Jan 14, 2025
ca7f638
fix: remove unnecesary context injection
shrugs Jan 14, 2025
356a45f
fix: coinType, texts array default, makeResolverId arg order
shrugs Jan 14, 2025
3d37215
fix: handle dangling makeResolverId refactor
shrugs Jan 14, 2025
6c51502
fix: index all resolver-looking events not just NewResolver
shrugs Jan 14, 2025
592da2c
docs: add v2 notes, add comment about root node isMigrated
shrugs Jan 14, 2025
2eac208
fix: use enum for OrderDirection to match subgraph
shrugs Jan 14, 2025
d67d0b8
feat: implement scalar Entity_orderBy enums
shrugs Jan 14, 2025
ba27584
docs: add rest of graphql autogen api spec
shrugs Jan 15, 2025
8ee2353
docs: update backfill time estimation
shrugs Jan 15, 2025
d2e0eab
feat: host subgraph-compatible api at /subgraph instead of root
shrugs Jan 15, 2025
5608ed0
fix: handle subgraph case where version is changed but domain doesn't…
shrugs Jan 15, 2025
7990a17
chore: better comment on the other domain expected error
shrugs Jan 15, 2025
53c91fa
docs: document which api features are explicitly not supported
shrugs Jan 15, 2025
22ace7c
chore: remove subgraph-api todo from readme
shrugs Jan 15, 2025
d7edae7
chore: update package name to ensnode
shrugs Jan 16, 2025
b33099b
docs: tidy v2 notes, move _nocase to potential todo
shrugs Jan 16, 2025
a5d683c
fix: use upsert in Resolver#handleVersionChanged
shrugs Jan 16, 2025
10066a5
wip: event support
shrugs Jan 17, 2025
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
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

> powered by ponder

estimated backfill time @ 50rps = 24-36 hours on M1 Macbook (~10x speedup)
estimated mainnet backfill time @ <=500rps = ~12 hours on M1 Macbook (~14x-28x speedup vs subgraph)

### goals
## goals

> an optimized, multichain ens indexer that the community loves and integrates

Expand All @@ -23,26 +23,26 @@ estimated backfill time @ 50rps = 24-36 hours on M1 Macbook (~10x speedup)
- (possible) continued backwards compatibility with subgraph
- support indexing subset of data, i.e. only domains under parent node

#### next up
## next up

- [ ] implement events
- [ ] implement polymorphic events resolver on each relevant entity
- [ ] `_nocase` case-insensitive where filters
- not used interally but ensjs does technically expose this as an available filter to users
- [ ] confirm all the schema relations are configured correctly
- [ ] integrate rainbow tables for label healing
- load the table dump into pglite (or just postgres) & query synchronously to match existing behavior
- https://github.com/graphprotocol/ens-rainbow
- [ ] subgraph graphql implementation within ponder
- [ ] implement subgraph-style pagination api
- [ ] support the well-known queries in `GRAPHQL.md`
- [ ] support collection queries as well, to power `snapshot-eq`
- [ ] CI/CD with indexing?
- more recent endlbock for gut checks
- integrate index to recent block (10m?) and validate with `snapshot-eq` b4 passing
- [ ] better understand reverse resolution & how that pertains to L2 primary names and impacts the future schema, etc

### notes
## notes

- eth registry is ERC721, has many controllers (), no knowledge of pricing — delegated to registrar controllers
- eth old registry & new registry migration due to security issue, new then fallback to old, therefore ignore all old evens on domains that have been seen by new registry

### ENSIP Ideas
## ENSIP Ideas

- unable to automatically identify subname registries via onchain event, CCIP standard dosn't include any info about data source, so we'll need to encode manually for now
- ENSIP - shared interface for subdomain registrars
Expand Down
8 changes: 8 additions & 0 deletions docs/GRAPHQL.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# graphql info/spec

## backwards-compatibility notes

the following features of the subgraph graphql api are explicitly unsupported, because they are not used by ensjs or ens-app-v3

- [fulltext search queries](https://thegraph.com/docs/en/subgraphs/querying/graphql-api/#fulltext-search-queries)
- 1-level-nested Entity `_orderBy` param
- subgraph `_Meta_` object (ponder's `_meta` is available)

## goals

1. ponder indexer 1:1 equivalency of results as compared to subgraph
Expand Down
4 changes: 4 additions & 0 deletions docs/V2.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ the 'empty' domains should be handled more accurately, depending on how importan
- removes need to increment during domain creation
- new impl likely needs to exclude 'empty' domains (see registry notes for context)

domain createdAt should not update on re-registration, should be original createdAt

various resources use both null and zeroAddress to indicate emptiness, this is horrible and creates numerous checks like [this](https://github.com/ensdomains/ensjs/blob/main/packages/ensjs/src/functions/subgraph/getNamesForAddress.ts#L255) where they check for `!== NULL && !== zeroAddress`

wrappedOwnerId should not be materialized onto domain, should just be resolved through wrappedDomain.owner
Expand Down Expand Up @@ -75,6 +77,8 @@ any resolver that implements the CCIP Read standard will have to have its record

in the subgraph implementation, resolver handlers must upsert resolvers because people can set records etc for a node that has not (yet) specified this resolver as active, meaning the create in `Registry:NewResolver` has yet to fire. in the ideal scenario, this lookup is keyed only by `(chainId, address)` and we can use pure updates instead of an upsert

v1: resolvers are discovered by tracking all emissions of events that look like resolver spec events. very inefficient, as a resolver is only relevant to the protocol once it's been set as a resolver. for v2, we could use factory like normal, starting to track events on `Registry#NewResolver` and then backfilling the events (using the same handlers) with ponder's cached viem client. not sure if this is more or less intensive than just parsing every event ever

### registrar

the subgraph implements all of the BaseRegistrar, EthRegistrarController, and EthRegistrarControllerOld logic together
Expand Down
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "ens-multichain",
"name": "ensnode",
"version": "0.0.1",
"private": true,
"type": "module",
Expand All @@ -13,8 +13,17 @@
},
"dependencies": {
"@ensdomains/ensjs": "^4.0.2",
"@escape.tech/graphql-armor-max-aliases": "^2.6.0",
"@escape.tech/graphql-armor-max-depth": "^2.4.0",
"@escape.tech/graphql-armor-max-tokens": "^2.5.0",
"change-case": "^5.4.4",
"dataloader": "^2.2.3",
"drizzle-orm": "^0.38.3",
"graphql": "^16.10.0",
"graphql-scalars": "^1.24.0",
"graphql-yoga": "^5.10.9",
"hono": "^4.6.14",
"ponder": "^0.8.17",
"ponder": "^0.8.24",
"viem": "^2.21.57"
},
"devDependencies": {
Expand Down
162 changes: 153 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading