diff --git a/Cargo.lock b/Cargo.lock index 2d222269db39754a629341eed02674859eed21af..8bfee84743004693780af7813e4f36202d279a70 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3025,6 +3025,7 @@ dependencies = [ "sp-authority-discovery", "sp-block-builder", "sp-consensus-babe", + "sp-consensus-grandpa", "sp-core", "sp-inherents", "sp-io", diff --git a/node/src/cli.rs b/node/src/cli.rs index 3cfdc73c383a8cf45123662aef8ede9e48f8f873..e1f62481f5ae63ca53e5b5096c29f5e1a6632502 100644 --- a/node/src/cli.rs +++ b/node/src/cli.rs @@ -75,7 +75,7 @@ pub enum Subcommand { /// Sub-commands concerned with benchmarking. /// The pallet benchmarking moved to the `pallet` sub-command. #[clap(subcommand)] - Benchmark(frame_benchmarking_cli::BenchmarkCmd), + Benchmark(Box<frame_benchmarking_cli::BenchmarkCmd>), /// Try some command against runtime state. #[cfg(feature = "try-runtime")] diff --git a/node/src/command.rs b/node/src/command.rs index d151a7fb6529c6ed437720228aa735726c068240..90bf1bd5d99e201dba2cf5f23502b1ee9eb3c1d4 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -311,11 +311,11 @@ pub fn run() -> sc_cli::Result<()> { } #[cfg(feature = "runtime-benchmarks")] Some(Subcommand::Benchmark(cmd)) => { - let runner = cli.create_runner(cmd)?; + let runner = cli.create_runner(&**cmd)?; let chain_spec = &runner.config().chain_spec; ensure_dev(chain_spec)?; - match cmd { + match &**cmd { BenchmarkCmd::Storage(cmd) => runner.sync_run(|mut config| { let (client, backend, _, _) = service::new_chain_ops(&mut config, false)?; let db = backend.expose_db(); diff --git a/node/src/rpc.rs b/node/src/rpc.rs index 036f63eb883ad8c2e4c5ac120eca5e78159d9974..301d4ce9febc08b08b9f4adfec31b5b1664e4ead 100644 --- a/node/src/rpc.rs +++ b/node/src/rpc.rs @@ -104,7 +104,7 @@ where module.merge( Babe::new( client.clone(), - babe_worker_handle.clone(), + babe_worker_handle, keystore, select_chain, deny_unsafe, @@ -113,7 +113,7 @@ where )?; } module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?; - module.merge(TransactionPayment::new(client.clone()).into_rpc())?; + module.merge(TransactionPayment::new(client).into_rpc())?; if let Some(command_sink) = command_sink_opt { // We provide the rpc handler with the sending end of the channel to allow the rpc // send EngineCommands to the background block authorship task. diff --git a/node/src/service.rs b/node/src/service.rs index 18162b7db146cca0899585e29c86eb758d8f7ae6..49b51a387656cf82cab1a911ec05eea2e53389e7 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -276,9 +276,10 @@ where client.clone(), ); + let client_ = client.clone(); let (grandpa_block_import, grandpa_link) = sc_consensus_grandpa::block_import( client.clone(), - &(client.clone() as Arc<_>), + &(client_ as Arc<_>), select_chain.clone(), telemetry.as_ref().map(|x| x.handle()), )?; @@ -555,17 +556,13 @@ where let rpc_extensions_builder = { let client = client.clone(); let pool = transaction_pool.clone(); - let select_chain = select_chain.clone(); + let select_chain = select_chain; let chain_spec = config.chain_spec.cloned_box(); let keystore = keystore_container.keystore().clone(); - let babe_deps = if let Some(babe_worker_handle) = babe_worker_handle { - Some(crate::rpc::BabeDeps { - babe_worker_handle: babe_worker_handle.clone(), - keystore: keystore.clone(), - }) - } else { - None - }; + let babe_deps = babe_worker_handle.map(|babe_worker_handle| crate::rpc::BabeDeps { + babe_worker_handle, + keystore: keystore.clone(), + }); Box::new(move |deny_unsafe, _| { let deps = crate::rpc::FullDeps { @@ -627,8 +624,8 @@ where let grandpa_config = sc_consensus_grandpa::GrandpaParams { config: grandpa_config, link: grandpa_link, - sync: sync_service.clone(), - network: network.clone(), + sync: sync_service, + network, voting_rule: sc_consensus_grandpa::VotingRulesBuilder::default().build(), prometheus_registry, shared_voter_state: SharedVoterState::empty(), diff --git a/pallets/offences/src/mock.rs b/pallets/offences/src/mock.rs index 1229f75591881beefe3606ac98d515fd2497c6b6..57f8e73990729b2822f1b515b9f4059fe94d44de 100644 --- a/pallets/offences/src/mock.rs +++ b/pallets/offences/src/mock.rs @@ -114,7 +114,7 @@ pub const KIND: [u8; 16] = *b"test_report_1234"; /// Returns all offence details for the specific `kind` happened at the specific time slot. pub fn offence_reports(kind: Kind, time_slot: u128) -> Vec<OffenceDetails<u64, u64>> { - <crate::ConcurrentReportsIndex<Runtime>>::get(kind, &time_slot.encode()) + <crate::ConcurrentReportsIndex<Runtime>>::get(kind, time_slot.encode()) .into_iter() .map(|report_id| { <crate::Reports<Runtime>>::get(report_id) diff --git a/runtime/common/src/pallets_config.rs b/runtime/common/src/pallets_config.rs index 043b8c67571a60b86782d8f3374be68410f23af2..fe2e8c240230029628f285414743988de628ebde 100644 --- a/runtime/common/src/pallets_config.rs +++ b/runtime/common/src/pallets_config.rs @@ -160,12 +160,12 @@ macro_rules! pallets_config { } // Take Dust from Balances and put it in the Treasury pot - use crate::sp_api_hidden_includes_construct_runtime::hidden_include::traits::Currency; - use crate::sp_api_hidden_includes_construct_runtime::hidden_include::traits::Imbalance; pub struct HandleDust; type CreditOf = frame_support::traits::tokens::fungible::Credit<AccountId, Balances>; impl frame_support::traits::OnUnbalanced<CreditOf> for HandleDust { fn on_nonzero_unbalanced(amount: CreditOf) { + use frame_support::traits::Currency as _; + use frame_support::traits::Imbalance as _; let imbalance = NegativeImbalance::new(amount.peek()); Balances::resolve_creating(&Treasury::account_id(), imbalance); } diff --git a/runtime/common/src/weights/pallet_grandpa.rs b/runtime/common/src/weights/pallet_grandpa.rs index b824f4c9d5167c655a55e0c73ddc373e811867dc..c30daf2614ff976b19499ea659e98a994037c6b0 100644 --- a/runtime/common/src/weights/pallet_grandpa.rs +++ b/runtime/common/src/weights/pallet_grandpa.rs @@ -36,7 +36,7 @@ impl<T: frame_system::Config> pallet_grandpa::WeightInfo for WeightInfo<T> { // checking membership proof (Weight::from_parts(WEIGHT_REF_TIME_PER_MICROS, 0) * 35) - .saturating_add((Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS, 0) * 175)) + .saturating_add(Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS, 0) * 175) .saturating_mul(validator_count) .saturating_add(T::DbWeight::get().reads(5)) // check equivocation proof diff --git a/runtime/g1/src/lib.rs b/runtime/g1/src/lib.rs index 3d34f0ef04962644b4eb8d8f59c3da5d40e4b971..e4c2435cc1b7217f9d7113cdda58a5aae6215f61 100644 --- a/runtime/g1/src/lib.rs +++ b/runtime/g1/src/lib.rs @@ -257,7 +257,7 @@ construct_runtime!( // Consensus support. AuthorityMembers: pallet_authority_members::{Pallet, Call, Storage, Config<T>, Event<T>} = 10, - Authorship: pallet_authorship::{Pallet, Call, Storage} = 11, + Authorship: pallet_authorship::{Pallet, Storage} = 11, Offences: pallet_offences::{Pallet, Storage, Event} = 12, Historical: session_historical::{Pallet} = 13, Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 14, diff --git a/runtime/gdev/Cargo.toml b/runtime/gdev/Cargo.toml index 8f51cf101c90d6d6e9f26b2521fadf17129fedfa..76d647fbe1ec8ca769cf0bc6f851fea4845754d7 100644 --- a/runtime/gdev/Cargo.toml +++ b/runtime/gdev/Cargo.toml @@ -187,6 +187,7 @@ sp-arithmetic = { git = 'https://github.com/duniter/substrate', branch = 'dunite sp-authority-discovery = { git = 'https://github.com/duniter/substrate', branch = 'duniter-substrate-v0.9.42', default-features = false } sp-block-builder = { git = 'https://github.com/duniter/substrate', branch = 'duniter-substrate-v0.9.42', default-features = false } sp-consensus-babe = { git = 'https://github.com/duniter/substrate', branch = 'duniter-substrate-v0.9.42', default-features = false } +sp-consensus-grandpa = { git = 'https://github.com/duniter/substrate', branch = 'duniter-substrate-v0.9.42', default-features = false } sp-core = { git = 'https://github.com/duniter/substrate', branch = 'duniter-substrate-v0.9.42', default-features = false } sp-inherents = { git = 'https://github.com/duniter/substrate', branch = 'duniter-substrate-v0.9.42', default-features = false } sp-offchain = { git = 'https://github.com/duniter/substrate', branch = 'duniter-substrate-v0.9.42', default-features = false } diff --git a/runtime/gdev/tests/common/mod.rs b/runtime/gdev/tests/common/mod.rs index 12e708e6513a73290cb2ff11c617d5f5127b72d3..8f630fdd0316ccd2c620a0999bf5a83fdf57b486 100644 --- a/runtime/gdev/tests/common/mod.rs +++ b/runtime/gdev/tests/common/mod.rs @@ -22,10 +22,10 @@ use frame_support::instances::{Instance1, Instance2}; use frame_support::traits::{GenesisBuild, OnFinalize, OnInitialize}; use gdev_runtime::opaque::SessionKeys; use gdev_runtime::*; -use sc_consensus_grandpa::AuthorityId as GrandpaId; use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; use sp_consensus_babe::{AuthorityId as BabeId, Slot}; -use sp_consensus_vrf::schnorrkel::{VRFOutput, VRFProof}; +use sp_consensus_babe::{VrfOutput, VrfProof}; +use sp_consensus_grandpa::AuthorityId as GrandpaId; use sp_core::crypto::IsWrappedBy; use sp_core::sr25519; use sp_core::{Encode, Pair, Public, H256}; diff --git a/runtime/gdev/tests/integration_tests.rs b/runtime/gdev/tests/integration_tests.rs index 22d1fb05626ce146ea8fde5e57fe23c0b0d0af4f..282180349b720206ecd2e0bfe4d3922ee39ec886 100644 --- a/runtime/gdev/tests/integration_tests.rs +++ b/runtime/gdev/tests/integration_tests.rs @@ -479,7 +479,7 @@ fn test_create_new_account() { MultiAddress::Id(AccountKeyring::Alice.to_account_id()), 200 ), - pallet_balances::Error::<Runtime>::KeepAlive, + pallet_balances::Error::<Runtime>::Expendability, ); assert_eq!( Balances::free_balance(AccountKeyring::Eve.to_account_id()), diff --git a/runtime/gtest/src/lib.rs b/runtime/gtest/src/lib.rs index ea65433a53734fd2267cecd2375599de405a9edf..0e1ca05c297d38a7b6646b3527db3253cb1d216f 100644 --- a/runtime/gtest/src/lib.rs +++ b/runtime/gtest/src/lib.rs @@ -273,7 +273,7 @@ construct_runtime!( // Consensus support AuthorityMembers: pallet_authority_members::{Pallet, Call, Storage, Config<T>, Event<T>} = 10, - Authorship: pallet_authorship::{Pallet, Call, Storage} = 11, + Authorship: pallet_authorship::{Pallet, Storage} = 11, Offences: pallet_offences::{Pallet, Storage, Event} = 12, Historical: session_historical::{Pallet} = 13, Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 14,