From 6e64d0df02fb39fad5f92222d3071c88d2190834 Mon Sep 17 00:00:00 2001 From: Aaron Blankstein Date: Tue, 18 Jun 2024 09:52:23 -0500 Subject: [PATCH 1/2] fix: signer slots count in staging --- stacks-common/src/libcommon.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/stacks-common/src/libcommon.rs b/stacks-common/src/libcommon.rs index fef8f0bba..b93c78c50 100644 --- a/stacks-common/src/libcommon.rs +++ b/stacks-common/src/libcommon.rs @@ -63,5 +63,20 @@ 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; +} + +/// This test asserts that the constant above doesn't change. +/// This exists because the constant above is used by Epoch 2.5 instantiation code. +/// +/// Adding more slots will require instantiating more .signers contracts through either +/// consensus changes (i.e., a new epoch) or through non-consensus-critical contract +/// deployments. +#[test] +fn signer_slots_count_2_5() { + assert_eq!( + consts::SIGNER_SLOTS_PER_USER, + 13, + "The .signers-x-y contracts in Epoch 2.5 were instantiated with 13 slots" + ); } From e4770f624171506f02189eb61d603492811f5ce8 Mon Sep 17 00:00:00 2001 From: Aaron Blankstein Date: Tue, 18 Jun 2024 11:01:46 -0500 Subject: [PATCH 2/2] test: update tests --- libsigner/src/v1/messages.rs | 2 ++ stacks-signer/src/client/stacks_client.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libsigner/src/v1/messages.rs b/libsigner/src/v1/messages.rs index a84ba98c6..a1422654a 100644 --- a/libsigner/src/v1/messages.rs +++ b/libsigner/src/v1/messages.rs @@ -1449,6 +1449,8 @@ mod test { use super::{StacksMessageCodecExtensions, *}; #[test] + #[should_panic] + // V1 signer slots do not have enough slots in Epoch 2.5. Something will need to be updated! fn signer_slots_count_is_sane() { let slot_identifiers_len = MessageSlotID::ALL.len(); assert!( diff --git a/stacks-signer/src/client/stacks_client.rs b/stacks-signer/src/client/stacks_client.rs index 6f07bb362..2bd17cf22 100644 --- a/stacks-signer/src/client/stacks_client.rs +++ b/stacks-signer/src/client/stacks_client.rs @@ -1090,7 +1090,7 @@ mod tests { let principal_data = StacksAddress::from_string(signer).unwrap().into(); let data_map = [ - ("num-slots".into(), ClarityValue::UInt(14)), + ("num-slots".into(), ClarityValue::UInt(13)), ( "signer".into(), ClarityValue::Principal(PrincipalData::Standard(principal_data)),