diff --git a/Cargo.lock b/Cargo.lock index 0d708521b9..a284a62cb3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4933,7 +4933,7 @@ dependencies = [ [[package]] name = "node-cli" -version = "0.8.1" +version = "0.8.2" dependencies = [ "cumulus-client-cli", "cumulus-client-service", diff --git a/node/cli/Cargo.toml b/node/cli/Cargo.toml index d38fba66a6..43267a8fb6 100644 --- a/node/cli/Cargo.toml +++ b/node/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-cli" -version = "0.8.1" +version = "0.8.2" authors = ["Liebi Technologies "] description = "Bifrost Parachain Node" build = "build.rs" diff --git a/pallets/vesting/src/benchmarking.rs b/pallets/vesting/src/benchmarking.rs index b03daf47d9..1ecf748140 100644 --- a/pallets/vesting/src/benchmarking.rs +++ b/pallets/vesting/src/benchmarking.rs @@ -48,6 +48,8 @@ fn add_vesting_schedule(who: &T::AccountId) -> Result<(), &'static st System::::set_block_number(0u32.into()); + Vesting::::init_vesting_start_at(RawOrigin::Root.into(), 0u32.into())?; + // Add schedule to avoid `NotVesting` error. Vesting::::add_vesting_schedule( &who, diff --git a/runtime/asgard/src/weights/bifrost_salp.rs b/runtime/asgard/src/weights/bifrost_salp.rs index 1fabc47330..8749be06d7 100644 --- a/runtime/asgard/src/weights/bifrost_salp.rs +++ b/runtime/asgard/src/weights/bifrost_salp.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for bifrost_salp //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-08-11, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2021-08-18, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("asgard-local"), DB CACHE: 128 // Executed Command: @@ -46,19 +46,17 @@ use sp_std::marker::PhantomData; pub struct WeightInfo(PhantomData); impl bifrost_salp::WeightInfo for WeightInfo { fn create() -> Weight { - (60_954_000 as Weight) + (38_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } fn contribute() -> Weight { - (64_140_000 as Weight) + (48_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } - fn on_finalize(n: u32) -> Weight { - (9_002_000 as Weight) - // Standard Error: 0 - .saturating_add((235_000 as Weight).saturating_mul(n as Weight)) + fn on_finalize(_n: u32) -> Weight { + (8_405_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } diff --git a/runtime/bifrost/Cargo.toml b/runtime/bifrost/Cargo.toml index 62324a5a6b..4eb35f5b72 100644 --- a/runtime/bifrost/Cargo.toml +++ b/runtime/bifrost/Cargo.toml @@ -149,6 +149,7 @@ runtime-benchmarks = [ "pallet-timestamp/runtime-benchmarks", "pallet-treasury/runtime-benchmarks", "pallet-utility/runtime-benchmarks", + "pallet-vesting/runtime-benchmarks", "pallet-xcm/runtime-benchmarks", "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", diff --git a/runtime/bifrost/src/lib.rs b/runtime/bifrost/src/lib.rs index 939ea2d6ef..d73dd9f393 100644 --- a/runtime/bifrost/src/lib.rs +++ b/runtime/bifrost/src/lib.rs @@ -29,7 +29,7 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); // A few exports that help ease life for downstream crates. pub use frame_support::{ construct_runtime, match_type, parameter_types, - traits::{All, Filter, IsInVec, Randomness}, + traits::{All, Contains, Filter, IsInVec, Randomness}, weights::{ constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND}, DispatchClass, IdentityFee, Weight, @@ -46,7 +46,7 @@ use sp_core::OpaqueMetadata; pub use sp_runtime::BuildStorage; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, - traits::{BlakeTwo256, Block as BlockT, Zero}, + traits::{AccountIdConversion, BlakeTwo256, Block as BlockT}, transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, }; @@ -95,7 +95,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("bifrost"), impl_name: create_runtime_str!("bifrost"), authoring_version: 1, - spec_version: 801, + spec_version: 802, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, @@ -156,11 +156,19 @@ impl Filter for CallFilter { } parameter_types! { - pub const NativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::ASG); + pub const NativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::BNC); pub const RelayCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::KSM); pub const StableCurrencyId: CurrencyId = CurrencyId::Stable(TokenSymbol::KUSD); } +parameter_types! { + pub const TreasuryPalletId: PalletId = PalletId(*b"bf/trsry"); +} + +pub fn get_all_pallet_accounts() -> Vec { + vec![TreasuryPalletId::get().into_account()] +} + impl frame_system::Config for Runtime { type AccountData = pallet_balances::AccountData; /// The identifier used to distinguish between accounts. @@ -512,34 +520,46 @@ impl pallet_vesting::Config for Runtime { // orml runtime start -pub type BifrostToken = BasicCurrencyAdapter; - impl orml_currencies::Config for Runtime { type Event = Event; type GetNativeCurrencyId = NativeCurrencyId; type MultiCurrency = Tokens; - type NativeCurrency = BifrostToken; + type NativeCurrency = BasicCurrencyAdapter; type WeightInfo = (); } orml_traits::parameter_type_with_key! { pub ExistentialDeposits: |currency_id: CurrencyId| -> Balance { match currency_id { - &CurrencyId::Native(TokenSymbol::ASG) => 1 * CENTS, - _ => Zero::zero(), + &CurrencyId::Native(TokenSymbol::BNC) => 10 * MILLIBNC, + &CurrencyId::Token(TokenSymbol::KSM) => 10 * MILLICENTS, + &CurrencyId::VSToken(TokenSymbol::KSM) => 10 * MILLICENTS, + &CurrencyId::VSBond(TokenSymbol::BNC, ..) => 10 * MILLICENTS, + _ => Balance::max_value() // unsupported } }; } +pub struct DustRemovalWhitelist; +impl Contains for DustRemovalWhitelist { + fn contains(a: &AccountId) -> bool { + get_all_pallet_accounts().contains(a) + } +} + +parameter_types! { + pub BifrostTreasuryAccount: AccountId = TreasuryPalletId::get().into_account(); +} + impl orml_tokens::Config for Runtime { type Amount = Amount; type Balance = Balance; type CurrencyId = CurrencyId; - type DustRemovalWhitelist = (); + type DustRemovalWhitelist = DustRemovalWhitelist; type Event = Event; type ExistentialDeposits = ExistentialDeposits; type MaxLocks = MaxLocks; - type OnDust = (); + type OnDust = orml_tokens::TransferDust; type WeightInfo = (); } @@ -550,7 +570,6 @@ impl orml_tokens::Config for Runtime { // pub const ProposalBondMinimum: Balance = 50 * DOLLARS; // pub const SpendPeriod: BlockNumber = 6 * DAYS; // pub const Burn: Permill = Permill::from_perthousand(2); -// pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); // // pub const TipCountdown: BlockNumber = 1 * DAYS; // pub const TipFindersFee: Percent = Percent::from_percent(20); @@ -815,12 +834,13 @@ impl_runtime_apis! { // Adding the pallet you will perform thee benchmarking add_benchmark!(params, batches, pallet_balances, Balances); - add_benchmark!(params, batches, pallet_bounties, Bounties); + // add_benchmark!(params, batches, pallet_bounties, Bounties); add_benchmark!(params, batches, pallet_indices, Indices); add_benchmark!(params, batches, pallet_scheduler, Scheduler); add_benchmark!(params, batches, pallet_timestamp, Timestamp); - add_benchmark!(params, batches, pallet_treasury, Treasury); + // add_benchmark!(params, batches, pallet_treasury, Treasury); add_benchmark!(params, batches, pallet_utility, Utility); + add_benchmark!(params, batches, pallet_vesting, Vesting); if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } Ok(batches) diff --git a/runtime/bifrost/src/weights/pallet_balances.rs b/runtime/bifrost/src/weights/pallet_balances.rs index a0aa9b6039..082f8bad67 100644 --- a/runtime/bifrost/src/weights/pallet_balances.rs +++ b/runtime/bifrost/src/weights/pallet_balances.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_balances //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-08-16, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2021-08-18, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bifrost-genesis"), DB CACHE: 128 // Executed Command: @@ -46,32 +46,32 @@ use sp_std::marker::PhantomData; pub struct WeightInfo(PhantomData); impl pallet_balances::WeightInfo for WeightInfo { fn transfer() -> Weight { - (248_276_000 as Weight) + (186_397_000 as Weight) .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } fn transfer_keep_alive() -> Weight { - (184_967_000 as Weight) + (149_209_000 as Weight) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } fn set_balance_creating() -> Weight { - (95_890_000 as Weight) + (91_298_000 as Weight) .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } fn set_balance_killing() -> Weight { - (115_106_000 as Weight) + (102_324_000 as Weight) .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } fn force_transfer() -> Weight { - (246_112_000 as Weight) + (185_362_000 as Weight) .saturating_add(T::DbWeight::get().reads(7 as Weight)) .saturating_add(T::DbWeight::get().writes(5 as Weight)) } fn transfer_all() -> Weight { - (226_555_000 as Weight) + (168_296_000 as Weight) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } diff --git a/runtime/bifrost/src/weights/pallet_indices.rs b/runtime/bifrost/src/weights/pallet_indices.rs index 5342a9c9d2..219fc805df 100644 --- a/runtime/bifrost/src/weights/pallet_indices.rs +++ b/runtime/bifrost/src/weights/pallet_indices.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_indices //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-08-16, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2021-08-18, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bifrost-genesis"), DB CACHE: 128 // Executed Command: @@ -46,27 +46,27 @@ use sp_std::marker::PhantomData; pub struct WeightInfo(PhantomData); impl pallet_indices::WeightInfo for WeightInfo { fn claim() -> Weight { - (130_555_000 as Weight) + (110_804_000 as Weight) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } fn transfer() -> Weight { - (164_299_000 as Weight) + (143_279_000 as Weight) .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } fn free() -> Weight { - (132_599_000 as Weight) + (112_222_000 as Weight) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(3 as Weight)) } fn force_transfer() -> Weight { - (134_983_000 as Weight) + (114_400_000 as Weight) .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } fn freeze() -> Weight { - (120_396_000 as Weight) + (112_784_000 as Weight) .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } diff --git a/runtime/bifrost/src/weights/pallet_timestamp.rs b/runtime/bifrost/src/weights/pallet_timestamp.rs index 5d7aa90739..300a57b234 100644 --- a/runtime/bifrost/src/weights/pallet_timestamp.rs +++ b/runtime/bifrost/src/weights/pallet_timestamp.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_timestamp //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-08-16, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2021-08-18, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bifrost-genesis"), DB CACHE: 128 // Executed Command: @@ -46,11 +46,11 @@ use sp_std::marker::PhantomData; pub struct WeightInfo(PhantomData); impl pallet_timestamp::WeightInfo for WeightInfo { fn set() -> Weight { - (24_637_000 as Weight) + (19_335_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn on_finalize() -> Weight { - (11_001_000 as Weight) + (10_593_000 as Weight) } } diff --git a/runtime/bifrost/src/weights/pallet_utility.rs b/runtime/bifrost/src/weights/pallet_utility.rs index 43b35b9219..3c1c131d47 100644 --- a/runtime/bifrost/src/weights/pallet_utility.rs +++ b/runtime/bifrost/src/weights/pallet_utility.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_utility //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-08-16, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2021-08-18, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bifrost-genesis"), DB CACHE: 128 // Executed Command: @@ -46,19 +46,19 @@ use sp_std::marker::PhantomData; pub struct WeightInfo(PhantomData); impl pallet_utility::WeightInfo for WeightInfo { fn batch(c: u32) -> Weight { - (44_360_000 as Weight) - // Standard Error: 7_000 - .saturating_add((6_778_000 as Weight).saturating_mul(c as Weight)) + (41_767_000 as Weight) + // Standard Error: 1_000 + .saturating_add((4_248_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } fn as_derivative() -> Weight { - (19_316_000 as Weight) + (11_279_000 as Weight) } fn batch_all(c: u32) -> Weight { - (638_011_000 as Weight) - // Standard Error: 79_000 - .saturating_add((6_251_000 as Weight).saturating_mul(c as Weight)) + (47_341_000 as Weight) + // Standard Error: 1_000 + .saturating_add((5_234_000 as Weight).saturating_mul(c as Weight)) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } diff --git a/runtime/bifrost/src/weights/pallet_vesting.rs b/runtime/bifrost/src/weights/pallet_vesting.rs index 86dac90d23..89c3da1b32 100644 --- a/runtime/bifrost/src/weights/pallet_vesting.rs +++ b/runtime/bifrost/src/weights/pallet_vesting.rs @@ -15,16 +15,17 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + //! Autogenerated weights for pallet_vesting //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-04-27, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 128 +//! DATE: 2021-08-18, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bifrost-genesis"), DB CACHE: 128 // Executed Command: -// target/release/polkadot +// target/release/bifrost // benchmark -// --chain=kusama-dev +// --chain=bifrost-genesis // --steps=50 // --repeat=20 // --pallet=pallet_vesting @@ -32,8 +33,8 @@ // --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --header=./file_header.txt -// --output=./runtime/kusama/src/weights/ +// --header=./HEADER-GPL3 +// --output=./runtime/bifrost/src/weights/ #![allow(unused_parens)] #![allow(unused_imports)] @@ -45,50 +46,45 @@ use sp_std::marker::PhantomData; pub struct WeightInfo(PhantomData); impl pallet_vesting::WeightInfo for WeightInfo { fn vest_locked(l: u32) -> Weight { - (40_504_000 as Weight) - // Standard Error: 20_000 - .saturating_add((261_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + (139_430_000 as Weight) + // Standard Error: 29_000 + .saturating_add((723_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(T::DbWeight::get().reads(7 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) } - fn vest_unlocked(l: u32) -> Weight { - (44_880_000 as Weight) - // Standard Error: 2_000 - .saturating_add((138_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + (144_165_000 as Weight) + // Standard Error: 13_000 + .saturating_add((713_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(T::DbWeight::get().reads(7 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) } - fn vest_other_locked(l: u32) -> Weight { - (39_872_000 as Weight) - // Standard Error: 20_000 - .saturating_add((265_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + (132_758_000 as Weight) + // Standard Error: 24_000 + .saturating_add((752_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(T::DbWeight::get().reads(8 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) } - fn vest_other_unlocked(l: u32) -> Weight { - (44_683_000 as Weight) - // Standard Error: 1_000 - .saturating_add((137_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + (138_258_000 as Weight) + // Standard Error: 13_000 + .saturating_add((723_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(T::DbWeight::get().reads(8 as Weight)) + .saturating_add(T::DbWeight::get().writes(5 as Weight)) } - fn vested_transfer(l: u32) -> Weight { - (95_999_000 as Weight) - // Standard Error: 17_000 - .saturating_add((242_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + (249_078_000 as Weight) + // Standard Error: 23_000 + .saturating_add((741_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(T::DbWeight::get().reads(8 as Weight)) + .saturating_add(T::DbWeight::get().writes(5 as Weight)) } - fn force_vested_transfer(l: u32) -> Weight { - (95_418_000 as Weight) - // Standard Error: 17_000 - .saturating_add((242_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) + (246_188_000 as Weight) + // Standard Error: 23_000 + .saturating_add((749_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(T::DbWeight::get().reads(9 as Weight)) + .saturating_add(T::DbWeight::get().writes(6 as Weight)) } }