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
64 changes: 32 additions & 32 deletions Cargo.lock

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

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
[package]
name = "staking-miner"
name = "polkadot-staking-miner"
version = "1.2.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
rust-version = "1.70.0"
license = "GPL-3.0"
repository = "https://github.com/paritytech/polkadot-staking-miner"
Copy link
Copy Markdown
Contributor Author

@niklasad1 niklasad1 Nov 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change this repo name as well if we agree :)

homepage = "https://www.parity.io/"

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0" }
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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`.

Expand All @@ -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
Expand All @@ -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
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

polkadot-dev is removed nowdays

# open another terminal and run
$ cargo run --release -- --uri ws://localhost:9999 monitor --seed-or-path //Alice seq-phragmen
```
Expand Down Expand Up @@ -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
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is removed as well.

- [substrate-etl](https://github.com/gpestana/substrate-etl) - a tool fetch state from substrate-based chains.
5 changes: 3 additions & 2 deletions RELEASE-CHECKLIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

```
Expand All @@ -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.

1 change: 0 additions & 1 deletion src/epm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<target>=<level>`, e.g. -lstaking-miner=debug.
/// Sets a custom logging filter. Syntax is `<target>=<level>`, 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<level>`.
Expand Down
2 changes: 1 addition & 1 deletion src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/common.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use assert_cmd::cargo::cargo_bin;
use staking_miner::{
use polkadot_staking_miner::{
opt::Chain,
prelude::{runtime, ChainClient},
};
Expand Down
4 changes: 2 additions & 2 deletions tests/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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(),
Expand Down