diff --git a/polkadot/utils/staking-miner/src/emergency_solution.rs b/polkadot/utils/staking-miner/src/emergency_solution.rs index a3847825f5..43bfc389cc 100644 --- a/polkadot/utils/staking-miner/src/emergency_solution.rs +++ b/polkadot/utils/staking-miner/src/emergency_solution.rs @@ -18,7 +18,6 @@ use crate::{prelude::*, EmergencySolutionConfig, Error, SharedConfig}; use codec::Encode; -use frame_election_provider_support::SequentialPhragmen; use std::io::Write; macro_rules! emergency_solution_cmd_for { ($runtime:ident) => { paste::paste! { @@ -28,15 +27,15 @@ macro_rules! emergency_solution_cmd_for { ($runtime:ident) => { paste::paste! { config: EmergencySolutionConfig, ) -> Result<(), Error<$crate::[<$runtime _runtime_exports>]::Runtime>> { use $crate::[<$runtime _runtime_exports>]::*; - let mut ext = crate::create_election_ext::(shared.uri.clone(), None, vec![]).await?; + + let mut ext = crate::create_election_ext::(shared.uri.clone(), config.at, vec![]).await?; + let (raw_solution, _witness) = crate::mine_with::(&config.solver, &mut ext, false)?; + ext.execute_with(|| { assert!(EPM::Pallet::::current_phase().is_emergency()); - // NOTE: this internally calls feasibility_check, but we just re-do it here as an easy way - // to get a `ReadySolution`. - let (raw_solution, _) = - >::mine_solution::>()?; log::info!(target: LOG_TARGET, "mined solution with {:?}", &raw_solution.score); + let mut ready_solution = EPM::Pallet::::feasibility_check(raw_solution, EPM::ElectionCompute::Signed)?; // maybe truncate. diff --git a/polkadot/utils/staking-miner/src/main.rs b/polkadot/utils/staking-miner/src/main.rs index 2a08df9cf8..f05897b426 100644 --- a/polkadot/utils/staking-miner/src/main.rs +++ b/polkadot/utils/staking-miner/src/main.rs @@ -319,12 +319,10 @@ struct MonitorConfig { #[derive(Debug, Clone, StructOpt)] struct EmergencySolutionConfig { /// The block hash at which scraping happens. If none is provided, the latest head is used. - #[allow(dead_code)] #[structopt(long)] at: Option, /// The solver algorithm to use. - #[allow(dead_code)] #[structopt(subcommand)] solver: Solvers,