From 7342e9127955d80851529e481c47e96077f5dc1d Mon Sep 17 00:00:00 2001 From: hqwangningbo <2536935847@qq.com> Date: Mon, 2 Dec 2024 22:16:54 +0800 Subject: [PATCH 1/3] Use BlockNumberProvider trait --- integration-tests/src/mock/bifrost.rs | 1 + pallets/bb-bnc/src/mock.rs | 1 + pallets/buy-back/src/mock.rs | 1 + pallets/deprecated/system-maker/src/mock.rs | 1 + pallets/fee-share/src/mock.rs | 1 + pallets/slp/src/agents/common.rs | 9 +++++--- pallets/slp/src/agents/utils.rs | 5 +++-- pallets/slp/src/lib.rs | 12 +++++++---- pallets/slp/src/mocks/mock.rs | 1 + pallets/slp/src/mocks/mock_kusama.rs | 1 + pallets/slpx/src/lib.rs | 23 ++++++++++++++------- pallets/slpx/src/mock.rs | 1 + pallets/system-staking/src/mock.rs | 1 + pallets/vesting/src/lib.rs | 17 ++++++++------- pallets/vesting/src/mock.rs | 1 + runtime/bifrost-kusama/src/lib.rs | 3 +++ runtime/bifrost-polkadot/src/lib.rs | 3 +++ 17 files changed, 59 insertions(+), 23 deletions(-) diff --git a/integration-tests/src/mock/bifrost.rs b/integration-tests/src/mock/bifrost.rs index 915cb879b..75d362433 100644 --- a/integration-tests/src/mock/bifrost.rs +++ b/integration-tests/src/mock/bifrost.rs @@ -309,6 +309,7 @@ impl bifrost_slp::Config for Runtime { type StablePoolHandler = (); type AssetIdMaps = AssetIdMaps; type TreasuryAccount = BifrostTreasuryAccount; + type BlockNumberProvider = System; } impl bifrost_asset_registry::Config for Runtime { diff --git a/pallets/bb-bnc/src/mock.rs b/pallets/bb-bnc/src/mock.rs index e82b13f68..f9153e629 100644 --- a/pallets/bb-bnc/src/mock.rs +++ b/pallets/bb-bnc/src/mock.rs @@ -319,6 +319,7 @@ impl bifrost_slp::Config for Runtime { type StablePoolHandler = (); type AssetIdMaps = AssetIdMaps; type TreasuryAccount = TreasuryAccount; + type BlockNumberProvider = System; } parameter_types! { diff --git a/pallets/buy-back/src/mock.rs b/pallets/buy-back/src/mock.rs index c11aa3872..8cdc643fd 100644 --- a/pallets/buy-back/src/mock.rs +++ b/pallets/buy-back/src/mock.rs @@ -245,6 +245,7 @@ impl bifrost_slp::Config for Runtime { type StablePoolHandler = (); type AssetIdMaps = AssetIdMaps; type TreasuryAccount = TreasuryAccount; + type BlockNumberProvider = System; } parameter_type_with_key! { diff --git a/pallets/deprecated/system-maker/src/mock.rs b/pallets/deprecated/system-maker/src/mock.rs index 7a309d1ae..e67824b15 100644 --- a/pallets/deprecated/system-maker/src/mock.rs +++ b/pallets/deprecated/system-maker/src/mock.rs @@ -244,6 +244,7 @@ impl bifrost_slp::Config for Runtime { type StablePoolHandler = (); type AssetIdMaps = AssetIdMaps; type TreasuryAccount = TreasuryAccount; + type BlockNumberProvider = System; } parameter_type_with_key! { diff --git a/pallets/fee-share/src/mock.rs b/pallets/fee-share/src/mock.rs index f138d448f..ac2e30fa6 100644 --- a/pallets/fee-share/src/mock.rs +++ b/pallets/fee-share/src/mock.rs @@ -357,6 +357,7 @@ impl bifrost_slp::Config for Runtime { type StablePoolHandler = (); type AssetIdMaps = AssetIdMaps; type TreasuryAccount = TreasuryAccount; + type BlockNumberProvider = System; } parameter_type_with_key! { diff --git a/pallets/slp/src/agents/common.rs b/pallets/slp/src/agents/common.rs index 021bb5b80..c8ffa4c5f 100644 --- a/pallets/slp/src/agents/common.rs +++ b/pallets/slp/src/agents/common.rs @@ -34,7 +34,10 @@ use orml_traits::{MultiCurrency, XcmTransfer}; use polkadot_parachain_primitives::primitives::Sibling; use sp_core::{Get, U256}; use sp_runtime::{ - traits::{AccountIdConversion, CheckedAdd, UniqueSaturatedFrom, UniqueSaturatedInto}, + traits::{ + AccountIdConversion, BlockNumberProvider, CheckedAdd, UniqueSaturatedFrom, + UniqueSaturatedInto, + }, DispatchResult, Saturating, }; use xcm::v3::{prelude::*, MultiLocation}; @@ -348,7 +351,7 @@ impl Pallet { weight_and_fee: Option<(Weight, BalanceOf)>, ) -> Result<(QueryId, BlockNumberFor, BalanceOf, xcm::v4::Xcm<()>), Error> { // prepare the query_id for reporting back transact status - let now = frame_system::Pallet::::block_number(); + let now = T::BlockNumberProvider::current_block_number(); let timeout = BlockNumberFor::::from(TIMEOUT_BLOCKS).saturating_add(now); let (query_id, notify_call_weight) = Self::get_query_id_and_notify_call_weight(currency_id, &operation)?; @@ -377,7 +380,7 @@ impl Pallet { currency_id: CurrencyId, operation: &XcmOperationType, ) -> Result<(QueryId, Weight), Error> { - let now = frame_system::Pallet::::block_number(); + let now = T::BlockNumberProvider::current_block_number(); let timeout = BlockNumberFor::::from(TIMEOUT_BLOCKS).saturating_add(now); let responder = Self::convert_currency_to_dest_location(currency_id)?; diff --git a/pallets/slp/src/agents/utils.rs b/pallets/slp/src/agents/utils.rs index 2c970f99e..eb3c7e37c 100644 --- a/pallets/slp/src/agents/utils.rs +++ b/pallets/slp/src/agents/utils.rs @@ -27,6 +27,7 @@ use bifrost_primitives::{ use frame_support::ensure; use parity_scale_codec::Encode; use sp_core::Get; +use sp_runtime::traits::BlockNumberProvider; use sp_std::prelude::*; use xcm::v3::{prelude::*, MultiLocation}; @@ -215,7 +216,7 @@ impl Pallet { let (entry, timeout) = DelegatorLedgerXcmUpdateQueue::::get(query_id).ok_or(Error::::QueryNotExist)?; - let now = frame_system::Pallet::::block_number(); + let now = T::BlockNumberProvider::current_block_number(); let mut updated = true; if now <= timeout { let currency_id = match entry.clone() { @@ -249,7 +250,7 @@ impl Pallet { let (entry, timeout) = ValidatorsByDelegatorXcmUpdateQueue::::get(query_id) .ok_or(Error::::QueryNotExist)?; - let now = frame_system::Pallet::::block_number(); + let now = T::BlockNumberProvider::current_block_number(); let mut updated = true; if now <= timeout { let currency_id = match entry.clone() { diff --git a/pallets/slp/src/lib.rs b/pallets/slp/src/lib.rs index 443002b58..4d24082e8 100644 --- a/pallets/slp/src/lib.rs +++ b/pallets/slp/src/lib.rs @@ -97,6 +97,7 @@ pub mod pallet { use frame_support::dispatch::GetDispatchInfo; use orml_traits::XcmTransfer; use pallet_xcm::ensure_response; + use sp_runtime::traits::BlockNumberProvider; use xcm::v3::{MaybeErrorCode, Response}; #[pallet::config] @@ -169,6 +170,9 @@ pub mod pallet { // asset registry to get asset metadata type AssetIdMaps: CurrencyIdMapping>>; + /// The current block number provider. + type BlockNumberProvider: BlockNumberProvider>; + #[pallet::constant] type TreasuryAccount: Get; } @@ -1180,7 +1184,7 @@ pub mod pallet { let last_update_block = LastTimeUpdatedOngoingTimeUnit::::get(currency_id) .ok_or(Error::::LastTimeUpdatedOngoingTimeUnitNotExist)?; - let current_block = frame_system::Pallet::::block_number(); + let current_block = T::BlockNumberProvider::current_block_number(); let blocks_between = current_block.checked_sub(&last_update_block).ok_or(Error::::UnderFlow)?; @@ -1885,7 +1889,7 @@ pub mod pallet { Pallet::::check_length_and_deduplicate(currency_id, validator_list)?; // get current block number - let current_block_number = >::block_number(); + let current_block_number = T::BlockNumberProvider::current_block_number(); // get the due block number let due_block_number = current_block_number .checked_add(&BlockNumberFor::::from(SIX_MONTHS)) @@ -1957,7 +1961,7 @@ pub mod pallet { T::ControlOrigin::ensure_origin(origin)?; // get current block number - let current_block_number = >::block_number(); + let current_block_number = T::BlockNumberProvider::current_block_number(); // get the due block number if the validator is not in the validator boost list let mut due_block_number = current_block_number @@ -2155,7 +2159,7 @@ pub mod pallet { 0 }; - let current_block_number = >::block_number(); + let current_block_number = T::BlockNumberProvider::current_block_number(); let mut remove_num = 0; // for each validator in the validator boost list, if the due block number is less than // or equal to the current block number, remove it diff --git a/pallets/slp/src/mocks/mock.rs b/pallets/slp/src/mocks/mock.rs index a8328f5b3..d41481738 100644 --- a/pallets/slp/src/mocks/mock.rs +++ b/pallets/slp/src/mocks/mock.rs @@ -458,6 +458,7 @@ impl Config for Runtime { type StablePoolHandler = (); type AssetIdMaps = AssetIdMaps; type TreasuryAccount = BifrostTreasuryAccount; + type BlockNumberProvider = System; } pub struct XcmDestWeightAndFee; diff --git a/pallets/slp/src/mocks/mock_kusama.rs b/pallets/slp/src/mocks/mock_kusama.rs index 6c7c53986..e31efac53 100644 --- a/pallets/slp/src/mocks/mock_kusama.rs +++ b/pallets/slp/src/mocks/mock_kusama.rs @@ -528,6 +528,7 @@ impl Config for Runtime { type StablePoolHandler = StablePool; type AssetIdMaps = AssetIdMaps; type TreasuryAccount = BifrostTreasuryAccount; + type BlockNumberProvider = System; } pub struct XcmDestWeightAndFee; diff --git a/pallets/slpx/src/lib.rs b/pallets/slpx/src/lib.rs index 3d3f0d399..829ae6d3a 100644 --- a/pallets/slpx/src/lib.rs +++ b/pallets/slpx/src/lib.rs @@ -49,7 +49,9 @@ use parity_scale_codec::{Decode, Encode}; use polkadot_parachain_primitives::primitives::{Id, Sibling}; use sp_core::{Hasher, H160, U256}; use sp_runtime::{ - traits::{AccountIdConversion, BlakeTwo256, CheckedSub, UniqueSaturatedFrom}, + traits::{ + AccountIdConversion, BlakeTwo256, BlockNumberProvider, CheckedSub, UniqueSaturatedFrom, + }, BoundedVec, DispatchError, }; use sp_std::{vec, vec::Vec}; @@ -81,6 +83,7 @@ pub mod pallet { weights::WeightMeter, }; use frame_system::ensure_root; + use sp_runtime::traits::BlockNumberProvider; const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); @@ -104,7 +107,8 @@ pub mod pallet { CurrencyIdOf, BalanceOf, >; - + /// The current block number provider. + type BlockNumberProvider: BlockNumberProvider>; /// xtokens xcm transfer interface type XcmTransfer: XcmTransfer, BalanceOf, CurrencyIdOf>; /// Send Xcm @@ -302,7 +306,7 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { - fn on_idle(n: BlockNumberFor, limit: Weight) -> Weight { + fn on_idle(_: BlockNumberFor, limit: Weight) -> Weight { let mut weight = Weight::default(); if WeightMeter::with_limit(limit) @@ -312,14 +316,19 @@ pub mod pallet { return weight; } + let current_block_number = T::BlockNumberProvider::current_block_number(); let mut is_handle_xcm_oracle = false; - if let Err(error) = Self::handle_xcm_oracle(n, &mut is_handle_xcm_oracle, &mut weight) { + if let Err(error) = Self::handle_xcm_oracle( + current_block_number, + &mut is_handle_xcm_oracle, + &mut weight, + ) { Self::deposit_event(Event::::XcmOracleFailed { error }); } if !is_handle_xcm_oracle { - let _ = Self::handle_order_queue(n, &mut weight); + let _ = Self::handle_order_queue(current_block_number, &mut weight); } weight } @@ -547,7 +556,7 @@ pub mod pallet { xcm_fee, xcm_weight, period, - last_block: frame_system::Pallet::::block_number(), + last_block: T::BlockNumberProvider::current_block_number(), contract, }); Self::deposit_event(Event::SetXcmOracleConfiguration { @@ -828,7 +837,7 @@ impl Pallet { let order_type = Self::order_type(currency_id)?; let derivative_account = Self::frontier_derivative_account(&source_chain_caller); let order = Order { - create_block_number: >::block_number(), + create_block_number: T::BlockNumberProvider::current_block_number(), order_type, currency_id, currency_amount, diff --git a/pallets/slpx/src/mock.rs b/pallets/slpx/src/mock.rs index 605c72a8c..e359da7fa 100644 --- a/pallets/slpx/src/mock.rs +++ b/pallets/slpx/src/mock.rs @@ -318,6 +318,7 @@ impl slpx::Config for Test { type ParachainId = ParachainId; type WeightInfo = (); type MaxOrderSize = ConstU32<500>; + type BlockNumberProvider = System; } // Build genesis storage according to the mock runtime. diff --git a/pallets/system-staking/src/mock.rs b/pallets/system-staking/src/mock.rs index b70453057..df8a8c7c6 100644 --- a/pallets/system-staking/src/mock.rs +++ b/pallets/system-staking/src/mock.rs @@ -272,6 +272,7 @@ impl bifrost_slp::Config for Runtime { type StablePoolHandler = (); type AssetIdMaps = AssetIdMaps; type TreasuryAccount = TreasuryAccount; + type BlockNumberProvider = System; } parameter_types! { diff --git a/pallets/vesting/src/lib.rs b/pallets/vesting/src/lib.rs index c70f2754a..abf768940 100644 --- a/pallets/vesting/src/lib.rs +++ b/pallets/vesting/src/lib.rs @@ -72,8 +72,8 @@ use scale_info::TypeInfo; use sp_runtime::{ codec::{Decode, Encode, MaxEncodedLen}, traits::{ - AtLeast32BitUnsigned, Bounded, Convert, MaybeSerializeDeserialize, One, Saturating, - StaticLookup, Zero, + AtLeast32BitUnsigned, BlockNumberProvider, Bounded, Convert, MaybeSerializeDeserialize, + One, Saturating, StaticLookup, Zero, }, DispatchError, RuntimeDebug, }; @@ -177,6 +177,9 @@ pub mod pallet { /// the unvested amount. type UnvestedFundsAllowedWithdrawReasons: Get; + /// Provider for the block number. + type BlockNumberProvider: BlockNumberProvider>; + /// Maximum number of vesting schedules an account may have at a given moment. const MAX_VESTING_SCHEDULES: u32; } @@ -428,7 +431,7 @@ pub mod pallet { let absolute_start = VestingStartAt::::get().ok_or(Error::::VestingStartAtNotSet)?; - let now = >::block_number(); + let now = T::BlockNumberProvider::current_block_number(); let old_start_at = absolute_start.saturating_add(schedules[index].starting_block()); let remained_vesting = @@ -523,7 +526,7 @@ pub mod pallet { impl Pallet { fn check_cliff(who: T::AccountId) -> DispatchResult { if let Some(cliff_block) = Cliff::::get(who.clone()) { - let now = >::block_number(); + let now = T::BlockNumberProvider::current_block_number(); ensure!(cliff_block < now, Error::::WrongCliffVesting); Cliff::::remove(who); }; @@ -641,7 +644,7 @@ impl Pallet { schedules: Vec, BlockNumberFor>>, action: VestingAction, ) -> (Vec, BlockNumberFor>>, BalanceOf) { - let now = >::block_number(); + let now = T::BlockNumberProvider::current_block_number(); let mut total_locked_now: BalanceOf = Zero::zero(); let filtered_schedules = action @@ -727,7 +730,7 @@ impl Pallet { let (mut schedules, mut locked_now) = Self::report_schedule_updates(schedules.to_vec(), action); - let now = >::block_number(); + let now = T::BlockNumberProvider::current_block_number(); if let Some(new_schedule) = Self::merge_vesting_info(now, schedule1, schedule2) { // Merging created a new schedule so we: // 1) need to add it to the accounts vesting schedule collection, @@ -765,7 +768,7 @@ where /// Get the amount that is currently being vested and cannot be transferred out of this account. fn vesting_balance(who: &T::AccountId) -> Option> { if let Some(v) = Vesting::::get(who) { - let now = >::block_number(); + let now = T::BlockNumberProvider::current_block_number(); let total_locked_now = v.iter().fold(Zero::zero(), |total, schedule| { let start_at = VestingStartAt::::get() .map(|st| st.saturating_add(schedule.starting_block())); diff --git a/pallets/vesting/src/mock.rs b/pallets/vesting/src/mock.rs index 8ed458342..28a99cbc3 100644 --- a/pallets/vesting/src/mock.rs +++ b/pallets/vesting/src/mock.rs @@ -79,6 +79,7 @@ impl Config for Test { type MinVestedTransfer = MinVestedTransfer; type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons; type WeightInfo = (); + type BlockNumberProvider = System; } pub struct ExtBuilder { diff --git a/runtime/bifrost-kusama/src/lib.rs b/runtime/bifrost-kusama/src/lib.rs index 0199f63c0..a9aa89bf8 100644 --- a/runtime/bifrost-kusama/src/lib.rs +++ b/runtime/bifrost-kusama/src/lib.rs @@ -1100,6 +1100,7 @@ impl bifrost_vesting::Config for Runtime { type WeightInfo = weights::bifrost_vesting::BifrostWeight; type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons; const MAX_VESTING_SCHEDULES: u32 = 28; + type BlockNumberProvider = System; } // Bifrost modules start @@ -1337,6 +1338,7 @@ impl bifrost_slp::Config for Runtime { type StablePoolHandler = StablePool; type AssetIdMaps = AssetIdMaps; type TreasuryAccount = BifrostTreasuryAccount; + type BlockNumberProvider = System; } impl bifrost_vstoken_conversion::Config for Runtime { @@ -1581,6 +1583,7 @@ impl bifrost_slpx::Config for Runtime { type ParachainId = ParachainInfo; type WeightInfo = weights::bifrost_slpx::BifrostWeight; type MaxOrderSize = ConstU32<500>; + type BlockNumberProvider = System; } pub struct EnsurePoolAssetId; diff --git a/runtime/bifrost-polkadot/src/lib.rs b/runtime/bifrost-polkadot/src/lib.rs index 72638b573..7f89460c5 100644 --- a/runtime/bifrost-polkadot/src/lib.rs +++ b/runtime/bifrost-polkadot/src/lib.rs @@ -958,6 +958,7 @@ impl bifrost_vesting::Config for Runtime { type WeightInfo = weights::bifrost_vesting::BifrostWeight; type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons; const MAX_VESTING_SCHEDULES: u32 = 28; + type BlockNumberProvider = System; } // Bifrost modules start @@ -1179,6 +1180,7 @@ impl bifrost_slp::Config for Runtime { type StablePoolHandler = StablePool; type AssetIdMaps = AssetIdMaps; type TreasuryAccount = BifrostTreasuryAccount; + type BlockNumberProvider = System; } parameter_types! { @@ -1268,6 +1270,7 @@ impl bifrost_slpx::Config for Runtime { type ParachainId = ParachainInfo; type WeightInfo = weights::bifrost_slpx::BifrostWeight; type MaxOrderSize = ConstU32<500>; + type BlockNumberProvider = System; } pub struct EnsurePoolAssetId; From a645bb66e7ea0f505386343ee29202ee0c1cb1bc Mon Sep 17 00:00:00 2001 From: hqwangningbo <2536935847@qq.com> Date: Mon, 2 Dec 2024 22:20:13 +0800 Subject: [PATCH 2/3] Revert deprecated --- pallets/deprecated/system-maker/src/mock.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/pallets/deprecated/system-maker/src/mock.rs b/pallets/deprecated/system-maker/src/mock.rs index e67824b15..7a309d1ae 100644 --- a/pallets/deprecated/system-maker/src/mock.rs +++ b/pallets/deprecated/system-maker/src/mock.rs @@ -244,7 +244,6 @@ impl bifrost_slp::Config for Runtime { type StablePoolHandler = (); type AssetIdMaps = AssetIdMaps; type TreasuryAccount = TreasuryAccount; - type BlockNumberProvider = System; } parameter_type_with_key! { From 4047f3290cc11c1f96573dc40d9ae3d57e032d0f Mon Sep 17 00:00:00 2001 From: hqwangningbo <2536935847@qq.com> Date: Tue, 3 Dec 2024 09:57:30 +0800 Subject: [PATCH 3/3] Fix clippy --- Cargo.lock | 35 ----- Cargo.toml | 2 - runtime/bifrost-kusama/Cargo.toml | 4 - .../src/weights/bifrost_system_maker.rs | 122 ------------------ runtime/bifrost-kusama/src/weights/mod.rs | 1 - runtime/bifrost-polkadot/Cargo.toml | 3 - .../src/weights/bifrost_system_maker.rs | 122 ------------------ runtime/bifrost-polkadot/src/weights/mod.rs | 1 - 8 files changed, 290 deletions(-) delete mode 100644 runtime/bifrost-kusama/src/weights/bifrost_system_maker.rs delete mode 100644 runtime/bifrost-polkadot/src/weights/bifrost_system_maker.rs diff --git a/Cargo.lock b/Cargo.lock index 96c56dd0e..67f32247e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1342,7 +1342,6 @@ dependencies = [ "bifrost-stable-asset", "bifrost-stable-pool", "bifrost-stable-pool-rpc-runtime-api", - "bifrost-system-maker", "bifrost-system-staking", "bifrost-token-issuer", "bifrost-vbnc-convert", @@ -1504,7 +1503,6 @@ dependencies = [ "bifrost-stable-asset", "bifrost-stable-pool", "bifrost-stable-pool-rpc-runtime-api", - "bifrost-system-maker", "bifrost-system-staking", "bifrost-vesting", "bifrost-vstoken-conversion", @@ -2128,39 +2126,6 @@ dependencies = [ "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.13.0)", ] -[[package]] -name = "bifrost-system-maker" -version = "0.8.0" -dependencies = [ - "bifrost-asset-registry", - "bifrost-currencies", - "bifrost-primitives", - "bifrost-slp", - "bifrost-vtoken-minting", - "cumulus-primitives-core", - "frame-benchmarking", - "frame-support", - "frame-system", - "hex-literal 0.4.1", - "log", - "orml-tokens", - "orml-traits", - "orml-xtokens", - "pallet-balances", - "pallet-xcm", - "parity-scale-codec", - "scale-info", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.13.0)", - "staging-xcm", - "staging-xcm-builder", - "staging-xcm-executor", - "zenlink-protocol", -] - [[package]] name = "bifrost-system-staking" version = "4.0.0-dev" diff --git a/Cargo.toml b/Cargo.toml index ac5429758..ced3629f8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,6 @@ members = [ "pallets/vtoken-minting", "pallets/vtoken-voting", "pallets/system-staking", - "pallets/deprecated/system-maker", "pallets/fee-share", "pallets/parachain-staking", "pallets/bb-bnc", @@ -84,7 +83,6 @@ bifrost-slpx = { path = "pallets/slpx", default-featur bifrost-stable-asset = { path = "pallets/stable-asset", default-features = false } bifrost-stable-pool = { path = "pallets/stable-pool", default-features = false } bifrost-stable-pool-rpc-runtime-api = { path = "pallets/stable-pool/rpc/runtime-api", default-features = false } -bifrost-system-maker = { path = "pallets/deprecated/system-maker", default-features = false } bifrost-system-staking = { path = "pallets/system-staking", default-features = false } bifrost-token-issuer = { path = "pallets/token-issuer", default-features = false } bifrost-vbnc-convert = { path = "pallets/vbnc-convert", default-features = false } diff --git a/runtime/bifrost-kusama/Cargo.toml b/runtime/bifrost-kusama/Cargo.toml index f5b09216e..78d7d03f5 100644 --- a/runtime/bifrost-kusama/Cargo.toml +++ b/runtime/bifrost-kusama/Cargo.toml @@ -132,7 +132,6 @@ bifrost-slp = { workspace = true } bifrost-slpx = { workspace = true } bifrost-stable-pool = { workspace = true } bifrost-stable-pool-rpc-runtime-api = { workspace = true } -bifrost-system-maker = { workspace = true } bifrost-system-staking = { workspace = true } bifrost-token-issuer = { workspace = true } bifrost-vesting = { workspace = true } @@ -259,7 +258,6 @@ std = [ "bifrost-slpx/std", "bifrost-stable-pool-rpc-runtime-api/std", "bifrost-stable-pool/std", - "bifrost-system-maker/std", "bifrost-system-staking/std", "bifrost-token-issuer/std", "bifrost-vesting/std", @@ -312,7 +310,6 @@ runtime-benchmarks = [ "bifrost-vtoken-minting/runtime-benchmarks", "bifrost-farming/runtime-benchmarks", "bifrost-system-staking/runtime-benchmarks", - "bifrost-system-maker/runtime-benchmarks", "bifrost-vstoken-conversion/runtime-benchmarks", "bifrost-slp/runtime-benchmarks", "bifrost-asset-registry/runtime-benchmarks", @@ -388,7 +385,6 @@ try-runtime = [ "bifrost-vstoken-conversion/try-runtime", "bifrost-farming/try-runtime", "bifrost-system-staking/try-runtime", - "bifrost-system-maker/try-runtime", "bifrost-fee-share/try-runtime", "bifrost-cross-in-out/try-runtime", "bifrost-slpx/try-runtime", diff --git a/runtime/bifrost-kusama/src/weights/bifrost_system_maker.rs b/runtime/bifrost-kusama/src/weights/bifrost_system_maker.rs deleted file mode 100644 index e2109a2d2..000000000 --- a/runtime/bifrost-kusama/src/weights/bifrost_system_maker.rs +++ /dev/null @@ -1,122 +0,0 @@ -// This file is part of Bifrost. - -// Copyright (C) Liebi Technologies PTE. LTD. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Autogenerated weights for bifrost_system_maker -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-09-14, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `bifrost-jenkins`, CPU: `Intel(R) Xeon(R) CPU E5-26xx v4` -//! WASM-EXECUTION: Compiled, CHAIN: Some("bifrost-kusama-local"), DB CACHE: 1024 - -// Executed Command: -// target/release/bifrost -// benchmark -// pallet -// --chain=bifrost-kusama-local -// --steps=50 -// --repeat=20 -// --pallet=bifrost_system_maker -// --extrinsic=* -// --execution=wasm -// --wasm-execution=compiled -// --heap-pages=4096 -// --output=./runtime/bifrost-kusama/src/weights/bifrost_system_maker.rs -// --template=./weight-template/runtime-weight-template.hbs - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; - -/// Weight functions for bifrost_system_maker. -pub struct BifrostWeight(PhantomData); -impl bifrost_system_maker::WeightInfo for BifrostWeight { - // Storage: SystemMaker Infos (r:1 w:1) - // Proof Skipped: SystemMaker Infos (max_values: None, max_size: None, mode: Measured) - fn set_config() -> Weight { - // Proof Size summary in bytes: - // Measured: `109` - // Estimated: `3574` - // Minimum execution time: 32_211 nanoseconds. - Weight::from_parts(33_399_000, 3574) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Tokens Accounts (r:2 w:2) - // Proof: Tokens Accounts (max_values: None, max_size: Some(118), added: 2593, mode: MaxEncodedLen) - // Storage: AssetRegistry CurrencyMetadatas (r:1 w:0) - // Proof Skipped: AssetRegistry CurrencyMetadatas (max_values: None, max_size: None, mode: Measured) - // Storage: System Account (r:2 w:1) - // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - fn charge() -> Weight { - // Proof Size summary in bytes: - // Measured: `1402` - // Estimated: `6196` - // Minimum execution time: 122_457 nanoseconds. - Weight::from_parts(124_486_000, 6196) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: SystemMaker Infos (r:0 w:1) - // Proof Skipped: SystemMaker Infos (max_values: None, max_size: None, mode: Measured) - fn close() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 22_412 nanoseconds. - Weight::from_parts(22_806_000, 0) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Tokens Accounts (r:2 w:2) - // Proof: Tokens Accounts (max_values: None, max_size: Some(118), added: 2593, mode: MaxEncodedLen) - // Storage: AssetRegistry CurrencyMetadatas (r:1 w:0) - // Proof Skipped: AssetRegistry CurrencyMetadatas (max_values: None, max_size: None, mode: Measured) - // Storage: System Account (r:2 w:1) - // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - fn payout() -> Weight { - // Proof Size summary in bytes: - // Measured: `1461` - // Estimated: `6196` - // Minimum execution time: 114_158 nanoseconds. - Weight::from_parts(116_409_000, 6196) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: SystemMaker Infos (r:2 w:0) - // Proof Skipped: SystemMaker Infos (max_values: None, max_size: None, mode: Measured) - // Storage: ParachainInfo ParachainId (r:1 w:0) - // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - // Storage: Tokens Accounts (r:2 w:0) - // Proof: Tokens Accounts (max_values: None, max_size: Some(118), added: 2593, mode: MaxEncodedLen) - fn on_idle() -> Weight { - // Proof Size summary in bytes: - // Measured: `894` - // Estimated: `6834` - // Minimum execution time: 54_792 nanoseconds. - Weight::from_parts(55_872_000, 6834) - .saturating_add(T::DbWeight::get().reads(5)) - } -} diff --git a/runtime/bifrost-kusama/src/weights/mod.rs b/runtime/bifrost-kusama/src/weights/mod.rs index c69a7e8be..944900a81 100644 --- a/runtime/bifrost-kusama/src/weights/mod.rs +++ b/runtime/bifrost-kusama/src/weights/mod.rs @@ -31,7 +31,6 @@ pub mod bifrost_salp; pub mod bifrost_slp; pub mod bifrost_slpx; pub mod bifrost_stable_pool; -pub mod bifrost_system_maker; pub mod bifrost_system_staking; pub mod bifrost_token_issuer; pub mod bifrost_vbnc_convert; diff --git a/runtime/bifrost-polkadot/Cargo.toml b/runtime/bifrost-polkadot/Cargo.toml index 80747c824..5d1030a1b 100644 --- a/runtime/bifrost-polkadot/Cargo.toml +++ b/runtime/bifrost-polkadot/Cargo.toml @@ -155,7 +155,6 @@ bifrost-slp-v2 = { workspace = true, features = ["polkadot"] } bifrost-slpx = { workspace = true } bifrost-stable-pool = { workspace = true } bifrost-stable-pool-rpc-runtime-api = { workspace = true } -bifrost-system-maker = { workspace = true } bifrost-system-staking = { workspace = true } bb-bnc = { workspace = true } bb-bnc-rpc-runtime-api = { workspace = true } @@ -275,7 +274,6 @@ std = [ "bifrost-slpx/std", "bifrost-stable-pool-rpc-runtime-api/std", "bifrost-stable-pool/std", - "bifrost-system-maker/std", "bifrost-system-staking/std", "bb-bnc-rpc-runtime-api/std", "bb-bnc/std", @@ -373,7 +371,6 @@ try-runtime = [ "bifrost-slpx/try-runtime", "bifrost-stable-asset/try-runtime", "bifrost-stable-pool/try-runtime", - "bifrost-system-maker/try-runtime", "bifrost-system-staking/try-runtime", "bb-bnc/try-runtime", "bifrost-vesting/try-runtime", diff --git a/runtime/bifrost-polkadot/src/weights/bifrost_system_maker.rs b/runtime/bifrost-polkadot/src/weights/bifrost_system_maker.rs deleted file mode 100644 index e2109a2d2..000000000 --- a/runtime/bifrost-polkadot/src/weights/bifrost_system_maker.rs +++ /dev/null @@ -1,122 +0,0 @@ -// This file is part of Bifrost. - -// Copyright (C) Liebi Technologies PTE. LTD. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Autogenerated weights for bifrost_system_maker -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-09-14, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `bifrost-jenkins`, CPU: `Intel(R) Xeon(R) CPU E5-26xx v4` -//! WASM-EXECUTION: Compiled, CHAIN: Some("bifrost-kusama-local"), DB CACHE: 1024 - -// Executed Command: -// target/release/bifrost -// benchmark -// pallet -// --chain=bifrost-kusama-local -// --steps=50 -// --repeat=20 -// --pallet=bifrost_system_maker -// --extrinsic=* -// --execution=wasm -// --wasm-execution=compiled -// --heap-pages=4096 -// --output=./runtime/bifrost-kusama/src/weights/bifrost_system_maker.rs -// --template=./weight-template/runtime-weight-template.hbs - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; - -/// Weight functions for bifrost_system_maker. -pub struct BifrostWeight(PhantomData); -impl bifrost_system_maker::WeightInfo for BifrostWeight { - // Storage: SystemMaker Infos (r:1 w:1) - // Proof Skipped: SystemMaker Infos (max_values: None, max_size: None, mode: Measured) - fn set_config() -> Weight { - // Proof Size summary in bytes: - // Measured: `109` - // Estimated: `3574` - // Minimum execution time: 32_211 nanoseconds. - Weight::from_parts(33_399_000, 3574) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Tokens Accounts (r:2 w:2) - // Proof: Tokens Accounts (max_values: None, max_size: Some(118), added: 2593, mode: MaxEncodedLen) - // Storage: AssetRegistry CurrencyMetadatas (r:1 w:0) - // Proof Skipped: AssetRegistry CurrencyMetadatas (max_values: None, max_size: None, mode: Measured) - // Storage: System Account (r:2 w:1) - // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - fn charge() -> Weight { - // Proof Size summary in bytes: - // Measured: `1402` - // Estimated: `6196` - // Minimum execution time: 122_457 nanoseconds. - Weight::from_parts(124_486_000, 6196) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: SystemMaker Infos (r:0 w:1) - // Proof Skipped: SystemMaker Infos (max_values: None, max_size: None, mode: Measured) - fn close() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 22_412 nanoseconds. - Weight::from_parts(22_806_000, 0) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Tokens Accounts (r:2 w:2) - // Proof: Tokens Accounts (max_values: None, max_size: Some(118), added: 2593, mode: MaxEncodedLen) - // Storage: AssetRegistry CurrencyMetadatas (r:1 w:0) - // Proof Skipped: AssetRegistry CurrencyMetadatas (max_values: None, max_size: None, mode: Measured) - // Storage: System Account (r:2 w:1) - // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - fn payout() -> Weight { - // Proof Size summary in bytes: - // Measured: `1461` - // Estimated: `6196` - // Minimum execution time: 114_158 nanoseconds. - Weight::from_parts(116_409_000, 6196) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: SystemMaker Infos (r:2 w:0) - // Proof Skipped: SystemMaker Infos (max_values: None, max_size: None, mode: Measured) - // Storage: ParachainInfo ParachainId (r:1 w:0) - // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - // Storage: Tokens Accounts (r:2 w:0) - // Proof: Tokens Accounts (max_values: None, max_size: Some(118), added: 2593, mode: MaxEncodedLen) - fn on_idle() -> Weight { - // Proof Size summary in bytes: - // Measured: `894` - // Estimated: `6834` - // Minimum execution time: 54_792 nanoseconds. - Weight::from_parts(55_872_000, 6834) - .saturating_add(T::DbWeight::get().reads(5)) - } -} diff --git a/runtime/bifrost-polkadot/src/weights/mod.rs b/runtime/bifrost-polkadot/src/weights/mod.rs index c2ecca9ad..812a4fb6c 100644 --- a/runtime/bifrost-polkadot/src/weights/mod.rs +++ b/runtime/bifrost-polkadot/src/weights/mod.rs @@ -35,7 +35,6 @@ pub mod bifrost_slp; pub mod bifrost_slp_v2; pub mod bifrost_slpx; pub mod bifrost_stable_pool; -pub mod bifrost_system_maker; pub mod bifrost_system_staking; pub mod bifrost_vesting; pub mod bifrost_vstoken_conversion;