Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,144 changes: 629 additions & 515 deletions Cargo.lock

Large diffs are not rendered by default.

441 changes: 221 additions & 220 deletions Cargo.toml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions crates/collator-selection/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ benchmarks! {
set_invulnerables {
let b in 1 .. T::MaxInvulnerables::get();
let new_invulnerables = register_validators::<T>(b);
let origin = T::UpdateOrigin::successful_origin();
let origin = T::UpdateOrigin::try_successful_origin().unwrap();
}: {
assert_ok!(
<CollatorSelection<T>>::set_invulnerables(origin, new_invulnerables.clone())
Expand All @@ -115,7 +115,7 @@ benchmarks! {

set_desired_candidates {
let max: u32 = 999;
let origin = T::UpdateOrigin::successful_origin();
let origin = T::UpdateOrigin::try_successful_origin().unwrap();
}: {
assert_ok!(
<CollatorSelection<T>>::set_desired_candidates(origin, max.clone())
Expand All @@ -127,7 +127,7 @@ benchmarks! {

set_candidacy_bond {
let bond_amount: BalanceOf<T> = T::StakingCurrency::minimum_balance() * 10u32.into();
let origin = T::UpdateOrigin::successful_origin();
let origin = T::UpdateOrigin::try_successful_origin().unwrap();
}: {
assert_ok!(
<CollatorSelection<T>>::set_candidacy_bond(origin, bond_amount.clone())
Expand Down
4 changes: 0 additions & 4 deletions crates/collator-selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,10 +489,6 @@ pub mod pallet {
DispatchClass::Mandatory,
);
}

fn note_uncle(_author: T::AccountId, _age: T::BlockNumber) {
//TODO can we ignore this?
}
}

/// Play the role of the session manager.
Expand Down
4 changes: 1 addition & 3 deletions crates/collator-selection/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ frame_support::construct_runtime!(
Aura: pallet_aura::{Pallet, Storage, Config<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
CollatorSelection: collator_selection::{Pallet, Call, Storage, Event<T>},
Authorship: pallet_authorship::{Pallet, Call, Storage, Inherent},
Authorship: pallet_authorship::{Pallet, Storage},
}
);

Expand Down Expand Up @@ -110,8 +110,6 @@ impl FindAuthor<u64> for Author4 {

impl pallet_authorship::Config for Test {
type FindAuthor = Author4;
type UncleGenerations = ();
type FilterUncle = ();
type EventHandler = CollatorSelection;
}

Expand Down
2 changes: 1 addition & 1 deletion crates/democracy/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ benchmarks! {
}

fast_track {
let origin_fast_track = T::FastTrackOrigin::successful_origin();
let origin_fast_track = T::FastTrackOrigin::try_successful_origin().unwrap();
let proposal_hash = add_proposal::<T>(0)?;
let prop_index = PublicProps::<T>::get()
.iter()
Expand Down
6 changes: 3 additions & 3 deletions crates/tx-pause/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ benchmarks! {
let full_name: FullNameOf<T> = (name::<T>(b"SomePalletName"), Some(name::<T>(b"SomePalletName")));
// let pallet_name: PalletNameOf<T> = name::<T>(b"SomePalletName");
// let maybe_call_name: Option<CallNameOf<T>> = Some(name::<T>(b"some_call_name"));
let origin = T::PauseOrigin::successful_origin();
let origin = T::PauseOrigin::try_successful_origin().unwrap();
// let call = Call::<T>::pause { full_name: full_name.clone() };
// let call = Call::<T>::pause { pallet_name: pallet_name.clone(), maybe_call_name: maybe_call_name.clone() };

Expand All @@ -37,14 +37,14 @@ benchmarks! {

unpause {
let full_name: FullNameOf<T> = (name::<T>(b"SomePalletName"), Some(name::<T>(b"SomePalletName")));
let pause_origin = T::PauseOrigin::successful_origin();
let pause_origin = T::PauseOrigin::try_successful_origin().unwrap();

TxPause::<T>::pause(
pause_origin,
full_name.clone(),
)?;

let unpause_origin = T::UnpauseOrigin::successful_origin();
let unpause_origin = T::UnpauseOrigin::try_successful_origin().unwrap();
// let call = Call::<T>::unpause { pallet_name: pallet_name.clone(), maybe_call_name: maybe_call_name.clone() };

}: _<T::RuntimeOrigin>(unpause_origin, full_name.clone())
Expand Down
22 changes: 10 additions & 12 deletions parachain/runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub type AccountId<T> = <T as frame_system::Config>::AccountId;
pub type VaultId<T> = primitives::VaultId<AccountId<T>, currency::CurrencyId<T>>;
pub use currency::CurrencyId;
use primitives::{Balance, Nonce};
use xcm::{latest::MultiLocation, v2::Instruction};
use xcm::latest::{Instruction, MultiLocation, Weight};
use xcm_executor::traits::ShouldExecute;

fn native_currency_id<T: currency::Config>() -> CurrencyId<T> {
Expand Down Expand Up @@ -65,12 +65,12 @@ pub struct AndBarrier<T: ShouldExecute, U: ShouldExecute>(PhantomData<(T, U)>);
impl<T: ShouldExecute, U: ShouldExecute> ShouldExecute for AndBarrier<T, U> {
fn should_execute<Call>(
origin: &MultiLocation,
message: &mut xcm::v2::Xcm<Call>,
max_weight: u64,
weight_credit: &mut u64,
instructions: &mut [Instruction<Call>],
max_weight: Weight,
weight_credit: &mut Weight,
) -> Result<(), ()> {
T::should_execute(origin, message, max_weight, weight_credit)?;
U::should_execute(origin, message, max_weight, weight_credit)?;
T::should_execute(origin, instructions, max_weight, weight_credit)?;
U::should_execute(origin, instructions, max_weight, weight_credit)?;
// only if both returned ok, we return ok
Ok(())
}
Expand All @@ -81,19 +81,17 @@ pub struct Transactless<T: ShouldExecute>(PhantomData<T>);
impl<T: ShouldExecute> ShouldExecute for Transactless<T> {
fn should_execute<Call>(
origin: &MultiLocation,
message: &mut xcm::v2::Xcm<Call>,
max_weight: u64,
weight_credit: &mut u64,
instructions: &mut [Instruction<Call>],
max_weight: Weight,
weight_credit: &mut Weight,
) -> Result<(), ()> {
let xcm::v2::Xcm(ref instructions) = message;

// filter any outer-level Transacts. Any Transact calls sent to other chain should still work.
let has_transact = instructions.iter().any(|x| matches!(x, Instruction::Transact { .. }));
if has_transact {
return Err(());
}
// No transact - return result of the wrapped barrier
T::should_execute(origin, message, max_weight, weight_credit)
T::should_execute(origin, instructions, max_weight, weight_credit)
}
}

Expand Down
31 changes: 17 additions & 14 deletions parachain/runtime/interlay/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for 0.5 seconds of compute with a 12 second average block time.
pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64,
cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64,
);

parameter_types! {
Expand Down Expand Up @@ -169,7 +169,6 @@ impl Contains<RuntimeCall> for BaseCallFilter {
if matches!(
call,
RuntimeCall::System(_)
| RuntimeCall::Authorship(_)
| RuntimeCall::Session(_)
| RuntimeCall::Timestamp(_)
| RuntimeCall::ParachainSystem(_)
Expand Down Expand Up @@ -232,14 +231,8 @@ impl frame_system::Config for Runtime {
type MaxConsumers = frame_support::traits::ConstU32<16>;
}

parameter_types! {
pub const UncleGenerations: u32 = 0;
}

impl pallet_authorship::Config for Runtime {
type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Aura>;
type UncleGenerations = UncleGenerations;
type FilterUncle = ();
type EventHandler = (CollatorSelection,);
}

Expand Down Expand Up @@ -413,8 +406,8 @@ impl EnsureOrigin<RuntimeOrigin> for EnsureKintsugiLabs {
}

#[cfg(feature = "runtime-benchmarks")]
fn successful_origin() -> RuntimeOrigin {
RuntimeOrigin::from(RawOrigin::None)
fn try_successful_origin() -> Result<RuntimeOrigin, ()> {
Ok(RuntimeOrigin::from(RawOrigin::None))
}
}

Expand Down Expand Up @@ -700,8 +693,8 @@ impl EnsureOriginWithArg<RuntimeOrigin, Option<u32>> for AssetAuthority {
}

#[cfg(feature = "runtime-benchmarks")]
fn successful_origin(_asset_id: &Option<u32>) -> RuntimeOrigin {
EnsureRoot::successful_origin()
fn try_successful_origin(_: &Option<u32>) -> Result<RuntimeOrigin, ()> {
EnsureRoot::try_successful_origin()
}
}

Expand Down Expand Up @@ -1190,7 +1183,7 @@ construct_runtime! {
TechnicalMembership: pallet_membership::{Pallet, Call, Storage, Event<T>, Config<T>} = 72,
// Treasury: 73

Authorship: pallet_authorship::{Pallet, Call, Storage} = 80,
Authorship: pallet_authorship::{Pallet, Storage} = 80,
CollatorSelection: collator_selection::{Pallet, Call, Storage, Event<T>, Config<T>} = 81,
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 82,
Aura: pallet_aura::{Pallet, Storage, Config<T>} = 83,
Expand Down Expand Up @@ -1249,10 +1242,12 @@ pub type Executive = frame_executive::Executive<
>,
democracy::migrations::v1::Migration<Runtime>,
SudoMigrationCheck,
orml_asset_registry::Migration<Runtime>,
orml_unknown_tokens::Migration<Runtime>,
),
>;

struct SudoMigrationCheck;
pub struct SudoMigrationCheck;

impl OnRuntimeUpgrade for SudoMigrationCheck {
fn on_runtime_upgrade() -> Weight {
Expand Down Expand Up @@ -1378,6 +1373,14 @@ impl_runtime_apis! {
) -> pallet_transaction_payment_rpc_runtime_api::FeeDetails<Balance> {
TransactionPayment::query_fee_details(uxt, len)
}

fn query_weight_to_fee(weight: Weight) -> Balance {
TransactionPayment::weight_to_fee(weight)
}

fn query_length_to_fee(length: u32) -> Balance {
TransactionPayment::length_to_fee(length)
}
}

impl loans_rpc_runtime_api::LoansApi<
Expand Down
Loading