style: Migrate to stable-only rustfmt configuration
- Remove nightly-only features from .rustfmt.toml and vendor/ss58-registry/rustfmt.toml - Removed features: imports_granularity, wrap_comments, comment_width, reorder_impl_items, spaces_around_ranges, binop_separator, match_arm_blocks, trailing_semicolon, trailing_comma - Format all 898 affected files with stable rustfmt - Ensures long-term reliability without nightly toolchain dependency
This commit is contained in:
@@ -64,8 +64,8 @@ impl PastSystemClock {
|
||||
|
||||
impl Clock for PastSystemClock {
|
||||
fn tick_now(&self) -> Tick {
|
||||
self.real_system_clock.tick_now() -
|
||||
self.delta_ticks.load(std::sync::atomic::Ordering::SeqCst)
|
||||
self.real_system_clock.tick_now()
|
||||
- self.delta_ticks.load(std::sync::atomic::Ordering::SeqCst)
|
||||
}
|
||||
|
||||
fn wait(
|
||||
|
||||
@@ -210,7 +210,7 @@ impl PeerMessagesGenerator {
|
||||
// Receive all messages and sort them by Tick they have to be sent.
|
||||
loop {
|
||||
match rx.try_next() {
|
||||
Ok(Some((block_hash, messages))) =>
|
||||
Ok(Some((block_hash, messages))) => {
|
||||
for message in messages {
|
||||
let block_info = blocks
|
||||
.iter()
|
||||
@@ -223,7 +223,8 @@ impl PeerMessagesGenerator {
|
||||
);
|
||||
let to_add = all_messages.entry(tick_to_send).or_default();
|
||||
to_add.push(message);
|
||||
},
|
||||
}
|
||||
},
|
||||
Ok(None) => break,
|
||||
Err(_) => {
|
||||
std::thread::sleep(Duration::from_millis(50));
|
||||
@@ -326,8 +327,9 @@ impl PeerMessagesGenerator {
|
||||
let mut unique_assignments = HashSet::new();
|
||||
for (core_index, assignment) in assignments {
|
||||
let assigned_cores = match &assignment.cert().kind {
|
||||
approval::v2::AssignmentCertKindV2::RelayVRFModuloCompact { core_bitfield } =>
|
||||
core_bitfield.iter_ones().map(|val| CoreIndex::from(val as u32)).collect_vec(),
|
||||
approval::v2::AssignmentCertKindV2::RelayVRFModuloCompact { core_bitfield } => {
|
||||
core_bitfield.iter_ones().map(|val| CoreIndex::from(val as u32)).collect_vec()
|
||||
},
|
||||
approval::v2::AssignmentCertKindV2::RelayVRFDelay { core_index } => {
|
||||
vec![*core_index]
|
||||
},
|
||||
@@ -495,10 +497,10 @@ fn issue_approvals(
|
||||
.map(|val| val.assignment.tranche)
|
||||
.unwrap_or(message.tranche);
|
||||
|
||||
if queued_to_sign.len() >= num_coalesce ||
|
||||
(!queued_to_sign.is_empty() &&
|
||||
current_validator_index != assignment.0.validator) ||
|
||||
message.tranche - earliest_tranche >= options.coalesce_tranche_diff
|
||||
if queued_to_sign.len() >= num_coalesce
|
||||
|| (!queued_to_sign.is_empty()
|
||||
&& current_validator_index != assignment.0.validator)
|
||||
|| message.tranche - earliest_tranche >= options.coalesce_tranche_diff
|
||||
{
|
||||
approvals_to_create.push(TestSignInfo::sign_candidates(
|
||||
&mut queued_to_sign,
|
||||
@@ -642,23 +644,23 @@ fn neighbours_that_would_sent_message(
|
||||
.unwrap();
|
||||
|
||||
let originator_y = topology_originator.validator_indices_y.iter().find(|validator| {
|
||||
topology_node_under_test.required_routing_by_index(**validator, false) ==
|
||||
RequiredRouting::GridY
|
||||
topology_node_under_test.required_routing_by_index(**validator, false)
|
||||
== RequiredRouting::GridY
|
||||
});
|
||||
|
||||
assert!(originator_y != Some(&ValidatorIndex(NODE_UNDER_TEST)));
|
||||
|
||||
let originator_x = topology_originator.validator_indices_x.iter().find(|validator| {
|
||||
topology_node_under_test.required_routing_by_index(**validator, false) ==
|
||||
RequiredRouting::GridX
|
||||
topology_node_under_test.required_routing_by_index(**validator, false)
|
||||
== RequiredRouting::GridX
|
||||
});
|
||||
|
||||
assert!(originator_x != Some(&ValidatorIndex(NODE_UNDER_TEST)));
|
||||
|
||||
let is_neighbour = topology_originator
|
||||
.validator_indices_x
|
||||
.contains(&ValidatorIndex(NODE_UNDER_TEST)) ||
|
||||
topology_originator
|
||||
.contains(&ValidatorIndex(NODE_UNDER_TEST))
|
||||
|| topology_originator
|
||||
.validator_indices_y
|
||||
.contains(&ValidatorIndex(NODE_UNDER_TEST));
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ impl MockChainSelection {
|
||||
let msg = ctx.recv().await.expect("Should not fail");
|
||||
match msg {
|
||||
orchestra::FromOrchestra::Signal(_) => {},
|
||||
orchestra::FromOrchestra::Communication { msg } =>
|
||||
orchestra::FromOrchestra::Communication { msg } => {
|
||||
if let ChainSelectionMessage::Approved(hash) = msg {
|
||||
let block_info = self.state.get_info_by_hash(hash);
|
||||
let approved_number = block_info.block_number;
|
||||
@@ -55,11 +55,12 @@ impl MockChainSelection {
|
||||
.last_approved_block
|
||||
.store(approved_number, std::sync::atomic::Ordering::SeqCst);
|
||||
|
||||
let approved_in_tick = self.clock.tick_now() -
|
||||
slot_number_to_tick(SLOT_DURATION_MILLIS, block_info.slot);
|
||||
let approved_in_tick = self.clock.tick_now()
|
||||
- slot_number_to_tick(SLOT_DURATION_MILLIS, block_info.slot);
|
||||
|
||||
gum::info!(target: LOG_TARGET, ?hash, "Chain selection approved after {:} ms", approved_in_tick * TICK_DURATION_MILLIS);
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,8 +207,8 @@ struct CandidateTestData {
|
||||
impl CandidateTestData {
|
||||
/// If message in this tranche needs to be sent.
|
||||
fn should_send_tranche(&self, tranche: u32) -> bool {
|
||||
self.sent_assignment <= self.needed_approvals ||
|
||||
tranche <= self.max_tranche + self.num_no_shows
|
||||
self.sent_assignment <= self.needed_approvals
|
||||
|| tranche <= self.max_tranche + self.num_no_shows
|
||||
}
|
||||
|
||||
/// Sets max tranche
|
||||
@@ -233,8 +233,8 @@ impl CandidateTestData {
|
||||
|
||||
/// Tells if a message in this tranche should be a no-show.
|
||||
fn should_no_show(&self, tranche: u32) -> bool {
|
||||
(self.num_no_shows < self.max_no_shows && self.last_tranche_with_no_show < tranche) ||
|
||||
(tranche == 0 && self.num_no_shows == 0 && self.max_no_shows > 0)
|
||||
(self.num_no_shows < self.max_no_shows && self.last_tranche_with_no_show < tranche)
|
||||
|| (tranche == 0 && self.num_no_shows == 0 && self.max_no_shows > 0)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -547,8 +547,8 @@ impl PeerMessageProducer {
|
||||
.blocks
|
||||
.iter()
|
||||
.filter(|block_info| {
|
||||
block_info.slot <= current_slot &&
|
||||
!initialized_blocks.contains(&block_info.hash)
|
||||
block_info.slot <= current_slot
|
||||
&& !initialized_blocks.contains(&block_info.hash)
|
||||
})
|
||||
.cloned()
|
||||
.collect_vec();
|
||||
@@ -556,8 +556,8 @@ impl PeerMessageProducer {
|
||||
if !TestEnvironment::metric_lower_than(
|
||||
&self.registry,
|
||||
"pezkuwi_teyrchain_imported_candidates_total",
|
||||
(block_info.total_candidates_before + block_info.candidates.len() as u64 -
|
||||
1) as f64,
|
||||
(block_info.total_candidates_before + block_info.candidates.len() as u64
|
||||
- 1) as f64,
|
||||
) {
|
||||
initialized_blocks.insert(block_info.hash);
|
||||
self.initialize_block(&block_info).await;
|
||||
@@ -670,8 +670,8 @@ impl PeerMessageProducer {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if !block_info.approved.load(std::sync::atomic::Ordering::SeqCst) &&
|
||||
self.options.num_no_shows_per_candidate > 0
|
||||
} else if !block_info.approved.load(std::sync::atomic::Ordering::SeqCst)
|
||||
&& self.options.num_no_shows_per_candidate > 0
|
||||
{
|
||||
skipped_messages.push(bundle);
|
||||
}
|
||||
@@ -708,9 +708,9 @@ impl PeerMessageProducer {
|
||||
block_info: &BlockTestData,
|
||||
block_initialized: bool,
|
||||
) -> bool {
|
||||
bundle.tranche_to_send() <= tranche_now &&
|
||||
current_slot >= block_info.slot &&
|
||||
block_initialized
|
||||
bundle.tranche_to_send() <= tranche_now
|
||||
&& current_slot >= block_info.slot
|
||||
&& block_initialized
|
||||
}
|
||||
|
||||
// Queue message to be sent by validator `sent_by`
|
||||
@@ -1011,8 +1011,8 @@ pub async fn bench_approvals_run(
|
||||
let start_marker = Instant::now();
|
||||
let real_clock = SystemClock {};
|
||||
state.delta_tick_from_generated.store(
|
||||
real_clock.tick_now() -
|
||||
slot_number_to_tick(SLOT_DURATION_MILLIS, state.generated_state.initial_slot),
|
||||
real_clock.tick_now()
|
||||
- slot_number_to_tick(SLOT_DURATION_MILLIS, state.generated_state.initial_slot),
|
||||
std::sync::atomic::Ordering::SeqCst,
|
||||
);
|
||||
let system_clock = PastSystemClock::new(real_clock, state.delta_tick_from_generated.clone());
|
||||
@@ -1046,8 +1046,8 @@ pub async fn bench_approvals_run(
|
||||
|
||||
// Wait for all blocks to be approved before exiting.
|
||||
// This is an invariant of the benchmark, if this does not happen something went terribly wrong.
|
||||
while state.last_approved_block.load(std::sync::atomic::Ordering::SeqCst) <
|
||||
env.config().num_blocks as u32
|
||||
while state.last_approved_block.load(std::sync::atomic::Ordering::SeqCst)
|
||||
< env.config().num_blocks as u32
|
||||
{
|
||||
gum::info!(
|
||||
"Waiting for all blocks to be approved current approved {:} num_sent {:} num_unique {:}",
|
||||
|
||||
@@ -96,9 +96,9 @@ impl MessagesBundle {
|
||||
candidates_test_data: &HashMap<(Hash, CandidateIndex), CandidateTestData>,
|
||||
options: &ApprovalsOptions,
|
||||
) -> bool {
|
||||
self.needed_for_approval(candidates_test_data) ||
|
||||
(!options.stop_when_approved &&
|
||||
self.min_tranche() <= options.last_considered_tranche)
|
||||
self.needed_for_approval(candidates_test_data)
|
||||
|| (!options.stop_when_approved
|
||||
&& self.min_tranche() <= options.last_considered_tranche)
|
||||
}
|
||||
|
||||
/// Tells if the bundle is needed because we need more messages to approve the candidates.
|
||||
@@ -218,8 +218,8 @@ impl TestMessageInfo {
|
||||
assert_eq!(approvals.len(), 1);
|
||||
|
||||
for approval in approvals {
|
||||
should_no_show = should_no_show ||
|
||||
approval.candidate_indices.iter_ones().all(|candidate_index| {
|
||||
should_no_show = should_no_show
|
||||
|| approval.candidate_indices.iter_ones().all(|candidate_index| {
|
||||
let candidate_test_data = candidates_test_data
|
||||
.get_mut(&(
|
||||
approval.block_hash,
|
||||
@@ -265,7 +265,7 @@ impl TestMessageInfo {
|
||||
candidates_test_data: &HashMap<(Hash, CandidateIndex), CandidateTestData>,
|
||||
) -> bool {
|
||||
match &self.msg {
|
||||
protocol_v3::ApprovalDistributionMessage::Assignments(assignments) =>
|
||||
protocol_v3::ApprovalDistributionMessage::Assignments(assignments) => {
|
||||
assignments.iter().any(|(assignment, candidate_indices)| {
|
||||
candidate_indices.iter_ones().any(|candidate_index| {
|
||||
candidates_test_data
|
||||
@@ -273,8 +273,9 @@ impl TestMessageInfo {
|
||||
.map(|data| data.should_send_tranche(self.tranche))
|
||||
.unwrap_or_default()
|
||||
})
|
||||
}),
|
||||
protocol_v3::ApprovalDistributionMessage::Approvals(approvals) =>
|
||||
})
|
||||
},
|
||||
protocol_v3::ApprovalDistributionMessage::Approvals(approvals) => {
|
||||
approvals.iter().any(|approval| {
|
||||
approval.candidate_indices.iter_ones().any(|candidate_index| {
|
||||
candidates_test_data
|
||||
@@ -282,7 +283,8 @@ impl TestMessageInfo {
|
||||
.map(|data| data.should_send_tranche(self.tranche))
|
||||
.unwrap_or_default()
|
||||
})
|
||||
}),
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user