Skip to content

Commit ffaaa10

Browse files
authored
feat: deflation (#884)
1 parent c8ae0f4 commit ffaaa10

14 files changed

Lines changed: 43 additions & 270 deletions

File tree

runtimes/common/src/constants.rs

Lines changed: 24 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -138,19 +138,19 @@ parameter_types! {
138138
pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons =
139139
WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE);
140140
/// Deposits per byte
141-
pub const ByteDeposit: Balance = deposit(0, 1);
141+
pub const ByteDeposit: Balance = 0;
142142
/// Index Pallet. Deposit taken for an account index
143-
pub const IndicesDeposit: Balance = deposit(1, MAX_INDICES_BYTE_LENGTH);
143+
pub const IndicesDeposit: Balance = 0;
144144
/// CType Pallet. Per byte fee for a ctype.
145-
pub const CtypeFee: Balance = MILLI_KILT;
145+
pub const CtypeFee: Balance = 0;
146146
}
147147

148148
pub mod attestation {
149149
use super::*;
150150

151151
/// The size is checked in the runtime by a test.
152152
pub const MAX_ATTESTATION_BYTE_LENGTH: u32 = 179;
153-
pub const ATTESTATION_DEPOSIT: Balance = deposit(2, MAX_ATTESTATION_BYTE_LENGTH);
153+
pub const ATTESTATION_DEPOSIT: Balance = 0;
154154

155155
parameter_types! {
156156
pub const MaxDelegatedAttestations: u32 = 1000;
@@ -163,11 +163,8 @@ pub mod bonded_coins {
163163

164164
/// The size is checked in the runtime by a test.
165165
pub const MAX_POOL_BYTE_LENGTH: u32 = 987;
166-
pub const BASE_DEPOSIT: Balance = deposit(1, MAX_POOL_BYTE_LENGTH);
167-
const ASSET_ID_BYTE_LENGTH: u32 = 8;
168-
/// https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/assets/src/types.rs#L188
169-
const ASSET_METADATA_BYTE_LENGTH: u32 = 26;
170-
pub const DEPOSIT_PER_CURRENCY: Balance = deposit(1, ASSET_ID_BYTE_LENGTH + (2 * ASSET_METADATA_BYTE_LENGTH));
166+
pub const BASE_DEPOSIT: Balance = 0;
167+
pub const DEPOSIT_PER_CURRENCY: Balance = 0;
171168
pub const MAX_CURRENCIES: u32 = 50;
172169
pub const MAX_DENOMINATION: u8 = 15;
173170
pub const MAX_STRING_LENGTH: u32 = crate::constants::bonded_assets::STRING_LIMIT;
@@ -210,7 +207,7 @@ pub mod delegation {
210207

211208
use super::*;
212209

213-
pub const DELEGATION_DEPOSIT: Balance = KILT;
210+
pub const DELEGATION_DEPOSIT: Balance = 0;
214211
pub const MAX_SIGNATURE_BYTE_LENGTH: u16 = 64;
215212
pub const MAX_PARENT_CHECKS: u32 = 5;
216213
pub const MAX_REVOCATIONS: u32 = 5;
@@ -224,7 +221,7 @@ pub mod delegation {
224221
pub const MaxRemovals: u32 = MAX_REMOVALS;
225222
#[derive(Clone, TypeInfo)]
226223
pub const MaxChildren: u32 = MAX_CHILDREN;
227-
pub const DelegationDeposit: Balance = DELEGATION_DEPOSIT;
224+
pub const DelegationDeposit: Balance = 0;
228225
}
229226
}
230227

@@ -241,7 +238,7 @@ pub mod dip_provider {
241238
pub const MAX_LINKED_ACCOUNTS: u32 = 10;
242239
// Commitment are 32-byte hashes.
243240
pub const MAX_COMMITMENT_BYTE_LENGTH: u32 = 32;
244-
pub const COMMITMENT_DEPOSIT: Balance = deposit(1, MAX_COMMITMENT_BYTE_LENGTH);
241+
pub const COMMITMENT_DEPOSIT: Balance = 0;
245242
}
246243

247244
pub mod staking {
@@ -404,8 +401,8 @@ pub mod multisig {
404401

405402
parameter_types! {
406403
pub const MaxSignitors: u32 = 64;
407-
pub const DepositBase: Balance = DEPOSIT_STORAGE_ITEM;
408-
pub const DepositFactor: Balance = DEPOSIT_STORAGE_BYTE;
404+
pub const DepositBase: Balance = 0;
405+
pub const DepositFactor: Balance = 0;
409406
}
410407
}
411408

@@ -441,11 +438,11 @@ pub mod did {
441438
+ MAX_NUMBER_OF_URLS_PER_SERVICE * MAX_SERVICE_URL_LENGTH
442439
+ 8;
443440

444-
pub const DID_BASE_DEPOSIT: Balance = 2 * KILT;
445-
pub const KEY_DEPOSIT: Balance = deposit(0, MAX_KEY_LENGTH);
446-
pub const SERVICE_ENDPOINT_DEPOSIT: Balance = deposit(1, MAX_SERVICE_ENDPOINT_BYTE_LENGTH);
441+
pub const DID_BASE_DEPOSIT: Balance = 0;
442+
pub const KEY_DEPOSIT: Balance = 0;
443+
pub const SERVICE_ENDPOINT_DEPOSIT: Balance = 0;
447444

448-
pub const DID_FEE: Balance = 50 * MILLI_KILT;
445+
pub const DID_FEE: Balance = 0;
449446
pub const MAX_KEY_AGREEMENT_KEYS: u32 = 10;
450447
// This has been reduced from the previous 100, but it might still need
451448
// fine-tuning depending on our needs.
@@ -488,7 +485,7 @@ pub mod did_lookup {
488485

489486
/// The size is checked in the runtime by a test.
490487
pub const MAX_CONNECTION_BYTE_LENGTH: u32 = 80;
491-
pub const DID_CONNECTION_DEPOSIT: Balance = deposit(1, MAX_CONNECTION_BYTE_LENGTH);
488+
pub const DID_CONNECTION_DEPOSIT: Balance = 0;
492489

493490
parameter_types! {
494491
pub const DidLookupDeposit: Balance = DID_CONNECTION_DEPOSIT;
@@ -516,12 +513,12 @@ pub mod proxy {
516513

517514
parameter_types! {
518515
// One storage item; key size 32, value size 8; .
519-
pub const ProxyDepositBase: Balance = deposit(1, 8);
516+
pub const ProxyDepositBase: Balance = 0;
520517
// Additional storage item size of 33 bytes.
521-
pub const ProxyDepositFactor: Balance = deposit(0, 33);
518+
pub const ProxyDepositFactor: Balance = 0;
522519
pub const MaxProxies: u16 = 10;
523-
pub const AnnouncementDepositBase: Balance = deposit(1, 8);
524-
pub const AnnouncementDepositFactor: Balance = deposit(0, 66);
520+
pub const AnnouncementDepositBase: Balance = 0;
521+
pub const AnnouncementDepositFactor: Balance = 0;
525522
pub const MaxPending: u16 = 10;
526523
}
527524
}
@@ -534,30 +531,7 @@ pub mod web3_names {
534531

535532
/// The size is checked in the runtime by a test.
536533
pub const MAX_NAME_BYTE_LENGTH: u32 = 121;
537-
pub const DEPOSIT: Balance = deposit(2, MAX_NAME_BYTE_LENGTH);
538-
539-
parameter_types! {
540-
pub const Web3NameDeposit: Balance = DEPOSIT;
541-
pub const MinNameLength: u32 = MIN_LENGTH;
542-
pub const MaxNameLength: u32 = MAX_LENGTH;
543-
}
544-
}
545-
546-
pub mod dot_names {
547-
use super::*;
548-
549-
const MIN_NAME_LENGTH: u32 = 3;
550-
const MAX_NAME_LENGTH: u32 = 28;
551-
552-
pub const DOT_NAME_SUFFIX: &str = ".dot";
553-
#[allow(clippy::as_conversions)]
554-
pub const MIN_LENGTH: u32 = MIN_NAME_LENGTH + DOT_NAME_SUFFIX.len() as u32;
555-
#[allow(clippy::as_conversions)]
556-
pub const MAX_LENGTH: u32 = MAX_NAME_LENGTH + DOT_NAME_SUFFIX.len() as u32;
557-
558-
/// The size is checked in the runtime by a test.
559-
pub const MAX_NAME_BYTE_LENGTH: u32 = 121;
560-
pub const DEPOSIT: Balance = deposit(2, MAX_NAME_BYTE_LENGTH);
534+
pub const DEPOSIT: Balance = 0;
561535

562536
parameter_types! {
563537
pub const Web3NameDeposit: Balance = DEPOSIT;
@@ -569,7 +543,7 @@ pub mod dot_names {
569543
pub mod preimage {
570544
use super::*;
571545
parameter_types! {
572-
pub const PreimageBaseDeposit: Balance = deposit(2, 64);
546+
pub const PreimageBaseDeposit: Balance = 0;
573547
}
574548
}
575549

@@ -583,7 +557,7 @@ pub mod tips {
583557
pub const MaximumReasonLength: u32 = MAXIMUM_REASON_LENGTH;
584558
pub const TipCountdown: BlockNumber = DAYS;
585559
pub const TipFindersFee: Percent = Percent::from_percent(0);
586-
pub const TipReportDepositBase: Balance = deposit(1, 1);
560+
pub const TipReportDepositBase: Balance = 1;
587561
pub const MaxTipAmount: Balance = 100_000 * KILT;
588562
}
589563
}
@@ -608,7 +582,7 @@ pub mod public_credentials {
608582
/// The size is checked in the runtime by a test.
609583
pub const MAX_PUBLIC_CREDENTIAL_STORAGE_LENGTH: u32 = 419;
610584
// Each credential would have a different deposit, so no multiplier here
611-
pub const PUBLIC_CREDENTIAL_DEPOSIT: Balance = deposit(1, MAX_PUBLIC_CREDENTIAL_STORAGE_LENGTH);
585+
pub const PUBLIC_CREDENTIAL_DEPOSIT: Balance = 0;
612586

613587
parameter_types! {
614588
pub const Deposit: Balance = PUBLIC_CREDENTIAL_DEPOSIT;

runtimes/peregrine/src/benchmarks/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ use xcm::v4::{Asset, Assets, Fungibility, Location};
3939
use crate::{
4040
xcm::XcmConfig, AllPalletsWithSystem, AssetSwitchPool1, Attestation, Balances, BondedCurrencies, BondedFungibles,
4141
Collators, Council, Ctype, Delegation, Democracy, DepositStorage, Did, DidLookup, DipProvider, Fungibles, Indices,
42-
Inflation, MessageQueue, Migration, Multisig, ParachainStaking, ParachainSystem, Preimage, Proxy,
43-
PublicCredentials, Runtime, RuntimeEvent, Scheduler, Sudo, System, TechnicalCommittee, TechnicalMembership,
44-
Timestamp, Tips, TipsMembership, Treasury, Utility, Vesting, Web3Names,
42+
MessageQueue, Migration, Multisig, ParachainStaking, ParachainSystem, Preimage, Proxy, PublicCredentials, Runtime,
43+
RuntimeEvent, Scheduler, Sudo, System, TechnicalCommittee, TechnicalMembership, Timestamp, Tips, TipsMembership,
44+
Treasury, Utility, Vesting, Web3Names,
4545
};
4646

4747
pub(crate) mod asset_switch;
@@ -81,7 +81,6 @@ define_benchmarks!(
8181
[attestation, Attestation]
8282
[delegation, Delegation]
8383
[did, Did]
84-
[pallet_inflation, Inflation]
8584
[public_credentials, PublicCredentials]
8685
[pallet_xcm, pallet_xcm::benchmarking::Pallet::<Runtime>]
8786
[pallet_migration, Migration]

runtimes/peregrine/src/governance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl pallet_democracy::Config for Runtime {
8989

9090
parameter_types! {
9191
pub const ProposalBond: Permill = Permill::from_percent(5);
92-
pub const Burn: Permill = Permill::zero();
92+
pub const Burn: Permill = Permill::from_percent(100);
9393
pub TreasuryAccount: AccountId = Treasury::account_id();
9494
}
9595

runtimes/peregrine/src/kilt/mod.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use runtime_common::{
2828
NativeAndForeignAssets as NativeAndForeignAssetsType, TargetFromLeft,
2929
},
3030
deposits::DepositNamespace,
31-
AccountId, Balance, SendDustAndFeesToTreasury,
31+
AccountId, Balance,
3232
};
3333
use sp_core::{crypto::ByteArray, ConstU128, ConstU32, ConstU8};
3434
use sp_runtime::AccountId32;
@@ -69,20 +69,12 @@ impl parachain_staking::Config for Runtime {
6969
type MaxUnstakeRequests = constants::staking::MaxUnstakeRequests;
7070
type NetworkRewardRate = constants::staking::NetworkRewardRate;
7171
type NetworkRewardStart = constants::staking::NetworkRewardStart;
72-
type NetworkRewardBeneficiary = SendDustAndFeesToTreasury<Runtime>;
72+
type NetworkRewardBeneficiary = ();
7373
type WeightInfo = weights::parachain_staking::WeightInfo<Runtime>;
7474

7575
const BLOCKS_PER_YEAR: BlockNumberFor<Self> = constants::BLOCKS_PER_YEAR;
7676
}
7777

78-
impl pallet_inflation::Config for Runtime {
79-
type Currency = Balances;
80-
type InitialPeriodLength = constants::treasury::InitialPeriodLength;
81-
type InitialPeriodReward = constants::treasury::InitialPeriodReward;
82-
type Beneficiary = SendDustAndFeesToTreasury<Runtime>;
83-
type WeightInfo = weights::pallet_inflation::WeightInfo<Runtime>;
84-
}
85-
8678
parameter_types! {
8779
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
8880
}

runtimes/peregrine/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ construct_runtime! {
158158
Delegation: delegation = 63,
159159
Did: did = 64,
160160
// DELETED: CrowdloanContributors = 65,
161-
Inflation: pallet_inflation = 66,
161+
// DELETED: Inflation: pallet_inflation = 66,
162162
DidLookup: pallet_did_lookup = 67,
163163
Web3Names: pallet_web3_names = 68,
164164
PublicCredentials: public_credentials = 69,

runtimes/peregrine/src/migrations/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,12 @@ use runtime_common::constants;
2222
use crate::{weights, Balances, Runtime, RuntimeEvent};
2323

2424
parameter_types! {
25-
pub const DmpPalletName: &'static str = "DmpQueue";
26-
pub const DotNames: &'static str = "DotNames";
27-
pub const UniqueLinking: &'static str = "UniqueLinking";
25+
pub const Inflation: &'static str = "Inflation";
2826
}
2927

3028
pub type RuntimeMigrations = (
3129
pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,
32-
frame_support::migrations::RemovePallet<DmpPalletName, <Runtime as frame_system::Config>::DbWeight>,
33-
frame_support::migrations::RemovePallet<DotNames, <Runtime as frame_system::Config>::DbWeight>,
34-
frame_support::migrations::RemovePallet<UniqueLinking, <Runtime as frame_system::Config>::DbWeight>,
30+
frame_support::migrations::RemovePallet<Inflation, <Runtime as frame_system::Config>::DbWeight>,
3531
pallet_bonded_coins::migrations::v1::MigrateV0ToV1<Runtime>,
3632
);
3733

runtimes/peregrine/src/weights/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ pub mod pallet_deposit_storage;
3535
pub mod pallet_did_lookup;
3636
pub mod pallet_dip_provider;
3737
pub mod pallet_indices;
38-
pub mod pallet_inflation;
3938
pub mod pallet_membership;
4039
pub mod pallet_message_queue;
4140
pub mod pallet_migration;

runtimes/peregrine/src/weights/pallet_inflation.rs

Lines changed: 0 additions & 88 deletions
This file was deleted.

runtimes/spiritnet/src/benchmarks/mod.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ use xcm::v4::{Asset, Assets, Fungibility, Location};
3838

3939
use crate::{
4040
xcm::XcmConfig, AllPalletsWithSystem, AssetSwitchPool1, Attestation, Balances, Collators, Council, Ctype,
41-
Delegation, Democracy, DepositStorage, Did, DidLookup, DipProvider, Fungibles, Indices, Inflation, MessageQueue,
42-
Migration, Multisig, ParachainStaking, ParachainSystem, Preimage, Proxy, PublicCredentials, Runtime, RuntimeEvent,
43-
Scheduler, System, TechnicalCommittee, TechnicalMembership, Timestamp, Tips, TipsMembership, Treasury, Utility,
44-
Vesting, Web3Names,
41+
Delegation, Democracy, DepositStorage, Did, DidLookup, DipProvider, Fungibles, Indices, MessageQueue, Migration,
42+
Multisig, ParachainStaking, ParachainSystem, Preimage, Proxy, PublicCredentials, Runtime, RuntimeEvent, Scheduler,
43+
System, TechnicalCommittee, TechnicalMembership, Timestamp, Tips, TipsMembership, Treasury, Utility, Vesting,
44+
Web3Names,
4545
};
4646

4747
pub(crate) mod asset_switch;
@@ -79,7 +79,6 @@ define_benchmarks!(
7979
[attestation, Attestation]
8080
[delegation, Delegation]
8181
[did, Did]
82-
[pallet_inflation, Inflation]
8382
[public_credentials, PublicCredentials]
8483
[pallet_xcm, pallet_xcm::benchmarking::Pallet::<Runtime>]
8584
[pallet_migration, Migration]

0 commit comments

Comments
 (0)