Repository navigation
docs(adr): align ADR 016 CapacityBond genesis-credit surface with shipped contract (#771) - #787
Conversation
…pped contract (#771) Fix doc/contract mismatches in ADR 016 against the shipped CapacityBond, ICapacityBond, and DecdnGovernor sources (verified via `forge inspect`): - Remove non-existent `accrueGenesisVest(operator)`; vesting is on-demand via `curveVested(operator)` / `claimableCredit(operator)`. - Correct `claimVestedCredit` to its shipped no-arg form (acts on msg.sender, `nonReentrant whenNotPaused`). - Fix `PendingCredit` struct to `{ uint128 originalGrant; uint128 claimed; uint64 grantedAt; }` (no stored `vested`); update the grant guard and slashing-applies-to pool to `originalGrant - claimed`. - Replace `bondedAmount` with the shipped `activeBond` storage / `bondOf` read. - Correct the CapacityBond constructor-params row: k/alpha and the capacity band are storage defaults set in-constructor and tunable post-deploy, not constructor args; age_ramp_months lives on DecdnGovernor. - Align capacity-band parameter names to `minCapacityMbps`/`maxCapacityMbps`. Items 6-7 (Tunable-Economics k/alpha tunability, Governor self-governance setters) were already correct in the shipped ADR; the issue's premise that k/alpha are not on-chain-tunable is contradicted by the contract (`setK`/`setAlpha`), so those tables are left as-is to match the contract. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request updates the contract interactions ADR to reflect architectural changes in the CapacityBond contract, transitioning from state-mutating genesis credit vesting to on-demand view-based calculations (curveVested and claimableCredit) and updating the PendingCredit struct. It also documents new constructor and governance-tunable parameters. The review feedback recommends explicitly defining the safety bounds for minCapacityMbps in the parameter table as 10 Mbps to 1000 Mbps to ensure consistency with the implementation and other ADRs.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
This PR updates ADR 016’s documented CapacityBond “genesis credit” surface to match the currently shipped Solidity contracts, removing stale function/field names and correcting struct/signature details so the ADR reflects the real ABI.
Changes:
- Replaced nonexistent/incorrect genesis-credit functions (
accrueGenesisVest,claimVestedCredit(address)) with shippedcurveVested,claimableCredit, andclaimVestedCredit()(no args). - Corrected
PendingCreditstruct fields and updated the slashing-at-risk pool description to useoriginalGrant - claimed. - Updated deployment/economics/reentrancy tables to use shipped names (
bondOf/activeBond,minCapacityMbps/maxCapacityMbps) and constructor parameter list.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fill in minCapacityMbps Min/Max safety bounds (10 Mbps / 1 Gbps) in the governable-parameters table, matching the shipped CapacityBond _enforceMinCapacityBounds(MIN_CAPACITY_FLOOR_MBPS=10, MIN_CAPACITY_CEILING_MBPS=1000) and ADR 026. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
alpergundogdu
left a comment
There was a problem hiding this comment.
Review — ADR 016 CapacityBond genesis-credit alignment
Docs-only, and I independently verified every claim against the shipped contract (contracts/src/CapacityBond.sol) — they all check out:
accrueGenesisVestdoes not exist;curveVested(address) external view(line 786) andclaimableCredit(address) public view(line 793) do. ✓claimVestedCredit() external nonReentrant whenNotPaused— nooperatorarg, acts onmsg.sender(line 837). ✓struct PendingCredit { uint128 originalGrant; uint128 claimed; uint64 grantedAt; }(lines 333–337) — no storedvested. ✓bondOf(address)exists (line 1473);bondedAmountdoes not (storage isactiveBond). ✓setK/setAlpha/setMinCapacityMbps/setMaxCapacityMbpsall exist underGOVERNANCE_ROLE(lines 1330–1378), confirming the curve coefficients and capacity band are storage-with-defaults + post-deploy tunable, not constructor args. ✓grantGenesisCredit(operator, amount)and the one-grant guard align with the correctedoriginalGrant == 0text. ✓
The "source of truth = shipped contract" discipline is exactly right, and declining issue #771's items 6–7 (because the contract contradicts the "not tunable" premise — setK/setAlpha exist) rather than introducing new errors into the ADR is the correct call. Scoping out the items 6–7 tables to avoid colliding with #770 is also sensible.
No code/CI surface touched, claims accurate. LGTM.
Generated by Claude Code
Closes #771
Documentation-only alignment of
adr/016-contract-interactions.mdagainst the shipped contract (source of truth):contracts/src/CapacityBond.sol,contracts/src/interfaces/ICapacityBond.sol,contracts/src/DecdnGovernor.sol. Every name/signature was verified viaforge inspect CapacityBond abi(andforge inspect DecdnGovernor abi) plus direct source reads. No contract or Rust code changed.Changes
accrueGenesisVest(operator)removed — no such function exists. Vesting is computed on demand; shipped reads arecurveVested(operator)/claimableCredit(operator)(internal_curveVested). Fixed in theICapacityBondblock, class diagram, comments, and reentrancy table.claimVestedCreditarity — shipped isclaimVestedCredit() external(nooperatorarg; acts onmsg.sender;nonReentrant whenNotPaused). Fixed in interface block, class diagram, reentrancy table.PendingCreditstruct — corrected to{ uint128 originalGrant; uint128 claimed; uint64 grantedAt; }(no storedvested). Fixed the grant guard (originalGrant == 0) and the slashing-applies-to pool (originalGrant - claimed).bondedAmount→activeBond/bondOf—bondedAmountis not a shipped field; storage mapping isactiveBond, surfaced viabondOf(operator).setK/setAlpha/setMinCapacityMbps/setMaxCapacityMbps), NOT constructor args;age_ramp_monthslives onDecdnGovernor. Listed the actual constructor params.minCapacityMbps/maxCapacityMbps.Review
Source of truth = the shipped contract. Re-verified the final diff against the live ABI:
pendingCredit(address)returns tuple(uint128 originalGrant, uint128 claimed, uint64 grantedAt)✓claimVestedCredit()no-arg, nonpayable ✓;curveVested/claimableCredit/bondOfareview -> uint256✓setK/setAlpha/setMinCapacityMbps/setMaxCapacityMbpsexist on CapacityBond ✓Finding declined (1): The issue's items 6 (Tunable-Economics) and 7 (Governor self-governance setters) asked to mark
k/αas not on-chain-tunable and to addsetVoteCapBps/setAgeRampMonths. The shipped contract contradicts the "not tunable" premise —setK/setAlphaexist onCapacityBond(kConstant/alphaWadstorage), and the ADR already documentssetVoteCapBps/setAgeRampMonthscorrectly onDecdnGovernor(checkpointed, with events). Per the source-of-truth rule, those tables were left matching the contract rather than introducing new errors.Coordination with #770
Items 6–7 overlap open issue #770's tables (Tunable-Economics, Cross-Contract Call Graph / GOVERNANCE_ROLE). Those tables were already contract-accurate, so this PR makes no edits there — keeping the change scoped to the genesis-credit / constructor / struct surface to avoid collisions with #770.
🤖 Generated with Claude Code