Skip to content

ADR: unify contract surface; drop PoC/Production phasing in favor of tunable economics #449

Closed

Description

@alpergundogdu

Summary

ADR 016 §1's contract inventory currently splits the surface into "PoC + Production", "PoC only", and "Production only" rows. This phasing is misleading: two contracts tagged "PoC + Production" (PublisherRegistry, OriginAssignment) have no implementation, while contracts tagged "Production only" (FeeRouter, VotingEscrow, SafetyReserve) are load-bearing for ADR 022 / 026 / 027 / 028 claims that the rest of the spec treats as canonical. The in-flight scaffolding PR (#237) further made its own scope cuts that don't match the inventory tags.

Decision: drop the Phase column. Specify the full contract surface with tunable bucket shares and governance-mutable dependency addresses so a single deployment can launch with a simplified economic configuration (e.g. 80% operator / 10% buyback / 10% treasury) and dial up gauge boost / delegator pool / safety reserve as the dependent ADRs and infrastructure stabilize. Single audit covers the full surface.

Why now

  • PR feat(contracts): scaffold PoC EVM contract set per ADR 016 #237 will be closed in favor of a clean restart with the unified scope.
  • The current ADR set treats FeeRouter, VotingEscrow, SafetyReserve as deferred but ADRs 003 / 008 / 022 / 026 / 027 / 028 read against their interfaces as if they exist. The phasing distinction creates more confusion than it saves.
  • One audit pass against the full surface is materially cheaper than auditing twice with a migration in between, and it locks the public interface that off-chain integrations (clients, indexers, monitors) will integrate against.

Scope

A. ADR 016 §1 — inventory rewrite

Drop the Phase column. Replace the inventory table with the full contract surface:

Contract ADR Holds Funds Token Types OZ Base Contracts
TOKEN (ERC-20) 026 No — ERC20, ERC20Permit, ERC20Votes
StakingRegistry 003, 026 Yes TOKEN AccessControl, ReentrancyGuard, Pausable, EIP712
StablePaymentChannel 003 Yes USDC Ownable, ReentrancyGuard, Pausable, EIP712
FeeRouter 026 Yes USDC, TOKEN AccessControl, ReentrancyGuard, Pausable
VotingEscrow 026 Yes TOKEN (locked) ReentrancyGuard, Pausable
SafetyReserve 026, 028 Yes USDC, TOKEN AccessControl, ReentrancyGuard, Pausable
BuybackBurner 018, 026 Yes USDC, TOKEN AccessControl, ReentrancyGuard, Pausable
DelegatorBuyer 026 Yes USDC, TOKEN AccessControl, ReentrancyGuard, Pausable
ContentBlacklist 011 No — AccessControl, ReentrancyGuard
PublisherRegistry 002 No — AccessControl, ReentrancyGuard
OriginAssignment 011 No — AccessControl, ReentrancyGuard
SlashJudge 014 Yes TOKEN AccessControl, ReentrancyGuard, Pausable, EIP712
DecdnGovernor 009 No — OZ Governor + GovernorSettings + GovernorVotes + GovernorVotesQuorumFraction + GovernorTimelockControl
TimelockController 009 Yes (treasury custodian) USDC OZ TimelockController (no custom code)

ContentBlacklist covers the full surface: hash-level (global + regional), operator-level (addOrigin / removeOrigin / isOriginBlacklisted), and the blacklist-entry appeal API per ADR 011.

