Skip to content

feat(testnet): adapt BENS metadata to canonical ENSv2 NFTs - #11

Merged
JOY (JOY) merged 3 commits into
dosfrom
codex/testnet-ensv2-bens-adapter
Oct 25, 2026
Merged

JOY (JOY) merged 3 commits into
dosfrom
codex/testnet-ensv2-bens-adapter

Conversation

@JOY

@JOY JOY (JOY) commented Oct 25, 2026 •

Copy link
Copy Markdown

Summary

  • Add a read-only, Testnet-only compatibility adapter next to the DOS Names subgraph.
  • Preserve ENS namehash identities and use canonical Graph Node tokenId/registry metadata for ERC-1155 NFT links.
  • Keep official BENS and all contracts unchanged. The adapter has no secrets and never signs or submits transactions.
  • Bound payload sizes, deadlines and active requests; strip caller credentials; fail closed on indexing errors/inconsistent metadata.
  • Add adapter tests to CI and document runtime boundaries.

Verification

  • 8 adapter tests pass, including real HTTP upstream/Graph Node fixtures, invalid states, subdomains and token regeneration.
  • 9 existing manifest rendering tests pass.
  • Biome formatting and git diff --check pass.
  • Independent source review in progress. Runtime deployment will occur only through the separately reviewed DOScan Testnet configuration. Mainnet is not enabled.

📌 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

  • 🚀 New feature
  • 📚 Documentation
  • ⚙️ CI / Configuration

🔍 Changes Walkthrough

File Summary of Changes
.github/workflows/main.yml Adds a CI step to execute the new adapter's isolated test suite (node --test adapter/server.test.mjs).
README.md Documents the new Testnet BENS metadata adapter, its purpose (compatibility proxy), security model (read-only, no keys), and how to run its tests.
subgraph/dos-names/adapter/server.mjs New file. Implements the HTTP adapter server. Key logic includes:
1. 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.mjs New file. Comprehensive test suite using node: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)
    end
Loading

Final-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.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization has no extra usage available to pay for this review.

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.

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3531d0f4-abdc-4251-ad5f-e3067125c237

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

dos[bot]
dos Bot approved these changes Oct 25, 2026

@dos dos Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⏱️ Code Review completed (4 eligible files · 15,749 chars · 2 model call(s) · 1 PR unit(s))

Whole diff with bounded context at base 3345d09 / head 3fc6d14.

✅ CLEAN_PASS: Complete diff reviewed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread subgraph/dos-names/adapter/server.mjs
Comment thread subgraph/dos-names/adapter/server.mjs
Comment thread subgraph/dos-names/adapter/server.mjs
Comment thread subgraph/dos-names/adapter/server.mjs

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread subgraph/dos-names/adapter/server.mjs Outdated
Comment thread subgraph/dos-names/adapter/server.mjs
Comment thread subgraph/dos-names/adapter/server.mjs
dos[bot]
dos Bot approved these changes Oct 25, 2026

@dos dos Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⏱️ Code Review completed (4 eligible files · 16,815 chars · 2 model call(s) · 1 PR unit(s))

Whole diff with bounded context at base 3345d09 / head d8cd171.

✅ CLEAN_PASS: Complete diff reviewed

dos[bot]
dos Bot approved these changes Oct 25, 2026

@dos dos Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⏱️ Code Review completed (4 eligible files · 18,501 chars · 2 model call(s) · 1 PR unit(s))

Whole diff with bounded context at base 3345d09 / head eaa2de6.

✅ CLEAN_PASS: Complete diff reviewed

@JOY
JOY (JOY) merged commit 2d47fb7 into dos Oct 25, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant