bump deps, fix aura-ext pallet, and fill in stubs for XCM (#600)

* 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>
This commit is contained in:
Robert Habermeier
2021-09-04 14:57:48 -05:00
committed by GitHub
parent d260b0e14f
commit cdbd4c12af
10 changed files with 386 additions and 457 deletions
+337 -446
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -404,7 +404,7 @@ mod tests {
let (sub_tx, sub_rx) = mpsc::channel(64); let (sub_tx, sub_rx) = mpsc::channel(64);
let all_subsystems = let all_subsystems =
AllSubsystems::<()>::dummy().replace_collation_generation(ForwardSubsystem(sub_tx)); AllSubsystems::<()>::dummy().replace_collation_generation(|_| ForwardSubsystem(sub_tx));
let (overseer, handle) = Overseer::new( let (overseer, handle) = Overseer::new(
Vec::new(), Vec::new(),
all_subsystems, all_subsystems,
+2 -2
View File
@@ -62,7 +62,7 @@ pub mod pallet {
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> { impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_finalize(_: BlockNumberFor<T>) { fn on_finalize(_: BlockNumberFor<T>) {
// Update to the latest AuRa authorities. // 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 { fn on_initialize(_: BlockNumberFor<T>) -> Weight {
@@ -98,7 +98,7 @@ pub mod pallet {
"AuRa authorities empty, maybe wrong order in `construct_runtime!`?", "AuRa authorities empty, maybe wrong order in `construct_runtime!`?",
); );
Authorities::<T>::put(authorities); Authorities::<T>::put(authorities.into_inner());
} }
} }
} }
@@ -126,6 +126,7 @@ impl pallet_timestamp::Config for Test {
impl pallet_aura::Config for Test { impl pallet_aura::Config for Test {
type AuthorityId = sp_consensus_aura::sr25519::AuthorityId; type AuthorityId = sp_consensus_aura::sr25519::AuthorityId;
type MaxAuthorities = MaxAuthorities;
type DisabledValidators = (); type DisabledValidators = ();
} }
@@ -190,6 +191,7 @@ parameter_types! {
pub const MaxCandidates: u32 = 20; pub const MaxCandidates: u32 = 20;
pub const MaxInvulnerables: u32 = 20; pub const MaxInvulnerables: u32 = 20;
pub const MinCandidates: u32 = 1; pub const MinCandidates: u32 = 1;
pub const MaxAuthorities: u32 = 100_000;
} }
pub struct IsRegistered; pub struct IsRegistered;
+3
View File
@@ -142,6 +142,9 @@ impl xcm_executor::Config for XcmConfig {
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>; type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
type Trader = (); type Trader = ();
type ResponseHandler = (); type ResponseHandler = ();
type AssetTrap = ();
type AssetClaims = ();
type SubscriptionService = ();
} }
pub type XcmRouter = ( pub type XcmRouter = (
@@ -348,7 +348,10 @@ impl Config for XcmConfig {
type Barrier = Barrier; type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>; type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
type Trader = UsingComponents<IdentityFee<Balance>, RocLocation, AccountId, Balances, ()>; 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. /// No local origins on this chain are allowed to dispatch XCM sends/executions.
@@ -376,6 +379,8 @@ impl pallet_xcm::Config for Runtime {
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin; type Origin = Origin;
type Call = Call; type Call = Call;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
} }
impl cumulus_pallet_xcm::Config for Runtime { impl cumulus_pallet_xcm::Config for Runtime {
@@ -410,6 +415,7 @@ parameter_types! {
pub const MetadataDepositBase: Balance = 1 * ROC; pub const MetadataDepositBase: Balance = 1 * ROC;
pub const MetadataDepositPerByte: Balance = 10 * MILLIROC; pub const MetadataDepositPerByte: Balance = 10 * MILLIROC;
pub const UnitBody: BodyId = BodyId::Unit; 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. /// A majority of the Unit body from Rococo over XCM is our required administration origin.
@@ -434,6 +440,7 @@ impl pallet_assets::Config for Runtime {
impl pallet_aura::Config for Runtime { impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId; type AuthorityId = AuraId;
type DisabledValidators = (); type DisabledValidators = ();
type MaxAuthorities = MaxAuthorities;
} }
construct_runtime! { construct_runtime! {
@@ -589,7 +596,7 @@ impl_runtime_apis! {
} }
fn authorities() -> Vec<AuraId> { fn authorities() -> Vec<AuraId> {
Aura::authorities() Aura::authorities().into_inner()
} }
} }
@@ -213,6 +213,9 @@ impl Config for XcmConfig {
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>; // balances not supported type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>; // balances not supported
type Trader = (); // balances not supported type Trader = (); // balances not supported
type ResponseHandler = (); // Don't handle responses for now. 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 { impl cumulus_pallet_xcm::Config for Runtime {
@@ -542,7 +542,10 @@ impl Config for XcmConfig {
type Barrier = Barrier; type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>; type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
type Trader = UsingComponents<IdentityFee<Balance>, KsmLocation, AccountId, Balances, ()>; 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! { parameter_types! {
@@ -574,6 +577,9 @@ impl pallet_xcm::Config for Runtime {
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin; type Origin = Origin;
type Call = Call; type Call = Call;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
} }
impl cumulus_pallet_xcm::Config for Runtime { impl cumulus_pallet_xcm::Config for Runtime {
@@ -598,6 +604,7 @@ parameter_types! {
pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(33); pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(33);
pub const Period: u32 = 6 * HOURS; pub const Period: u32 = 6 * HOURS;
pub const Offset: u32 = 0; pub const Offset: u32 = 0;
pub const MaxAuthorities: u32 = 100_000;
} }
impl pallet_session::Config for Runtime { impl pallet_session::Config for Runtime {
@@ -618,6 +625,7 @@ impl pallet_session::Config for Runtime {
impl pallet_aura::Config for Runtime { impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId; type AuthorityId = AuraId;
type DisabledValidators = (); type DisabledValidators = ();
type MaxAuthorities = MaxAuthorities;
} }
parameter_types! { parameter_types! {
@@ -743,7 +751,7 @@ impl_runtime_apis! {
} }
fn authorities() -> Vec<AuraId> { fn authorities() -> Vec<AuraId> {
Aura::authorities() Aura::authorities().into_inner()
} }
} }
@@ -507,7 +507,10 @@ impl Config for XcmConfig {
type Barrier = Barrier; type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>; type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
type Trader = UsingComponents<IdentityFee<Balance>, DotLocation, AccountId, Balances, ()>; 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! { parameter_types! {
@@ -539,6 +542,8 @@ impl pallet_xcm::Config for Runtime {
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin; type Origin = Origin;
type Call = Call; type Call = Call;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
} }
impl cumulus_pallet_xcm::Config for Runtime { impl cumulus_pallet_xcm::Config for Runtime {
@@ -563,6 +568,7 @@ parameter_types! {
pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(33); pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(33);
pub const Period: u32 = 6 * HOURS; pub const Period: u32 = 6 * HOURS;
pub const Offset: u32 = 0; pub const Offset: u32 = 0;
pub const MaxAuthorities: u32 = 100_000;
} }
impl pallet_session::Config for Runtime { impl pallet_session::Config for Runtime {
@@ -583,6 +589,7 @@ impl pallet_session::Config for Runtime {
impl pallet_aura::Config for Runtime { impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId; type AuthorityId = AuraId;
type DisabledValidators = (); type DisabledValidators = ();
type MaxAuthorities = MaxAuthorities;
} }
parameter_types! { parameter_types! {
@@ -726,7 +733,7 @@ impl_runtime_apis! {
} }
fn authorities() -> Vec<AuraId> { fn authorities() -> Vec<AuraId> {
Aura::authorities() Aura::authorities().into_inner()
} }
} }
@@ -505,7 +505,10 @@ impl Config for XcmConfig {
type Barrier = Barrier; type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>; type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
type Trader = UsingComponents<IdentityFee<Balance>, WestendLocation, AccountId, Balances, ()>; 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! { parameter_types! {
@@ -537,6 +540,9 @@ impl pallet_xcm::Config for Runtime {
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin; type Origin = Origin;
type Call = Call; type Call = Call;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
} }
impl cumulus_pallet_xcm::Config for Runtime { impl cumulus_pallet_xcm::Config for Runtime {
@@ -561,6 +567,7 @@ parameter_types! {
pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(33); pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(33);
pub const Period: u32 = 6 * HOURS; pub const Period: u32 = 6 * HOURS;
pub const Offset: u32 = 0; pub const Offset: u32 = 0;
pub const MaxAuthorities: u32 = 100_000;
} }
impl pallet_session::Config for Runtime { impl pallet_session::Config for Runtime {
@@ -581,6 +588,7 @@ impl pallet_session::Config for Runtime {
impl pallet_aura::Config for Runtime { impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId; type AuthorityId = AuraId;
type DisabledValidators = (); type DisabledValidators = ();
type MaxAuthorities = MaxAuthorities;
} }
parameter_types! { parameter_types! {
@@ -728,7 +736,7 @@ impl_runtime_apis! {
} }
fn authorities() -> Vec<AuraId> { fn authorities() -> Vec<AuraId> {
Aura::authorities() Aura::authorities().into_inner()
} }
} }