Skip to content

Commit 0bedcea

Browse files
committed
Merge remote-tracking branch 'origin/develop' into test/4976-signer-set-handoff
2 parents 54ec4f5 + 8adec6d commit 0bedcea

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"recommendations": [
33
"rust-lang.rust-analyzer",
44
"vadimcn.vscode-lldb",
5-
"serayuzgur.crates",
5+
"fill-labs.dependi",
66
"editorconfig.editorconfig",
77
]
88
}

testnet/stacks-node/src/tests/signer/v0.rs

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,36 +2059,38 @@ fn empty_sortition() {
20592059
.collect();
20602060
assert_eq!(signer_slot_ids.len(), num_signers);
20612061

2062-
// The miner's proposed block should get rejected by the signers
2063-
let start_polling = Instant::now();
2064-
let mut found_rejection = false;
2065-
while !found_rejection {
2066-
std::thread::sleep(Duration::from_secs(1));
2067-
let messages: Vec<SignerMessage> = StackerDB::get_messages(
2068-
stackerdb
2069-
.get_session_mut(&MessageSlotID::BlockResponse)
2070-
.expect("Failed to get BlockResponse stackerdb session"),
2071-
&signer_slot_ids,
2072-
)
2073-
.expect("Failed to get message from stackerdb");
2074-
for message in messages {
2062+
// The miner's proposed block should get rejected by all the signers
2063+
let mut found_rejections = Vec::new();
2064+
wait_for(short_timeout.as_secs(), || {
2065+
for slot_id in signer_slot_ids.iter() {
2066+
if found_rejections.contains(slot_id) {
2067+
continue;
2068+
}
2069+
let mut latest_msgs = StackerDB::get_messages(
2070+
stackerdb
2071+
.get_session_mut(&MessageSlotID::BlockResponse)
2072+
.expect("Failed to get BlockResponse stackerdb session"),
2073+
&[*slot_id]
2074+
).expect("Failed to get message from stackerdb");
2075+
assert!(latest_msgs.len() <= 1);
2076+
let Some(latest_msg) = latest_msgs.pop() else {
2077+
info!("No message yet from slot #{slot_id}, will wait to try again");
2078+
continue;
2079+
};
20752080
if let SignerMessage::BlockResponse(BlockResponse::Rejected(BlockRejection {
20762081
reason_code,
20772082
..
2078-
})) = message
2083+
})) = latest_msg
20792084
{
20802085
assert!(matches!(reason_code, RejectCode::SortitionViewMismatch));
2081-
found_rejection = true;
2086+
found_rejections.push(*slot_id);
20822087
} else {
2083-
error!("Unexpected message type: {:?}", message);
2084-
panic!("Unexpected message type");
2088+
info!("Latest message from slot #{slot_id} isn't a block rejection, will wait to see if the signer updates to a rejection");
20852089
}
20862090
}
2087-
assert!(
2088-
start_polling.elapsed() <= short_timeout,
2089-
"Timed out after waiting for response from signer"
2090-
);
2091-
}
2091+
// wait until we've found rejections for all the signers
2092+
Ok(found_rejections.len() == signer_slot_ids.len())
2093+
}).unwrap();
20922094
signer_test.shutdown();
20932095
}
20942096

0 commit comments

Comments
 (0)