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: validate rotate keys contract calls with validated shares #1316

Conversation

djordon
Copy link
Collaborator

@djordon djordon commented Feb 6, 2025

Description

Closes #1313.

This PR introduces a few changes that we had spoken about earlier. Also, it turns out that #1313 was already handled the necessary logic required for #1301, this just adds a test.

Changes

  • Change the dkg_shares_status_id column to just be an enum. Also rename it to dkg_shares_status.
  • Rename the verified_at_bitcoin_block_* columns to started_at_bitcoin_block_*.
  • Removed the foreign key constraints on the dkg_shares table. This was kinda accidental, if we want it I don't mind adding it back.
  • Only allow going from unverified to verified or failed, no other status transitions are allowed. This allowed for some simplifications.
  • The SignerStateMachine::get_encrypted_dkg_shares function now takes a bitcoin block ref for when DKG started. It probably makes more sense to put this information in the SignerStateMachine but the diff was growing and it looked more complex than the route took here.

Testing Information

This PR adds a test for the new behavior of the revoke_dkg_shares and verify_dkg_shares functions. It also adds a new test for the validation condition in RotateKeysV1 struct.

Checklist:

  • I have performed a self-review of my code

@djordon djordon added sbtc signer binary The sBTC Bootstrap Signer. key rotation The functionality to rotate a private key for a signer in sBTC-v1. labels Feb 6, 2025
@djordon djordon added this to the sBTC: Deposits milestone Feb 6, 2025
@djordon djordon self-assigned this Feb 6, 2025
signer/src/error.rs Outdated Show resolved Hide resolved
signer/src/error.rs Outdated Show resolved Hide resolved
signer/src/stacks/contracts.rs Outdated Show resolved Hide resolved
signer/src/storage/in_memory.rs Show resolved Hide resolved
signer/src/storage/model.rs Outdated Show resolved Hide resolved
signer/src/storage/model.rs Outdated Show resolved Hide resolved
signer/src/transaction_signer.rs Outdated Show resolved Hide resolved
@matteojug matteojug merged commit 45c8299 into feat/mock-signing Feb 7, 2025
8 checks passed
@matteojug matteojug deleted the 1313-validate-rotate-keys-contract-calls-with-validated-shares branch February 7, 2025 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
key rotation The functionality to rotate a private key for a signer in sBTC-v1. sbtc signer binary The sBTC Bootstrap Signer.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants