Skip to content

Commit 4b350e8

Browse files
authored
consensus-context: enable workspace lints (#321)
enable lints, fix 1.82 clippy
1 parent 978d72b commit 4b350e8

File tree

6 files changed

+15
-8
lines changed

6 files changed

+15
-8
lines changed

consensus/context/Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ authors = ["SyntheticBird","Boog900"]
77

88
[dependencies]
99
cuprate-consensus-rules = { path = "../rules", features = ["proptest"]}
10-
cuprate-helper = { path = "../../helper", default-features = false, features = ["std", "cast"] }
11-
cuprate-types = { path = "../../types", default-features = false }
10+
cuprate-helper = { path = "../../helper", default-features = false, features = ["std", "cast", "num", "asynch"] }
11+
cuprate-types = { path = "../../types", default-features = false, features = ["blockchain"] }
1212

1313
futures = { workspace = true, features = ["std", "async-await"] }
1414
tokio = { workspace = true, features = ["rt-multi-thread", "macros"]}
@@ -22,3 +22,6 @@ randomx-rs = { workspace = true }
2222
rayon = { workspace = true }
2323
thread_local = { workspace = true }
2424
hex = { workspace = true }
25+
26+
[lints]
27+
workspace = true

consensus/context/src/difficulty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ fn next_difficulty(
329329
}
330330

331331
// TODO: do checked operations here and unwrap so we don't silently overflow?
332-
(windowed_work * hf.block_time().as_secs() as u128 + time_span - 1) / time_span
332+
(windowed_work * u128::from(hf.block_time().as_secs()) + time_span - 1) / time_span
333333
}
334334

335335
/// Get the start and end of the window to calculate difficulty.

consensus/context/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
//! This crate contains a service to get cached context from the blockchain: [`BlockChainContext`].
44
//! This is used during contextual validation, this does not have all the data for contextual validation
55
//! (outputs) for that you will need a [`Database`].
6-
//!
6+
7+
// Used in documentation references for [`BlockChainContextRequest`]
8+
// FIXME: should we pull in a dependency just to link docs?
9+
use monero_serai as _;
10+
711
use std::{
812
cmp::min,
913
collections::HashMap,

consensus/rules/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ proptest = ["cuprate-types/proptest"]
1111
rayon = ["dep:rayon"]
1212

1313
[dependencies]
14-
cuprate-constants = { path = "../../constants", default-features = false }
14+
cuprate-constants = { path = "../../constants", default-features = false, features = ["block"] }
1515
cuprate-helper = { path = "../../helper", default-features = false, features = ["std", "cast"] }
1616
cuprate-types = { path = "../../types", default-features = false }
1717
cuprate-cryptonight = {path = "../../cryptonight"}

consensus/rules/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ where
6363
/// An internal function that returns an iterator or a parallel iterator if the
6464
/// `rayon` feature is enabled.
6565
#[cfg(not(feature = "rayon"))]
66-
fn try_par_iter<T>(t: T) -> impl std::iter::Iterator<Item = T::Item>
66+
fn try_par_iter<T>(t: T) -> impl Iterator<Item = T::Item>
6767
where
68-
T: std::iter::IntoIterator,
68+
T: IntoIterator,
6969
{
7070
t.into_iter()
7171
}

consensus/rules/src/miner_tx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub fn calculate_block_reward(
6868
.unwrap();
6969
let effective_median_bw: u128 = median_bw.try_into().unwrap();
7070

71-
(((base_reward as u128 * multiplicand) / effective_median_bw) / effective_median_bw)
71+
(((u128::from(base_reward) * multiplicand) / effective_median_bw) / effective_median_bw)
7272
.try_into()
7373
.unwrap()
7474
}

0 commit comments

Comments
 (0)