Skip to content

Commit

Permalink
Merge pull request #4845 from stacks-network/fix/signer-slot-count
Browse files Browse the repository at this point in the history
Fix/signer slot count
  • Loading branch information
wileyj authored Jun 4, 2024
2 parents a88ee2b + 5d9f472 commit 246aac0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion libsigner/src/v1/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1448,7 +1448,8 @@ mod test {

use super::{StacksMessageCodecExtensions, *};

#[test]
// This test is disabled because the last signer slot can't be introduced until after Nakamoto
// #[test]
fn signer_slots_count_is_sane() {
let slot_identifiers_len = MessageSlotID::ALL.len();
assert!(
Expand Down
2 changes: 1 addition & 1 deletion stacks-common/src/libcommon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ pub mod consts {

/// The number of StackerDB slots each signing key needs
/// to use to participate in DKG and block validation signing.
pub const SIGNER_SLOTS_PER_USER: u32 = 14;
pub const SIGNER_SLOTS_PER_USER: u32 = 13;
}
6 changes: 5 additions & 1 deletion stacks-signer/src/client/stacks_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ mod tests {
};
use rand::thread_rng;
use rand_core::RngCore;
use stacks_common::consts::{CHAIN_ID_TESTNET, SIGNER_SLOTS_PER_USER};
use stacks_common::consts::CHAIN_ID_TESTNET;
use wsts::curve::scalar::Scalar;

use super::*;
Expand Down Expand Up @@ -1121,9 +1121,13 @@ mod tests {

let signer_slots = mock.client.parse_signer_slots(value).unwrap();
assert_eq!(signer_slots.len(), 5);

/*
* This is disabled until the number of slots is again 14
signer_slots
.into_iter()
.for_each(|(_address, slots)| assert_eq!(slots, SIGNER_SLOTS_PER_USER as u128));
*/
}

#[test]
Expand Down
4 changes: 1 addition & 3 deletions stackslib/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -906,9 +906,7 @@ simulating a miner.
.parse::<u64>()
.expect("<start_block> not a valid u64");
let arg5 = argv[5].parse::<u64>().expect("<end_block> not a valid u64");
let start = arg4.saturating_sub(1);
let blocks = arg5.saturating_sub(arg4);
format!("SELECT index_block_hash FROM staging_blocks ORDER BY height ASC LIMIT {start}, {blocks}")
format!("SELECT index_block_hash FROM staging_blocks WHERE height >= {arg4} AND height < {arg5} ORDER BY height ASC, index_block_hash ASC")
}
Some("last") => format!(
"SELECT index_block_hash FROM staging_blocks ORDER BY height DESC LIMIT {}",
Expand Down

0 comments on commit 246aac0

Please sign in to comment.