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

Companion for Substrate #13425 #6784

Merged
merged 5 commits into from
Mar 7, 2023
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
371 changes: 186 additions & 185 deletions Cargo.lock

Large diffs are not rendered by default.

16 changes: 4 additions & 12 deletions runtime/common/src/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use crate::{
};
use frame_support::{
assert_noop, assert_ok, parameter_types,
traits::{Currency, GenesisBuild, KeyOwnerProofSystem, OnFinalize, OnInitialize},
traits::{Currency, GenesisBuild, OnFinalize, OnInitialize},
weights::Weight,
PalletId,
};
Expand All @@ -35,7 +35,7 @@ use primitives::{BlockNumber, HeadData, Header, Id as ParaId, ValidationCode, LO
use runtime_parachains::{
configuration, origin, paras, shared, Origin as ParaOrigin, ParaLifecycle,
};
use sp_core::{crypto::KeyTypeId, H256};
use sp_core::H256;
use sp_io::TestExternalities;
use sp_keystore::{testing::KeyStore, KeystoreExt};
use sp_runtime::{
Expand Down Expand Up @@ -146,18 +146,10 @@ impl pallet_babe::Config for Test {
type ExpectedBlockTime = ExpectedBlockTime;
type EpochChangeTrigger = pallet_babe::ExternalTrigger;
type DisabledValidators = ();
type KeyOwnerProofSystem = ();
type KeyOwnerProof = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
pallet_babe::AuthorityId,
)>>::Proof;
type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
pallet_babe::AuthorityId,
)>>::IdentificationTuple;
type HandleEquivocation = ();
type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
type KeyOwnerProof = sp_core::Void;
type EquivocationReportSystem = ();
}

parameter_types! {
Expand Down
38 changes: 9 additions & 29 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,20 +264,11 @@ impl pallet_babe::Config for Runtime {

type DisabledValidators = Session;

type KeyOwnerProof = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
pallet_babe::AuthorityId,
)>>::Proof;

type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
pallet_babe::AuthorityId,
)>>::IdentificationTuple;

type KeyOwnerProofSystem = Historical;
type KeyOwnerProof =
<Historical as KeyOwnerProofSystem<(KeyTypeId, pallet_babe::AuthorityId)>>::Proof;

type HandleEquivocation =
pallet_babe::EquivocationHandler<Self::KeyOwnerIdentification, Offences, ReportLongevity>;
type EquivocationReportSystem =
pallet_babe::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>;

type WeightInfo = ();

Expand Down Expand Up @@ -729,25 +720,14 @@ parameter_types! {
impl pallet_grandpa::Config for Runtime {
type RuntimeEvent = RuntimeEvent;

type KeyOwnerProof =
<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;

type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
GrandpaId,
)>>::IdentificationTuple;

type KeyOwnerProofSystem = Historical;

type HandleEquivocation = pallet_grandpa::EquivocationHandler<
Self::KeyOwnerIdentification,
Offences,
ReportLongevity,
>;

type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;

type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;

type EquivocationReportSystem =
pallet_grandpa::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>;
}

/// Submits transaction with the node's public and signature type. Adheres to the signed extension
Expand Down
22 changes: 6 additions & 16 deletions runtime/parachains/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::{

use frame_support::{
parameter_types,
traits::{GenesisBuild, KeyOwnerProofSystem, ValidatorSet, ValidatorSetWithIdentification},
traits::{GenesisBuild, ValidatorSet, ValidatorSetWithIdentification},
weights::Weight,
};
use frame_support_test::TestRandomness;
Expand All @@ -39,7 +39,7 @@ use sp_io::TestExternalities;
use sp_runtime::{
traits::{BlakeTwo256, IdentityLookup},
transaction_validity::TransactionPriority,
KeyTypeId, Permill,
Permill,
};
use std::{cell::RefCell, collections::HashMap};

Expand Down Expand Up @@ -148,23 +148,13 @@ impl pallet_babe::Config for Test {

type DisabledValidators = ();

type KeyOwnerProof = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
pallet_babe::AuthorityId,
)>>::Proof;

type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
pallet_babe::AuthorityId,
)>>::IdentificationTuple;

type KeyOwnerProofSystem = ();

type HandleEquivocation = ();

type WeightInfo = ();

type MaxAuthorities = MaxAuthorities;

type KeyOwnerProof = sp_core::Void;

type EquivocationReportSystem = ();
}

parameter_types! {
Expand Down
42 changes: 11 additions & 31 deletions runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,24 +257,15 @@ impl pallet_babe::Config for Runtime {

type DisabledValidators = Session;

type KeyOwnerProofSystem = Historical;

type KeyOwnerProof = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
pallet_babe::AuthorityId,
)>>::Proof;

type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
pallet_babe::AuthorityId,
)>>::IdentificationTuple;

type HandleEquivocation =
pallet_babe::EquivocationHandler<Self::KeyOwnerIdentification, Offences, ReportLongevity>;

type WeightInfo = ();

type MaxAuthorities = MaxAuthorities;

type KeyOwnerProof =
<Historical as KeyOwnerProofSystem<(KeyTypeId, pallet_babe::AuthorityId)>>::Proof;

type EquivocationReportSystem =
pallet_babe::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>;
}

