mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 00:01:09 +00:00
Companion for Weight v1.5 (#5943)
* fix to latest substrate pr
* update weights
* cargo build -p polkadot-runtime-parachains
* fix xcm-builder
* fix import
* fix a bunch
* fix a bunch of weight stuff
* kusama compile
* unused
* builds
* maybe fix
* cargo test -p polkadot-runtime-parachains
* xcm simulator example
* fix tests
* xcm sim fuzz
* fix runtime tests
* remove unused
* fix integration tests
* scalar div
* update lockfile for {"substrate"}
Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -192,7 +192,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
// We didn't return early above, so we didn't do anything.
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,16 +50,16 @@ pub trait WeightInfo {
|
||||
pub struct TestWeightInfo;
|
||||
impl WeightInfo for TestWeightInfo {
|
||||
fn new_auction() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn bid() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn cancel_auction() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn on_initialize() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,19 +55,19 @@ pub trait WeightInfo {
|
||||
pub struct TestWeightInfo;
|
||||
impl WeightInfo for TestWeightInfo {
|
||||
fn claim() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn mint_claim() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn claim_attest() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn attest() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn move_claim() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ pub mod crowdloan_index_migration {
|
||||
/// This migration converts crowdloans to use a crowdloan index rather than the parachain id as a
|
||||
/// unique identifier. This makes it easier to swap two crowdloans between parachains.
|
||||
pub fn migrate<T: Config>() -> frame_support::weights::Weight {
|
||||
let mut weight = 0;
|
||||
let mut weight = Weight::new();
|
||||
|
||||
// First migrate `NextTrieIndex` counter to `NextFundIndex`.
|
||||
|
||||
|
||||
@@ -106,31 +106,31 @@ pub trait WeightInfo {
|
||||
pub struct TestWeightInfo;
|
||||
impl WeightInfo for TestWeightInfo {
|
||||
fn create() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn contribute() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn withdraw() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn refund(_k: u32) -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn dissolve() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn edit() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn add_memo() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn on_initialize(_n: u32) -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn poke() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,12 @@ where
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use frame_support::{parameter_types, traits::FindAuthor, weights::DispatchClass, PalletId};
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
traits::FindAuthor,
|
||||
weights::{DispatchClass, Weight},
|
||||
PalletId,
|
||||
};
|
||||
use frame_system::limits;
|
||||
use primitives::v2::AccountId;
|
||||
use sp_core::H256;
|
||||
@@ -90,12 +95,12 @@ mod tests {
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: u64 = 250;
|
||||
pub BlockWeights: limits::BlockWeights = limits::BlockWeights::builder()
|
||||
.base_block(10)
|
||||
.base_block(Weight::from_ref_time(10))
|
||||
.for_class(DispatchClass::all(), |weight| {
|
||||
weight.base_extrinsic = 100;
|
||||
weight.base_extrinsic = Weight::from_ref_time(100);
|
||||
})
|
||||
.for_class(DispatchClass::non_mandatory(), |weight| {
|
||||
weight.max_total = Some(1024);
|
||||
weight.max_total = Some(Weight::from_ref_time(1024));
|
||||
})
|
||||
.build_or_panic();
|
||||
pub BlockLength: limits::BlockLength = limits::BlockLength::max(2 * 1024);
|
||||
|
||||
@@ -25,6 +25,7 @@ use crate::{
|
||||
use frame_support::{
|
||||
assert_noop, assert_ok, parameter_types,
|
||||
traits::{Currency, GenesisBuild, KeyOwnerProofSystem, OnFinalize, OnInitialize},
|
||||
weights::Weight,
|
||||
PalletId,
|
||||
};
|
||||
use frame_support_test::TestRandomness;
|
||||
@@ -103,7 +104,7 @@ use crate::{auctions::Error as AuctionsError, crowdloan::Error as CrowdloanError
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: u32 = 250;
|
||||
pub BlockWeights: frame_system::limits::BlockWeights =
|
||||
frame_system::limits::BlockWeights::simple_max(4 * 1024 * 1024);
|
||||
frame_system::limits::BlockWeights::simple_max(Weight::from_ref_time(4 * 1024 * 1024));
|
||||
}
|
||||
|
||||
impl frame_system::Config for Test {
|
||||
|
||||
@@ -69,7 +69,7 @@ pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(1);
|
||||
/// by Operational extrinsics.
|
||||
pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
||||
/// We allow for 2 seconds of compute with a 6 second average block time.
|
||||
pub const MAXIMUM_BLOCK_WEIGHT: Weight = 2 * WEIGHT_PER_SECOND;
|
||||
pub const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.scalar_saturating_mul(2);
|
||||
|
||||
const_assert!(NORMAL_DISPATCH_RATIO.deconstruct() >= AVERAGE_ON_INITIALIZE_RATIO.deconstruct());
|
||||
|
||||
|
||||
@@ -224,10 +224,10 @@ impl frame_support::traits::EstimateNextSessionRotation<u32> for TestNextSession
|
||||
}
|
||||
|
||||
fn estimate_current_session_progress(_now: u32) -> (Option<Permill>, Weight) {
|
||||
(None, 0)
|
||||
(None, Weight::zero())
|
||||
}
|
||||
|
||||
fn estimate_next_session_rotation(_now: u32) -> (Option<u32>, Weight) {
|
||||
(None, 0)
|
||||
(None, Weight::zero())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,19 +65,19 @@ pub trait WeightInfo {
|
||||
pub struct TestWeightInfo;
|
||||
impl WeightInfo for TestWeightInfo {
|
||||
fn reserve() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn register() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn force_register() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn deregister() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn swap() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -641,7 +641,7 @@ mod tests {
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: u32 = 250;
|
||||
pub BlockWeights: limits::BlockWeights =
|
||||
frame_system::limits::BlockWeights::simple_max(1024);
|
||||
frame_system::limits::BlockWeights::simple_max(Weight::from_ref_time(1024));
|
||||
pub BlockLength: limits::BlockLength =
|
||||
limits::BlockLength::max_with_normal_ratio(4 * 1024 * 1024, NORMAL_RATIO);
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ pub mod pallet {
|
||||
/// We check that the account does not exist at this stage.
|
||||
///
|
||||
/// Origin must match the `ValidityOrigin`.
|
||||
#[pallet::weight(200_000_000 + T::DbWeight::get().reads_writes(4, 1))]
|
||||
#[pallet::weight(Weight::from_ref_time(200_000_000) + T::DbWeight::get().reads_writes(4, 1))]
|
||||
pub fn create_account(
|
||||
origin: OriginFor<T>,
|
||||
who: T::AccountId,
|
||||
|
||||
@@ -51,7 +51,7 @@ pub mod slots_crowdloan_index_migration {
|
||||
}
|
||||
|
||||
pub fn migrate<T: Config + crowdloan::Config>() -> frame_support::weights::Weight {
|
||||
let mut weight = 0;
|
||||
let mut weight = Weight::new();
|
||||
|
||||
for (para_id, mut leases) in Leases::<T>::iter() {
|
||||
weight = weight.saturating_add(T::DbWeight::get().reads(2));
|
||||
|
||||
@@ -49,16 +49,16 @@ pub trait WeightInfo {
|
||||
pub struct TestWeightInfo;
|
||||
impl WeightInfo for TestWeightInfo {
|
||||
fn force_lease() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn manage_lease_period_start(_c: u32, _t: u32) -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn clear_all_leases() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
fn trigger_onboard() -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
// We didn't return early above, so we didn't do anything.
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user