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: stacks signer able to save multiple dkg shares and load it where appropriate #4704

Closed
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
df3a3b2
refactor: Load signer state after signer is constructed
netrome Apr 19, 2024
c5f3d0a
feat: Saving and loading the two last signer states per DKG round
netrome Apr 19, 2024
5331a3c
feat: Store signer state per group key
netrome Apr 22, 2024
8d30a25
feat: Don't process dkg results for a reward cycle if aggregate key i…
netrome Apr 22, 2024
f433116
test: Integration test to ensure signers are able to recover DKG keys
netrome Apr 24, 2024
4f7b1da
feat: Do not panic on network errors
netrome Apr 29, 2024
035815e
refactor: Pluralize some names
netrome Apr 29, 2024
f6b7a51
refactor: Helper function to access an Rng instead of hard-coding OsRng
netrome May 3, 2024
38649df
refactor: Remove get_signer_state utility function which is only used…
netrome May 3, 2024
69b3c67
feat: Try load signer state from SignerDB before StackerDB
netrome May 3, 2024
5db9210
refactor: Move storage utility functions new module
netrome May 3, 2024
46e67e9
feat: Only send DkgResult messages once an aggregate key has been app…
netrome May 3, 2024
864842b
fix: format
netrome May 3, 2024
34cf8ac
feat: Only reload saved signer state in `update_approved_aggregate_key`
netrome May 6, 2024
2284657
fix: Only send dkg results if loading the aggregate key was successful
netrome May 6, 2024
333c677
Merge branch 'develop' into 4654-stacks-signer-a-signer-must-be-able-…
netrome May 6, 2024
8d3add0
fix: Skip missed mutant in `get_signer_commitments`
netrome May 6, 2024
65680c3
fix: Add copyright header to storage.rs module
netrome May 8, 2024
248550f
feat: Top-level Error type for storage.rs module
netrome May 8, 2024
4b58dc1
feat: Return errors if encountering failures in DKG processing
netrome May 8, 2024
ff15ebf
feat: Check if signer has pending dkg results before attempting to se…
netrome May 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/bitcoin-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ jobs:
- tests::nakamoto_integrations::forked_tenure_is_ignored
- tests::signer::stackerdb_dkg
- tests::signer::stackerdb_sign_request_rejected
- tests::signer::stackerdb_recover_old_dkg_key
- tests::signer::stackerdb_block_proposal
- tests::signer::stackerdb_filter_bad_transactions
- tests::signer::stackerdb_mine_2_nakamoto_reward_cycles
Expand Down
2 changes: 2 additions & 0 deletions stacks-signer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ pub mod runloop;
pub mod signer;
/// The state module for the signer
pub mod signerdb;
/// Utilities for storing and loading signer data
pub mod storage;
10 changes: 6 additions & 4 deletions stacks-signer/src/runloop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ impl RunLoop {
}

/// Refresh signer configuration for a specific reward cycle
fn refresh_signer_config(&mut self, reward_cycle: u64) {
fn refresh_signer_config(&mut self, reward_cycle: u64) -> Result<(), ClientError> {
let reward_index = reward_cycle % 2;
if let Some(new_signer_config) = self.get_signer_config(reward_cycle) {
let signer_id = new_signer_config.signer_id;
Expand Down Expand Up @@ -256,6 +256,8 @@ impl RunLoop {
} else {
warn!("Signer is not registered for reward cycle {reward_cycle}. Waiting for confirmed registration...");
}

Ok(())
}

fn initialize_runloop(&mut self) -> Result<(), ClientError> {
Expand All @@ -266,11 +268,11 @@ impl RunLoop {
.map_err(backoff::Error::transient)
})?;
let current_reward_cycle = reward_cycle_info.reward_cycle;
self.refresh_signer_config(current_reward_cycle);
self.refresh_signer_config(current_reward_cycle)?;
// We should only attempt to initialize the next reward cycle signer if we are in the prepare phase of the next reward cycle
if reward_cycle_info.is_in_next_prepare_phase(reward_cycle_info.last_burnchain_block_height)
{
self.refresh_signer_config(current_reward_cycle.saturating_add(1));
self.refresh_signer_config(current_reward_cycle.saturating_add(1))?;
}
self.current_reward_cycle_info = Some(reward_cycle_info);
if self.stacks_signers.is_empty() {
Expand Down Expand Up @@ -322,7 +324,7 @@ impl RunLoop {
.unwrap_or(true)
{
info!("Received a new burnchain block height ({current_burn_block_height}) in the prepare phase of the next reward cycle ({next_reward_cycle}). Checking for signer registration...");
self.refresh_signer_config(next_reward_cycle);
self.refresh_signer_config(next_reward_cycle)?;
}
}
self.cleanup_stale_signers(current_reward_cycle);
Expand Down