Skip to content

feat(runtime)!: private entries wait unbonded until they settle, ending the reward leak from pending entries to minted shares; events name each entry's key and Compounded the share price (spec 24, v0.10.0) - #194

Merged
nol4lej merged 3 commits into
mainfrom
feat/private-staking-event-keys
Nov 19, 2026

Conversation

@nol4lej

@nol4lej nol4lej commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Summary

Spec 24, v0.10.0. Two changes to private staking:

  1. Fix: pending private entries no longer leak rewards to the shares already minted.
  2. Events name each entry's or exit's one-time key, and Compounded announces the share price.

Plus a wasmtime patch bump for three new advisories.

1. The reward leak

Until spec 23 an entry's ORB was bonded the moment it entered, but its shares were minted only after its era compounded. The pool hands out rewards by points at payout time, so a pending entry's points drew rewards its stake had not earned (it was not exposed in that era). Compounding then bonded those rewards as points of the minted shares. Value moved from entrants and the pool's public members to the private holders.

On testnet pool 1, from the indexer (m_P's payout at each compounding vs the share of its points that were pending entries):

Block m_P reward Pending / total points Leaked to holders
1751402 252 ORB 585 / 659 224 ORB (×7.9 what the holders earned)
1765803 900 ORB 3025 / 3352 812 ORB (×9.3)
1780203 696 ORB 1885 / 3112 422 ORB (×1.5)

About 1,460 ORB over three eras, most of pool 1's share price rise (25 → 643 ORB). It also drove the mass refunds: entries priced against the inflated price fell under the app's old min_shares.

Fix

  • Entry: the ORB waits in m_P's free balance, unbonded, counted in a new storage item EntryEscrow. A pending entry has no points, so it draws no rewards and bears no slash.
  • Settlement (after the entry's era compounds): priced against the minted value, which never included it; then bonded (bond_extra, or join for the pool's first private entry); then its shares are minted.
  • Compounding never bonds escrowed ORB: liquid() leaves EntryEscrow out.
  • Refund at once. A destroying pool, fewer shares than asked for, or a bond the pool refuses: the ORB never left m_P, so it is queued as an output already funded and minted in the same block. EntryRefunded.unlock_era is the era it settled in. No unbonding wait.
  • Entries from before spec 24 (bonded, points > 0) settle the old way on their points (EntryPoints, which only drains now). No migration: Entry is unchanged and EntryEscrow starts empty.
  • Weights and invariants: step_weight covers a settling entry's first join. try_state checks Escrow + EntryEscrow <= m_P's free balance.

Once settled, an entry is a holder like any other. Bonding right before a payout shares that payout, as for any nomination pool member who joins (standard pool behavior); nothing moves from waiting entries to holders anymore.

2. Events

  • Entered, Exited, EntrySettled, EntryRefunded and ExitSettled carry owner_pk, the entry's or exit's one-time key, already public in its bound spend's action. Wallets and indexers can follow an entry to its outcome without decoding calls or matching amounts. A refund's ORB is paid by ExitSettled to the entry's key.
  • Compounded carries value and supply (the share price per era). Its four reads are charged in compound_weight.

Dependencies

cargo deny flagged three new wasmtime advisories in the node's executor: RUSTSEC-2026-0566, RUSTSEC-2026-0569 and RUSTSEC-2026-0571. cargo update -p wasmtime takes wasmtime to 36.0.22 and cranelift to 0.123.22, patch releases within the same major; Cargo.lock only.

Other

The shared signed-text vectors (ed25519_text_vectors.json) are regenerated: the signed payload carries spec_version (23 → 24). The copy in ts-protocol is synced in its own PR.

No call changes: transaction_version stays 8.

Tests

  • New or updated:
    • an entry is escrowed, not bonded, until it settles;
    • a refund is paid in full in the era it settled;
    • a slash while an entry waits is not charged to it;
    • entries bonded before spec 24 settle on their points and refund through an unbonding;
    • a pending entry's points do not raise what the shares already minted earn. It failed under fast-runtime before the fix: the holder earned 14.36 ORB with an entry pending vs 3.32 without.
  • Runtime lib tests, as CI runs them: fast-runtime 386/386, runtime-benchmarks,skip-proof-verification 387/387, default 390/390.
  • clippy (runtime-benchmarks,skip-proof-verification,try-runtime, -D warnings) and rustfmt clean. cargo deny check passes.
  • End to end against a fast-runtime build of this branch with the indexer and the app (app/scripts/e2e-private-stake): 22/22. On chain it checks that a pending entry is escrowed (EntryEscrow = its value), that a refund is paid in the same block, and that the escrow is bonded once shares are minted. In the UI and the indexer it checks the refund, settlement, share price over two eras, exit and restore.

…time key and Compounded announces the share price (spec 24, v0.10.0)
…ounds, so pending entries draw no pool rewards for the shares already minted, and a refund is paid at once (spec 24)
@nol4lej nol4lej changed the title feat(runtime): private staking events name the entry's or exit's one-time key and Compounded announces the share price (spec 24, v0.10.0) feat(runtime)!: private entries wait unbonded until they settle, ending the reward leak from pending entries to minted shares; events name each entry's key and Compounded the share price (spec 24, v0.10.0) Nov 19, 2026
@nol4lej
nol4lej merged commit 8fdfc12 into main Nov 19, 2026
7 checks passed
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.

1 participant