mirror of
https://github.com/Cuprate/cuprate.git
synced 2024-12-22 03:29:25 +00:00
consensus-context: enable workspace lints (#321)
Some checks failed
Audit / audit (push) Has been cancelled
CI / fmt (push) Has been cancelled
CI / typo (push) Has been cancelled
Deny / audit (push) Has been cancelled
Doc / build (push) Has been cancelled
CI / ci (macos-latest, stable, bash) (push) Has been cancelled
CI / ci (ubuntu-latest, stable, bash) (push) Has been cancelled
CI / ci (windows-latest, stable-x86_64-pc-windows-gnu, msys2 {0}) (push) Has been cancelled
Doc / deploy (push) Has been cancelled
Some checks failed
Audit / audit (push) Has been cancelled
CI / fmt (push) Has been cancelled
CI / typo (push) Has been cancelled
Deny / audit (push) Has been cancelled
Doc / build (push) Has been cancelled
CI / ci (macos-latest, stable, bash) (push) Has been cancelled
CI / ci (ubuntu-latest, stable, bash) (push) Has been cancelled
CI / ci (windows-latest, stable-x86_64-pc-windows-gnu, msys2 {0}) (push) Has been cancelled
Doc / deploy (push) Has been cancelled
enable lints, fix 1.82 clippy
This commit is contained in:
parent
978d72b6c1
commit
4b350e897d
6 changed files with 15 additions and 8 deletions
|
@ -7,8 +7,8 @@ authors = ["SyntheticBird","Boog900"]
|
|||
|
||||
[dependencies]
|
||||
cuprate-consensus-rules = { path = "../rules", features = ["proptest"]}
|
||||
cuprate-helper = { path = "../../helper", default-features = false, features = ["std", "cast"] }
|
||||
cuprate-types = { path = "../../types", default-features = false }
|
||||
cuprate-helper = { path = "../../helper", default-features = false, features = ["std", "cast", "num", "asynch"] }
|
||||
cuprate-types = { path = "../../types", default-features = false, features = ["blockchain"] }
|
||||
|
||||
futures = { workspace = true, features = ["std", "async-await"] }
|
||||
tokio = { workspace = true, features = ["rt-multi-thread", "macros"]}
|
||||
|
@ -22,3 +22,6 @@ randomx-rs = { workspace = true }
|
|||
rayon = { workspace = true }
|
||||
thread_local = { workspace = true }
|
||||
hex = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
|
@ -329,7 +329,7 @@ fn next_difficulty(
|
|||
}
|
||||
|
||||
// TODO: do checked operations here and unwrap so we don't silently overflow?
|
||||
(windowed_work * hf.block_time().as_secs() as u128 + time_span - 1) / time_span
|
||||
(windowed_work * u128::from(hf.block_time().as_secs()) + time_span - 1) / time_span
|
||||
}
|
||||
|
||||
/// Get the start and end of the window to calculate difficulty.
|
||||
|
|
|
@ -3,7 +3,11 @@
|
|||
//! This crate contains a service to get cached context from the blockchain: [`BlockChainContext`].
|
||||
//! This is used during contextual validation, this does not have all the data for contextual validation
|
||||
//! (outputs) for that you will need a [`Database`].
|
||||
//!
|
||||
|
||||
// Used in documentation references for [`BlockChainContextRequest`]
|
||||
// FIXME: should we pull in a dependency just to link docs?
|
||||
use monero_serai as _;
|
||||
|
||||
use std::{
|
||||
cmp::min,
|
||||
collections::HashMap,
|
||||
|
|
|
@ -11,7 +11,7 @@ proptest = ["cuprate-types/proptest"]
|
|||
rayon = ["dep:rayon"]
|
||||
|
||||
[dependencies]
|
||||
cuprate-constants = { path = "../../constants", default-features = false }
|
||||
cuprate-constants = { path = "../../constants", default-features = false, features = ["block"] }
|
||||
cuprate-helper = { path = "../../helper", default-features = false, features = ["std", "cast"] }
|
||||
cuprate-types = { path = "../../types", default-features = false }
|
||||
cuprate-cryptonight = {path = "../../cryptonight"}
|
||||
|
|
|
@ -63,9 +63,9 @@ where
|
|||
/// An internal function that returns an iterator or a parallel iterator if the
|
||||
/// `rayon` feature is enabled.
|
||||
#[cfg(not(feature = "rayon"))]
|
||||
fn try_par_iter<T>(t: T) -> impl std::iter::Iterator<Item = T::Item>
|
||||
fn try_par_iter<T>(t: T) -> impl Iterator<Item = T::Item>
|
||||
where
|
||||
T: std::iter::IntoIterator,
|
||||
T: IntoIterator,
|
||||
{
|
||||
t.into_iter()
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ pub fn calculate_block_reward(
|
|||
.unwrap();
|
||||
let effective_median_bw: u128 = median_bw.try_into().unwrap();
|
||||
|
||||
(((base_reward as u128 * multiplicand) / effective_median_bw) / effective_median_bw)
|
||||
(((u128::from(base_reward) * multiplicand) / effective_median_bw) / effective_median_bw)
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue