diff --git a/Cargo.lock b/Cargo.lock index d502fcb7b..5efeec7de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3281,6 +3281,38 @@ version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" +[[package]] +name = "polkadot-staking-miner" +version = "1.2.0" +dependencies = [ + "anyhow", + "assert_cmd", + "clap", + "frame-election-provider-support", + "frame-support", + "futures", + "hyper", + "jsonrpsee", + "log", + "once_cell", + "pallet-election-provider-multi-phase", + "parity-scale-codec", + "pin-project-lite", + "prometheus", + "regex", + "scale-info", + "scale-value", + "serde", + "serde_json", + "sp-npos-elections", + "sp-runtime 29.0.0", + "sp-storage 17.0.0", + "subxt", + "thiserror", + "tokio", + "tracing-subscriber 0.3.18", +] + [[package]] name = "polling" version = "2.8.0" @@ -5247,38 +5279,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" -[[package]] -name = "staking-miner" -version = "1.2.0" -dependencies = [ - "anyhow", - "assert_cmd", - "clap", - "frame-election-provider-support", - "frame-support", - "futures", - "hyper", - "jsonrpsee", - "log", - "once_cell", - "pallet-election-provider-multi-phase", - "parity-scale-codec", - "pin-project-lite", - "prometheus", - "regex", - "scale-info", - "scale-value", - "serde", - "serde_json", - "sp-npos-elections", - "sp-runtime 29.0.0", - "sp-storage 17.0.0", - "subxt", - "thiserror", - "tokio", - "tracing-subscriber 0.3.18", -] - [[package]] name = "static_assertions" version = "1.1.0" diff --git a/Cargo.toml b/Cargo.toml index 32016d83e..c98a3d99d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,12 @@ [package] -name = "staking-miner" +name = "polkadot-staking-miner" version = "1.2.0" authors = ["Parity Technologies "] edition = "2021" +rust-version = "1.70.0" +license = "GPL-3.0" +repository = "https://github.com/paritytech/polkadot-staking-miner" +homepage = "https://www.parity.io/" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0" } diff --git a/README.md b/README.md index e7706c612..18cb4259f 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ and that will work unless there is a breaking change in any of pallets used by the staking-miner (mainly pallet-election-provider and pallet-system are used). Because detecting breaking changes when connection to RPC node when using -`staking-miner-v2` is hard, this repo performs daily integration tests +`polkadot-staking-miner` is hard, this repo performs daily integration tests against `polkadot master` and in most cases [update the metadata](#update-metadata) and fixing the compile errors are sufficient. @@ -83,7 +83,7 @@ can be loaded to make your seed available: `.env`: ```bash SEED=0x1234... -RUST_LOG=staking-miner=debug +RUST_LOG=polkadot-staking-miner=debug ``` You can load it using `source .env`. @@ -95,12 +95,12 @@ it is nonetheless recommended running this container in `read-only` mode: ```bash docker run --rm -it \ - --name staking-miner \ + --name polkadot-staking-miner \ --read-only \ -e RUST_LOG=info \ -e SEED \ -e URI=wss://your-node:9944 \ - staking-miner dry-run + polkadot-staking-miner dry-run ``` ## Update metadata @@ -126,7 +126,7 @@ it's possible build the polkadot binary with `feature --fast-runtime` to ensure that elections occurs more often (in order of minutes rather hours/days). ```bash -$ cargo run --release --package polkadot --features fast-runtime -- --chain polkadot-dev --tmp --alice --execution Native -lruntime=debug --offchain-worker=Never --ws-port 9999 +$ cargo run --release --package polkadot --features fast-runtime -- --chain westend-dev --tmp --alice --execution Native -lruntime=debug --offchain-worker=Never --ws-port 9999 # open another terminal and run $ cargo run --release -- --uri ws://localhost:9999 monitor --seed-or-path //Alice seq-phragmen ``` @@ -176,5 +176,4 @@ staking_miner_submit_and_watch_duration_ms 17283 ## Related projects -- [polkadot staking miner](https://github.com/paritytech/polkadot/tree/master/utils/staking-miner) - provides similar functionality but each release is hard-coded to a specific runtime version - [substrate-etl](https://github.com/gpestana/substrate-etl) - a tool fetch state from substrate-based chains. diff --git a/RELEASE-CHECKLIST.md b/RELEASE-CHECKLIST.md index 3c1a4fb9e..77b37a121 100644 --- a/RELEASE-CHECKLIST.md +++ b/RELEASE-CHECKLIST.md @@ -46,7 +46,9 @@ We also assume that ongoing work done is being merged directly to the `main` bra cargo test --features slow-tests -- --nocapture ``` -8. If the release was successful, tag the commit that we released in the `main` branch with the +8. Now, we're ready to publish the release to crates.io. Run `cargo publish` to do that. + +9. If the release was successful, tag the commit that we released in the `main` branch with the version that we just released, for example: ``` @@ -57,4 +59,3 @@ We also assume that ongoing work done is being merged directly to the `main` bra Once this is pushed, go along to [the releases page on GitHub](https://github.com/paritytech/staking-miner-v2/releases) and draft a new release which points to the tag you just pushed to `main` above. Copy the changelog comments for the current release into the release description. - diff --git a/src/epm.rs b/src/epm.rs index bb96efc9a..be3879246 100644 --- a/src/epm.rs +++ b/src/epm.rs @@ -128,7 +128,6 @@ where .await?; let max_weight: Weight = T::MaxWeight::get(); - log::trace!(target: "staking-miner", "trimming weight: est_weight={est_weight} / max_weight={max_weight}"); if est_weight.all_lt(max_weight) { return Ok(Self { state: State { voters, voters_by_stake }, _marker: PhantomData }) diff --git a/src/main.rs b/src/main.rs index 86ca8ee22..bde660e7f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -64,7 +64,7 @@ pub struct Opt { #[clap(long, short, env = "PROMETHEUS_PORT", default_value_t = DEFAULT_PROMETHEUS_PORT)] pub prometheus_port: u16, - /// Sets a custom logging filter. Syntax is `=`, e.g. -lstaking-miner=debug. + /// Sets a custom logging filter. Syntax is `=`, e.g. -lpolkadot-staking-miner=debug. /// /// Log levels (least to most verbose) are error, warn, info, debug, and trace. /// By default, all targets log `info`. The global log level can be set with `-l`. diff --git a/src/prelude.rs b/src/prelude.rs index 636349040..9d1e8d0d6 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -41,7 +41,7 @@ pub const DEFAULT_URI: &str = "ws://127.0.0.1:9944"; /// Default port to start the prometheus server on. pub const DEFAULT_PROMETHEUS_PORT: u16 = 9999; /// The logging target. -pub const LOG_TARGET: &str = "staking-miner"; +pub const LOG_TARGET: &str = "polkadot-staking-miner"; /// The key pair type being used. We "strongly" assume sr25519 for simplicity. pub type Pair = sp_core::sr25519::Pair; diff --git a/tests/common.rs b/tests/common.rs index d32141ac5..9012f9cae 100644 --- a/tests/common.rs +++ b/tests/common.rs @@ -1,5 +1,5 @@ use assert_cmd::cargo::cargo_bin; -use staking_miner::{ +use polkadot_staking_miner::{ opt::Chain, prelude::{runtime, ChainClient}, }; diff --git a/tests/monitor.rs b/tests/monitor.rs index f05ae5dd9..7fbb51df6 100644 --- a/tests/monitor.rs +++ b/tests/monitor.rs @@ -9,8 +9,8 @@ use common::{ wait_for_mined_solution, ElectionCompute, KillChildOnDrop, Target, MAX_DURATION_FOR_SUBMIT_SOLUTION, }; +use polkadot_staking_miner::opt::Chain; use regex::Regex; -use staking_miner::opt::Chain; use std::{process, time::Instant}; #[tokio::test] @@ -31,7 +31,7 @@ async fn default_trimming_works() { process::Command::new(cargo_bin(env!("CARGO_PKG_NAME"))) .stdout(process::Stdio::piped()) .stderr(process::Stdio::piped()) - .env("RUST_LOG", "runtime=debug,staking-miner=debug") + .env("RUST_LOG", "runtime=debug,polkadot-staking-miner=debug") .args(["--uri", &ws_url, "monitor", "--seed-or-path", "//Alice", "seq-phragmen"]) .spawn() .unwrap(),