Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/build-polkadot-for-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
tests:
name: Build polkadot binary
runs-on: ubuntu-latest
container: paritytech/ci-unified:bullseye-1.81.0-2024-09-11
container: docker.io/paritytech/ci-unified:bullseye-1.85.0-2025-01-28-v202504231537
steps:
- name: checkout polkadot-sdk
uses: actions/checkout@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
tests:
name: Build staking-miner-playground
runs-on: ubuntu-latest
container: paritytech/ci-unified:bullseye-1.81.0-2024-09-11
container: docker.io/paritytech/ci-unified:bullseye-1.85.0-2025-01-28-v202504231537
steps:
- name: checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- main

env:
IMAGE: paritytech/ci-unified:bullseye-1.84.1-2025-01-28
IMAGE: docker.io/paritytech/ci-unified:bullseye-1.85.0-2025-01-28-v202504231537
IMAGE_NAME: paritytech/polkadot-staking-miner
RUST_INFO: rustup show && cargo --version && rustup +nightly show && cargo +nightly --version

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/staking-miner-playground.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ on:
branches:
- main
paths:
- 'staking-miner-playground/**'
- "staking-miner-playground/**"

env:
IMAGE: paritytech/ci-unified:bullseye-1.81.0-2024-09-11
IMAGE: docker.io/paritytech/ci-unified:bullseye-1.85.0-2025-01-28-v202504231537
IMAGE_NAME: paritytech/polkadot-staking-miner
RUST_INFO: rustup show && cargo --version && rustup +nightly show && cargo +nightly --version

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
name = "polkadot-staking-miner"
version = "1.7.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
rust-version = "1.81.0"
edition = "2024"
rust-version = "1.85.0"
license = "GPL-3.0"
repository = "https://github.com/paritytech/polkadot-staking-miner"
homepage = "https://www.parity.io/"
Expand Down
2 changes: 1 addition & 1 deletion src/client.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::prelude::{ChainClient, RpcClient, LOG_TARGET};
use crate::prelude::{ChainClient, LOG_TARGET, RpcClient};
use jsonrpsee::ws_client::WsClientBuilder;
use subxt::backend::rpc::RpcClient as RawRpcClient;

