Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Update Currency Const Use #6386

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions runtime/kusama/constants/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub mod currency {
use primitives::v2::Balance;

/// The existential deposit.
pub const EXISTENTIAL_DEPOSIT: Balance = 1 * CENTS;
pub const EXISTENTIAL_DEPOSIT: Balance = 100 * MILLICENTS;

pub const UNITS: Balance = 1_000_000_000_000;
pub const QUID: Balance = UNITS / 30;
Expand All @@ -32,7 +32,7 @@ pub mod currency {
pub const MILLICENTS: Balance = CENTS / 1_000;

pub const fn deposit(items: u32, bytes: u32) -> Balance {
items as Balance * 2_000 * CENTS + (bytes as Balance) * 100 * MILLICENTS
items as Balance * 200 * CENTS + (bytes as Balance) * 10 * MILLICENTS
}
}

Expand Down Expand Up @@ -84,9 +84,9 @@ pub mod fee {
impl WeightToFeePolynomial for WeightToFee {
type Balance = Balance;
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
// in Kusama, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT:
// in Kusama, extrinsic base weight (smallest non-zero weight) is mapped to 1/100 CENT:
let p = super::currency::CENTS;
let q = 10 * Balance::from(ExtrinsicBaseWeight::get().ref_time());
let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time());
smallvec![WeightToFeeCoefficient {
degree: 1,
negative: false,
Expand All @@ -110,19 +110,19 @@ mod tests {
#[test]
// Test that the fee for `MAXIMUM_BLOCK_WEIGHT` of weight has sane bounds.
fn full_block_fee_is_correct() {
// A full block should cost between 1,000 and 10,000 CENTS.
// A full block should cost between 100 and 1,000 CENTS.
let full_block = WeightToFee::weight_to_fee(&MAXIMUM_BLOCK_WEIGHT);
assert!(full_block >= 1_000 * CENTS);
assert!(full_block <= 10_000 * CENTS);
assert!(full_block >= 100 * CENTS);
assert!(full_block <= 1_000 * CENTS);
}

#[test]
// This function tests that the fee for `ExtrinsicBaseWeight` of weight is correct
fn extrinsic_base_fee_is_correct() {
// `ExtrinsicBaseWeight` should cost 1/10 of a CENT
// `ExtrinsicBaseWeight` should cost 1/100 of a CENT
println!("Base: {}", ExtrinsicBaseWeight::get());
let x = WeightToFee::weight_to_fee(&ExtrinsicBaseWeight::get());
let y = CENTS / 10;
assert!(x.max(y) - x.min(y) < MILLICENTS);
let y = CENTS / 100;
assert!(x.max(y) - x.min(y) < MILLICENTS / 10);
}
}
4 changes: 2 additions & 2 deletions runtime/kusama/src/governance/old.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ parameter_types! {
pub LaunchPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1, "KSM_LAUNCH_PERIOD");
pub VotingPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES, "KSM_VOTING_PERIOD");
pub FastTrackVotingPeriod: BlockNumber = prod_or_fast!(3 * HOURS, 1 * MINUTES, "KSM_FAST_TRACK_VOTING_PERIOD");
pub const MinimumDeposit: Balance = 100 * CENTS;
pub const MinimumDeposit: Balance = 10 * CENTS;
pub EnactmentPeriod: BlockNumber = prod_or_fast!(8 * DAYS, 1, "KSM_ENACTMENT_PERIOD");
pub CooloffPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES, "KSM_COOLOFF_PERIOD");
pub const InstantAllowed: bool = true;
Expand Down Expand Up @@ -103,7 +103,7 @@ impl pallet_collective::Config<CouncilCollective> for Runtime {
}

parameter_types! {
pub const CandidacyBond: Balance = 100 * CENTS;
pub const CandidacyBond: Balance = 10 * CENTS;
// 1 storage item created, key size is 32 bytes, value size is 16+16.
pub const VotingBondBase: Balance = deposit(1, 64);
// additional data per vote is 32 bytes (account id).
Expand Down
12 changes: 6 additions & 6 deletions runtime/kusama/src/governance/origins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ pub mod pallet_custom_origins {

decl_ensure! {
pub type Spender: EnsureOrigin<Success = Balance> {
SmallTipper = 250 * QUID,
BigTipper = 1 * GRAND,
SmallSpender = 10 * GRAND,
MediumSpender = 100 * GRAND,
BigSpender = 1_000 * GRAND,
Treasurer = 10_000 * GRAND,
SmallTipper = 25 * QUID,
BigTipper = 100 * QUID,
SmallSpender = 1 * GRAND,
MediumSpender = 10 * GRAND,
BigSpender = 100 * GRAND,
Treasurer = 1_000 * GRAND,
}
}

Expand Down
46 changes: 23 additions & 23 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ impl pallet_babe::Config for Runtime {
}

parameter_types! {
pub const IndexDeposit: Balance = 100 * CENTS;
pub const IndexDeposit: Balance = 10 * CENTS;
}

impl pallet_indices::Config for Runtime {
Expand Down Expand Up @@ -315,7 +315,7 @@ impl pallet_balances::Config for Runtime {
}

parameter_types! {
pub const TransactionByteFee: Balance = 10 * MILLICENTS;
pub const TransactionByteFee: Balance = 1 * MILLICENTS;
/// This value increases the priority of `Operational` transactions by adding
/// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.
pub const OperationalFeeMultiplier: u8 = 5;
Expand Down Expand Up @@ -603,7 +603,7 @@ impl pallet_fast_unstake::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type BatchSize = frame_support::traits::ConstU32<64>;
type Deposit = frame_support::traits::ConstU128<{ CENTS * 100 }>;
type Deposit = frame_support::traits::ConstU128<{ CENTS * 10 }>;
type ControlOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 1, 2>,
Expand All @@ -614,16 +614,16 @@ impl pallet_fast_unstake::Config for Runtime {

parameter_types! {
pub const ProposalBond: Permill = Permill::from_percent(5);
pub const ProposalBondMinimum: Balance = 2000 * CENTS;
pub const ProposalBondMinimum: Balance = 200 * CENTS;
pub const ProposalBondMaximum: Balance = 1 * GRAND;
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);
pub const TipReportDepositBase: Balance = 100 * CENTS;
pub const DataDepositPerByte: Balance = 1 * CENTS;
pub const TipReportDepositBase: Balance = 10 * CENTS;
pub const DataDepositPerByte: Balance = 100 * MILLICENTS;
pub const MaxApprovals: u32 = 100;
pub const MaxAuthorities: u32 = 100_000;
pub const MaxKeys: u32 = 10_000;
Expand Down Expand Up @@ -651,14 +651,14 @@ impl pallet_treasury::Config for Runtime {
}

parameter_types! {
pub const BountyDepositBase: Balance = 100 * CENTS;
pub const BountyDepositBase: Balance = 10 * CENTS;
pub const BountyDepositPayoutDelay: BlockNumber = 4 * DAYS;
pub const BountyUpdatePeriod: BlockNumber = 90 * DAYS;
pub const MaximumReasonLength: u32 = 16384;
pub const CuratorDepositMultiplier: Permill = Permill::from_percent(50);
pub const CuratorDepositMin: Balance = 10 * CENTS;
pub const CuratorDepositMax: Balance = 500 * CENTS;
pub const BountyValueMinimum: Balance = 200 * CENTS;
pub const CuratorDepositMin: Balance = 1 * CENTS;
pub const CuratorDepositMax: Balance = 50 * CENTS;
pub const BountyValueMinimum: Balance = 20 * CENTS;
}

impl pallet_bounties::Config for Runtime {
Expand Down Expand Up @@ -824,9 +824,9 @@ impl claims::Config for Runtime {

parameter_types! {
// Minimum 100 bytes/KSM deposited (1 CENT/byte)
pub const BasicDeposit: Balance = 1000 * CENTS; // 258 bytes on-chain
pub const FieldDeposit: Balance = 250 * CENTS; // 66 bytes on-chain
pub const SubAccountDeposit: Balance = 200 * CENTS; // 53 bytes on-chain
pub const BasicDeposit: Balance = 100 * CENTS; // 258 bytes on-chain
pub const FieldDeposit: Balance = 25 * CENTS; // 66 bytes on-chain
pub const SubAccountDeposit: Balance = 20 * CENTS; // 53 bytes on-chain
pub const MaxSubAccounts: u32 = 100;
pub const MaxAdditionalFields: u32 = 100;
pub const MaxRegistrars: u32 = 20;
Expand Down Expand Up @@ -873,10 +873,10 @@ impl pallet_multisig::Config for Runtime {
}

parameter_types! {
pub const ConfigDepositBase: Balance = 500 * CENTS;
pub const FriendDepositFactor: Balance = 50 * CENTS;
pub const ConfigDepositBase: Balance = 50 * CENTS;
pub const FriendDepositFactor: Balance = 5 * CENTS;
pub const MaxFriends: u16 = 9;
pub const RecoveryDeposit: Balance = 500 * CENTS;
pub const RecoveryDeposit: Balance = 50 * CENTS;
}

impl pallet_recovery::Config for Runtime {
Expand All @@ -891,11 +891,11 @@ impl pallet_recovery::Config for Runtime {
}

parameter_types! {
pub const CandidateDeposit: Balance = 10 * QUID;
pub const WrongSideDeduction: Balance = 2 * QUID;
pub const CandidateDeposit: Balance = 1 * QUID;
pub const WrongSideDeduction: Balance = 20 * CENTS;
pub const MaxStrikes: u32 = 10;
pub const RotationPeriod: BlockNumber = 7 * DAYS;
pub const PeriodSpend: Balance = 500 * QUID;
pub const PeriodSpend: Balance = 50 * QUID;
pub const MaxLockDuration: BlockNumber = 36 * 30 * DAYS;
pub const ChallengePeriod: BlockNumber = 7 * DAYS;
pub const MaxCandidateIntake: u32 = 1;
Expand All @@ -921,7 +921,7 @@ impl pallet_society::Config for Runtime {
}

parameter_types! {
pub const MinVestedTransfer: Balance = 100 * CENTS;
pub const MinVestedTransfer: Balance = 10 * CENTS;
pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons =
WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE);
}
Expand Down Expand Up @@ -1209,8 +1209,8 @@ impl slots::Config for Runtime {

parameter_types! {
pub const CrowdloanId: PalletId = PalletId(*b"py/cfund");
pub const OldSubmissionDeposit: Balance = 3 * GRAND; // ~ 10 KSM
pub const MinContribution: Balance = 3_000 * CENTS; // ~ .1 KSM
pub const OldSubmissionDeposit: Balance = 300 * QUID; // ~ 10 KSM
pub const MinContribution: Balance = 300 * CENTS; // ~ .1 KSM
pub const RemoveKeysLimit: u32 = 1000;
// Allow 32 bytes for an additional memo to a crowdloan.
pub const MaxMemoLength: u8 = 32;
Expand Down Expand Up @@ -1253,7 +1253,7 @@ parameter_types! {
pub const MaxQueueLen: u32 = 1000;
pub const FifoQueueLen: u32 = 250;
pub const GiltPeriod: BlockNumber = 30 * DAYS;
pub const MinFreeze: Balance = 10_000 * CENTS;
pub const MinFreeze: Balance = 10 * QUID;
pub const IntakePeriod: BlockNumber = 5 * MINUTES;
pub const MaxIntakeBids: u32 = 100;
}
Expand Down