Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
bump deps, fix aura-ext pallet, and fill in stubs for XCM (#600)
Browse files Browse the repository at this point in the history
* bump deps, fix aura-ext pallet, and fill in stubs for XCM

* response handler, asset trap, asset claims

* subscription_service

* update xcmp-queue mock

* fix tests

* Update polkadot deps

Co-authored-by: Andronik Ordian <write@reusable.software>
Co-authored-by: Bastian Köcher <info@kchr.de>
  • Loading branch information
3 people committed Sep 4, 2021
1 parent bf4024f commit 6c8f1f7
Show file tree
Hide file tree
Showing 10 changed files with 386 additions and 457 deletions.
783 changes: 337 additions & 446 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/collator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ mod tests {
let (sub_tx, sub_rx) = mpsc::channel(64);

let all_subsystems =
AllSubsystems::<()>::dummy().replace_collation_generation(ForwardSubsystem(sub_tx));
AllSubsystems::<()>::dummy().replace_collation_generation(|_| ForwardSubsystem(sub_tx));
let (overseer, handle) = Overseer::new(
Vec::new(),
all_subsystems,
Expand Down
4 changes: 2 additions & 2 deletions pallets/aura-ext/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub mod pallet {
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_finalize(_: BlockNumberFor<T>) {
// Update to the latest AuRa authorities.
Authorities::<T>::put(Aura::<T>::authorities());
Authorities::<T>::put(Aura::<T>::authorities().into_inner());
}

fn on_initialize(_: BlockNumberFor<T>) -> Weight {
Expand Down Expand Up @@ -98,7 +98,7 @@ pub mod pallet {
"AuRa authorities empty, maybe wrong order in `construct_runtime!`?",
);

Authorities::<T>::put(authorities);
Authorities::<T>::put(authorities.into_inner());
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions pallets/collator-selection/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ impl pallet_timestamp::Config for Test {

impl pallet_aura::Config for Test {
type AuthorityId = sp_consensus_aura::sr25519::AuthorityId;
type MaxAuthorities = MaxAuthorities;
type DisabledValidators = ();
}

Expand Down Expand Up @@ -190,6 +191,7 @@ parameter_types! {
pub const MaxCandidates: u32 = 20;
pub const MaxInvulnerables: u32 = 20;
pub const MinCandidates: u32 = 1;
pub const MaxAuthorities: u32 = 100_000;
}

pub struct IsRegistered;
Expand Down
3 changes: 3 additions & 0 deletions pallets/xcmp-queue/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ impl xcm_executor::Config for XcmConfig {
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
type Trader = ();
type ResponseHandler = ();
type AssetTrap = ();
type AssetClaims = ();
type SubscriptionService = ();
}

pub type XcmRouter = (
Expand Down
11 changes: 9 additions & 2 deletions polkadot-parachains/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,10 @@ impl Config for XcmConfig {
type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
type Trader = UsingComponents<IdentityFee<Balance>, RocLocation, AccountId, Balances, ()>;
type ResponseHandler = (); // Don't handle responses for now.
type ResponseHandler = PolkadotXcm;
type AssetTrap = PolkadotXcm;
type AssetClaims = PolkadotXcm;
type SubscriptionService = PolkadotXcm;
}

/// No local origins on this chain are allowed to dispatch XCM sends/executions.
Expand Down Expand Up @@ -376,6 +379,8 @@ impl pallet_xcm::Config for Runtime {
type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin;
type Call = Call;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
}

impl cumulus_pallet_xcm::Config for Runtime {
Expand Down Expand Up @@ -410,6 +415,7 @@ parameter_types! {
pub const MetadataDepositBase: Balance = 1 * ROC;
pub const MetadataDepositPerByte: Balance = 10 * MILLIROC;
pub const UnitBody: BodyId = BodyId::Unit;
pub const MaxAuthorities: u32 = 100_000;
}

/// A majority of the Unit body from Rococo over XCM is our required administration origin.
Expand All @@ -434,6 +440,7 @@ impl pallet_assets::Config for Runtime {
impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId;
type DisabledValidators = ();
type MaxAuthorities = MaxAuthorities;
}

construct_runtime! {
Expand Down Expand Up @@ -589,7 +596,7 @@ impl_runtime_apis! {
}

fn authorities() -> Vec<AuraId> {
Aura::authorities()
Aura::authorities().into_inner()
}
}

Expand Down
3 changes: 3 additions & 0 deletions polkadot-parachains/shell/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ impl Config for XcmConfig {
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>; // balances not supported
type Trader = (); // balances not supported
type ResponseHandler = (); // Don't handle responses for now.
type AssetTrap = (); // don't trap for now
type AssetClaims = (); // don't claim for now
type SubscriptionService = (); // don't handle subscriptions for now
}

impl cumulus_pallet_xcm::Config for Runtime {
Expand Down
12 changes: 10 additions & 2 deletions polkadot-parachains/statemine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,10 @@ impl Config for XcmConfig {
type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
type Trader = UsingComponents<IdentityFee<Balance>, KsmLocation, AccountId, Balances, ()>;
type ResponseHandler = (); // Don't handle responses for now.
type ResponseHandler = PolkadotXcm;
type AssetTrap = PolkadotXcm;
type AssetClaims = PolkadotXcm;
type SubscriptionService = PolkadotXcm;
}

parameter_types! {
Expand Down Expand Up @@ -574,6 +577,9 @@ impl pallet_xcm::Config for Runtime {
type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin;
type Call = Call;

const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
}

impl cumulus_pallet_xcm::Config for Runtime {
Expand All @@ -598,6 +604,7 @@ parameter_types! {
pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(33);
pub const Period: u32 = 6 * HOURS;
pub const Offset: u32 = 0;
pub const MaxAuthorities: u32 = 100_000;
}

impl pallet_session::Config for Runtime {
Expand All @@ -618,6 +625,7 @@ impl pallet_session::Config for Runtime {
impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId;
type DisabledValidators = ();
type MaxAuthorities = MaxAuthorities;
}

parameter_types! {
Expand Down Expand Up @@ -743,7 +751,7 @@ impl_runtime_apis! {
}

fn authorities() -> Vec<AuraId> {
Aura::authorities()
Aura::authorities().into_inner()
}
}

Expand Down
11 changes: 9 additions & 2 deletions polkadot-parachains/statemint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,10 @@ impl Config for XcmConfig {
type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
type Trader = UsingComponents<IdentityFee<Balance>, DotLocation, AccountId, Balances, ()>;
type ResponseHandler = (); // Don't handle responses for now.
type ResponseHandler = PolkadotXcm;
type AssetTrap = PolkadotXcm;
type AssetClaims = PolkadotXcm;
type SubscriptionService = PolkadotXcm;
}

parameter_types! {
Expand Down Expand Up @@ -539,6 +542,8 @@ impl pallet_xcm::Config for Runtime {
type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin;
type Call = Call;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
}

impl cumulus_pallet_xcm::Config for Runtime {
Expand All @@ -563,6 +568,7 @@ parameter_types! {
pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(33);
pub const Period: u32 = 6 * HOURS;
pub const Offset: u32 = 0;
pub const MaxAuthorities: u32 = 100_000;
}

impl pallet_session::Config for Runtime {
Expand All @@ -583,6 +589,7 @@ impl pallet_session::Config for Runtime {
impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId;
type DisabledValidators = ();
type MaxAuthorities = MaxAuthorities;
}

parameter_types! {
Expand Down Expand Up @@ -726,7 +733,7 @@ impl_runtime_apis! {
}

fn authorities() -> Vec<AuraId> {
Aura::authorities()
Aura::authorities().into_inner()
}
}

Expand Down
12 changes: 10 additions & 2 deletions polkadot-parachains/westmint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,10 @@ impl Config for XcmConfig {
type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
type Trader = UsingComponents<IdentityFee<Balance>, WestendLocation, AccountId, Balances, ()>;
type ResponseHandler = (); // Don't handle responses for now.
type ResponseHandler = PolkadotXcm;
type AssetTrap = PolkadotXcm;
type AssetClaims = PolkadotXcm;
type SubscriptionService = PolkadotXcm;
}

parameter_types! {
Expand Down Expand Up @@ -537,6 +540,9 @@ impl pallet_xcm::Config for Runtime {
type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin;
type Call = Call;

const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
}

impl cumulus_pallet_xcm::Config for Runtime {
Expand All @@ -561,6 +567,7 @@ parameter_types! {
pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(33);
pub const Period: u32 = 6 * HOURS;
pub const Offset: u32 = 0;
pub const MaxAuthorities: u32 = 100_000;
}

impl pallet_session::Config for Runtime {
Expand All @@ -581,6 +588,7 @@ impl pallet_session::Config for Runtime {
impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId;
type DisabledValidators = ();
type MaxAuthorities = MaxAuthorities;
}

parameter_types! {
Expand Down Expand Up @@ -728,7 +736,7 @@ impl_runtime_apis! {
}

fn authorities() -> Vec<AuraId> {
Aura::authorities()
Aura::authorities().into_inner()
}
}

Expand Down

0 comments on commit 6c8f1f7

Please sign in to comment.