Skip to content

feat(arns): resolve on-demand by default + bundled observer self-references local gateway - #836

Open
vilenarios wants to merge 1 commit into
developfrom
feat/arns-resolver-on-demand-default
Open

feat(arns): resolve on-demand by default + bundled observer self-references local gateway#836
vilenarios wants to merge 1 commit into
developfrom
feat/arns-resolver-on-demand-default

Conversation

@vilenarios

Copy link
Copy Markdown
Contributor

What

Two small, synergistic default changes that make the standard AR.IO node deployment resolve ArNS authoritatively and decentrally:

  1. ARNS_RESOLVER_PRIORITY_ORDER default → on-demand,gateway (was gateway,on-demand). The gateway resolves ArNS names by reading the ANT record from chain first (OnDemandArNSResolver via SolanaANTReadable), falling back to a trusted-gateway hop (TrustedGatewayArNSResolver) only if the on-demand resolver fails.
  2. Bundled observer references this node's own gateway (ARNS_ROOT_HOST) by default, instead of external gateways.

Why

  • Decentralization. A gateway that hops to turbo/ar-io.net for resolution is a client of those gateways — a soft centralization. Reading the ANT directly makes each gateway self-sufficient and removes the chokepoint.
  • Authoritative. Reads the source of truth (the ANT record) rather than another gateway's possibly-stale cached answer.
  • It's what serious operators already run (turbo-gateway.com and others use on-demand).
  • The two changes reinforce each other: the observer's self-reference is only authoritative because the gateway now resolves on-demand. Together they make the default deployment's observation trustless-by-default, while the protocol continues to aggregate observers by majority.

Safety / fallback

  • The trusted-gateway hop is kept as a fallback, so resolution degrades gracefully if chain RPC is briefly unavailable — no new single point of failure.
  • The observer falls back to its own default (turbo/ar-io.net) if neither REFERENCE_GATEWAY_HOSTS nor ARNS_ROOT_HOST is set.
  • Both are fully overridable per operator (ARNS_RESOLVER_PRIORITY_ORDER=gateway,on-demand, REFERENCE_GATEWAY_HOSTS=…).

For reviewers — the one thing to weigh

On-demand adds a chain read per cache-miss resolution. That's cheap on Solana (RPC account read) but heavier on AO (CU dryrun, rate-limitable). Worth a quick latency / RPC-load sanity check on the heavier network before this ships broadly; per-gateway caching recovers repeat-name latency, and the gateway fallback + per-op override bound the downside. Consider per-network defaults if AO cost is material.

Scope

Intentionally standalone — this flips resolution behavior for all names and operators, so it's separated from any feature work for its own review and perf validation. No test asserts the prior order; docker compose config validated (self-reference resolves when ARNS_ROOT_HOST is set, empty otherwise).

…er self-references

Change the default ArNS resolution posture to be authoritative and decentralized.

- ARNS_RESOLVER_PRIORITY_ORDER default is now `on-demand,gateway` (was
  `gateway,on-demand`). Gateways resolve names authoritatively from the ANT record
  itself, falling back to a trusted-gateway hop only if the on-demand resolver
  fails. This makes each gateway self-sufficient instead of a client of a few
  trusted gateways (turbo/ar-io.net), and reads the source of truth rather than
  another gateway's possibly-stale cached answer. The trusted-gateway hop is kept
  as a fallback so resolution degrades gracefully if chain RPC is unavailable.

- The bundled observer references THIS node's own gateway (ARNS_ROOT_HOST) by
  default instead of external gateways. Because the gateway now resolves
  on-demand, that self-reference is authoritative and local; the observer forms
  its own chain-derived view and the protocol aggregates observers by majority.
  Falls back to the observer's own default (turbo/ar-io.net) if neither
  REFERENCE_GATEWAY_HOSTS nor ARNS_ROOT_HOST is set.

Cost note for reviewers: on-demand adds a chain read per cache-miss resolution —
cheap on Solana (RPC account read) but heavier on AO (CU dryrun). Worth a quick
latency/RPC-load sanity check on AO before this ships broadly; the `gateway`
fallback and per-op override (ARNS_RESOLVER_PRIORITY_ORDER=gateway,on-demand)
bound the downside.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01QPmZYvBxMyHWxrTL85xFr7
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR makes on-demand ArNS resolution the default before trusted-gateway fallback. The observer uses ARNS_ROOT_HOST as its default reference gateway when explicitly configured. The changelog documents these defaults and rollback behavior.

Changes

ArNS Resolution Defaults

Layer / File(s) Summary
Resolver and observer default wiring
src/config.ts, docker-compose.yaml, CHANGELOG.md
The default resolver order changes to on-demand,gateway. The observer uses ARNS_ROOT_HOST as its reference gateway fallback. The changelog documents the new resolution behavior and environment-variable override.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • ar-io/ar-io-node#793: Both PRs modify ArNS resolution configuration, but this PR changes resolver priority while #793 adds protocol-aware IPFS target handling.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the default on-demand ArNS resolution and bundled observer self-reference changes.
Description check ✅ Passed The description directly explains the resolution-order and observer-default changes, including rationale, fallbacks, overrides, and performance considerations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/arns-resolver-on-demand-default

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/config.ts (1)

2632-2639: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use TSDoc for the exported configuration constant.

ARNS_RESOLVER_PRIORITY_ORDER is a touched exported TypeScript constant, but its new documentation uses // comments. Convert this block to /** ... */ TSDoc while preserving the default-order and override details.

Proposed fix
-// Resolve ArNS names authoritatively from chain first (on-demand ANT lookups),
-// falling back to a trusted-gateway hop only if the on-demand resolver fails.
-// This makes each gateway self-sufficient rather than a client of a few trusted
-// gateways (more decentralized) and reads the source of truth (the ANT record)
-// instead of another gateway's possibly-stale cached answer. Operators can revert
-// to the previous behavior with ARNS_RESOLVER_PRIORITY_ORDER=gateway,on-demand.
+/**
+ * Resolves ArNS names from chain first and falls back to a trusted gateway.
+ *
+ * Operators can restore the previous order with
+ * `ARNS_RESOLVER_PRIORITY_ORDER=gateway,on-demand`.
+ */

As per coding guidelines, add or improve TSDoc comments on code you touch.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/config.ts` around lines 2632 - 2639, Convert the comment immediately
above the exported ARNS_RESOLVER_PRIORITY_ORDER constant from line comments to a
TSDoc block, preserving the authoritative on-demand resolution behavior, gateway
fallback, decentralization context, and
ARNS_RESOLVER_PRIORITY_ORDER=gateway,on-demand override details.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/config.ts`:
- Around line 2632-2639: Convert the comment immediately above the exported
ARNS_RESOLVER_PRIORITY_ORDER constant from line comments to a TSDoc block,
preserving the authoritative on-demand resolution behavior, gateway fallback,
decentralization context, and ARNS_RESOLVER_PRIORITY_ORDER=gateway,on-demand
override details.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8f9a25a3-cc55-4dbf-bd43-7fb33d284cbb

📥 Commits

Reviewing files that changed from the base of the PR and between 3e81d66 and ff61927.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • docker-compose.yaml
  • src/config.ts

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.43%. Comparing base (3e81d66) to head (ff61927).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #836   +/-   ##
========================================
  Coverage    79.43%   79.43%           
========================================
  Files          138      138           
  Lines        53401    53407    +6     
  Branches      4087     4087           
========================================
+ Hits         42420    42426    +6     
  Misses       10928    10928           
  Partials        53       53           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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