Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Prepare for rust 1.62.1 (#11903)
Browse files Browse the repository at this point in the history
* Update UI test output for rust 1.62.1

* switch ci to staging image to check that everything works

* fix artifacts node-bench-regression-guard

* Imeplement `scale_info::TypeInfo` manually to silence aggressive rust warning

* Fix more clippy lints

* Make clippy happy by relying on auto-deref were possible

* Add tracking issue to the comments

* pin ci image

Co-authored-by: alvicsam <[email protected]>
  • Loading branch information
skunert and alvicsam authored Jul 26, 2022
1 parent 531d7c3 commit 9428b0e
Show file tree
Hide file tree
Showing 45 changed files with 365 additions and 84 deletions.
3 changes: 2 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ variables: &default-vars
CARGO_INCREMENTAL: 0
DOCKER_OS: "debian:stretch"
ARCH: "x86_64"
CI_IMAGE: "paritytech/ci-linux:production"
# change to production when this image is published
CI_IMAGE: "paritytech/ci-linux:staging@sha256:2c90b67f1452ed2d7236c2cd13f6224053a833d521b3630650b679f00874e0a9"
RUSTY_CACHIER_SINGLE_BRANCH: master
RUSTY_CACHIER_DONT_OPERATE_ON_MAIN_BRANCH: "true"

Expand Down
2 changes: 1 addition & 1 deletion bin/node/bench/src/simple_trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub struct SimpleTrie<'a> {

impl<'a> AsHashDB<Hasher, DBValue> for SimpleTrie<'a> {
fn as_hash_db(&self) -> &dyn hash_db::HashDB<Hasher, DBValue> {
&*self
self
}

fn as_hash_db_mut<'b>(&'b mut self) -> &'b mut (dyn HashDB<Hasher, DBValue> + 'b) {
Expand Down
8 changes: 4 additions & 4 deletions bin/node/cli/benches/transaction_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,25 +243,25 @@ fn transaction_pool_benchmarks(c: &mut Criterion) {
move |b| {
b.iter_batched(
|| {
let prepare_extrinsics = create_account_extrinsics(&*node.client, &accounts);
let prepare_extrinsics = create_account_extrinsics(&node.client, &accounts);

runtime.block_on(future::join_all(prepare_extrinsics.into_iter().map(|tx| {
submit_tx_and_wait_for_inclusion(
&node.transaction_pool,
tx,
&*node.client,
&node.client,
true,
)
})));

create_benchmark_extrinsics(&*node.client, &accounts, extrinsics_per_account)
create_benchmark_extrinsics(&node.client, &accounts, extrinsics_per_account)
},
|extrinsics| {
runtime.block_on(future::join_all(extrinsics.into_iter().map(|tx| {
submit_tx_and_wait_for_inclusion(
&node.transaction_pool,
tx,
&*node.client,
&node.client,
false,
)
})));
Expand Down
14 changes: 7 additions & 7 deletions client/beefy/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ fn finalize_block_and_wait_for_beefy(
finalize_targets: &[u64],
expected_beefy: &[u64],
) {
let (best_blocks, signed_commitments) = get_beefy_streams(&mut *net.lock(), peers);
let (best_blocks, signed_commitments) = get_beefy_streams(&mut net.lock(), peers);

for block in finalize_targets {
let finalize = BlockId::number(*block);
Expand Down Expand Up @@ -555,15 +555,15 @@ fn lagging_validators() {

// Alice finalizes #25, Bob lags behind
let finalize = BlockId::number(25);
let (best_blocks, signed_commitments) = get_beefy_streams(&mut *net.lock(), peers);
let (best_blocks, signed_commitments) = get_beefy_streams(&mut net.lock(), peers);
net.lock().peer(0).client().as_client().finalize_block(finalize, None).unwrap();
// verify nothing gets finalized by BEEFY
let timeout = Some(Duration::from_millis(250));
streams_empty_after_timeout(best_blocks, &net, &mut runtime, timeout);
streams_empty_after_timeout(signed_commitments, &net, &mut runtime, None);

// Bob catches up and also finalizes #25
let (best_blocks, signed_commitments) = get_beefy_streams(&mut *net.lock(), peers);
let (best_blocks, signed_commitments) = get_beefy_streams(&mut net.lock(), peers);
net.lock().peer(1).client().as_client().finalize_block(finalize, None).unwrap();
// expected beefy finalizes block #17 from diff-power-of-two
wait_for_best_beefy_blocks(best_blocks, &net, &mut runtime, &[23, 24, 25]);
Expand All @@ -577,7 +577,7 @@ fn lagging_validators() {
// validator set).

// Alice finalizes session-boundary mandatory block #60, Bob lags behind
let (best_blocks, signed_commitments) = get_beefy_streams(&mut *net.lock(), peers);
let (best_blocks, signed_commitments) = get_beefy_streams(&mut net.lock(), peers);
let finalize = BlockId::number(60);
net.lock().peer(0).client().as_client().finalize_block(finalize, None).unwrap();
// verify nothing gets finalized by BEEFY
Expand All @@ -586,7 +586,7 @@ fn lagging_validators() {
streams_empty_after_timeout(signed_commitments, &net, &mut runtime, None);

// Bob catches up and also finalizes #60 (and should have buffered Alice's vote on #60)
let (best_blocks, signed_commitments) = get_beefy_streams(&mut *net.lock(), peers);
let (best_blocks, signed_commitments) = get_beefy_streams(&mut net.lock(), peers);
net.lock().peer(1).client().as_client().finalize_block(finalize, None).unwrap();
// verify beefy skips intermediary votes, and successfully finalizes mandatory block #40
wait_for_best_beefy_blocks(best_blocks, &net, &mut runtime, &[60]);
Expand Down Expand Up @@ -629,7 +629,7 @@ fn correct_beefy_payload() {
finalize_block_and_wait_for_beefy(&net, peers, &mut runtime, &[10], &[1, 9]);

let (best_blocks, signed_commitments) =
get_beefy_streams(&mut *net.lock(), &[BeefyKeyring::Alice]);
get_beefy_streams(&mut net.lock(), &[BeefyKeyring::Alice]);

// now 2 good validators and 1 bad one are voting
net.lock()
Expand Down Expand Up @@ -658,7 +658,7 @@ fn correct_beefy_payload() {

// 3rd good validator catches up and votes as well
let (best_blocks, signed_commitments) =
get_beefy_streams(&mut *net.lock(), &[BeefyKeyring::Alice]);
get_beefy_streams(&mut net.lock(), &[BeefyKeyring::Alice]);
net.lock()
.peer(2)
.client()
Expand Down
4 changes: 2 additions & 2 deletions client/beefy/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ where
let commitment = Commitment { payload, block_number: target_number, validator_set_id };
let encoded_commitment = commitment.encode();

let signature = match self.key_store.sign(&authority_id, &*encoded_commitment) {
let signature = match self.key_store.sign(&authority_id, &encoded_commitment) {
Ok(sig) => sig,
Err(err) => {
warn!(target: "beefy", "🥩 Error signing commitment: {:?}", err);
Expand All @@ -451,7 +451,7 @@ where
target: "beefy",
"🥩 Produced signature using {:?}, is_valid: {:?}",
authority_id,
BeefyKeystore::verify(&authority_id, &signature, &*encoded_commitment)
BeefyKeystore::verify(&authority_id, &signature, &encoded_commitment)
);

let message = VoteMessage { commitment, id: authority_id, signature };
Expand Down
2 changes: 1 addition & 1 deletion client/cli/src/commands/run_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ impl std::error::Error for TelemetryParsingError {}

impl std::fmt::Display for TelemetryParsingError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match &*self {
match self {
TelemetryParsingError::MissingVerbosity => write!(f, "Verbosity level missing"),
TelemetryParsingError::VerbosityParsingError(e) => write!(f, "{}", e),
}
Expand Down
4 changes: 2 additions & 2 deletions client/consensus/common/src/block_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,10 @@ impl<B: BlockT> JustificationSyncLink<B> for () {

impl<B: BlockT, L: JustificationSyncLink<B>> JustificationSyncLink<B> for Arc<L> {
fn request_justification(&self, hash: &B::Hash, number: NumberFor<B>) {
L::request_justification(&*self, hash, number);
L::request_justification(self, hash, number);
}

fn clear_justification_requests(&self) {
L::clear_justification_requests(&*self);
L::clear_justification_requests(self);
}
}
2 changes: 1 addition & 1 deletion client/db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2292,7 +2292,7 @@ impl<Block: BlockT> sc_client_api::backend::Backend<Block> for Backend<Block> {
}

fn get_import_lock(&self) -> &RwLock<()> {
&*self.import_lock
&self.import_lock
}

fn requires_full_sync(&self) -> bool {
Expand Down
6 changes: 3 additions & 3 deletions client/finality-grandpa/src/communication/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ impl<B: BlockT, N: Network<B>> NetworkBridge<B, N> {
voters: Arc<VoterSet<AuthorityId>>,
has_voted: HasVoted<B>,
) -> (impl Stream<Item = SignedMessage<B>> + Unpin, OutgoingMessages<B>) {
self.note_round(round, set_id, &*voters);
self.note_round(round, set_id, &voters);

let keystore = keystore.and_then(|ks| {
let id = ks.local_id();
Expand Down Expand Up @@ -637,9 +637,9 @@ fn incoming_global<B: BlockT>(
.filter_map(move |(notification, msg)| {
future::ready(match msg {
GossipMessage::Commit(msg) =>
process_commit(msg, notification, &gossip_engine, &gossip_validator, &*voters),
process_commit(msg, notification, &gossip_engine, &gossip_validator, &voters),
GossipMessage::CatchUp(msg) =>
process_catch_up(msg, notification, &gossip_engine, &gossip_validator, &*voters),
process_catch_up(msg, notification, &gossip_engine, &gossip_validator, &voters),
_ => {
debug!(target: "afg", "Skipping unknown message type");
None
Expand Down
2 changes: 1 addition & 1 deletion client/finality-grandpa/src/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ where

impl<'a, H, N> InnerGuard<'a, H, N> {
fn as_mut(&mut self) -> &mut AuthoritySet<H, N> {
&mut **self.guard.as_mut().expect("only taken on deconstruction; qed")
self.guard.as_mut().expect("only taken on deconstruction; qed")
}

fn set_old(&mut self, old: AuthoritySet<H, N>) {
Expand Down
2 changes: 1 addition & 1 deletion client/finality-grandpa/src/observer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ where
network.note_round(
crate::communication::Round(round),
crate::communication::SetId(set_id),
&*voters,
&voters,
)
}
};
Expand Down
4 changes: 2 additions & 2 deletions client/rpc/src/offchain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl<T: OffchainStorage + 'static> OffchainApiServer for Offchain<T> {
StorageKind::PERSISTENT => sp_offchain::STORAGE_PREFIX,
StorageKind::LOCAL => return Err(JsonRpseeError::from(Error::UnavailableStorageKind)),
};
self.storage.write().set(prefix, &*key, &*value);
self.storage.write().set(prefix, &key, &value);
Ok(())
}

Expand All @@ -69,6 +69,6 @@ impl<T: OffchainStorage + 'static> OffchainApiServer for Offchain<T> {
StorageKind::LOCAL => return Err(JsonRpseeError::from(Error::UnavailableStorageKind)),
};

Ok(self.storage.read().get(prefix, &*key).map(Into::into))
Ok(self.storage.read().get(prefix, &key).map(Into::into))
}
}
2 changes: 1 addition & 1 deletion client/rpc/src/state/state_full.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ where
.call(
&BlockId::Hash(block),
&method,
&*call_data,
&call_data,
self.client.execution_extensions().strategies().other,
None,
)
Expand Down
4 changes: 2 additions & 2 deletions client/service/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1614,11 +1614,11 @@ where
RA: Send + Sync,
{
fn header(&self, id: BlockId<Block>) -> sp_blockchain::Result<Option<Block::Header>> {
(**self).backend.blockchain().header(id)
self.backend.blockchain().header(id)
}

fn info(&self) -> blockchain::Info<Block> {
(**self).backend.blockchain().info()
self.backend.blockchain().info()
}

fn status(&self, id: BlockId<Block>) -> sp_blockchain::Result<blockchain::BlockStatus> {
Expand Down
2 changes: 1 addition & 1 deletion client/tracing/src/logging/stderr_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn flush_logs(mut buffer: parking_lot::lock_api::MutexGuard<parking_lot::RawMute

let stderr = std::io::stderr();
let mut stderr_lock = stderr.lock();
let _ = stderr_lock.write_all(&*spare_buffer);
let _ = stderr_lock.write_all(&spare_buffer);
std::mem::drop(stderr_lock);

spare_buffer.clear();
Expand Down
14 changes: 7 additions & 7 deletions client/transaction-pool/tests/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ fn should_resubmit_from_retracted_during_maintenance() {
let header = api.push_block(1, vec![], true);
let fork_header = api.push_block(1, vec![], false);

let event = block_event_with_retracted(header, fork_header.hash(), &*pool.api());
let event = block_event_with_retracted(header, fork_header.hash(), pool.api());

block_on(pool.maintain(event));
assert_eq!(pool.status().ready, 1);
Expand All @@ -272,7 +272,7 @@ fn should_not_resubmit_from_retracted_during_maintenance_if_tx_is_also_in_enacte
let header = api.push_block(1, vec![xt.clone()], true);
let fork_header = api.push_block(1, vec![xt], false);

let event = block_event_with_retracted(header, fork_header.hash(), &*pool.api());
let event = block_event_with_retracted(header, fork_header.hash(), pool.api());

block_on(pool.maintain(event));
assert_eq!(pool.status().ready, 0);
Expand All @@ -292,7 +292,7 @@ fn should_not_retain_invalid_hashes_from_retracted() {
let fork_header = api.push_block(1, vec![xt.clone()], false);
api.add_invalid(&xt);

let event = block_event_with_retracted(header, fork_header.hash(), &*pool.api());
let event = block_event_with_retracted(header, fork_header.hash(), pool.api());
block_on(pool.maintain(event));

assert_eq!(
Expand Down Expand Up @@ -533,7 +533,7 @@ fn fork_aware_finalization() {
let header = pool.api().push_block(3, vec![from_charlie.clone()], true);

canon_watchers.push((watcher, header.hash()));
let event = block_event_with_retracted(header.clone(), d2, &*pool.api());
let event = block_event_with_retracted(header.clone(), d2, pool.api());
block_on(pool.maintain(event));
assert_eq!(pool.status().ready, 2);

Expand Down Expand Up @@ -633,7 +633,7 @@ fn prune_and_retract_tx_at_same_time() {
let header = pool.api().push_block(2, vec![from_alice.clone()], false);
assert_eq!(pool.status().ready, 0);

let event = block_event_with_retracted(header.clone(), b1, &*pool.api());
let event = block_event_with_retracted(header.clone(), b1, pool.api());
block_on(pool.maintain(event));
assert_eq!(pool.status().ready, 0);

Expand Down Expand Up @@ -708,7 +708,7 @@ fn resubmit_tx_of_fork_that_is_not_part_of_retracted() {
// Block D2
{
let header = pool.api().push_block(2, vec![], false);
let event = block_event_with_retracted(header, d0, &*pool.api());
let event = block_event_with_retracted(header, d0, pool.api());
block_on(pool.maintain(event));
assert_eq!(pool.status().ready, 2);
}
Expand Down Expand Up @@ -801,7 +801,7 @@ fn resubmit_from_retracted_fork() {
let expected_ready = vec![tx3, tx4, tx5].iter().map(Encode::encode).collect::<BTreeSet<_>>();
assert_eq!(expected_ready, ready);

let event = block_event_with_retracted(f1_header, f0, &*pool.api());
let event = block_event_with_retracted(f1_header, f0, pool.api());
block_on(pool.maintain(event));

assert_eq!(pool.status().ready, 3);
Expand Down
2 changes: 1 addition & 1 deletion frame/contracts/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,7 @@ where

fn deposit_event<T: Config>(topics: Vec<T::Hash>, event: Event<T>) {
<frame_system::Pallet<T>>::deposit_event_indexed(
&*topics,
&topics,
<T as Config>::Event::from(event).into(),
)
}
Expand Down
4 changes: 2 additions & 2 deletions frame/executive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ mod tests {
use pallet_balances::Call as BalancesCall;
use pallet_transaction_payment::CurrencyAdapter;

const TEST_KEY: &[u8] = &*b":test:key:";
const TEST_KEY: &[u8] = b":test:key:";

#[frame_support::pallet]
mod custom {
Expand Down Expand Up @@ -806,7 +806,7 @@ mod tests {
type TestUncheckedExtrinsic = TestXt;

// Will contain `true` when the custom runtime logic was called.
const CUSTOM_ON_RUNTIME_KEY: &[u8] = &*b":custom:on_runtime";
const CUSTOM_ON_RUNTIME_KEY: &[u8] = b":custom:on_runtime";

struct CustomOnRuntimeUpgrade;
impl OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
Expand Down
2 changes: 1 addition & 1 deletion frame/offences/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl<Reporter, Offender> offence::OnOffenceHandler<Reporter, Offender, Weight>
}

pub fn with_on_offence_fractions<R, F: FnOnce(&mut Vec<Perbill>) -> R>(f: F) -> R {
ON_OFFENCE_PERBILL.with(|fractions| f(&mut *fractions.borrow_mut()))
ON_OFFENCE_PERBILL.with(|fractions| f(&mut fractions.borrow_mut()))
}

type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
Expand Down
2 changes: 1 addition & 1 deletion frame/support/procedural/src/pallet/parse/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ impl CallDef {
return Err(syn::Error::new(method.sig.span(), msg))
},
Some(syn::FnArg::Typed(arg)) => {
check_dispatchable_first_arg_type(&*arg.ty)?;
check_dispatchable_first_arg_type(&arg.ty)?;
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ help: consider importing this struct
|
1 | use frame_system::GenesisConfig;
|
help: if you import `GenesisConfig`, refer to it directly
|
40 - construct_runtime! {
41 - pub enum Runtime where
42 - Block = Block,
43 - NodeBlock = Block,
44 - UncheckedExtrinsic = UncheckedExtrinsic
45 - {
46 - System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
47 - Pallet: test_pallet::{Pallet, Config},
48 - }
49 - }
|

error[E0283]: type annotations needed
--> tests/construct_runtime_ui/no_std_genesis_config.rs:40:1
Expand Down
Loading

0 comments on commit 9428b0e

Please sign in to comment.