Skip to content

feat: namespace-as-origin-addressing — drop per-hash claims + default-open allow-list (#1394) - #1401

Merged
thiras merged 10 commits into
mainfrom
claude/adr-namespace-origin-impl-7f198d
Jul 23, 2026
Merged

thiras merged 10 commits into
mainfrom
claude/adr-namespace-origin-impl-7f198d

Conversation

@alpergundogdu

@alpergundogdu alpergundogdu commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Implements #1394 — the code half of the namespace-as-origin-addressing redesign ratified in #1395 (ADRs 002/005/011/016/022). The namespace is now the unit of origin addressing: a cdn/client/v1 request carries (namespace_id, hash), and the node routes on the namespace to that namespace's DAO-authorized origins. There is no per-hash on-chain claim and no default-open allow-list.

Design: namespace_id is a client→node hint, consumed once

namespace_id is a routing hint the client supplies, consumed exactly once — at the receiving node's origin-directory fallback (the DHT-miss branch of discover). It does not propagate:

  • Node-to-node: a peer that answered has_blob: true to a probe already holds the bytes; the requester pulls by hash. No namespace on that leg.
  • Node-to-origin: backends (S3/HTTP/FS) are opaque and hash-keyed. No namespace, ever.

Consequences: the generic cache Origin trait and the S3/HTTP/FS backends are untouched; only the node-to-node discovery entry and the client-facing fetch path carry the namespace.

What changed

Contracts (ba18f57)

  • PublisherRegistry: removed claimContent / namespaceOf / hasClaimed / ContentClaimed / AlreadyClaimed + the per-hash claim storage. It records only namespace ownership + lifecycle.
  • OriginAssignment: removed the entire default-open allow-list surface (setDefaultOpenAllowlist/add/remove, defaultOpenMaxOrigins + bounds, 3 DefaultOpen* events, DEFAULT_OPEN_NAMESPACE). Namespace 0 is unassignable by construction (ownerOf(0) == 0), so getOrigins(0) is always empty — no special-casing.
  • ContentBlacklist: appeal path-1 standing drops the hasClaimed check (owning the declared namespace is the only on-chain gate; hash→namespace is off-chain). Path numbering unchanged.
  • Tests re-blessed, InterfaceFreeze re-blessed (setDefaultOpenAllowlist selector gone), .gas-snapshot regenerated.

Rust core (7988698)

  • protocol: StreamRequest.namespace_id: [u8; 32] (big-endian uint256) + NO_NAMESPACE/has_namespace. Kept [u8; 32] (like hash/channel_id) so protocol stays alloy-free; the node layer converts to U256.
  • node/dht: OriginDirectory re-keyed hash→namespace. chain_origin_directory rewritten — cache is namespace → operators, bootstrap replays AssignmentActivated (not ContentClaimed), watcher filter is OriginAssignment-only (3 events).
  • node/handlers + node_origin: the pull-through authorized-origin gate + the origin-directory fallback key on the request namespace. Prefetch's require_authorized_origin gate is dropped — the FIND_VALUE demand signal is hash-only and carries no namespace; prefetch no longer depends on OriginDirectory. Metrics consolidated to decdn_prefetch_acquisitions_total.
  • incentive: ABI bindings stripped of the removed surface.
  • common/config: the origin directory keys solely on origin_assignment_address (dropped the both-or-neither pairing with publisher_registry_address, which is now publish-CLI-only); removed prefetch.require_authorized_origin.
  • cli: publish claim subcommand removed (create-namespace + assign remain).

Client-namespace (7c42796)

  • decdn fetch --namespace <id> (rejects 0; absent ⇒ NO_NAMESPACE = best-effort cache/DHT). Threaded through client-pull stream_fetch_tracked/_with_progress/fetch_inner + fetch_blob + ChunkFetcher (a DECDNMAN manifest's chunk pulls inherit it). stream_fetch/stream_fetch_shared keep their signatures and pass NO_NAMESPACE, so the ~40 node-to-node test callers are untouched.

e2e (356b616, dfbe80b)

  • Purged the stale contract-ABI copy + helpers; deleted g_origin_04_default_open; rewrote g_origin_01/cli_publish/g_node_08 to the create+assign flow. g_node_08 now drives the real journey end-to-end: the client sends namespace 0 pre-ratification (gate refuses) and the ratified namespace post-ratification (gate resolves the authorized origin and serves).

Verification

  • cargo build/clippy --workspace --all-targets, cargo fmt --check — clean
  • cargo nextest: common (496), client-pull, node lib (693), node integration (client_loopback 45, node_origin_pull + node_to_node_pull_through 65, dht_loopback)
  • contracts: 808 forge tests, FOUNDRY_PROFILE=ci forge build --deny warnings, gas snapshot regenerated
  • e2e compiles clean --features anvil-e2e
  • Repo-wide sweep: zero removed-surface references (claimContent/namespaceOf/hasClaimed/default-open/ContentClaimed/require_authorized_origin)

Notes

  • The ADRs show namespace_id: U256; the impl uses [u8; 32] big-endian to keep the protocol leaf crate alloy-free (defensible illustrative difference; documented in code).
  • bundle pull sends NO_NAMESPACE (a --namespace for bundles is a small future follow-up).

Closes #1394.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added optional namespace routing to fetch requests and pull-through delivery.
    • Namespace-aware origin authorization now supports safer, targeted provider discovery.
  • Changes

    • Removed the publish claim workflow; content-to-namespace associations are handled off-chain.
    • Publisher namespaces now focus on creation and ownership transfers.
    • Namespace 0 no longer provides default-open origins and always resolves to no authorized origins.
    • Blockchain origin-directory configuration can now be enabled independently.
  • Bug Fixes

    • Improved fail-closed behavior when authorized-origin information is unavailable.

alpergundogdu and others added 5 commits July 22, 2026 17:42
…s + default-open allow-list (#1394)

Solidity half of the ADR 002/011/016 redesign (PR #1395):

- PublisherRegistry: remove claimContent / namespaceOf / hasClaimed /
  ContentClaimed / AlreadyClaimed + the per-hash claim storage. The registry
  now records only namespace ownership + lifecycle; hash->namespace is off-chain.
- OriginAssignment: remove the entire default-open allow-list surface
  (setDefaultOpenAllowlist / add / remove, defaultOpenMaxOrigins + bounds, the
  3 DefaultOpen* events, DEFAULT_OPEN_NAMESPACE). Namespace 0 is unassignable
  by construction (ownerOf(0) == 0), so getOrigins(0) is always empty with no
  special-casing.
- ContentBlacklist: appeal path-1 standing drops the hasClaimed check — owning
  the declared namespace is the only on-chain gate (hash->namespace is off-chain).
- IPublisherRegistryStanding: drop hasClaimed (ownerOf only).
- Tests re-blessed: remove claim / default-open suites, re-bless InterfaceFreeze
  (setDefaultOpenAllowlist selector gone), regenerate .gas-snapshot.

All 808 contract tests pass; forge build --deny warnings clean.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Rust half of the ADR 002/011/016 redesign, matching the merged contracts
(ba18f57). namespace_id is a client→node routing hint consumed exactly once —
at the receiving node's origin-directory fallback (the DHT-miss branch). It does
not propagate node-to-node (a probed holder already has the blob) and is never
needed node-to-origin (backends are opaque, hash-keyed).

- protocol: StreamRequest gains `namespace_id: [u8; 32]` (big-endian uint256) +
  NO_NAMESPACE / has_namespace helpers. Kept `[u8; 32]` (like hash/channel_id)
  so protocol stays alloy-free; the node layer converts to U256.
- node/dht: OriginDirectory re-keyed hash→namespace_id (U256).
  chain_origin_directory rewritten — cache is namespace→operators; bootstrap
  replays AssignmentActivated (not ContentClaimed); watcher filter is
  OriginAssignment-only (3 events); default-open / hash→namespace machinery gone.
- node/node_origin: the origin-directory fallback in `discover` takes the
  namespace; the client-serve path (open_progressive_pull ← window handler)
  threads req.namespace_id; the generic Origin::fetch (buffered/prefetch, hash-
  only) passes NO_NAMESPACE. The generic Origin trait + S3/HTTP/FS backends are
  untouched.
- node/handlers: pull_through_require_authorized_origin gate re-keyed to the
  request namespace. Prefetch's require_authorized_origin gate DROPPED (the
  FIND_VALUE demand signal is hash-only); prefetch no longer depends on
  OriginDirectory. Metrics consolidated to decdn_prefetch_acquisitions_total.
- incentive: PublisherRegistry / OriginAssignment bindings stripped of the
  removed surface (claimContent/namespaceOf/DefaultOpen*).
- common/config: origin directory keys solely on origin_assignment_address
  (publisher_registry independent, publish-CLI only) — dropped the both-or-
  neither pairing; removed prefetch.require_authorized_origin.
- cli: `publish claim` subcommand removed (create-namespace + assign remain);
  client-pull node-to-node pulls send NO_NAMESPACE.

Green: cargo build/clippy --all-targets, fmt; nextest across protocol/common/
incentive/client-pull + node lib + node integration. e2e (anvil-gated) test
logic reworked in a follow-up commit.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
)

e2e half of the redesign. The e2e crate carries its own contract ABI copy plus
fixtures/tests that referenced the removed surface (claimContent / namespaceOf /
hasClaimed / AlreadyClaimed / DefaultOpen*); they compiled against the stale
bindings but would revert against the redesigned contracts.

- bindings.rs: drop claimContent / namespaceOf / hasClaimed / AlreadyClaimed /
  addDefaultOpenOperator from the sol! blocks.
- chain.rs: drop the claim_content / content_namespaces / add_default_open_operator
  helpers; getOrigins(0) documented as always-empty.
- g_origin_04_default_open.rs: deleted (default-open concept is gone).
- g_origin_01_publish.rs: run_publish rewritten from claim/multi-claim/hasClaimed
  to the surviving `namespace create` flow (mints owned ids; namespace 0 unowned).
  The namespace-transfer journey is unchanged.
- cli_publish.rs: drop the `publish claim` step + namespaceOf assertion; keep
  namespace-create + assign.
- g_node_08_authorized_origin.rs: ratification keys on the namespace directly
  (getOrigins(namespace)) instead of a hash→namespace lookup; the claim loop is
  gone.

Compiles clean with `--features anvil-e2e` (no warnings). NOTE: g_node_08's
positive serving journey (a client fetch succeeds once the namespace's origin is
ratified) requires the client to *send* that namespace on its StreamRequest.
Client-pull currently sends NO_NAMESPACE (node-to-node needs none), so wiring a
client-supplied namespace through client-pull/the fetch CLI is a follow-up before
that journey can pass at runtime.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Follow-up doc-comment cleanup: the origin directory replays AssignmentActivated
(not ContentClaimed) and resolves a request's namespace via getOrigins, with no
hash→namespace lookup. Updates the resumable_watcher checkpoint doc and the
G-NODE-08 module/ordering comments accordingly.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…1394)

Completes the client send-side of namespace-as-origin-addressing. Clients can
now route a cache-miss origin pull to a namespace's DAO-authorized origins;
previously every client sent NO_NAMESPACE, so the pull-through gate and origin-
directory fallback only ever saw namespace 0.

- client-pull: thread `namespace_id: [u8; 32]` through stream_fetch_tracked /
  stream_fetch_tracked_with_progress / fetch_inner. `stream_fetch` and
  stream_fetch_shared keep their signatures and pass NO_NAMESPACE (node-to-node
  loopback helpers), so the ~40 node-to-node test callers are untouched.
- cli: `decdn fetch --namespace <id>` (rejects 0; absent => NO_NAMESPACE =
  best-effort cache/DHT). Threaded through fetch_blob + ChunkFetcher so a
  DECDNMAN manifest's chunk pulls inherit it. `bundle pull` sends NO_NAMESPACE.
- e2e: ClientFixture `fetch`/`fetch_once` take a `namespace_id: U256`; g_node_08
  now drives the real end-to-end journey — the client sends namespace 0 pre-
  ratification (gate refuses) and the ratified namespace post-ratification (gate
  resolves the authorized origin and serves). Other e2e fetch callers pass
  U256::ZERO.

Green: cargo clippy --all-targets, fmt; nextest common (496) + client-pull +
node client_loopback (45); e2e compiles --features anvil-e2e.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Copilot AI review requested due to automatic review settings July 22, 2026 22:57
@coderabbitai

coderabbitai Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@thiras, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 26 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Free

Run ID: e5a2c884-bbb5-4851-b79d-49626364d3ce

📥 Commits

Reviewing files that changed from the base of the PR and between 38c88b7 and dad536b.

📒 Files selected for processing (7)
  • contracts/src/PublisherRegistry.sol
  • crates/client-pull/src/lib.rs
  • crates/common/src/cli/run.rs
  • crates/e2e/src/client.rs
  • crates/e2e/tests/g_node_08_authorized_origin.rs
  • crates/node/src/dht/chain_origin_directory.rs
  • crates/node/src/metrics.rs

Walkthrough

The change removes on-chain content-claim and default-open origin mechanisms, introduces namespace identifiers into fetch routing and pull-through authorization, and updates origin-directory resolution, configuration, bindings, CLI commands, tests, and gas snapshots accordingly.

Changes

Namespace-based contract and ABI surface

Layer / File(s) Summary
Contract and ABI surface
contracts/src/*, contracts/test/*, crates/e2e/src/bindings.rs, crates/incentive/src/*
PublisherRegistry now retains namespace lifecycle and ownership only; OriginAssignment removes default-open state and management APIs; Publisher standing checks namespace ownership without hash claims; related tests and ABI bindings are updated.

Protocol, CLI, and client propagation

Layer / File(s) Summary
Protocol and CLI namespace propagation
crates/protocol/*, crates/client-pull/*, crates/common/src/cli/*, crates/cli/src/commands/*, crates/e2e/src/client.rs
StreamRequest gains namespace_id and NO_NAMESPACE; fetch commands and client pull APIs propagate namespace routing; publish claim is removed.

Origin directory and pull-through resolution

Layer / File(s) Summary
Namespace-based origin directory
crates/node/src/dht/*, crates/node/src/node_origin.rs, crates/node/src/runtime/mod.rs
Origin lookup, caching, replay, watcher updates, and provider fallback are keyed by namespace and use AssignmentActivated events; namespace zero resolves to no origins.
Namespace-aware pull-through gates
crates/node/src/handlers/client/*, crates/node/tests/*, crates/e2e/tests/*
Authorization gates and progressive upstream pulls use request namespaces, while existing no-namespace paths pass the zero sentinel; tests update request construction and fetch signatures.
Runtime configuration and namespace semantics
crates/common/src/config/*, crates/node/src/metrics.rs, crates/cli/src/commands/config.rs, crates/incentive/src/*
Origin-directory enablement depends only on origin_assignment_address, and related documentation, metrics, replay anchors, and operator configuration describe namespace-based behavior.

Validation and measurements

Layer / File(s) Summary
Contract validation and gas updates
contracts/test/*, contracts/.gas-snapshot
Tests remove obsolete claim/default-open cases, add namespace-zero coverage, and refresh gas and fuzz snapshot entries.

Estimated code review effort: 4 (Complex) | ~60 minutes


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

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

Copilot AI 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.

Pull request overview

Implements the namespace-as-origin-addressing redesign (issue #1394): client requests now carry a (namespace_id, hash) pair, nodes route cache-miss origin pulls by namespace via OriginAssignment, and the per-hash on-chain claim + default-open allow-list surfaces are removed across Rust, contracts, CLI, and e2e fixtures.

Changes:

  • Added StreamRequest.namespace_id (with NO_NAMESPACE + helper) and threaded it through client fetch, node client handler, and test fixtures.
  • Reworked the node origin-directory and gating model to be namespace-keyed; removed prefetch’s authorized-origin gate and consolidated prefetch acquisition metrics.
  • Simplified Solidity surfaces by removing per-hash claim and default-open allow-list mechanisms; updated bindings, interface-freeze tests, and gas snapshots accordingly.

Reviewed changes

Copilot reviewed 55 out of 55 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
crates/protocol/src/client.rs Adds namespace_id to StreamRequest, plus NO_NAMESPACE and helper API.
crates/node/tests/origin_range_pull.rs Updates test StreamRequest construction to include NO_NAMESPACE.
crates/node/tests/node_to_node_pull_through.rs Updates test StreamRequest construction to include NO_NAMESPACE.
crates/node/tests/node_origin_pull.rs Updates origin-directory test wiring and progressive pull calls for namespace-keyed directory.
crates/node/tests/dht_loopback.rs Adjusts prefetch tests/metrics expectations after gate and metric changes.
crates/node/tests/client_loopback.rs Threads NO_NAMESPACE through loopback client requests and tracked fetch helpers.
crates/node/src/runtime/reload.rs Updates reload-warning text to reflect removed prefetch config knob.
crates/node/src/runtime/mod.rs Removes publisher-registry requirement for origin directory; updates gate-armed warning logic; updates prefetch engine wiring.
crates/node/src/prefetch/mod.rs Removes origin-directory dependency from prefetch engine; simplifies decision call chain.
crates/node/src/prefetch/decision.rs Removes authorized-origin gate from prefetch policy and updates skip reasons/tests accordingly.
crates/node/src/node_origin.rs Threads namespace into discover fallback; ensures hash-only pulls use NO_NAMESPACE behavior.
crates/node/src/metrics.rs Consolidates prefetch acquisition metrics into a single counter and removes origin-gate rejection metric.
crates/node/src/handlers/dht.rs Updates metrics call site for simplified prefetch acquisition recording.
crates/node/src/handlers/client/window.rs Converts request namespace_id bytes to U256 for namespace-keyed fallback in progressive pulls.
crates/node/src/handlers/client/mod.rs Updates pull-through authorized-origin gate to be namespace-based and adjusts tests.
crates/node/src/handlers/client/dispatch.rs Routes pull-through authorized-origin gate check on request namespace (not hash).
crates/node/src/dht/origin.rs Re-keys OriginDirectory trait to namespace_id: U256; updates docs and implementations.
crates/node/src/chain_events/resumable_watcher.rs Updates watcher cursor docs to reference AssignmentActivated projection.
crates/node/src/chain_events/backfill.rs Updates backfill docs to reference AssignmentActivated replay.
crates/incentive/src/store.rs Renames origin-directory watcher cursor doc to AssignmentActivated.
crates/incentive/src/publisher_registry.rs Updates bindings/docs: registry is namespace lifecycle only (no hash claims).
crates/incentive/src/origin_assignment.rs Updates bindings/docs: removes default-open allow-list events/surface.
crates/e2e/tests/smoke.rs Updates client fetch call to pass namespace id parameter.
crates/e2e/tests/slash_appeal.rs Updates client fetch call to pass namespace id parameter.
crates/e2e/tests/g_origin_04_default_open.rs Removes obsolete default-open migration journey.
crates/e2e/tests/g_origin_01_publish.rs Updates journey to namespace create/transfer only; removes claim/multi-claim assertions.
crates/e2e/tests/g_node_08_authorized_origin.rs Updates authorized-origin journey to namespace-based routing (no per-hash claim).
crates/e2e/tests/g_node_04_blacklist_compliance.rs Updates client fetch calls to pass namespace id parameter.
crates/e2e/tests/g_gov_02_rate_bounds.rs Updates client fetch calls to pass namespace id parameter.
crates/e2e/tests/cli_publish.rs Updates publish e2e to namespace create + assign only (no claim).
crates/e2e/src/client.rs Threads namespace id into tracked fetch helpers and wire-tap StreamRequest.
crates/e2e/src/chain.rs Removes default-open and claim helpers; updates origins docs.
crates/e2e/src/bindings.rs Removes claim-related functions/errors from PublisherRegistry bindings; removes default-open function from OriginAssignment.
crates/common/src/config/types.rs Updates config docs: origin directory depends only on origin_assignment_address; prefetch config removes require_authorized_origin.
crates/common/src/config/resolved.rs Removes resolved prefetch require_authorized_origin; updates blockchain docs.
crates/common/src/config/mod.rs Updates config resolution logic: no longer enforces both-or-neither origin/publisher addresses; removes prefetch knob defaults/tests.
crates/common/src/cli/publish.rs Removes publish claim subcommand and related parsing/tests; updates namespace parsing docs.
crates/common/src/cli/mod.rs Removes ClaimArgs re-export from CLI module.
crates/common/src/cli/fetch.rs Adds --namespace to decdn fetch with validation rejecting 0.
crates/client-pull/src/lib.rs Threads namespace_id through tracked fetch path; keeps node-to-node helpers defaulting to NO_NAMESPACE.
crates/cli/src/commands/publish.rs Removes publish claim implementation/output/tests; updates docs for namespace-only lifecycle + assign.
crates/cli/src/commands/fetch.rs Threads namespace through fetch plumbing and chunk fetching.
crates/cli/src/commands/config.rs Updates default config comments: origin directory from OriginAssignment; removes prefetch origin-gate doc.
crates/cli/src/commands/bundle_pull.rs Uses NO_NAMESPACE for bundle chunk pulls (namespace support deferred).
contracts/test/PublisherRegistry.t.sol Removes claim-related tests; updates namespace-0 comment wording.
contracts/test/OriginAssignment.t.sol Removes default-open allow-list tests and gas guards; removes unused console import.
contracts/test/InterfaceFreeze.t.sol Removes interface-freeze assertion for deleted default-open selector.
contracts/test/ContentBlacklist.t.sol Updates publisher standing tests: ownership only, no hasClaimed check.
contracts/src/PublisherRegistry.sol Removes claim storage/functions/events/errors; registry becomes namespace lifecycle only.
contracts/src/OriginAssignment.sol Removes default-open allow-list surface/state/events; clarifies namespace 0 semantics.
contracts/src/interfaces/IPublisherRegistryStanding.sol Removes hasClaimed from standing interface; updates docs for ownership-only standing.
contracts/src/interfaces/IPublisherRegistryOwnership.sol Updates docs for namespace 0 meaning.
contracts/src/ContentBlacklist.sol Updates publisher standing logic/docs to ownership-only gate.
contracts/.gas-snapshot Regenerates gas snapshot after contract surface changes.
Comments suppressed due to low confidence (2)

crates/node/tests/node_origin_pull.rs:1504

  • This HashMap::from([ ... ]) uses the same U256::ZERO key twice; the first entry is overwritten immediately. It also forces an unnecessary providers.clone(). Since the directory is namespace-keyed now, this should be a single entry.
    crates/node/tests/node_origin_pull.rs:9434
  • This origin-directory map has duplicate U256::ZERO keys; the first entry is overwritten by the second, so providers.clone() is wasted. Use a single entry for the namespace.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 859 to 862
let mut dir = HashMap::new();
for h in hashes {
dir.insert(DhtHash::from_bytes(*h.as_bytes()), providers.to_vec());
for _h in hashes {
dir.insert(U256::ZERO, providers.to_vec());
}
fn sample_request() -> StreamRequest {
StreamRequest {
hash: [1u8; 32],
namespace_id: [3u8; 32],
…origin-impl-7f198d

# Conflicts:
#	crates/cli/src/commands/config.rs
#	crates/common/src/config/mod.rs
#	crates/common/src/config/resolved.rs
#	crates/common/src/config/types.rs
#	crates/node/src/dht/chain_origin_directory.rs
#	crates/node/src/dht/origin.rs
#	crates/node/src/handlers/client/dispatch.rs
#	crates/node/src/handlers/dht.rs
#	crates/node/src/metrics.rs
#	crates/node/src/prefetch/decision.rs
#	crates/node/src/prefetch/mod.rs
#	crates/node/src/runtime/mod.rs
#	crates/node/src/runtime/reload.rs
#	crates/node/tests/dht_loopback.rs
#	crates/node/tests/node_origin_pull.rs
@github-actions

github-actions Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

Contracts coverage

Line coverage: 89.58% (2631/2937 lines)
▼ -0.05pp vs base (89.63% → 89.58%)
Run: 29970488518

@github-actions

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

@alpergundogdu alpergundogdu changed the title Implement namespace-as-origin-addressing: drop per-hash claims + default-open allow-list (#1394) feat: namespace-as-origin-addressing — drop per-hash claims + default-open allow-list (#1394) Jul 22, 2026
…ace_id (#1394)

Adds namespace_id / NO_NAMESPACE / has_namespace to the frozen public API
snapshot, matching the redesign.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@github-actions

github-actions Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

Coverage report

Total: 81.24% (was 81.13%, ▲ +0.11%) — 54100/66593 lines

File Coverage Lines Δ
crates/cli/src/commands/bundle_pull.rs 56.42% 549/973 ● 0.00%
crates/cli/src/commands/config.rs 69.81% 185/265 ● 0.00%
crates/cli/src/commands/fetch.rs 35.52% 292/822 ▼ 0.48%
crates/cli/src/commands/publish.rs 52.89% 201/380 ▼ 1.98%
crates/client-pull/src/lib.rs 88.55% 990/1118 ▲ +0.39%
crates/common/src/cli/fetch.rs 100.00% 117/117 ● 0.00%
crates/common/src/cli/mod.rs 100.00% 3/3 ● 0.00%
crates/common/src/cli/publish.rs 95.00% 19/20 ▼ 2.14%
crates/common/src/config/mod.rs 96.98% 6782/6993 ▲ +0.02%
crates/common/src/config/resolved.rs 100.00% 35/35 ● 0.00%
crates/e2e/src/chain.rs 1.00% 11/1105 ▲ +0.04%
crates/e2e/src/client.rs 0.00% 0/362 ● 0.00%
crates/incentive/src/store.rs 90.76% 167/184 ● 0.00%
crates/node/src/chain_events/backfill.rs 98.11% 52/53 ● 0.00%
crates/node/src/chain_events/resumable_watcher.rs 94.89% 799/842 ● 0.00%
crates/node/src/dht/chain_origin_directory.rs 71.71% 616/859 ▼ 0.51%
crates/node/src/dht/origin.rs 95.00% 57/60 ▲ +0.26%
crates/node/src/handlers/client/dispatch.rs 86.19% 231/268 ● 0.00%
crates/node/src/handlers/client/mod.rs 88.83% 636/716 ▼ 0.06%
crates/node/src/handlers/client/window.rs 83.77% 222/265 ▲ +0.12%
crates/node/src/metrics.rs 95.31% 976/1024 ● 0.00%
crates/node/src/node_origin.rs 91.01% 952/1046 ▲ +0.57%
crates/node/src/runtime/mod.rs 45.21% 1086/2402 ▲ +0.09%
crates/protocol/src/client.rs 97.34% 696/715 ● 0.00%
History
Commit Total Δ vs base
414fcfd 81.21% ▲ +0.08%
38c88b7 81.23% ▲ +0.10%
dad536b (HEAD) 81.24% ▲ +0.11%

thiras and others added 3 commits July 23, 2026 03:22
…defenses, comment/test cleanup

Behavioral: thread the served request's namespace onto the progressive
client-serve node-to-node leg (client-pull open_progressive_pull +
node_origin open_from_candidate[s]) so a directory-discovered cold origin's
pull-through gate resolves and it fills from its own backend. Previously the
leg was hardcoded to NO_NAMESPACE, so an armed origin refused content it was
the authorized origin for. Buffered/warm/prefetch paths correctly stay
NO_NAMESPACE. New test node_origin_pull::a_progressive_pull_routes_the_
fallback_on_the_request_namespace proves the namespace is load-bearing
(resolves under a non-zero namespace, resolves nothing under NO_NAMESPACE),
closing the prior symmetric-ZERO test blindness.

Invariant defense: guard U256::ZERO at both ChainOriginDirectory cache insert
sites (bootstrap_cache, resync_namespace) so "ns 0 authorizes nothing" is
type-local, not merely trusted from the ABI-decoded event field; add the
on-chain OriginAssignment.t.sol test_namespaceZero_isUnassignableAndHasNoOrigins.

Observability: meter undecodable-log decode-skip arms so an ABI-drift storm
is visible, not warn-log-only.

Cleanup: rewrite the stale default-open pull_origin_gate comment (ns 0 now
hard-denies); fix the "only consumer"/"does not propagate" namespace comments;
remove dead StreamRequest::has_namespace() (re-bless public_api snapshot);
drop the vestigial origin::Hash re-export; correct metrics/config/protocol/e2e
doc staleness; add parse_fetch_namespace_id test; delete the orphan root
.gas-snapshot; regenerate contracts/.gas-snapshot for the new test.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`capture_delivery_wire` hardcoded `NO_NAMESPACE`, so the g_node_08 wire-tap
fetched a backend-only blob under namespace 0. Under namespace-as-origin-
addressing the authorized-origin gate keys on the request namespace, so that
request is refused (`NotFound`) — the tap captured a refusal and
`assert_backend_never_on_the_wire` panicked ("tapped delivery was refused").

Add a `namespace_id` parameter and pass the DAO-ratified namespace at the call
site, matching the `fetch`/`fetch_once` paths the PR already threaded. The
origin backend stays hash-keyed and opaque (never sees the namespace).

Fixes the `anvil e2e` CI failure on this branch.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Follow-up from the PR review. No behavior change beyond docs/tests.

- metrics.rs: the review commit's scrub left "default-open set" / "claimed
  hashes" / "newly-claimed namespace" / "activate/add … remove" language on the
  later lines of doc blocks whose first lines it did update; reconcile them with
  the namespace-as-origin model (matching chain_origin_directory's wording).
- metrics.rs: clarify serve_stream_rejected_unauthorized_origin — the gate
  scopes on the namespace the requester names, not proven hash membership.
- cli/run.rs: --origin-assignment-address / --publisher-registry-address help
  text no longer claims the removed both-or-neither pairing.
- PublisherRegistry.sol: "default-open id 0" -> "no-namespace id 0".
- client-pull: scope the "node-to-node pulls pass NO_NAMESPACE" comment to the
  callers that reach fetch_inner (the cold-origin leg carries a real namespace).
- chain_origin_directory: add namespace_zero_event_never_seats_operators,
  covering the resync_namespace ns-0 guard that keeps the pull-through gate
  closed for NO_NAMESPACE even under decode drift.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@thiras
thiras merged commit a02f781 into main Jul 23, 2026
23 checks passed
@thiras
thiras deleted the claude/adr-namespace-origin-impl-7f198d branch July 23, 2026 01:12
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.

Redesign origin addressing: namespace-as-address, drop per-hash claims and the default-open allow-list

3 participants