StakingRegistry includes isActive(operator) (currently missing from the spec'd interface).

SafetyReserve includes the ADR 028 appeal extensions (openSlashAppeal / fastTrackAppeal / rejectAppeal / ratifyAppeal / reverseAppeal).

B. ADR 016 — new section: Tunable Economics

Document the shipping-day configuration pattern:

  1. Bucket shares are governance-mutable. FeeRouter.setShares(operatorBaseBps, gaugeBoostBps, delegatorBps, buybackBps, treasuryBps, safetyBps) updates the six-bucket split with a sum-to-10000 invariant. Default ship config is 80/0/0/10/10/0; steady-state target per ADR 026 §2 is 40/40/7/5/5/3.
  2. Dependency addresses are governance-mutable. FeeRouter.setVotingEscrow(addr), setSafetyReserve(addr), setDelegatorBuyer(addr) may be called any time. Cross-validation: setShares(...) reverts if any non-zero share has its destination set to address(0).
  3. Inactive buckets accumulate zero with no reverts. Same-tx legs (operator / buyback / treasury / safety) execute inline. Epoch-bucket legs (gauge / delegator) accumulate to per-epoch storage; at zero share, no storage writes happen and claimBoost / claimDelegator return zero. No code path reverts when a bucket is off.
  4. Activation sequence is governance-driven. When VotingEscrow / SafetyReserve / DelegatorBuyer are deployed and audited, governance calls the relevant set*(addr) then setShares(...) to allocate.

C. ADR 016 §97 — carve-out for non-signing-contract addresses

Current text forbids proxy patterns to preserve EIP-712 domain-separator stability. Clarify that the immutability constraint applies only to fields included in voucher domain separators (i.e. PaymentChannel, SlashJudge self-addresses). Helper-contract addresses on those contracts — feeRouter on PaymentChannel, stakingRegistry on SlashJudge, contentBlacklist on OriginAssignment — may be governance-mutable without breaking signature validity. Add:

Non-signing helper contracts referenced by signing contracts may be re-pointed via governance-controlled setters (setFeeRouter, setStakingRegistry, etc.) under standard 48h timelock. The EIP-712 immutability constraint applies only to fields included in voucher / challenge domain separators; helper addresses are not domain-separator inputs.

D. ADR 016 §3 — call table

Add the rows currently missing because the destination contracts were tagged "Production only":

  • FeeRouter → VotingEscrow (balanceOfAt, totalSupplyAt)
  • FeeRouter → SafetyReserve (3% USDC same-tx)
  • FeeRouter → DelegatorBuyer (delegator-pool USDC handoff)
  • FeeRouter → BuybackBurner (5% USDC same-tx)
  • StakingRegistry → SafetyReserve (30% slashed TOKEN)
  • Governor → SafetyReserve (payout, appeal authorization)
  • OriginAssignment → StakingRegistry (isActive(operator))
  • OriginAssignment → PublisherRegistry (ownerOf(namespaceId))
  • OriginAssignment → ContentBlacklist (isOriginBlacklisted)
  • ContentBlacklist → StakingRegistry (ejectNode via addOrigin)

E. ADR 016 §2 — deployment order

Update the dependency graph to include all 14 contracts, with a note that FeeRouter deploys with zero-address dependencies for VotingEscrow / SafetyReserve / DelegatorBuyer if those aren't ready, and the launch share config of 80/0/0/10/10/0 honors the cross-validation invariant.

F. Cross-ADR cleanups

  • ADR 002: drop the framing that PoC operates on namespaceId == 0 only. PublisherRegistry exists; default-open semantics still apply pre-activation but on the same contract that production runs against.
  • ADR 011: drop the framing that OriginAssignment is production-only. The permissive bootstrap (isAuthorizedOrigin(0, op) == true for any active staker until first DAO activation) is contract behavior, not a phase.
  • ADR 022 §1.6: drop the "pre-activation DHT-only" framing. The on-chain origin-directory fallback is always available; whether it returns results depends on whether governance has activated allow-lists and whether publishers have claimed namespaces.
  • ADR 026 §2: mark the 40/40/7/5/5/3 share table as the steady-state target. Note that FeeRouter.setShares is governance-tunable from launch; default ship config is documented as 80/0/0/10/10/0.
  • ADR 026 §1 / TOKEN: drop the PoC-mintable variant. Production fixed-supply TOKEN is what gets built; testnet seeding is a one-time deploy-script mint() followed by ownership renounce (or simply a constructor _mint(deployer, supply) with no mint() function exposed at all).
  • CLAUDE.md: clarify that "PoC of tens of nodes" refers to network scale, not contract scope.

Out of scope

  • Surface gaps in the canonical interfaces (e.g. ContentBlacklist.isOriginBlacklisted not currently in the ADR 011 interface listing, StakingRegistry.isActive(operator) not in the ADR 016 §3 call table). These get audited in the next issue ("ADR surface gaps audit").
  • Parameter values for ADR 026 / 027 / 028 (gauge-boost formula constants, epoch length, claim window, appeal windows). These remain governance-tunable post-deploy.
  • Multi-token PaymentChannel per ADR 010. PoC continues with StablePaymentChannel (USDC-only); rewiring is settleChannel forwards full balance to FeeRouter.routeSettlement instead of inline fee-skimming, plus commitReceiptRoot per ADR 003 §118.
  • DelegatorBuyer vs BuybackBurner-multi-output-mode choice per ADR 016 §35 — implementation-time decision, both options preserve the FeeRouter call surface.
  • Implementation. A separate "implement deCDN contract surface for audit" issue follows once steps 1–3 of the planning sequence are done.

Acceptance

  • ADR 016 §1 inventory has no Phase column; all 14 contracts listed
  • ADR 016 §"Tunable Economics" subsection added with the share-tunability + zero-address-dependency pattern documented
  • ADR 016 §97 carve-out clarifies non-signing-contract address mutability
  • ADR 016 §3 call table covers every cross-contract call in the unified surface
  • ADR 016 §2 deployment order graph includes all 14 contracts
  • ADR 002 / 011 / 022 framings cleaned of phase distinctions
  • ADR 026 §2 marks 40/40/7/5/5/3 as steady-state target; documents launch default
  • ADR 026 §1 fixed-supply TOKEN is the only spec'd variant
  • CLAUDE.md "PoC" framing scoped to network scale

Related

  • Supersedes scope decisions in feat(contracts): scaffold PoC EVM contract set per ADR 016 #237 (which will be closed)
  • Surfaces requirement: ADR 026 / 027 / 028 surface lock-down (formula shape, state machines, signatures) — separate review pass
  • Follow-ups (in order):
    1. ADR surface-gap audit (this issue's "out of scope" §1)
    2. ADR 026 / 027 / 028 surface lock-down
    3. Implementation issue: "implement unified deCDN contract surface for audit"
  • References: ADR 016, ADR 002, ADR 011, ADR 022, ADR 026, ADR 027, ADR 028, ADR 009, ADR 018

Metadata

Metadata

Assignees

Labels

design:adrkind:docs

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions