Skip to content

Commit 1b1a57a

Browse files
committed
Fix build errors due to bad merge mixed with accidental stash
Signed-off-by: Jacinta Ferrant <[email protected]>
1 parent 30505d5 commit 1b1a57a

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

libsigner/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ tiny_http = "0.12"
3232
mutants = "0.0.3"
3333
rand_core = { workspace = true }
3434
rand = { workspace = true }
35+
stacks-common = { path = "../stacks-common", features = ["testing"] }
36+
3537

3638
[dependencies.serde_json]
3739
version = "1.0"

libsigner/src/v0/signer_state.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ impl PartialEq for SignerStateMachine {
262262
self.burn_block == other.burn_block
263263
&& self.burn_block_height == other.burn_block_height
264264
&& self.current_miner == other.current_miner
265+
&& self.active_signer_protocol_version == other.active_signer_protocol_version
265266
&& self.tx_replay_set == other.tx_replay_set
266267
}
267268
}
@@ -281,12 +282,12 @@ impl Hash for SignerStateMachine {
281282

282283
#[derive(Debug)]
283284
/// A wrapped SignerStateMachine that implements a very specific hash that enables properly ignoring the
284-
/// tx_replay_set when evaluating the global signer state machine
285+
/// tx_replay_set and update_time when evaluating the global signer state machine
285286
pub struct SignerStateMachineKey(SignerStateMachine);
286287

287288
impl PartialEq for SignerStateMachineKey {
288289
fn eq(&self, other: &Self) -> bool {
289-
// NOTE: tx_replay_set is intentionally ignored
290+
// NOTE: tx_replay_set and update_time are intentionally ignored
290291
self.0.burn_block == other.0.burn_block
291292
&& self.0.burn_block_height == other.0.burn_block_height
292293
&& self.0.current_miner == other.0.current_miner
@@ -303,7 +304,6 @@ impl Hash for SignerStateMachineKey {
303304
self.0.burn_block_height.hash(state);
304305
self.0.current_miner.hash(state);
305306
self.0.active_signer_protocol_version.hash(state);
306-
self.0.update_time.hash(state); // This doesn't actually do anything. But include for completeness sake.
307307
}
308308
}
309309

stackslib/src/chainstate/burn/mod.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl SortitionHash {
140140

141141
/// Choose two indices (without replacement) from the range [0, max).
142142
pub fn choose_two(&self, max: u32) -> Vec<u32> {
143-
let mut rng = ChaCha20Rng::from_seed(self.0.clone());
143+
let mut rng = ChaCha20Rng::from_seed(self.0);
144144
if max < 2 {
145145
return (0..max).collect();
146146
}
@@ -158,9 +158,17 @@ impl SortitionHash {
158158

159159
/// Convert a SortitionHash into a (little-endian) uint256
160160
pub fn to_uint256(&self) -> Uint256 {
161-
let (u64_chunks, []) = self.0.as_chunks::<8>() else {
162-
panic!("SortitionHash was not evenly divisible by 8")
163-
};
161+
let chunks = self.0.chunks_exact(8);
162+
let remainder = chunks.remainder();
163+
164+
let u64_chunks: Vec<[u8; 8]> = chunks
165+
.map(|chunk| chunk.try_into().expect("chunk size should be 8"))
166+
.collect();
167+
168+
assert!(
169+
remainder.is_empty(),
170+
"SortitionHash was not evenly divisible by 8"
171+
);
164172

165173
let tmp: Vec<u64> = u64_chunks
166174
.iter()

0 commit comments

Comments
 (0)