diff --git a/modules/aggregated-dex/src/lib.rs b/modules/aggregated-dex/src/lib.rs index 482a1a3a7d..f107d97d17 100644 --- a/modules/aggregated-dex/src/lib.rs +++ b/modules/aggregated-dex/src/lib.rs @@ -282,10 +282,8 @@ impl Pallet { match path { SwapPath::Dex(dex_path) => { // calculate the supply amount - let (supply_amount, _) = T::DEX::get_swap_amount( - dex_path, - SwapLimit::ExactTarget(Balance::max_value(), input_amount), - )?; + let (supply_amount, _) = + T::DEX::get_swap_amount(dex_path, SwapLimit::ExactTarget(Balance::MAX, input_amount))?; input_amount = supply_amount; } diff --git a/modules/dex/src/lib.rs b/modules/dex/src/lib.rs index 90888a1406..728dd33aac 100644 --- a/modules/dex/src/lib.rs +++ b/modules/dex/src/lib.rs @@ -818,12 +818,10 @@ impl Pallet { LiquidityPool::::try_mutate(trading_pair, |(pool_0, pool_1)| -> sp_std::result::Result { let old_pool_0 = *pool_0; let old_pool_1 = *pool_1; - f((pool_0, pool_1)).map(move |result| { + f((pool_0, pool_1)).inspect(move |_result| { if *pool_0 != old_pool_0 || *pool_1 != old_pool_1 { T::OnLiquidityPoolUpdated::happened(&(*trading_pair, *pool_0, *pool_1)); } - - result }) }) } diff --git a/modules/evm/src/runner/stack.rs b/modules/evm/src/runner/stack.rs index a31cc7ed37..e773f1eeaf 100644 --- a/modules/evm/src/runner/stack.rs +++ b/modules/evm/src/runner/stack.rs @@ -469,9 +469,8 @@ impl<'config> SubstrateStackSubstate<'config> { let target = self.metadata().target().expect("Storage target is none"); let storage = exited.metadata().storage_meter().used_storage(); - self.metadata.swallow_commit(exited.metadata).map_err(|e| { + self.metadata.swallow_commit(exited.metadata).inspect_err(|_e| { sp_io::storage::rollback_transaction(); - e })?; self.logs.append(&mut exited.logs); self.deletes.append(&mut exited.deletes); @@ -486,9 +485,8 @@ impl<'config> SubstrateStackSubstate<'config> { pub fn exit_revert(&mut self) -> Result<(), ExitError> { let mut exited = *self.parent.take().expect("Cannot discard on root substate"); mem::swap(&mut exited, self); - self.metadata.swallow_revert(exited.metadata).map_err(|e| { + self.metadata.swallow_revert(exited.metadata).inspect_err(|_e| { sp_io::storage::rollback_transaction(); - e })?; sp_io::storage::rollback_transaction(); @@ -498,9 +496,8 @@ impl<'config> SubstrateStackSubstate<'config> { pub fn exit_discard(&mut self) -> Result<(), ExitError> { let mut exited = *self.parent.take().expect("Cannot discard on root substate"); mem::swap(&mut exited, self); - self.metadata.swallow_discard(exited.metadata).map_err(|e| { + self.metadata.swallow_discard(exited.metadata).inspect_err(|_e| { sp_io::storage::rollback_transaction(); - e })?; sp_io::storage::rollback_transaction(); diff --git a/modules/evm/src/runner/state.rs b/modules/evm/src/runner/state.rs index 14c821fe19..45fdd8437a 100644 --- a/modules/evm/src/runner/state.rs +++ b/modules/evm/src/runner/state.rs @@ -811,7 +811,7 @@ impl<'config, 'precompiles, S: StackState<'config>, P: PrecompileSet> StackExecu let mut stream = rlp::RlpStream::new_list(2); stream.append(&caller); stream.append(&nonce); - H256::from_slice(Keccak256::digest(&stream.out()).as_slice()).into() + H256::from_slice(Keccak256::digest(stream.out()).as_slice()).into() } CreateScheme::Fixed(naddress) => naddress, }; diff --git a/modules/homa/src/lib.rs b/modules/homa/src/lib.rs index 42694fc29b..4f150b1878 100644 --- a/modules/homa/src/lib.rs +++ b/modules/homa/src/lib.rs @@ -714,7 +714,7 @@ pub mod module { let mut ledger = maybe_ledger.take().unwrap_or_default(); let old_bonded_amount = ledger.bonded; - f(&mut ledger).map(move |result| { + f(&mut ledger).inspect(move |_result| { *maybe_ledger = if ledger == Default::default() { TotalStakingBonded::::mutate(|staking_balance| { *staking_balance = staking_balance.saturating_sub(old_bonded_amount) @@ -728,7 +728,6 @@ pub mod module { }); Some(ledger) }; - result }) }) } diff --git a/modules/incentives/src/lib.rs b/modules/incentives/src/lib.rs index b7a90da498..7114b2d5aa 100644 --- a/modules/incentives/src/lib.rs +++ b/modules/incentives/src/lib.rs @@ -32,8 +32,8 @@ //! //! Rewards accumulation: //! 1. Incentives: periodicly(AccumulatePeriod), accumulate fixed amount according to Incentive. -//! Rewards come from RewardsSource, please transfer enough tokens to RewardsSource before -//! start incentive plan. +//! Rewards come from RewardsSource, please transfer enough tokens to RewardsSource before start +//! incentive plan. #![cfg_attr(not(feature = "std"), no_std)] #![allow(clippy::unused_unit)] diff --git a/runtime/acala/src/lib.rs b/runtime/acala/src/lib.rs index 822db4ef5a..11b2ae9f39 100644 --- a/runtime/acala/src/lib.rs +++ b/runtime/acala/src/lib.rs @@ -766,7 +766,7 @@ impl orml_oracle::Config for Runtime { type RootOperatorAccountId = RootOperatorAccountId; type Members = OperatorMembershipAcala; type MaxHasDispatchedSize = ConstU32<20>; - type WeightInfo = (); + type WeightInfo = weights::orml_oracle::WeightInfo; type MaxFeedValues = MaxFeedValues; #[cfg(feature = "runtime-benchmarks")] type BenchmarkHelper = BenchmarkHelper; @@ -805,7 +805,7 @@ parameter_type_with_key! { TokenSymbol::ACA | TokenSymbol::KBTC | TokenSymbol::KINT | - TokenSymbol::TAI => Balance::max_value() // unsupported + TokenSymbol::TAI => Balance::MAX // unsupported }, CurrencyId::DexShare(dex_share_0, _) => { let currency_id_0: CurrencyId = (*dex_share_0).into(); @@ -817,20 +817,20 @@ parameter_type_with_key! { } else if let CurrencyId::Erc20(address) = currency_id_0 { // LP token with erc20 AssetIdMaps::::get_asset_metadata(AssetIds::Erc20(address)). - map_or(Balance::max_value(), |metatata| metatata.minimal_balance) + map_or(Balance::MAX, |metatata| metatata.minimal_balance) } else { Self::get(¤cy_id_0) } }, - CurrencyId::Erc20(address) => AssetIdMaps::::get_asset_metadata(AssetIds::Erc20(*address)).map_or(Balance::max_value(), |metatata| metatata.minimal_balance), + CurrencyId::Erc20(address) => AssetIdMaps::::get_asset_metadata(AssetIds::Erc20(*address)).map_or(Balance::MAX, |metatata| metatata.minimal_balance), CurrencyId::StableAssetPoolToken(stable_asset_id) => { AssetIdMaps::::get_asset_metadata(AssetIds::StableAssetId(*stable_asset_id)). - map_or(Balance::max_value(), |metatata| metatata.minimal_balance) + map_or(Balance::MAX, |metatata| metatata.minimal_balance) }, CurrencyId::LiquidCrowdloan(_) => ExistentialDeposits::get(&CurrencyId::Token(TokenSymbol::DOT)), // the same as DOT CurrencyId::ForeignAsset(foreign_asset_id) => { AssetIdMaps::::get_asset_metadata(AssetIds::ForeignAssetId(*foreign_asset_id)). - map_or(Balance::max_value(), |metatata| metatata.minimal_balance) + map_or(Balance::MAX, |metatata| metatata.minimal_balance) }, } }; diff --git a/runtime/common/src/xcm_impl.rs b/runtime/common/src/xcm_impl.rs index cfde56f8bf..502e261356 100644 --- a/runtime/common/src/xcm_impl.rs +++ b/runtime/common/src/xcm_impl.rs @@ -117,8 +117,8 @@ where /// Simple fee calculator that requires payment in a single fungible at a fixed rate. /// -/// - The `FixedRate` constant should be the concrete fungible ID and the amount of it -/// required for one second of weight. +/// - The `FixedRate` constant should be the concrete fungible ID and the amount of it required for +/// one second of weight. /// - The `TakeRevenue` trait is used to collecting xcm execution fee. /// - The `BuyWeightRate` trait is used to calculate ratio by location. pub struct FixedRateOfAsset, R: TakeRevenue, M: BuyWeightRate> { diff --git a/runtime/karura/src/lib.rs b/runtime/karura/src/lib.rs index af2b110964..88304685c8 100644 --- a/runtime/karura/src/lib.rs +++ b/runtime/karura/src/lib.rs @@ -775,7 +775,7 @@ impl orml_oracle::Config for Runtime { type RootOperatorAccountId = RootOperatorAccountId; type Members = OperatorMembershipAcala; type MaxHasDispatchedSize = ConstU32<20>; - type WeightInfo = (); + type WeightInfo = weights::orml_oracle::WeightInfo; type MaxFeedValues = MaxFeedValues; #[cfg(feature = "runtime-benchmarks")] type BenchmarkHelper = BenchmarkHelper; @@ -814,7 +814,7 @@ parameter_type_with_key! { TokenSymbol::DOT | TokenSymbol::LDOT | TokenSymbol::KAR | - TokenSymbol::TAP => Balance::max_value() // unsupported + TokenSymbol::TAP => Balance::MAX // unsupported }, CurrencyId::DexShare(dex_share_0, _) => { let currency_id_0: CurrencyId = (*dex_share_0).into(); @@ -826,20 +826,20 @@ parameter_type_with_key! { } else if let CurrencyId::Erc20(address) = currency_id_0 { // LP token with erc20 AssetIdMaps::::get_asset_metadata(AssetIds::Erc20(address)). - map_or(Balance::max_value(), |metatata| metatata.minimal_balance) + map_or(Balance::MAX, |metatata| metatata.minimal_balance) } else { Self::get(¤cy_id_0) } }, - CurrencyId::Erc20(address) => AssetIdMaps::::get_asset_metadata(AssetIds::Erc20(*address)).map_or(Balance::max_value(), |metatata| metatata.minimal_balance), + CurrencyId::Erc20(address) => AssetIdMaps::::get_asset_metadata(AssetIds::Erc20(*address)).map_or(Balance::MAX, |metatata| metatata.minimal_balance), CurrencyId::StableAssetPoolToken(stable_asset_id) => { AssetIdMaps::::get_asset_metadata(AssetIds::StableAssetId(*stable_asset_id)). - map_or(Balance::max_value(), |metatata| metatata.minimal_balance) + map_or(Balance::MAX, |metatata| metatata.minimal_balance) }, CurrencyId::LiquidCrowdloan(_) => ExistentialDeposits::get(&CurrencyId::Token(TokenSymbol::KSM)), // the same as KSM CurrencyId::ForeignAsset(foreign_asset_id) => { AssetIdMaps::::get_asset_metadata(AssetIds::ForeignAssetId(*foreign_asset_id)). - map_or(Balance::max_value(), |metatata| metatata.minimal_balance) + map_or(Balance::MAX, |metatata| metatata.minimal_balance) }, } }; diff --git a/runtime/mandala/src/lib.rs b/runtime/mandala/src/lib.rs index 95fc2e9213..46d877489d 100644 --- a/runtime/mandala/src/lib.rs +++ b/runtime/mandala/src/lib.rs @@ -861,7 +861,7 @@ parameter_type_with_key! { TokenSymbol::TAI => 10 * millicent(*currency_id), TokenSymbol::TAP => 10 * millicent(*currency_id), TokenSymbol::ACA | - TokenSymbol::KAR => Balance::max_value() // unsupported + TokenSymbol::KAR => Balance::MAX // unsupported }, CurrencyId::DexShare(dex_share_0, _) => { let currency_id_0: CurrencyId = (*dex_share_0).into(); @@ -873,20 +873,20 @@ parameter_type_with_key! { } else if let CurrencyId::Erc20(address) = currency_id_0 { // LP token with erc20 AssetIdMaps::::get_asset_metadata(AssetIds::Erc20(address)). - map_or(Balance::max_value(), |metatata| metatata.minimal_balance) + map_or(Balance::MAX, |metatata| metatata.minimal_balance) } else { Self::get(¤cy_id_0) } }, - CurrencyId::Erc20(address) => AssetIdMaps::::get_asset_metadata(AssetIds::Erc20(*address)).map_or(Balance::max_value(), |metatata| metatata.minimal_balance), + CurrencyId::Erc20(address) => AssetIdMaps::::get_asset_metadata(AssetIds::Erc20(*address)).map_or(Balance::MAX, |metatata| metatata.minimal_balance), CurrencyId::StableAssetPoolToken(stable_asset_id) => { AssetIdMaps::::get_asset_metadata(AssetIds::StableAssetId(*stable_asset_id)). - map_or(Balance::max_value(), |metatata| metatata.minimal_balance) + map_or(Balance::MAX, |metatata| metatata.minimal_balance) }, CurrencyId::LiquidCrowdloan(_) => ExistentialDeposits::get(&CurrencyId::Token(TokenSymbol::DOT)), // the same as DOT CurrencyId::ForeignAsset(foreign_asset_id) => { AssetIdMaps::::get_asset_metadata(AssetIds::ForeignAssetId(*foreign_asset_id)). - map_or(Balance::max_value(), |metatata| metatata.minimal_balance) + map_or(Balance::MAX, |metatata| metatata.minimal_balance) }, } }; @@ -2682,12 +2682,6 @@ impl_runtime_apis! { } } -#[cfg(not(feature = "standalone"))] -cumulus_pallet_parachain_system::register_validate_block!( - Runtime = Runtime, - BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::, -); - #[cfg(test)] mod tests { use super::*; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index b365e13a84..6d985f163a 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "1.77.0" +channel = "1.81.0" components = ["rust-src", "rustfmt", "clippy"] targets = ["wasm32-unknown-unknown"]