Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
d278b63f
Commit
d278b63f
authored
3 years ago
by
Niklas Adolfsson
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
staking miner: use config for emergency solution (#4694)
parent
d929efff
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
polkadot/utils/staking-miner/src/emergency_solution.rs
+5
-6
5 additions, 6 deletions
polkadot/utils/staking-miner/src/emergency_solution.rs
polkadot/utils/staking-miner/src/main.rs
+0
-2
0 additions, 2 deletions
polkadot/utils/staking-miner/src/main.rs
with
5 additions
and
8 deletions
polkadot/utils/staking-miner/src/emergency_solution.rs
+
5
−
6
View file @
d278b63f
...
...
@@ -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
::
<
Runtime
,
Block
>
(
shared
.uri
.clone
(),
None
,
vec!
[])
.await
?
;
let
mut
ext
=
crate
::
create_election_ext
::
<
Runtime
,
Block
>
(
shared
.uri
.clone
(),
config
.at
,
vec!
[])
.await
?
;
let
(
raw_solution
,
_witness
)
=
crate
::
mine_with
::
<
Runtime
>
(
&
config
.solver
,
&
mut
ext
,
false
)
?
;
ext
.execute_with
(||
{
assert!
(
EPM
::
Pallet
::
<
Runtime
>
::
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
,
_
)
=
<
EPM
::
Pallet
<
Runtime
>>
::
mine_solution
::
<
SequentialPhragmen
<
AccountId
,
sp_runtime
::
Perbill
>>
()
?
;
log
::
info!
(
target
:
LOG_TARGET
,
"mined solution with {:?}"
,
&
raw_solution
.score
);
let
mut
ready_solution
=
EPM
::
Pallet
::
<
Runtime
>
::
feasibility_check
(
raw_solution
,
EPM
::
ElectionCompute
::
Signed
)
?
;
// maybe truncate.
...
...
This diff is collapsed.
Click to expand it.
polkadot/utils/staking-miner/src/main.rs
+
0
−
2
View file @
d278b63f
...
...
@@ -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
<
Hash
>
,
/// The solver algorithm to use.
#[allow(dead_code)]
#[structopt(subcommand)]
solver
:
Solvers
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment