From aa9b20ff3c26fc62b63c4b0fe6e23ff54a13a3b7 Mon Sep 17 00:00:00 2001 From: joepetrowski Date: Mon, 5 Dec 2022 07:26:01 +0100 Subject: [PATCH] update use of currency consts --- runtime/kusama/constants/src/lib.rs | 20 +++++------ runtime/kusama/src/governance/old.rs | 4 +-- runtime/kusama/src/governance/origins.rs | 12 +++---- runtime/kusama/src/lib.rs | 46 ++++++++++++------------ 4 files changed, 41 insertions(+), 41 deletions(-) diff --git a/runtime/kusama/constants/src/lib.rs b/runtime/kusama/constants/src/lib.rs index 923f71b94dd8..7cffaf373261 100644 --- a/runtime/kusama/constants/src/lib.rs +++ b/runtime/kusama/constants/src/lib.rs @@ -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; @@ -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 } } @@ -84,9 +84,9 @@ pub mod fee { impl WeightToFeePolynomial for WeightToFee { type Balance = Balance; fn polynomial() -> WeightToFeeCoefficients { - // 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, @@ -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); } } diff --git a/runtime/kusama/src/governance/old.rs b/runtime/kusama/src/governance/old.rs index 9365c903198a..f85ce509c8d7 100644 --- a/runtime/kusama/src/governance/old.rs +++ b/runtime/kusama/src/governance/old.rs @@ -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; @@ -103,7 +103,7 @@ impl pallet_collective::Config 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). diff --git a/runtime/kusama/src/governance/origins.rs b/runtime/kusama/src/governance/origins.rs index b02ff53f3bab..5181e50714ac 100644 --- a/runtime/kusama/src/governance/origins.rs +++ b/runtime/kusama/src/governance/origins.rs @@ -169,12 +169,12 @@ pub mod pallet_custom_origins { decl_ensure! { pub type Spender: EnsureOrigin { - 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, } } diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 9dbaaccb9465..39a4f28bb1e0 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -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 { @@ -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; @@ -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, pallet_collective::EnsureProportionAtLeast, @@ -614,7 +614,7 @@ 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); @@ -622,8 +622,8 @@ parameter_types! { 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; @@ -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 { @@ -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; @@ -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 { @@ -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; @@ -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); } @@ -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; @@ -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; }