feat(arns): resolve on-demand by default + bundled observer self-references local gateway - #836
feat(arns): resolve on-demand by default + bundled observer self-references local gateway#836vilenarios wants to merge 1 commit into
Conversation
…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
📝 WalkthroughWalkthroughThe PR makes on-demand ArNS resolution the default before trusted-gateway fallback. The observer uses ChangesArNS Resolution Defaults
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/config.ts (1)
2632-2639: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse TSDoc for the exported configuration constant.
ARNS_RESOLVER_PRIORITY_ORDERis 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
📒 Files selected for processing (3)
CHANGELOG.mddocker-compose.yamlsrc/config.ts
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
What
Two small, synergistic default changes that make the standard AR.IO node deployment resolve ArNS authoritatively and decentrally:
ARNS_RESOLVER_PRIORITY_ORDERdefault →on-demand,gateway(wasgateway,on-demand). The gateway resolves ArNS names by reading the ANT record from chain first (OnDemandArNSResolverviaSolanaANTReadable), falling back to a trusted-gateway hop (TrustedGatewayArNSResolver) only if the on-demand resolver fails.ARNS_ROOT_HOST) by default, instead of external gateways.Why
Safety / fallback
REFERENCE_GATEWAY_HOSTSnorARNS_ROOT_HOSTis set.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
gatewayfallback + 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 configvalidated (self-reference resolves whenARNS_ROOT_HOSTis set, empty otherwise).