mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 11:07:56 +00:00
Initial integration of Gilts pallet (Kusama) (#2587)
* Initial integration of Gilts pallet (Kusama) * Fixes * Fixes * Fixes * Fixes * Fixes * Fixes * cargo run --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=pallet_gilt --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/ * Use real weights * Update lock * Merge * Fixes * Add working. * Add proper curve arithmetic * Fixes * Fixes * Make build * Fixes * Fixes * Fix build * remove dep. * undo dep. * upadte substrate * Fix * Bump Substrate * Fixes * Fixes * Fix test * Remove cap and some tests * Fixes * Fixes * Update runtime/kusama/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * bump the lock file * Fixes * Fixes * Fixes * Fixes * Fixes * Fixes * Fixes * Fixes * Fixes Co-authored-by: Parity Benchmarking Bot <admin@parity.io> Co-authored-by: kianenigma <kian@parity.io> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Generated
+175
-150
File diff suppressed because it is too large
Load Diff
@@ -644,6 +644,7 @@ fn kusama_staging_testnet_config_genesis(wasm_binary: &[u8]) -> kusama::GenesisC
|
||||
pallet_vesting: kusama::VestingConfig { vesting: vec![] },
|
||||
pallet_treasury: Default::default(),
|
||||
parachains_configuration: Default::default(),
|
||||
pallet_gilt: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1282,6 +1283,7 @@ pub fn kusama_testnet_genesis(
|
||||
pallet_vesting: kusama::VestingConfig { vesting: vec![] },
|
||||
pallet_treasury: Default::default(),
|
||||
parachains_configuration: Default::default(),
|
||||
pallet_gilt: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", d
|
||||
inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
offchain-primitives = { package = "sp-offchain", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sp-arithmetic = { package = "sp-arithmetic", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
@@ -45,6 +46,7 @@ pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", b
|
||||
pallet-election-provider-multi-phase = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
frame-executive = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-gilt = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-identity = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
@@ -61,7 +63,7 @@ pallet-session = { git = "https://github.com/paritytech/substrate", branch = "ma
|
||||
pallet-society = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-staking-reward-curve = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
pallet-staking-reward-fn = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
frame-system = {git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
@@ -128,6 +130,7 @@ std = [
|
||||
"pallet-elections-phragmen/std",
|
||||
"pallet-election-provider-multi-phase/std",
|
||||
"pallet-democracy/std",
|
||||
"pallet-gilt/std",
|
||||
"pallet-grandpa/std",
|
||||
"pallet-identity/std",
|
||||
"pallet-im-online/std",
|
||||
@@ -142,6 +145,7 @@ std = [
|
||||
"pallet-session/std",
|
||||
"pallet-society/std",
|
||||
"pallet-staking/std",
|
||||
"pallet-staking-reward-fn/std",
|
||||
"pallet-timestamp/std",
|
||||
"pallet-tips/std",
|
||||
"pallet-treasury/std",
|
||||
@@ -183,6 +187,7 @@ runtime-benchmarks = [
|
||||
"pallet-democracy/runtime-benchmarks",
|
||||
"pallet-elections-phragmen/runtime-benchmarks",
|
||||
"pallet-election-provider-multi-phase/runtime-benchmarks",
|
||||
"pallet-gilt/runtime-benchmarks",
|
||||
"pallet-grandpa/runtime-benchmarks",
|
||||
"pallet-identity/runtime-benchmarks",
|
||||
"pallet-im-online/runtime-benchmarks",
|
||||
|
||||
@@ -57,14 +57,14 @@ use xcm_builder::{
|
||||
AccountId32Aliases, ChildParachainConvertsVia, SovereignSignedViaLocation, CurrencyAdapter as XcmCurrencyAdapter,
|
||||
ChildParachainAsNative, SignedAccountId32AsNative, ChildSystemParachainAsSuperuser, LocationInverter,
|
||||
IsConcrete, FixedWeightBounds, TakeWeightCredit, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom,
|
||||
IsChildSystemParachain, UsingComponents, BackingToPlurality, SignedToAccountId32
|
||||
IsChildSystemParachain, UsingComponents, BackingToPlurality, SignedToAccountId32,
|
||||
};
|
||||
use xcm_executor::XcmExecutor;
|
||||
use sp_arithmetic::Perquintill;
|
||||
use sp_runtime::{
|
||||
create_runtime_str, generic, impl_opaque_keys,
|
||||
ApplyExtrinsicResult, KeyTypeId, Percent, Permill, Perbill,
|
||||
transaction_validity::{TransactionValidity, TransactionSource, TransactionPriority},
|
||||
curve::PiecewiseLinear,
|
||||
traits::{
|
||||
BlakeTwo256, Block as BlockT, OpaqueKeys, ConvertInto, AccountIdLookup,
|
||||
Extrinsic as ExtrinsicT, SaturatedConversion, Verify,
|
||||
@@ -106,6 +106,9 @@ use constants::{time::*, currency::*, fee::*, paras::*};
|
||||
// Weights used in the runtime.
|
||||
mod weights;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
// Make the WASM binary available.
|
||||
#[cfg(feature = "std")]
|
||||
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
||||
@@ -219,8 +222,6 @@ impl pallet_babe::Config for Runtime {
|
||||
// session module is the trigger
|
||||
type EpochChangeTrigger = pallet_babe::ExternalTrigger;
|
||||
|
||||
type KeyOwnerProofSystem = Historical;
|
||||
|
||||
type KeyOwnerProof = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
|
||||
KeyTypeId,
|
||||
pallet_babe::AuthorityId,
|
||||
@@ -231,6 +232,8 @@ impl pallet_babe::Config for Runtime {
|
||||
pallet_babe::AuthorityId,
|
||||
)>>::IdentificationTuple;
|
||||
|
||||
type KeyOwnerProofSystem = Historical;
|
||||
|
||||
type HandleEquivocation =
|
||||
pallet_babe::EquivocationHandler<Self::KeyOwnerIdentification, Offences, ReportLongevity>;
|
||||
|
||||
@@ -260,8 +263,8 @@ impl pallet_balances::Config for Runtime {
|
||||
type Event = Event;
|
||||
type ExistentialDeposit = ExistentialDeposit;
|
||||
type AccountStore = System;
|
||||
type MaxLocks = MaxLocks;
|
||||
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
|
||||
type MaxLocks = MaxLocks;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -361,8 +364,8 @@ sp_npos_elections::generate_solution_type!(
|
||||
impl pallet_election_provider_multi_phase::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Currency = Balances;
|
||||
type SignedPhase = SignedPhase;
|
||||
type UnsignedPhase = UnsignedPhase;
|
||||
type SignedPhase = SignedPhase;
|
||||
type SolutionImprovementThreshold = SolutionImprovementThreshold;
|
||||
type MinerMaxIterations = MinerMaxIterations;
|
||||
type MinerMaxWeight = OffchainSolutionWeightLimit; // For now use the one from staking.
|
||||
@@ -370,27 +373,72 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
|
||||
type OffchainRepeat = OffchainRepeat;
|
||||
type MinerTxPriority = NposSolutionPriority;
|
||||
type DataProvider = Staking;
|
||||
type OnChainAccuracy = Perbill;
|
||||
type CompactSolution = NposCompactSolution24;
|
||||
type OnChainAccuracy = Perbill;
|
||||
type Fallback = Fallback;
|
||||
type BenchmarkingConfig = ();
|
||||
type WeightInfo = weights::pallet_election_provider_multi_phase::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
// TODO #6469: This shouldn't be static, but a lazily cached value, not built unless needed, and
|
||||
// re-built in case input parameters have changed. The `ideal_stake` should be determined by the
|
||||
// amount of parachain slots being bid on: this should be around `(75 - 25.min(slots / 4))%`.
|
||||
pallet_staking_reward_curve::build! {
|
||||
const REWARD_CURVE: PiecewiseLinear<'static> = curve!(
|
||||
min_inflation: 0_025_000,
|
||||
max_inflation: 0_100_000,
|
||||
// 3:2:1 staked : parachains : float.
|
||||
// while there's no parachains, then this is 75% staked : 25% float.
|
||||
ideal_stake: 0_750_000,
|
||||
falloff: 0_050_000,
|
||||
max_piece_count: 40,
|
||||
test_precision: 0_005_000,
|
||||
);
|
||||
fn era_payout(
|
||||
total_staked: Balance,
|
||||
non_gilt_issuance: Balance,
|
||||
max_annual_inflation: Perquintill,
|
||||
period_fraction: Perquintill,
|
||||
auctioned_slots: u64,
|
||||
) -> (Balance, Balance) {
|
||||
use sp_arithmetic::traits::Saturating;
|
||||
use pallet_staking_reward_fn::compute_inflation;
|
||||
|
||||
let min_annual_inflation = Perquintill::from_rational(25u64, 1000u64);
|
||||
let delta_annual_inflation = max_annual_inflation.saturating_sub(min_annual_inflation);
|
||||
|
||||
// 30% reserved for up to 60 slots.
|
||||
let auction_proportion = Perquintill::from_rational(auctioned_slots.min(60), 200u64);
|
||||
|
||||
// Therefore the ideal amount at stake (as a percentage of total issuance) is 75% less the amount that we expect
|
||||
// to be taken up with auctions.
|
||||
let ideal_stake = Perquintill::from_percent(75)
|
||||
.saturating_sub(auction_proportion);
|
||||
|
||||
let stake = Perquintill::from_rational(total_staked, non_gilt_issuance);
|
||||
let falloff = Perquintill::from_percent(5);
|
||||
let adjustment = compute_inflation(stake, ideal_stake, falloff);
|
||||
let staking_inflation = min_annual_inflation.saturating_add(delta_annual_inflation * adjustment);
|
||||
|
||||
let max_payout = period_fraction * max_annual_inflation * non_gilt_issuance;
|
||||
let staking_payout = (period_fraction * staking_inflation) * non_gilt_issuance;
|
||||
let rest = max_payout.saturating_sub(staking_payout);
|
||||
|
||||
let other_issuance = non_gilt_issuance.saturating_sub(total_staked);
|
||||
if total_staked > other_issuance {
|
||||
let _cap_rest = Perquintill::from_rational(other_issuance, total_staked) * staking_payout;
|
||||
// We don't do anything with this, but if we wanted to, we could introduce a cap on the treasury amount
|
||||
// with: `rest = rest.min(cap_rest);`
|
||||
}
|
||||
(staking_payout, rest)
|
||||
}
|
||||
|
||||
pub struct EraPayout;
|
||||
impl pallet_staking::EraPayout<Balance> for EraPayout {
|
||||
fn era_payout(
|
||||
total_staked: Balance,
|
||||
_total_issuance: Balance,
|
||||
era_duration_millis: u64,
|
||||
) -> (Balance, Balance) {
|
||||
// TODO: #2999 Update with Auctions logic when auctions pallet added.
|
||||
const AUCTIONED_SLOTS: u64 = 0;
|
||||
const MAX_ANNUAL_INFLATION: Perquintill = Perquintill::from_percent(10);
|
||||
const MILLISECONDS_PER_YEAR: u64 = 1000 * 3600 * 24 * 36525 / 100;
|
||||
|
||||
era_payout(
|
||||
total_staked,
|
||||
Gilt::issuance().non_gilt,
|
||||
MAX_ANNUAL_INFLATION,
|
||||
Perquintill::from_rational(era_duration_millis, MILLISECONDS_PER_YEAR),
|
||||
AUCTIONED_SLOTS,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -400,8 +448,7 @@ parameter_types! {
|
||||
pub const BondingDuration: pallet_staking::EraIndex = 28;
|
||||
// 27 eras in which slashes can be cancelled (slightly less than 7 days).
|
||||
pub const SlashDeferDuration: pallet_staking::EraIndex = 27;
|
||||
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
|
||||
pub const MaxNominatorRewardedPerValidator: u32 = 256;
|
||||
pub const MaxNominatorRewardedPerValidator: u32 = 256;
|
||||
}
|
||||
|
||||
type SlashCancelOrigin = EnsureOneOf<
|
||||
@@ -415,6 +462,7 @@ impl pallet_staking::Config for Runtime {
|
||||
type Currency = Balances;
|
||||
type UnixTime = Timestamp;
|
||||
type CurrencyToVote = CurrencyToVote;
|
||||
type ElectionProvider = ElectionProviderMultiPhase;
|
||||
type RewardRemainder = Treasury;
|
||||
type Event = Event;
|
||||
type Slash = Treasury;
|
||||
@@ -425,10 +473,9 @@ impl pallet_staking::Config for Runtime {
|
||||
// A majority of the council or root can cancel the slash.
|
||||
type SlashCancelOrigin = SlashCancelOrigin;
|
||||
type SessionInterface = Self;
|
||||
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
|
||||
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
|
||||
type EraPayout = EraPayout;
|
||||
type NextNewSession = Session;
|
||||
type ElectionProvider = ElectionProviderMultiPhase;
|
||||
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
|
||||
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
@@ -473,6 +520,7 @@ impl pallet_democracy::Config for Runtime {
|
||||
EnsureRoot<AccountId>,
|
||||
pallet_collective::EnsureProportionAtLeast<_2, _3, AccountId, CouncilCollective>,
|
||||
>;
|
||||
type BlacklistOrigin = EnsureRoot<AccountId>;
|
||||
// To cancel a proposal before it has been passed, the technical committee must be unanimous or
|
||||
// Root must agree.
|
||||
type CancelProposalOrigin = EnsureOneOf<
|
||||
@@ -480,17 +528,16 @@ impl pallet_democracy::Config for Runtime {
|
||||
EnsureRoot<AccountId>,
|
||||
pallet_collective::EnsureProportionAtLeast<_1, _1, AccountId, TechnicalCollective>,
|
||||
>;
|
||||
type BlacklistOrigin = EnsureRoot<AccountId>;
|
||||
// Any single technical committee member may veto a coming council proposal, however they can
|
||||
// only do it once and it lasts only for the cooloff period.
|
||||
type VetoOrigin = pallet_collective::EnsureMember<AccountId, TechnicalCollective>;
|
||||
type CooloffPeriod = CooloffPeriod;
|
||||
type PreimageByteDeposit = PreimageByteDeposit;
|
||||
type OperationalPreimageOrigin = pallet_collective::EnsureMember<AccountId, CouncilCollective>;
|
||||
type Slash = Treasury;
|
||||
type Scheduler = Scheduler;
|
||||
type PalletsOrigin = OriginCaller;
|
||||
type MaxVotes = MaxVotes;
|
||||
type OperationalPreimageOrigin = pallet_collective::EnsureMember<AccountId, CouncilCollective>;
|
||||
type WeightInfo = weights::pallet_democracy::WeightInfo<Runtime>;
|
||||
type MaxProposals = MaxProposals;
|
||||
}
|
||||
@@ -616,32 +663,31 @@ impl pallet_treasury::Config for Runtime {
|
||||
type SpendPeriod = SpendPeriod;
|
||||
type Burn = Burn;
|
||||
type BurnDestination = Society;
|
||||
type SpendFunds = Bounties;
|
||||
type MaxApprovals = MaxApprovals;
|
||||
type WeightInfo = weights::pallet_treasury::WeightInfo<Runtime>;
|
||||
type SpendFunds = Bounties;
|
||||
}
|
||||
|
||||
impl pallet_bounties::Config for Runtime {
|
||||
type Event = Event;
|
||||
type BountyDepositBase = BountyDepositBase;
|
||||
type BountyDepositPayoutDelay = BountyDepositPayoutDelay;
|
||||
type BountyUpdatePeriod = BountyUpdatePeriod;
|
||||
type BountyCuratorDeposit = BountyCuratorDeposit;
|
||||
type BountyValueMinimum = BountyValueMinimum;
|
||||
type DataDepositPerByte = DataDepositPerByte;
|
||||
type Event = Event;
|
||||
type MaximumReasonLength = MaximumReasonLength;
|
||||
type WeightInfo = weights::pallet_bounties::WeightInfo<Runtime>;
|
||||
|
||||
}
|
||||
|
||||
impl pallet_tips::Config for Runtime {
|
||||
type Event = Event;
|
||||
type DataDepositPerByte = DataDepositPerByte;
|
||||
type MaximumReasonLength = MaximumReasonLength;
|
||||
type DataDepositPerByte = DataDepositPerByte;
|
||||
type Tippers = PhragmenElection;
|
||||
type TipCountdown = TipCountdown;
|
||||
type TipFindersFee = TipFindersFee;
|
||||
type TipReportDepositBase = TipReportDepositBase;
|
||||
type Event = Event;
|
||||
type WeightInfo = weights::pallet_tips::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
@@ -673,8 +719,6 @@ impl pallet_grandpa::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Call = Call;
|
||||
|
||||
type KeyOwnerProofSystem = Historical;
|
||||
|
||||
type KeyOwnerProof =
|
||||
<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
|
||||
|
||||
@@ -683,6 +727,8 @@ impl pallet_grandpa::Config for Runtime {
|
||||
GrandpaId,
|
||||
)>>::IdentificationTuple;
|
||||
|
||||
type KeyOwnerProofSystem = Historical;
|
||||
|
||||
type HandleEquivocation =
|
||||
pallet_grandpa::EquivocationHandler<Self::KeyOwnerIdentification, Offences, ReportLongevity>;
|
||||
|
||||
@@ -742,8 +788,8 @@ impl frame_system::offchain::SigningTypes for Runtime {
|
||||
impl<C> frame_system::offchain::SendTransactionTypes<C> for Runtime where
|
||||
Call: From<C>,
|
||||
{
|
||||
type OverarchingCall = Call;
|
||||
type Extrinsic = UncheckedExtrinsic;
|
||||
type OverarchingCall = Call;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -771,15 +817,15 @@ parameter_types! {
|
||||
impl pallet_identity::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Currency = Balances;
|
||||
type Slashed = Treasury;
|
||||
type BasicDeposit = BasicDeposit;
|
||||
type FieldDeposit = FieldDeposit;
|
||||
type SubAccountDeposit = SubAccountDeposit;
|
||||
type MaxSubAccounts = MaxSubAccounts;
|
||||
type MaxAdditionalFields = MaxAdditionalFields;
|
||||
type MaxRegistrars = MaxRegistrars;
|
||||
type RegistrarOrigin = MoreThanHalfCouncil;
|
||||
type Slashed = Treasury;
|
||||
type ForceOrigin = MoreThanHalfCouncil;
|
||||
type RegistrarOrigin = MoreThanHalfCouncil;
|
||||
type WeightInfo = weights::pallet_identity::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
@@ -932,7 +978,8 @@ impl InstanceFilter<Call> for ProxyType {
|
||||
// Specifically omitting Vesting `vested_transfer`, and `force_vested_transfer`
|
||||
Call::Scheduler(..) |
|
||||
Call::Proxy(..) |
|
||||
Call::Multisig(..)
|
||||
Call::Multisig(..) |
|
||||
Call::Gilt(..)
|
||||
),
|
||||
ProxyType::Governance => matches!(c,
|
||||
Call::Democracy(..) |
|
||||
@@ -1221,6 +1268,35 @@ impl pallet_xcm::Config for Runtime {
|
||||
type Weigher = FixedWeightBounds<BaseXcmWeight, Call>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub IgnoredIssuance: Balance = Treasury::pot();
|
||||
pub const QueueCount: u32 = 300;
|
||||
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 IntakePeriod: BlockNumber = 5 * MINUTES;
|
||||
pub const MaxIntakeBids: u32 = 100;
|
||||
}
|
||||
|
||||
impl pallet_gilt::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Currency = Balances;
|
||||
type CurrencyBalance = Balance;
|
||||
type AdminOrigin = MoreThanHalfCouncil;
|
||||
type Deficit = (); // Mint
|
||||
type Surplus = (); // Burn
|
||||
type IgnoredIssuance = IgnoredIssuance;
|
||||
type QueueCount = QueueCount;
|
||||
type MaxQueueLen = MaxQueueLen;
|
||||
type FifoQueueLen = FifoQueueLen;
|
||||
type Period = GiltPeriod;
|
||||
type MinFreeze = MinFreeze;
|
||||
type IntakePeriod = IntakePeriod;
|
||||
type MaxIntakeBids = MaxIntakeBids;
|
||||
type WeightInfo = weights::pallet_gilt::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
construct_runtime! {
|
||||
pub enum Runtime where
|
||||
Block = Block,
|
||||
@@ -1293,6 +1369,9 @@ construct_runtime! {
|
||||
// Election pallet. Only works with staking, but placed here to maintain indices.
|
||||
ElectionProviderMultiPhase: pallet_election_provider_multi_phase::{Pallet, Call, Storage, Event<T>, ValidateUnsigned} = 37,
|
||||
|
||||
// Gilts pallet.
|
||||
Gilt: pallet_gilt::{Pallet, Call, Storage, Event<T>, Config} = 38,
|
||||
|
||||
// Parachains pallets. Start indices at 50 to leave room.
|
||||
ParachainsOrigin: parachains_origin::{Pallet, Origin} = 50,
|
||||
ParachainsConfiguration: parachains_configuration::{Pallet, Call, Storage, Config<T>} = 51,
|
||||
@@ -1742,6 +1821,7 @@ sp_api::impl_runtime_apis! {
|
||||
add_benchmark!(params, batches, pallet_democracy, Democracy);
|
||||
add_benchmark!(params, batches, pallet_elections_phragmen, PhragmenElection);
|
||||
add_benchmark!(params, batches, pallet_election_provider_multi_phase, ElectionProviderMultiPhase);
|
||||
add_benchmark!(params, batches, pallet_gilt, Gilt);
|
||||
add_benchmark!(params, batches, pallet_identity, Identity);
|
||||
add_benchmark!(params, batches, pallet_im_online, ImOnline);
|
||||
add_benchmark!(params, batches, pallet_indices, Indices);
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Polkadot.
|
||||
|
||||
// Polkadot 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.
|
||||
|
||||
// Polkadot 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 Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Tests for the Kusama Runtime Configuration
|
||||
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn compute_inflation_should_give_sensible_results() {
|
||||
assert_eq!(pallet_staking_reward_fn::compute_inflation(
|
||||
Perquintill::from_percent(75),
|
||||
Perquintill::from_percent(75),
|
||||
Perquintill::from_percent(5),
|
||||
), Perquintill::one());
|
||||
assert_eq!(pallet_staking_reward_fn::compute_inflation(
|
||||
Perquintill::from_percent(50),
|
||||
Perquintill::from_percent(75),
|
||||
Perquintill::from_percent(5),
|
||||
), Perquintill::from_rational(2u64, 3u64));
|
||||
assert_eq!(pallet_staking_reward_fn::compute_inflation(
|
||||
Perquintill::from_percent(80),
|
||||
Perquintill::from_percent(75),
|
||||
Perquintill::from_percent(5),
|
||||
), Perquintill::from_rational(1u64, 2u64));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn era_payout_should_give_sensible_results() {
|
||||
assert_eq!(era_payout(
|
||||
75,
|
||||
100,
|
||||
Perquintill::from_percent(10),
|
||||
Perquintill::one(),
|
||||
0,
|
||||
), (10, 0));
|
||||
assert_eq!(era_payout(
|
||||
80,
|
||||
100,
|
||||
Perquintill::from_percent(10),
|
||||
Perquintill::one(),
|
||||
0,
|
||||
), (6, 4));
|
||||
}
|
||||
@@ -22,6 +22,7 @@ pub mod pallet_collective;
|
||||
pub mod pallet_democracy;
|
||||
pub mod pallet_elections_phragmen;
|
||||
pub mod pallet_election_provider_multi_phase;
|
||||
pub mod pallet_gilt;
|
||||
pub mod pallet_identity;
|
||||
pub mod pallet_im_online;
|
||||
pub mod pallet_indices;
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
// Copyright 2017-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Polkadot.
|
||||
|
||||
// Polkadot 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.
|
||||
|
||||
// Polkadot 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 Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
//! Autogenerated weights for pallet_gilt
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
|
||||
//! DATE: 2021-03-10, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 128
|
||||
|
||||
// Executed Command:
|
||||
// target/release/polkadot
|
||||
// benchmark
|
||||
// --chain=kusama-dev
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --pallet=pallet_gilt
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --header=./file_header.txt
|
||||
// --output=./runtime/kusama/src/weights/
|
||||
|
||||
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for pallet_gilt.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_gilt::WeightInfo for WeightInfo<T> {
|
||||
fn place_bid(l: u32, ) -> Weight {
|
||||
(66_637_000 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((308_000 as Weight).saturating_mul(l as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn place_bid_max() -> Weight {
|
||||
(307_267_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn retract_bid(l: u32, ) -> Weight {
|
||||
(66_767_000 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((250_000 as Weight).saturating_mul(l as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn set_target() -> Weight {
|
||||
(5_467_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn thaw() -> Weight {
|
||||
(73_106_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn pursue_target_noop() -> Weight {
|
||||
(3_203_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
}
|
||||
fn pursue_target_per_item(b: u32, ) -> Weight {
|
||||
(68_961_000 as Weight)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((10_500_000 as Weight).saturating_mul(b as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(b as Weight)))
|
||||
}
|
||||
fn pursue_target_per_queue(q: u32, ) -> Weight {
|
||||
(33_795_000 as Weight)
|
||||
// Standard Error: 15_000
|
||||
.saturating_add((16_999_000 as Weight).saturating_mul(q as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(q as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(q as Weight)))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user