Repository navigation
Description
Context
PRs #646 / #647 shipped the trait abstractions (`StakerSet`, `OriginDirectory`) and file-config-driven implementations (`ConfigStakerSet`, `ConfigOriginDirectory`) for testnet bring-up. The chain-backed implementations were deferred because they depend on contracts (`PublisherRegistry`, `OriginAssignment`, `StakingRegistry.{nodeIdOf, getActiveNodes}`) that are tracked separately (see #327 for the StakingRegistry surface).
This issue is to land the chain-backed Rust impls once those contracts ship, so operators can switch from `dht.static_active_nodes` / `dht.static_origins` (TOML) to live on-chain state via RPC.
Scope
alloy bindings (`crates/incentive`)
Add `sol!` blocks for the three view interfaces consumed by ADR 022 §FIND_VALUE Flow "Origin discovery":
- `PublisherRegistry::namespaceOf(bytes32 hash) returns (uint256[])`
- `OriginAssignment::getOrigins(uint256 namespaceId) returns (address[])`
- `StakingRegistry::nodeIdOf(address operator) returns (bytes32 nodeId, bool active)`
- `StakingRegistry::getActiveNodes(uint256 offset, uint256 limit) returns (NodeInfo[])` + paged iteration
ChainStakerSet
Implements `StakerSet` by:
- Initial `getActiveNodes()` read at startup (paged).
- Subscribe to `Staked` / `Unstaked` / `Slashed` events and apply to the cached set.
- Background reconciliation tick (15min default) to repair drift on missed events.
- Exposed via `Arc` so the runtime swaps it in via the same construction site as `ConfigStakerSet`.
ChainOriginDirectory
Implements `OriginDirectory`:
- `lookup_origins(hash)` resolves `namespaceOf(hash)` → `getOrigins(namespaceId)` → `nodeIdOf(operator)` via `Multicall3` (ADR 022 §FIND_VALUE Flow "no inter-call dependencies within a tier ... batches via the standard `Multicall3` aggregator").
- Subscribes to `AssignmentActivated` / `AssignmentRevoked` / `DefaultOpenAllowlistUpdated` to invalidate the per-hash cache.
- Default-open content: `getOrigins(0)` resolved on demand.
Wiring
Runtime selects between `ConfigStakerSet` and `ChainStakerSet` based on `dht.staker_source = { "config" | "chain" }` (and similarly for OriginDirectory). Default flips to "chain" once the contracts are live.
Dependencies
- Implement on-chain CapacityBond and PaymentChannel contract integration #327 — `StakingRegistry.{nodeIdOf, getActiveNodes}` view surface
- New: `PublisherRegistry` and `OriginAssignment` contracts (file a separate contract issue if not already tracked)
References
- Trait + config impls: `crates/node/src/dht/staker_set.rs`, `crates/node/src/dht/origin.rs`
- ADR 022 §FIND_VALUE Flow "Origin discovery"
- ADR 003 §NodeId-to-Ethereum Binding, ADR 016 §Off-Chain Read API
Splits out from #320.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
github-actions commentedon May 21, 2026
🎯 Triage report
This is a well-scoped implementation task to land
ChainStakerSetandChainOriginDirectory— the chain-backed counterparts to the file-config implementations shipped in #646/#647. It is explicitly blocked on contract delivery (#327 forStakingRegistry, plusPublisherRegistryandOriginAssignmentstill needing dedicated issues). The scope is crisp: alloysol!bindings incrates/incentive, two newimplstructs incrates/node/src/dht/, and a config-key-driven runtime wiring switch.📊 Assessment
technical,rust,blocked,prod-blockingsol!ABI definitions can't be written untilPublisherRegistryandOriginAssignmentcontract interfaces are finalized. Once those ABIs land, this becomes a suitable coding-agent task.🔗 Similar issues
StakingRegistryview surface; hard dependency forChainStakerSet💡 Notes and suggestions
Blocking dependencies to track:
StakingRegistry.nodeIdOf/getActiveNodesview surface. Already tracked.PublisherRegistry+OriginAssignment— the issue notes these need a dedicated contract issue; file one before assigning this to an agent or engineer.Implementation checklist (once ABIs are available):
crates/incentive: addsol!blocks forPublisherRegistry::namespaceOf,OriginAssignment::getOrigins,StakingRegistry::nodeIdOf,StakingRegistry::getActiveNodescrates/node/src/dht/staker_set.rs: implementChainStakerSet— startup page-scan, event subscriptions (Staked/Unstaked/Slashed), 15-min reconciliation tickcrates/node/src/dht/origin.rs: implementChainOriginDirectory—lookup_originsvia Multicall3 batching, event-driven cache invalidation (AssignmentActivated/AssignmentRevoked/DefaultOpenAllowlistUpdated), default-open (getOrigins(0)) pathdht.staker_sourceanddht.origin_sourceenum keys ("config" | "chain") — default to"config"until contracts are confirmed livecrates/nodebring-up): swap betweenConfig*andChain*impls at construction siteAnti-panic reminder: all alloy call sites must return
Result; no.unwrap()/.expect()per workspace Clippy policy.fix(node): address review on origin directory (#651)
test/docs(node): close review gaps on origin directory (#651)
feat(node): chain-backed origin directory + OriginAssignment/Publishe…
Merge origin/main into feat/831-node-pull-through-reputation
thiras commentedon Jun 10, 2026
Completed in #830 (the chain-backed OriginDirectory + OriginAssignment/PublisherRegistry bindings half); the StakerSet/ChainStakerSet half had already shipped earlier. Both halves of #651 are now on
main. Closing.fix(node,cli): correct wrong watcher docs + close the publish-resolve…
refactor(node): retire dead/redundant watcher surface (#1231) (#1234)