companion for 11350 (#5489)

* fix all runtimes

* fix staking miner

* update lockfile for {"substrate"}

Co-authored-by: parity-processbot <>
This commit is contained in:
Kian Paimani
2022-05-11 20:22:15 +01:00
committed by GitHub
parent bca124a46f
commit eb2448e1be
6 changed files with 253 additions and 190 deletions
+171 -171
View File
File diff suppressed because it is too large Load Diff
+25 -4
View File
@@ -439,6 +439,28 @@ impl onchain::Config for OnChainSeqPhragmen {
type WeightInfo = weights::frame_election_provider_support::WeightInfo<Runtime>;
}
impl pallet_election_provider_multi_phase::MinerConfig for Runtime {
type AccountId = AccountId;
type MaxLength = OffchainSolutionLengthLimit;
type MaxWeight = OffchainSolutionWeightLimit;
type Solution = NposCompactSolution24;
type MaxVotesPerVoter = <
<Self as pallet_election_provider_multi_phase::Config>::DataProvider
as
frame_election_provider_support::ElectionDataProvider
>::MaxVotesPerVoter;
// The unsigned submissions have to respect the weight of the submit_unsigned call, thus their
// weight estimate function is wired to this call's weight.
fn solution_weight(v: u32, t: u32, a: u32, d: u32) -> Weight {
<
<Self as pallet_election_provider_multi_phase::Config>::WeightInfo
as
pallet_election_provider_multi_phase::WeightInfo
>::submit_unsigned(v, t, a, d)
}
}
impl pallet_election_provider_multi_phase::Config for Runtime {
type Event = Event;
type Currency = Balances;
@@ -450,18 +472,17 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type SignedDepositBase = SignedDepositBase;
type SignedDepositByte = SignedDepositByte;
type SignedDepositWeight = ();
type SignedMaxWeight = Self::MinerMaxWeight;
type SignedMaxWeight =
<Self::MinerConfig as pallet_election_provider_multi_phase::MinerConfig>::MaxWeight;
type MinerConfig = Self;
type SlashHandler = (); // burn slashes
type RewardHandler = (); // nothing to do upon rewards
type SignedPhase = SignedPhase;
type BetterUnsignedThreshold = BetterUnsignedThreshold;
type BetterSignedThreshold = ();
type MinerMaxWeight = OffchainSolutionWeightLimit; // For now use the one from staking.
type MinerMaxLength = OffchainSolutionLengthLimit;
type OffchainRepeat = OffchainRepeat;
type MinerTxPriority = NposSolutionPriority;
type DataProvider = Staking;
type Solution = NposCompactSolution24;
type Fallback = pallet_election_provider_multi_phase::NoFallback<Self>;
type GovernanceFallback = onchain::UnboundedExecution<OnChainSeqPhragmen>;
type Solver = SequentialPhragmen<
+25 -4
View File
@@ -479,6 +479,28 @@ impl onchain::Config for OnChainSeqPhragmen {
type WeightInfo = weights::frame_election_provider_support::WeightInfo<Runtime>;
}
impl pallet_election_provider_multi_phase::MinerConfig for Runtime {
type AccountId = AccountId;
type MaxLength = OffchainSolutionLengthLimit;
type MaxWeight = OffchainSolutionWeightLimit;
type Solution = NposCompactSolution16;
type MaxVotesPerVoter = <
<Self as pallet_election_provider_multi_phase::Config>::DataProvider
as
frame_election_provider_support::ElectionDataProvider
>::MaxVotesPerVoter;
// The unsigned submissions have to respect the weight of the submit_unsigned call, thus their
// weight estimate function is wired to this call's weight.
fn solution_weight(v: u32, t: u32, a: u32, d: u32) -> Weight {
<
<Self as pallet_election_provider_multi_phase::Config>::WeightInfo
as
pallet_election_provider_multi_phase::WeightInfo
>::submit_unsigned(v, t, a, d)
}
}
impl pallet_election_provider_multi_phase::Config for Runtime {
type Event = Event;
type Currency = Balances;
@@ -491,17 +513,16 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type SignedDepositBase = SignedDepositBase;
type SignedDepositByte = SignedDepositByte;
type SignedDepositWeight = ();
type SignedMaxWeight = Self::MinerMaxWeight;
type SignedMaxWeight =
<Self::MinerConfig as pallet_election_provider_multi_phase::MinerConfig>::MaxWeight;
type MinerConfig = Self;
type SlashHandler = (); // burn slashes
type RewardHandler = (); // nothing to do upon rewards
type BetterUnsignedThreshold = BetterUnsignedThreshold;
type BetterSignedThreshold = ();
type MinerMaxWeight = OffchainSolutionWeightLimit; // For now use the one from staking.
type MinerMaxLength = OffchainSolutionLengthLimit;
type OffchainRepeat = OffchainRepeat;
type MinerTxPriority = NposSolutionPriority;
type DataProvider = Staking;
type Solution = NposCompactSolution16;
type Fallback = pallet_election_provider_multi_phase::NoFallback<Self>;
type GovernanceFallback = onchain::UnboundedExecution<OnChainSeqPhragmen>;
type Solver = SequentialPhragmen<
+25 -4
View File
@@ -382,6 +382,28 @@ impl onchain::Config for OnChainSeqPhragmen {
type WeightInfo = weights::frame_election_provider_support::WeightInfo<Runtime>;
}
impl pallet_election_provider_multi_phase::MinerConfig for Runtime {
type AccountId = AccountId;
type MaxLength = OffchainSolutionLengthLimit;
type MaxWeight = OffchainSolutionWeightLimit;
type Solution = NposCompactSolution16;
type MaxVotesPerVoter = <
<Self as pallet_election_provider_multi_phase::Config>::DataProvider
as
frame_election_provider_support::ElectionDataProvider
>::MaxVotesPerVoter;
// The unsigned submissions have to respect the weight of the submit_unsigned call, thus their
// weight estimate function is wired to this call's weight.
fn solution_weight(v: u32, t: u32, a: u32, d: u32) -> Weight {
<
<Self as pallet_election_provider_multi_phase::Config>::WeightInfo
as
pallet_election_provider_multi_phase::WeightInfo
>::submit_unsigned(v, t, a, d)
}
}
impl pallet_election_provider_multi_phase::Config for Runtime {
type Event = Event;
type Currency = Balances;
@@ -394,17 +416,16 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type SignedDepositBase = SignedDepositBase;
type SignedDepositByte = SignedDepositByte;
type SignedDepositWeight = ();
type SignedMaxWeight = Self::MinerMaxWeight;
type SignedMaxWeight =
<Self::MinerConfig as pallet_election_provider_multi_phase::MinerConfig>::MaxWeight;
type MinerConfig = Self;
type SlashHandler = (); // burn slashes
type RewardHandler = (); // nothing to do upon rewards
type BetterUnsignedThreshold = BetterUnsignedThreshold;
type BetterSignedThreshold = ();
type MinerMaxWeight = OffchainSolutionWeightLimit; // For now use the one from staking.
type MinerMaxLength = OffchainSolutionLengthLimit;
type OffchainRepeat = OffchainRepeat;
type MinerTxPriority = NposSolutionPriority;
type DataProvider = Staking;
type Solution = NposCompactSolution16;
type Fallback = pallet_election_provider_multi_phase::NoFallback<Self>;
type GovernanceFallback = onchain::UnboundedExecution<OnChainSeqPhragmen>;
type Solver = SequentialPhragmen<
+1 -1
View File
@@ -39,7 +39,7 @@ fn force_create_snapshot<T: EPM::Config>(ext: &mut Ext) -> Result<(), Error<T>>
async fn print_info<T: EPM::Config>(
rpc: &SharedRpcClient,
ext: &mut Ext,
raw_solution: &EPM::RawSolution<EPM::SolutionOf<T>>,
raw_solution: &EPM::RawSolution<EPM::SolutionOf<T::MinerConfig>>,
extrinsic: &Bytes,
) where
<T as EPM::Config>::Currency: Currency<T::AccountId, Balance = Balance>,
+6 -6
View File
@@ -238,7 +238,7 @@ enum Error<T: EPM::Config> {
Codec(#[from] codec::Error),
Crypto(sp_core::crypto::SecretStringError),
RemoteExternalities(&'static str),
PalletMiner(EPM::unsigned::MinerError<T>),
PalletMiner(EPM::unsigned::MinerError),
PalletElection(EPM::ElectionError<T>),
PalletFeasibility(EPM::FeasibilityError),
AccountDoesNotExists,
@@ -254,8 +254,8 @@ impl<T: EPM::Config> From<sp_core::crypto::SecretStringError> for Error<T> {
}
}
impl<T: EPM::Config> From<EPM::unsigned::MinerError<T>> for Error<T> {
fn from(e: EPM::unsigned::MinerError<T>) -> Error<T> {
impl<T: EPM::Config> From<EPM::unsigned::MinerError> for Error<T> {
fn from(e: EPM::unsigned::MinerError) -> Error<T> {
Error::PalletMiner(e)
}
}
@@ -463,7 +463,7 @@ async fn create_election_ext<T: EPM::Config, B: BlockT + DeserializeOwned>(
fn mine_solution<T, S>(
ext: &mut Ext,
do_feasibility: bool,
) -> Result<EPM::RawSolution<EPM::SolutionOf<T>>, Error<T>>
) -> Result<EPM::RawSolution<EPM::SolutionOf<T::MinerConfig>>, Error<T>>
where
T: EPM::Config,
S: NposSolver<
@@ -473,7 +473,7 @@ where
{
ext.execute_with(|| {
let (solution, _) =
<EPM::Pallet<T>>::mine_solution::<S>().map_err::<Error<T>, _>(Into::into)?;
<EPM::Pallet<T>>::mine_solution().map_err::<Error<T>, _>(Into::into)?;
if do_feasibility {
let _ = <EPM::Pallet<T>>::feasibility_check(
solution.clone(),
@@ -489,7 +489,7 @@ fn mine_with<T>(
solver: &Solver,
ext: &mut Ext,
do_feasibility: bool,
) -> Result<EPM::RawSolution<EPM::SolutionOf<T>>, Error<T>>
) -> Result<EPM::RawSolution<EPM::SolutionOf<T::MinerConfig>>, Error<T>>
where
T: EPM::Config,
T::Solver: NposSolver<Error = sp_npos_elections::Error>,