mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 00:28:01 +00:00
cargo +nightly fmt (#3540)
* cargo +nightly fmt * add cargo-fmt check to ci * update ci * fmt * fmt * skip macro * ignore bridges
This commit is contained in:
@@ -18,47 +18,52 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
pub mod claims;
|
||||
pub mod slots;
|
||||
pub mod auctions;
|
||||
pub mod claims;
|
||||
pub mod crowdloan;
|
||||
pub mod purchase;
|
||||
pub mod elections;
|
||||
pub mod impls;
|
||||
pub mod paras_sudo_wrapper;
|
||||
pub mod paras_registrar;
|
||||
pub mod paras_sudo_wrapper;
|
||||
pub mod purchase;
|
||||
pub mod slot_range;
|
||||
pub mod slots;
|
||||
pub mod traits;
|
||||
pub mod xcm_sender;
|
||||
pub mod elections;
|
||||
|
||||
#[cfg(test)]
|
||||
mod mock;
|
||||
#[cfg(test)]
|
||||
mod integration_tests;
|
||||
#[cfg(test)]
|
||||
mod mock;
|
||||
|
||||
use primitives::v1::{AssignmentId, BlockNumber, ValidatorId};
|
||||
use sp_runtime::{Perquintill, Perbill, FixedPointNumber};
|
||||
use frame_system::limits;
|
||||
use frame_support::{
|
||||
parameter_types, traits::{Currency, OneSessionHandler},
|
||||
weights::{Weight, constants::WEIGHT_PER_SECOND, DispatchClass},
|
||||
pub use frame_support::weights::constants::{
|
||||
BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight,
|
||||
};
|
||||
use pallet_transaction_payment::{TargetedFeeAdjustment, Multiplier};
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
traits::{Currency, OneSessionHandler},
|
||||
weights::{constants::WEIGHT_PER_SECOND, DispatchClass, Weight},
|
||||
};
|
||||
use frame_system::limits;
|
||||
use pallet_transaction_payment::{Multiplier, TargetedFeeAdjustment};
|
||||
use primitives::v1::{AssignmentId, BlockNumber, ValidatorId};
|
||||
use sp_runtime::{FixedPointNumber, Perbill, Perquintill};
|
||||
use static_assertions::const_assert;
|
||||
pub use frame_support::weights::constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
|
||||
|
||||
pub use elections::{OffchainSolutionLengthLimit, OffchainSolutionWeightLimit};
|
||||
pub use pallet_balances::Call as BalancesCall;
|
||||
#[cfg(feature = "std")]
|
||||
pub use pallet_staking::StakerStatus;
|
||||
pub use pallet_timestamp::Call as TimestampCall;
|
||||
#[cfg(any(feature = "std", test))]
|
||||
pub use sp_runtime::BuildStorage;
|
||||
pub use pallet_timestamp::Call as TimestampCall;
|
||||
pub use pallet_balances::Call as BalancesCall;
|
||||
pub use elections::{OffchainSolutionLengthLimit, OffchainSolutionWeightLimit};
|
||||
|
||||
/// Implementations of some helper traits passed into runtime modules as associated types.
|
||||
pub use impls::ToAuthor;
|
||||
|
||||
pub type NegativeImbalance<T> = <pallet_balances::Pallet<T> as Currency<<T as frame_system::Config>::AccountId>>::NegativeImbalance;
|
||||
pub type NegativeImbalance<T> = <pallet_balances::Pallet<T> as Currency<
|
||||
<T as frame_system::Config>::AccountId,
|
||||
>>::NegativeImbalance;
|
||||
|
||||
/// We assume that an on-initialize consumes 1% of the weight on average, hence a single extrinsic
|
||||
/// will not be allowed to consume more than `AvailableBlockRatio - 1%`.
|
||||
@@ -110,12 +115,8 @@ parameter_types! {
|
||||
|
||||
/// Parameterized slow adjusting fee updated based on
|
||||
/// https://w3f-research.readthedocs.io/en/latest/polkadot/Token%20Economics.html#-2.-slow-adjusting-mechanism
|
||||
pub type SlowAdjustingFeeUpdate<R> = TargetedFeeAdjustment<
|
||||
R,
|
||||
TargetBlockFullness,
|
||||
AdjustmentVariable,
|
||||
MinimumMultiplier
|
||||
>;
|
||||
pub type SlowAdjustingFeeUpdate<R> =
|
||||
TargetedFeeAdjustment<R, TargetBlockFullness, AdjustmentVariable, MinimumMultiplier>;
|
||||
|
||||
/// The type used for currency conversion.
|
||||
///
|
||||
@@ -130,25 +131,26 @@ impl<T> sp_runtime::BoundToRuntimeAppPublic for ParachainSessionKeyPlaceholder<T
|
||||
type Public = ValidatorId;
|
||||
}
|
||||
|
||||
impl<T: pallet_session::Config> OneSessionHandler<T::AccountId> for ParachainSessionKeyPlaceholder<T>
|
||||
impl<T: pallet_session::Config> OneSessionHandler<T::AccountId>
|
||||
for ParachainSessionKeyPlaceholder<T>
|
||||
{
|
||||
type Key = ValidatorId;
|
||||
|
||||
fn on_genesis_session<'a, I: 'a>(_validators: I) where
|
||||
fn on_genesis_session<'a, I: 'a>(_validators: I)
|
||||
where
|
||||
I: Iterator<Item = (&'a T::AccountId, ValidatorId)>,
|
||||
T::AccountId: 'a
|
||||
T::AccountId: 'a,
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
fn on_new_session<'a, I: 'a>(_changed: bool, _v: I, _q: I) where
|
||||
fn on_new_session<'a, I: 'a>(_changed: bool, _v: I, _q: I)
|
||||
where
|
||||
I: Iterator<Item = (&'a T::AccountId, ValidatorId)>,
|
||||
T::AccountId: 'a
|
||||
T::AccountId: 'a,
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
fn on_disabled(_: usize) { }
|
||||
fn on_disabled(_: usize) {}
|
||||
}
|
||||
|
||||
/// A placeholder since there is currently no provided session key handler for parachain validator
|
||||
@@ -158,25 +160,26 @@ impl<T> sp_runtime::BoundToRuntimeAppPublic for AssignmentSessionKeyPlaceholder<
|
||||
type Public = AssignmentId;
|
||||
}
|
||||
|
||||
impl<T: pallet_session::Config> OneSessionHandler<T::AccountId> for AssignmentSessionKeyPlaceholder<T>
|
||||
impl<T: pallet_session::Config> OneSessionHandler<T::AccountId>
|
||||
for AssignmentSessionKeyPlaceholder<T>
|
||||
{
|
||||
type Key = AssignmentId;
|
||||
|
||||
fn on_genesis_session<'a, I: 'a>(_validators: I) where
|
||||
fn on_genesis_session<'a, I: 'a>(_validators: I)
|
||||
where
|
||||
I: Iterator<Item = (&'a T::AccountId, AssignmentId)>,
|
||||
T::AccountId: 'a
|
||||
T::AccountId: 'a,
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
fn on_new_session<'a, I: 'a>(_changed: bool, _v: I, _q: I) where
|
||||
fn on_new_session<'a, I: 'a>(_changed: bool, _v: I, _q: I)
|
||||
where
|
||||
I: Iterator<Item = (&'a T::AccountId, AssignmentId)>,
|
||||
T::AccountId: 'a
|
||||
T::AccountId: 'a,
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
fn on_disabled(_: usize) { }
|
||||
fn on_disabled(_: usize) {}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -186,7 +189,7 @@ mod multiplier_tests {
|
||||
use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup, Convert, One},
|
||||
traits::{BlakeTwo256, Convert, IdentityLookup, One},
|
||||
Perbill,
|
||||
};
|
||||
|
||||
@@ -238,9 +241,14 @@ mod multiplier_tests {
|
||||
type OnSetCode = ();
|
||||
}
|
||||
|
||||
fn run_with_system_weight<F>(w: Weight, mut assertions: F) where F: FnMut() -> () {
|
||||
let mut t: sp_io::TestExternalities =
|
||||
frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap().into();
|
||||
fn run_with_system_weight<F>(w: Weight, mut assertions: F)
|
||||
where
|
||||
F: FnMut() -> (),
|
||||
{
|
||||
let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default()
|
||||
.build_storage::<Runtime>()
|
||||
.unwrap()
|
||||
.into();
|
||||
t.execute_with(|| {
|
||||
System::set_block_consumed_resources(w, 0);
|
||||
assertions()
|
||||
@@ -266,9 +274,9 @@ mod multiplier_tests {
|
||||
// assume the multiplier is initially set to its minimum. We update it with values twice the
|
||||
//target (target is 25%, thus 50%) and we see at which point it reaches 1.
|
||||
let mut multiplier = MinimumMultiplier::get();
|
||||
let block_weight = TargetBlockFullness::get()
|
||||
* BlockWeights::get().get(DispatchClass::Normal).max_total.unwrap()
|
||||
* 2;
|
||||
let block_weight = TargetBlockFullness::get() *
|
||||
BlockWeights::get().get(DispatchClass::Normal).max_total.unwrap() *
|
||||
2;
|
||||
let mut blocks = 0;
|
||||
while multiplier <= Multiplier::one() {
|
||||
run_with_system_weight(block_weight, || {
|
||||
|
||||
Reference in New Issue
Block a user