diff --git a/.github/env b/.github/env index 088d7c6914..17e6bea555 100644 --- a/.github/env +++ b/.github/env @@ -1,2 +1,2 @@ -RUST_STABLE_VERSION=1.76.0 -RUST_NIGHTLY_VERSION=2024-03-14 +RUST_STABLE_VERSION=1.77.0 +RUST_NIGHTLY_VERSION=2024-04-14 diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index 3e19c20bef..cec099296a 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -36,4 +36,5 @@ jobs: - name: Clippy run: cargo +nightly-$RUST_NIGHTLY_VERSION clippy --all-targets --locked -q env: + RUSTFLAGS: "-D warnings" SKIP_WASM_BUILD: 1 diff --git a/chain-spec-generator/src/common.rs b/chain-spec-generator/src/common.rs index 2c2fe95ff8..c76e20c865 100644 --- a/chain-spec-generator/src/common.rs +++ b/chain-spec-generator/src/common.rs @@ -67,7 +67,7 @@ struct EmptyChainSpecWithId { pub fn from_json_file(filepath: &str, supported: String) -> Result, String> { let path = std::path::PathBuf::from(&filepath); - let file = std::fs::File::open(&filepath).expect("Failed to open file"); + let file = std::fs::File::open(filepath).expect("Failed to open file"); let reader = std::io::BufReader::new(file); let chain_spec: EmptyChainSpecWithId = serde_json::from_reader(reader) .expect("Failed to read 'json' file with ChainSpec configuration"); diff --git a/chain-spec-generator/src/main.rs b/chain-spec-generator/src/main.rs index eb4f7185e1..4a72781717 100644 --- a/chain-spec-generator/src/main.rs +++ b/chain-spec-generator/src/main.rs @@ -38,63 +38,51 @@ fn main() -> Result<(), String> { let supported_chains = HashMap::<_, Box Result, String>>>::from([ - ( - "polkadot-dev", - Box::new(|| relay_chain_specs::polkadot_development_config()) as Box<_>, - ), + ("polkadot-dev", Box::new(relay_chain_specs::polkadot_development_config) as Box<_>), ( "polkadot-local", - Box::new(|| relay_chain_specs::polkadot_local_testnet_config()) as Box<_>, - ), - ("kusama-dev", Box::new(|| relay_chain_specs::kusama_development_config()) as Box<_>), - ( - "kusama-local", - Box::new(|| relay_chain_specs::kusama_local_testnet_config()) as Box<_>, + Box::new(relay_chain_specs::polkadot_local_testnet_config) as Box<_>, ), + ("kusama-dev", Box::new(relay_chain_specs::kusama_development_config) as Box<_>), + ("kusama-local", Box::new(relay_chain_specs::kusama_local_testnet_config) as Box<_>), ( "asset-hub-kusama-local", - Box::new(|| system_parachains_specs::asset_hub_kusama_local_testnet_config()) - as Box<_>, + Box::new(system_parachains_specs::asset_hub_kusama_local_testnet_config) as Box<_>, ), ( "asset-hub-polkadot-local", - Box::new(|| system_parachains_specs::asset_hub_polkadot_local_testnet_config()) + Box::new(system_parachains_specs::asset_hub_polkadot_local_testnet_config) as Box<_>, ), ( "collectives-polkadot-local", - Box::new(|| system_parachains_specs::collectives_polkadot_local_testnet_config()) + Box::new(system_parachains_specs::collectives_polkadot_local_testnet_config) as Box<_>, ), ( "bridge-hub-polkadot-local", - Box::new(|| system_parachains_specs::bridge_hub_polkadot_local_testnet_config()) + Box::new(system_parachains_specs::bridge_hub_polkadot_local_testnet_config) as Box<_>, ), ( "bridge-hub-kusama-local", - Box::new(|| system_parachains_specs::bridge_hub_kusama_local_testnet_config()) - as Box<_>, + Box::new(system_parachains_specs::bridge_hub_kusama_local_testnet_config) as Box<_>, ), ( "glutton-kusama-local", - Box::new(|| system_parachains_specs::glutton_kusama_local_testnet_config()) - as Box<_>, + Box::new(system_parachains_specs::glutton_kusama_local_testnet_config) as Box<_>, ), ( "encointer-kusama-local", - Box::new(|| system_parachains_specs::encointer_kusama_local_testnet_config()) - as Box<_>, + Box::new(system_parachains_specs::encointer_kusama_local_testnet_config) as Box<_>, ), ( "coretime-kusama-local", - Box::new(|| system_parachains_specs::coretime_kusama_local_testnet_config()) - as Box<_>, + Box::new(system_parachains_specs::coretime_kusama_local_testnet_config) as Box<_>, ), ( "people-kusama-local", - Box::new(|| system_parachains_specs::people_kusama_local_testnet_config()) - as Box<_>, + Box::new(system_parachains_specs::people_kusama_local_testnet_config) as Box<_>, ), ]); @@ -104,7 +92,7 @@ fn main() -> Result<(), String> { Ok(()) } else { let supported = supported_chains.keys().enumerate().fold(String::new(), |c, (n, k)| { - let extra = (n + 1 < supported_chains.len()).then(|| ", ").unwrap_or(""); + let extra = if n + 1 < supported_chains.len() { ", " } else { "" }; format!("{c}{k}{extra}") }); if cli.chain.ends_with(".json") { diff --git a/chain-spec-generator/src/relay_chain_specs.rs b/chain-spec-generator/src/relay_chain_specs.rs index 3fb70efdd0..63caaeb44d 100644 --- a/chain-spec-generator/src/relay_chain_specs.rs +++ b/chain-spec-generator/src/relay_chain_specs.rs @@ -180,6 +180,7 @@ fn testnet_accounts() -> Vec { ] } +#[allow(clippy::type_complexity)] pub fn polkadot_testnet_genesis( initial_authorities: Vec<( AccountId, @@ -242,6 +243,7 @@ pub fn polkadot_testnet_genesis( }) } +#[allow(clippy::type_complexity)] pub fn kusama_testnet_genesis( initial_authorities: Vec<( AccountId, diff --git a/integration-tests/emulated/chains/relays/kusama/src/genesis.rs b/integration-tests/emulated/chains/relays/kusama/src/genesis.rs index 7fcd30571d..cc0b844516 100644 --- a/integration-tests/emulated/chains/relays/kusama/src/genesis.rs +++ b/integration-tests/emulated/chains/relays/kusama/src/genesis.rs @@ -37,6 +37,7 @@ mod validators { use super::*; use parachains_common::AccountId; + #[allow(clippy::type_complexity)] pub fn initial_authorities() -> Vec<( AccountId, AccountId, diff --git a/integration-tests/emulated/chains/relays/polkadot/src/genesis.rs b/integration-tests/emulated/chains/relays/polkadot/src/genesis.rs index 9451c70e68..36ea0bfff1 100644 --- a/integration-tests/emulated/chains/relays/polkadot/src/genesis.rs +++ b/integration-tests/emulated/chains/relays/polkadot/src/genesis.rs @@ -39,6 +39,7 @@ mod validators { use super::*; use parachains_common::AccountId; + #[allow(clippy::type_complexity)] pub fn initial_authorities() -> Vec<( AccountId, AccountId, diff --git a/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/reserve_transfer.rs b/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/reserve_transfer.rs index 22a1419f98..38714e6d90 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/reserve_transfer.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/reserve_transfer.rs @@ -107,7 +107,7 @@ fn para_to_system_para_receiver_assertions(t: ParaToSystemParaTest) { RuntimeEvent::Balances( pallet_balances::Event::Burned { who, amount } ) => { - who: *who == sov_penpal_on_ahk.clone().into(), + who: *who == sov_penpal_on_ahk.clone(), amount: *amount == t.args.amount, }, RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {}, @@ -267,7 +267,7 @@ fn para_to_para_limited_reserve_transfer_assets(t: ParaToParaTest) -> DispatchRe /// Reserve Transfers of native asset from Relay Chain to the System Parachain shouldn't work #[test] fn reserve_transfer_native_asset_from_relay_to_system_para_fails() { - let signed_origin = ::RuntimeOrigin::signed(KusamaSender::get().into()); + let signed_origin = ::RuntimeOrigin::signed(KusamaSender::get()); let destination = Kusama::child_location_of(AssetHubKusama::para_id()); let beneficiary: Location = AccountId32Junction { network: None, id: AssetHubKusamaReceiver::get().into() }.into(); @@ -301,7 +301,7 @@ fn reserve_transfer_native_asset_from_relay_to_system_para_fails() { fn reserve_transfer_native_asset_from_system_para_to_relay_fails() { // Init values for System Parachain let signed_origin = - ::RuntimeOrigin::signed(AssetHubKusamaSender::get().into()); + ::RuntimeOrigin::signed(AssetHubKusamaSender::get()); let destination = AssetHubKusama::parent_location(); let beneficiary_id = KusamaReceiver::get(); let beneficiary: Location = @@ -444,7 +444,7 @@ fn reserve_transfer_native_asset_from_para_to_system_para() { let sov_penpal_on_ahk = AssetHubKusama::sovereign_account_id_of(penpal_location_as_seen_by_ahk); // fund the Penpal's SA on AHK with the native tokens held in reserve - AssetHubKusama::fund_accounts(vec![(sov_penpal_on_ahk.into(), amount_to_send * 2)]); + AssetHubKusama::fund_accounts(vec![(sov_penpal_on_ahk, amount_to_send * 2)]); test.set_assertion::(para_to_system_para_sender_assertions); test.set_assertion::(para_to_system_para_receiver_assertions); @@ -527,7 +527,7 @@ fn reserve_transfer_assets_from_system_para_to_para() { // Create SA-of-Penpal-on-AHK with ED. let penpal_location = AssetHubKusama::sibling_location_of(PenpalA::para_id()); let sov_penpal_on_ahk = AssetHubKusama::sovereign_account_id_of(penpal_location); - AssetHubKusama::fund_accounts(vec![(sov_penpal_on_ahk.into(), KUSAMA_ED)]); + AssetHubKusama::fund_accounts(vec![(sov_penpal_on_ahk, KUSAMA_ED)]); let sender_balance_before = test.sender.balance; let receiver_balance_before = test.receiver.balance; @@ -598,7 +598,7 @@ fn reserve_transfer_native_asset_from_para_to_para() { let sov_of_sender_on_relay = Kusama::sovereign_account_id_of(sender_as_seen_by_relay); // fund the PenpalA's SA on Kusama with the native tokens held in reserve - Kusama::fund_accounts(vec![(sov_of_sender_on_relay.into(), amount_to_send * 2)]); + Kusama::fund_accounts(vec![(sov_of_sender_on_relay, amount_to_send * 2)]); test.set_assertion::(para_to_para_sender_assertions); test.set_assertion::(para_to_para_relay_hop_assertions); diff --git a/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/send.rs b/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/send.rs index 09cff4ec55..2188318aa7 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/send.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/send.rs @@ -23,7 +23,7 @@ fn send_transact_as_superuser_from_relay_to_system_para_works() { ASSET_ID, ASSET_MIN_BALANCE, true, - AssetHubKusamaSender::get().into(), + AssetHubKusamaSender::get(), Some(Weight::from_parts(1_019_445_000, 200_000)), ) } diff --git a/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/teleport.rs b/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/teleport.rs index 5d9af97d50..a6b9c68e81 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/teleport.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/teleport.rs @@ -151,7 +151,7 @@ fn penpal_to_ah_foreign_assets_receiver_assertions(t: ParaToSystemParaTest) { RuntimeEvent::Balances( pallet_balances::Event::Burned { who, amount } ) => { - who: *who == sov_penpal_on_ahk.clone().into(), + who: *who == sov_penpal_on_ahk.clone(), amount: *amount == t.args.amount, }, RuntimeEvent::Balances(pallet_balances::Event::Minted { who, .. }) => { @@ -383,8 +383,8 @@ fn limited_teleport_native_assets_back_from_system_para_to_relay_works() { fn limited_teleport_native_assets_from_system_para_to_relay_fails() { // Init values for Relay Chain let amount_to_send: Balance = ASSET_HUB_KUSAMA_ED * 1000; - let destination = AssetHubKusama::parent_location().into(); - let beneficiary_id = KusamaReceiver::get().into(); + let destination = AssetHubKusama::parent_location(); + let beneficiary_id = KusamaReceiver::get(); let assets = (Parent, amount_to_send).into(); let test_args = TestContext { diff --git a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/fellowship_treasury.rs b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/fellowship_treasury.rs index d13e50fdbc..2670a1128b 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/fellowship_treasury.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/fellowship_treasury.rs @@ -15,7 +15,7 @@ use crate::*; use emulated_integration_tests_common::accounts::{ALICE, BOB}; -use frame_support::traits::fungibles::{Create, Inspect, Mutate}; +use frame_support::traits::fungibles::{Create, Mutate}; use polkadot_runtime_common::impls::VersionedLocatableAsset; use xcm_executor::traits::ConvertLocation; diff --git a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/reserve_transfer.rs b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/reserve_transfer.rs index bb3ac058cd..e7f094a4d9 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/reserve_transfer.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/reserve_transfer.rs @@ -107,7 +107,7 @@ fn para_to_system_para_receiver_assertions(t: ParaToSystemParaTest) { RuntimeEvent::Balances( pallet_balances::Event::Burned { who, amount } ) => { - who: *who == sov_penpal_on_ahp.clone().into(), + who: *who == sov_penpal_on_ahp.clone(), amount: *amount == t.args.amount, }, RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {}, @@ -267,7 +267,7 @@ fn para_to_para_limited_reserve_transfer_assets(t: ParaToParaTest) -> DispatchRe /// Reserve Transfers of native asset from Relay Chain to the System Parachain shouldn't work #[test] fn reserve_transfer_native_asset_from_relay_to_system_para_fails() { - let signed_origin = ::RuntimeOrigin::signed(PolkadotSender::get().into()); + let signed_origin = ::RuntimeOrigin::signed(PolkadotSender::get()); let destination = Polkadot::child_location_of(AssetHubPolkadot::para_id()); let beneficiary: Location = AccountId32Junction { network: None, id: AssetHubPolkadotReceiver::get().into() }.into(); @@ -301,7 +301,7 @@ fn reserve_transfer_native_asset_from_relay_to_system_para_fails() { fn reserve_transfer_native_asset_from_system_para_to_relay_fails() { // Init values for System Parachain let signed_origin = - ::RuntimeOrigin::signed(AssetHubPolkadotSender::get().into()); + ::RuntimeOrigin::signed(AssetHubPolkadotSender::get()); let destination = AssetHubPolkadot::parent_location(); let beneficiary_id = PolkadotReceiver::get(); let beneficiary: Location = @@ -445,7 +445,7 @@ fn reserve_transfer_native_asset_from_para_to_system_para() { AssetHubPolkadot::sovereign_account_id_of(penpal_location_as_seen_by_ahp); // fund the Penpal's SA on AHP with the native tokens held in reserve - AssetHubPolkadot::fund_accounts(vec![(sov_penpal_on_ahp.into(), amount_to_send * 2)]); + AssetHubPolkadot::fund_accounts(vec![(sov_penpal_on_ahp, amount_to_send * 2)]); test.set_assertion::(para_to_system_para_sender_assertions); test.set_assertion::(para_to_system_para_receiver_assertions); @@ -528,7 +528,7 @@ fn reserve_transfer_assets_from_system_para_to_para() { // Create SA-of-Penpal-on-AHP with ED. let penpal_location = AssetHubPolkadot::sibling_location_of(PenpalB::para_id()); let sov_penpal_on_ahp = AssetHubPolkadot::sovereign_account_id_of(penpal_location); - AssetHubPolkadot::fund_accounts(vec![(sov_penpal_on_ahp.into(), POLKADOT_ED)]); + AssetHubPolkadot::fund_accounts(vec![(sov_penpal_on_ahp, POLKADOT_ED)]); let sender_balance_before = test.sender.balance; let receiver_balance_before = test.receiver.balance; @@ -599,7 +599,7 @@ fn reserve_transfer_native_asset_from_para_to_para() { let sov_of_sender_on_relay = Polkadot::sovereign_account_id_of(sender_as_seen_by_relay); // fund the PenpalB's SA on Polkadot with the native tokens held in reserve - Polkadot::fund_accounts(vec![(sov_of_sender_on_relay.into(), amount_to_send * 2)]); + Polkadot::fund_accounts(vec![(sov_of_sender_on_relay, amount_to_send * 2)]); test.set_assertion::(para_to_para_sender_assertions); test.set_assertion::(para_to_para_relay_hop_assertions); diff --git a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/send.rs b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/send.rs index 2be0ae22ff..623264b25b 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/send.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/send.rs @@ -23,7 +23,7 @@ fn send_transact_as_superuser_from_relay_to_system_para_works() { ASSET_ID, ASSET_MIN_BALANCE, true, - AssetHubPolkadotSender::get().into(), + AssetHubPolkadotSender::get(), Some(Weight::from_parts(1_019_445_000, 200_000)), ) } diff --git a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/swap.rs b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/swap.rs index 63a1fa45c7..fa76779587 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/swap.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/swap.rs @@ -15,7 +15,6 @@ use crate::*; use polkadot_system_emulated_network::penpal_emulated_chain::LocalTeleportableToAssetHub as PenpalLocalTeleportableToAssetHub; -use sp_runtime::ModuleError; use system_parachains_constants::polkadot::currency::SYSTEM_PARA_EXISTENTIAL_DEPOSIT; #[test] diff --git a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/teleport.rs b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/teleport.rs index e5a6c3ea5a..65b25f13bc 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/teleport.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/teleport.rs @@ -151,7 +151,7 @@ fn penpal_to_ah_foreign_assets_receiver_assertions(t: ParaToSystemParaTest) { RuntimeEvent::Balances( pallet_balances::Event::Burned { who, amount } ) => { - who: *who == sov_penpal_on_ahk.clone().into(), + who: *who == sov_penpal_on_ahk.clone(), amount: *amount == t.args.amount, }, RuntimeEvent::Balances(pallet_balances::Event::Minted { who, .. }) => { @@ -383,8 +383,8 @@ fn limited_teleport_native_assets_back_from_system_para_to_relay_works() { fn limited_teleport_native_assets_from_system_para_to_relay_fails() { // Init values for Relay Chain let amount_to_send: Balance = ASSET_HUB_POLKADOT_ED * 1000; - let destination = AssetHubPolkadot::parent_location().into(); - let beneficiary_id = PolkadotReceiver::get().into(); + let destination = AssetHubPolkadot::parent_location(); + let beneficiary_id = PolkadotReceiver::get(); let assets = (Parent, amount_to_send).into(); let test_args = TestContext { diff --git a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/treasury.rs b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/treasury.rs index 7c177bc272..213b9c0f1f 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/treasury.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/treasury.rs @@ -15,7 +15,7 @@ use crate::*; use emulated_integration_tests_common::accounts::{ALICE, BOB}; -use frame_support::traits::fungibles::{Create, Inspect, Mutate}; +use frame_support::traits::fungibles::{Create, Mutate}; use polkadot_runtime_common::impls::VersionedLocatableAsset; use xcm_executor::traits::ConvertLocation; diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/mod.rs b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/mod.rs index 05b1b3437c..9d5d7a9f38 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/mod.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/mod.rs @@ -40,7 +40,7 @@ pub(crate) fn send_asset_from_asset_hub_kusama( (id, amount): (Location, u128), ) -> DispatchResult { let signed_origin = - ::RuntimeOrigin::signed(AssetHubKusamaSender::get().into()); + ::RuntimeOrigin::signed(AssetHubKusamaSender::get()); let beneficiary: Location = AccountId32Junction { network: None, id: AssetHubPolkadotReceiver::get().into() }.into(); diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/send_xcm.rs b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/send_xcm.rs index a700d61122..757089282c 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/send_xcm.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/send_xcm.rs @@ -74,7 +74,7 @@ fn send_xcm_through_opened_lane_with_different_xcm_version_on_hops_works() { // fund the AHK's SA on BHK for paying bridge transport fees BridgeHubKusama::fund_para_sovereign(AssetHubKusama::para_id(), 10_000_000_000_000u128); // fund sender - AssetHubKusama::fund_accounts(vec![(AssetHubKusamaSender::get().into(), amount * 10)]); + AssetHubKusama::fund_accounts(vec![(AssetHubKusamaSender::get(), amount * 10)]); // send XCM from AssetHubKusama - fails - destination version not known assert_err!( diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/snowbridge.rs b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/snowbridge.rs index 4001733b9a..f15c05f67a 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/snowbridge.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-kusama/src/tests/snowbridge.rs @@ -224,7 +224,7 @@ fn create_channel() { #[test] fn register_weth_token_from_ethereum_to_asset_hub() { // Fund AH sovereign account on BH so that it can pay execution fees. - BridgeHubKusama::fund_para_sovereign(AssetHubKusama::para_id().into(), INITIAL_FUND); + BridgeHubKusama::fund_para_sovereign(AssetHubKusama::para_id(), INITIAL_FUND); // Fund ethereum sovereign account on AssetHub. AssetHubKusama::fund_accounts(vec![(ethereum_sovereign_account(), INITIAL_FUND)]); @@ -379,7 +379,7 @@ fn send_token_from_ethereum_to_penpal() { /// a token from Ethereum to AssetHub. #[test] fn send_token_from_ethereum_to_asset_hub() { - BridgeHubKusama::fund_para_sovereign(AssetHubKusama::para_id().into(), INITIAL_FUND); + BridgeHubKusama::fund_para_sovereign(AssetHubKusama::para_id(), INITIAL_FUND); // Fund ethereum sovereign account on AssetHub. AssetHubKusama::fund_accounts(vec![(ethereum_sovereign_account(), INITIAL_FUND)]); @@ -466,7 +466,7 @@ fn send_weth_asset_from_asset_hub_to_ethereum() { exchange_rate: FixedU128::from_rational(1, 75), fee_per_gas: gwei(20), rewards: Rewards { - local: (1 * UNITS / 100).into(), // 0.01 KSM + local: (UNITS / 100), // 0.01 KSM remote: meth(1), }, multiplier: FixedU128::from_rational(1, 1), @@ -537,7 +537,7 @@ fn send_weth_asset_from_asset_hub_to_ethereum() { let beneficiary = VersionedLocation::V4(Location::new( 0, - [AccountKey20 { network: None, key: ETHEREUM_DESTINATION_ADDRESS.into() }], + [AccountKey20 { network: None, key: ETHEREUM_DESTINATION_ADDRESS }], )); let free_balance_before = ::Balances::free_balance( @@ -599,7 +599,7 @@ fn send_weth_asset_from_asset_hub_to_ethereum() { #[test] fn register_weth_token_in_asset_hub_fail_for_insufficient_fee() { - BridgeHubKusama::fund_para_sovereign(AssetHubKusama::para_id().into(), INITIAL_FUND); + BridgeHubKusama::fund_para_sovereign(AssetHubKusama::para_id(), INITIAL_FUND); BridgeHubKusama::execute_with(|| { type RuntimeEvent = ::RuntimeEvent; @@ -636,7 +636,7 @@ fn register_weth_token_in_asset_hub_fail_for_insufficient_fee() { #[test] fn send_token_from_ethereum_to_asset_hub_fail_for_insufficient_fund() { // Insufficient fund - BridgeHubKusama::fund_para_sovereign(AssetHubKusama::para_id().into(), 1_000); + BridgeHubKusama::fund_para_sovereign(AssetHubKusama::para_id(), 1_000); BridgeHubKusama::execute_with(|| { assert_ok!(::System::set_storage( diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/mod.rs b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/mod.rs index 9b9c1243cf..86138cf32c 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/mod.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/mod.rs @@ -40,7 +40,7 @@ pub(crate) fn send_asset_from_asset_hub_polkadot( (id, amount): (Location, u128), ) -> DispatchResult { let signed_origin = - ::RuntimeOrigin::signed(AssetHubPolkadotSender::get().into()); + ::RuntimeOrigin::signed(AssetHubPolkadotSender::get()); let beneficiary: Location = AccountId32Junction { network: None, id: AssetHubKusamaReceiver::get().into() }.into(); diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/send_xcm.rs b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/send_xcm.rs index 587f6f7291..4102ddeb56 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/send_xcm.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/send_xcm.rs @@ -74,7 +74,7 @@ fn send_xcm_through_opened_lane_with_different_xcm_version_on_hops_works() { // fund the AHK's SA on BHK for paying bridge transport fees BridgeHubPolkadot::fund_para_sovereign(AssetHubPolkadot::para_id(), 10_000_000_000_000u128); // fund sender - AssetHubPolkadot::fund_accounts(vec![(AssetHubPolkadotSender::get().into(), amount * 10)]); + AssetHubPolkadot::fund_accounts(vec![(AssetHubPolkadotSender::get(), amount * 10)]); // send XCM from AssetHubPolkadot - fails - destination version not known assert_err!( diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/snowbridge.rs b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/snowbridge.rs index 8bfebf9327..cc6dbc4583 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/snowbridge.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/snowbridge.rs @@ -224,7 +224,7 @@ fn create_channel() { #[test] fn register_weth_token_from_ethereum_to_asset_hub() { // Fund AH sovereign account on BH so that it can pay execution fees. - BridgeHubPolkadot::fund_para_sovereign(AssetHubPolkadot::para_id().into(), INITIAL_FUND); + BridgeHubPolkadot::fund_para_sovereign(AssetHubPolkadot::para_id(), INITIAL_FUND); // Fund ethereum sovereign account on AssetHub. AssetHubPolkadot::fund_accounts(vec![(ethereum_sovereign_account(), INITIAL_FUND)]); @@ -379,7 +379,7 @@ fn send_token_from_ethereum_to_penpal() { /// a token from Ethereum to AssetHub. #[test] fn send_token_from_ethereum_to_asset_hub() { - BridgeHubPolkadot::fund_para_sovereign(AssetHubPolkadot::para_id().into(), INITIAL_FUND); + BridgeHubPolkadot::fund_para_sovereign(AssetHubPolkadot::para_id(), INITIAL_FUND); // Fund ethereum sovereign account on AssetHub. AssetHubPolkadot::fund_accounts(vec![(ethereum_sovereign_account(), INITIAL_FUND)]); @@ -466,7 +466,7 @@ fn send_weth_asset_from_asset_hub_to_ethereum() { exchange_rate: FixedU128::from_rational(1, 75), fee_per_gas: gwei(20), rewards: Rewards { - local: (1 * UNITS / 100).into(), // 0.01 DOT + local: (UNITS / 100), // 0.01 DOT remote: meth(1), }, multiplier: FixedU128::from_rational(1, 1), @@ -537,7 +537,7 @@ fn send_weth_asset_from_asset_hub_to_ethereum() { let beneficiary = VersionedLocation::V4(Location::new( 0, - [AccountKey20 { network: None, key: ETHEREUM_DESTINATION_ADDRESS.into() }], + [AccountKey20 { network: None, key: ETHEREUM_DESTINATION_ADDRESS }], )); let free_balance_before = @@ -603,7 +603,7 @@ fn send_weth_asset_from_asset_hub_to_ethereum() { #[test] fn register_weth_token_in_asset_hub_fail_for_insufficient_fee() { - BridgeHubPolkadot::fund_para_sovereign(AssetHubPolkadot::para_id().into(), INITIAL_FUND); + BridgeHubPolkadot::fund_para_sovereign(AssetHubPolkadot::para_id(), INITIAL_FUND); BridgeHubPolkadot::execute_with(|| { type RuntimeEvent = ::RuntimeEvent; @@ -640,7 +640,7 @@ fn register_weth_token_in_asset_hub_fail_for_insufficient_fee() { #[test] fn send_token_from_ethereum_to_asset_hub_fail_for_insufficient_fund() { // Insufficient fund - BridgeHubPolkadot::fund_para_sovereign(AssetHubPolkadot::para_id().into(), 1_000); + BridgeHubPolkadot::fund_para_sovereign(AssetHubPolkadot::para_id(), 1_000); BridgeHubPolkadot::execute_with(|| { assert_ok!(::System::set_storage( diff --git a/relay/kusama/constants/src/lib.rs b/relay/kusama/constants/src/lib.rs index 78046e0d05..4310e3966e 100644 --- a/relay/kusama/constants/src/lib.rs +++ b/relay/kusama/constants/src/lib.rs @@ -23,7 +23,7 @@ pub mod currency { use primitives::Balance; /// The existential deposit. - pub const EXISTENTIAL_DEPOSIT: Balance = 1 * CENTS; + pub const EXISTENTIAL_DEPOSIT: Balance = CENTS; pub const UNITS: Balance = 1_000_000_000_000; pub const QUID: Balance = UNITS / 30; @@ -42,7 +42,7 @@ pub mod time { use runtime_common::prod_or_fast; pub const MILLISECS_PER_BLOCK: Moment = 6000; pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK; - pub const EPOCH_DURATION_IN_SLOTS: BlockNumber = prod_or_fast!(1 * HOURS, 1 * MINUTES); + pub const EPOCH_DURATION_IN_SLOTS: BlockNumber = prod_or_fast!(HOURS, MINUTES); // These time units are defined in number of blocks. pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); diff --git a/relay/kusama/src/bag_thresholds.rs b/relay/kusama/src/bag_thresholds.rs index 82dc4c3a81..5e34d5073f 100644 --- a/relay/kusama/src/bag_thresholds.rs +++ b/relay/kusama/src/bag_thresholds.rs @@ -27,7 +27,7 @@ pub const EXISTENTIAL_WEIGHT: u64 = 33_333_333; /// Constant ratio between bags for this runtime. #[cfg(any(test, feature = "std"))] #[allow(unused)] -pub const CONSTANT_RATIO: f64 = 1.1455399939091000; +pub const CONSTANT_RATIO: f64 = 1.145_539_993_909_1; /// Upper thresholds delimiting the bag list. pub const THRESHOLDS: [u64; 200] = [ diff --git a/relay/kusama/src/governance/fellowship.rs b/relay/kusama/src/governance/fellowship.rs index b353ff5e3d..9427b135d5 100644 --- a/relay/kusama/src/governance/fellowship.rs +++ b/relay/kusama/src/governance/fellowship.rs @@ -23,11 +23,10 @@ use frame_support::traits::{MapSuccess, TryMapSuccess}; use sp_arithmetic::traits::CheckedSub; use sp_runtime::{ morph_types, - traits::{ConstU16, Replace, TypedGet}, + traits::{Replace, TypedGet}, }; use super::*; -use crate::{DAYS, QUID}; parameter_types! { pub const AlarmInterval: BlockNumber = 1; @@ -50,7 +49,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -72,7 +71,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -94,7 +93,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -116,7 +115,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -138,7 +137,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -156,11 +155,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "experts", max_deciding: 10, - decision_deposit: 1 * QUID, + decision_deposit: QUID, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -178,11 +177,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "senior experts", max_deciding: 10, - decision_deposit: 1 * QUID, + decision_deposit: QUID, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -200,11 +199,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "masters", max_deciding: 10, - decision_deposit: 1 * QUID, + decision_deposit: QUID, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -222,11 +221,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "senior masters", max_deciding: 10, - decision_deposit: 1 * QUID, + decision_deposit: QUID, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -244,11 +243,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "grand masters", max_deciding: 10, - decision_deposit: 1 * QUID, + decision_deposit: QUID, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), diff --git a/relay/kusama/src/governance/mod.rs b/relay/kusama/src/governance/mod.rs index c8a7b360ed..b07e4d7204 100644 --- a/relay/kusama/src/governance/mod.rs +++ b/relay/kusama/src/governance/mod.rs @@ -51,12 +51,12 @@ impl pallet_conviction_voting::Config for Runtime { parameter_types! { pub const AlarmInterval: BlockNumber = 1; - pub const SubmissionDeposit: Balance = 1 * QUID; + pub const SubmissionDeposit: Balance = QUID; pub const UndecidingTimeout: BlockNumber = 14 * DAYS; } parameter_types! { - pub const MaxBalance: Balance = Balance::max_value(); + pub const MaxBalance: Balance = Balance::MAX; } pub type TreasurySpender = EitherOf, Spender>; diff --git a/relay/kusama/src/governance/origins.rs b/relay/kusama/src/governance/origins.rs index 0b55c0056d..24dcf17801 100644 --- a/relay/kusama/src/governance/origins.rs +++ b/relay/kusama/src/governance/origins.rs @@ -173,7 +173,7 @@ pub mod pallet_custom_origins { decl_ensure! { pub type Spender: EnsureOrigin { SmallTipper = 250 * QUID, - BigTipper = 1 * GRAND, + BigTipper = GRAND, SmallSpender = 10 * GRAND, MediumSpender = 100 * GRAND, BigSpender = 1_000 * GRAND, diff --git a/relay/kusama/src/governance/tracks.rs b/relay/kusama/src/governance/tracks.rs index 75781deff1..d2e5403501 100644 --- a/relay/kusama/src/governance/tracks.rs +++ b/relay/kusama/src/governance/tracks.rs @@ -127,7 +127,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 16 pallet_referenda::TrackInfo { name: "treasurer", max_deciding: 10, - decision_deposit: 1 * GRAND, + decision_deposit: GRAND, prepare_period: 2 * HOURS, decision_period: 14 * DAYS, confirm_period: 48 * HOURS, @@ -225,11 +225,11 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 16 pallet_referenda::TrackInfo { name: "small_tipper", max_deciding: 200, - decision_deposit: 1 * QUID, - prepare_period: 1 * MINUTES, + decision_deposit: QUID, + prepare_period: MINUTES, decision_period: 7 * DAYS, confirm_period: 10 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: APP_SMALL_TIPPER, min_support: SUP_SMALL_TIPPER, }, @@ -242,7 +242,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 16 decision_deposit: 10 * QUID, prepare_period: 10 * MINUTES, decision_period: 7 * DAYS, - confirm_period: 1 * HOURS, + confirm_period: HOURS, min_enactment_period: 10 * MINUTES, min_approval: APP_BIG_TIPPER, min_support: SUP_BIG_TIPPER, diff --git a/relay/kusama/src/impls.rs b/relay/kusama/src/impls.rs index 23e63b637c..e9c3f970ec 100644 --- a/relay/kusama/src/impls.rs +++ b/relay/kusama/src/impls.rs @@ -15,19 +15,16 @@ // along with Polkadot. If not, see . use super::*; -use crate::xcm_config; use core::marker::PhantomData; use frame_support::{ - defensive, - pallet_prelude::DispatchResult, - traits::{tokens::ConversionFromAssetBalance, Contains}, + defensive, pallet_prelude::DispatchResult, traits::tokens::ConversionFromAssetBalance, }; use frame_system::RawOrigin; use kusama_runtime_constants::system_parachain::PEOPLE_ID; use parity_scale_codec::{Decode, Encode}; -use primitives::{Balance, Id as ParaId}; +use primitives::Id as ParaId; use runtime_common::identity_migrator::{OnReapIdentity, WeightInfo}; -use xcm::{latest::prelude::*, VersionedLocation, VersionedXcm}; +use xcm::{latest::prelude::*, VersionedXcm}; use xcm_builder::IsChildSystemParachain; use xcm_executor::traits::TransactAsset; @@ -161,8 +158,7 @@ where DepositAsset { assets: Wild(AllCounted(1)), beneficiary: Junction::AccountId32 { network: None, id: who.clone().into() } - .into_location() - .into(), + .into_location(), }, // Poke the deposit to reserve the appropriate amount on the parachain. Transact { @@ -173,7 +169,7 @@ where ]); // send - let _ = >::send( + >::send( RawOrigin::Root.into(), Box::new(VersionedLocation::V4(destination)), Box::new(VersionedXcm::V4(program)), diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index 8e0cfd1b63..a3faef097e 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -407,13 +407,12 @@ impl BeefyDataProvider for ParaHeadsRootProvider { fn extra_data() -> H256 { let mut para_heads: Vec<(u32, Vec)> = Paras::parachains() .into_iter() - .filter_map(|id| Paras::para_head(&id).map(|head| (id.into(), head.0))) + .filter_map(|id| Paras::para_head(id).map(|head| (id.into(), head.0))) .collect(); para_heads.sort_by_key(|k| k.0); binary_merkle_tree::merkle_root::( para_heads.into_iter().map(|pair| pair.encode()), ) - .into() } } @@ -540,12 +539,12 @@ parameter_types! { // in testing: 1min or half of the session for each pub SignedPhase: u32 = prod_or_fast!( EPOCH_DURATION_IN_SLOTS / 4, - (1 * MINUTES).min(EpochDuration::get().saturated_into::() / 2), + MINUTES.min(EpochDuration::get().saturated_into::() / 2), "KSM_SIGNED_PHASE" ); pub UnsignedPhase: u32 = prod_or_fast!( EPOCH_DURATION_IN_SLOTS / 4, - (1 * MINUTES).min(EpochDuration::get().saturated_into::() / 2), + MINUTES.min(EpochDuration::get().saturated_into::() / 2), "KSM_UNSIGNED_PHASE" ); @@ -568,7 +567,7 @@ parameter_types! { pub ElectionBounds: frame_election_provider_support::bounds::ElectionBounds = ElectionBoundsBuilder::default().voters_count(MaxElectingVoters::get().into()).build(); pub NposSolutionPriority: TransactionPriority = - Perbill::from_percent(90) * TransactionPriority::max_value(); + Perbill::from_percent(90) * TransactionPriority::MAX; /// Setup election pallet to support maximum winners upto 2000. This will mean Staking Pallet /// cannot have active validators higher than this count. pub const MaxActiveValidators: u32 = 2000; @@ -773,7 +772,7 @@ impl pallet_fast_unstake::Config for Runtime { parameter_types! { pub const ProposalBond: Permill = Permill::from_percent(5); pub const ProposalBondMinimum: Balance = 2000 * CENTS; - pub const ProposalBondMaximum: Balance = 1 * GRAND; + pub const ProposalBondMaximum: Balance = GRAND; pub const SpendPeriod: BlockNumber = 6 * DAYS; pub const Burn: Permill = Permill::from_perthousand(2); pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); @@ -782,10 +781,10 @@ parameter_types! { // pallet instance (which sits at index 18). pub TreasuryInteriorLocation: InteriorLocation = PalletInstance(TREASURY_PALLET_ID).into(); - pub const TipCountdown: BlockNumber = 1 * DAYS; + pub const TipCountdown: BlockNumber = DAYS; pub const TipFindersFee: Percent = Percent::from_percent(20); pub const TipReportDepositBase: Balance = 100 * CENTS; - pub const DataDepositPerByte: Balance = 1 * CENTS; + pub const DataDepositPerByte: Balance = CENTS; pub const MaxApprovals: u32 = 100; pub const MaxAuthorities: u32 = 100_000; pub const MaxKeys: u32 = 10_000; @@ -1276,7 +1275,7 @@ impl parachains_inclusion::Config for Runtime { } parameter_types! { - pub const ParasUnsignedPriority: TransactionPriority = TransactionPriority::max_value(); + pub const ParasUnsignedPriority: TransactionPriority = TransactionPriority::MAX; } impl parachains_paras::Config for Runtime { @@ -2876,7 +2875,7 @@ mod multiplier_tests { fn run_with_system_weight(w: Weight, mut assertions: F) where - F: FnMut() -> (), + F: FnMut(), { let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::::default() .build_storage() diff --git a/relay/kusama/src/tests.rs b/relay/kusama/src/tests.rs index e6e248a8e9..b5fc87781b 100644 --- a/relay/kusama/src/tests.rs +++ b/relay/kusama/src/tests.rs @@ -21,12 +21,9 @@ use frame_support::{ dispatch::GetDispatchInfo, traits::WhitelistedStorageKeys, weights::WeightToFee as WeightToFeeT, }; use keyring::Sr25519Keyring::Charlie; -use pallet_transaction_payment::Multiplier; -use parity_scale_codec::Encode; use runtime_common::MinimumMultiplier; use separator::Separatable; use sp_core::hexdisplay::HexDisplay; -use sp_runtime::FixedPointNumber; use std::collections::HashSet; #[test] diff --git a/relay/kusama/src/weights/xcm/mod.rs b/relay/kusama/src/weights/xcm/mod.rs index 321e1eac27..8cc7122800 100644 --- a/relay/kusama/src/weights/xcm/mod.rs +++ b/relay/kusama/src/weights/xcm/mod.rs @@ -18,7 +18,6 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; use crate::Runtime; -use frame_support::weights::Weight; use sp_std::prelude::*; use xcm::{latest::prelude::*, DoubleEncoded}; @@ -55,7 +54,7 @@ impl WeighAssets for AssetFilter { match self { Self::Definite(assets) => assets .inner() - .into_iter() + .iter() .map(From::from) .map(|t| match t { AssetTypes::Balances => balances_weight, @@ -75,8 +74,8 @@ impl WeighAssets for AssetFilter { impl WeighAssets for Assets { fn weigh_multi_assets(&self, balances_weight: Weight) -> Weight { self.inner() - .into_iter() - .map(|m| >::from(m)) + .iter() + .map(>::from) .map(|t| match t { AssetTypes::Balances => balances_weight, AssetTypes::Unknown => Weight::MAX, diff --git a/relay/kusama/src/xcm_config.rs b/relay/kusama/src/xcm_config.rs index 9cca5d0ca1..9c6e8fbe78 100644 --- a/relay/kusama/src/xcm_config.rs +++ b/relay/kusama/src/xcm_config.rs @@ -24,7 +24,6 @@ use super::{ use frame_support::{ parameter_types, traits::{Contains, Equals, Everything, Nothing}, - weights::Weight, }; use frame_system::EnsureRoot; use kusama_runtime_constants::{currency::CENTS, system_parachain::*}; @@ -321,7 +320,7 @@ fn karura_liquid_staking_xcm_has_sane_weight_upper_limt() { assert!(weight.all_lte(Weight::from_parts(30_313_281_000, 72_722))); let Some(Transact { require_weight_at_most, call, .. }) = - xcm.inner_mut().into_iter().find(|inst| matches!(inst, Transact { .. })) + xcm.inner_mut().iter_mut().find(|inst| matches!(inst, Transact { .. })) else { panic!("no Transact instruction found") }; diff --git a/relay/polkadot/constants/src/lib.rs b/relay/polkadot/constants/src/lib.rs index f47d9e6a97..1ddd59d86a 100644 --- a/relay/polkadot/constants/src/lib.rs +++ b/relay/polkadot/constants/src/lib.rs @@ -44,7 +44,7 @@ pub mod time { use runtime_common::prod_or_fast; pub const MILLISECS_PER_BLOCK: Moment = 6000; pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK; - pub const EPOCH_DURATION_IN_SLOTS: BlockNumber = prod_or_fast!(4 * HOURS, 1 * MINUTES); + pub const EPOCH_DURATION_IN_SLOTS: BlockNumber = prod_or_fast!(4 * HOURS, MINUTES); // These time units are defined in number of blocks. pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); diff --git a/relay/polkadot/src/governance/mod.rs b/relay/polkadot/src/governance/mod.rs index 39a7188954..d9b84b21ae 100644 --- a/relay/polkadot/src/governance/mod.rs +++ b/relay/polkadot/src/governance/mod.rs @@ -18,7 +18,7 @@ use super::*; use crate::xcm_config::CollectivesLocation; -use frame_support::{parameter_types, traits::EitherOf}; +use frame_support::parameter_types; use frame_system::EnsureRootWithSuccess; use pallet_xcm::{EnsureXcm, IsVoiceOfBody}; use xcm::latest::BodyId; @@ -48,12 +48,12 @@ impl pallet_conviction_voting::Config for Runtime { parameter_types! { pub const AlarmInterval: BlockNumber = 1; - pub const SubmissionDeposit: Balance = 1 * DOLLARS; + pub const SubmissionDeposit: Balance = DOLLARS; pub const UndecidingTimeout: BlockNumber = 14 * DAYS; } parameter_types! { - pub const MaxBalance: Balance = Balance::max_value(); + pub const MaxBalance: Balance = Balance::MAX; } pub type TreasurySpender = EitherOf, Spender>; diff --git a/relay/polkadot/src/governance/origins.rs b/relay/polkadot/src/governance/origins.rs index ac4f667d39..f1283b551e 100644 --- a/relay/polkadot/src/governance/origins.rs +++ b/relay/polkadot/src/governance/origins.rs @@ -144,7 +144,7 @@ pub mod pallet_custom_origins { decl_ensure! { pub type Spender: EnsureOrigin { SmallTipper = 250 * DOLLARS, - BigTipper = 1 * GRAND, + BigTipper = GRAND, SmallSpender = 10 * GRAND, MediumSpender = 100 * GRAND, BigSpender = 1_000 * GRAND, diff --git a/relay/polkadot/src/governance/tracks.rs b/relay/polkadot/src/governance/tracks.rs index 4a167d606f..7ee9aec7a6 100644 --- a/relay/polkadot/src/governance/tracks.rs +++ b/relay/polkadot/src/governance/tracks.rs @@ -127,7 +127,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 16 pallet_referenda::TrackInfo { name: "treasurer", max_deciding: 10, - decision_deposit: 1 * GRAND, + decision_deposit: GRAND, prepare_period: 2 * HOURS, decision_period: 28 * DAYS, confirm_period: 7 * DAYS, @@ -225,11 +225,11 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 16 pallet_referenda::TrackInfo { name: "small_tipper", max_deciding: 200, - decision_deposit: 1 * DOLLARS, - prepare_period: 1 * MINUTES, + decision_deposit: DOLLARS, + prepare_period: MINUTES, decision_period: 7 * DAYS, confirm_period: 10 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: APP_SMALL_TIPPER, min_support: SUP_SMALL_TIPPER, }, @@ -242,7 +242,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 16 decision_deposit: 10 * DOLLARS, prepare_period: 10 * MINUTES, decision_period: 7 * DAYS, - confirm_period: 1 * HOURS, + confirm_period: HOURS, min_enactment_period: 10 * MINUTES, min_approval: APP_BIG_TIPPER, min_support: SUP_BIG_TIPPER, diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index 7af0c9f617..5e1695038c 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -132,7 +132,7 @@ use governance::{ pub mod impls; pub mod xcm_config; -pub const LOG_TARGET: &'static str = "runtime::polkadot"; +pub const LOG_TARGET: &str = "runtime::polkadot"; impl_runtime_weights!(polkadot_runtime_constants); @@ -384,13 +384,12 @@ impl BeefyDataProvider for ParaHeadsRootProvider { fn extra_data() -> H256 { let mut para_heads: Vec<(u32, Vec)> = Paras::parachains() .into_iter() - .filter_map(|id| Paras::para_head(&id).map(|head| (id.into(), head.0))) + .filter_map(|id| Paras::para_head(id).map(|head| (id.into(), head.0))) .collect(); para_heads.sort_by_key(|k| k.0); binary_merkle_tree::merkle_root::( para_heads.into_iter().map(|pair| pair.encode()), ) - .into() } } @@ -517,12 +516,12 @@ parameter_types! { // in testing: 1min or half of the session for each pub SignedPhase: u32 = prod_or_fast!( EPOCH_DURATION_IN_SLOTS / 4, - (1 * MINUTES).min(EpochDuration::get().saturated_into::() / 2), + MINUTES.min(EpochDuration::get().saturated_into::() / 2), "DOT_SIGNED_PHASE" ); pub UnsignedPhase: u32 = prod_or_fast!( EPOCH_DURATION_IN_SLOTS / 4, - (1 * MINUTES).min(EpochDuration::get().saturated_into::() / 2), + MINUTES.min(EpochDuration::get().saturated_into::() / 2), "DOT_UNSIGNED_PHASE" ); @@ -534,7 +533,7 @@ parameter_types! { // 0.01 DOT per KB of solution data. pub const SignedDepositByte: Balance = deposit(0, 10) / 1024; // Each good submission will get 1 DOT as reward - pub SignedRewardBase: Balance = 1 * UNITS; + pub SignedRewardBase: Balance = UNITS; // 4 hour session, 1 hour unsigned phase, 32 offchain executions. pub OffchainRepeat: BlockNumber = UnsignedPhase::get() / 32; @@ -853,10 +852,10 @@ parameter_types! { // pallet instance (which sits at index 19). pub TreasuryInteriorLocation: InteriorLocation = PalletInstance(TREASURY_PALLET_ID).into(); - pub const TipCountdown: BlockNumber = 1 * DAYS; + pub const TipCountdown: BlockNumber = DAYS; pub const TipFindersFee: Percent = Percent::from_percent(20); - pub const TipReportDepositBase: Balance = 1 * DOLLARS; - pub const DataDepositPerByte: Balance = 1 * CENTS; + pub const TipReportDepositBase: Balance = DOLLARS; + pub const DataDepositPerByte: Balance = CENTS; pub const MaxApprovals: u32 = 100; pub const MaxAuthorities: u32 = 100_000; pub const MaxKeys: u32 = 10_000; @@ -902,7 +901,7 @@ impl pallet_treasury::Config for Runtime { } parameter_types! { - pub const BountyDepositBase: Balance = 1 * DOLLARS; + pub const BountyDepositBase: Balance = DOLLARS; pub const BountyDepositPayoutDelay: BlockNumber = 8 * DAYS; pub const BountyUpdatePeriod: BlockNumber = 90 * DAYS; pub const MaximumReasonLength: u32 = 16384; @@ -951,7 +950,7 @@ impl pallet_authority_discovery::Config for Runtime { parameter_types! { pub NposSolutionPriority: TransactionPriority = - Perbill::from_percent(90) * TransactionPriority::max_value(); + Perbill::from_percent(90) * TransactionPriority::MAX; } parameter_types! { @@ -1054,7 +1053,7 @@ impl claims::Config for Runtime { } parameter_types! { - pub const MinVestedTransfer: Balance = 1 * DOLLARS; + pub const MinVestedTransfer: Balance = DOLLARS; pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons = WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE); } @@ -1300,7 +1299,7 @@ impl parachains_inclusion::Config for Runtime { } parameter_types! { - pub const ParasUnsignedPriority: TransactionPriority = TransactionPriority::max_value(); + pub const ParasUnsignedPriority: TransactionPriority = TransactionPriority::MAX; } impl parachains_paras::Config for Runtime { @@ -1543,7 +1542,7 @@ impl frame_support::traits::OnRuntimeUpgrade for InitiateNominationPools { parameter_types! { // The deposit configuration for the singed migration. Specially if you want to allow any signed account to do the migration (see `SignedFilter`, these deposits should be high) - pub const MigrationSignedDepositPerItem: Balance = 1 * CENTS; + pub const MigrationSignedDepositPerItem: Balance = CENTS; pub const MigrationSignedDepositBase: Balance = 20 * CENTS * 100; pub const MigrationMaxKeyLen: u32 = 512; } @@ -2721,10 +2720,9 @@ mod test_fees { use super::*; use frame_support::{dispatch::GetDispatchInfo, weights::WeightToFee as WeightToFeeT}; use keyring::Sr25519Keyring::{Alice, Charlie}; - use pallet_transaction_payment::Multiplier; use runtime_common::MinimumMultiplier; use separator::Separatable; - use sp_runtime::{assert_eq_error_rate, FixedPointNumber, MultiAddress, MultiSignature}; + use sp_runtime::{assert_eq_error_rate, MultiAddress, MultiSignature}; #[test] fn payout_weight_portion() { @@ -2937,7 +2935,7 @@ mod multiplier_tests { fn run_with_system_weight(w: Weight, mut assertions: F) where - F: FnMut() -> (), + F: FnMut(), { let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::::default() .build_storage() diff --git a/relay/polkadot/src/weights/xcm/mod.rs b/relay/polkadot/src/weights/xcm/mod.rs index 2aff001c59..aedf2704b5 100644 --- a/relay/polkadot/src/weights/xcm/mod.rs +++ b/relay/polkadot/src/weights/xcm/mod.rs @@ -18,7 +18,6 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; use crate::Runtime; -use frame_support::weights::Weight; use sp_std::prelude::*; use xcm::{latest::prelude::*, DoubleEncoded}; @@ -55,7 +54,7 @@ impl WeighAssets for AssetFilter { match self { Self::Definite(assets) => assets .inner() - .into_iter() + .iter() .map(From::from) .map(|t| match t { AssetTypes::Balances => balances_weight, @@ -75,8 +74,8 @@ impl WeighAssets for AssetFilter { impl WeighAssets for Assets { fn weigh_multi_assets(&self, balances_weight: Weight) -> Weight { self.inner() - .into_iter() - .map(|m| >::from(m)) + .iter() + .map(>::from) .map(|t| match t { AssetTypes::Balances => balances_weight, AssetTypes::Unknown => Weight::MAX, diff --git a/relay/polkadot/src/xcm_config.rs b/relay/polkadot/src/xcm_config.rs index 93fc46e84b..678c8d18ea 100644 --- a/relay/polkadot/src/xcm_config.rs +++ b/relay/polkadot/src/xcm_config.rs @@ -24,7 +24,6 @@ use super::{ use frame_support::{ parameter_types, traits::{Contains, Equals, Everything, Nothing}, - weights::Weight, }; use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs index 258497ea71..1e4afc6a7d 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs @@ -859,7 +859,7 @@ impl pallet_nft_fractionalization::Config for Runtime { type Assets = Assets; type Nfts = Nfts; type PalletId = NftFractionalizationPalletId; - type WeightInfo = pallet_nft_fractionalization::weights::SubstrateWeight; + type WeightInfo = weights::pallet_nft_fractionalization::WeightInfo; type RuntimeHoldReason = RuntimeHoldReason; #[cfg(feature = "runtime-benchmarks")] type BenchmarkHelper = (); @@ -1723,7 +1723,6 @@ fn ensure_key_ss58() { #[cfg(test)] mod tests { use super::*; - use crate::{CENTS, MILLICENTS}; use sp_runtime::traits::Zero; use sp_weights::WeightToFee; use system_parachains_constants::kusama::fee; diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/xcm/mod.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/xcm/mod.rs index 7383a55a8f..d2866f2525 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/weights/xcm/mod.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/weights/xcm/mod.rs @@ -18,7 +18,6 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; use crate::{xcm_config::MaxAssetsIntoHolding, Runtime}; -use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; use sp_std::prelude::*; diff --git a/system-parachains/asset-hubs/asset-hub-kusama/tests/snowbridge.rs b/system-parachains/asset-hubs/asset-hub-kusama/tests/snowbridge.rs index 0d8e946e83..756001a9aa 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/tests/snowbridge.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/tests/snowbridge.rs @@ -27,6 +27,7 @@ use xcm_builder::{ExporterFor, NetworkExportTable}; #[test] fn network_export_table_works() { sp_io::TestExternalities::default().execute_with(|| { + #[allow(clippy::type_complexity)] let test_data: Vec<(NetworkId, InteriorLocation, Option<(Location, Option)>)> = vec![ // From Ethereum (from GlobalConsensus(Ethereum) is routed to BridgeHub, with a fee, // matched. @@ -34,7 +35,7 @@ fn network_export_table_works() { EthereumNetwork::get(), Junctions::Here, Some(( - SiblingBridgeHub::get().into(), + SiblingBridgeHub::get(), Some(Asset { id: XcmBridgeHubRouterFeeAssetId::get(), fun: Fungible(BridgeHubEthereumBaseFee::get()), diff --git a/system-parachains/asset-hubs/asset-hub-kusama/tests/weight_trader.rs b/system-parachains/asset-hubs/asset-hub-kusama/tests/weight_trader.rs index 2bc64b545f..d6fefa1f27 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/tests/weight_trader.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/tests/weight_trader.rs @@ -30,7 +30,7 @@ use frame_support::{ fungible::{Inspect, Mutate}, fungibles::{Create, Inspect as FungiblesInspect, Mutate as FungiblesMutate}, }, - weights::{Weight, WeightToFee as WeightToFeeT}, + weights::WeightToFee as WeightToFeeT, }; use asset_hub_kusama_runtime::{ diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs index 8fa2d744a4..d0bdc2edb1 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs @@ -1680,7 +1680,6 @@ cumulus_pallet_parachain_system::register_validate_block! { #[cfg(test)] mod tests { use super::*; - use crate::{CENTS, MILLICENTS}; use sp_runtime::traits::Zero; use sp_weights::WeightToFee; use system_parachains_constants::polkadot::fee; diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/xcm/mod.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/xcm/mod.rs index 563135f9b8..2864aa093d 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/xcm/mod.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/xcm/mod.rs @@ -18,7 +18,6 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; use crate::{xcm_config::MaxAssetsIntoHolding, Runtime}; -use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; use sp_std::prelude::*; diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/tests/snowbridge.rs b/system-parachains/asset-hubs/asset-hub-polkadot/tests/snowbridge.rs index 77f7054726..05dff0bc97 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/tests/snowbridge.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/tests/snowbridge.rs @@ -27,6 +27,7 @@ use xcm_builder::{ExporterFor, NetworkExportTable}; #[test] fn network_export_table_works() { sp_io::TestExternalities::default().execute_with(|| { + #[allow(clippy::type_complexity)] let test_data: Vec<(NetworkId, InteriorLocation, Option<(Location, Option)>)> = vec![ // From Ethereum (from GlobalConsensus(Ethereum) is routed to BridgeHub, with a fee, // matched. @@ -34,7 +35,7 @@ fn network_export_table_works() { EthereumNetwork::get(), Junctions::Here, Some(( - SiblingBridgeHub::get().into(), + SiblingBridgeHub::get(), Some(Asset { id: XcmBridgeHubRouterFeeAssetId::get(), fun: Fungible(BridgeHubEthereumBaseFee::get()), diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/tests/weight_trader.rs b/system-parachains/asset-hubs/asset-hub-polkadot/tests/weight_trader.rs index e29fb78d63..a7732b0812 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/tests/weight_trader.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/tests/weight_trader.rs @@ -32,7 +32,7 @@ use frame_support::{ fungible::{Inspect, Mutate}, fungibles::{Create, Inspect as FungiblesInspect, Mutate as FungiblesMutate}, }, - weights::{Weight, WeightToFee as WeightToFeeT}, + weights::WeightToFee as WeightToFeeT, }; use parachains_common::{AccountId, AssetHubPolkadotAuraId as AuraId}; use sp_runtime::traits::MaybeEquivalence; diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/bridge_to_polkadot_config.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/bridge_to_polkadot_config.rs index bcce5bd144..cfcb735c53 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/bridge_to_polkadot_config.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/bridge_to_polkadot_config.rs @@ -41,14 +41,10 @@ use bridge_runtime_common::{ RefundableMessagesLane, RefundableParachain, }, }; -use cumulus_primitives_core::ParentThen; use frame_support::{parameter_types, traits::PalletInfoAccess}; use kusama_runtime_constants as constants; use sp_runtime::{traits::ConstU32, RuntimeDebug}; -use xcm::{ - latest::prelude::*, - prelude::{InteriorLocation, NetworkId}, -}; +use xcm::latest::prelude::*; use xcm_builder::BridgeBlobDispatcher; /// Lane identifier, used to connect Kusama Asset Hub and Polkadot Asset Hub. diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs index 9d9afd530d..a3ee2c451e 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs @@ -19,7 +19,6 @@ mod pallet_xcm_benchmarks_generic; use crate::{xcm_config::MaxAssetsIntoHolding, Runtime}; use codec::Encode; -use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; use sp_std::prelude::*; diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/tests/snowbridge.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/tests/snowbridge.rs index 594bf05f85..5859943f36 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/tests/snowbridge.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/tests/snowbridge.rs @@ -249,7 +249,7 @@ pub fn send_transfer_token_message_failure( exchange_rate: FixedU128::from_rational(1, 75), fee_per_gas: gwei(20), rewards: Rewards { - local: (1 * UNITS / 100).into(), // 0.01 KSM + local: (UNITS / 100).into(), // 0.01 KSM remote: meth(1), }, multiplier: FixedU128::from_rational(1, 1), diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/bridge_to_kusama_config.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/bridge_to_kusama_config.rs index b53da25e62..68480a4219 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/bridge_to_kusama_config.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/bridge_to_kusama_config.rs @@ -41,14 +41,10 @@ use bridge_runtime_common::{ RefundableMessagesLane, RefundableParachain, }, }; -use cumulus_primitives_core::ParentThen; use frame_support::{parameter_types, traits::PalletInfoAccess}; use polkadot_runtime_constants as constants; use sp_runtime::{traits::ConstU32, RuntimeDebug}; -use xcm::{ - latest::prelude::*, - prelude::{InteriorLocation, NetworkId}, -}; +use xcm::latest::prelude::*; use xcm_builder::BridgeBlobDispatcher; /// Lane identifier, used to connect Polkadot Asset Hub and Kusama Asset Hub. diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/mod.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/mod.rs index b577150e77..8f60b012ee 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/mod.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/mod.rs @@ -19,7 +19,6 @@ mod pallet_xcm_benchmarks_generic; use crate::{xcm_config::MaxAssetsIntoHolding, Runtime}; use codec::Encode; -use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; use sp_std::prelude::*; diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/snowbridge.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/snowbridge.rs index bde909648e..b0ac089a43 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/snowbridge.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/snowbridge.rs @@ -249,7 +249,7 @@ pub fn send_transfer_token_message_failure( exchange_rate: FixedU128::from_rational(1, 75), fee_per_gas: gwei(20), rewards: Rewards { - local: (1 * UNITS / 100).into(), // 0.01 DOT + local: (UNITS / 100).into(), // 0.01 DOT remote: meth(1), }, multiplier: FixedU128::from_rational(1, 1), diff --git a/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs b/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs index 0f1c5fd815..8a702b9c23 100644 --- a/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs +++ b/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs @@ -26,7 +26,6 @@ use crate::{ ParachainInfo, PolkadotTreasuryAccount, Preimage, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, Scheduler, DAYS, FELLOWSHIP_TREASURY_PALLET_ID, }; -use cumulus_primitives_core::Junction::GeneralIndex; use frame_support::{ parameter_types, traits::{ @@ -50,7 +49,6 @@ use polkadot_runtime_constants::{ use sp_arithmetic::Permill; use sp_core::{ConstU128, ConstU32}; use sp_runtime::traits::{ConstU16, ConvertToValue, IdentityLookup, Replace, TakeFirst}; -use xcm::latest::BodyId; use xcm_builder::{AliasesIntoAccountId32, LocatableAssetId, PayOverXcm}; #[cfg(feature = "runtime-benchmarks")] @@ -269,7 +267,7 @@ parameter_types! { pub const FellowshipTreasuryPalletId: PalletId = FELLOWSHIP_TREASURY_PALLET_ID; pub const ProposalBond: Permill = Permill::from_percent(100); pub const Burn: Permill = Permill::from_percent(0); - pub const MaxBalance: Balance = Balance::max_value(); + pub const MaxBalance: Balance = Balance::MAX; // The asset's interior location for the paying account. This is the Fellowship Treasury // pallet instance. pub FellowshipTreasuryInteriorLocation: InteriorLocation = diff --git a/system-parachains/collectives/collectives-polkadot/src/fellowship/tracks.rs b/system-parachains/collectives/collectives-polkadot/src/fellowship/tracks.rs index f4ba4e05ec..f6ef2166a4 100644 --- a/system-parachains/collectives/collectives-polkadot/src/fellowship/tracks.rs +++ b/system-parachains/collectives/collectives-polkadot/src/fellowship/tracks.rs @@ -71,7 +71,7 @@ impl Convert for MinRankOfClass { // A promotion vote; the track ID turns out to be 18 more than the minimum required // rank. promotion @ 21..=26 => promotion - 18, - _ => Rank::max_value(), + _ => Rank::MAX, } } } @@ -80,7 +80,7 @@ const RETAIN_MAX_DECIDING: u32 = 25; const RETAIN_DECISION_DEPOSIT: Balance = 5 * DOLLARS; const RETAIN_PREPARE_PERIOD: BlockNumber = 0; const RETAIN_DECISION_PERIOD: BlockNumber = 14 * DAYS; -const RETAIN_CONFIRM_PERIOD: BlockNumber = 1 * HOURS; +const RETAIN_CONFIRM_PERIOD: BlockNumber = HOURS; const RETAIN_MIN_ENACTMENT_PERIOD: BlockNumber = 0; const RETAIN_MIN_APPROVAL: pallet_referenda::Curve = pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), @@ -97,7 +97,7 @@ const PROMOTE_MAX_DECIDING: u32 = 10; const PROMOTE_DECISION_DEPOSIT: Balance = 5 * DOLLARS; const PROMOTE_PREPARE_PERIOD: BlockNumber = 0; const PROMOTE_DECISION_PERIOD: BlockNumber = 30 * DAYS; -const PROMOTE_CONFIRM_PERIOD: BlockNumber = 1 * HOURS; +const PROMOTE_CONFIRM_PERIOD: BlockNumber = HOURS; const PROMOTE_MIN_ENACTMENT_PERIOD: BlockNumber = 0; const PROMOTE_MIN_APPROVAL: pallet_referenda::Curve = pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), diff --git a/system-parachains/collectives/collectives-polkadot/src/impls.rs b/system-parachains/collectives/collectives-polkadot/src/impls.rs index 02086c0adb..77215cbc26 100644 --- a/system-parachains/collectives/collectives-polkadot/src/impls.rs +++ b/system-parachains/collectives/collectives-polkadot/src/impls.rs @@ -14,22 +14,18 @@ // limitations under the License. use super::*; -use crate::OriginCaller; use frame_support::{ dispatch::DispatchResultWithPostInfo, traits::{ tokens::ConversionFromAssetBalance, Contains, Currency, Get, Imbalance, OnUnbalanced, OriginTrait, PrivilegeCmp, }, - weights::Weight, }; -use log; use pallet_alliance::{ProposalIndex, ProposalProvider}; use parachains_common::impls::NegativeImbalance; use polkadot_parachain_primitives::primitives::{Id as ParaId, IsSystem}; use sp_runtime::DispatchError; use sp_std::{cmp::Ordering, marker::PhantomData, prelude::*}; -use xcm::latest::{Fungibility, Junction, Junctions::Here, Location, Parent, WeightLimit}; use xcm_executor::traits::ConvertLocation; type AccountIdOf = ::AccountId; diff --git a/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs b/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs index e49e41121e..f61112defa 100644 --- a/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs +++ b/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs @@ -21,7 +21,6 @@ use super::{ use frame_support::{ parameter_types, traits::{ConstU32, Contains, Equals, Everything, Nothing}, - weights::Weight, }; use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; diff --git a/system-parachains/coretime/coretime-kusama/src/coretime.rs b/system-parachains/coretime/coretime-kusama/src/coretime.rs index 8ba44741f5..1bc3487b43 100644 --- a/system-parachains/coretime/coretime-kusama/src/coretime.rs +++ b/system-parachains/coretime/coretime-kusama/src/coretime.rs @@ -28,7 +28,6 @@ use frame_support::{ use pallet_broker::{ AdaptPrice, CoreAssignment, CoreIndex, CoretimeInterface, PartsOf57600, RCBlockNumberOf, }; -use parachains_common::{AccountId, Balance, BlockNumber}; use sp_runtime::{ traits::{AccountIdConversion, One, Saturating}, FixedU64, diff --git a/system-parachains/coretime/coretime-kusama/src/weights/xcm/mod.rs b/system-parachains/coretime/coretime-kusama/src/weights/xcm/mod.rs index 1cf30c053d..b12d688d38 100644 --- a/system-parachains/coretime/coretime-kusama/src/weights/xcm/mod.rs +++ b/system-parachains/coretime/coretime-kusama/src/weights/xcm/mod.rs @@ -18,7 +18,6 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; use crate::{xcm_config::MaxAssetsIntoHolding, Runtime}; -use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; use sp_std::prelude::*; diff --git a/system-parachains/encointer/src/lib.rs b/system-parachains/encointer/src/lib.rs index 217fcac6fd..fd4b534e62 100644 --- a/system-parachains/encointer/src/lib.rs +++ b/system-parachains/encointer/src/lib.rs @@ -345,7 +345,7 @@ pub struct NoConversion; impl ConversionFromAssetBalance for NoConversion { type Error = (); fn from_asset_balance(balance: Balance, _asset_id: ()) -> Result { - return Ok(balance) + Ok(balance) } #[cfg(feature = "runtime-benchmarks")] fn ensure_successful(_: ()) {} @@ -1296,7 +1296,7 @@ mod system_parachains_constants { use polkadot_primitives::Balance; /// The existential deposit. - pub const EXISTENTIAL_DEPOSIT: Balance = 1 * CENTS; + pub const EXISTENTIAL_DEPOSIT: Balance = CENTS; pub const UNITS: Balance = 1_000_000_000_000; pub const QUID: Balance = UNITS / 30; diff --git a/system-parachains/encointer/src/migrations_fix.rs b/system-parachains/encointer/src/migrations_fix.rs index 0493d57bb5..f5992de5a1 100644 --- a/system-parachains/encointer/src/migrations_fix.rs +++ b/system-parachains/encointer/src/migrations_fix.rs @@ -24,7 +24,7 @@ pub mod balances { use sp_runtime::TryRuntimeError; /// The log target. - const TARGET: &'static str = "runtime::fix::balances::migration"; + const TARGET: &str = "runtime::fix::balances::migration"; pub mod v1 { use super::*; use frame_support::pallet_prelude::*; @@ -72,7 +72,7 @@ pub mod scheduler { use sp_runtime::TryRuntimeError; /// The log target. - const TARGET: &'static str = "runtime::fix::scheduler::migration"; + const TARGET: &str = "runtime::fix::scheduler::migration"; pub mod v1 { use super::*; @@ -144,6 +144,7 @@ pub mod scheduler { StorageMap, Twox64Concat, TaskName, TaskAddress>>; /// Migrate the scheduler pallet from V0 to V4 by brute-force emptying the agenda. + #[allow(dead_code)] pub struct MigrateToV4(sp_std::marker::PhantomData); impl OnRuntimeUpgrade for MigrateToV4 { diff --git a/system-parachains/encointer/src/xcm_config.rs b/system-parachains/encointer/src/xcm_config.rs index a53c78d047..6639eecfb3 100644 --- a/system-parachains/encointer/src/xcm_config.rs +++ b/system-parachains/encointer/src/xcm_config.rs @@ -22,7 +22,6 @@ use super::{ use frame_support::{ parameter_types, traits::{Contains, Everything, Nothing}, - weights::Weight, }; use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; diff --git a/system-parachains/gluttons/glutton-kusama/src/xcm_config.rs b/system-parachains/gluttons/glutton-kusama/src/xcm_config.rs index d79f1b98a5..0c7f2cac18 100644 --- a/system-parachains/gluttons/glutton-kusama/src/xcm_config.rs +++ b/system-parachains/gluttons/glutton-kusama/src/xcm_config.rs @@ -20,7 +20,6 @@ use super::{ use frame_support::{ match_types, parameter_types, traits::{Everything, Nothing}, - weights::Weight, }; use xcm::latest::prelude::*; use xcm_builder::{ diff --git a/system-parachains/people/people-kusama/src/people.rs b/system-parachains/people/people-kusama/src/people.rs index cfcb76a05f..5f260c9a3d 100644 --- a/system-parachains/people/people-kusama/src/people.rs +++ b/system-parachains/people/people-kusama/src/people.rs @@ -18,8 +18,7 @@ use crate::xcm_config::LocationToAccountId; use codec::{Decode, Encode, MaxEncodedLen}; use enumflags2::{bitflags, BitFlags}; use frame_support::{ - parameter_types, traits::ConstU32, CloneNoBound, EqNoBound, PartialEqNoBound, - RuntimeDebugNoBound, + parameter_types, CloneNoBound, EqNoBound, PartialEqNoBound, RuntimeDebugNoBound, }; use pallet_identity::{Data, IdentityInformationProvider}; use parachains_common::{impls::ToParentTreasury, DAYS}; diff --git a/system-parachains/people/people-kusama/src/weights/xcm/mod.rs b/system-parachains/people/people-kusama/src/weights/xcm/mod.rs index 23e9ca6829..37ea90fa3b 100644 --- a/system-parachains/people/people-kusama/src/weights/xcm/mod.rs +++ b/system-parachains/people/people-kusama/src/weights/xcm/mod.rs @@ -17,7 +17,6 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; use crate::{xcm_config::MaxAssetsIntoHolding, Runtime}; -use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; use sp_std::prelude::*;