rustfmt staking-miner and fix typos

Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
Uncle Stretch
2025-07-29 14:38:49 +03:00
parent e21ac88235
commit ce26787a11
14 changed files with 1317 additions and 130 deletions

View File

@@ -21,9 +21,15 @@ async fn serve_req(req: Request<Body>) -> Result<Response<Body>, hyper::Error> {
.header(CONTENT_TYPE, encoder.format_type())
.body(Body::from(buffer))
.unwrap()
},
(&Method::GET, "/") => Response::builder().status(200).body(Body::from("")).unwrap(),
_ => Response::builder().status(404).body(Body::from("")).unwrap(),
}
(&Method::GET, "/") => Response::builder()
.status(200)
.body(Body::from(""))
.unwrap(),
_ => Response::builder()
.status(404)
.body(Body::from(""))
.unwrap(),
};
Ok(response)
@@ -75,35 +81,40 @@ mod hidden {
register_counter!(opts!(
"staking_miner_trim_started",
"Number of started trimmed solutions",
)).unwrap()
))
.unwrap()
});
static TRIMMED_SOLUTION_SUCCESS: Lazy<Counter> = Lazy::new(|| {
register_counter!(opts!(
"staking_miner_trim_success",
"Number of successful trimmed solutions",
)).unwrap()
))
.unwrap()
});
static SUBMISSIONS_STARTED: Lazy<Counter> = Lazy::new(|| {
register_counter!(opts!(
"staking_miner_submissions_started",
"Number of submissions started",
)).unwrap()
))
.unwrap()
});
static SUBMISSIONS_SUCCESS: Lazy<Counter> = Lazy::new(|| {
register_counter!(opts!(
"staking_miner_submissions_success",
"Number of submissions finished successfully",
)).unwrap()
))
.unwrap()
});
static MINED_SOLUTION_DURATION: Lazy<Gauge> = Lazy::new(|| {
register_counter!(opts!(
"staking_miner_mining_duration_ms",
"The mined solution time in milliseconds.",
)).unwrap()
))
.unwrap()
});
static SUBMIT_SOLUTION_AND_WATCH_DURATION: Lazy<Gauge> = Lazy::new(|| {
@@ -117,49 +128,56 @@ mod hidden {
register_counter!(opts!(
"staking_miner_balance",
"The balance of the staking miner account",
)).unwrap()
))
.unwrap()
});
static SCORE_MINIMAL_STAKE: Lazy<Gauge> = Lazy::new(|| {
register_counter!(opts!(
"staking_miner_score_minimal_stake",
"The minimal winner, in terms of total backing stake",
)).unwrap()
))
.unwrap()
});
static SCORE_SUM_STAKE: Lazy<Gauge> = Lazy::new(|| {
register_counter!(opts!(
"staking_miner_score_sum_stake",
"The sum of the total backing of all winners",
)).unwrap()
))
.unwrap()
});
static SCORE_SUM_STAKE_SQUARED: Lazy<Gauge> = Lazy::new(|| {
register_counter!(opts!(
"staking_miner_score_sum_stake_squared",
"The sum of the total backing of all winners, aka. the variance.",
)).unwrap()
))
.unwrap()
});
static RUNTIME_UPGRADES: Lazy<Counter> = Lazy::new(|| {
register_counter!(opts!(
"staking_miner_runtime",
"Number of runtime upgrades performed",
)).unwrap()
))
.unwrap()
});
static SUBMISSION_LENGTH: Lazy<Gauge> = Lazy::new(|| {
register_counter!(opts!(
"staking_miner_solution_length_bytes",
"Number of bytes in the solution submitted",
)).unwrap()
))
.unwrap()
});
static SUBMISSION_WEIGHT: Lazy<Gauge> = Lazy::new(|| {
register_counter!(opts!(
"staking_miner_solution_weight",
"Weight of the solution submitted",
)).unwrap()
))
.unwrap()
});
pub fn on_runtime_upgrade() {