From a4ea5bb86301bcd7fe9d3bc1a326d4f2d9a3f33c Mon Sep 17 00:00:00 2001 From: jaypan Date: Wed, 11 Sep 2024 14:57:35 +0200 Subject: [PATCH 1/2] Adjust evm fee again --- runtime/peaq/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/peaq/src/lib.rs b/runtime/peaq/src/lib.rs index 53a94db5..e5ee5d54 100644 --- a/runtime/peaq/src/lib.rs +++ b/runtime/peaq/src/lib.rs @@ -173,7 +173,7 @@ pub mod currency { pub const TRANSACTION_BYTE_FEE: Balance = GIGAWEI * SUPPLY_FACTOR; pub const STORAGE_BYTE_FEE: Balance = 100 * MICROPEAQ * SUPPLY_FACTOR; - pub const WEIGHT_FEE: Balance = 40 * KILOWEI * SUPPLY_FACTOR; + pub const WEIGHT_FEE: Balance = 400 * KILOWEI * SUPPLY_FACTOR; // pub const fn deposit(items: u32, bytes: u32) -> Balance { // items as Balance * 100 * MILLIPEAQ * SUPPLY_FACTOR + (bytes as Balance) * STORAGE_BYTE_FEE @@ -206,7 +206,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 101, + spec_version: 102, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From bc10812cfbed169c5fdfd5f9f23a7ae79048d508 Mon Sep 17 00:00:00 2001 From: jaypan Date: Sat, 14 Sep 2024 21:57:14 +0200 Subject: [PATCH 2/2] Remove the migrations --- runtime/krest/src/lib.rs | 16 +--- runtime/krest/src/vesting_migration.rs | 96 ----------------------- runtime/peaq-dev/src/lib.rs | 16 +--- runtime/peaq-dev/src/vesting_migration.rs | 96 ----------------------- runtime/peaq/src/lib.rs | 16 +--- runtime/peaq/src/vesting_migration.rs | 96 ----------------------- 6 files changed, 6 insertions(+), 330 deletions(-) delete mode 100644 runtime/krest/src/vesting_migration.rs delete mode 100644 runtime/peaq-dev/src/vesting_migration.rs delete mode 100644 runtime/peaq/src/vesting_migration.rs diff --git a/runtime/krest/src/lib.rs b/runtime/krest/src/lib.rs index 74c6bd2e..b5a1df81 100644 --- a/runtime/krest/src/lib.rs +++ b/runtime/krest/src/lib.rs @@ -60,7 +60,6 @@ use sp_version::NativeVersion; use sp_version::RuntimeVersion; use zenlink_protocol::{AssetBalance, MultiAssetsHandler, PairInfo, ZenlinkMultiAssets}; -mod vesting_migration; mod weights; pub mod xcm_config; @@ -404,14 +403,7 @@ impl pallet_contracts::Config for Runtime { type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent; type MaxDelegateDependencies = MaxDelegateDependencies; type RuntimeHoldReason = RuntimeHoldReason; - type Migrations = ( - pallet_contracts::migration::v10::Migration, - pallet_contracts::migration::v11::Migration, - pallet_contracts::migration::v12::Migration, - pallet_contracts::migration::v13::Migration, - pallet_contracts::migration::v14::Migration, - pallet_contracts::migration::v15::Migration, - ); + type Migrations = (); type Debug = (); type Environment = (); type Xcm = (); @@ -1161,11 +1153,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - ( - cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4, - pallet_contracts::Migration, - vesting_migration::VestingMigrationToAsyncBacking, - ), + (), >; #[cfg(feature = "runtime-benchmarks")] diff --git a/runtime/krest/src/vesting_migration.rs b/runtime/krest/src/vesting_migration.rs deleted file mode 100644 index 849cbe10..00000000 --- a/runtime/krest/src/vesting_migration.rs +++ /dev/null @@ -1,96 +0,0 @@ -#[cfg(feature = "try-runtime")] -use frame_support::pallet_prelude::Decode; -use frame_support::{ - traits::{Currency, Get, OnRuntimeUpgrade}, - weights::Weight, - BoundedVec, -}; -use frame_system::pallet_prelude::BlockNumberFor; -use pallet_vesting::VestingInfo; -#[cfg(feature = "try-runtime")] -use parity_scale_codec::Encode; -use sp_runtime::traits::CheckedDiv; -#[cfg(feature = "try-runtime")] -use sp_runtime::TryRuntimeError; -use sp_std::vec::Vec; -type BalanceOf = <::Currency as Currency< - ::AccountId, ->>::Balance; -type VestingBoundVec = BoundedVec< - VestingInfo, BlockNumberFor>, - pallet_vesting::MaxVestingSchedulesGet, ->; - -pub struct VestingMigrationToAsyncBacking(sp_std::marker::PhantomData); - -impl OnRuntimeUpgrade - for VestingMigrationToAsyncBacking -{ - fn on_runtime_upgrade() -> Weight { - let mut weight_writes = 0; - let mut weight_reads = 0; - pallet_vesting::Vesting::::translate::, _>( - |_acc_id, vesting_infos| { - weight_reads += 1; - weight_writes += 1; - let out: Vec<_> = vesting_infos - .iter() - .map(|s| { - let new_per_block = - s.per_block().checked_div(&2u32.into()).unwrap_or_default(); - VestingInfo::, BlockNumberFor>::new( - s.locked(), - new_per_block, - s.starting_block(), - ) - }) - .collect(); - Some(BoundedVec::try_from(out).unwrap()) - }, - ); - log::info!( - "Vesting migration for async backing: reads: {}, writes: {}", - weight_reads, - weight_writes - ); - T::DbWeight::get().reads_writes(weight_reads, weight_writes) - } - - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, TryRuntimeError> { - let mut old_schedules = Vec::new(); - for (_acc_id, mut schedules) in pallet_vesting::Vesting::::iter() { - if schedules.len() != 0 { - old_schedules = schedules.drain(..).collect(); - break; - } - } - Ok(old_schedules.encode()) - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(state: Vec) -> Result<(), TryRuntimeError> { - let old_schedules = - , BlockNumberFor>> as Decode>::decode(&mut &state[..]) - .expect("pre_upgrade_step provides a valid state; qed"); - - let mut new_schedules = Vec::new(); - for (_acc_id, mut schedules) in pallet_vesting::Vesting::::iter() { - if schedules.len() != 0 { - new_schedules = schedules.drain(..).collect(); - break; - } - } - assert_eq!(old_schedules.len(), new_schedules.len()); - for i in 0..old_schedules.len() { - assert_eq!(old_schedules[i].locked(), new_schedules[i].locked()); - assert_eq!( - old_schedules[i].per_block().checked_div(&2u32.into()).unwrap_or_default(), - new_schedules[i].per_block() - ); - assert_eq!(old_schedules[i].starting_block(), new_schedules[i].starting_block()); - } - - Ok(()) - } -} diff --git a/runtime/peaq-dev/src/lib.rs b/runtime/peaq-dev/src/lib.rs index 93d6bca3..5f13e12b 100644 --- a/runtime/peaq-dev/src/lib.rs +++ b/runtime/peaq-dev/src/lib.rs @@ -60,7 +60,6 @@ use sp_version::NativeVersion; use sp_version::RuntimeVersion; use zenlink_protocol::{AssetBalance, MultiAssetsHandler, PairInfo, ZenlinkMultiAssets}; -mod vesting_migration; mod weights; pub mod xcm_config; @@ -410,14 +409,7 @@ impl pallet_contracts::Config for Runtime { type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent; type MaxDelegateDependencies = MaxDelegateDependencies; type RuntimeHoldReason = RuntimeHoldReason; - type Migrations = ( - pallet_contracts::migration::v10::Migration, - pallet_contracts::migration::v11::Migration, - pallet_contracts::migration::v12::Migration, - pallet_contracts::migration::v13::Migration, - pallet_contracts::migration::v14::Migration, - pallet_contracts::migration::v15::Migration, - ); + type Migrations = (); type Debug = (); type Environment = (); type Xcm = (); @@ -1176,11 +1168,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - ( - cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4, - pallet_contracts::Migration, - vesting_migration::VestingMigrationToAsyncBacking, - ), + (), >; #[cfg(feature = "runtime-benchmarks")] diff --git a/runtime/peaq-dev/src/vesting_migration.rs b/runtime/peaq-dev/src/vesting_migration.rs deleted file mode 100644 index 849cbe10..00000000 --- a/runtime/peaq-dev/src/vesting_migration.rs +++ /dev/null @@ -1,96 +0,0 @@ -#[cfg(feature = "try-runtime")] -use frame_support::pallet_prelude::Decode; -use frame_support::{ - traits::{Currency, Get, OnRuntimeUpgrade}, - weights::Weight, - BoundedVec, -}; -use frame_system::pallet_prelude::BlockNumberFor; -use pallet_vesting::VestingInfo; -#[cfg(feature = "try-runtime")] -use parity_scale_codec::Encode; -use sp_runtime::traits::CheckedDiv; -#[cfg(feature = "try-runtime")] -use sp_runtime::TryRuntimeError; -use sp_std::vec::Vec; -type BalanceOf = <::Currency as Currency< - ::AccountId, ->>::Balance; -type VestingBoundVec = BoundedVec< - VestingInfo, BlockNumberFor>, - pallet_vesting::MaxVestingSchedulesGet, ->; - -pub struct VestingMigrationToAsyncBacking(sp_std::marker::PhantomData); - -impl OnRuntimeUpgrade - for VestingMigrationToAsyncBacking -{ - fn on_runtime_upgrade() -> Weight { - let mut weight_writes = 0; - let mut weight_reads = 0; - pallet_vesting::Vesting::::translate::, _>( - |_acc_id, vesting_infos| { - weight_reads += 1; - weight_writes += 1; - let out: Vec<_> = vesting_infos - .iter() - .map(|s| { - let new_per_block = - s.per_block().checked_div(&2u32.into()).unwrap_or_default(); - VestingInfo::, BlockNumberFor>::new( - s.locked(), - new_per_block, - s.starting_block(), - ) - }) - .collect(); - Some(BoundedVec::try_from(out).unwrap()) - }, - ); - log::info!( - "Vesting migration for async backing: reads: {}, writes: {}", - weight_reads, - weight_writes - ); - T::DbWeight::get().reads_writes(weight_reads, weight_writes) - } - - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, TryRuntimeError> { - let mut old_schedules = Vec::new(); - for (_acc_id, mut schedules) in pallet_vesting::Vesting::::iter() { - if schedules.len() != 0 { - old_schedules = schedules.drain(..).collect(); - break; - } - } - Ok(old_schedules.encode()) - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(state: Vec) -> Result<(), TryRuntimeError> { - let old_schedules = - , BlockNumberFor>> as Decode>::decode(&mut &state[..]) - .expect("pre_upgrade_step provides a valid state; qed"); - - let mut new_schedules = Vec::new(); - for (_acc_id, mut schedules) in pallet_vesting::Vesting::::iter() { - if schedules.len() != 0 { - new_schedules = schedules.drain(..).collect(); - break; - } - } - assert_eq!(old_schedules.len(), new_schedules.len()); - for i in 0..old_schedules.len() { - assert_eq!(old_schedules[i].locked(), new_schedules[i].locked()); - assert_eq!( - old_schedules[i].per_block().checked_div(&2u32.into()).unwrap_or_default(), - new_schedules[i].per_block() - ); - assert_eq!(old_schedules[i].starting_block(), new_schedules[i].starting_block()); - } - - Ok(()) - } -} diff --git a/runtime/peaq/src/lib.rs b/runtime/peaq/src/lib.rs index e5ee5d54..707cd785 100644 --- a/runtime/peaq/src/lib.rs +++ b/runtime/peaq/src/lib.rs @@ -60,7 +60,6 @@ use sp_version::NativeVersion; use sp_version::RuntimeVersion; use zenlink_protocol::{AssetBalance, MultiAssetsHandler, PairInfo, ZenlinkMultiAssets}; -mod vesting_migration; mod weights; pub mod xcm_config; @@ -430,14 +429,7 @@ impl pallet_contracts::Config for Runtime { type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent; type MaxDelegateDependencies = MaxDelegateDependencies; type RuntimeHoldReason = RuntimeHoldReason; - type Migrations = ( - pallet_contracts::migration::v10::Migration, - pallet_contracts::migration::v11::Migration, - pallet_contracts::migration::v12::Migration, - pallet_contracts::migration::v13::Migration, - pallet_contracts::migration::v14::Migration, - pallet_contracts::migration::v15::Migration, - ); + type Migrations = (); type Debug = (); type Environment = (); type Xcm = (); @@ -1207,11 +1199,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - ( - cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4, - pallet_contracts::Migration, - vesting_migration::VestingMigrationToAsyncBacking, - ), + (), >; #[cfg(feature = "runtime-benchmarks")] diff --git a/runtime/peaq/src/vesting_migration.rs b/runtime/peaq/src/vesting_migration.rs deleted file mode 100644 index 849cbe10..00000000 --- a/runtime/peaq/src/vesting_migration.rs +++ /dev/null @@ -1,96 +0,0 @@ -#[cfg(feature = "try-runtime")] -use frame_support::pallet_prelude::Decode; -use frame_support::{ - traits::{Currency, Get, OnRuntimeUpgrade}, - weights::Weight, - BoundedVec, -}; -use frame_system::pallet_prelude::BlockNumberFor; -use pallet_vesting::VestingInfo; -#[cfg(feature = "try-runtime")] -use parity_scale_codec::Encode; -use sp_runtime::traits::CheckedDiv; -#[cfg(feature = "try-runtime")] -use sp_runtime::TryRuntimeError; -use sp_std::vec::Vec; -type BalanceOf = <::Currency as Currency< - ::AccountId, ->>::Balance; -type VestingBoundVec = BoundedVec< - VestingInfo, BlockNumberFor>, - pallet_vesting::MaxVestingSchedulesGet, ->; - -pub struct VestingMigrationToAsyncBacking(sp_std::marker::PhantomData); - -impl OnRuntimeUpgrade - for VestingMigrationToAsyncBacking -{ - fn on_runtime_upgrade() -> Weight { - let mut weight_writes = 0; - let mut weight_reads = 0; - pallet_vesting::Vesting::::translate::, _>( - |_acc_id, vesting_infos| { - weight_reads += 1; - weight_writes += 1; - let out: Vec<_> = vesting_infos - .iter() - .map(|s| { - let new_per_block = - s.per_block().checked_div(&2u32.into()).unwrap_or_default(); - VestingInfo::, BlockNumberFor>::new( - s.locked(), - new_per_block, - s.starting_block(), - ) - }) - .collect(); - Some(BoundedVec::try_from(out).unwrap()) - }, - ); - log::info!( - "Vesting migration for async backing: reads: {}, writes: {}", - weight_reads, - weight_writes - ); - T::DbWeight::get().reads_writes(weight_reads, weight_writes) - } - - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, TryRuntimeError> { - let mut old_schedules = Vec::new(); - for (_acc_id, mut schedules) in pallet_vesting::Vesting::::iter() { - if schedules.len() != 0 { - old_schedules = schedules.drain(..).collect(); - break; - } - } - Ok(old_schedules.encode()) - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(state: Vec) -> Result<(), TryRuntimeError> { - let old_schedules = - , BlockNumberFor>> as Decode>::decode(&mut &state[..]) - .expect("pre_upgrade_step provides a valid state; qed"); - - let mut new_schedules = Vec::new(); - for (_acc_id, mut schedules) in pallet_vesting::Vesting::::iter() { - if schedules.len() != 0 { - new_schedules = schedules.drain(..).collect(); - break; - } - } - assert_eq!(old_schedules.len(), new_schedules.len()); - for i in 0..old_schedules.len() { - assert_eq!(old_schedules[i].locked(), new_schedules[i].locked()); - assert_eq!( - old_schedules[i].per_block().checked_div(&2u32.into()).unwrap_or_default(), - new_schedules[i].per_block() - ); - assert_eq!(old_schedules[i].starting_block(), new_schedules[i].starting_block()); - } - - Ok(()) - } -}