parameter_types! {
Expand Down Expand Up @@ -946,25 +937,14 @@ parameter_types! {
impl pallet_grandpa::Config for Runtime {
type RuntimeEvent = RuntimeEvent;

type KeyOwnerProof =
<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;

type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
GrandpaId,
)>>::IdentificationTuple;

type KeyOwnerProofSystem = Historical;

type HandleEquivocation = pallet_grandpa::EquivocationHandler<
Self::KeyOwnerIdentification,
Offences,
ReportLongevity,
>;

type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;

type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;

type EquivocationReportSystem =
pallet_grandpa::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>;
}

/// Submits a transaction with the node's public and signature type. Adheres to the signed extension
Expand Down
42 changes: 11 additions & 31 deletions runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,24 +251,15 @@ impl pallet_babe::Config for Runtime {

type DisabledValidators = Session;

type KeyOwnerProof = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
pallet_babe::AuthorityId,
)>>::Proof;

type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
pallet_babe::AuthorityId,
)>>::IdentificationTuple;

type KeyOwnerProofSystem = Historical;

type HandleEquivocation =
pallet_babe::EquivocationHandler<Self::KeyOwnerIdentification, Offences, ReportLongevity>;

type WeightInfo = ();

type MaxAuthorities = MaxAuthorities;

type KeyOwnerProof =
<Historical as KeyOwnerProofSystem<(KeyTypeId, pallet_babe::AuthorityId)>>::Proof;

type EquivocationReportSystem =
pallet_babe::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>;
}

parameter_types! {
Expand Down Expand Up @@ -669,25 +660,14 @@ parameter_types! {
impl pallet_grandpa::Config for Runtime {
type RuntimeEvent = RuntimeEvent;

type KeyOwnerProof =
<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;

type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
GrandpaId,
)>>::IdentificationTuple;

type KeyOwnerProofSystem = Historical;

type HandleEquivocation = pallet_grandpa::EquivocationHandler<
Self::KeyOwnerIdentification,
Offences,
ReportLongevity,
>;

type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;

type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;

type EquivocationReportSystem =
pallet_grandpa::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>;
}

/// Submits a transaction with the node's public and signature type. Adheres to the signed extension
Expand Down
36 changes: 9 additions & 27 deletions runtime/test-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use beefy_primitives::crypto::{AuthorityId as BeefyId, Signature as BeefySignatu
use frame_election_provider_support::{onchain, SequentialPhragmen};
use frame_support::{
construct_runtime, parameter_types,
traits::{Everything, KeyOwnerProofSystem, WithdrawReasons},
traits::{Everything, WithdrawReasons},
};
use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId};
use pallet_session::historical as session_historical;
Expand Down Expand Up @@ -66,7 +66,7 @@ use sp_runtime::{
SaturatedConversion, StaticLookup, Verify,
},
transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity},
ApplyExtrinsicResult, KeyTypeId, Perbill,
ApplyExtrinsicResult, Perbill,
};
use sp_staking::SessionIndex;
#[cfg(any(feature = "std", test))]
Expand Down Expand Up @@ -179,22 +179,13 @@ impl pallet_babe::Config for Runtime {

type DisabledValidators = ();

type KeyOwnerProofSystem = ();

type KeyOwnerProof = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
pallet_babe::AuthorityId,
)>>::Proof;
type WeightInfo = ();

type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
pallet_babe::AuthorityId,
)>>::IdentificationTuple;
type MaxAuthorities = MaxAuthorities;

type HandleEquivocation = ();
type KeyOwnerProof = sp_core::Void;

type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
type EquivocationReportSystem = ();
}

parameter_types! {
Expand Down Expand Up @@ -368,21 +359,12 @@ parameter_types! {
impl pallet_grandpa::Config for Runtime {
type RuntimeEvent = RuntimeEvent;

type KeyOwnerProofSystem = ();

type KeyOwnerProof =
<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;

type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
GrandpaId,
)>>::IdentificationTuple;

type HandleEquivocation = ();

type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;

type KeyOwnerProof = sp_core::Void;
type EquivocationReportSystem = ();
}

impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Runtime
Expand Down
42 changes: 11 additions & 31 deletions runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,24 +222,15 @@ impl pallet_babe::Config for Runtime {

type DisabledValidators = Session;

type KeyOwnerProofSystem = Historical;

type KeyOwnerProof = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
pallet_babe::AuthorityId,
)>>::Proof;

type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
pallet_babe::AuthorityId,
)>>::IdentificationTuple;

type HandleEquivocation =
pallet_babe::EquivocationHandler<Self::KeyOwnerIdentification, Offences, ReportLongevity>;

type WeightInfo = ();

type MaxAuthorities = MaxAuthorities;

type KeyOwnerProof =
<Historical as KeyOwnerProofSystem<(KeyTypeId, pallet_babe::AuthorityId)>>::Proof;

type EquivocationReportSystem =
pallet_babe::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>;
}

parameter_types! {
Expand Down Expand Up @@ -579,25 +570,14 @@ parameter_types! {
impl pallet_grandpa::Config for Runtime {
type RuntimeEvent = RuntimeEvent;

type KeyOwnerProofSystem = Historical;

type KeyOwnerProof =
<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;

type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
GrandpaId,
)>>::IdentificationTuple;

type HandleEquivocation = pallet_grandpa::EquivocationHandler<
Self::KeyOwnerIdentification,
Offences,
ReportLongevity,
>;

type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;

type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;

type EquivocationReportSystem =
pallet_grandpa::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>;
}

/// Submits a transaction with the node's public and signature type. Adheres to the signed extension
Expand Down