Skip to content

docs(adr): align CapacityBond accessor names with shipped ABI (#765) - #769

Merged
thiras merged 3 commits into
mainfrom
docs/765-capacitybond-accessor-sweep
Jun 1, 2026
Merged

thiras merged 3 commits into
mainfrom
docs/765-capacitybond-accessor-sweep

Conversation

@thiras

@thiras thiras commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Closes #765.

Systematic sweep of every ADR-cited CapacityBond accessor/setter/event/return-type against the shipped Solidity surface (contracts/src/CapacityBond.sol + interfaces/ICapacityBond.sol), which is the source of truth for the ABI. Follows the precedent of #756 (bondOf→stakeOf). Documentation-only; no contract changes.

Verified against forge inspect CapacityBond abi — every name introduced exists in the compiled ABI; every name removed is genuinely absent.

Rename / reconciliation map

Doc term (drift) Canonical (shipped) Notes
declaredCapacityMbps(operator) declaredMbps(operator) public-mapping getter
getFirstBondedAt(addr) returns (uint256) firstBondedAt(addr) returns (uint64) name and return type
capacityAt(operator[, ts]) declaredMbps(operator) no such function; no historical/ts variant exists (6 sites in ADR 016)
register(declaredMbps) bond(...) + declareMbps(...) atomic call doesn't exist; registerNode(...) is a separate NodeId-binding call (ADR 019/024/026/key-rotation)
CapacityClaimed event Bonded + MbpsDeclared real emitted events
lastSettlementAt[operator] mapping indexed SettlementRecorded(operator) event recordSettlement only emits (no SSTORE); getActiveNodes tuple corrected to the real NodeInfo fields
setAlpha, setK, setAgeRampMonths — (removed) bond-curve / age-ramp not on-chain-tunable in this revision
setMaxCapacityPerOperator setMaxCapacityMbps shipped setter
totalVotingWeightAt(ts) — (removed) never shipped; totals are FeeRouter-derived (totalBytesInWindow)

Two stale premises in the issue (corrected here)

  • The bondOf→stakeOf framing is inverted — PR refactor(contracts): rename stake→bond on CapacityBond surface #768 (8caa4ee) renamed stake→bond after the issue was filed, so the contract exposes bondOf and the existing bondOf ADR references are already correct. No stakeOf work.
  • unbond() does exist (CapacityBond.sol:671) — the issue's claim that it's missing is wrong; left in place.

⚠️ Flagged (not changed here — possible follow-up)

The bond-curve coefficients (k, α) and age_ramp months are not on-chain-tunable in the shipped contract (the declareMbps comment states the bond-curve coupling "is not enforced at the contract layer in this revision"). This PR removes the phantom setAlpha/setK/setAgeRampMonths setters from the docs; whether to add that governance is a separate contract/ADR decision.

Verification

  • cd contracts && forge inspect CapacityBond abi — all remaining ADR names ∈ ABI ✅
  • Repo-wide straggler grep returns zero (excl. adr/_history/) ✅
  • pre-commit run --all-files clean (markdownlint + ADR reference hygiene) ✅

🤖 Generated with Claude Code

Sweep every ADR-cited CapacityBond accessor/setter/event/return-type
against the shipped contract surface (contracts/src/CapacityBond.sol +
interfaces/ICapacityBond.sol), which is the source of truth for the ABI.

Renames / reconciliations (all verified absent/present via
`forge inspect CapacityBond abi`):
- declaredCapacityMbps        -> declaredMbps  (mapping getter)
- getFirstBondedAt(...)uint256 -> firstBondedAt(...)uint64
- capacityAt(operator[, ts])   -> declaredMbps(operator)  (no such fn)
- register(declaredMbps)       -> bond(...) + declareMbps(...) ;
                                  registerNode(...) is a separate NodeId binding
- CapacityClaimed event        -> Bonded + MbpsDeclared
- lastSettlementAt mapping     -> event-sourced SettlementRecorded(operator)
                                  (recordSettlement only emits; no SSTORE);
                                  getActiveNodes tuple corrected to real NodeInfo fields
- setAlpha/setK/setAgeRampMonths -> removed (bond-curve/age-ramp not
                                  on-chain-tunable in this revision)
- setMaxCapacityPerOperator    -> setMaxCapacityMbps
- totalVotingWeightAt(ts)      -> removed (never shipped; totals are FeeRouter-derived)

Documentation-only; no contract changes. Files: adr/003, 008, 016, 019,
024, 026, 036, appendix-{observability,l2-deployment,operator-key-rotation}.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings June 1, 2026 19:31
@thiras thiras self-assigned this Jun 1, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request updates several Architecture Decision Records (ADRs) to reflect changes in the CapacityBond contract interface. Specifically, the single register(declaredMbps) function has been split into separate bond(amount) and declareMbps(mbps) steps, and the lastSettlementAt state variable has been replaced by an event-sourced SettlementRecorded event. Additionally, capacityAt has been renamed to declaredMbps, and getFirstBondedAt has been renamed to firstBondedAt returning a uint64. The review feedback suggests updating the documentation and class diagrams to correctly reflect the two-step unbonding process involving requestUnbond and unbond.

Comment thread adr/024-account-abstraction.md Resolved
Comment thread adr/016-contract-interactions.md Resolved
@thiras

thiras commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

Filed the flagged bond-curve tunability gap as #770. Scope correction discovered while filing: age_ramp is not part of the gap — it ships governable on DecdnGovernor (setAgeRampMonths/setVoteCapBps, checkpointed). Only the capacity-bond curve (k, α) is unenforced/ungovernable on-chain. #770 also tracks a small adjacent doc cleanup: ADR 016 doesn't document the Governor's self-governance setters.

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

This PR updates ADR documentation to match the shipped CapacityBond Solidity ABI (accessor/setter/event names and relevant return types), avoiding references to selectors that do not exist on-chain.

Changes:

  • Renames ADR references from drifted CapacityBond accessors/events to the canonical shipped names (e.g., declaredMbps, firstBondedAt).
  • Reconciles registration flow docs from register(declaredMbps) to the shipped bond(...) + declareMbps(...) pattern (docs-only).
  • Updates settlement-recency documentation to reflect recordSettlement as an event emit (SettlementRecorded) rather than an on-chain timestamp mapping.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
adr/appendix-operator-key-rotation.md Updates rebonding procedure to use bond(...) + declareMbps(...) instead of a nonexistent register(...).
adr/appendix-observability.md Fixes metric source accessor from declaredCapacityMbps to shipped declaredMbps.
adr/appendix-l2-deployment.md Corrects settlement overhead description to reflect SettlementRecorded event-only behavior.
adr/036-served-bytes-voting-weight.md Removes references to nonexistent totalVotingWeightAt(ts) and aligns declared-capacity wording to declaredMbps.
adr/026-tokenomics.md Updates bond lifecycle docs to the shipped bond(...) + declareMbps(...) entrypoints and emitted events.
adr/024-account-abstraction.md Updates operator bond-management bullet to new entrypoints (but needs a small correction re: unbonding flow).
adr/019-node-onboarding.md Updates onboarding step to bond(...) + declareMbps(...) (but “deposit/refund” wording needs correction).
adr/016-contract-interactions.md Sweeps contract inventory/call-graph/read-API references to shipped names and settlement event sourcing (but reentrancy table misses requestUnbond).
adr/008-reputation.md Updates cold-start bonus check to use shipped firstBondedAt.
adr/003-payments.md Updates ICapacityBond excerpt to firstBondedAt(address) returns (uint64).

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

Comment thread adr/024-account-abstraction.md Resolved
Comment thread adr/016-contract-interactions.md Resolved
Comment thread adr/019-node-onboarding.md Resolved
thiras and others added 2 commits June 1, 2026 22:38
… review)

