difftreelog
feat(app-promo) added `FreezeIdentifier` to runtime impl
in: master
Added `MaxFreezes` to `pallet_balances::Config`
3 files changed
pallets/app-promotion/src/lib.rsdiffbeforeafterboth--- a/pallets/app-promotion/src/lib.rs
+++ b/pallets/app-promotion/src/lib.rs
@@ -826,7 +826,11 @@
/// Migrates lock state into freeze one
///
- /// # Arguments
+ /// # Permissions
+ ///
+ /// * Sudo
+ ///
+ /// # Arguments
///
/// * `origin`: Must be `Signed`.
/// * `stakers`: Accounts to be upgraded.
@@ -836,7 +840,7 @@
origin: OriginFor<T>,
stakers: Vec<T::AccountId>,
) -> DispatchResult {
- ensure_signed(origin)?;
+ ensure_root(origin)?;
stakers
.into_iter()
runtime/common/config/pallets/app_promotion.rsdiffbeforeafterboth--- a/runtime/common/config/pallets/app_promotion.rs
+++ b/runtime/common/config/pallets/app_promotion.rs
@@ -31,6 +31,7 @@
pub const RecalculationInterval: BlockNumber = RELAY_DAYS;
pub const PendingInterval: BlockNumber = 7 * DAYS;
pub const Nominal: Balance = UNIQUE;
+ pub const HoldAndFreezeIdentifier: [u8; 16] = *b"appstakeappstake";
pub IntervalIncome: Perbill = Perbill::from_rational(5u32, 10_000);
}
@@ -47,4 +48,5 @@
type Nominal = Nominal;
type IntervalIncome = IntervalIncome;
type RuntimeEvent = RuntimeEvent;
+ type FreezeIdentifier = HoldAndFreezeIdentifier;
}
runtime/common/config/substrate.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use frame_support::{18 traits::{Everything, ConstU32, NeverEnsureOrigin},19 weights::{20 constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},21 ConstantMultiplier,22 },23 dispatch::DispatchClass,24 parameter_types, PalletId,25};26use sp_runtime::{27 generic,28 traits::{BlakeTwo256, AccountIdLookup},29 Perbill, Permill, Percent,30};31use sp_arithmetic::traits::One;32use frame_system::{33 limits::{BlockLength, BlockWeights},34 EnsureRoot,35};36use pallet_transaction_payment::{Multiplier, ConstFeeMultiplier};37use crate::{38 runtime_common::DealWithFees, Runtime, RuntimeEvent, RuntimeCall, RuntimeOrigin, PalletInfo,39 System, Balances, SS58Prefix, Version,40};41use up_common::{types::*, constants::*};4243parameter_types! {44 pub const BlockHashCount: BlockNumber = 2400;45 pub RuntimeBlockLength: BlockLength =46 BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);47 pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);48 pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;49 pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()50 .base_block(BlockExecutionWeight::get())51 .for_class(DispatchClass::all(), |weights| {52 weights.base_extrinsic = ExtrinsicBaseWeight::get();53 })54 .for_class(DispatchClass::Normal, |weights| {55 weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);56 })57 .for_class(DispatchClass::Operational, |weights| {58 weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);59 // Operational transactions have some extra reserved space, so that they60 // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.61 weights.reserved = Some(62 MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT63 );64 })65 .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)66 .build_or_panic();67}6869impl frame_system::Config for Runtime {70 /// The data to be stored in an account.71 type AccountData = pallet_balances::AccountData<Balance>;72 /// The identifier used to distinguish between accounts.73 type AccountId = AccountId;74 /// The basic call filter to use in dispatchable.75 type BaseCallFilter = Everything;76 /// Maximum number of block number to block hash mappings to keep (oldest pruned first).77 type BlockHashCount = BlockHashCount;78 /// The maximum length of a block (in bytes).79 type BlockLength = RuntimeBlockLength;80 /// The index type for blocks.81 type BlockNumber = BlockNumber;82 /// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.83 type BlockWeights = RuntimeBlockWeights;84 /// The aggregated dispatch type that is available for extrinsics.85 type RuntimeCall = RuntimeCall;86 /// The weight of database operations that the runtime can invoke.87 type DbWeight = RocksDbWeight;88 /// The ubiquitous event type.89 type RuntimeEvent = RuntimeEvent;90 /// The type for hashing blocks and tries.91 type Hash = Hash;92 /// The hashing algorithm used.93 type Hashing = BlakeTwo256;94 /// The header type.95 type Header = generic::Header<BlockNumber, BlakeTwo256>;96 /// The index type for storing how many extrinsics an account has signed.97 type Index = Index;98 /// The lookup mechanism to get account ID from whatever is passed in dispatchers.99 type Lookup = AccountIdLookup<AccountId, ()>;100 /// What to do if an account is fully reaped from the system.101 type OnKilledAccount = ();102 /// What to do if a new account is created.103 type OnNewAccount = ();104 type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;105 /// The ubiquitous origin type.106 type RuntimeOrigin = RuntimeOrigin;107 /// This type is being generated by `construct_runtime!`.108 type PalletInfo = PalletInfo;109 /// This is used as an identifier of the chain. 42 is the generic substrate prefix.110 type SS58Prefix = SS58Prefix;111 /// Weight information for the extrinsics of this pallet.112 type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;113 /// Version of the runtime.114 type Version = Version;115 type MaxConsumers = ConstU32<16>;116}117118parameter_types! {119 pub const MinimumPeriod: u64 = SLOT_DURATION / 2;120}121122impl pallet_timestamp::Config for Runtime {123 /// A timestamp: milliseconds since the unix epoch.124 type Moment = u64;125 type OnTimestampSet = ();126 type MinimumPeriod = MinimumPeriod;127 type WeightInfo = ();128}129130parameter_types! {131 // pub const ExistentialDeposit: u128 = 500;132 pub const ExistentialDeposit: u128 = EXISTENTIAL_DEPOSIT;133 pub const MaxLocks: u32 = 50;134 pub const MaxReserves: u32 = 50;135}136137impl pallet_balances::Config for Runtime {138 type MaxLocks = MaxLocks;139 type MaxReserves = MaxReserves;140 type ReserveIdentifier = [u8; 16];141 /// The type for recording an account's balance.142 type Balance = Balance;143 /// The ubiquitous event type.144 type RuntimeEvent = RuntimeEvent;145 // FIXME: Is () the new treasury?146 type DustRemoval = ();147 type ExistentialDeposit = ExistentialDeposit;148 type AccountStore = System;149 type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;150 type HoldIdentifier = [u8; 16];151 type FreezeIdentifier = [u8; 16];152 type MaxHolds = ();153 type MaxFreezes = ();154}155156parameter_types! {157 /// This value increases the priority of `Operational` transactions by adding158 /// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.159 pub const OperationalFeeMultiplier: u8 = 5;160161 pub FeeMultiplier: Multiplier = Multiplier::one();162}163164impl pallet_transaction_payment::Config for Runtime {165 type RuntimeEvent = RuntimeEvent;166 type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;167 type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;168 type OperationalFeeMultiplier = OperationalFeeMultiplier;169 type WeightToFee = pallet_configuration::WeightToFee<Self, Balance>;170 type FeeMultiplierUpdate = ConstFeeMultiplier<FeeMultiplier>;171}172173parameter_types! {174 pub const ProposalBond: Permill = Permill::from_percent(5);175 pub const ProposalBondMinimum: Balance = 1 * UNIQUE;176 pub const ProposalBondMaximum: Balance = 1000 * UNIQUE;177 pub const SpendPeriod: BlockNumber = 5 * MINUTES;178 pub const Burn: Permill = Permill::from_percent(0);179 pub const TipCountdown: BlockNumber = 1 * DAYS;180 pub const TipFindersFee: Percent = Percent::from_percent(20);181 pub const TipReportDepositBase: Balance = 1 * UNIQUE;182 pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;183 pub const BountyDepositBase: Balance = 1 * UNIQUE;184 pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;185 pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");186 pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;187 pub const MaximumReasonLength: u32 = 16384;188 pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);189 pub const BountyValueMinimum: Balance = 5 * UNIQUE;190 pub const MaxApprovals: u32 = 100;191}192193impl pallet_treasury::Config for Runtime {194 type PalletId = TreasuryModuleId;195 type Currency = Balances;196 type ApproveOrigin = EnsureRoot<AccountId>;197 type RejectOrigin = EnsureRoot<AccountId>;198 type SpendOrigin = NeverEnsureOrigin<u128>;199 type RuntimeEvent = RuntimeEvent;200 type OnSlash = ();201 type ProposalBond = ProposalBond;202 type ProposalBondMinimum = ProposalBondMinimum;203 type ProposalBondMaximum = ProposalBondMaximum;204 type SpendPeriod = SpendPeriod;205 type Burn = Burn;206 type BurnDestination = ();207 type SpendFunds = ();208 type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;209 type MaxApprovals = MaxApprovals;210}211212impl pallet_sudo::Config for Runtime {213 type RuntimeEvent = RuntimeEvent;214 type RuntimeCall = RuntimeCall;215}216217parameter_types! {218 pub const MaxAuthorities: u32 = 100_000;219}220221impl pallet_aura::Config for Runtime {222 type AuthorityId = AuraId;223 type DisabledValidators = ();224 type MaxAuthorities = MaxAuthorities;225}1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use frame_support::{18 traits::{Everything, ConstU32, NeverEnsureOrigin},19 weights::{20 constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},21 ConstantMultiplier,22 },23 dispatch::DispatchClass,24 parameter_types, PalletId,25};26use sp_runtime::{27 generic,28 traits::{BlakeTwo256, AccountIdLookup},29 Perbill, Permill, Percent,30};31use sp_arithmetic::traits::One;32use frame_system::{33 limits::{BlockLength, BlockWeights},34 EnsureRoot,35};36use pallet_transaction_payment::{Multiplier, ConstFeeMultiplier};37use crate::{38 runtime_common::DealWithFees, Runtime, RuntimeEvent, RuntimeCall, RuntimeOrigin, PalletInfo,39 System, Balances, SS58Prefix, Version,40};41use up_common::{types::*, constants::*};4243parameter_types! {44 pub const BlockHashCount: BlockNumber = 2400;45 pub RuntimeBlockLength: BlockLength =46 BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);47 pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);48 pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;49 pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()50 .base_block(BlockExecutionWeight::get())51 .for_class(DispatchClass::all(), |weights| {52 weights.base_extrinsic = ExtrinsicBaseWeight::get();53 })54 .for_class(DispatchClass::Normal, |weights| {55 weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);56 })57 .for_class(DispatchClass::Operational, |weights| {58 weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);59 // Operational transactions have some extra reserved space, so that they60 // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.61 weights.reserved = Some(62 MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT63 );64 })65 .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)66 .build_or_panic();67}6869impl frame_system::Config for Runtime {70 /// The data to be stored in an account.71 type AccountData = pallet_balances::AccountData<Balance>;72 /// The identifier used to distinguish between accounts.73 type AccountId = AccountId;74 /// The basic call filter to use in dispatchable.75 type BaseCallFilter = Everything;76 /// Maximum number of block number to block hash mappings to keep (oldest pruned first).77 type BlockHashCount = BlockHashCount;78 /// The maximum length of a block (in bytes).79 type BlockLength = RuntimeBlockLength;80 /// The index type for blocks.81 type BlockNumber = BlockNumber;82 /// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.83 type BlockWeights = RuntimeBlockWeights;84 /// The aggregated dispatch type that is available for extrinsics.85 type RuntimeCall = RuntimeCall;86 /// The weight of database operations that the runtime can invoke.87 type DbWeight = RocksDbWeight;88 /// The ubiquitous event type.89 type RuntimeEvent = RuntimeEvent;90 /// The type for hashing blocks and tries.91 type Hash = Hash;92 /// The hashing algorithm used.93 type Hashing = BlakeTwo256;94 /// The header type.95 type Header = generic::Header<BlockNumber, BlakeTwo256>;96 /// The index type for storing how many extrinsics an account has signed.97 type Index = Index;98 /// The lookup mechanism to get account ID from whatever is passed in dispatchers.99 type Lookup = AccountIdLookup<AccountId, ()>;100 /// What to do if an account is fully reaped from the system.101 type OnKilledAccount = ();102 /// What to do if a new account is created.103 type OnNewAccount = ();104 type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;105 /// The ubiquitous origin type.106 type RuntimeOrigin = RuntimeOrigin;107 /// This type is being generated by `construct_runtime!`.108 type PalletInfo = PalletInfo;109 /// This is used as an identifier of the chain. 42 is the generic substrate prefix.110 type SS58Prefix = SS58Prefix;111 /// Weight information for the extrinsics of this pallet.112 type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;113 /// Version of the runtime.114 type Version = Version;115 type MaxConsumers = ConstU32<16>;116}117118parameter_types! {119 pub const MinimumPeriod: u64 = SLOT_DURATION / 2;120}121122impl pallet_timestamp::Config for Runtime {123 /// A timestamp: milliseconds since the unix epoch.124 type Moment = u64;125 type OnTimestampSet = ();126 type MinimumPeriod = MinimumPeriod;127 type WeightInfo = ();128}129130parameter_types! {131 // pub const ExistentialDeposit: u128 = 500;132 pub const ExistentialDeposit: u128 = EXISTENTIAL_DEPOSIT;133 pub const MaxLocks: u32 = 50;134 pub const MaxReserves: u32 = 50;135 pub const MaxFreezes: u32 = 20;136}137138impl pallet_balances::Config for Runtime {139 type MaxLocks = MaxLocks;140 type MaxReserves = MaxReserves;141 type ReserveIdentifier = [u8; 16];142 /// The type for recording an account's balance.143 type Balance = Balance;144 /// The ubiquitous event type.145 type RuntimeEvent = RuntimeEvent;146 // FIXME: Is () the new treasury?147 type DustRemoval = ();148 type ExistentialDeposit = ExistentialDeposit;149 type AccountStore = System;150 type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;151 type HoldIdentifier = [u8; 16];152 type FreezeIdentifier = [u8; 16];153 type MaxHolds = ();154 type MaxFreezes = MaxFreezes;155}156157parameter_types! {158 /// This value increases the priority of `Operational` transactions by adding159 /// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.160 pub const OperationalFeeMultiplier: u8 = 5;161162 pub FeeMultiplier: Multiplier = Multiplier::one();163}164165impl pallet_transaction_payment::Config for Runtime {166 type RuntimeEvent = RuntimeEvent;167 type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;168 type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;169 type OperationalFeeMultiplier = OperationalFeeMultiplier;170 type WeightToFee = pallet_configuration::WeightToFee<Self, Balance>;171 type FeeMultiplierUpdate = ConstFeeMultiplier<FeeMultiplier>;172}173174parameter_types! {175 pub const ProposalBond: Permill = Permill::from_percent(5);176 pub const ProposalBondMinimum: Balance = 1 * UNIQUE;177 pub const ProposalBondMaximum: Balance = 1000 * UNIQUE;178 pub const SpendPeriod: BlockNumber = 5 * MINUTES;179 pub const Burn: Permill = Permill::from_percent(0);180 pub const TipCountdown: BlockNumber = 1 * DAYS;181 pub const TipFindersFee: Percent = Percent::from_percent(20);182 pub const TipReportDepositBase: Balance = 1 * UNIQUE;183 pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;184 pub const BountyDepositBase: Balance = 1 * UNIQUE;185 pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;186 pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");187 pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;188 pub const MaximumReasonLength: u32 = 16384;189 pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);190 pub const BountyValueMinimum: Balance = 5 * UNIQUE;191 pub const MaxApprovals: u32 = 100;192}193194impl pallet_treasury::Config for Runtime {195 type PalletId = TreasuryModuleId;196 type Currency = Balances;197 type ApproveOrigin = EnsureRoot<AccountId>;198 type RejectOrigin = EnsureRoot<AccountId>;199 type SpendOrigin = NeverEnsureOrigin<u128>;200 type RuntimeEvent = RuntimeEvent;201 type OnSlash = ();202 type ProposalBond = ProposalBond;203 type ProposalBondMinimum = ProposalBondMinimum;204 type ProposalBondMaximum = ProposalBondMaximum;205 type SpendPeriod = SpendPeriod;206 type Burn = Burn;207 type BurnDestination = ();208 type SpendFunds = ();209 type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;210 type MaxApprovals = MaxApprovals;211}212213impl pallet_sudo::Config for Runtime {214 type RuntimeEvent = RuntimeEvent;215 type RuntimeCall = RuntimeCall;216}217218parameter_types! {219 pub const MaxAuthorities: u32 = 100_000;220}221222impl pallet_aura::Config for Runtime {223 type AuthorityId = AuraId;224 type DisabledValidators = ();225 type MaxAuthorities = MaxAuthorities;226}