From b9641da7d532727296ef0819b8053d8eceff0555 Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Fri, 15 Sep 2023 19:20:49 +0400 Subject: [PATCH] chore(v1.0.0): Clean up and constants fix (#3265) --- node/service/src/chain_spec/vara.rs | 6 +- node/testing/src/genesis.rs | 44 ++-- pallets/gas/src/lib.rs | 2 - pallets/gas/src/migrations.rs | 243 ---------------------- pallets/staking-rewards/src/mock.rs | 7 +- runtime/gear/src/constants.rs | 2 + runtime/gear/src/migrations.rs | 2 +- runtime/vara/src/constants.rs | 16 +- runtime/vara/src/governance/fellowship.rs | 22 +- runtime/vara/src/governance/mod.rs | 2 +- runtime/vara/src/governance/tracks.rs | 26 +-- runtime/vara/src/lib.rs | 34 +-- runtime/vara/src/migrations.rs | 2 +- 13 files changed, 86 insertions(+), 322 deletions(-) delete mode 100644 pallets/gas/src/migrations.rs diff --git a/node/service/src/chain_spec/vara.rs b/node/service/src/chain_spec/vara.rs index b6522ae114a..3122e7326d8 100644 --- a/node/service/src/chain_spec/vara.rs +++ b/node/service/src/chain_spec/vara.rs @@ -28,7 +28,7 @@ use sp_consensus_grandpa::AuthorityId as GrandpaId; use sp_core::{crypto::UncheckedInto, sr25519}; use sp_runtime::{Perbill, Perquintill}; use vara_runtime::{ - constants::currency::{DOLLARS, EXISTENTIAL_DEPOSIT, UNITS as TOKEN}, + constants::currency::{ECONOMIC_UNITS, EXISTENTIAL_DEPOSIT, UNITS as TOKEN}, AuthorityDiscoveryConfig, BabeConfig, BalancesConfig, GenesisConfig, GrandpaConfig, ImOnlineConfig, NominationPoolsConfig, SessionConfig, SessionKeys, StakerStatus, StakingConfig, StakingRewardsConfig, SudoConfig, SystemConfig, VestingConfig, WASM_BINARY, @@ -617,8 +617,8 @@ fn testnet_genesis( transaction_payment: Default::default(), treasury: Default::default(), nomination_pools: NominationPoolsConfig { - min_create_bond: 10 * DOLLARS, - min_join_bond: DOLLARS, + min_create_bond: 10 * ECONOMIC_UNITS, + min_join_bond: ECONOMIC_UNITS, ..Default::default() }, vesting: VestingConfig { vesting: vec![] }, diff --git a/node/testing/src/genesis.rs b/node/testing/src/genesis.rs index f5a63aa4629..019e3f93948 100644 --- a/node/testing/src/genesis.rs +++ b/node/testing/src/genesis.rs @@ -49,18 +49,18 @@ pub fn genesis_config(code: Option<&[u8]>) -> GenesisConfig { #[cfg(feature = "vara-native")] pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec) -> GenesisConfig { let mut endowed = vec![ - (alice(), 111 * DOLLARS), - (bob(), 100 * DOLLARS), - (charlie(), 100_000_000 * DOLLARS), - (dave(), 111 * DOLLARS), - (eve(), 101 * DOLLARS), - (ferdie(), 100 * DOLLARS), + (alice(), 111 * ECONOMIC_UNITS), + (bob(), 100 * ECONOMIC_UNITS), + (charlie(), 100_000_000 * ECONOMIC_UNITS), + (dave(), 111 * ECONOMIC_UNITS), + (eve(), 101 * ECONOMIC_UNITS), + (ferdie(), 100 * ECONOMIC_UNITS), ]; endowed.extend( extra_endowed .into_iter() - .map(|endowed| (endowed, 100 * DOLLARS)), + .map(|endowed| (endowed, 100 * ECONOMIC_UNITS)), ); GenesisConfig { @@ -98,9 +98,19 @@ pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec) -> Gen }, staking: StakingConfig { stakers: vec![ - (dave(), alice(), 111 * DOLLARS, StakerStatus::Validator), - (eve(), bob(), 100 * DOLLARS, StakerStatus::Validator), - (ferdie(), charlie(), 100 * DOLLARS, StakerStatus::Validator), + ( + dave(), + alice(), + 111 * ECONOMIC_UNITS, + StakerStatus::Validator, + ), + (eve(), bob(), 100 * ECONOMIC_UNITS, StakerStatus::Validator), + ( + ferdie(), + charlie(), + 100 * ECONOMIC_UNITS, + StakerStatus::Validator, + ), ], validator_count: 3, minimum_validator_count: 3, @@ -128,18 +138,18 @@ pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec) -> Gen #[cfg(all(not(feature = "vara-native"), feature = "gear-native"))] pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec) -> GenesisConfig { let mut endowed = vec![ - (alice(), 111 * DOLLARS), - (bob(), 100 * DOLLARS), - (charlie(), 100_000_000 * DOLLARS), - (dave(), 111 * DOLLARS), - (eve(), 101 * DOLLARS), - (ferdie(), 100 * DOLLARS), + (alice(), 111 * ECONOMIC_UNITS), + (bob(), 100 * ECONOMIC_UNITS), + (charlie(), 100_000_000 * ECONOMIC_UNITS), + (dave(), 111 * ECONOMIC_UNITS), + (eve(), 101 * ECONOMIC_UNITS), + (ferdie(), 100 * ECONOMIC_UNITS), ]; endowed.extend( extra_endowed .into_iter() - .map(|endowed| (endowed, 100 * DOLLARS)), + .map(|endowed| (endowed, 100 * ECONOMIC_UNITS)), ); GenesisConfig { diff --git a/pallets/gas/src/lib.rs b/pallets/gas/src/lib.rs index 24d49b20d33..db681e5ca60 100644 --- a/pallets/gas/src/lib.rs +++ b/pallets/gas/src/lib.rs @@ -139,8 +139,6 @@ mod mock; #[cfg(test)] mod tests; -pub mod migrations; - type BlockGasLimitOf = ::BlockGasLimit; type AccountIdOf = ::AccountId; diff --git a/pallets/gas/src/migrations.rs b/pallets/gas/src/migrations.rs deleted file mode 100644 index 8ade4e216c1..00000000000 --- a/pallets/gas/src/migrations.rs +++ /dev/null @@ -1,243 +0,0 @@ -use crate::{Config, Error, Key, NodeOf, Pallet, Weight}; -use common::GasMultiplier; -use core::marker::PhantomData; -use frame_support::{ - dispatch::GetStorageVersion, - traits::{Get, OnRuntimeUpgrade}, -}; -#[cfg(feature = "try-runtime")] -use sp_std::vec::Vec; - -const MULTIPLIER: GasMultiplier = GasMultiplier::ValuePerGas(1_000); - -pub struct MigrateToV3(PhantomData); - -impl OnRuntimeUpgrade for MigrateToV3 { - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, &'static str> { - use parity_scale_codec::Encode as _; - - let version = >::on_chain_storage_version(); - - Ok(version.encode()) - } - - fn on_runtime_upgrade() -> Weight { - let onchain = Pallet::::on_chain_storage_version(); - let current = Pallet::::current_storage_version(); - - if current != 3 || onchain != 2 { - log::info!("❌ Migrations of `pallet-gear-gas` to V3 are outdated"); - - return T::DbWeight::get().reads(1); - } - - log::info!("🚚 Running migrations to version {current:?} from version {onchain:?}"); - - let mut writes = 0u64; - - crate::GasNodes::::translate::, _>(|key, value| { - writes += 1; - translate::(key, value) - .map_err(|e| { - log::error!("Error translating {key:?} node: {e:?})"); - e - }) - .ok() - }); - - log::info!("Upgraded {writes:?} gas nodes"); - - current.put::>(); - - T::DbWeight::get().reads_writes(1, writes + 1) - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(state: Vec) -> Result<(), &'static str> { - use frame_support::traits::StorageVersion; - use parity_scale_codec::Decode; - - let previous: StorageVersion = - Decode::decode(&mut state.as_ref()).map_err(|_| "Cannot decode version")?; - - if previous == 2 { - let onchain = Pallet::::on_chain_storage_version(); - - assert_ne!(previous, onchain, "Must have upgraded from version 2 to 3"); - - log::info!("Storage `pallet-gear-gas` successfully migrated to V3"); - } else { - log::info!("Storage `pallet-gear-gas` was already migrated to V3"); - } - - Ok(()) - } -} - -fn translate(node_key: Key, node: v2::GasNode) -> Result, Error> { - log::info!("Translating {node_key:?} node"); - - let new_node = match node { - v2::GasNode::::Cut { id, value, lock } => NodeOf::::Cut { - id, - multiplier: MULTIPLIER, - value, - lock, - }, - v2::GasNode::::External { - id, - value, - lock, - system_reserve, - refs, - consumed, - deposit, - } => NodeOf::::External { - id, - multiplier: MULTIPLIER, - value, - lock, - system_reserve, - refs, - consumed, - deposit, - }, - v2::GasNode::::Reserved { - id, - value, - lock, - refs, - consumed, - } => NodeOf::::Reserved { - id, - multiplier: MULTIPLIER, - value, - lock, - refs, - consumed, - }, - v2::GasNode::::SpecifiedLocal { - parent, - value, - lock, - system_reserve, - refs, - consumed, - } => NodeOf::::SpecifiedLocal { - parent, - root: v2::root(node_key, node)?, - value, - lock, - system_reserve, - refs, - consumed, - }, - v2::GasNode::::UnspecifiedLocal { - parent, - lock, - system_reserve, - } => NodeOf::::UnspecifiedLocal { - parent, - root: v2::root(node_key, node)?, - lock, - system_reserve, - }, - }; - - Ok(new_node) -} - -mod v2 { - use crate::{AccountIdOf, Balance, Config, Error, Key, Pallet}; - use common::gas_provider::{ChildrenRefs, GasNodeId, NodeLock}; - use core::marker::PhantomData; - use frame_support::{ - storage::types::StorageMap, - traits::{PalletInfo, StorageInstance}, - Identity, - }; - use gear_core::ids::{MessageId, ReservationId}; - use parity_scale_codec::{Decode, Encode}; - - pub type GasNode = GasNodeImpl, GasNodeId, Balance>; - - pub struct GasNodesPrefix(PhantomData); - - impl StorageInstance for GasNodesPrefix { - const STORAGE_PREFIX: &'static str = "GasNodes"; - - fn pallet_prefix() -> &'static str { - <::PalletInfo as PalletInfo>::name::>() - .expect("No name found for the pallet in the runtime!") - } - } - - pub type GasNodes = StorageMap, Identity, Key, GasNode>; - - #[derive(Encode, Decode, Debug)] - pub enum GasNodeImpl { - External { - id: ExternalId, - value: Balance, - lock: NodeLock, - system_reserve: Balance, - refs: ChildrenRefs, - consumed: bool, - deposit: bool, - }, - - Cut { - id: ExternalId, - value: Balance, - lock: NodeLock, - }, - - Reserved { - id: ExternalId, - value: Balance, - lock: NodeLock, - refs: ChildrenRefs, - consumed: bool, - }, - - SpecifiedLocal { - parent: Id, - value: Balance, - lock: NodeLock, - system_reserve: Balance, - refs: ChildrenRefs, - consumed: bool, - }, - - UnspecifiedLocal { - parent: Id, - lock: NodeLock, - system_reserve: Balance, - }, - } - - impl GasNodeImpl { - pub fn parent(&self) -> Option { - match self { - Self::External { .. } | Self::Cut { .. } | Self::Reserved { .. } => None, - Self::SpecifiedLocal { parent, .. } | Self::UnspecifiedLocal { parent, .. } => { - Some(*parent) - } - } - } - } - - pub fn root(mut node_key: Key, mut node: GasNode) -> Result> { - log::trace!("Looking for root of {node_key:?} ({node:?}"); - - while let Some(parent) = node.parent() { - node_key = parent; - node = GasNodes::::get(node_key).ok_or(Error::::ParentIsLost)?; - } - - log::trace!("Root found: {node_key:?}"); - - Ok(node_key) - } -} diff --git a/pallets/staking-rewards/src/mock.rs b/pallets/staking-rewards/src/mock.rs index d491261680b..e5037ced27b 100644 --- a/pallets/staking-rewards/src/mock.rs +++ b/pallets/staking-rewards/src/mock.rs @@ -67,14 +67,11 @@ pub(crate) const NOM_1_CONTROLLER: AccountId = 41; pub(crate) const ROOT: AccountId = 101; pub(crate) const INITIAL_TOTAL_TOKEN_SUPPLY: u128 = 1_000_000 * UNITS; -pub(crate) const EXISTENTIAL_DEPOSIT: u128 = 10 * MILLICENTS; // 10 +pub(crate) const EXISTENTIAL_DEPOSIT: u128 = 10 * UNITS / 100_000; // 10 pub(crate) const VALIDATOR_STAKE: u128 = 100 * UNITS; // 10 pub(crate) const ENDOWMENT: u128 = 100 * UNITS; pub(crate) const UNITS: u128 = 100_000; // 10^(-5) precision -pub(crate) const DOLLARS: u128 = UNITS; // 1 to 1 -pub(crate) const CENTS: u128 = DOLLARS / 100; // 1_000 -pub(crate) const MILLICENTS: u128 = CENTS / 1_000; // 1 pub(crate) const MILLISECONDS_PER_YEAR: u64 = 1_000 * 3_600 * 24 * 36_525 / 100; pub(crate) const MILLISECS_PER_BLOCK: u64 = 2_400; pub(crate) const SESSION_DURATION: u64 = 1000; @@ -394,7 +391,7 @@ impl pallet_bags_list::Config for Test { parameter_types! { pub const ProposalBond: Permill = Permill::from_percent(5); - pub const ProposalBondMinimum: u128 = DOLLARS; + pub const ProposalBondMinimum: u128 = UNITS; pub const SpendPeriod: u32 = 100; pub const Burn: Permill = Permill::from_percent(50); pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); diff --git a/runtime/gear/src/constants.rs b/runtime/gear/src/constants.rs index 35c4873d511..0b4e927003b 100644 --- a/runtime/gear/src/constants.rs +++ b/runtime/gear/src/constants.rs @@ -20,6 +20,8 @@ pub mod currency { use runtime_primitives::Balance; + pub const UNITS: Balance = 1_000_000_000_000; // 10^(-12) precision + /// The existential deposit. pub const EXISTENTIAL_DEPOSIT: Balance = 500; diff --git a/runtime/gear/src/migrations.rs b/runtime/gear/src/migrations.rs index 8749826d911..248916f1fad 100644 --- a/runtime/gear/src/migrations.rs +++ b/runtime/gear/src/migrations.rs @@ -19,4 +19,4 @@ #[allow(unused)] use crate::*; -pub type Migrations = (pallet_gear_gas::migrations::MigrateToV3,); +pub type Migrations = (); diff --git a/runtime/vara/src/constants.rs b/runtime/vara/src/constants.rs index 75f273a42ee..b80d724a3ec 100644 --- a/runtime/vara/src/constants.rs +++ b/runtime/vara/src/constants.rs @@ -20,22 +20,22 @@ pub mod currency { use runtime_primitives::Balance; + pub const UNITS: Balance = 1_000_000_000_000; // 10^(-12) precision + + /// Base economic unit, 50 Vara. + pub const ECONOMIC_UNITS: Balance = UNITS * 50; + pub const ECONOMIC_CENTIUNITS: Balance = ECONOMIC_UNITS / 100; + /// The existential deposit. - pub const EXISTENTIAL_DEPOSIT: Balance = 10_000_000_000_000; // 10 Vara + pub const EXISTENTIAL_DEPOSIT: Balance = 10 * UNITS; // 10 Vara /// The program rent cost per block. pub const RENT_COST_PER_BLOCK: Balance = 125_000_000; - // TODO: review quantities based on economic model (issue #1277) - pub const UNITS: Balance = 1_000_000_000_000; // 10^(-12) precision - pub const DOLLARS: Balance = UNITS * 20; // 1 token is worth ~$0.05 - pub const CENTS: Balance = DOLLARS / 100; // 200_000_000_000 - pub const MILLICENTS: Balance = CENTS / 1_000; // 200_000_000 - /// Helper function to calculate various deposits for using pallets' storage pub const fn deposit(items: u32, bytes: u32) -> Balance { // TODO: review numbers (#2650) - items as Balance * 15 * CENTS + (bytes as Balance) * 6 * CENTS + items as Balance * 15 * ECONOMIC_CENTIUNITS + (bytes as Balance) * 6 * ECONOMIC_CENTIUNITS } } diff --git a/runtime/vara/src/governance/fellowship.rs b/runtime/vara/src/governance/fellowship.rs index e0e9a39c2c4..6adad66c76d 100644 --- a/runtime/vara/src/governance/fellowship.rs +++ b/runtime/vara/src/governance/fellowship.rs @@ -30,7 +30,7 @@ use sp_runtime::{ }; use super::*; -use crate::{DAYS, DOLLARS}; +use crate::{DAYS, ECONOMIC_UNITS}; parameter_types! { pub const AlarmInterval: BlockNumber = 1; @@ -49,7 +49,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "candidates", max_deciding: 10, - decision_deposit: 100 * DOLLARS, + decision_deposit: 100 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -71,7 +71,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "members", max_deciding: 10, - decision_deposit: 10 * DOLLARS, + decision_deposit: 10 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -93,7 +93,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "proficients", max_deciding: 10, - decision_deposit: 10 * DOLLARS, + decision_deposit: 10 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -115,7 +115,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "fellows", max_deciding: 10, - decision_deposit: 10 * DOLLARS, + decision_deposit: 10 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -137,7 +137,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "senior fellows", max_deciding: 10, - decision_deposit: 10 * DOLLARS, + decision_deposit: 10 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -159,7 +159,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "experts", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: 1 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -181,7 +181,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "senior experts", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: 1 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -203,7 +203,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "masters", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: 1 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -225,7 +225,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "senior masters", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: 1 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -247,7 +247,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "grand masters", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: 1 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, diff --git a/runtime/vara/src/governance/mod.rs b/runtime/vara/src/governance/mod.rs index cd3189fc2f4..6e435b4df51 100644 --- a/runtime/vara/src/governance/mod.rs +++ b/runtime/vara/src/governance/mod.rs @@ -53,7 +53,7 @@ impl pallet_conviction_voting::Config for Runtime { parameter_types! { pub const AlarmInterval: BlockNumber = 1; - pub const SubmissionDeposit: Balance = 10 * DOLLARS; + pub const SubmissionDeposit: Balance = 10 * ECONOMIC_UNITS; pub const UndecidingTimeout: BlockNumber = 14 * DAYS; } diff --git a/runtime/vara/src/governance/tracks.rs b/runtime/vara/src/governance/tracks.rs index b20bbf0b3ce..48170c7e827 100644 --- a/runtime/vara/src/governance/tracks.rs +++ b/runtime/vara/src/governance/tracks.rs @@ -67,7 +67,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "root", max_deciding: 1, - decision_deposit: 100_000 * DOLLARS, + decision_deposit: 100_000 * ECONOMIC_UNITS, prepare_period: 2 * HOURS, decision_period: 14 * DAYS, confirm_period: 24 * HOURS, @@ -81,7 +81,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "whitelisted_caller", max_deciding: 100, - decision_deposit: 10_000 * DOLLARS, + decision_deposit: 10_000 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 14 * DAYS, confirm_period: 10 * MINUTES, @@ -95,7 +95,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "staking_admin", max_deciding: 10, - decision_deposit: 5_000 * DOLLARS, + decision_deposit: 5_000 * ECONOMIC_UNITS, prepare_period: 2 * HOURS, decision_period: 14 * DAYS, confirm_period: 3 * HOURS, @@ -109,7 +109,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "treasurer", max_deciding: 10, - decision_deposit: 1_000 * DOLLARS, + decision_deposit: 1_000 * ECONOMIC_UNITS, prepare_period: 2 * HOURS, decision_period: 14 * DAYS, confirm_period: 3 * HOURS, @@ -123,7 +123,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "fellowship_admin", max_deciding: 10, - decision_deposit: 5_000 * DOLLARS, + decision_deposit: 5_000 * ECONOMIC_UNITS, prepare_period: 2 * HOURS, decision_period: 14 * DAYS, confirm_period: 3 * HOURS, @@ -137,7 +137,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "general_admin", max_deciding: 10, - decision_deposit: 5_000 * DOLLARS, + decision_deposit: 5_000 * ECONOMIC_UNITS, prepare_period: 2 * HOURS, decision_period: 14 * DAYS, confirm_period: 3 * HOURS, @@ -151,7 +151,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "referendum_canceller", max_deciding: 1_000, - decision_deposit: 10_000 * DOLLARS, + decision_deposit: 10_000 * ECONOMIC_UNITS, prepare_period: 2 * HOURS, decision_period: 7 * DAYS, confirm_period: 3 * HOURS, @@ -165,7 +165,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "referendum_killer", max_deciding: 1_000, - decision_deposit: 50_000 * DOLLARS, + decision_deposit: 50_000 * ECONOMIC_UNITS, prepare_period: 2 * HOURS, decision_period: 14 * DAYS, confirm_period: 3 * HOURS, @@ -179,7 +179,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "small_tipper", max_deciding: 200, - decision_deposit: DOLLARS, + decision_deposit: ECONOMIC_UNITS, prepare_period: MINUTES, decision_period: 7 * DAYS, confirm_period: 10 * MINUTES, @@ -193,7 +193,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "big_tipper", max_deciding: 100, - decision_deposit: 10 * DOLLARS, + decision_deposit: 10 * ECONOMIC_UNITS, prepare_period: 10 * MINUTES, decision_period: 7 * DAYS, confirm_period: HOURS, @@ -207,7 +207,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "small_spender", max_deciding: 50, - decision_deposit: 100 * DOLLARS, + decision_deposit: 100 * ECONOMIC_UNITS, prepare_period: 4 * HOURS, decision_period: 14 * DAYS, confirm_period: 12 * HOURS, @@ -221,7 +221,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "medium_spender", max_deciding: 50, - decision_deposit: 200 * DOLLARS, + decision_deposit: 200 * ECONOMIC_UNITS, prepare_period: 4 * HOURS, decision_period: 14 * DAYS, confirm_period: 24 * HOURS, @@ -235,7 +235,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "big_spender", max_deciding: 50, - decision_deposit: 400 * DOLLARS, + decision_deposit: 400 * ECONOMIC_UNITS, prepare_period: 4 * HOURS, decision_period: 14 * DAYS, confirm_period: 48 * HOURS, diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index cf6de126ae5..c6332876d1b 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -313,8 +313,8 @@ impl pallet_scheduler::Config for Runtime { parameter_types! { pub const PreimageMaxSize: u32 = 4096 * 1024; - pub const PreimageBaseDeposit: Balance = DOLLARS; - pub const PreimageByteDeposit: Balance = CENTS; + pub const PreimageBaseDeposit: Balance = ECONOMIC_UNITS; + pub const PreimageByteDeposit: Balance = ECONOMIC_CENTIUNITS; } impl pallet_preimage::Config for Runtime { @@ -451,9 +451,9 @@ parameter_types! { pub const UnsignedPhase: u32 = EPOCH_DURATION_IN_BLOCKS / 4; // signed config - pub const SignedRewardBase: Balance = DOLLARS; - pub const SignedDepositBase: Balance = DOLLARS; - pub const SignedDepositByte: Balance = CENTS; + pub const SignedRewardBase: Balance = ECONOMIC_UNITS; + pub const SignedDepositBase: Balance = ECONOMIC_UNITS; + pub const SignedDepositByte: Balance = ECONOMIC_CENTIUNITS; pub BetterUnsignedThreshold: Perbill = Perbill::from_rational(1u32, 10_000); @@ -679,13 +679,13 @@ impl pallet_offences::Config for Runtime { parameter_types! { pub const ProposalBond: Permill = Permill::from_percent(5); - pub const ProposalBondMinimum: Balance = DOLLARS; + pub const ProposalBondMinimum: Balance = ECONOMIC_UNITS; pub const SpendPeriod: BlockNumber = DAYS; pub const Burn: Permill = Permill::from_percent(50); pub const TipCountdown: BlockNumber = DAYS; pub const TipFindersFee: Percent = Percent::from_percent(20); - pub const TipReportDepositBase: Balance = DOLLARS; - pub const DataDepositPerByte: Balance = CENTS; + pub const TipReportDepositBase: Balance = ECONOMIC_UNITS; + pub const DataDepositPerByte: Balance = ECONOMIC_CENTIUNITS; pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); pub const MaximumReasonLength: u32 = 300; pub const MaxApprovals: u32 = 100; @@ -712,11 +712,11 @@ impl pallet_treasury::Config for Runtime { parameter_types! { pub const BountyCuratorDeposit: Permill = Permill::from_percent(50); - pub const BountyValueMinimum: Balance = 5 * DOLLARS; - pub const BountyDepositBase: Balance = DOLLARS; + pub const BountyValueMinimum: Balance = 5 * ECONOMIC_UNITS; + pub const BountyDepositBase: Balance = ECONOMIC_UNITS; pub const CuratorDepositMultiplier: Permill = Permill::from_percent(50); - pub const CuratorDepositMin: Balance = DOLLARS; - pub const CuratorDepositMax: Balance = 100 * DOLLARS; + pub const CuratorDepositMin: Balance = ECONOMIC_UNITS; + pub const CuratorDepositMax: Balance = 100 * ECONOMIC_UNITS; pub const BountyDepositPayoutDelay: BlockNumber = DAYS; pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS; } @@ -737,7 +737,7 @@ impl pallet_bounties::Config for Runtime { } parameter_types! { - pub const ChildBountyValueMinimum: Balance = DOLLARS; + pub const ChildBountyValueMinimum: Balance = ECONOMIC_UNITS; } impl pallet_child_bounties::Config for Runtime { @@ -775,9 +775,9 @@ impl pallet_authority_discovery::Config for Runtime { } parameter_types! { - pub const BasicDeposit: Balance = 10 * DOLLARS; // 258 bytes on-chain - pub const FieldDeposit: Balance = 250 * CENTS; // 66 bytes on-chain - pub const SubAccountDeposit: Balance = 2 * DOLLARS; // 53 bytes on-chain + pub const BasicDeposit: Balance = 10 * ECONOMIC_UNITS; // 258 bytes on-chain + pub const FieldDeposit: Balance = 250 * ECONOMIC_CENTIUNITS; // 66 bytes on-chain + pub const SubAccountDeposit: Balance = 2 * ECONOMIC_UNITS; // 53 bytes on-chain pub const MaxSubAccounts: u32 = 100; pub const MaxAdditionalFields: u32 = 100; pub const MaxRegistrars: u32 = 20; @@ -1094,7 +1094,7 @@ where } parameter_types! { - pub const MinVestedTransfer: Balance = 100 * CENTS; + pub const MinVestedTransfer: Balance = 100 * ECONOMIC_CENTIUNITS; pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons = WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE); } diff --git a/runtime/vara/src/migrations.rs b/runtime/vara/src/migrations.rs index 8749826d911..248916f1fad 100644 --- a/runtime/vara/src/migrations.rs +++ b/runtime/vara/src/migrations.rs @@ -19,4 +19,4 @@ #[allow(unused)] use crate::*; -pub type Migrations = (pallet_gear_gas::migrations::MigrateToV3,); +pub type Migrations = ();