Repository navigation
Description
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
-
Bonded and declared, never registered. Directly reachable from the shipped CLI:
decdn node bond --mbps Nruns approve ->bond->declareMbpsand never callsregisterNode(crates/cli/src/commands/bond.rs). An operator who stops there, or whoseregisterNodenever lands, holds a standing tier with noderegisterNodeavailable. Escape: complete a fullregisterNodeceremony (ed25519 + terms signature) purely in order to immediately deregister. -
Auto-ejected on slashing (
_maybeAutoEject->_ejectNodeEffects,:1031/:1479), blacklist-ejected (ejectNode,:1121), or displaced byreclaimNodeId(:907). All three clearinfo.activeand drop the operator from the registered set without touching the tier. Escape: re-bond back overmax(minBond, bondRequired(tier))— which also clearsejected— re-register, then deregister. For ablacklistEjectedoperatorregisterNoderevertsOperatorEjected, so there is no escape until governance callsunEjectNode.
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
- Clear
declaredMbpsin_ejectNodeEffects. Makes all three deactivation paths agree. Does not help state 1, and needs the slashing-economics call above. - 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 widensdeclareMbps's surface. - Gate
declareMbpson 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. - 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.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
fix(contracts,adr): scope the exit-path claims to what deregisterNode…
fix(contracts,e2e): make deregistration a real bond exit; settle the …
fix: batch six review follow-ups (#1346, #1347, #1348, #1349, #1359, #…
thiras commentedon Jul 21, 2026
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.