mirror of
https://github.com/pezkuwichain/pezkuwi-runtime-templates.git
synced 2026-04-22 03:17:56 +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
@@ -28,10 +28,7 @@ use pallet_ethereum::PostLogContent;
|
||||
use pallet_evm::{EVMCurrencyAdapter, EnsureAccountId20, IdentityAddressMapping};
|
||||
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_core::{H160, U256};
|
||||
@@ -42,11 +39,7 @@ use sp_runtime::{
|
||||
use sp_std::marker::PhantomData;
|
||||
use sp_version::RuntimeVersion;
|
||||
// XCM Imports
|
||||
use xcm::{
|
||||
latest::{prelude::BodyId, InteriorLocation, Junction::PalletInstance},
|
||||
VersionedLocation,
|
||||
};
|
||||
use xcm_builder::PayOverXcm;
|
||||
use xcm::latest::{prelude::BodyId, InteriorLocation, Junction::PalletInstance};
|
||||
#[cfg(not(feature = "runtime-benchmarks"))]
|
||||
use xcm_builder::ProcessXcmMessage;
|
||||
use xcm_config::{RelayLocation, XcmOriginToTransactDispatchOrigin};
|
||||
@@ -55,14 +48,15 @@ use xcm_config::{RelayLocation, XcmOriginToTransactDispatchOrigin};
|
||||
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, WEIGHT_PER_GAS,
|
||||
},
|
||||
opaque,
|
||||
types::{
|
||||
AccountId, Balance, Block, BlockNumber, CollatorSelectionUpdateOrigin, ConsensusHook, Hash,
|
||||
Nonce, PriceForSiblingParachainDelivery,
|
||||
AccountId, AssetKind, Balance, Beneficiary, Block, BlockNumber,
|
||||
CollatorSelectionUpdateOrigin, ConsensusHook, Hash, Nonce,
|
||||
PriceForSiblingParachainDelivery, TreasuryPaymaster,
|
||||
},
|
||||
weights::{self, BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},
|
||||
Aura, Balances, BaseFee, CollatorSelection, EVMChainId, MessageQueue, OpenZeppelinPrecompiles,
|
||||
@@ -514,8 +508,8 @@ impl pallet_utility::Config for Runtime {
|
||||
|
||||
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");
|
||||
@@ -533,20 +527,6 @@ parameter_types! {
|
||||
pub BenchmarkParaId: u8 = 0;
|
||||
}
|
||||
|
||||
type Beneficiary = VersionedLocation;
|
||||
type AssetKind = VersionedLocatableAsset;
|
||||
|
||||
pub type TreasuryPaymaster = PayOverXcm<
|
||||
TreasuryInteriorLocation,
|
||||
xcm_config::XcmRouter,
|
||||
crate::PolkadotXcm,
|
||||
ConstU32<{ 6 * HOURS }>,
|
||||
Beneficiary,
|
||||
AssetKind,
|
||||
LocatableAssetConverter,
|
||||
VersionedLocationConverter,
|
||||
>;
|
||||
|
||||
impl pallet_treasury::Config for Runtime {
|
||||
type ApproveOrigin = EitherOfDiverse<EnsureRoot<AccountId>, Treasurer>;
|
||||
type AssetKind = AssetKind;
|
||||
|
||||
@@ -2,15 +2,25 @@ use fp_account::EthereumSignature;
|
||||
use frame_support::traits::EitherOfDiverse;
|
||||
use frame_system::EnsureRoot;
|
||||
use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
|
||||
use polkadot_runtime_common::impls::{
|
||||
LocatableAssetConverter, VersionedLocatableAsset, VersionedLocationConverter,
|
||||
};
|
||||
use sp_core::ConstU32;
|
||||
use sp_runtime::{
|
||||
generic,
|
||||
traits::{BlakeTwo256, IdentifyAccount, Verify},
|
||||
MultiAddress,
|
||||
};
|
||||
use xcm_builder::ConvertedConcreteId;
|
||||
use xcm::VersionedLocation;
|
||||
use xcm_builder::{ConvertedConcreteId, PayOverXcm};
|
||||
use xcm_executor::traits::JustTry;
|
||||
use xcm_primitives::AsAssetType;
|
||||
|
||||
use crate::{
|
||||
configs::{xcm_config, TreasuryInteriorLocation},
|
||||
constants::HOURS,
|
||||
AssetManager, Assets,
|
||||
};
|
||||
pub use crate::{
|
||||
configs::{
|
||||
xcm_config::RelayLocation, AssetType, FeeAssetId, StakingAdminBodyId,
|
||||
@@ -21,7 +31,6 @@ pub use crate::{
|
||||
},
|
||||
AllPalletsWithSystem, Runtime, RuntimeCall, XcmpQueue,
|
||||
};
|
||||
use crate::{AssetManager, Assets};
|
||||
|
||||
/// Unchecked extrinsic type as expected by this runtime.
|
||||
pub type UncheckedExtrinsic =
|
||||
@@ -118,3 +127,19 @@ pub type XcmFeesToAccount = xcm_primitives::XcmFeesToAccount<
|
||||
AccountId,
|
||||
TreasuryAccount,
|
||||
>;
|
||||
|
||||
/// These aliases are describing the Beneficiary and AssetKind for the Treasury pallet
|
||||
pub type Beneficiary = VersionedLocation;
|
||||
pub type AssetKind = VersionedLocatableAsset;
|
||||
|
||||
/// This is a type that describes how we should transfer bounties from treasury pallet
|
||||
pub type TreasuryPaymaster = PayOverXcm<
|
||||
TreasuryInteriorLocation,
|
||||
xcm_config::XcmRouter,
|
||||
crate::PolkadotXcm,
|
||||
ConstU32<{ 6 * HOURS }>,
|
||||
Beneficiary,
|
||||
AssetKind,
|
||||
LocatableAssetConverter,
|
||||
VersionedLocationConverter,
|
||||
>;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//! Autogenerated weights for `pallet_treasury`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
|
||||
//! DATE: 2024-06-26, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! DATE: 2024-07-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `ip-172-31-15-118`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
|
||||
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: 1024
|
||||
@@ -42,8 +42,8 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `6`
|
||||
// Estimated: `1887`
|
||||
// Minimum execution time: 13_831_000 picoseconds.
|
||||
Weight::from_parts(14_113_000, 0)
|
||||
// Minimum execution time: 13_456_000 picoseconds.
|
||||
Weight::from_parts(13_880_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1887))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(3))
|
||||
@@ -56,8 +56,8 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `134`
|
||||
// Estimated: `1489`
|
||||
// Minimum execution time: 32_187_000 picoseconds.
|
||||
Weight::from_parts(32_905_000, 0)
|
||||
// Minimum execution time: 32_043_000 picoseconds.
|
||||
Weight::from_parts(32_512_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1489))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
@@ -70,8 +70,8 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `430`
|
||||
// Estimated: `6172`
|
||||
// Minimum execution time: 50_832_000 picoseconds.
|
||||
Weight::from_parts(51_309_000, 0)
|
||||
// Minimum execution time: 50_210_000 picoseconds.
|
||||
Weight::from_parts(51_711_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6172))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(3))
|
||||
@@ -85,11 +85,11 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `433 + p * (8 ±0)`
|
||||
// Estimated: `3549`
|
||||
// Minimum execution time: 10_700_000 picoseconds.
|
||||
Weight::from_parts(13_306_602, 0)
|
||||
// Minimum execution time: 10_613_000 picoseconds.
|
||||
Weight::from_parts(13_553_733, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3549))
|
||||
// Standard Error: 1_333
|
||||
.saturating_add(Weight::from_parts(106_841, 0).saturating_mul(p.into()))
|
||||
// Standard Error: 1_221
|
||||
.saturating_add(Weight::from_parts(95_485, 0).saturating_mul(p.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
@@ -99,35 +99,34 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `90`
|
||||
// Estimated: `1887`
|
||||
// Minimum execution time: 6_999_000 picoseconds.
|
||||
Weight::from_parts(7_248_000, 0)
|
||||
// Minimum execution time: 6_900_000 picoseconds.
|
||||
Weight::from_parts(7_133_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1887))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `System::Account` (r:199 w:199)
|
||||
/// Storage: `System::Account` (r:1 w:0)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Treasury::Deactivated` (r:1 w:1)
|
||||
/// Proof: `Treasury::Deactivated` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Treasury::Approvals` (r:1 w:1)
|
||||
/// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Treasury::Proposals` (r:99 w:99)
|
||||
/// Storage: `Treasury::Proposals` (r:99 w:0)
|
||||
/// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
|
||||
/// The range of component `p` is `[0, 99]`.
|
||||
fn on_initialize_proposals(p: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `351 + p * (220 ±0)`
|
||||
// Estimated: `3581 + p * (5182 ±0)`
|
||||
// Minimum execution time: 25_230_000 picoseconds.
|
||||
Weight::from_parts(37_320_091, 0)
|
||||
// Measured: `215 + p * (96 ±0)`
|
||||
// Estimated: `3581 + p * (2559 ±0)`
|
||||
// Minimum execution time: 25_132_000 picoseconds.
|
||||
Weight::from_parts(24_004_402, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3581))
|
||||
// Standard Error: 14_026
|
||||
.saturating_add(Weight::from_parts(44_075_078, 0).saturating_mul(p.into()))
|
||||
// Standard Error: 5_817
|
||||
.saturating_add(Weight::from_parts(3_490_607, 0).saturating_mul(p.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(p.into())))
|
||||
.saturating_add(T::DbWeight::get().writes(3))
|
||||
.saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(p.into())))
|
||||
.saturating_add(Weight::from_parts(0, 5182).saturating_mul(p.into()))
|
||||
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into())))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
.saturating_add(Weight::from_parts(0, 2559).saturating_mul(p.into()))
|
||||
}
|
||||
/// Storage: `Treasury::SpendCount` (r:1 w:1)
|
||||
/// Proof: `Treasury::SpendCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||
@@ -137,8 +136,8 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `6`
|
||||
// Estimated: `1489`
|
||||
// Minimum execution time: 16_410_000 picoseconds.
|
||||
Weight::from_parts(16_859_000, 0)
|
||||
// Minimum execution time: 16_286_000 picoseconds.
|
||||
Weight::from_parts(16_758_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1489))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
@@ -163,8 +162,8 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `491`
|
||||
// Estimated: `5318`
|
||||
// Minimum execution time: 61_669_000 picoseconds.
|
||||
Weight::from_parts(62_804_000, 0)
|
||||
// Minimum execution time: 61_116_000 picoseconds.
|
||||
Weight::from_parts(62_281_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 5318))
|
||||
.saturating_add(T::DbWeight::get().reads(6))
|
||||
.saturating_add(T::DbWeight::get().writes(5))
|
||||
@@ -177,8 +176,8 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `170`
|
||||
// Estimated: `5318`
|
||||
// Minimum execution time: 28_555_000 picoseconds.
|
||||
Weight::from_parts(29_396_000, 0)
|
||||
// Minimum execution time: 28_673_000 picoseconds.
|
||||
Weight::from_parts(29_031_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 5318))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
@@ -189,8 +188,8 @@ impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `142`
|
||||
// Estimated: `5318`
|
||||
// Minimum execution time: 16_360_000 picoseconds.
|
||||
Weight::from_parts(16_699_000, 0)
|
||||
// Minimum execution time: 16_349_000 picoseconds.
|
||||
Weight::from_parts(16_835_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 5318))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
|
||||
Reference in New Issue
Block a user