Skip to content

CapacityBond: a declared tier can only be cleared by deregisterNode, so ejected and never-registered operators stay pinned to the curve floor #1361

Closed

Description

@thiras

What

#1351 made deregisterNode clear declaredMbps, which is what lets a registered operator reach a full bond exit. But deregisterNode reverts NodeNotActive unless the node is active, while declareMbps (contracts/src/CapacityBond.sol:662) has no active-node gate. So a tier can be declared in states from which it can never be cleared, and in each of them the operator stays pinned at bondRequired(declaredMbps).

Surfaced by a multi-agent review of #1360; the boundary is now pinned by test_ejectedOperator_keepsTheTierAndCannotUnbond and documented in ADR 026 § Capacity-bond curve, so this issue is about closing it, not discovering it.

The stuck states

  1. Bonded and declared, never registered. Directly reachable from the shipped CLI: decdn node bond --mbps N runs approve -> bond -> declareMbps and never calls registerNode (crates/cli/src/commands/bond.rs). An operator who stops there, or whose registerNode never lands, holds a standing tier with no deregisterNode available. Escape: complete a full registerNode ceremony (ed25519 + terms signature) purely in order to immediately deregister.

  2. Auto-ejected on slashing (_maybeAutoEject -> _ejectNodeEffects, :1031/:1479), blacklist-ejected (ejectNode, :1121), or displaced by reclaimNodeId (:907). All three clear info.active and drop the operator from the registered set without touching the tier. Escape: re-bond back over max(minBond, bondRequired(tier)) — which also clears ejected — re-register, then deregister. For a blacklistEjected operator registerNode reverts OperatorEjected, so there is no escape until governance calls unEjectNode.

Measured on an operator onboarded at 1000 Mbps and slashed to auto-ejection:

bond before slash: 50161.50 TOKEN   (== bondRequired(1000))
bond after slash:  10126.35 TOKEN
declaredMbps:      1000              <- survives ejection
deregisterNode()   -> reverts NodeNotActive
requestUnbond(1)   -> reverts BondBelowCurve(10126.35e18 - 1, 50161.50e18)

Because the slash already took the bond below the standing floor, not one wei of the remaining 10,126 TOKEN is withdrawable, and freeing it costs ~40,035 TOKEN of fresh capital — 4x the trapped amount.

Why this wasn't fixed in #1360

Not a mechanical fix. Clearing the tier inside _ejectNodeEffects would make all the ADR statements uniformly true, but it also lets a just-slashed operator immediately requestUnbond their entire remaining bond. Today the curve floor holds that stake in place. Whether it should is a slashing-economics question for ADR 026, not a bug fix — note the bond stays slashable throughout the 14-day window either way (_reduceBondAtTier reaches bond sitting in the unbonding queue), so the exposure argument is not obviously decisive in either direction.

Options

  1. Clear declaredMbps in _ejectNodeEffects. Makes all three deactivation paths agree. Does not help state 1, and needs the slashing-economics call above.
  2. Allow declareMbps(0) when !_nodes[msg.sender].active. Covers states 1 and 2 in one branch and keeps the band check for active nodes. Same economics question, plus it widens declareMbps's surface.
  3. Gate declareMbps on an active registration. Closes state 1 at the source rather than adding an exit, but is a breaking change to the documented onboarding order (ADR 019 Step 2.2 declares before Step 2.3 registers), so almost certainly wrong.
  4. Accept and document. Already done as of fix(contracts,e2e): make deregistration a real bond exit; settle the unbond gate question (#1351, #1352, #1354) #1360 — ADR 026 § Capacity-bond curve records it as a known gap.

Whichever is chosen must be recorded in ADR 026 in place, per the repo ADR convention.

Constraint

CapacityBond is at 23,362 / 24,576 bytes — 1,214 of EIP-170 headroom. Options 1 and 2 are each a few dozen bytes, but the --sizes gate is the known failure mode for this contract.

Activity

  1. added
    design:economics
    design:missing-decision
    design:adr
    prio:medium
    area:contracts
    on Jul 21, 2026
  2. self-assigned this
    on Jul 21, 2026
  3. thiras commented on Jul 21, 2026

    @thiras
    ContributorAuthor

    Fixed in #1362 (merged as e73fa04).

    Note the batch's review round revised the framing of this issue's premise where it was wrong — see the PR description and the ADR/NatSpec updates for the corrected account.

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

Metadata

Metadata

Assignees

Labels

area:contractsdesign:adrdesign:economicsdesign:missing-decisionprio:medium

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions