Repository navigation
Closed
Labels
kind:featureNew capability or a change to current behavior
Description
Context
ADR 019 §Terms Acceptance and §Governance-canonical terms version (adr/019-node-onboarding.md:241-247) specify that node registration records the operator's acceptance of the current operator terms, carried in the EIP-712 registration signature, with a governance-canonical currentTermsHash on CapacityBond. The legal text (TERMS.md, #1044) and the ADR design (#1023) are merged, but the ADR explicitly calls the shown signatures "the pre-extension surface" — the contract change was never implemented.
Confirmed gaps in contracts/src/CapacityBond.sol:
BIND_NODE_TYPEHASH = keccak256("BindNodeId(bytes32 nodeId,uint64 nonce)")(:183) — notermsHash.registerNode(...)(:691) takes notermsHash; no acceptance recorded.- No
currentTermsHashstate, nosetCurrentTermsHashgovernor setter, noTermsAcceptedevent, no mismatch revert. - Zero
termsreferences anywhere incontracts/src.
Scope (this issue — contract only)
CapacityBond.sol
- Add
bytes32 public currentTermsHash, initialized in the constructor (genesis launches with a real version — no permissive zero-default bootstrap). - Add
REGISTER_NODE_TYPEHASH = keccak256("RegisterNode(bytes32 nodeId,uint64 nonce,bytes32 termsHash)"). Registration gets its own typehash;bindNodeId(rebind/key-rotation) keepsBIND_NODE_TYPEHASHunchanged, honoring ADR 019 §245 "enforcement at registration only" (rotating keys never re-accepts terms). registerNodegains abytes32 termsHashparam: verify the binding signature overREGISTER_NODE_TYPEHASH; revertTermsHashMismatch(provided, expected)iftermsHash != currentTermsHash; emitTermsAccepted(nodeId, termsHash, timestamp).setCurrentTermsHash(bytes32 newHash)underGOVERNANCE_ROLE(governor-swappable, matching the other tunable-param setters). No[floor, ceiling]rail — a hash has no monotonic direction (ADR 019 §243). EmitCurrentTermsHashUpdated(old, new).
Wiring — touches deploy + all construction sites + interface freeze
- Constructor arity change: update
script/BaseProtocolDeploy.s.sol,script/DeployProtocol.s.sol(passkeccak256(TERMS.md)at genesis), and every test construction site. registerNodeselector + constructor change ⇒ updatetest/InterfaceFreeze.t.solfrozen set.
Test plan
- register with
termsHash == currentTermsHashsucceeds, emitsTermsAccepted. - register with stale/wrong
termsHashrevertsTermsHashMismatch. - signature must cover
termsHash(a sig over a different hash revertsInvalidBindingSignature). setCurrentTermsHash: role-gated, emits event; a bump binds new registrants; already-registered nodes unaffected.bindNodeId(rebind) still works with the unchangedBindNodeIdpayload — no terms required (regression).- shared
bindingNoncereplay protection holds acrossregisterNode/bindNodeId.
ADR reconciliation
- ADR 003 §NodeId Binding: document the
RegisterNodetyped struct (termsHashfield) as distinct fromBindNodeId; drop the "pre-extension surface" caveat in ADR 019 §109. - ADR 019 §241-247: mark the contract surface as shipped.
Refs
- ADR 019 §Terms Acceptance (
adr/019-node-onboarding.md:241-247), ADR 003 §NodeId Binding (adr/003-payments.md:818,831) contracts/src/CapacityBond.sol:183,691,751- Docs/legal predecessors: docs: add draft operator terms (TERMS.md) (#825) #1044 (TERMS.md), docs(adr): record operator safety obligations at onboarding (#825) #1023 (ADR). CLI follow-up: filed separately.
CI reminders (Solidity)
FOUNDRY_PROFILE=ci forge build --sizes --deny warnings— watchCapacityBond--sizes(added storage/branch nudges bytecode toward EIP-170).emit TermsAcceptedbefore any revert path stays clear of W5740/mutability traps.- aderyn (fail-on high) / slither (fail-on medium) both run in CI.
Reacted by github-actions
Metadata
Metadata
Assignees
Labels
kind:featureNew capability or a change to current behavior
Type
Fields
Priority
None yet
Activity
feat(contracts): terms-hash acceptance at registration + governor-swa…