Address review feedback (gemini-code-assist, Copilot) on the CapacityBond
surface docs:
- requestUnbond(amount) starts the 14-day window; unbond() only reclaims
  after it elapses. Fix 024 bond-management bullet and 016 class diagram
  (add requestUnbond), and clarify the 016 external-call table's unbond() row.
- 016 external-call table claimed completeness but omitted requestUnbond,
  which makes external calls (token.burn / safeTransfer via
  _forfeitUnvestedCredit). Add the row.
- 019: drop the atomic "deposit/refund" wording — the shipped surface has no
  register-style refund; tier change is declareMbps + bond / requestUnbond+unbond
  (bond reduction is subject to the unbonding window).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…rift (PR #769 review)

Address review findings (comment-analyzer, code-reviewer):
- 016: the Governor→CapacityBond row wrongly claimed age_ramp months is not
  on-chain-tunable. It is governable via DecdnGovernor.setAgeRampMonths (not
  CapacityBond). Corrected; only k/α are un-tunable in this revision (#770).
- 026: drop the residual atomic "deposit/refund" tier-change sentence that
  contradicted the 019 fix and the bond()+declareMbps bullet above it.
- 016: two bare `register` references the earlier sweep missed (fund-flow
  inflow row, deployment-atomicity note) -> bond(amount) / bond+registerNode.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@thiras

thiras commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

Ran a multi-agent review (doc-accuracy + general). Two findings were defects this PR introduced/left adjacent to its edits — fixed in ad710e9:

The reviewers also surfaced a separate pre-existing drift cluster (genesis-credit interface block: phantom accrueGenesisVest, claimVestedCredit arity, PendingCredit struct fields, bondedAmount→activeBond; plus the economics/deploy-params tables). That's outside #765's accessor scope and has semantic ripples, so it's tracked separately in #771 rather than expanded into this PR.

@thiras
thiras merged commit ad9e32b into main Jun 1, 2026
19 checks passed
@thiras
thiras deleted the docs/765-capacitybond-accessor-sweep branch June 1, 2026 19:53
yigitdot added a commit that referenced this pull request Jun 1, 2026
…on control (#446)

Reframe ADR 003 §Admission and Priority to match the protocol's actual congestion semantics: congestion control at probe time (declining to sign has_blob:true, gated by max_probe_holds), committed voucher rate as a mid-stream ordering signal (not an admission key), and registered node-bond (CapacityBond.bondOf) as probe-acceptance prioritization usable only for registered-operator node-to-node requesters. Align the ADR 016 bondOf consumer row to the probe-acceptance framing. The worked reference design stays in issue #446.

Rebuilt on current main (post #768 stake→bond rename and #769 accessor-name alignment); keeps the canonical bondOf name.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
thiras pushed a commit that referenced this pull request Jun 2, 2026
…on control (#446) (#756)

Reframe ADR 003 §Admission and Priority to match the protocol's actual congestion semantics: congestion control at probe time (declining to sign has_blob:true, gated by max_probe_holds), committed voucher rate as a mid-stream ordering signal (not an admission key), and registered node-bond (CapacityBond.bondOf) as probe-acceptance prioritization usable only for registered-operator node-to-node requesters. Align the ADR 016 bondOf consumer row to the probe-acceptance framing. The worked reference design stays in issue #446.

Rebuilt on current main (post #768 stake→bond rename and #769 accessor-name alignment); keeps the canonical bondOf name.

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
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.

Sweep ADR contract-accessor names against shipped CapacityBond ABI

2 participants