Repository navigation
feat(testnet): adapt BENS metadata to canonical ENSv2 NFTs - #11
Conversation
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
There was a problem hiding this comment.
Code Review
This pull request introduces a read-only compatibility proxy adapter (server.mjs) and its corresponding tests for the BENS ENS-like API on DOS Testnet. The adapter preserves ENS namehash identities while fetching ERC-1155 token IDs and registry addresses from a canonical Graph Node domain record. Feedback on the implementation highlights a potential Denial of Service (DoS) vulnerability where client disconnects can leak active request slots and trigger premature 503 errors; utilizing an AbortController linked to the client's connection closure is recommended to resolve this. Additionally, a logic bug was identified in rewriteMetadata where mapping over the original item.tokens instead of the walked result.tokens discards recursive transformations.
There was a problem hiding this comment.
Code Review
This pull request introduces a read-only compatibility proxy adapter for the BENS ENS-like API on DOS Testnet, mapping ERC-1155 token IDs and registry addresses from the canonical Graph Node domain record while preserving namehash identities. It also adds a comprehensive test suite and updates the README. Feedback on the implementation focuses on improving robustness, including normalizing name comparisons to handle null/undefined mismatches, and utilizing optional chaining for safer property access on indexed.owner and req.url.
Summary
Verification
📌 TL;DR
Introduces a read-only HTTP adapter for the DOS Testnet (3939) that proxies BENS API requests, rewrites ENSv2 metadata to use canonical Graph Node token IDs, and enforces strict security boundaries (no credentials, bounded payloads, fail-closed on indexing errors).
🎯 Type of Change
🔍 Changes Walkthrough
.github/workflows/main.ymlnode --test adapter/server.test.mjs).README.mdsubgraph/dos-names/adapter/server.mjs1.
validateDeployment: Ensures the deployment manifest targets Testnet 3939 with a valid registry.2.
rewriteMetadata: Recursively walks JSON responses to replace internal token IDs with canonical ERC-1155 IDs from the Graph Node, while preserving ENS namehash identities.3.
createAdapter: Sets up the HTTP server with strict limits (max 16 concurrent requests, 2MB payload limit, 10s timeout), strips credentials, and forwards requests to the upstream BENS API. It queries the Graph Node for token metadata and fails closed (502) if indexing errors are detected.subgraph/dos-names/adapter/server.test.mjsnode:test. Validates metadata rewriting logic, security constraints (credential stripping, origin checks), error handling (fail-closed behavior), and HTTP semantics (status codes, headers).📊 Architectural Flow
sequenceDiagram participant Client participant Adapter as DOS Names Adapter participant BENS as BENS API (Upstream) participant Graph as Graph Node (Subgraph) Client->>Adapter: GET /api/v1/3939/domains/{name} Note over Adapter: Validate path & limits<br>Strip credentials Adapter->>BENS: Forward request (GET) BENS-->>Adapter: JSON Metadata Response Note over Adapter: Parse JSON<br>Identify dos-names protocol Adapter->>Graph: GraphQL Query (domain token state) Graph-->>Adapter: Token ID & Owner Note over Adapter: Validate token state<br>Rewrite token IDs<br>Update explorer URLs Adapter-->>Client: 200 OK (Rewritten JSON) alt Graph Node Error Adapter-->>Client: 502 Bad Gateway (Fail Closed) endFinal-head source review
Independent fresh-context review completed on eaa2de6: CLEAN_PASS. P2 retired token metadata was fixed in d8cd171; abandoned upstream cancellation was fixed in eaa2de6. Adapter 10/10 tests and manifest 9/9 tests pass. Native review threads have replies and are resolved. This source merge does not deploy Mainnet or prove authenticated DOS.Me score acceptance.