mirror of
https://github.com/pezkuwichain/pezkuwi-runtime-templates.git
synced 2026-04-22 05:37:57 +00:00
Fix for treasury config and benchmark (#240)
* Fix treasury config * fix build * Updated benchmarks * fix generic fmt * fix clippy * fix comments --------- Co-authored-by: Amar Singh <asinghchrony@protonmail.com>
This commit is contained in:
committed by
Gustavo Gonzalez
parent
cdba7fea87
commit
5e61a2d8a6
@@ -25,10 +25,7 @@ pub use governance::origins::pallet_custom_origins;
|
||||
use governance::{origins::Treasurer, TreasurySpender};
|
||||
use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling};
|
||||
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
|
||||
use polkadot_runtime_common::{
|
||||
impls::{LocatableAssetConverter, VersionedLocatableAsset, VersionedLocationConverter},
|
||||
BlockHashCount, SlowAdjustingFeeUpdate,
|
||||
};
|
||||
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
|
||||
use sp_runtime::{
|
||||
@@ -36,31 +33,29 @@ use sp_runtime::{
|
||||
Perbill, Permill, RuntimeDebug,
|
||||
};
|
||||
use sp_version::RuntimeVersion;
|
||||
use xcm::{
|
||||
latest::{
|
||||
prelude::{AssetId, BodyId},
|
||||
InteriorLocation,
|
||||
Junction::PalletInstance,
|
||||
},
|
||||
VersionedLocation,
|
||||
use xcm::latest::{
|
||||
prelude::{AssetId, BodyId},
|
||||
InteriorLocation,
|
||||
Junction::PalletInstance,
|
||||
};
|
||||
use xcm_builder::PayOverXcm;
|
||||
#[cfg(not(feature = "runtime-benchmarks"))]
|
||||
use xcm_builder::ProcessXcmMessage;
|
||||
use xcm_config::{RelayLocation, XcmOriginToTransactDispatchOrigin};
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
use crate::benchmark::{OpenHrmpChannel, PayWithEnsure};
|
||||
use crate::{
|
||||
constants::{
|
||||
currency::{deposit, CENTS, EXISTENTIAL_DEPOSIT, MICROCENTS},
|
||||
currency::{deposit, CENTS, EXISTENTIAL_DEPOSIT, GRAND, MICROCENTS},
|
||||
AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, MAX_BLOCK_LENGTH,
|
||||
NORMAL_DISPATCH_RATIO, SLOT_DURATION, VERSION,
|
||||
},
|
||||
types::{
|
||||
AccountId, Balance, Block, BlockNumber, CollatorSelectionUpdateOrigin, ConsensusHook, Hash,
|
||||
Nonce, PriceForSiblingParachainDelivery,
|
||||
AccountId, AssetKind, Balance, Beneficiary, Block, BlockNumber,
|
||||
CollatorSelectionUpdateOrigin, ConsensusHook, Hash, Nonce,
|
||||
PriceForSiblingParachainDelivery, TreasuryPaymaster,
|
||||
},
|
||||
weights,
|
||||
weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},
|
||||
weights::{self, BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},
|
||||
Aura, Balances, CollatorSelection, MessageQueue, OriginCaller, PalletInfo, ParachainSystem,
|
||||
Preimage, Runtime, RuntimeCall, RuntimeEvent, RuntimeFreezeReason, RuntimeHoldReason,
|
||||
RuntimeOrigin, RuntimeTask, Session, SessionKeys, System, Treasury, WeightToFee, XcmpQueue,
|
||||
@@ -537,10 +532,16 @@ impl pallet_utility::Config for Runtime {
|
||||
type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
parameter_types! {
|
||||
pub LocationParents: u8 = 1;
|
||||
pub BenchmarkParaId: u8 = 0;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const ProposalBond: Permill = Permill::from_percent(5);
|
||||
pub const ProposalBondMinimum: Balance = 2000; // * CENTS
|
||||
pub const ProposalBondMaximum: Balance = 1;// * GRAND;
|
||||
pub const ProposalBondMinimum: Balance = 2 * GRAND;
|
||||
pub const ProposalBondMaximum: Balance = GRAND;
|
||||
pub const SpendPeriod: BlockNumber = 6 * DAYS;
|
||||
pub const Burn: Permill = Permill::from_perthousand(2);
|
||||
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
|
||||
@@ -554,11 +555,14 @@ parameter_types! {
|
||||
|
||||
impl pallet_treasury::Config for Runtime {
|
||||
type ApproveOrigin = EitherOfDiverse<EnsureRoot<AccountId>, Treasurer>;
|
||||
type AssetKind = VersionedLocatableAsset;
|
||||
type AssetKind = AssetKind;
|
||||
type BalanceConverter = frame_support::traits::tokens::UnityAssetBalanceConversion;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
type BenchmarkHelper = polkadot_runtime_common::impls::benchmarks::TreasuryArguments;
|
||||
type Beneficiary = VersionedLocation;
|
||||
type BenchmarkHelper = polkadot_runtime_common::impls::benchmarks::TreasuryArguments<
|
||||
LocationParents,
|
||||
BenchmarkParaId,
|
||||
>;
|
||||
type Beneficiary = Beneficiary;
|
||||
type BeneficiaryLookup = IdentityLookup<Self::Beneficiary>;
|
||||
type Burn = ();
|
||||
type BurnDestination = ();
|
||||
@@ -566,16 +570,10 @@ impl pallet_treasury::Config for Runtime {
|
||||
type MaxApprovals = MaxApprovals;
|
||||
type OnSlash = Treasury;
|
||||
type PalletId = TreasuryPalletId;
|
||||
type Paymaster = PayOverXcm<
|
||||
TreasuryInteriorLocation,
|
||||
xcm_config::XcmRouter,
|
||||
crate::PolkadotXcm,
|
||||
ConstU32<{ 6 * HOURS }>,
|
||||
Self::Beneficiary,
|
||||
Self::AssetKind,
|
||||
LocatableAssetConverter,
|
||||
VersionedLocationConverter,
|
||||
>;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
type Paymaster = PayWithEnsure<TreasuryPaymaster, OpenHrmpChannel<BenchmarkParaId>>;
|
||||
#[cfg(not(feature = "runtime-benchmarks"))]
|
||||
type Paymaster = TreasuryPaymaster;
|
||||
type PayoutPeriod = PayoutSpendPeriod;
|
||||
type ProposalBond = ProposalBond;
|
||||
type ProposalBondMaximum = ProposalBondMaximum;
|
||||
@@ -585,5 +583,5 @@ impl pallet_treasury::Config for Runtime {
|
||||
type SpendFunds = ();
|
||||
type SpendOrigin = TreasurySpender;
|
||||
type SpendPeriod = SpendPeriod;
|
||||
type WeightInfo = pallet_treasury::weights::SubstrateWeight<Runtime>;
|
||||
type WeightInfo = weights::pallet_treasury::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user