Skip to content

Sweep ADR contract-accessor names against shipped CapacityBond ABI #765

Closed

Description

@yigitdot

Summary

The ADRs cite several CapacityBond accessor names that don't match the shipped Solidity ABI in contracts/src/CapacityBond.sol. PR #756 fixed one instance (bondOf → stakeOf, which has no such function in the contract); a review pass on that PR surfaced more of the same drift on adjacent/unchanged lines. This issue tracks a systematic sweep so the docs match the compiled contract — an implementer/indexer copying these names out of the ADRs would target nonexistent selectors.

Source of truth is the shipped contract; it is named CapacityBond but retains stake-flavored accessor names from its StakingRegistry lineage.

Confirmed mismatches

1. declaredCapacityMbps → declaredMbps

No declaredCapacityMbps accessor exists. The contract exposes the public mapping declaredMbps (CapacityBond.sol:242, auto-getter declaredMbps(address)).

  • adr/appendix-observability.md:196 — metric decdn_capacity_bond_declared_mbps Source cell
  • adr/016-contract-interactions.md:537 — getActiveNodes(...) tuple field name

2. getFirstBondedAt(...) returns (uint256) → firstBondedAt(...) returns (uint64)

No getFirstBondedAt exists; the contract and interface implement firstBondedAt(address operator) returns (uint64) (CapacityBond.sol:1448, interfaces/ICapacityBond.sol:21). Both the name (get prefix) and the return type (uint256 vs uint64) are wrong.

  • adr/003-payments.md:681 — interface block: function getFirstBondedAt(address ethAddress) external view returns (uint256);
  • adr/016-contract-interactions.md:511 — off-chain read API row
  • adr/008-reputation.md:240 — prose: CapacityBond.getFirstBondedAt(operator)

3. CapacityBond surface enumeration (adr/016-contract-interactions.md:239)

The list reads (register, unbond, slash, capacityAt, firstBondedAt, stakeOf, slashedAtEpoch, recordSettlement, bindNodeId / reclaimNodeId, isActive). Spot checks: register → contract exposes registerNode (CapacityBond.sol:861); no function unbond or function capacityAt was found (only setUnbondingPeriod, plus recordSettlement/pendingCredit/stakeOf/firstBondedAt/isActive/slashedAtEpoch). These entries need reconciliation against the actual entrypoints.

Scope

  • Sweep every ADR-cited CapacityBond (ideally all-contract) accessor name + return type against the shipped ABI; correct the docs to match.
  • Apply the CONTRIBUTING § ADR cross-reference checklist (grep each renamed term repo-wide) so fixes stay internally consistent — same discipline used for bondOf → stakeOf in docs(adr-003): correct §Admission and Priority to probe-time congestion control (#446) #756.
  • Documentation-only; no contract changes (unless governance prefers adding aliases — a separate decision).

References

Activity

  1. added
    kind:docs
    kind:bug
    prio:critical
    on Jun 1, 2026
  2. added
    design:adr
    design:consistency
    on Jun 1, 2026
  3. github-actions commented on Jun 1, 2026

    @github-actions

    🎯 Triage report

    ADR documentation has drifted from the shipped CapacityBond Solidity ABI — three confirmed mismatch classes across 6+ file locations: wrong accessor names (declaredCapacityMbps, getFirstBondedAt, register, unbond, capacityAt) and a wrong return type (uint256 vs uint64). The precedent fix is #756 (bondOf → stakeOf); this is a systematic follow-up sweep. Scope is documentation-only; source of truth is contracts/src/CapacityBond.sol + interfaces/ICapacityBond.sol.

    📊 Assessment

    Dimension Value Reasoning
    Type Task Systematic doc sweep with enumerated fix locations; no new design decisions required
    Labels consistency, ADR added Issue already carries bug, documentation, critical, technical; added consistency (name drift across ADR set) and ADR (directly modifies ADR files)
    Coding agent Suitable All affected file locations are pinpointed with line numbers, the source of truth is unambiguous (compiled contract ABI / interface), and all changes are documentation-only text corrections

    🔗 Similar issues

    💡 Notes and suggestions

    Suggested sub-task checklist:

    • declaredCapacityMbps → declaredMbps

      • adr/appendix-observability.md:196 — update Source cell in metric table
      • adr/016-contract-interactions.md:537 — update getActiveNodes(...) tuple field name
      • Grep repo-wide for declaredCapacityMbps to catch any additional occurrences
    • getFirstBondedAt → firstBondedAt, uint256 → uint64

      • adr/003-payments.md:681 — fix interface block function signature (name + return type)
      • adr/016-contract-interactions.md:511 — fix off-chain read API row
      • adr/008-reputation.md:240 — fix prose reference
      • Grep for getFirstBondedAt and uint256 in context of firstBondedAt repo-wide
    • CapacityBond surface enumeration at adr/016-contract-interactions.md:239

      • register → registerNode
      • Remove or correct unbond (no such function; only setUnbondingPeriod)
      • Remove or correct capacityAt (no such function)
      • Verify bindNodeId / reclaimNodeId against contract ABI
      • Cross-check the full list against the ABI export: forge inspect CapacityBond abi | jq '[.[].name] | sort'

    Workflow tip: Per CONTRIBUTING §ADR cross-reference checklist, grep each renamed term repo-wide before filing the PR to catch any occurrences in appendices, architecture.md, or other ADRs not yet listed above. The bondOf → stakeOf fix in #756 is the established precedent for the PR structure.

    ABI extraction command to generate ground truth:

    cd contracts && forge build --silent && forge inspect CapacityBond abi | jq '[.[].name] | sort'

    Generated by Agentic Triage for issue #765 · sonnet46 555.2K · ◷

    Add this agentic workflows to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@94ec5db57374c5b04a4b8eef8b4413f9af44d63f
    
  4. self-assigned this
    on Jun 1, 2026
  5. yigitdot commented on Jun 1, 2026

    @yigitdot
    ContributorAuthor

    Correction — the bondOf framing in this issue is superseded by #768.

    #768 (refactor(contracts): rename stake→bond on CapacityBond surface) renamed the contract accessor stakeOf → bondOf. On current main, CapacityBond.bondOf(address) exists (contracts/src/CapacityBond.sol:1433) and is the canonical name. So the premise here ("bondOf doesn't exist") and the #756 precedent (bondOf→stakeOf) are both inverted — bondOf is correct, and the #756 rename was reverted. Please disregard the bond/stake-naming portion of this issue.

    The two independent findings still stand on current main (re-verified post-#768):

    1. declaredCapacityMbps → declaredMbps. No declaredCapacityMbps accessor; the contract exposes the public mapping declaredMbps (CapacityBond.sol:242). Refs: adr/appendix-observability.md, adr/016-contract-interactions.md (getActiveNodes tuple field).
    2. getFirstBondedAt(...) returns (uint256) → firstBondedAt(...) returns (uint64). No getFirstBondedAt; the contract/interface implement firstBondedAt(address) returns (uint64) (CapacityBond.sol:1448, interfaces/ICapacityBond.sol). Refs: adr/003-payments.md, adr/016-contract-interactions.md, adr/008-reputation.md.

    Narrowing this issue to those two (plus a general ADR-vs-ABI accessor sweep). Line numbers above predate any post-#768 shifts — re-grep before editing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

design:adrdesign:consistencykind:bugkind:docsprio:critical

Type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions