mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 08:51:09 +00:00
Remove extra commas made redundent after rustfmt (#9404)
* Remove extra commas made redundent after rustfmt
This commit is contained in:
@@ -421,7 +421,7 @@ where
|
||||
|
||||
if log_enabled!(log::Level::Debug) {
|
||||
let hashes: Vec<_> = v.iter().map(|(hash, _value)| hash.clone()).collect();
|
||||
debug!(target: LOG_TARGET, "Value for hash '{:?}' found on Dht.", hashes,);
|
||||
debug!(target: LOG_TARGET, "Value for hash '{:?}' found on Dht.", hashes);
|
||||
}
|
||||
|
||||
if let Err(e) = self.handle_dht_value_found_event(v) {
|
||||
@@ -429,7 +429,7 @@ where
|
||||
metrics.handle_value_found_event_failure.inc();
|
||||
}
|
||||
|
||||
debug!(target: LOG_TARGET, "Failed to handle Dht value found event: {:?}", e,);
|
||||
debug!(target: LOG_TARGET, "Failed to handle Dht value found event: {:?}", e);
|
||||
}
|
||||
},
|
||||
DhtEvent::ValueNotFound(hash) => {
|
||||
@@ -456,7 +456,7 @@ where
|
||||
metrics.dht_event_received.with_label_values(&["value_put"]).inc();
|
||||
}
|
||||
|
||||
debug!(target: LOG_TARGET, "Successfully put hash '{:?}' on Dht.", hash,)
|
||||
debug!(target: LOG_TARGET, "Successfully put hash '{:?}' on Dht.", hash)
|
||||
},
|
||||
DhtEvent::ValuePutFailed(hash) => {
|
||||
if let Some(metrics) = &self.metrics {
|
||||
|
||||
@@ -49,7 +49,7 @@ impl FromStr for GenericNumber {
|
||||
|
||||
fn from_str(block_number: &str) -> Result<Self, Self::Err> {
|
||||
if let Some(pos) = block_number.chars().position(|d| !d.is_digit(10)) {
|
||||
Err(format!("Expected block number, found illegal digit at position: {}", pos,))
|
||||
Err(format!("Expected block number, found illegal digit at position: {}", pos))
|
||||
} else {
|
||||
Ok(Self(block_number.to_owned()))
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ impl<C: SubstrateCli> Runner<C> {
|
||||
pub fn print_node_infos<C: SubstrateCli>(config: &Configuration) {
|
||||
info!("{}", C::impl_name());
|
||||
info!("✌️ version {}", C::impl_version());
|
||||
info!("❤️ by {}, {}-{}", C::author(), C::copyright_start_year(), Local::today().year(),);
|
||||
info!("❤️ by {}, {}-{}", C::author(), C::copyright_start_year(), Local::today().year());
|
||||
info!("📋 Chain specification: {}", config.chain_spec.name());
|
||||
info!("🏷 Node name: {}", config.network.node_name);
|
||||
info!("👤 Role: {}", config.display_role());
|
||||
|
||||
@@ -170,7 +170,7 @@ mod test {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(load_decode::<_, u32>(&client, BABE_EPOCH_CHANGES_VERSION).unwrap(), None,);
|
||||
assert_eq!(load_decode::<_, u32>(&client, BABE_EPOCH_CHANGES_VERSION).unwrap(), None);
|
||||
|
||||
let epoch_changes = load_epoch_changes::<TestBlock, _>(
|
||||
&client,
|
||||
@@ -202,6 +202,6 @@ mod test {
|
||||
client.insert_aux(values, &[]).unwrap();
|
||||
});
|
||||
|
||||
assert_eq!(load_decode::<_, u32>(&client, BABE_EPOCH_CHANGES_VERSION).unwrap(), Some(2),);
|
||||
assert_eq!(load_decode::<_, u32>(&client, BABE_EPOCH_CHANGES_VERSION).unwrap(), Some(2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -780,10 +780,10 @@ fn importing_epoch_change_block_prunes_tree() {
|
||||
let fork_3 = propose_and_import_blocks(BlockId::Hash(canon_hashes[18]), 10);
|
||||
|
||||
// We should be tracking a total of 9 epochs in the fork tree
|
||||
assert_eq!(epoch_changes.shared_data().tree().iter().count(), 9,);
|
||||
assert_eq!(epoch_changes.shared_data().tree().iter().count(), 9);
|
||||
|
||||
// And only one root
|
||||
assert_eq!(epoch_changes.shared_data().tree().roots().count(), 1,);
|
||||
assert_eq!(epoch_changes.shared_data().tree().roots().count(), 1);
|
||||
|
||||
// We finalize block #13 from the canon chain, so on the next epoch
|
||||
// change the tree should be pruned, to not contain F (#7).
|
||||
|
||||
@@ -169,21 +169,21 @@ mod test {
|
||||
let header6 = create_header(3); // @ slot 4
|
||||
|
||||
// It's ok to sign same headers.
|
||||
assert!(check_equivocation(&client, 2.into(), 2.into(), &header1, &public,)
|
||||
assert!(check_equivocation(&client, 2.into(), 2.into(), &header1, &public)
|
||||
.unwrap()
|
||||
.is_none(),);
|
||||
|
||||
assert!(check_equivocation(&client, 3.into(), 2.into(), &header1, &public,)
|
||||
assert!(check_equivocation(&client, 3.into(), 2.into(), &header1, &public)
|
||||
.unwrap()
|
||||
.is_none(),);
|
||||
|
||||
// But not two different headers at the same slot.
|
||||
assert!(check_equivocation(&client, 4.into(), 2.into(), &header2, &public,)
|
||||
assert!(check_equivocation(&client, 4.into(), 2.into(), &header2, &public)
|
||||
.unwrap()
|
||||
.is_some(),);
|
||||
|
||||
// Different slot is ok.
|
||||
assert!(check_equivocation(&client, 5.into(), 4.into(), &header3, &public,)
|
||||
assert!(check_equivocation(&client, 5.into(), 4.into(), &header3, &public)
|
||||
.unwrap()
|
||||
.is_none(),);
|
||||
|
||||
|
||||
@@ -318,7 +318,7 @@ pub trait SimpleSlotWorker<B: BlockT> {
|
||||
let proposal = match futures::future::select(proposing, proposing_remaining).await {
|
||||
Either::Left((Ok(p), _)) => p,
|
||||
Either::Left((Err(err), _)) => {
|
||||
warn!(target: logging_target, "Proposing failed: {:?}", err,);
|
||||
warn!(target: logging_target, "Proposing failed: {:?}", err);
|
||||
|
||||
return None
|
||||
},
|
||||
@@ -363,7 +363,7 @@ pub trait SimpleSlotWorker<B: BlockT> {
|
||||
) {
|
||||
Ok(bi) => bi,
|
||||
Err(err) => {
|
||||
warn!(target: logging_target, "Failed to create block import params: {:?}", err,);
|
||||
warn!(target: logging_target, "Failed to create block import params: {:?}", err);
|
||||
|
||||
return None
|
||||
},
|
||||
@@ -922,7 +922,7 @@ mod test {
|
||||
}
|
||||
|
||||
// but we cap it to a maximum of 20 slots
|
||||
assert_eq!(super::slot_lenience_linear(1u64.into(), &slot(23)), Some(SLOT_DURATION * 20),);
|
||||
assert_eq!(super::slot_lenience_linear(1u64.into(), &slot(23)), Some(SLOT_DURATION * 20));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -33,7 +33,7 @@ pub fn duration_now() -> Duration {
|
||||
use std::time::SystemTime;
|
||||
let now = SystemTime::now();
|
||||
now.duration_since(SystemTime::UNIX_EPOCH).unwrap_or_else(|e| {
|
||||
panic!("Current time {:?} is before unix epoch. Something is wrong: {:?}", now, e,)
|
||||
panic!("Current time {:?} is before unix epoch. Something is wrong: {:?}", now, e)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1155,23 +1155,23 @@ pub(crate) mod tests {
|
||||
|
||||
let hash7 =
|
||||
insert_block(&db, make_authorities(vec![auth3()]), || default_header(&hash6, 7));
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]),);
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]));
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash7)), Some(vec![auth3()]));
|
||||
let hash8 =
|
||||
insert_block(&db, make_authorities(vec![auth3()]), || default_header(&hash7, 8));
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]),);
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]));
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash7)), Some(vec![auth3()]));
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash8)), Some(vec![auth3()]));
|
||||
let hash6_1 =
|
||||
insert_block(&db, make_authorities(vec![auth4()]), || default_header(&hash6, 7));
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]),);
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]));
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash7)), Some(vec![auth3()]));
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash8)), Some(vec![auth3()]));
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6_1)), Some(vec![auth4()]));
|
||||
let hash6_1_1 = insert_non_best_block(&db, make_authorities(vec![auth5()]), || {
|
||||
default_header(&hash6_1, 8)
|
||||
});
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]),);
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]));
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash7)), Some(vec![auth3()]));
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash8)), Some(vec![auth3()]));
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6_1)), Some(vec![auth4()]));
|
||||
@@ -1179,7 +1179,7 @@ pub(crate) mod tests {
|
||||
let hash6_1_2 = insert_non_best_block(&db, make_authorities(vec![auth6()]), || {
|
||||
default_header(&hash6_1, 8)
|
||||
});
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]),);
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]));
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash7)), Some(vec![auth3()]));
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash8)), Some(vec![auth3()]));
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6_1)), Some(vec![auth4()]));
|
||||
@@ -1187,7 +1187,7 @@ pub(crate) mod tests {
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6_1_2)), Some(vec![auth6()]));
|
||||
let hash6_2 =
|
||||
insert_block(&db, make_authorities(vec![auth4()]), || default_header(&hash6_1, 8));
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]),);
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]));
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash7)), Some(vec![auth3()]));
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash8)), Some(vec![auth3()]));
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6_1)), Some(vec![auth4()]));
|
||||
@@ -1201,7 +1201,7 @@ pub(crate) mod tests {
|
||||
{
|
||||
// finalize block hash6_1
|
||||
db.finalize_header(BlockId::Hash(hash6_1)).unwrap();
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]),);
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]));
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash7)), None);
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash8)), None);
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6_1)), Some(vec![auth4()]));
|
||||
@@ -1210,7 +1210,7 @@ pub(crate) mod tests {
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6_2)), Some(vec![auth4()]));
|
||||
// finalize block hash6_2
|
||||
db.finalize_header(BlockId::Hash(hash6_2)).unwrap();
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]),);
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]));
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash7)), None);
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash8)), None);
|
||||
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6_1)), Some(vec![auth4()]));
|
||||
|
||||
@@ -51,7 +51,7 @@ fn sandbox_should_work(wasm_method: WasmExecutionMethod) {
|
||||
.unwrap()
|
||||
.encode();
|
||||
|
||||
assert_eq!(call_in_wasm("test_sandbox", &code, wasm_method, &mut ext,).unwrap(), true.encode(),);
|
||||
assert_eq!(call_in_wasm("test_sandbox", &code, wasm_method, &mut ext).unwrap(), true.encode());
|
||||
}
|
||||
|
||||
test_wasm_execution!(sandbox_trap);
|
||||
@@ -72,7 +72,7 @@ fn sandbox_trap(wasm_method: WasmExecutionMethod) {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(call_in_wasm("test_sandbox", &code, wasm_method, &mut ext,).unwrap(), vec![0],);
|
||||
assert_eq!(call_in_wasm("test_sandbox", &code, wasm_method, &mut ext).unwrap(), vec![0]);
|
||||
}
|
||||
|
||||
test_wasm_execution!(start_called);
|
||||
@@ -111,7 +111,7 @@ fn start_called(wasm_method: WasmExecutionMethod) {
|
||||
.unwrap()
|
||||
.encode();
|
||||
|
||||
assert_eq!(call_in_wasm("test_sandbox", &code, wasm_method, &mut ext,).unwrap(), true.encode(),);
|
||||
assert_eq!(call_in_wasm("test_sandbox", &code, wasm_method, &mut ext).unwrap(), true.encode());
|
||||
}
|
||||
|
||||
test_wasm_execution!(invoke_args);
|
||||
|
||||
@@ -658,7 +658,7 @@ mod tests {
|
||||
fn native_executor_registers_custom_interface() {
|
||||
let executor = NativeExecutor::<MyExecutor>::new(WasmExecutionMethod::Interpreted, None, 8);
|
||||
my_interface::HostFunctions::host_functions().iter().for_each(|function| {
|
||||
assert_eq!(executor.wasm.host_functions.iter().filter(|f| f == &function).count(), 2,);
|
||||
assert_eq!(executor.wasm.host_functions.iter().filter(|f| f == &function).count(), 2);
|
||||
});
|
||||
|
||||
my_interface::say_hello_world("hey");
|
||||
|
||||
@@ -176,7 +176,7 @@ impl InstanceWrapper {
|
||||
.ok_or_else(|| Error::from(format!("Export {} is not a function", method)))?
|
||||
.clone();
|
||||
EntryPoint::direct(func).map_err(|_| {
|
||||
Error::from(format!("Exported function '{}' has invalid signature.", method,))
|
||||
Error::from(format!("Exported function '{}' has invalid signature.", method))
|
||||
})?
|
||||
},
|
||||
InvokeMethod::Table(func_ref) => {
|
||||
|
||||
@@ -780,13 +780,13 @@ mod tests {
|
||||
authorities.add_pending_change(change(1), &is_descendent_of).unwrap();
|
||||
authorities.add_pending_change(change(2), &is_descendent_of).unwrap();
|
||||
|
||||
assert_eq!(authorities.current_limit(0), Some(1),);
|
||||
assert_eq!(authorities.current_limit(0), Some(1));
|
||||
|
||||
assert_eq!(authorities.current_limit(1), Some(1),);
|
||||
assert_eq!(authorities.current_limit(1), Some(1));
|
||||
|
||||
assert_eq!(authorities.current_limit(2), Some(2),);
|
||||
assert_eq!(authorities.current_limit(2), Some(2));
|
||||
|
||||
assert_eq!(authorities.current_limit(3), None,);
|
||||
assert_eq!(authorities.current_limit(3), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -910,7 +910,7 @@ mod tests {
|
||||
.add_pending_change(change_b.clone(), &static_is_descendent_of(true))
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(authorities.pending_changes().collect::<Vec<_>>(), vec![&change_a, &change_b],);
|
||||
assert_eq!(authorities.pending_changes().collect::<Vec<_>>(), vec![&change_a, &change_b]);
|
||||
|
||||
// finalizing "hash_c" won't enact the change signaled at "hash_a" but it will prune out "hash_b"
|
||||
let status = authorities
|
||||
@@ -929,7 +929,7 @@ mod tests {
|
||||
|
||||
assert!(status.changed);
|
||||
assert_eq!(status.new_set_block, None);
|
||||
assert_eq!(authorities.pending_changes().collect::<Vec<_>>(), vec![&change_a],);
|
||||
assert_eq!(authorities.pending_changes().collect::<Vec<_>>(), vec![&change_a]);
|
||||
assert_eq!(authorities.authority_set_changes, AuthoritySetChanges::empty());
|
||||
|
||||
// finalizing "hash_d" will enact the change signaled at "hash_a"
|
||||
@@ -1444,7 +1444,7 @@ mod tests {
|
||||
);
|
||||
|
||||
// there's no longer any pending change at `best_b` fork
|
||||
assert_eq!(authorities.next_change(&"best_b", &is_descendent_of).unwrap(), None,);
|
||||
assert_eq!(authorities.next_change(&"best_b", &is_descendent_of).unwrap(), None);
|
||||
|
||||
// we a forced change at A10 (#8)
|
||||
let change_a10 = PendingChange {
|
||||
@@ -1666,7 +1666,7 @@ mod tests {
|
||||
authority_set_changes.append(2, 81);
|
||||
|
||||
// we are missing the data for the first set, therefore we should return `None`
|
||||
assert_eq!(None, authority_set_changes.iter_from(40).map(|it| it.collect::<Vec<_>>()),);
|
||||
assert_eq!(None, authority_set_changes.iter_from(40).map(|it| it.collect::<Vec<_>>()));
|
||||
|
||||
// after adding the data for the first set the same query should work
|
||||
let mut authority_set_changes = AuthoritySetChanges::empty();
|
||||
@@ -1685,8 +1685,8 @@ mod tests {
|
||||
authority_set_changes.iter_from(41).map(|it| it.cloned().collect::<Vec<_>>()),
|
||||
);
|
||||
|
||||
assert_eq!(0, authority_set_changes.iter_from(121).unwrap().count(),);
|
||||
assert_eq!(0, authority_set_changes.iter_from(121).unwrap().count());
|
||||
|
||||
assert_eq!(0, authority_set_changes.iter_from(200).unwrap().count(),);
|
||||
assert_eq!(0, authority_set_changes.iter_from(200).unwrap().count());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -536,7 +536,7 @@ mod test {
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
assert_eq!(load_decode::<_, u32>(&client, VERSION_KEY).unwrap(), None,);
|
||||
assert_eq!(load_decode::<_, u32>(&client, VERSION_KEY).unwrap(), None);
|
||||
|
||||
// should perform the migration
|
||||
load_persistent::<substrate_test_runtime_client::runtime::Block, _, _>(
|
||||
@@ -547,7 +547,7 @@ mod test {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(load_decode::<_, u32>(&client, VERSION_KEY).unwrap(), Some(3),);
|
||||
assert_eq!(load_decode::<_, u32>(&client, VERSION_KEY).unwrap(), Some(3));
|
||||
|
||||
let PersistentData { authority_set, set_state, .. } =
|
||||
load_persistent::<substrate_test_runtime_client::runtime::Block, _, _>(
|
||||
@@ -629,7 +629,7 @@ mod test {
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
assert_eq!(load_decode::<_, u32>(&client, VERSION_KEY).unwrap(), Some(1),);
|
||||
assert_eq!(load_decode::<_, u32>(&client, VERSION_KEY).unwrap(), Some(1));
|
||||
|
||||
// should perform the migration
|
||||
load_persistent::<substrate_test_runtime_client::runtime::Block, _, _>(
|
||||
@@ -640,7 +640,7 @@ mod test {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(load_decode::<_, u32>(&client, VERSION_KEY).unwrap(), Some(3),);
|
||||
assert_eq!(load_decode::<_, u32>(&client, VERSION_KEY).unwrap(), Some(3));
|
||||
|
||||
let PersistentData { authority_set, set_state, .. } =
|
||||
load_persistent::<substrate_test_runtime_client::runtime::Block, _, _>(
|
||||
@@ -719,7 +719,7 @@ mod test {
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
assert_eq!(load_decode::<_, u32>(&client, VERSION_KEY).unwrap(), Some(2),);
|
||||
assert_eq!(load_decode::<_, u32>(&client, VERSION_KEY).unwrap(), Some(2));
|
||||
|
||||
// should perform the migration
|
||||
load_persistent::<substrate_test_runtime_client::runtime::Block, _, _>(
|
||||
@@ -730,7 +730,7 @@ mod test {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(load_decode::<_, u32>(&client, VERSION_KEY).unwrap(), Some(3),);
|
||||
assert_eq!(load_decode::<_, u32>(&client, VERSION_KEY).unwrap(), Some(3));
|
||||
|
||||
let PersistentData { authority_set, .. } = load_persistent::<
|
||||
substrate_test_runtime_client::runtime::Block,
|
||||
|
||||
@@ -2258,7 +2258,7 @@ mod tests {
|
||||
// we accept messages from rounds 9, 10 and 11
|
||||
// therefore neither of those should be considered expired
|
||||
for round in &[9, 10, 11] {
|
||||
assert!(!is_expired(crate::communication::round_topic::<Block>(*round, 1), &[],))
|
||||
assert!(!is_expired(crate::communication::round_topic::<Block>(*round, 1), &[]))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2533,10 +2533,10 @@ mod tests {
|
||||
);
|
||||
|
||||
// it should be expired if it is for a lower block
|
||||
assert!(message_expired(crate::communication::global_topic::<Block>(1), &commit(1, 1, 1),));
|
||||
assert!(message_expired(crate::communication::global_topic::<Block>(1), &commit(1, 1, 1)));
|
||||
|
||||
// or the same block height but from the previous round
|
||||
assert!(message_expired(crate::communication::global_topic::<Block>(1), &commit(0, 1, 2),));
|
||||
assert!(message_expired(crate::communication::global_topic::<Block>(1), &commit(0, 1, 2)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -512,7 +512,7 @@ fn peer_with_higher_view_leads_to_catch_up_request() {
|
||||
tester
|
||||
.filter_network_events(move |event| match event {
|
||||
Event::WriteNotification(peer, message) => {
|
||||
assert_eq!(peer, id,);
|
||||
assert_eq!(peer, id);
|
||||
|
||||
assert_eq!(
|
||||
message,
|
||||
|
||||
@@ -1376,7 +1376,7 @@ where
|
||||
set_ref.len(),
|
||||
);
|
||||
} else {
|
||||
afg_log!(initial_sync, "👴 Applying GRANDPA set change to new set {:?}", set_ref,);
|
||||
afg_log!(initial_sync, "👴 Applying GRANDPA set change to new set {:?}", set_ref);
|
||||
}
|
||||
|
||||
telemetry!(
|
||||
|
||||
@@ -512,7 +512,7 @@ pub(crate) mod tests {
|
||||
let mut authority_set_changes = AuthoritySetChanges::empty();
|
||||
authority_set_changes.append(0, 5);
|
||||
|
||||
assert!(matches!(prove_finality(&*backend, authority_set_changes, 6), Ok(None),));
|
||||
assert!(matches!(prove_finality(&*backend, authority_set_changes, 6), Ok(None)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1631,7 +1631,7 @@ fn imports_justification_for_regular_blocks_on_import() {
|
||||
);
|
||||
|
||||
// the justification should be imported and available from the client
|
||||
assert!(client.justifications(&BlockId::Hash(block_hash)).unwrap().is_some(),);
|
||||
assert!(client.justifications(&BlockId::Hash(block_hash)).unwrap().is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -759,7 +759,7 @@ mod tests {
|
||||
chain_state.import_header(h3);
|
||||
});
|
||||
|
||||
assert_eq!(unapply_commit(res), unapply_commit(unknown_commit()),);
|
||||
assert_eq!(unapply_commit(res), unapply_commit(unknown_commit()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -787,7 +787,7 @@ mod tests {
|
||||
chain_state.import_header(h3);
|
||||
});
|
||||
|
||||
assert_eq!(unapply_commit(res), unapply_commit(known_commit()),);
|
||||
assert_eq!(unapply_commit(res), unapply_commit(known_commit()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -835,7 +835,7 @@ mod tests {
|
||||
chain_state.import_header(h3);
|
||||
});
|
||||
|
||||
assert_eq!(unapply_catch_up(res), unapply_catch_up(unknown_catch_up()),);
|
||||
assert_eq!(unapply_catch_up(res), unapply_catch_up(unknown_catch_up()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -883,7 +883,7 @@ mod tests {
|
||||
chain_state.import_header(h3);
|
||||
});
|
||||
|
||||
assert_eq!(unapply_catch_up(res), unapply_catch_up(unknown_catch_up()),);
|
||||
assert_eq!(unapply_catch_up(res), unapply_catch_up(unknown_catch_up()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -709,7 +709,7 @@ mod tests {
|
||||
let file_name = temp_dir.path().join(hex::encode(&SR25519.0[..2]));
|
||||
fs::write(file_name, "test").expect("Invalid file is written");
|
||||
|
||||
assert!(SyncCryptoStore::sr25519_public_keys(&store, SR25519).is_empty(),);
|
||||
assert!(SyncCryptoStore::sr25519_public_keys(&store, SR25519).is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -264,7 +264,7 @@ impl<B: BlockT> Future for GossipEngine<B> {
|
||||
match sink.start_send(notification.clone()) {
|
||||
Ok(()) => {},
|
||||
Err(e) if e.is_full() =>
|
||||
unreachable!("Previously ensured that all sinks are ready; qed.",),
|
||||
unreachable!("Previously ensured that all sinks are ready; qed."),
|
||||
// Receiver got dropped. Will be removed in next iteration (See (1)).
|
||||
Err(_) => {},
|
||||
}
|
||||
@@ -624,7 +624,7 @@ mod tests {
|
||||
.or_insert(1);
|
||||
},
|
||||
Poll::Ready(None) =>
|
||||
unreachable!("Sender side of channel is never dropped",),
|
||||
unreachable!("Sender side of channel is never dropped"),
|
||||
Poll::Pending => {},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ impl<B: BlockT> NetworkBehaviour for Bitswap<B> {
|
||||
let wantlist = match request.wantlist {
|
||||
Some(wantlist) => wantlist,
|
||||
None => {
|
||||
debug!(target: LOG_TARGET, "Unexpected bitswap message from {}", peer,);
|
||||
debug!(target: LOG_TARGET, "Unexpected bitswap message from {}", peer);
|
||||
return
|
||||
},
|
||||
};
|
||||
|
||||
@@ -902,7 +902,7 @@ mod tests {
|
||||
|
||||
let OutEvent::SendRequest { target, pending_response, .. } =
|
||||
block_on(sender.next()).unwrap();
|
||||
assert!(target == peer0 || target == peer1, "Expect request to originate from known peer.",);
|
||||
assert!(target == peer0 || target == peer1, "Expect request to originate from known peer.");
|
||||
|
||||
// And we should have one busy peer.
|
||||
assert!({
|
||||
|
||||
@@ -2272,7 +2272,7 @@ mod test {
|
||||
.any(|(who, request)| { who == peer_id && request.from == FromBlock::Hash(a1_hash) }));
|
||||
|
||||
// there are no extra pending requests
|
||||
assert_eq!(sync.extra_justifications.pending_requests().count(), 0,);
|
||||
assert_eq!(sync.extra_justifications.pending_requests().count(), 0);
|
||||
|
||||
// there's one in-flight extra request to the expected peer
|
||||
assert!(sync.extra_justifications.active_requests().any(|(who, (hash, number))| {
|
||||
@@ -2290,7 +2290,7 @@ mod test {
|
||||
);
|
||||
|
||||
// there should be no in-flight requests
|
||||
assert_eq!(sync.extra_justifications.active_requests().count(), 0,);
|
||||
assert_eq!(sync.extra_justifications.active_requests().count(), 0);
|
||||
|
||||
// and the request should now be pending again, waiting for reschedule
|
||||
assert!(sync
|
||||
|
||||
@@ -127,7 +127,7 @@ fn should_return_child_storage() {
|
||||
.map(|x| x.is_some()),
|
||||
Ok(true)
|
||||
);
|
||||
assert_matches!(child.storage_size(child_key.clone(), key.clone(), None,).wait(), Ok(Some(1)));
|
||||
assert_matches!(child.storage_size(child_key.clone(), key.clone(), None).wait(), Ok(Some(1)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -145,27 +145,27 @@ fn wait_receiver<T>(rx: Receiver<T>) -> T {
|
||||
|
||||
#[test]
|
||||
fn system_name_works() {
|
||||
assert_eq!(api(None).system_name().unwrap(), "testclient".to_owned(),);
|
||||
assert_eq!(api(None).system_name().unwrap(), "testclient".to_owned());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn system_version_works() {
|
||||
assert_eq!(api(None).system_version().unwrap(), "0.2.0".to_owned(),);
|
||||
assert_eq!(api(None).system_version().unwrap(), "0.2.0".to_owned());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn system_chain_works() {
|
||||
assert_eq!(api(None).system_chain().unwrap(), "testchain".to_owned(),);
|
||||
assert_eq!(api(None).system_chain().unwrap(), "testchain".to_owned());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn system_properties_works() {
|
||||
assert_eq!(api(None).system_properties().unwrap(), serde_json::map::Map::new(),);
|
||||
assert_eq!(api(None).system_properties().unwrap(), serde_json::map::Map::new());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn system_type_works() {
|
||||
assert_eq!(api(None).system_type().unwrap(), Default::default(),);
|
||||
assert_eq!(api(None).system_type().unwrap(), Default::default());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1913,7 +1913,7 @@ where
|
||||
// (i.e. fork blocks and bad blocks respectively)
|
||||
match self.block_rules.lookup(number, &hash) {
|
||||
BlockLookupResult::KnownBad => {
|
||||
trace!("Rejecting known bad block: #{} {:?}", number, hash,);
|
||||
trace!("Rejecting known bad block: #{} {:?}", number, hash);
|
||||
return Ok(ImportResult::KnownBad)
|
||||
},
|
||||
BlockLookupResult::Expected(expected_hash) => {
|
||||
|
||||
@@ -1220,13 +1220,13 @@ fn import_with_justification() {
|
||||
.block;
|
||||
block_on(client.import_justified(BlockOrigin::Own, a3.clone(), justification.clone())).unwrap();
|
||||
|
||||
assert_eq!(client.chain_info().finalized_hash, a3.hash(),);
|
||||
assert_eq!(client.chain_info().finalized_hash, a3.hash());
|
||||
|
||||
assert_eq!(client.justifications(&BlockId::Hash(a3.hash())).unwrap(), Some(justification),);
|
||||
assert_eq!(client.justifications(&BlockId::Hash(a3.hash())).unwrap(), Some(justification));
|
||||
|
||||
assert_eq!(client.justifications(&BlockId::Hash(a1.hash())).unwrap(), None,);
|
||||
assert_eq!(client.justifications(&BlockId::Hash(a1.hash())).unwrap(), None);
|
||||
|
||||
assert_eq!(client.justifications(&BlockId::Hash(a2.hash())).unwrap(), None,);
|
||||
assert_eq!(client.justifications(&BlockId::Hash(a2.hash())).unwrap(), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1265,15 +1265,15 @@ fn importing_diverged_finalized_block_should_trigger_reorg() {
|
||||
let b1 = b1.build().unwrap().block;
|
||||
|
||||
// A2 is the current best since it's the longest chain
|
||||
assert_eq!(client.chain_info().best_hash, a2.hash(),);
|
||||
assert_eq!(client.chain_info().best_hash, a2.hash());
|
||||
|
||||
// importing B1 as finalized should trigger a re-org and set it as new best
|
||||
let justification = Justifications::from((TEST_ENGINE_ID, vec![1, 2, 3]));
|
||||
block_on(client.import_justified(BlockOrigin::Own, b1.clone(), justification)).unwrap();
|
||||
|
||||
assert_eq!(client.chain_info().best_hash, b1.hash(),);
|
||||
assert_eq!(client.chain_info().best_hash, b1.hash());
|
||||
|
||||
assert_eq!(client.chain_info().finalized_hash, b1.hash(),);
|
||||
assert_eq!(client.chain_info().finalized_hash, b1.hash());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1320,21 +1320,21 @@ fn finalizing_diverged_block_should_trigger_reorg() {
|
||||
block_on(client.import(BlockOrigin::Own, b2.clone())).unwrap();
|
||||
|
||||
// A2 is the current best since it's the longest chain
|
||||
assert_eq!(client.chain_info().best_hash, a2.hash(),);
|
||||
assert_eq!(client.chain_info().best_hash, a2.hash());
|
||||
|
||||
// we finalize block B1 which is on a different branch from current best
|
||||
// which should trigger a re-org.
|
||||
ClientExt::finalize_block(&client, BlockId::Hash(b1.hash()), None).unwrap();
|
||||
|
||||
// B1 should now be the latest finalized
|
||||
assert_eq!(client.chain_info().finalized_hash, b1.hash(),);
|
||||
assert_eq!(client.chain_info().finalized_hash, b1.hash());
|
||||
|
||||
// and B1 should be the new best block (`finalize_block` as no way of
|
||||
// knowing about B2)
|
||||
assert_eq!(client.chain_info().best_hash, b1.hash(),);
|
||||
assert_eq!(client.chain_info().best_hash, b1.hash());
|
||||
|
||||
// `SelectChain` should report B2 as best block though
|
||||
assert_eq!(block_on(select_chain.best_chain()).unwrap().hash(), b2.hash(),);
|
||||
assert_eq!(block_on(select_chain.best_chain()).unwrap().hash(), b2.hash());
|
||||
|
||||
// after we build B3 on top of B2 and import it
|
||||
// it should be the new best block,
|
||||
@@ -1346,7 +1346,7 @@ fn finalizing_diverged_block_should_trigger_reorg() {
|
||||
.block;
|
||||
block_on(client.import(BlockOrigin::Own, b3.clone())).unwrap();
|
||||
|
||||
assert_eq!(client.chain_info().best_hash, b3.hash(),);
|
||||
assert_eq!(client.chain_info().best_hash, b3.hash());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1505,7 +1505,7 @@ fn doesnt_import_blocks_that_revert_finality() {
|
||||
.to_string(),
|
||||
);
|
||||
|
||||
assert_eq!(import_err.to_string(), expected_err.to_string(),);
|
||||
assert_eq!(import_err.to_string(), expected_err.to_string());
|
||||
|
||||
// adding a C1 block which is lower than the last finalized should also
|
||||
// fail (with a cheaper check that doesn't require checking ancestry).
|
||||
@@ -1525,7 +1525,7 @@ fn doesnt_import_blocks_that_revert_finality() {
|
||||
let expected_err =
|
||||
ConsensusError::ClientImport(sp_blockchain::Error::NotInFinalizedChain.to_string());
|
||||
|
||||
assert_eq!(import_err.to_string(), expected_err.to_string(),);
|
||||
assert_eq!(import_err.to_string(), expected_err.to_string());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -246,7 +246,7 @@ where
|
||||
);
|
||||
let _guard = dispatcher_span.enter();
|
||||
if let Err(e) = dispatcher::with_default(&dispatch, || {
|
||||
let span = tracing::info_span!(target: TRACE_TARGET, "trace_block",);
|
||||
let span = tracing::info_span!(target: TRACE_TARGET, "trace_block");
|
||||
let _enter = span.enter();
|
||||
self.client.runtime_api().execute_block(&parent_id, block)
|
||||
}) {
|
||||
|
||||
@@ -403,7 +403,7 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
let output = String::from_utf8(output.stderr).unwrap();
|
||||
assert!(re.is_match(output.trim()), "Expected:\n{}\nGot:\n{}", re, output,);
|
||||
assert!(re.is_match(output.trim()), "Expected:\n{}\nGot:\n{}", re, output);
|
||||
}
|
||||
|
||||
/// This is not an actual test, it is used by the `prefix_in_log_lines` test.
|
||||
@@ -448,7 +448,7 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
let output = String::from_utf8(output.stderr).unwrap();
|
||||
assert!(re.is_match(output.trim()), "Expected:\n{}\nGot:\n{}", re, output,);
|
||||
assert!(re.is_match(output.trim()), "Expected:\n{}\nGot:\n{}", re, output);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user