Prepare for rust 1.62.1 (#11903)

* 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 <alvicsam@gmail.com>
This commit is contained in:
Sebastian Kunert
2022-07-26 14:37:05 +02:00
committed by GitHub
parent 151c5d3fd9
commit 9f409dc0b8
45 changed files with 365 additions and 84 deletions
+2 -1
View File
@@ -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"
+1 -1
View File
@@ -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) {
@@ -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,
)
})));
+7 -7
View File
@@ -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);
@@ -555,7 +555,7 @@ 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));
@@ -563,7 +563,7 @@ fn lagging_validators() {
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]);
@@ -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
@@ -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]);
@@ -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()
@@ -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()
+2 -2
View File
@@ -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);
@@ -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 };
+1 -1
View File
@@ -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),
}
@@ -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);
}
}
+1 -1
View File
@@ -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 {
@@ -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();
@@ -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
@@ -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>) {
@@ -289,7 +289,7 @@ where
network.note_round(
crate::communication::Round(round),
crate::communication::SetId(set_id),
&*voters,
&voters,
)
}
};
+2 -2
View File
@@ -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(())
}
@@ -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))
}
}
+1 -1
View File
@@ -199,7 +199,7 @@ where
.call(
&BlockId::Hash(block),
&method,
&*call_data,
&call_data,
self.client.execution_extensions().strategies().other,
None,
)
@@ -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> {
@@ -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();
@@ -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);
@@ -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);
@@ -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!(
@@ -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);
@@ -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);
@@ -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);
}
@@ -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);
+1 -1
View File
@@ -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(),
)
}
+2 -2
View File
@@ -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 {
@@ -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 {
+1 -1
View File
@@ -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>;
@@ -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)?;
},
}
@@ -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
@@ -32,6 +32,19 @@ help: consider importing this enum
|
1 | use frame_system::Event;
|
help: if you import `Event`, refer to it directly
|
49 - construct_runtime! {
50 - pub enum Runtime where
51 - Block = Block,
52 - NodeBlock = Block,
53 - UncheckedExtrinsic = UncheckedExtrinsic
54 - {
55 - System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
56 - Pallet: pallet::{Pallet, Event},
57 - }
58 - }
|
error[E0412]: cannot find type `Event` in module `pallet`
--> tests/construct_runtime_ui/undefined_event_part.rs:49:1
@@ -52,3 +65,16 @@ help: consider importing one of these items
|
1 | use frame_system::Event;
|
help: if you import `Event`, refer to it directly
|
49 - construct_runtime! {
50 - pub enum Runtime where
51 - Block = Block,
52 - NodeBlock = Block,
53 - UncheckedExtrinsic = UncheckedExtrinsic
54 - {
55 - System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
56 - Pallet: pallet::{Pallet, Event},
57 - }
58 - }
|
@@ -32,6 +32,19 @@ help: consider importing this struct
|
1 | use frame_system::GenesisConfig;
|
help: if you import `GenesisConfig`, refer to it directly
|
49 - construct_runtime! {
50 - pub enum Runtime where
51 - Block = Block,
52 - NodeBlock = Block,
53 - UncheckedExtrinsic = UncheckedExtrinsic
54 - {
55 - System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
56 - Pallet: pallet::{Pallet, Config},
57 - }
58 - }
|
error[E0283]: type annotations needed
--> tests/construct_runtime_ui/undefined_genesis_config_part.rs:49:1
@@ -32,6 +32,19 @@ help: consider importing this type alias
|
1 | use frame_system::Origin;
|
help: if you import `Origin`, refer to it directly
|
49 - construct_runtime! {
50 - pub enum Runtime where
51 - Block = Block,
52 - NodeBlock = Block,
53 - UncheckedExtrinsic = UncheckedExtrinsic
54 - {
55 - System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
56 - Pallet: pallet::{Pallet, Origin},
57 - }
58 - }
|
error[E0412]: cannot find type `Origin` in module `pallet`
--> tests/construct_runtime_ui/undefined_origin_part.rs:49:1
@@ -52,6 +65,19 @@ help: consider importing one of these items
|
1 | use frame_system::Origin;
|
help: if you import `Origin`, refer to it directly
|
49 - construct_runtime! {
50 - pub enum Runtime where
51 - Block = Block,
52 - NodeBlock = Block,
53 - UncheckedExtrinsic = UncheckedExtrinsic
54 - {
55 - System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
56 - Pallet: pallet::{Pallet, Origin},
57 - }
58 - }
|
error[E0282]: type annotations needed
--> tests/construct_runtime_ui/undefined_origin_part.rs:49:1
@@ -1,5 +1,5 @@
error: `integrity_test` can only be passed once as input.
--> $DIR/reserved_keyword_two_times_integrity_test.rs:1:1
--> tests/decl_module_ui/reserved_keyword_two_times_integrity_test.rs:1:1
|
1 | / frame_support::decl_module! {
2 | | pub struct Module<T: Config> for enum Call where origin: T::Origin, system=self {
@@ -13,13 +13,7 @@ error: `integrity_test` can only be passed once as input.
= note: this error originates in the macro `$crate::decl_module` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0601]: `main` function not found in crate `$CRATE`
--> $DIR/reserved_keyword_two_times_integrity_test.rs:1:1
--> tests/decl_module_ui/reserved_keyword_two_times_integrity_test.rs:7:2
|
1 | / frame_support::decl_module! {
2 | | pub struct Module<T: Config> for enum Call where origin: T::Origin, system=self {
3 | | fn integrity_test() {}
4 | |
5 | | fn integrity_test() {}
6 | | }
7 | | }
| |_^ consider adding a `main` function to `$DIR/tests/decl_module_ui/reserved_keyword_two_times_integrity_test.rs`
7 | }
| ^ consider adding a `main` function to `$DIR/tests/decl_module_ui/reserved_keyword_two_times_integrity_test.rs`
@@ -797,7 +797,7 @@ mod test_append_and_len {
TestExternalities::default().execute_with(|| {
let key = JustVec::hashed_key();
// Set it to some invalid value.
frame_support::storage::unhashed::put_raw(&key, &*b"1");
frame_support::storage::unhashed::put_raw(&key, b"1");
assert!(JustVec::get().is_empty());
assert_eq!(frame_support::storage::unhashed::get_raw(&key), Some(b"1".to_vec()));
@@ -1,7 +1,5 @@
error[E0369]: binary operation `==` cannot be applied to type `<T as Config>::C`
--> $DIR/partial_eq.rs:7:2
--> tests/derive_no_bound_ui/partial_eq.rs:7:2
|
7 | c: T::C,
| ^
|
= note: the trait `std::cmp::PartialEq` is not implemented for `<T as Config>::C`
@@ -19,8 +19,3 @@ error[E0369]: binary operation `==` cannot be applied to type `&<T as pallet::Co
|
20 | pub fn foo(origin: OriginFor<T>, bar: T::Bar) -> DispatchResultWithPostInfo {
| ^^^
|
help: consider further restricting this bound
|
17 | #[pallet::call + std::cmp::PartialEq]
| +++++++++++++++++++++
@@ -19,11 +19,6 @@ error[E0369]: binary operation `==` cannot be applied to type `&<T as pallet::Co
|
20 | pub fn foo(origin: OriginFor<T>, bar: T::Bar) -> DispatchResultWithPostInfo {
| ^^^
|
help: consider further restricting this bound
|
17 | #[pallet::call + std::cmp::PartialEq]
| +++++++++++++++++++++
error[E0277]: the trait bound `<T as pallet::Config>::Bar: WrapperTypeEncode` is not satisfied
--> tests/pallet_ui/call_argument_invalid_bound_2.rs:20:36
@@ -8,3 +8,7 @@ error[E0277]: `Bar` doesn't implement `std::fmt::Debug`
= note: add `#[derive(Debug)]` to `Bar` or manually `impl std::fmt::Debug for Bar`
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&Bar`
= note: required for the cast to the object type `dyn std::fmt::Debug`
help: consider annotating `Bar` with `#[derive(Debug)]`
|
17 | #[derive(Debug)]
|
@@ -4,4 +4,14 @@ error[E0277]: the trait bound `MyError: PalletError` is not satisfied
1 | #[frame_support::pallet]
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `PalletError` is not implemented for `MyError`
|
= help: the following other types implement trait `PalletError`:
()
(TupleElement0, TupleElement1)
(TupleElement0, TupleElement1, TupleElement2)
(TupleElement0, TupleElement1, TupleElement2, TupleElement3)
(TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4)
(TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5)
(TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6)
(TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7)
and 36 others
= note: this error originates in the derive macro `frame_support::PalletError` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -9,11 +9,6 @@ error[E0369]: binary operation `==` cannot be applied to type `&<T as pallet::Co
|
23 | B { b: T::Bar },
| ^
|
help: consider further restricting this bound
|
22 | pub enum Event<T: Config + std::cmp::PartialEq> {
| +++++++++++++++++++++
error[E0277]: `<T as pallet::Config>::Bar` doesn't implement `std::fmt::Debug`
--> tests/pallet_ui/event_field_not_member.rs:23:7
@@ -9,3 +9,7 @@ note: required by a bound in `GenesisBuild`
|
| pub trait GenesisBuild<T, I = ()>: Default + sp_runtime::traits::MaybeSerializeDeserialize {
| ^^^^^^^ required by this bound in `GenesisBuild`
help: consider annotating `pallet::GenesisConfig` with `#[derive(Default)]`
|
19 | #[derive(Default)]
|
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `Bar: WrapperTypeDecode` is not satisfied
10 | #[pallet::without_storage_info]
| ^^^^^^^^^^^^^^^^^^^^ the trait `WrapperTypeDecode` is not implemented for `Bar`
|
= help: the following other types implement trait `WrapperTypeDecode`:
Arc<T>
Box<T>
Rc<T>
frame_support::sp_runtime::sp_application_crypto::sp_core::Bytes
= note: required because of the requirements on the impl of `Decode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `PartialStorageInfoTrait` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
@@ -14,6 +19,16 @@ error[E0277]: the trait bound `Bar: EncodeLike` is not satisfied
10 | #[pallet::without_storage_info]
| ^^^^^^^^^^^^^^^^^^^^ the trait `EncodeLike` is not implemented for `Bar`
|
= help: the following other types implement trait `EncodeLike<T>`:
<&&T as EncodeLike<T>>
<&T as EncodeLike<T>>
<&T as EncodeLike>
<&[(K, V)] as EncodeLike<BTreeMap<LikeK, LikeV>>>
<&[(T,)] as EncodeLike<BTreeSet<LikeT>>>
<&[(T,)] as EncodeLike<BinaryHeap<LikeT>>>
<&[(T,)] as EncodeLike<LinkedList<LikeT>>>
<&[T] as EncodeLike<Vec<U>>>
and 273 others
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `PartialStorageInfoTrait` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
@@ -24,6 +39,16 @@ error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied
10 | #[pallet::without_storage_info]
| ^^^^^^^^^^^^^^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Bar`
|
= help: the following other types implement trait `WrapperTypeEncode`:
&T
&mut T
Arc<T>
Box<T>
Cow<'a, T>
Rc<T>
Vec<T>
frame_support::sp_runtime::sp_application_crypto::sp_core::Bytes
and 2 others
= note: required because of the requirements on the impl of `Encode` for `Bar`
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
@@ -35,6 +60,16 @@ error[E0277]: the trait bound `Bar: TypeInfo` is not satisfied
21 | #[pallet::storage]
| ^^^^^^^ the trait `TypeInfo` is not implemented for `Bar`
|
= help: the following other types implement trait `TypeInfo`:
&T
&mut T
()
(A, B)
(A, B, C)
(A, B, C, D)
(A, B, C, D, E)
(A, B, C, D, E, F)
and 158 others
= note: required because of the requirements on the impl of `StaticTypeInfo` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
@@ -44,6 +79,11 @@ error[E0277]: the trait bound `Bar: WrapperTypeDecode` is not satisfied
21 | #[pallet::storage]
| ^^^^^^^ the trait `WrapperTypeDecode` is not implemented for `Bar`
|
= help: the following other types implement trait `WrapperTypeDecode`:
Arc<T>
Box<T>
Rc<T>
frame_support::sp_runtime::sp_application_crypto::sp_core::Bytes
= note: required because of the requirements on the impl of `Decode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
@@ -54,6 +94,16 @@ error[E0277]: the trait bound `Bar: EncodeLike` is not satisfied
21 | #[pallet::storage]
| ^^^^^^^ the trait `EncodeLike` is not implemented for `Bar`
|
= help: the following other types implement trait `EncodeLike<T>`:
<&&T as EncodeLike<T>>
<&T as EncodeLike<T>>
<&T as EncodeLike>
<&[(K, V)] as EncodeLike<BTreeMap<LikeK, LikeV>>>
<&[(T,)] as EncodeLike<BTreeSet<LikeT>>>
<&[(T,)] as EncodeLike<BinaryHeap<LikeT>>>
<&[(T,)] as EncodeLike<LinkedList<LikeT>>>
<&[T] as EncodeLike<Vec<U>>>
and 273 others
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
@@ -64,6 +114,16 @@ error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied
21 | #[pallet::storage]
| ^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Bar`
|
= help: the following other types implement trait `WrapperTypeEncode`:
&T
&mut T
Arc<T>
Box<T>
Cow<'a, T>
Rc<T>
Vec<T>
frame_support::sp_runtime::sp_application_crypto::sp_core::Bytes
and 2 others
= note: required because of the requirements on the impl of `Encode` for `Bar`
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
@@ -4,6 +4,11 @@ error[E0277]: the trait bound `Bar: WrapperTypeDecode` is not satisfied
10 | #[pallet::without_storage_info]
| ^^^^^^^^^^^^^^^^^^^^ the trait `WrapperTypeDecode` is not implemented for `Bar`
|
= help: the following other types implement trait `WrapperTypeDecode`:
Arc<T>
Box<T>
Rc<T>
frame_support::sp_runtime::sp_application_crypto::sp_core::Bytes
= note: required because of the requirements on the impl of `Decode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `PartialStorageInfoTrait` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
@@ -14,6 +19,16 @@ error[E0277]: the trait bound `Bar: EncodeLike` is not satisfied
10 | #[pallet::without_storage_info]
| ^^^^^^^^^^^^^^^^^^^^ the trait `EncodeLike` is not implemented for `Bar`
|
= help: the following other types implement trait `EncodeLike<T>`:
<&&T as EncodeLike<T>>
<&T as EncodeLike<T>>
<&T as EncodeLike>
<&[(K, V)] as EncodeLike<BTreeMap<LikeK, LikeV>>>
<&[(T,)] as EncodeLike<BTreeSet<LikeT>>>
<&[(T,)] as EncodeLike<BinaryHeap<LikeT>>>
<&[(T,)] as EncodeLike<LinkedList<LikeT>>>
<&[T] as EncodeLike<Vec<U>>>
and 273 others
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `PartialStorageInfoTrait` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
@@ -24,6 +39,16 @@ error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied
10 | #[pallet::without_storage_info]
| ^^^^^^^^^^^^^^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Bar`
|
= help: the following other types implement trait `WrapperTypeEncode`:
&T
&mut T
Arc<T>
Box<T>
Cow<'a, T>
Rc<T>
Vec<T>
frame_support::sp_runtime::sp_application_crypto::sp_core::Bytes
and 2 others
= note: required because of the requirements on the impl of `Encode` for `Bar`
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
@@ -35,6 +60,16 @@ error[E0277]: the trait bound `Bar: TypeInfo` is not satisfied
21 | #[pallet::storage]
| ^^^^^^^ the trait `TypeInfo` is not implemented for `Bar`
|
= help: the following other types implement trait `TypeInfo`:
&T
&mut T
()
(A, B)
(A, B, C)
(A, B, C, D)
(A, B, C, D, E)
(A, B, C, D, E, F)
and 158 others
= note: required because of the requirements on the impl of `StaticTypeInfo` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
@@ -44,6 +79,11 @@ error[E0277]: the trait bound `Bar: WrapperTypeDecode` is not satisfied
21 | #[pallet::storage]
| ^^^^^^^ the trait `WrapperTypeDecode` is not implemented for `Bar`
|
= help: the following other types implement trait `WrapperTypeDecode`:
Arc<T>
Box<T>
Rc<T>
frame_support::sp_runtime::sp_application_crypto::sp_core::Bytes
= note: required because of the requirements on the impl of `Decode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
@@ -54,6 +94,16 @@ error[E0277]: the trait bound `Bar: EncodeLike` is not satisfied
21 | #[pallet::storage]
| ^^^^^^^ the trait `EncodeLike` is not implemented for `Bar`
|
= help: the following other types implement trait `EncodeLike<T>`:
<&&T as EncodeLike<T>>
<&T as EncodeLike<T>>
<&T as EncodeLike>
<&[(K, V)] as EncodeLike<BTreeMap<LikeK, LikeV>>>
<&[(T,)] as EncodeLike<BTreeSet<LikeT>>>
<&[(T,)] as EncodeLike<BinaryHeap<LikeT>>>
<&[(T,)] as EncodeLike<LinkedList<LikeT>>>
<&[T] as EncodeLike<Vec<U>>>
and 273 others
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
@@ -64,6 +114,16 @@ error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied
21 | #[pallet::storage]
| ^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Bar`
|
= help: the following other types implement trait `WrapperTypeEncode`:
&T
&mut T
Arc<T>
Box<T>
Cow<'a, T>
Rc<T>
Vec<T>
frame_support::sp_runtime::sp_application_crypto::sp_core::Bytes
and 2 others
= note: required because of the requirements on the impl of `Encode` for `Bar`
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
@@ -4,4 +4,14 @@ error[E0277]: the trait bound `Bar: MaxEncodedLen` is not satisfied
9 | #[pallet::pallet]
| ^^^^^^ the trait `MaxEncodedLen` is not implemented for `Bar`
|
= help: the following other types implement trait `MaxEncodedLen`:
()
(TupleElement0, TupleElement1)
(TupleElement0, TupleElement1, TupleElement2)
(TupleElement0, TupleElement1, TupleElement2, TupleElement3)
(TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4)
(TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5)
(TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6)
(TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7)
and 70 others
= note: required because of the requirements on the impl of `StorageInfoTrait` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
@@ -4,5 +4,15 @@ error[E0277]: the trait bound `Bar: MaxEncodedLen` is not satisfied
12 | #[pallet::pallet]
| ^^^^^^ the trait `MaxEncodedLen` is not implemented for `Bar`
|
= help: the following other types implement trait `MaxEncodedLen`:
()
(TupleElement0, TupleElement1)
(TupleElement0, TupleElement1, TupleElement2)
(TupleElement0, TupleElement1, TupleElement2, TupleElement3)
(TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4)
(TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5)
(TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6)
(TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7)
and 70 others
= note: required because of the requirements on the impl of `KeyGeneratorMaxEncodedLen` for `Key<frame_support::Twox64Concat, Bar>`
= note: required because of the requirements on the impl of `StorageInfoTrait` for `frame_support::pallet_prelude::StorageNMap<_GeneratedPrefixForStorageFoo<T>, Key<frame_support::Twox64Concat, Bar>, u32>`
@@ -613,7 +613,7 @@ fn generate_api_impl_for_runtime_api(impls: &[ItemImpl]) -> Result<TokenStream>
let mut visitor = ApiRuntimeImplToApiRuntimeApiImpl {
runtime_block,
runtime_mod_path: &runtime_mod_path,
runtime_type: &*runtime_type,
runtime_type,
trait_generic_arguments: &trait_generic_arguments,
impl_trait: &impl_trait.ident,
};
@@ -104,10 +104,46 @@ where
/// A bounded slice.
///
/// Similar to a `BoundedVec`, but not owned and cannot be decoded.
#[derive(Encode, scale_info::TypeInfo)]
#[scale_info(skip_type_params(S))]
#[derive(Encode)]
pub struct BoundedSlice<'a, T, S>(pub(super) &'a [T], PhantomData<S>);
// This can be replaced with
// #[derive(scale_info::TypeInfo)]
// #[scale_info(skip_type_params(S))]
// again once this issue is fixed in the rust compiler: https://github.com/rust-lang/rust/issues/96956
// Tracking issues: https://github.com/paritytech/substrate/issues/11915
impl<'a, T, S> scale_info::TypeInfo for BoundedSlice<'a, T, S>
where
&'a [T]: scale_info::TypeInfo + 'static,
PhantomData<S>: scale_info::TypeInfo + 'static,
T: scale_info::TypeInfo + 'static,
S: 'static,
{
type Identity = Self;
fn type_info() -> ::scale_info::Type {
scale_info::Type::builder()
.path(scale_info::Path::new("BoundedSlice", "sp_runtime::bounded::bounded_vec"))
.type_params(<[_]>::into_vec(Box::new([
scale_info::TypeParameter::new(
"T",
core::option::Option::Some(::scale_info::meta_type::<T>()),
),
scale_info::TypeParameter::new("S", ::core::option::Option::None),
])))
.docs(&[
"A bounded slice.",
"",
"Similar to a `BoundedVec`, but not owned and cannot be decoded.",
])
.composite(
scale_info::build::Fields::unnamed()
.field(|f| f.ty::<&'static [T]>().type_name("&'static[T]").docs(&[]))
.field(|f| f.ty::<PhantomData<S>>().type_name("PhantomData<S>").docs(&[])),
)
}
}
// `BoundedSlice`s encode to something which will always decode into a `BoundedVec`,
// `WeakBoundedVec`, or a `Vec`.
impl<'a, T: Encode + Decode, S: Get<u32>> EncodeLike<BoundedVec<T, S>> for BoundedSlice<'a, T, S> {}
+31 -1
View File
@@ -24,7 +24,7 @@ use crate::{
use core::ops::Sub;
/// Piecewise Linear function in [0, 1] -> [0, 1].
#[derive(PartialEq, Eq, sp_core::RuntimeDebug, scale_info::TypeInfo)]
#[derive(PartialEq, Eq, sp_core::RuntimeDebug)]
pub struct PiecewiseLinear<'a> {
/// Array of points. Must be in order from the lowest abscissas to the highest.
pub points: &'a [(Perbill, Perbill)],
@@ -32,6 +32,36 @@ pub struct PiecewiseLinear<'a> {
pub maximum: Perbill,
}
// This can be replaced with
// #[derive(scale_info::TypeInfo)]
// #[scale_info(skip_type_params(S))]
// again once this issue is fixed in the rust compiler: https://github.com/rust-lang/rust/issues/96956
// Tracking issues: https://github.com/paritytech/substrate/issues/11915
impl scale_info::TypeInfo for PiecewiseLinear<'static> {
type Identity = Self;
fn type_info() -> ::scale_info::Type {
scale_info::Type::builder()
.path(scale_info::Path::new("PiecewiseLinear", "sp_runtime::curve"))
.type_params(crate::Vec::new())
.docs(&["Piecewise Linear function in [0, 1] -> [0, 1]."])
.composite(
scale_info::build::Fields::named()
.field(|f| {
f.ty::<&'static[(Perbill, Perbill)]>()
.name("points")
.type_name("&'static[(Perbill, Perbill)]")
.docs(&["Array of points. Must be in order from the lowest abscissas to the highest."])
})
.field(|f| {
f.ty::<Perbill>()
.name("maximum")
.type_name("Perbill")
.docs(&["The maximum value that can be returned."])
}),
)
}
}
fn abs_sub<N: Ord + Sub<Output = N> + Clone>(a: N, b: N) -> N where {
a.clone().max(b.clone()) - a.min(b)
}
+1 -1
View File
@@ -55,7 +55,7 @@ pub trait Lazy<T: ?Sized> {
impl<'a> Lazy<[u8]> for &'a [u8] {
fn get(&mut self) -> &[u8] {
&**self
self
}
}
+6 -6
View File
@@ -280,7 +280,7 @@ where
L: TrieConfiguration,
DB: hash_db::HashDBRef<L::Hash, trie_db::DBValue>,
{
TrieDB::<L>::new(&*db, root)?.get(key).map(|x| x.map(|val| val.to_vec()))
TrieDB::<L>::new(db, root)?.get(key).map(|x| x.map(|val| val.to_vec()))
}
/// Read a value from the trie with given Query.
@@ -295,7 +295,7 @@ where
Q: Query<L::Hash, Item = DBValue>,
DB: hash_db::HashDBRef<L::Hash, trie_db::DBValue>,
{
TrieDB::<L>::new(&*db, root)?
TrieDB::<L>::new(db, root)?
.get_with(key, query)
.map(|x| x.map(|val| val.to_vec()))
}
@@ -354,7 +354,7 @@ pub fn record_all_keys<L: TrieConfiguration, DB>(
where
DB: hash_db::HashDBRef<L::Hash, trie_db::DBValue>,
{
let trie = TrieDB::<L>::new(&*db, root)?;
let trie = TrieDB::<L>::new(db, root)?;
let iter = trie.iter()?;
for x in iter {
@@ -379,7 +379,7 @@ pub fn read_child_trie_value<L: TrieConfiguration, DB>(
where
DB: hash_db::HashDBRef<L::Hash, trie_db::DBValue>,
{
let db = KeySpacedDB::new(&*db, keyspace);
let db = KeySpacedDB::new(db, keyspace);
TrieDB::<L>::new(&db, root)?.get(key).map(|x| x.map(|val| val.to_vec()))
}
@@ -400,7 +400,7 @@ where
// root is fetched from DB, not writable by runtime, so it's always valid.
root.as_mut().copy_from_slice(root_slice);
let db = KeySpacedDB::new(&*db, keyspace);
let db = KeySpacedDB::new(db, keyspace);
TrieDB::<L>::new(&db, &root)?
.get_with(key, query)
.map(|x| x.map(|val| val.to_vec()))
@@ -501,7 +501,7 @@ where
T: Default + PartialEq<T> + for<'b> From<&'b [u8]> + Clone + Send + Sync,
{
fn as_hash_db(&self) -> &dyn hash_db::HashDB<H, T> {
&*self
self
}
fn as_hash_db_mut<'b>(&'b mut self) -> &'b mut (dyn hash_db::HashDB<H, T> + 'b) {
@@ -37,7 +37,7 @@ pub fn decl_runtime_version_impl(input: proc_macro::TokenStream) -> proc_macro::
}
fn decl_runtime_version_impl_inner(item: ItemConst) -> Result<TokenStream> {
let runtime_version = ParseRuntimeVersion::parse_expr(&*item.expr)?.build(item.expr.span())?;
let runtime_version = ParseRuntimeVersion::parse_expr(&item.expr)?.build(item.expr.span())?;
let link_section =
generate_emit_link_section_decl(&runtime_version.encode(), "runtime_version");
+1
View File
@@ -21,3 +21,4 @@ match_block_trailing_comma = true
trailing_comma = "Vertical"
trailing_semicolon = false
use_field_init_shorthand = true
edition = "2021"
@@ -130,7 +130,7 @@ pub enum Transport {
impl Transport {
fn as_client(&self) -> Option<&WsClient> {
match self {
Self::RemoteClient(client) => Some(&*client),
Self::RemoteClient(client) => Some(client),
_ => None,
}
}