Skip to content

feat: seamless rollovers between bond and stx-only staking positions#7249

Open
brice-stacks wants to merge 23 commits into
stacks-network:pox-wf-integrationfrom
brice-stacks:test/consecutive-bonds
Open

feat: seamless rollovers between bond and stx-only staking positions#7249
brice-stacks wants to merge 23 commits into
stacks-network:pox-wf-integrationfrom
brice-stacks:test/consecutive-bonds

Conversation

@brice-stacks
Copy link
Copy Markdown
Contributor

@brice-stacks brice-stacks commented May 28, 2026

A pox-5 staker can now move directly from one staking position to the
next with no gap in either signer participation or the STX lock:

  • bond N -> bond N+6 (or any later non-overlapping bond) via
    register-for-bond
  • bond N -> STX-only stake via stake
  • STX-only stake -> bond via register-for-bond

The STX lock is carried forward in place (amount may go up or down,
unlock height is rescheduled) rather than released and re-acquired.
The bond's custodied sBTC is rolled forward via a net transfer:
equal amounts move zero sBTC, larger pulls only the delta from the
staker, smaller refunds the delta back. Rolling out of a bond into
stx-only (or any path where the new position has no sBTC) refunds
the bond's full sBTC custody.

This change also replaces my previous PRs #7237 and #7238.

The interesting commits are 957b509 and e313078

brice-stacks and others added 18 commits May 21, 2026 14:23
The simnet doesn't provide a way to do much real testing with the L1
data, so we need to remove those from the unit tests and check that
behavior in integration tests.
The `construct-lockup-script` now correctly handles the `unlock-bytes`
from the user. The `check_pox_5_register_for_bond_l1_lockup_lifecycle`
test is extended to verify that the staker, and no one else, can spend
the BTC when the lock expires.
A pox-5 staker can now move directly from one staking position to the
next with no gap in either signer participation or the STX lock:

  - bond N -> bond N+6 (or any later non-overlapping bond) via
    `register-for-bond`
  - bond N -> STX-only stake via `stake`
  - STX-only stake -> bond via `register-for-bond`

The STX lock is carried forward in place (amount may go up or down,
unlock height is rescheduled) rather than released and re-acquired.
The bond's custodied sBTC is rolled forward via a *net* transfer:
equal amounts move zero sBTC, larger pulls only the delta from the
staker, smaller refunds the delta back. Rolling out of a bond into
stx-only (or any path where the new position has no sBTC) refunds
the bond's full sBTC custody.
@brice-stacks
Copy link
Copy Markdown
Contributor Author

I'll merge the latest pox-wf-integration into this, and then also move the integration test after I finish that change in #7223.

@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 26598194932

Coverage decreased (-0.2%) to 85.794%

Details

  • Coverage decreased (-0.2%) from the base build.
  • Patch coverage: 74 uncovered changes across 4 files (353 of 427 lines covered, 82.67%).
  • 4987 coverage regressions across 77 files.

Uncovered Changes

File Changed Covered %
stacks-node/src/burnchains/bitcoin_regtest_controller.rs 37 0 0.0%
stacks-node/src/burnchains/rpc/bitcoin_rpc_client/test_utils.rs 20 0 0.0%
clarity/src/vm/database/structures.rs 41 29 70.73%
pox-locking/src/pox_5.rs 329 324 98.48%

Coverage Regressions

4987 previously-covered lines in 77 files lost coverage.

Top 10 Files by Coverage Loss Lines Losing Coverage Coverage
stackslib/src/chainstate/burn/db/sortdb.rs 630 90.21%
stackslib/src/config/mod.rs 424 69.14%
stackslib/src/chainstate/stacks/boot/mod.rs 248 94.21%
clarity/src/vm/database/structures.rs 235 77.3%
stackslib/src/chainstate/stacks/miner.rs 224 83.06%
clarity/src/vm/database/clarity_db.rs 218 80.9%
stackslib/src/burnchains/burnchain.rs 209 72.01%
stackslib/src/chainstate/nakamoto/signer_set.rs 199 69.19%
stackslib/src/chainstate/stacks/db/transactions.rs 190 97.0%
stackslib/src/core/mempool.rs 181 86.44%

Coverage Stats

Coverage Status
Relevant Lines: 222683
Covered Lines: 191048
Line Coverage: 85.79%
Coverage Strength: 17649171.54 hits per line

💛 - Coveralls

@brice-stacks
Copy link
Copy Markdown
Contributor Author

This is built on top of #7223, and so includes those changes as well. The diff will shrink once that is merged.

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.

3 participants