Skip to content

4.1: derive PoX-5 sBTC recipient from the taproot multisig set in 4.1 - #7833

Open
aaronb-stacks wants to merge 3 commits into
stacks-network:mainfrom
aaronb-stacks:feat/4.1-sbtc-addr
Open

aaronb-stacks wants to merge 3 commits into
stacks-network:mainfrom
aaronb-stacks:feat/4.1-sbtc-addr

Conversation

@aaronb-stacks

Copy link
Copy Markdown
Contributor

From Epoch 4.1, PoX-5 signer-set computation derives the per-cycle sBTC waterfall recipient from the sBTC registry's current-signer-set and current-signature-threshold (via get-current-signer-data) as an sBTC v2 Taproot script-path multisig deposit, instead of from the registry's WSTS aggregate public key (get-current-aggregate-pubkey), which stops being a public key once sBTC rotates to v2 signing (stacks-sbtc/sbtc#2138).

The epoch of the block computing the reward set selects the format, so the block-commit output switches at the first reward cycle whose prepare phase begins in Epoch 4.1. The Epoch 4.0 path is unchanged.

This PR adds:

  • the BIP-32 signer-key derivation and multi_a script, v2 deposit prefix and v2 NUMS constant to chainstate::stacks::sbtc
  • fixtures pinned to sBTC's published signer-UTXO scriptPubKeys
  • a consensus test walking the reward sets across the 4.0 -> 4.1 boundary
  • a bitcoind integration test for the block-commit switch.
  • a contrib binary for generating test fixtures from the sbtc crate directly
  • a CI job for verifying that the committed test fixtures match the output of the generator exactly.

From Epoch 4.1, PoX-5 signer-set computation derives the per-cycle sBTC
waterfall recipient from the sBTC registry's `current-signer-set` and
`current-signature-threshold` (via `get-current-signer-data`) as an sBTC v2
Taproot script-path multisig deposit, instead of from the registry's WSTS
aggregate public key (`get-current-aggregate-pubkey`), which stops being a
public key once sBTC rotates to v2 signing (stacks-sbtc/sbtc#2138).

The epoch of the block computing the reward set selects the format, so the
block-commit output switches at the first reward cycle whose prepare phase
begins in Epoch 4.1. The Epoch 4.0 path is unchanged.

Adds the BIP-32 signer-key derivation, `multi_a` script, v2 deposit prefix
and v2 NUMS constant to `chainstate::stacks::sbtc`, with fixtures pinned to
sBTC's published signer-UTXO scriptPubKeys; a consensus test walking the
reward sets across the 4.0 -> 4.1 boundary; and a bitcoind integration test
for the block-commit switch.

This includes a contrib binary for generating test fixtures from the sbtc
crate directly, as well as a CI job for verifying that the committed test
fixtures match the output of the generator exactly.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The lockfile lacks the newly required hmac 0.12 package entry, so CI and release builds using --locked will fail until the complete workspace lockfile is regenerated and committed.

No open issues 🎉

What changed in this PR

This PR updates PoX-5 reward-set computation to derive sBTC recipients from Taproot multisig signer data in Epoch 4.1, while preserving the Epoch 4.0 aggregate-key path.

Changes:

  • Adds epoch-selected v2 deposit derivation, including signer-key derivation and multisig scripts.
  • Adds reference fixtures, property tests, and consensus and bitcoind transition tests.
  • Adds a pinned upstream fixture generator and CI reproducibility checks.
File Description
stackslib/​src/​net/​api/​getpoxinfo.rs Updates registry-method comments only.
stackslib/​src/​core/​mod.rs Adds v2 internal-key and signer-limit constants.
stackslib/​src/​config/​mod.rs Documents epoch-dependent registry reads.
stackslib/​src/​chainstate/​tests/​mod.rs Extends registry stubs with signer data.
stackslib/​src/​chainstate/​tests/​consensus.rs Tests recipient selection across epoch activation.
stackslib/​src/​chainstate/​stacks/​sbtc.rs Implements and tests v2 deposit derivation.
stackslib/​src/​chainstate/​stacks/​fixtures/​sbtc-v2.json Adds upstream-derived reference fixtures.
stackslib/​src/​chainstate/​nakamoto/​signer_set.rs Selects recipient derivation by computing epoch.
stackslib/​Cargo.toml Adds HMAC for signer-key derivation.
stacks-node/​src/​tests/​signer/​v0/​mod.rs Extends integration-test registry stubs.
stacks-node/​src/​tests/​signer/​v0/​epoch_4_0_waterfall.rs Adds a bitcoind recipient-switch test.
stacks-node/​src/​tests/​nakamoto_integrations.rs Adds an Epoch 4.1 activation helper.
stacks-common/​src/​types/​tests.rs Tests deposit-format activation.
stacks-common/​src/​types/​mod.rs Defines epoch-specific deposit formats.
contrib/​tools/​sbtc-fixtures/​src/​main.rs Generates fixtures using upstream sBTC.
contrib/​tools/​sbtc-fixtures/​README.md Documents generation and reproducibility checks.
contrib/​tools/​sbtc-fixtures/​inputs.json Defines seven fixture input cases.
contrib/​tools/​sbtc-fixtures/​Cargo.toml Defines the standalone generator and dependencies.
contrib/​tools/​sbtc-fixtures/​Cargo.lock Locks generator dependencies.
changelog.d/​epoch-4-1-sbtc-taproot-multisig.changed Describes the recipient-format transition.
Cargo.lock Adds the workspace HMAC dependency reference.
.github/​workflows/​check-sbtc-fixtures.yml Checks fixture regeneration byte for byte.

Review effort: Balanced

Change the sbtc contract stub for tests which require booting through 4.1 -- this preserves the hashes in the snap consensus tests for <= 4.0 by separating out the tests that boot to 4.1

This branch has not been deployed

No deployments
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.

2 participants