From 06a89b9353fc0c06a6c525869c2cc6e90aa6f606 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Wed, 23 Apr 2025 10:11:33 +0200 Subject: [PATCH 1/7] first draft constants --- runtimes/common/src/constants.rs | 82 +++++++++++--------------------- 1 file changed, 28 insertions(+), 54 deletions(-) diff --git a/runtimes/common/src/constants.rs b/runtimes/common/src/constants.rs index 120f74576..cb61f2d92 100644 --- a/runtimes/common/src/constants.rs +++ b/runtimes/common/src/constants.rs @@ -138,11 +138,11 @@ parameter_types! { pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons = WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE); /// Deposits per byte - pub const ByteDeposit: Balance = deposit(0, 1); + pub const ByteDeposit: Balance = 0; /// Index Pallet. Deposit taken for an account index - pub const IndicesDeposit: Balance = deposit(1, MAX_INDICES_BYTE_LENGTH); + pub const IndicesDeposit: Balance = 0; /// CType Pallet. Per byte fee for a ctype. - pub const CtypeFee: Balance = MILLI_KILT; + pub const CtypeFee: Balance = 0; } pub mod attestation { @@ -150,7 +150,7 @@ pub mod attestation { /// The size is checked in the runtime by a test. pub const MAX_ATTESTATION_BYTE_LENGTH: u32 = 179; - pub const ATTESTATION_DEPOSIT: Balance = deposit(2, MAX_ATTESTATION_BYTE_LENGTH); + pub const ATTESTATION_DEPOSIT: Balance = 0; parameter_types! { pub const MaxDelegatedAttestations: u32 = 1000; @@ -163,11 +163,8 @@ pub mod bonded_coins { /// The size is checked in the runtime by a test. pub const MAX_POOL_BYTE_LENGTH: u32 = 986; - pub const BASE_DEPOSIT: Balance = deposit(1, MAX_POOL_BYTE_LENGTH); - const ASSET_ID_BYTE_LENGTH: u32 = 8; - /// https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/assets/src/types.rs#L188 - const ASSET_METADATA_BYTE_LENGTH: u32 = 26; - pub const DEPOSIT_PER_CURRENCY: Balance = deposit(1, ASSET_ID_BYTE_LENGTH + (2 * ASSET_METADATA_BYTE_LENGTH)); + pub const BASE_DEPOSIT: Balance = 0; + pub const DEPOSIT_PER_CURRENCY: Balance = 0; pub const MAX_CURRENCIES: u32 = 50; pub const MAX_DENOMINATION: u8 = 15; pub const MAX_STRING_LENGTH: u32 = crate::constants::bonded_assets::STRING_LIMIT; @@ -210,7 +207,7 @@ pub mod delegation { use super::*; - pub const DELEGATION_DEPOSIT: Balance = KILT; + pub const DELEGATION_DEPOSIT: Balance = 0; pub const MAX_SIGNATURE_BYTE_LENGTH: u16 = 64; pub const MAX_PARENT_CHECKS: u32 = 5; pub const MAX_REVOCATIONS: u32 = 5; @@ -224,7 +221,7 @@ pub mod delegation { pub const MaxRemovals: u32 = MAX_REMOVALS; #[derive(Clone, TypeInfo)] pub const MaxChildren: u32 = MAX_CHILDREN; - pub const DelegationDeposit: Balance = DELEGATION_DEPOSIT; + pub const DelegationDeposit: Balance = 0; } } @@ -241,7 +238,7 @@ pub mod dip_provider { pub const MAX_LINKED_ACCOUNTS: u32 = 10; // Commitment are 32-byte hashes. pub const MAX_COMMITMENT_BYTE_LENGTH: u32 = 32; - pub const COMMITMENT_DEPOSIT: Balance = deposit(1, MAX_COMMITMENT_BYTE_LENGTH); + pub const COMMITMENT_DEPOSIT: Balance = 0; } pub mod staking { @@ -274,9 +271,9 @@ pub mod staking { pub const MAX_CANDIDATES: u32 = 75; pub const MAX_DELEGATORS_PER_COLLATOR: u32 = 35; - pub const MIN_DELEGATOR_STAKE: Balance = 20 * KILT; + pub const MIN_DELEGATOR_STAKE: Balance = 0; - pub const NETWORK_REWARD_RATE: Perquintill = Perquintill::from_percent(10); + pub const NETWORK_REWARD_RATE: Perquintill = Perquintill::from_percent(0); parameter_types! { /// Minimum round length is 1 hour @@ -297,7 +294,7 @@ pub mod staking { #[derive(Debug, Eq, PartialEq)] pub const MaxDelegatorsPerCollator: u32 = MAX_DELEGATORS_PER_COLLATOR; /// Minimum stake required to be reserved to be a collator is 10_000 - pub const MinCollatorStake: Balance = 10_000 * KILT; + pub const MinCollatorStake: Balance = 0; /// Minimum stake required to be reserved to be a delegator is 1000 pub const MinDelegatorStake: Balance = MIN_DELEGATOR_STAKE; /// Maximum number of collator candidates @@ -400,8 +397,8 @@ pub mod multisig { parameter_types! { pub const MaxSignitors: u32 = 64; - pub const DepositBase: Balance = DEPOSIT_STORAGE_ITEM; - pub const DepositFactor: Balance = DEPOSIT_STORAGE_BYTE; + pub const DepositBase: Balance = 0; + pub const DepositFactor: Balance = 0; } } @@ -437,11 +434,11 @@ pub mod did { + MAX_NUMBER_OF_URLS_PER_SERVICE * MAX_SERVICE_URL_LENGTH + 8; - pub const DID_BASE_DEPOSIT: Balance = 2 * KILT; - pub const KEY_DEPOSIT: Balance = deposit(0, MAX_KEY_LENGTH); - pub const SERVICE_ENDPOINT_DEPOSIT: Balance = deposit(1, MAX_SERVICE_ENDPOINT_BYTE_LENGTH); + pub const DID_BASE_DEPOSIT: Balance = 0; + pub const KEY_DEPOSIT: Balance = 0; + pub const SERVICE_ENDPOINT_DEPOSIT: Balance = 0; - pub const DID_FEE: Balance = 50 * MILLI_KILT; + pub const DID_FEE: Balance = 0; pub const MAX_KEY_AGREEMENT_KEYS: u32 = 10; // This has been reduced from the previous 100, but it might still need // fine-tuning depending on our needs. @@ -484,7 +481,7 @@ pub mod did_lookup { /// The size is checked in the runtime by a test. pub const MAX_CONNECTION_BYTE_LENGTH: u32 = 80; - pub const DID_CONNECTION_DEPOSIT: Balance = deposit(1, MAX_CONNECTION_BYTE_LENGTH); + pub const DID_CONNECTION_DEPOSIT: Balance = 0; parameter_types! { pub const DidLookupDeposit: Balance = DID_CONNECTION_DEPOSIT; @@ -495,7 +492,7 @@ pub mod treasury { use super::*; pub const INITIAL_PERIOD_LENGTH: BlockNumber = BLOCKS_PER_YEAR.saturating_mul(5); - const YEARLY_REWARD: Balance = 2_000_000u128 * KILT; + const YEARLY_REWARD: Balance = 0; #[allow(clippy::as_conversions)] #[allow(clippy::integer_division)] pub const INITIAL_PERIOD_REWARD_PER_BLOCK: Balance = YEARLY_REWARD / (BLOCKS_PER_YEAR as Balance); @@ -512,12 +509,12 @@ pub mod proxy { parameter_types! { // One storage item; key size 32, value size 8; . - pub const ProxyDepositBase: Balance = deposit(1, 8); + pub const ProxyDepositBase: Balance = 0; // Additional storage item size of 33 bytes. - pub const ProxyDepositFactor: Balance = deposit(0, 33); + pub const ProxyDepositFactor: Balance = 0; pub const MaxProxies: u16 = 10; - pub const AnnouncementDepositBase: Balance = deposit(1, 8); - pub const AnnouncementDepositFactor: Balance = deposit(0, 66); + pub const AnnouncementDepositBase: Balance = 0; + pub const AnnouncementDepositFactor: Balance = 0; pub const MaxPending: u16 = 10; } } @@ -530,30 +527,7 @@ pub mod web3_names { /// The size is checked in the runtime by a test. pub const MAX_NAME_BYTE_LENGTH: u32 = 121; - pub const DEPOSIT: Balance = deposit(2, MAX_NAME_BYTE_LENGTH); - - parameter_types! { - pub const Web3NameDeposit: Balance = DEPOSIT; - pub const MinNameLength: u32 = MIN_LENGTH; - pub const MaxNameLength: u32 = MAX_LENGTH; - } -} - -pub mod dot_names { - use super::*; - - const MIN_NAME_LENGTH: u32 = 3; - const MAX_NAME_LENGTH: u32 = 28; - - pub const DOT_NAME_SUFFIX: &str = ".dot"; - #[allow(clippy::as_conversions)] - pub const MIN_LENGTH: u32 = MIN_NAME_LENGTH + DOT_NAME_SUFFIX.len() as u32; - #[allow(clippy::as_conversions)] - pub const MAX_LENGTH: u32 = MAX_NAME_LENGTH + DOT_NAME_SUFFIX.len() as u32; - - /// The size is checked in the runtime by a test. - pub const MAX_NAME_BYTE_LENGTH: u32 = 121; - pub const DEPOSIT: Balance = deposit(2, MAX_NAME_BYTE_LENGTH); + pub const DEPOSIT: Balance = 0; parameter_types! { pub const Web3NameDeposit: Balance = DEPOSIT; @@ -565,7 +539,7 @@ pub mod dot_names { pub mod preimage { use super::*; parameter_types! { - pub const PreimageBaseDeposit: Balance = deposit(2, 64); + pub const PreimageBaseDeposit: Balance = 0; } } @@ -579,7 +553,7 @@ pub mod tips { pub const MaximumReasonLength: u32 = MAXIMUM_REASON_LENGTH; pub const TipCountdown: BlockNumber = DAYS; pub const TipFindersFee: Percent = Percent::from_percent(0); - pub const TipReportDepositBase: Balance = deposit(1, 1); + pub const TipReportDepositBase: Balance = 0; pub const MaxTipAmount: Balance = 100_000 * KILT; } } @@ -604,7 +578,7 @@ pub mod public_credentials { /// The size is checked in the runtime by a test. pub const MAX_PUBLIC_CREDENTIAL_STORAGE_LENGTH: u32 = 419; // Each credential would have a different deposit, so no multiplier here - pub const PUBLIC_CREDENTIAL_DEPOSIT: Balance = deposit(1, MAX_PUBLIC_CREDENTIAL_STORAGE_LENGTH); + pub const PUBLIC_CREDENTIAL_DEPOSIT: Balance = 0; parameter_types! { pub const Deposit: Balance = PUBLIC_CREDENTIAL_DEPOSIT; From 9b048bcd20662b9e812740c4a1fdcb969ff3e2f7 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Wed, 23 Apr 2025 12:50:51 +0200 Subject: [PATCH 2/7] intermediate --- runtimes/peregrine/src/kilt/mod.rs | 6 +++--- runtimes/spiritnet/src/kilt/mod.rs | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/runtimes/peregrine/src/kilt/mod.rs b/runtimes/peregrine/src/kilt/mod.rs index 0f548921e..e981e08bc 100644 --- a/runtimes/peregrine/src/kilt/mod.rs +++ b/runtimes/peregrine/src/kilt/mod.rs @@ -28,7 +28,7 @@ use runtime_common::{ NativeAndForeignAssets as NativeAndForeignAssetsType, TargetFromLeft, }, deposits::DepositNamespace, - AccountId, Balance, SendDustAndFeesToTreasury, + AccountId, Balance, }; use sp_core::{crypto::ByteArray, ConstU128, ConstU32, ConstU8}; use sp_runtime::AccountId32; @@ -69,7 +69,7 @@ impl parachain_staking::Config for Runtime { type MaxUnstakeRequests = constants::staking::MaxUnstakeRequests; type NetworkRewardRate = constants::staking::NetworkRewardRate; type NetworkRewardStart = constants::staking::NetworkRewardStart; - type NetworkRewardBeneficiary = SendDustAndFeesToTreasury; + type NetworkRewardBeneficiary = (); type WeightInfo = weights::parachain_staking::WeightInfo; const BLOCKS_PER_YEAR: BlockNumberFor = constants::BLOCKS_PER_YEAR; @@ -79,7 +79,7 @@ impl pallet_inflation::Config for Runtime { type Currency = Balances; type InitialPeriodLength = constants::treasury::InitialPeriodLength; type InitialPeriodReward = constants::treasury::InitialPeriodReward; - type Beneficiary = SendDustAndFeesToTreasury; + type Beneficiary = (); type WeightInfo = weights::pallet_inflation::WeightInfo; } diff --git a/runtimes/spiritnet/src/kilt/mod.rs b/runtimes/spiritnet/src/kilt/mod.rs index 5d57bcd16..03b8e3c95 100644 --- a/runtimes/spiritnet/src/kilt/mod.rs +++ b/runtimes/spiritnet/src/kilt/mod.rs @@ -19,9 +19,7 @@ use frame_support::parameter_types; use frame_system::{pallet_prelude::BlockNumberFor, EnsureRoot, EnsureSigned}; use pallet_asset_switch::xcm::{AccountId32ToAccountId32JunctionConverter, MatchesSwitchPairXcmFeeFungibleAsset}; -use runtime_common::{ - asset_switch::hooks::RestrictSwitchDestinationToSelf, AccountId, Balance, SendDustAndFeesToTreasury, -}; +use runtime_common::{asset_switch::hooks::RestrictSwitchDestinationToSelf, AccountId, Balance}; use xcm_builder::{FungiblesAdapter, NoChecking}; use crate::{ @@ -56,7 +54,7 @@ impl parachain_staking::Config for Runtime { type MaxUnstakeRequests = constants::staking::MaxUnstakeRequests; type NetworkRewardRate = constants::staking::NetworkRewardRate; type NetworkRewardStart = constants::staking::NetworkRewardStart; - type NetworkRewardBeneficiary = SendDustAndFeesToTreasury; + type NetworkRewardBeneficiary = (); type WeightInfo = weights::parachain_staking::WeightInfo; const BLOCKS_PER_YEAR: BlockNumberFor = constants::BLOCKS_PER_YEAR; @@ -66,7 +64,7 @@ impl pallet_inflation::Config for Runtime { type Currency = Balances; type InitialPeriodLength = constants::treasury::InitialPeriodLength; type InitialPeriodReward = constants::treasury::InitialPeriodReward; - type Beneficiary = SendDustAndFeesToTreasury; + type Beneficiary = (); type WeightInfo = weights::pallet_inflation::WeightInfo; } From 8d05da5255d37cdc5d0dc0bf49f8d88c59239e12 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Wed, 23 Apr 2025 15:53:53 +0200 Subject: [PATCH 3/7] remove inflation --- runtimes/peregrine/src/benchmarks/mod.rs | 3 +-- runtimes/peregrine/src/governance.rs | 2 +- runtimes/peregrine/src/kilt/mod.rs | 8 -------- runtimes/peregrine/src/lib.rs | 2 +- runtimes/peregrine/src/migrations/mod.rs | 8 ++------ runtimes/spiritnet/src/benchmarks/mod.rs | 8 +++----- runtimes/spiritnet/src/kilt/mod.rs | 8 -------- runtimes/spiritnet/src/lib.rs | 2 +- runtimes/spiritnet/src/migrations/mod.rs | 5 +++-- 9 files changed, 12 insertions(+), 34 deletions(-) diff --git a/runtimes/peregrine/src/benchmarks/mod.rs b/runtimes/peregrine/src/benchmarks/mod.rs index 88fa2d3ee..7fafc35eb 100644 --- a/runtimes/peregrine/src/benchmarks/mod.rs +++ b/runtimes/peregrine/src/benchmarks/mod.rs @@ -38,7 +38,7 @@ use xcm::v4::{Asset, Assets, Fungibility, Location}; use crate::{ xcm::XcmConfig, AllPalletsWithSystem, AssetSwitchPool1, Attestation, Balances, BondedCurrencies, BondedFungibles, - Council, Ctype, Delegation, Democracy, DepositStorage, Did, DidLookup, DipProvider, Fungibles, Indices, Inflation, + Council, Ctype, Delegation, Democracy, DepositStorage, Did, DidLookup, DipProvider, Fungibles, Indices, MessageQueue, Migration, Multisig, ParachainStaking, ParachainSystem, Preimage, Proxy, PublicCredentials, Runtime, RuntimeEvent, Scheduler, Sudo, System, TechnicalCommittee, TechnicalMembership, Timestamp, Tips, TipsMembership, Treasury, Utility, Vesting, Web3Names, @@ -83,7 +83,6 @@ define_benchmarks!( [attestation, Attestation] [delegation, Delegation] [did, Did] - [pallet_inflation, Inflation] [public_credentials, PublicCredentials] [pallet_xcm, pallet_xcm::benchmarking::Pallet::] [pallet_migration, Migration] diff --git a/runtimes/peregrine/src/governance.rs b/runtimes/peregrine/src/governance.rs index 0f1fc2811..1fcbd1843 100644 --- a/runtimes/peregrine/src/governance.rs +++ b/runtimes/peregrine/src/governance.rs @@ -89,7 +89,7 @@ impl pallet_democracy::Config for Runtime { parameter_types! { pub const ProposalBond: Permill = Permill::from_percent(5); - pub const Burn: Permill = Permill::zero(); + pub const Burn: Permill = Permill::from_percent(100); pub TreasuryAccount: AccountId = Treasury::account_id(); } diff --git a/runtimes/peregrine/src/kilt/mod.rs b/runtimes/peregrine/src/kilt/mod.rs index e981e08bc..fd749c29b 100644 --- a/runtimes/peregrine/src/kilt/mod.rs +++ b/runtimes/peregrine/src/kilt/mod.rs @@ -75,14 +75,6 @@ impl parachain_staking::Config for Runtime { const BLOCKS_PER_YEAR: BlockNumberFor = constants::BLOCKS_PER_YEAR; } -impl pallet_inflation::Config for Runtime { - type Currency = Balances; - type InitialPeriodLength = constants::treasury::InitialPeriodLength; - type InitialPeriodReward = constants::treasury::InitialPeriodReward; - type Beneficiary = (); - type WeightInfo = weights::pallet_inflation::WeightInfo; -} - parameter_types! { pub CheckingAccount: AccountId = PolkadotXcm::check_account(); } diff --git a/runtimes/peregrine/src/lib.rs b/runtimes/peregrine/src/lib.rs index 916eb8c87..8722fccc0 100644 --- a/runtimes/peregrine/src/lib.rs +++ b/runtimes/peregrine/src/lib.rs @@ -157,7 +157,7 @@ construct_runtime! { Delegation: delegation = 63, Did: did = 64, // DELETED: CrowdloanContributors = 65, - Inflation: pallet_inflation = 66, + // DELETED: Inflation: pallet_inflation = 66, DidLookup: pallet_did_lookup = 67, Web3Names: pallet_web3_names = 68, PublicCredentials: public_credentials = 69, diff --git a/runtimes/peregrine/src/migrations/mod.rs b/runtimes/peregrine/src/migrations/mod.rs index f6ca110fa..218b7d519 100644 --- a/runtimes/peregrine/src/migrations/mod.rs +++ b/runtimes/peregrine/src/migrations/mod.rs @@ -22,16 +22,12 @@ use runtime_common::constants; use crate::{weights, Balances, Runtime, RuntimeEvent}; parameter_types! { - pub const DmpPalletName: &'static str = "DmpQueue"; - pub const DotNames: &'static str = "DotNames"; - pub const UniqueLinking: &'static str = "UniqueLinking"; + pub const Inflation: &'static str = "Inflation"; } pub type RuntimeMigrations = ( pallet_xcm::migration::MigrateToLatestXcmVersion, - frame_support::migrations::RemovePallet::DbWeight>, - frame_support::migrations::RemovePallet::DbWeight>, - frame_support::migrations::RemovePallet::DbWeight>, + frame_support::migrations::RemovePallet::DbWeight>, ); impl pallet_migration::Config for Runtime { diff --git a/runtimes/spiritnet/src/benchmarks/mod.rs b/runtimes/spiritnet/src/benchmarks/mod.rs index fcb53b313..3e4a8e8e2 100644 --- a/runtimes/spiritnet/src/benchmarks/mod.rs +++ b/runtimes/spiritnet/src/benchmarks/mod.rs @@ -38,10 +38,9 @@ use xcm::v4::{Asset, Assets, Fungibility, Location}; use crate::{ xcm::XcmConfig, AllPalletsWithSystem, AssetSwitchPool1, Attestation, Balances, Council, Ctype, Delegation, - Democracy, DepositStorage, Did, DidLookup, DipProvider, Fungibles, Indices, Inflation, MessageQueue, Migration, - Multisig, ParachainStaking, ParachainSystem, Preimage, Proxy, PublicCredentials, Runtime, RuntimeEvent, Scheduler, - System, TechnicalCommittee, TechnicalMembership, Timestamp, Tips, TipsMembership, Treasury, Utility, Vesting, - Web3Names, + Democracy, DepositStorage, Did, DidLookup, DipProvider, Fungibles, Indices, MessageQueue, Migration, Multisig, + ParachainStaking, ParachainSystem, Preimage, Proxy, PublicCredentials, Runtime, RuntimeEvent, Scheduler, System, + TechnicalCommittee, TechnicalMembership, Timestamp, Tips, TipsMembership, Treasury, Utility, Vesting, Web3Names, }; pub(crate) mod asset_switch; @@ -76,7 +75,6 @@ define_benchmarks!( [attestation, Attestation] [delegation, Delegation] [did, Did] - [pallet_inflation, Inflation] [public_credentials, PublicCredentials] [pallet_xcm, pallet_xcm::benchmarking::Pallet::] [pallet_migration, Migration] diff --git a/runtimes/spiritnet/src/kilt/mod.rs b/runtimes/spiritnet/src/kilt/mod.rs index 03b8e3c95..078615c68 100644 --- a/runtimes/spiritnet/src/kilt/mod.rs +++ b/runtimes/spiritnet/src/kilt/mod.rs @@ -60,14 +60,6 @@ impl parachain_staking::Config for Runtime { const BLOCKS_PER_YEAR: BlockNumberFor = constants::BLOCKS_PER_YEAR; } -impl pallet_inflation::Config for Runtime { - type Currency = Balances; - type InitialPeriodLength = constants::treasury::InitialPeriodLength; - type InitialPeriodReward = constants::treasury::InitialPeriodReward; - type Beneficiary = (); - type WeightInfo = weights::pallet_inflation::WeightInfo; -} - parameter_types! { pub CheckingAccount: AccountId = PolkadotXcm::check_account(); } diff --git a/runtimes/spiritnet/src/lib.rs b/runtimes/spiritnet/src/lib.rs index 7822d21dc..0bbf0dd4b 100644 --- a/runtimes/spiritnet/src/lib.rs +++ b/runtimes/spiritnet/src/lib.rs @@ -153,7 +153,7 @@ construct_runtime! { Delegation: delegation = 63, Did: did = 64, // DELETED: CrowdloanContributors = 65, - Inflation: pallet_inflation = 66, + // DELETED: Inflation: pallet_inflation = 66, DidLookup: pallet_did_lookup = 67, Web3Names: pallet_web3_names = 68, PublicCredentials: public_credentials = 69, diff --git a/runtimes/spiritnet/src/migrations/mod.rs b/runtimes/spiritnet/src/migrations/mod.rs index f1e8d2eb7..a2458c709 100644 --- a/runtimes/spiritnet/src/migrations/mod.rs +++ b/runtimes/spiritnet/src/migrations/mod.rs @@ -22,12 +22,13 @@ use runtime_common::constants; use crate::{weights, Balances, Runtime, RuntimeEvent}; parameter_types! { - pub const DmpPalletName: &'static str = "DmpQueue"; + pub const Inflation: &'static str = "Inflation"; + } pub type RuntimeMigrations = ( pallet_xcm::migration::MigrateToLatestXcmVersion, - frame_support::migrations::RemovePallet::DbWeight>, + frame_support::migrations::RemovePallet::DbWeight>, ); impl pallet_migration::Config for Runtime { From 8adb7fd3ec54ca22b968613ea6b2ba20968a5145 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Thu, 24 Apr 2025 10:43:39 +0200 Subject: [PATCH 4/7] remove weights inflation --- runtimes/peregrine/src/weights/mod.rs | 1 - .../peregrine/src/weights/pallet_inflation.rs | 88 ------------------- runtimes/spiritnet/src/weights/mod.rs | 1 - .../spiritnet/src/weights/pallet_inflation.rs | 88 ------------------- 4 files changed, 178 deletions(-) delete mode 100644 runtimes/peregrine/src/weights/pallet_inflation.rs delete mode 100644 runtimes/spiritnet/src/weights/pallet_inflation.rs diff --git a/runtimes/peregrine/src/weights/mod.rs b/runtimes/peregrine/src/weights/mod.rs index ec7616fdc..d5184a67e 100644 --- a/runtimes/peregrine/src/weights/mod.rs +++ b/runtimes/peregrine/src/weights/mod.rs @@ -34,7 +34,6 @@ pub mod pallet_deposit_storage; pub mod pallet_did_lookup; pub mod pallet_dip_provider; pub mod pallet_indices; -pub mod pallet_inflation; pub mod pallet_membership; pub mod pallet_message_queue; pub mod pallet_migration; diff --git a/runtimes/peregrine/src/weights/pallet_inflation.rs b/runtimes/peregrine/src/weights/pallet_inflation.rs deleted file mode 100644 index 1a60573d3..000000000 --- a/runtimes/peregrine/src/weights/pallet_inflation.rs +++ /dev/null @@ -1,88 +0,0 @@ -// KILT Blockchain – -// Copyright (C) 2025, KILT Foundation - -// The KILT Blockchain is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The KILT Blockchain is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -// If you feel like getting in touch with us, you can do so at - -//! Autogenerated weights for `pallet_inflation` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 33.0.0 -//! DATE: 2024-06-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `eyrie-7`, CPU: `Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz` -//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 - -// Executed Command: -// ./target/release/kilt-parachain -// benchmark -// pallet -// --template=.maintain/runtime-weight-template.hbs -// --header=HEADER-GPL -// --wasm-execution=compiled -// --heap-pages=4096 -// --steps=50 -// --repeat=20 -// --chain=dev -// --pallet=pallet-inflation -// --extrinsic=* -// --output=./runtimes/peregrine/src/weights/pallet_inflation.rs - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_imports)] -#![allow(clippy::as_conversions)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -/// Weight functions for `pallet_inflation`. -pub struct WeightInfo(PhantomData); -impl pallet_inflation::WeightInfo for WeightInfo { - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(132), added: 2607, mode: `MaxEncodedLen`) - fn on_initialize_mint_to_treasury() -> Weight { - // Proof Size summary in bytes: - // Measured: `107` - // Estimated: `3597` - // Minimum execution time: 19_289_000 picoseconds. - Weight::from_parts(19_441_000, 0) - .saturating_add(Weight::from_parts(0, 3597)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - fn on_initialize_no_action() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 222_000 picoseconds. - Weight::from_parts(228_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } -} - -#[cfg(test)] -mod tests { - #[test] - fn test_on_initialize_mint_to_treasury() { - assert!( - ::BlockWeights::get() - .per_class - .get(frame_support::dispatch::DispatchClass::Normal) - .max_extrinsic - .unwrap_or_else(::max_value) - .proof_size() - > 3597 - ); - } -} diff --git a/runtimes/spiritnet/src/weights/mod.rs b/runtimes/spiritnet/src/weights/mod.rs index 6e59fa1f9..ddd4d30fc 100644 --- a/runtimes/spiritnet/src/weights/mod.rs +++ b/runtimes/spiritnet/src/weights/mod.rs @@ -32,7 +32,6 @@ pub mod pallet_deposit_storage; pub mod pallet_did_lookup; pub mod pallet_dip_provider; pub mod pallet_indices; -pub mod pallet_inflation; pub mod pallet_membership; pub mod pallet_message_queue; pub mod pallet_migration; diff --git a/runtimes/spiritnet/src/weights/pallet_inflation.rs b/runtimes/spiritnet/src/weights/pallet_inflation.rs deleted file mode 100644 index 0adc2ceb4..000000000 --- a/runtimes/spiritnet/src/weights/pallet_inflation.rs +++ /dev/null @@ -1,88 +0,0 @@ -// KILT Blockchain – -// Copyright (C) 2025, KILT Foundation - -// The KILT Blockchain is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The KILT Blockchain is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -// If you feel like getting in touch with us, you can do so at - -//! Autogenerated weights for `pallet_inflation` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 33.0.0 -//! DATE: 2024-06-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `eyrie-7`, CPU: `Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz` -//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("spiritnet-dev"), DB CACHE: 1024 - -// Executed Command: -// ./target/release/kilt-parachain -// benchmark -// pallet -// --template=.maintain/runtime-weight-template.hbs -// --header=HEADER-GPL -// --wasm-execution=compiled -// --heap-pages=4096 -// --steps=50 -// --repeat=20 -// --chain=spiritnet-dev -// --pallet=pallet-inflation -// --extrinsic=* -// --output=./runtimes/spiritnet/src/weights/pallet_inflation.rs - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_imports)] -#![allow(clippy::as_conversions)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -/// Weight functions for `pallet_inflation`. -pub struct WeightInfo(PhantomData); -impl pallet_inflation::WeightInfo for WeightInfo { - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(132), added: 2607, mode: `MaxEncodedLen`) - fn on_initialize_mint_to_treasury() -> Weight { - // Proof Size summary in bytes: - // Measured: `107` - // Estimated: `3597` - // Minimum execution time: 19_031_000 picoseconds. - Weight::from_parts(19_533_000, 0) - .saturating_add(Weight::from_parts(0, 3597)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - fn on_initialize_no_action() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 201_000 picoseconds. - Weight::from_parts(224_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - } -} - -#[cfg(test)] -mod tests { - #[test] - fn test_on_initialize_mint_to_treasury() { - assert!( - ::BlockWeights::get() - .per_class - .get(frame_support::dispatch::DispatchClass::Normal) - .max_extrinsic - .unwrap_or_else(::max_value) - .proof_size() - > 3597 - ); - } -} From 7350a675480f9a86cb2e5c525d48358086b663ec Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Thu, 24 Apr 2025 10:46:59 +0200 Subject: [PATCH 5/7] minimize changeset --- runtimes/common/src/constants.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/runtimes/common/src/constants.rs b/runtimes/common/src/constants.rs index cb61f2d92..761464501 100644 --- a/runtimes/common/src/constants.rs +++ b/runtimes/common/src/constants.rs @@ -271,9 +271,9 @@ pub mod staking { pub const MAX_CANDIDATES: u32 = 75; pub const MAX_DELEGATORS_PER_COLLATOR: u32 = 35; - pub const MIN_DELEGATOR_STAKE: Balance = 0; + pub const MIN_DELEGATOR_STAKE: Balance = 20 * KILT; - pub const NETWORK_REWARD_RATE: Perquintill = Perquintill::from_percent(0); + pub const NETWORK_REWARD_RATE: Perquintill = Perquintill::from_percent(10); parameter_types! { /// Minimum round length is 1 hour @@ -294,7 +294,7 @@ pub mod staking { #[derive(Debug, Eq, PartialEq)] pub const MaxDelegatorsPerCollator: u32 = MAX_DELEGATORS_PER_COLLATOR; /// Minimum stake required to be reserved to be a collator is 10_000 - pub const MinCollatorStake: Balance = 0; + pub const MinCollatorStake: Balance = 10_000 * KILT; /// Minimum stake required to be reserved to be a delegator is 1000 pub const MinDelegatorStake: Balance = MIN_DELEGATOR_STAKE; /// Maximum number of collator candidates @@ -492,7 +492,7 @@ pub mod treasury { use super::*; pub const INITIAL_PERIOD_LENGTH: BlockNumber = BLOCKS_PER_YEAR.saturating_mul(5); - const YEARLY_REWARD: Balance = 0; + const YEARLY_REWARD: Balance = 2_000_000u128 * KILT; #[allow(clippy::as_conversions)] #[allow(clippy::integer_division)] pub const INITIAL_PERIOD_REWARD_PER_BLOCK: Balance = YEARLY_REWARD / (BLOCKS_PER_YEAR as Balance); From 97326f85a05346e4bb9119a4e2aaaaa46c3795de Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Thu, 24 Apr 2025 13:12:23 +0200 Subject: [PATCH 6/7] make test pass --- runtimes/common/src/constants.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtimes/common/src/constants.rs b/runtimes/common/src/constants.rs index 761464501..d47e7b202 100644 --- a/runtimes/common/src/constants.rs +++ b/runtimes/common/src/constants.rs @@ -553,7 +553,7 @@ pub mod tips { pub const MaximumReasonLength: u32 = MAXIMUM_REASON_LENGTH; pub const TipCountdown: BlockNumber = DAYS; pub const TipFindersFee: Percent = Percent::from_percent(0); - pub const TipReportDepositBase: Balance = 0; + pub const TipReportDepositBase: Balance = 1; pub const MaxTipAmount: Balance = 100_000 * KILT; } } From 61e35651f1c2a55b2e5b4e1fedb882fd35062ca9 Mon Sep 17 00:00:00 2001 From: Adel Golghalyani Date: Tue, 6 May 2025 11:17:05 +0200 Subject: [PATCH 7/7] fix tests --- runtimes/common/src/constants.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtimes/common/src/constants.rs b/runtimes/common/src/constants.rs index d47e7b202..5c8e56edc 100644 --- a/runtimes/common/src/constants.rs +++ b/runtimes/common/src/constants.rs @@ -162,7 +162,7 @@ pub mod bonded_coins { use super::*; /// The size is checked in the runtime by a test. - pub const MAX_POOL_BYTE_LENGTH: u32 = 986; + pub const MAX_POOL_BYTE_LENGTH: u32 = 987; pub const BASE_DEPOSIT: Balance = 0; pub const DEPOSIT_PER_CURRENCY: Balance = 0; pub const MAX_CURRENCIES: u32 = 50;