Skip to content

feat(cli): add decdn node unbond + G-NODE-06 journey (#1033) - #1353

Merged
thiras merged 3 commits into
mainfrom
feat/1033-node-unbond
Jul 21, 2026
Merged

thiras merged 3 commits into
mainfrom
feat/1033-node-unbond

Conversation

@yigitdot

@yigitdot yigitdot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1033.

Why

CapacityBond has shipped the full unbonding surface all along — requestUnbond(amount) starts the window (contracts/src/CapacityBond.sol:615), unbond() withdraws once it matures (:639), and ADR 026:155 names the pair as the only way to lower a bond. But no Rust path reached either call: crates/incentive/src/capacity_bond.rs declared bond/declareMbps/registerNode and stopped, and NodeCommand had Bond/Register but no Unbond. An operator who bonded via decdn node bond had no supported way to get TOKEN back out.

This is the CLI half #1033's triage note called out as the prerequisite — and since the e2e harness already has the time control it needs (crates/e2e/src/time.rs exists to 'advance the chain clock across dispute / compliance / timelock / unbond windows'), the e2e half lands here too.

What

One state-aware decdn node unbond covering all three phases of the window, picked from chain state rather than a flag. Same plan / --dry-run / --json / idempotent-re-run shape as decdn node bond.

Chain state Behaviour
no request in flight declareMbps down if needed, then requestUnbond
request maturing print unlock time + remaining, exit non-zero, submit nothing
request matured unbond()

Amounts: --to-mbps N (curve-derived), --all, --amount N (base units) — mutually exclusive via a clap ArgGroup.

Two contract facts that shaped the UX

Both were found by reading CapacityBond.sol, and both are surfaced to the operator rather than left to a revert:

  • A request in flight makes isActive false for the WHOLE window. It is a conjunct of the predicate, independent of the remaining bond. So this is a ~14-day outage, not a background operation. A terminal run warns and confirms; --yes bypasses for automation; headless without --yes refuses rather than assuming consent. The e2e asserts the node really does go inactive while its retained bond still covers minBond.
  • requestUnbond's floor is bondRequired(declaredMbps), not minBond. The contract permits unbonding into an inactive state. So the three flags pick deliberately different floors: --to-mbps retains max(minBond, bondRequired(N)) and keeps the operator eligible; --all goes to the contract's own floor and says so; --amount is pre-checked so BondBelowCurve never surfaces raw — it fails with the decdn node bond --mbps invocation needed instead.

Tests

  • crates/e2e/tests/g_node_06_unbond.rs (anvil-e2e) drives the production binary through the whole journey against a real CapacityBond: bond up → --to-mbps reduce → assert inactive → assert the maturing re-run exits non-zero and touches no state → assert an amount flag during a pending request errors → warp past unlockAt → withdraw → assert the TOKEN returned and the node is active again → assert a below-curve --amount is rejected before any transaction.
    • The tier constants sit at 5000→2000 Mbps deliberately: with the deployed k = 12.6, α = 1.2, minBond = 50_000 TOKEN, the curve only overtakes the floor around 1000 Mbps, so lower tiers collapse both targets to minBond and the journey would assert nothing. An in-test assertion re-derives this from chain state, so a governance retune of the curve fails loudly rather than silently hollowing out the test.
  • 9 unit tests in unbond.rs over the pure output/decision functions, including the confirmation gate (split into decide_confirmation the way terms::decide is, so the guard against an accidental window-long outage is testable without a TTY).

Verification

cargo clippy --workspace --all-targets -- -D warnings   # clean
cargo fmt --all -- --check                             # clean
cargo nextest run --no-fail-fast                       # 2525 passed, 0 failed
cargo nextest run -p decdn-e2e --features anvil-e2e -E 'binary(g_node_06_unbond)'   # 1 passed

Follow-ups filed, not bundled

Both found while reading the contract; neither belongs in a CLI PR:

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added the decdn node unbond command.
    • Supports reducing or fully releasing a bond, requesting withdrawals, and withdrawing funds after the unlock period.
    • Added --to-mbps, --all, --amount, --yes, and --json options.
    • Provides clear status output, remaining-time information, transaction hashes, and validation errors.
  • Tests

    • Added end-to-end coverage for pending, matured, successful, and invalid unbonding scenarios.

`CapacityBond` has shipped the full unbonding surface all along —
`requestUnbond(amount)` starts the window, `unbond()` withdraws once it
matures, and ADR 026 § Capacity-bond curve names the pair as the only way
to lower a bond — but no Rust path reached either call. `capacity_bond.rs`
declared `bond` / `declareMbps` / `registerNode` and stopped, and
`NodeCommand` had no `Unbond`, so an operator who bonded via `decdn node
bond` had no supported way to get TOKEN back out.

Add one state-aware `decdn node unbond` covering all three phases of the
window, picked from chain state rather than a flag: no request in flight
declares the tier down (if needed) and calls `requestUnbond`; a maturing
request reports the unlock time and exits non-zero; a matured one
withdraws. Same plan / --dry-run / --json / idempotent-re-run shape as
`decdn node bond`.

Two contract facts drive the UX, and both are surfaced rather than left to
a revert:

- A request in flight makes `isActive` false for the WHOLE window — it is
  a conjunct of the predicate, independent of the remaining bond. So this
  is a ~14-day outage, not a background operation, and a terminal run
  confirms before starting one (`--yes` for automation; headless without
  it refuses rather than assuming consent).
- `requestUnbond`'s floor is `bondRequired(declaredMbps)`, NOT `minBond`,
  so the contract permits unbonding into an inactive state. The three
  amount flags therefore pick deliberately different floors: `--to-mbps`
  retains `max(minBond, bondRequired(N))` and keeps the operator eligible,
  `--all` goes to the contract's own floor and says so, and `--amount` is
  pre-checked against the curve so `BondBelowCurve` never surfaces raw —
  it fails with the `decdn node bond --mbps` invocation needed instead.

G-NODE-06 drives the production binary through the whole journey against a
real `CapacityBond`: bond up, reduce with `--to-mbps`, assert the node is
inactive while the request matures, assert the maturing re-run touches no
state, warp past `unlockAt`, withdraw, assert the TOKEN returned and the
node is active again, and assert a below-curve `--amount` is rejected
before any transaction.

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

coderabbitai Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@yigitdot, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Free

Run ID: 44ac6541-3e6a-411c-b51b-eb56a6c64994

📥 Commits

Reviewing files that changed from the base of the PR and between eed0e49 and b2b6579.

📒 Files selected for processing (5)
  • .github/workflows/ci.yml
  • crates/cli/src/commands/unbond.rs
  • crates/common/src/cli/node.rs
  • crates/e2e/tests/g_node_06_unbond.rs
  • crates/incentive/src/capacity_bond.rs

Walkthrough

Changes

Node unbond workflow

Layer / File(s) Summary
CLI surface and dispatch
crates/common/src/cli/..., crates/cli/src/commands/...
Adds NodeCommand::Unbond, mutually exclusive amount arguments, confirmation flags, module registration, and dispatch to the command implementation.
CapacityBond read and write surface
crates/incentive/src/capacity_bond.rs, crates/e2e/src/bindings.rs, crates/e2e/src/chain.rs
Adds ABI and fixture accessors for unbonding state, bond requirements, declared capacity, activity, and unbonding transactions.
Plan, confirmation, execution, and output
crates/cli/src/commands/unbond.rs
Implements state-based request, waiting, and withdrawal phases, release validation, transaction submission, confirmation, output formatting, duration formatting, and unit tests.
Lifecycle integration coverage
crates/e2e/tests/g_node_06_unbond.rs
Tests request creation, pending-state restrictions, unlock withdrawal, node reactivation, and below-curve rejection through the CLI.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant CLI
  participant CapacityBond
  Operator->>CLI: run node unbond
  CLI->>CapacityBond: read bond and unbonding state
  CapacityBond-->>CLI: return current state
  CLI->>CapacityBond: requestUnbond or unbond
  CapacityBond-->>CLI: return transaction receipt
  CLI-->>Operator: print phase and transaction hashes
Loading

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands.

@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 introduces the decdn node unbond command, which allows operators to lower their on-chain capacity bond in a state-aware, multi-phase process (request, waiting, and withdraw). It includes CLI integration, updated contract bindings, and comprehensive end-to-end tests. The review feedback highlights a critical issue regarding the command's idempotency: if a previous run successfully declared a lower capacity but failed to request the unbond, a subsequent retry would fail because the target capacity is no longer strictly less than the declared capacity. The reviewer suggested allowing target <= declared and skipping the declaration transaction when they are equal to ensure the command converges correctly.

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.

Comment thread crates/cli/src/commands/unbond.rs Resolved
@github-actions

github-actions Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

Coverage report

Total: 81.53% (was 81.74%, ▼ 0.21%) — 51899/63656 lines

File Coverage Lines Δ
crates/cli/src/commands/node.rs 82.61% 1078/1305 ▼ 0.06%
crates/cli/src/commands/unbond.rs 69.80% 483/692 new
crates/common/src/cli/mod.rs 100.00% 3/3 ● 0.00%
crates/common/src/cli/node.rs 100.00% 5/5 ● 0.00%
crates/e2e/src/chain.rs 1.21% 11/912 ▼ 0.08%
History
Commit Total Δ vs base
eed0e49 81.43% ▼ 0.31%
8da691c 81.44% ▼ 0.30%
b2b6579 (HEAD) 81.53% ▼ 0.21%

yigitdot and others added 2 commits July 21, 2026 09:27
`--to-mbps` submits `declareMbps` and `requestUnbond` as two transactions.
A run that landed the first and lost the second — reverted, dropped
receipt, Ctrl-C — leaves the tier already reduced while the bond is still
high. The `target < declared` guard then rejected the identical re-run
with "not below the current declared tier", pointing the operator at
`decdn node bond`, which cannot release anything. That stranded exactly
the operator the command's idempotence exists for, and contradicted
`execute`'s independently-skippable step structure.

Accept `target == declared` and skip the redundant declare, mirroring
`bond`'s `needs_declare`. The rule moves into a named `tier_step` so it is
testable without a chain; the downstream `release > 0` check still catches
the genuinely-nothing-to-do case, so accepting equality costs no safety.

G-NODE-06 gains the convergence leg. The half-done state is reachable with
the shipped commands — `node bond` at a tier the operator is already
over-bonded for has zero shortfall, so it submits `declareMbps` and
nothing else, byte for byte what a partially-failed unbond leaves behind.
Verified the new leg fails against the pre-fix binary with the exact
reported error before passing with the fix.

Reported by gemini-code-assist on #1353.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
… plan math (#1033)

Follow-up to a multi-agent review of #1353. Three classes of defect, none
cosmetic.

**A landed declareMbps was reported nowhere.** `execute` built `Outcome`
locally, so when `requestUnbond` failed after `declareMbps` mined, `?`
discarded it and stdout was empty. The operator saw "failed", concluded
nothing changed, and was wrong: their declared tier was already halved
with no tx hash recorded anywhere. That is exactly the resumable state
8da691c was written to serve — the resume logic worked, but nobody was
told they were in it. The outcome is now owned by `run`, always written
before the error propagates, and the error names the landed declare and
the fact that re-running resumes.

**`--yes` suppressed the disclosure, not just the prompt.** `Bypassed`
returned before both `writeln!`s, so a scripted `--all --yes` could leave
a node permanently inactive with no warning at all. The consequences are
now printed on every path; only the prompt is gated. While there,
`confirm_or_bail` consumes `decide_confirmation` exhaustively instead of
re-deriving Prompt/NeedFlag from `interactive` — previously swapping those
two arms changed no behaviour and failed only a unit test, which made the
confirmation assertions decorative.

**Two tests certified behaviour they never executed.** The `--all` arm was
100% unexecuted (its only e2e use returns from the pending-request branch
before `resolve_release`), and `--to-mbps`'s `max(minBond, ·)` term was
inert at the journey's tiers — deleting it broke nothing, though it is the
entire documented difference between the two flags. Adds a mocked-provider
module (`Asserter`, already used in decdn-node) covering both, plus
`--amount`'s bounds. Queueing exact response counts also pins which reads
happen. Verified by negative control: deleting the minBond floor now fails
a test, and the `--all` copy-paste regression fails two.

Also: the `Waiting` arm of `execute` bails instead of returning a silent
`Ok` that would print `submitted=false` and exit 0; maturity compares in
U256 so it no longer depends on a narrowing conversion's saturation
constant; `declaredMbps` conversion is loud because it gates `tier_step`
and failed open; the capacity band is checked only when a `declareMbps`
will actually be sent; `send` carries the tx hash into the receipt-timeout
error and restores bond's per-step revert hint; `write_plan` regains the
`dry_run` key so a preview is distinguishable from a real no-op.

Comment/help corrections, all verified against the contract: `--to-mbps`
help still stated the pre-8da691c strict rule; `--all` help asserted an
unconditional drop below minBond that is false above ~1000 Mbps; a comment
justified a decision with `clippy::unreachable`, which the workspace does
not enable; the `nodeIdOf` analogy described a mapping getter that is
actually a hand-written view; "every precondition" omitted `whenNotPaused`;
plus ADR section, chrono, and from_args scope claims.

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

Copy link
Copy Markdown
Contributor Author

Multi-agent review applied — b2b6579

Ran a five-agent review (code quality, test coverage, comment accuracy, silent failures, type design) over the branch and verified each load-bearing finding against CapacityBond.sol / Cargo.toml rather than taking it on faith. Three classes of defect came out, none cosmetic.

1. A landed declareMbps was reported nowhere (critical)

execute built Outcome locally, so when requestUnbond failed after declareMbps mined, ? discarded it and stdout was empty. The operator saw "failed", concluded nothing changed, and was wrong — their declared tier was already lowered with no tx hash recorded anywhere. That is precisely the resumable state 8da691c exists to serve: the resume logic worked, but nobody was ever told they were in it.

The outcome is now owned by run, always written before the error propagates, and the error names the landed declare plus the fact that re-running resumes.

2. --yes suppressed the disclosure, not just the prompt (high)

Confirmation::Bypassed returned before both writeln!s, so a scripted --all --yes could leave a node permanently inactive with no warning at all. Consequences now print on every path; only the prompt is gated. confirm_or_bail also now consumes decide_confirmation exhaustively instead of re-deriving Prompt/NeedFlag from interactive — previously swapping those arms changed no behaviour and failed only a unit test, which made the confirmation assertions decorative.

3. Two tests certified behaviour they never executed

  • The --all arm was 100% unexecuted. Its only e2e use returns from build_plan's pending-request branch before resolve_release is reached.
  • --to-mbps's max(minBond, ·) term was inert at the journey's tiers (both above the ~1000 Mbps curve crossover). Deleting it broke nothing — yet it is the entire documented difference between --to-mbps and --all.

Closed with a mocked-provider module using Asserter — infrastructure that already exists in decdn-node and that I wrongly assumed was unavailable when first building this. Queueing exact response counts doubles as an assertion about which reads happen, which is what pins the band-check gating.

Verified by negative control, the same method used for 8da691c: deleting the minBond floor now fails a test, and the --all copy-paste regression (min_bond.max(curve_floor(declared))) fails two. Both previously passed everything.

Also fixed

Waiting arm of execute bails rather than returning a silent Ok that would print submitted=false and exit 0 · maturity compares in U256 so it no longer depends on a narrowing conversion's saturation constant · declaredMbps conversion is loud because it gates tier_step and failed open · capacity band checked only when a declareMbps will actually be sent (an ungated check refuses something the contract accepts) · send carries the tx hash into the receipt-timeout error and restores bond's per-step revert hint · write_plan regains the dry_run key (flagged independently by 4 agents).

Text and comment corrections

All verified against the source. Two were self-inflicted:

  • --to-mbps help still stated the pre-8da691c strict rule — steering the half-done operator away from the command that rescues them.
  • --all help asserted an unconditional drop below minBond, false for every tier above ~1000 Mbps and contradicting the command's own below_min_bond output.
  • A comment justified a decision with clippy::unreachable, which the workspace does not enable (Cargo.toml denies unwrap_used/expect_used/panic/indexing_slicing only).
  • The nodeIdOf analogy described a mapping auto-getter; it is a hand-written multi-return view (CapacityBond.sol:1367).
  • "Every precondition" omitted whenNotPaused; plus ADR section, chrono, and from_args scope claims.

Verification

cargo clippy --workspace --all-targets -- -D warnings   # clean
cargo fmt --all -- --check                             # clean
cargo nextest run --no-fail-fast                       # 2536 passed (was 2527)
cargo nextest run -p decdn-e2e --features anvil-e2e -E 'binary(g_node_06_unbond)'   # passed

Deferred, not bundled

Type-design suggestions I declined as not earning their weight in a single-producer command module: sealing Plan behind a private constructor, a full Outcome enum (loses grep parity with bond's declare_tx=/request_tx=/withdraw_tx= vocabulary), and newtypes separating base units from Mbps.

@github-actions

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

@github-actions

Copy link
Copy Markdown

Contracts coverage

Line coverage: 88.94% (2500/2811 lines)
▲ +0.00pp vs base (88.94% → 88.94%)
Run: 29811219779

@thiras
thiras merged commit d8739d1 into main Jul 21, 2026
22 of 23 checks passed
@thiras
thiras deleted the feat/1033-node-unbond branch July 21, 2026 14:39
thiras added a commit that referenced this pull request Jul 21, 2026
…#1350, #1355) (#1358)

Follow-ups filed off the reviews of #1340, #1341 and #1353. Closes #1342, #1343,
#1344, #1345, #1350 and #1355; #1356 was closed as a duplicate of #1347, which
stays open for the deferred swap-revert tests.

BREAKING: `ReportGate` and `ReputationWiring`'s struct literal are gone —
`ReputationWiring` is now a sum type (`Disabled` / `Enabled { sink, staked,
publish }`), so an admission set without a sink is unrepresentable rather than
warned about at runtime. That deletes the test #1344 asked for instead of adding
it. `GossipRuntimeConfig::subscribe_reputation` is also gone; the operator-facing
`[gossip] subscribe_reputation` key is unchanged, but `decdn-node` now resolves
it into the wiring variant at the one site that builds it, so there is a single
off-switch instead of two.

`AnnounceGate::Disabled` is `#[cfg(test)]`. It fails OPEN on ADR 001 rule 2 and
was guarded only by a doc comment plus a test on `announce_staked_gate`, which
would have stayed green if a future edit passed `Disabled` to `spawn` — the hole
#1170 closed. It no longer exists in production builds.

Transaction submission is unified in `decdn_incentive::tx::send`, including both
swap venues (they spend USDC and read the hash after `get_receipt()`, so a
receipt timeout named no transaction at all). `send` takes a caller-owned
`landed` slot: `Some` means "may have taken effect" — including the unreadable-
receipt case — and is cleared on a confirmed revert. `bond`, `setup`, `register`
and `appeal` use it. `channel` deliberately does not: it classifies a revert as
an expected outcome rather than an error.

That slot is what makes the re-run guidance safe. The earlier wording asserted
"no TOKEN was transferred" / "on-chain state is unchanged" and told the operator
to re-run immediately; alloy's nonce filler resolves against the pending block,
so re-running while a bond tx is in flight submits a second one and doubles the
bond.

`setup`'s live phases are one fallible section with a single reporting site, so a
failure at any phase emits the aggregated `--json` summary with whatever landed —
previously a register-phase failure printed nothing and a landed swap's hash had
no machine-readable carrier at all. `build_summary` emits one shape on both paths
with a `partial` flag.

Note for the record: commit `edb3e80`'s message asserts a symbol
(`bundle_pull::discover_candidates`) that does not exist — copied from #1350's
text without verifying, in a commit about fixing inaccurate comments. The code is
correct; the message could not be amended.

Tests: new `cli_setup_partial` e2e journey drives the production binary against
anvil (with a new `ChainFixture::pause_capacity_bond` lever, since starving the
operator of TOKEN trips the pre-flight instead of entering the live phase); the
gossip integration test's drain now varies its payload per round, because
plumtree dedups byte-identical messages for 90s and a constant payload collapsed
a 50-round budget to ~6. Every new test was mutation-verified.
thiras added a commit that referenced this pull request Jul 21, 2026
…unbond gate question (#1351, #1352, #1354) (#1360)

Closes #1351, #1352, #1354 — the three surviving follow-ups from #1033/#1353, all on one surface.

**#1351 — an operator that ever declared a tier could never fully unbond.**
`requestUnbond` enforces `activeBond >= bondRequired(declaredMbps)`; `declareMbps`
was the only writer of `declaredMbps` and cannot set it back to 0 (band floor
`MIN_CAPACITY_FLOOR_MBPS = 10`, not governance-lowerable); `deregisterNode` left
the tier standing. ADR 003 § Node Registry already asserted the intended
behaviour, so the contract contradicted its own source of truth.
`deregisterNode` now clears `declaredMbps`, emitting `MbpsDeclared(op, old, 0)`
rather than writing silently (that log is the only push signal indexers have),
skipped when no tier was ever declared. +105 bytes runtime, 1,214 of EIP-170
headroom left; no new event or selector, so the frozen interface is untouched.

The fix covers the voluntary path only. `deregisterNode` requires an active node
while `declareMbps` does not, so a tier declared without registering — the state
`decdn node bond --mbps N` leaves behind — or left standing by an ejection still
pins `bondRequired(declaredMbps)`. Measured: an operator slashed to auto-ejection
keeps 10,126 TOKEN against a 50,161 floor with not one wei withdrawable. Not a
regression (the floor was previously permanent for everyone) and deliberately not
fixed here: clearing the tier on the involuntary paths would let a just-slashed
operator immediately withdraw their whole remaining bond, which is a
slashing-economics decision for ADR 026. Recorded in ADR 026, fenced by
`test_ejectedOperator_keepsTheTierAndCannotUnbond`, tracked in #1361.

**#1352 — no slash/appeal gate on `requestUnbond`, deliberately.** #1033 listed
"unbond blocked while a slash/appeal is pending" as a negative case; that text was
wrong and the contract is right. The 14-day window outlasts SlashJudge's 5-day
evidence window by 9 days and the bond stays slashable throughout, so a gate adds
nothing an honest challenger needs while handing a griefing challenger an
indefinite freeze on an honest exit. The cited spec anchor does not exist — no
file in the workspace contains the string G-NODE-06 — so the wrong text lived only
in the closed #1033; the G-NODE-06 module docs now say the absent assertion is
deliberate.

**#1354 — four `decdn node unbond` behaviours only the real binary can reach.**
`--dry-run` and the headless confirmation refusal cost no chain time; a
below-crossover `--to-mbps 10` and a real `--all` release are appended after step
6. The `--all` leg had never run end to end (step 3 only reached its
already-in-flight error) and is where `--all`'s bare curve floor visibly diverges
from `--to-mbps`'s `max(minBond, curve)` — 199.696… TOKEN retained versus 50,000
at the same tier. Every expected amount is re-derived from chain state.

Tests: every new e2e leg and every new Solidity test is mutation-verified, not
merely green — dropping the dry-run short-circuit, bypassing the headless
refusal, removing either floor from `--all`/`--to-mbps`, removing the
`declaredMbps` clear or its zero-guard, and over-clearing `unbondingOf` each fail
the intended test. `test_deregisterNode_preservesUnbondingSlashStampAndFirstBonded`
fences the opposite direction: deleting `unbondingOf` in `deregisterNode` would
orphan escrowed TOKEN, and clearing `_slashedAtEpoch` would let an operator
launder a slash out of their ADR 036 voting weight by cycling
deregister/re-register. `.gas-snapshot` regenerated.

Also corrects pre-existing doc errors found on the way: ADR 003 and the
key-rotation appendix both said `unbond()` starts the unbonding window (it is
`requestUnbond`), the appendix referenced a `CapacityBond.withdraw()` that does
not exist, ADR 019 § Re-Onboarding miscounted its own list, and ADR 003's
`reclaimNodeId` paragraph claimed parity with `deregisterNode` that no longer
holds.

Follow-ups: #1359 (`deregisterNode` has no CLI surface), #1361 (tier stuck on the
ejection and never-registered paths).
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.

cli+e2e G-NODE-06: decdn node unbond / capacity reduction

2 participants