Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fall-back to current signer set + threshold from contract for stacks tx validation #1333

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

cylewitruk
Copy link
Member

@cylewitruk cylewitruk commented Feb 10, 2025

Description

Changes the tx-signer's assert_valid_stacks_tx_sign_request() method to use the current signer set public keys & threshold according to the following rule set.

⚠️ This PR builds on-top of (and includes) #1315 and targets main, so changes from both PR's are in the diff.

With only #1315, we would be unable to submit a rotate-keys contract call if any of the signers were missing the dkg shares entry for the current aggregate key. This PR adds a fallback mechanism for this case.

/// 1. First, we attempt to retrieve the information from the database.
/// 2. If the database does not contain the information, or we receive an
///    error from the database, we fall-back to the contract.
/// 3. If we couldn't get the information from the contract, but the
///    contract calls returned valid "not found" responses (i.e. `None`
///    here), then we're likely bootstrapping and fall-back to the
///    bootstrapping configuration.

Changes

  • Adds a new StacksInteract method for retrieving the current-signature-threshold from sbtc-registry.
  • Updates the current StacksInteract method for retrieving the current-signing-set from sbtc-registry to return an Option<>, and None if the Stacks node returns a 404.
  • Updates assert_valid_stacks_tx_sign_request() to use a new method get_current_signer_set_public_keys_and_threshold() for retrieving the signer set public keys and signature threshold, which uses the above rule set.

Testing Information

Checklist:

  • I have performed a self-review of my code
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@cylewitruk cylewitruk added enhancement New feature or request sbtc signer binary The sBTC Bootstrap Signer. key rotation The functionality to rotate a private key for a signer in sBTC-v1. labels Feb 10, 2025
@cylewitruk cylewitruk added this to the sBTC: Deposits milestone Feb 10, 2025
@cylewitruk cylewitruk self-assigned this Feb 10, 2025
@cylewitruk cylewitruk changed the base branch from main to feat/rotate-key-wait-for-all-signatures February 10, 2025 13:24
@cylewitruk cylewitruk changed the base branch from feat/rotate-key-wait-for-all-signatures to main February 10, 2025 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request key rotation The functionality to rotate a private key for a signer in sBTC-v1. sbtc signer binary The sBTC Bootstrap Signer.
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

2 participants