Expand Down
10 changes: 5 additions & 5 deletions src/commands/legacy/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ use crate::{
dynamic::legacy as dynamic,
error::Error,
prelude::{
AccountId, ChainClient, ExtrinsicParamsBuilder, Hash, Header, RpcClient, LOG_TARGET,
AccountId, ChainClient, ExtrinsicParamsBuilder, Hash, Header, LOG_TARGET, RpcClient,
},
prometheus,
runtime::legacy as runtime,
signer::Signer,
static_types::legacy as static_types,
utils::{
kill_main_task_if_critical_err, rpc_block_subscription, score_passes_strategy,
wait_for_in_block, TimedFuture,
TimedFuture, kill_main_task_if_critical_err, rpc_block_subscription, score_passes_strategy,
wait_for_in_block,
},
};
use codec::{Decode, Encode};
Expand Down Expand Up @@ -462,7 +462,7 @@ async fn submit_and_watch_solution<T: MinerConfig + Send + Sync + 'static>(
DryRunResult::TransactionValidityError => {
return Err(Error::TransactionRejected(
"TransactionValidityError".into(),
))
));
}
}
}
Expand Down Expand Up @@ -543,7 +543,7 @@ async fn dry_run_works(rpc: &RpcClient) -> Result<(), Error> {
return Err(Error::Other(
"Failed to downcast RPC error; this is a bug please file an issue"
.to_string(),
))
));
}
}
}
Expand Down
12 changes: 4 additions & 8 deletions src/commands/multi_block/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ use crate::{
},
dynamic::multi_block as dynamic,
error::Error,
prelude::{AccountId, ExtrinsicParamsBuilder, Storage, LOG_TARGET},
prelude::{AccountId, ExtrinsicParamsBuilder, LOG_TARGET, Storage},
prometheus,
runtime::multi_block::{
self as runtime, runtime_types::pallet_election_provider_multi_block::types::Phase,
},
signer::Signer,
static_types::multi_block as static_types,
utils::{self, kill_main_task_if_critical_err, score_passes_strategy, TimedFuture},
utils::{self, TimedFuture, kill_main_task_if_critical_err, score_passes_strategy},
};
use futures::future::{abortable, AbortHandle};
use futures::future::{AbortHandle, abortable};
use polkadot_sdk::{
pallet_election_provider_multi_block::unsigned::miner::MinerConfig,
sp_npos_elections::ElectionScore,
Expand Down Expand Up @@ -389,11 +389,7 @@ async fn get_submission(
.enumerate()
.filter_map(
|(i, submitted)| {
if submitted {
Some(i as u32)
} else {
None
}
if submitted { Some(i as u32) } else { None }
},
)
.collect();
Expand Down
2 changes: 1 addition & 1 deletion src/commands/multi_block/types.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
client::Client,
error::Error,
prelude::{AccountId, Hash, Header, Storage, LOG_TARGET},
prelude::{AccountId, Hash, Header, LOG_TARGET, Storage},
runtime::multi_block::{
self as runtime, runtime_types::pallet_election_provider_multi_block::types::Phase,
},
Expand Down
8 changes: 4 additions & 4 deletions src/dynamic/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ use crate::{
prometheus,
runtime::legacy as runtime,
static_types::legacy as static_types,
utils::{storage_at, RuntimeDispatchInfo},
utils::{RuntimeDispatchInfo, storage_at},
};
use codec::{Decode, Encode};
use polkadot_sdk::{
frame_election_provider_support::{self, Get, NposSolution, PhragMMS, SequentialPhragmen},
frame_support::{weights::Weight, BoundedVec},
frame_support::{BoundedVec, weights::Weight},
pallet_election_provider_multi_phase::{
self, unsigned::TrimmingStatus, Miner, MinerConfig, RawSolution, ReadySolution, SolutionOf,
SolutionOrSnapshotSize,
self, Miner, MinerConfig, RawSolution, ReadySolution, SolutionOf, SolutionOrSnapshotSize,
unsigned::TrimmingStatus,
},
sp_npos_elections::{ElectionScore, VoteWeight},
};
Expand Down
4 changes: 2 additions & 2 deletions src/dynamic/multi_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ use crate::{
utils::{decode_error, storage_addr, to_scale_value, tx},
},
error::Error,
prelude::{AccountId, ChainClient, Config, ExtrinsicParamsBuilder, Hash, Storage, LOG_TARGET},
prelude::{AccountId, ChainClient, Config, ExtrinsicParamsBuilder, Hash, LOG_TARGET, Storage},
runtime::multi_block as runtime,
signer::Signer,
utils,
};
use codec::Decode;
use futures::stream::FuturesUnordered;
use futures::StreamExt;
use futures::stream::FuturesUnordered;
use polkadot_sdk::{
frame_support::BoundedVec,
pallet_election_provider_multi_block::{
Expand Down
4 changes: 3 additions & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ pub enum Error {
AccountDoesNotExists,
#[error("Submission with better score already exist")]
BetterScoreExist,
#[error("Invalid chain: `{0}`, staking-miner supports only polkadot, kusama, westend, node and asset-hub-next")]
#[error(
"Invalid chain: `{0}`, staking-miner supports only polkadot, kusama, westend, node and asset-hub-next"
)]
InvalidChain(String),
#[error("Other error: `{0}`")]
Other(String),
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ async fn run_command(
fut: BoxFuture<'_, Result<(), Error>>,
rx_upgrade: oneshot::Receiver<Error>,
) -> Result<(), Error> {
use tokio::signal::unix::{signal, SignalKind};
use tokio::signal::unix::{SignalKind, signal};

let mut stream_int = signal(SignalKind::interrupt()).map_err(Error::Io)?;
let mut stream_term = signal(SignalKind::terminate()).map_err(Error::Io)?;
Expand Down
2 changes: 1 addition & 1 deletion src/opt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::error::Error;

use clap::*;
use polkadot_sdk::{frame_support, sp_npos_elections::BalancingConfig};
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use serde::{Deserialize, Serialize, de::DeserializeOwned};
use std::{collections::HashMap, fmt, str::FromStr};
use subxt::backend::legacy::rpc_methods as subxt_rpc;

Expand Down
4 changes: 2 additions & 2 deletions src/prometheus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use crate::prelude::LOG_TARGET;
pub use hidden::*;
use http_body_util::Full;
use hyper::{body::Bytes, header::CONTENT_TYPE, service::service_fn, Method, Request, Response};
use hyper::{Method, Request, Response, body::Bytes, header::CONTENT_TYPE, service::service_fn};
use hyper_util::{
rt::{TokioExecutor, TokioIo},
server::{conn::auto::Builder, graceful::GracefulShutdown},
Expand Down Expand Up @@ -109,7 +109,7 @@ pub async fn run(port: u16) -> Result<(), String> {
mod hidden {
use once_cell::sync::Lazy;
use polkadot_sdk::{frame_election_provider_support::Weight, sp_npos_elections};
use prometheus::{opts, register_counter, register_gauge, Counter, Gauge};
use prometheus::{Counter, Gauge, opts, register_counter, register_gauge};

static TRIMMED_SOLUTION_STARTED: Lazy<Counter> = Lazy::new(|| {
register_counter!(opts!(
Expand Down
2 changes: 1 addition & 1 deletion src/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ use crate::{
use polkadot_sdk::{
sp_core::Pair as PairT,
sp_runtime::{
traits::{IdentifyAccount, Verify},
MultiSignature as SpMultiSignature,
traits::{IdentifyAccount, Verify},
},
};

Expand Down
2 changes: 1 addition & 1 deletion src/static_types/multi_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
use polkadot_sdk::{
frame_election_provider_support::{self, SequentialPhragmen},
frame_support, pallet_election_provider_multi_block as multi_block,
sp_runtime::{traits::ConstU32, PerU16, Percent},
sp_runtime::{PerU16, Percent, traits::ConstU32},
};

impl_u32_parameter_type!(pages, Pages);
Expand Down
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::{
client::Client,
commands::types::{Listen, SubmissionStrategy},
error::Error,
prelude::{ChainClient, Config, Hash, Header, RpcClient, Storage, LOG_TARGET},
prelude::{ChainClient, Config, Hash, Header, LOG_TARGET, RpcClient, Storage},
};
use codec::Decode;
use jsonrpsee::core::ClientError as JsonRpseeError;
Expand Down
2 changes: 1 addition & 1 deletion staking-miner-playground/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "4.0.0-dev"
description = "A fresh FRAME-based Substrate node, ready for hacking."
authors = ["Substrate DevHub <https://github.com/substrate-developer-hub>"]
homepage = "https://substrate.io/"
edition = "2021"
edition = "2024"
license = "Unlicense"
publish = false
repository = "https://github.com/substrate-developer-hub/substrate-node-template/"
Expand Down
2 changes: 1 addition & 1 deletion staking-miner-playground/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "runtime"
version = "4.0.0-dev"
description = "staking-miner-playground runtime"
authors = ["Substrate DevHub <https://github.com/substrate-developer-hub>"]
edition = "2021"
edition = "2024"
license = "Unlicense"
publish = false

Expand Down
6 changes: 3 additions & 3 deletions tests/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ pub mod common;

use assert_cmd::cargo::cargo_bin;
use common::{
init_logger, run_staking_miner_playground, spawn_cli_output_threads, test_submit_solution,
wait_for_mined_solution, ElectionCompute, KillChildOnDrop, Target,
MAX_DURATION_FOR_SUBMIT_SOLUTION,
ElectionCompute, KillChildOnDrop, MAX_DURATION_FOR_SUBMIT_SOLUTION, Target, init_logger,
run_staking_miner_playground, spawn_cli_output_threads, test_submit_solution,
wait_for_mined_solution,
};
use polkadot_staking_miner::opt::Chain;
use regex::Regex;
Expand Down
8 changes: 4 additions & 4 deletions tests/multi_block_monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
pub mod common;

use assert_cmd::cargo::cargo_bin;
use common::{init_logger, spawn_cli_output_threads, KillChildOnDrop};
use common::{KillChildOnDrop, init_logger, spawn_cli_output_threads};
use polkadot_staking_miner::{
prelude::ChainClient,
runtime::multi_block::{
Expand Down Expand Up @@ -146,9 +146,9 @@ pub async fn wait_for_mined_solution(port: u16) -> anyhow::Result<()> {

if score_submitted && all_pages_submitted {
log::info!(
"Test passed: score registered, all {} pages submitted, and user rewarded!",
pages
);
"Test passed: score registered, all {} pages submitted, and user rewarded!",
pages
);
return Ok(());
}
// It should never happen that the user gets rewarded without score and all pages being submitted. Log the error outside both loops.
Expand Down
Loading