companion for #10945 (#5012)

* companion for #10945

* fix build

* fix bad merge

* update lockfile for {"substrate"}

Co-authored-by: parity-processbot <>
This commit is contained in:
Niklas Adolfsson
2022-03-04 00:26:05 +01:00
committed by GitHub
parent 3d5e9b3c9c
commit 8ea9b676a9
8 changed files with 175 additions and 180 deletions
+162 -162
View File
File diff suppressed because it is too large Load Diff
@@ -110,10 +110,9 @@ impl<T: frame_system::Config> pallet_election_provider_multi_phase::WeightInfo f
// Storage: TransactionPayment NextFeeMultiplier (r:1 w:0)
// Storage: ElectionProviderMultiPhase SignedSubmissionNextIndex (r:1 w:1)
// Storage: ElectionProviderMultiPhase SignedSubmissionsMap (r:0 w:1)
fn submit(c: u32) -> Weight {
fn submit() -> Weight {
(77_368_000 as Weight)
// Standard Error: 9_000
.saturating_add((369_000 as Weight).saturating_mul(c as Weight))
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
@@ -110,10 +110,9 @@ impl<T: frame_system::Config> pallet_election_provider_multi_phase::WeightInfo f
// Storage: TransactionPayment NextFeeMultiplier (r:1 w:0)
// Storage: ElectionProviderMultiPhase SignedSubmissionNextIndex (r:1 w:1)
// Storage: ElectionProviderMultiPhase SignedSubmissionsMap (r:0 w:1)
fn submit(c: u32) -> Weight {
fn submit() -> Weight {
(77_368_000 as Weight)
// Standard Error: 9_000
.saturating_add((369_000 as Weight).saturating_mul(c as Weight))
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
@@ -110,10 +110,9 @@ impl<T: frame_system::Config> pallet_election_provider_multi_phase::WeightInfo f
// Storage: TransactionPayment NextFeeMultiplier (r:1 w:0)
// Storage: ElectionProviderMultiPhase SignedSubmissionNextIndex (r:1 w:1)
// Storage: ElectionProviderMultiPhase SignedSubmissionsMap (r:0 w:1)
fn submit(c: u32) -> Weight {
fn submit() -> Weight {
(77_368_000 as Weight)
// Standard Error: 9_000
.saturating_add((369_000 as Weight).saturating_mul(c as Weight))
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
+3 -3
View File
@@ -126,7 +126,7 @@ macro_rules! dry_run_cmd_for { ($runtime:ident) => { paste::paste! {
};
log::debug!(target: LOG_TARGET, "solving with {:?}", config.solver);
let (raw_solution, witness) = crate::mine_with::<Runtime>(&config.solver, &mut ext, false)?;
let raw_solution = crate::mine_with::<Runtime>(&config.solver, &mut ext, false)?;
let nonce = crate::get_account_info::<Runtime>(&rpc, &signer.account, config.at)
.await?
@@ -137,7 +137,7 @@ macro_rules! dry_run_cmd_for { ($runtime:ident) => { paste::paste! {
);
let tip = 0 as Balance;
let era = sp_runtime::generic::Era::Immortal;
let extrinsic = ext.execute_with(|| create_uxt(raw_solution.clone(), witness, signer.clone(), nonce, tip, era));
let extrinsic = ext.execute_with(|| create_uxt(raw_solution.clone(), signer.clone(), nonce, tip, era));
let bytes = sp_core::Bytes(extrinsic.encode().to_vec());
print_info::<Runtime>(&rpc, &mut ext, &raw_solution, &bytes).await;
@@ -150,7 +150,7 @@ macro_rules! dry_run_cmd_for { ($runtime:ident) => { paste::paste! {
let dispatch_result = ext.execute_with(|| {
// manually tweak the phase.
EPM::CurrentPhase::<Runtime>::put(EPM::Phase::Signed);
EPM::Pallet::<Runtime>::submit(frame_system::RawOrigin::Signed(signer.account).into(), Box::new(raw_solution), witness)
EPM::Pallet::<Runtime>::submit(frame_system::RawOrigin::Signed(signer.account).into(), Box::new(raw_solution))
});
log::info!(target: LOG_TARGET, "dispatch result is {:?}", dispatch_result);
@@ -29,7 +29,7 @@ macro_rules! emergency_solution_cmd_for { ($runtime:ident) => { paste::paste! {
use $crate::[<$runtime _runtime_exports>]::*;
let mut ext = crate::create_election_ext::<Runtime, Block>(client, config.at, vec![]).await?;
let (raw_solution, _witness) = crate::mine_with::<Runtime>(&config.solver, &mut ext, false)?;
let raw_solution = crate::mine_with::<Runtime>(&config.solver, &mut ext, false)?;
ext.execute_with(|| {
assert!(EPM::Pallet::<Runtime>::current_phase().is_emergency());
+4 -6
View File
@@ -73,7 +73,6 @@ macro_rules! construct_runtime_prelude {
use super::*;
pub(crate) fn [<create_uxt_ $runtime>](
raw_solution: EPM::RawSolution<EPM::SolutionOf<Runtime>>,
witness: u32,
signer: crate::signer::Signer,
nonce: crate::prelude::Index,
tip: crate::prelude::Balance,
@@ -85,7 +84,7 @@ macro_rules! construct_runtime_prelude {
let crate::signer::Signer { account, pair, .. } = signer;
let local_call = EPMCall::<Runtime>::submit { raw_solution: Box::new(raw_solution), num_signed_submissions: witness };
let local_call = EPMCall::<Runtime>::submit { raw_solution: Box::new(raw_solution) };
let call: Call = <EPMCall<Runtime> as std::convert::TryInto<Call>>::try_into(local_call)
.expect("election provider pallet must exist in the runtime, thus \
inner call can be converted, qed."
@@ -409,7 +408,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>>, u32), Error<T>>
) -> Result<EPM::RawSolution<EPM::SolutionOf<T>>, Error<T>>
where
T: EPM::Config,
S: NposSolver<
@@ -426,8 +425,7 @@ where
EPM::ElectionCompute::Signed,
)?;
}
let witness = <EPM::SignedSubmissions<T>>::decode_len().unwrap_or_default();
Ok((solution, witness as u32))
Ok(solution)
})
}
@@ -436,7 +434,7 @@ fn mine_with<T>(
solver: &Solver,
ext: &mut Ext,
do_feasibility: bool,
) -> Result<(EPM::RawSolution<EPM::SolutionOf<T>>, u32), Error<T>>
) -> Result<EPM::RawSolution<EPM::SolutionOf<T>>, Error<T>>
where
T: EPM::Config,
T::Solver: NposSolver<Error = sp_npos_elections::Error>,
+2 -2
View File
@@ -165,7 +165,7 @@ macro_rules! monitor_cmd_for { ($runtime:tt) => { paste::paste! {
}
// mine a solution, and run feasibility check on it as well.
let (raw_solution, witness) = match crate::mine_with::<Runtime>(&config.solver, &mut ext, true) {
let raw_solution = match crate::mine_with::<Runtime>(&config.solver, &mut ext, true) {
Ok(r) => r,
Err(err) => {
let _ = tx.send(err.into());
@@ -197,7 +197,7 @@ macro_rules! monitor_cmd_for { ($runtime:tt) => { paste::paste! {
era.death(current_block.into()),
);
let extrinsic = ext.execute_with(|| create_uxt(raw_solution, witness, signer.clone(), nonce, tip, era));
let extrinsic = ext.execute_with(|| create_uxt(raw_solution, signer.clone(), nonce, tip, era));
let bytes = sp_core::Bytes(extrinsic.encode());
let mut tx_subscription = match rpc.watch_extrinsic(&bytes).await {