Skip to content

fix(payout): cap fee-drift surplus at the ratified treasury allocation, overflow into the node pool (#601) - #728

Merged
defenwycke merged 1 commit into
mainfrom
fix/601-drift-cap-rebased
Aug 21, 2026
Merged

fix(payout): cap fee-drift surplus at the ratified treasury allocation, overflow into the node pool (#601)#728
defenwycke merged 1 commit into
mainfrom
fix/601-drift-cap-rebased

Conversation

@defenwycke

Copy link
Copy Markdown
Contributor

Closes #601. This is step 1 of the #608 release sequence — "land fix/601-drift-cap-and-sink (1 commit, unmerged since 12 Aug, touches a live money path: main has no drift cap)".

The commit is bda4c0013, authored 2026-08-12, cherry-picked onto c78dda2e2 cleanly with no conflicts. Its original PR (#655) was closed rather than merged, so the fix never landed: bda4c0013 is not an ancestor of main and no equivalent change exists there. Verified by ancestry, not by grepping subject lines — a subject-line search is what made it look merged in the first place.

What it does

Post-gate surplus drift no longer lands on the treasury uncapped. The treasury's take is capped at its own ratified allocation, so drift can at most double what the decay schedule granted it. Overflow above the cap — including the entire surplus once the decay schedule has driven the ratified treasury to zero — is shared into the node pool pro rata to the ratified node amounts, remainder to the top entry, ties broken by address. Overflow with no node pool to absorb it fails closed to the fallback coinbase.

The cap is a pure function of the ratified checkpoint, so the builder and the settlement reconstruction stay byte-identical on every node, and the outputs balance exactly to subsidy + available fees.

Context for why this matters in practice: ratified tx_fees is 0 at a tip change, so roughly 1.5% of the coinbase currently drifts to the treasury. That is not a double-count, but it is unbounded, and main has no cap on it today.

Verification

cargo check -p ghost-pool --features zk-production passes against current main — the change still compiles after three weeks of drift in the surrounding tree.

Full ghost-pool lib suite: 481 passed, 0 failed, 0 filtered out. The five tests this commit adds were confirmed present and ok by name, not inferred from a total:

a_surplus_above_the_cap_overflows_into_the_node_pool              ... ok
at_the_cap_boundary_the_sum_still_balances_exactly                ... ok
a_decayed_zero_treasury_sends_the_whole_surplus_to_the_node_pool  ... ok
overflow_is_shared_pro_rata_with_the_remainder_on_the_top_entry   ... ok
a_capped_surplus_with_no_node_pool_fails_closed                   ... ok

⚠ Worth stating why that check is spelled out: a first pass ran cargo test … drift, which matched none of these five names and reported 0 passed; 0 failed with exit code 0. A filtered-to-nothing run is indistinguishable from a green one unless you read filtered out.

Note for the reviewer

This touches the coinbase builder, so it wants a deploy of its own rather than riding another change — the same reasoning that kept the Stage 6 deletion off the cutover binary.

…n, overflow into the node pool (#601)

Post-gate surplus drift no longer lands on the treasury uncapped. The
treasury's take is capped at its own ratified allocation — drift can at
most double what the decay schedule granted it — and the overflow above
the cap, including the whole surplus once the decay schedule has driven
the ratified treasury to zero, is shared into the node pool pro rata to
the ratified node amounts (remainder to the top entry, ties broken by
address). Overflow with no node pool to absorb it fails closed to the
fallback coinbase. The cap is a pure function of the ratified checkpoint,
so builder and settlement reconstruction stay byte-identical on every
node and the outputs balance exactly to subsidy + available fees.
@defenwycke
defenwycke merged commit 5499892 into main Aug 21, 2026
12 checks passed
defenwycke added a commit that referenced this pull request Aug 21, 2026
Workspace version bump. The tag carries thirteen commits since `v1.11.23`, of
which two touch the money path and are already running on the fleet:

- **#724** computes the payout checkpoint from the shard rather than the legacy
  ledger, which is what ended the payout standoff — v56 had disabled the ledger
  sweep the checkpoint still depended on, so nothing had finalised since 18
  August. Gated at 963,388; payouts resumed at the gate and are finalising now.
- **#728** caps the fee-drift surplus at the ratified treasury allocation and
  overflows the remainder into the node pool (#601).

The rest is convergence, performance and audit work: the mesh node-list
checkpoint now converges (#715), the checkpoint diagnostic stops re-scanning the
unpaid ledger (#718), the share-batch chain is deleted (#703), and #605's last
open item lands dark (#729).

`fuzz/` is a separate cargo workspace with its own lockfile pinning every
in-tree crate by version, so it is bumped in the same commit — otherwise the
fuzz build goes red on a version mismatch.
@defenwycke
defenwycke deleted the fix/601-drift-cap-rebased branch August 22, 2026 06:52
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.

The chain does not pay what the fleet ratified — settle from the mined coinbase (audit H-3)

1 participant