feat(sdk-coin-stx): add pox-5 staking contract support#9319
Draft
claude[bot] wants to merge 2 commits into
Draft
feat(sdk-coin-stx): add pox-5 staking contract support#9319claude[bot] wants to merge 2 commits into
claude[bot] wants to merge 2 commits into
Conversation
Accept both pox-4 and pox-5 contract names in the STX contract call builder during the SIP-045 (Stacks Epoch 4.0) transition window, via a VALID_STAKING_CONTRACT_NAMES allowlist. Add the pox-5 staking function names stake, stake-update and unstake to the contract function allowlist, and add build/sign/deserialize round-trip test coverage for pox-5 stake calls, including the signer-manager trait argument (contract principal) and the optional (buff 500) signer-calldata. pox-5 signatures are taken from the SIP-045 reference implementation (pre-audit, near-final). Bond-related pox-5 functions are intentionally excluded. pox-4 support will be removed in a follow-up breaking release after the fork activates, mirroring the pox-3 to pox-4 migration. Ticket: CSHLD-000 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016pcJwLhB4eR5uwREh9bL9e
Extend the StakeOptions.contractName union with pox-5 so SDK consumers can request pox-5 staking during the SIP-045 (Stacks Epoch 4.0) transition window. Ticket: CSHLD-000 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016pcJwLhB4eR5uwREh9bL9e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Noel Hawat · Slack thread
Description
Before: the SDK rejects any staking contract except
pox-4— the STX contract call builder throws on any other contract name, so pox-5 transactions can neither be built nor parsed/signed.After: the SDK builds, signs, and deserializes calls to the new
pox-5contract'sstake,stake-update, andunstakefunctions (mainnetSP000000000000000000002Q6VF78.pox-5, testnetST000000000000000000002AMW42H.pox-5).pox-4remains accepted during the transition window so in-flight pox-4 transactions (including half-signed/OVC flows, which re-run the same validation on deserialize) keep working until the fork activates.How: the single hardcoded
CONTRACT_NAME_STAKING = 'pox-4'equality check inContractBuilder.contractName()is replaced by aVALID_STAKING_CONTRACT_NAMES = ['pox-4', 'pox-5']allowlist (same pattern as the existingVALID_CONTRACT_FUNCTION_NAMES), and the pox-5 staking entrypointsstake,stake-update,unstakeare added to the function-name allowlist. The existing JSON→ClarityValue conversion already expresses the new pox-5 argument shapes — the<signer-manager-trait>argument serializes as a contract principal CV ({ type: 'principal', val: 'ADDR.contract-name' }) and the(optional (buff 500))signer-calldata asoptional/buffer— so no builder changes were needed there; new tests prove a fullstakecall round-trips build → serialize → deserialize with identical args.StakeOptions.contractNamein sdk-core is widened to include'pox-5'.Notes for reviewers:
pox-wf-integrationbranch of stacks-network/stacks-core). This is pre-audit but near-final; re-verify against the shipped boot contract before the fork activates.register-for-bond,update-bond-registration,unstake-sbtc,announce-l1-early-exit) are intentionally excluded — out of scope for STX-only staking.pox-4removal should follow in a breaking release after the Epoch 4.0 fork, mirroring the pox-3→pox-4 migration lifecycle.@bitgo/sdk-coin-stx/@bitgo/sdk-coreversion bump to pick this up; wallet-platform additionally has its ownCONTRACT_NAMES = ['pox-4']allowlist that must be extended separately.Issue Number
CSHLD-000 (no dedicated ticket; junk-drawer reference per repo convention)
Type of change
How Has This Been Tested?
yarn unit-testinmodules/sdk-coin-stx: 188 passing (includes 7 new pox-5 build/sign/round-trip tests, a new parseCv contract-principal test, and updated pox-2/pox-3/pox-6 negative tests). Serialized hex fixtures were generated by building the transactions with the SDK.yarn unit-testinmodules/sdk-core: 525 passing, 1 pending.eslintandprettier --checkclean on all changed files.Checklist:
🤖 Generated with Claude Code
https://claude.ai/code/session_016pcJwLhB4eR5uwREh9bL9e
Generated by Claude Code