Skip to content

Commit

Permalink
Update dependencies and fix new warnings
Browse files Browse the repository at this point in the history
A partial backport of #1388, non-breaking changes only.
  • Loading branch information
mzabaluev committed Feb 21, 2024
1 parent bfc7c57 commit 1bee917
Show file tree
Hide file tree
Showing 18 changed files with 44 additions and 55 deletions.
2 changes: 1 addition & 1 deletion abci/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ tendermint-proto = { version = "0.34.0", default-features = false, path = "../pr
tracing = { version = "0.1", default-features = false }
flex-error = { version = "0.4.4", default-features = false }
structopt = { version = "0.3", optional = true, default-features = false }
tracing-subscriber = { version = "0.2", optional = true, default-features = false }
tracing-subscriber = { version = "0.3", optional = true, default-features = false }
1 change: 0 additions & 1 deletion light-client-detector/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ tendermint-rpc = { version = "0.34.0", path = "../rpc", features = ["http-client
tendermint-proto = { version = "0.34.0", path = "../proto" }
tendermint-light-client = { version = "0.34.0", path = "../light-client" }

contracts = { version = "0.6.2", default-features = false }
crossbeam-channel = { version = "0.4.2", default-features = false }
derive_more = { version = "0.99.5", default-features = false, features = ["display"] }
futures = { version = "0.3.4", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion light-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ tendermint-testgen = { path = "../testgen", default-features = false }

serde_json = { version = "1.0.51", default-features = false }
gumdrop = { version = "0.8.0", default-features = false }
rand = { version = "0.7.3", default-features = false }
rand = { version = "0.8.3", default-features = false }
tempfile = { version = "3.2.0", default-features = false }
proptest = { version = "0.10.1", default-features = false, features = ["std"] }
2 changes: 1 addition & 1 deletion light-client/tests/backward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn make(chain: LightChain, trusted_height: Height) -> (LightClient, State) {
let primary = default_peer_id();

let clock = MockClock {
/// Set the current time to be ahead of the latest block in the chain
// Set the current time to be ahead of the latest block in the chain
now: tendermint_testgen::helpers::get_time(chain.light_blocks.len() as u64 + 1).unwrap(),
};

Expand Down
6 changes: 3 additions & 3 deletions light-client/tests/model_based.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ mod mbt {
None
} else {
let mut rng = rand::thread_rng();
let i = rng.gen_range(0, indices.len());
let i = rng.gen_range(0..indices.len());
Some((i, tc.input.get_mut(i).unwrap()))
}
}
Expand Down Expand Up @@ -170,7 +170,7 @@ mod mbt {
fn fuzz_input(input: &mut BlockVerdict) -> (String, LiteVerdict) {
let mut rng = rand::thread_rng();
let h: u64 = input.block.signed_header.header.height.into();
let mut height: u64 = rng.gen_range(0u64, i64::MAX as u64);
let mut height: u64 = rng.gen_range(0u64..i64::MAX as u64);
while height == h {
height = rng.gen();
}
Expand All @@ -190,7 +190,7 @@ mod mbt {
.duration_since(tendermint::Time::unix_epoch())
.unwrap()
.as_secs();
let rand_secs = rng.gen_range(1, secs);
let rand_secs = rng.gen_range(1..secs);
input.block.signed_header.header.time = (tendermint::Time::unix_epoch()
+ std::time::Duration::from_secs(rand_secs))
.unwrap();
Expand Down
3 changes: 1 addition & 2 deletions p2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ amino = ["prost-derive"]
chacha20poly1305 = { version = "0.10", default-features = false, features = ["reduced-round"] }
ed25519-consensus = { version = "2", default-features = false }
eyre = { version = "0.6", default-features = false }
flume = { version = "0.10.7", default-features = false }
hkdf = { version = "0.12.3", default-features = false }
merlin = { version = "2", default-features = false }
merlin = { version = "3", default-features = false }
prost = { version = "0.12", default-features = false }
rand_core = { version = "0.5", default-features = false, features = ["std"] }
sha2 = { version = "0.10", default-features = false }
Expand Down
1 change: 0 additions & 1 deletion p2p/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#![forbid(unsafe_code)]
#![deny(
nonstandard_style,
private_in_public,
rust_2018_idioms,
trivial_casts,
trivial_numeric_casts,
Expand Down
11 changes: 6 additions & 5 deletions rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@ tendermint-proto = { version = "0.34.0", path = "../proto", default-features = f
async-trait = { version = "0.1", default-features = false }
bytes = { version = "1.0", default-features = false }
getrandom = { version = "0.2", default-features = false, features = ["js"] }
peg = { version = "0.7.0", default-features = false }
peg = { version = "0.8", default-features = false }
pin-project = { version = "1.0.1", default-features = false }
serde = { version = "1", default-features = false, features = [ "derive" ] }
serde_bytes = { version = "0.11", default-features = false }
serde_json = { version = "1", default-features = false, features = ["std"] }
thiserror = { version = "1", default-features = false }
time = { version = "0.3", default-features = false, features = ["macros", "parsing"] }
uuid = { version = "0.8", default-features = false }
uuid = { version = "1.7", default-features = false }
rand = { version = "0.8" }
subtle-encoding = { version = "0.5", default-features = false, features = ["bech32-preview"] }
url = { version = "2.4.1", default-features = false }
walkdir = { version = "2.3", default-features = false }
Expand All @@ -78,15 +79,15 @@ subtle = { version = "2", default-features = false }
semver = { version = "1.0", default-features = false }

# Optional dependencies
async-tungstenite = { version = "0.23", default-features = false, features = ["tokio-runtime", "tokio-rustls-native-certs"], optional = true }
async-tungstenite = { version = "0.24", default-features = false, features = ["tokio-runtime", "tokio-rustls-native-certs"], optional = true }
futures = { version = "0.3", optional = true, default-features = false }
reqwest = { version = "0.11.20", optional = true, default-features = false, features = ["rustls-tls-native-roots"] }
structopt = { version = "0.3", optional = true, default-features = false }
tokio = { version = "1.0", optional = true, default-features = false, features = ["rt-multi-thread"] }
tracing = { version = "0.1", optional = true, default-features = false }
tracing-subscriber = { version = "0.2", optional = true, default-features = false, features = ["fmt"] }
tracing-subscriber = { version = "0.3", optional = true, default-features = false, features = ["fmt"] }

[dev-dependencies]
http = { version = "0.2", default-features = false }
http = { version = "1", default-features = false, features = ["std"] }
lazy_static = { version = "1.4.0", default-features = false }
tokio-test = { version = "0.4", default-features = false }
12 changes: 3 additions & 9 deletions rpc/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
//! Utility methods for the Tendermint RPC crate.

use getrandom::getrandom;
use rand::Rng;

use crate::prelude::*;

/// Produce a string containing a UUID.
///
/// Panics if random number generation fails.
pub fn uuid_str() -> String {
let mut bytes = [0; 16];
getrandom(&mut bytes).expect("RNG failure!");

let uuid = uuid::Builder::from_bytes(bytes)
.set_variant(uuid::Variant::RFC4122)
.set_version(uuid::Version::Random)
.build();

let bytes: [u8; 16] = rand::thread_rng().gen();
let uuid = uuid::Builder::from_random_bytes(bytes).into_uuid();
uuid.to_string()
}
14 changes: 7 additions & 7 deletions rpc/tests/kvstore_fixtures/v0_34.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ fn incoming_fixtures() {
},
"block_at_height_1" => {
let result = endpoint::block::Response::from_string(content).unwrap();
assert!(result.block.data.get(0).is_none());
assert!(result.block.data.first().is_none());
assert!(result.block.evidence.iter().next().is_none());
assert!(result.block.header.app_hash.as_bytes().is_empty());
assert_eq!(result.block.header.chain_id.as_str(), CHAIN_ID);
Expand Down Expand Up @@ -373,7 +373,7 @@ fn incoming_fixtures() {
},
"block_at_height_10" => {
let result = endpoint::block::Response::from_string(content).unwrap();
assert!(result.block.data.get(0).is_none());
assert!(result.block.data.first().is_none());
assert!(result.block.evidence.iter().next().is_none());
assert_eq!(result.block.header.app_hash.as_bytes(), &[0u8; 8]);
assert_eq!(result.block.header.chain_id.as_str(), CHAIN_ID);
Expand Down Expand Up @@ -813,7 +813,7 @@ fn incoming_fixtures() {
} = result.data.into()
{
let b = block.unwrap();
assert!(b.data.get(0).is_none());
assert!(b.data.first().is_none());
assert!(b.evidence.iter().next().is_none());
assert!(!b.header.app_hash.as_bytes().is_empty());
assert_eq!(b.header.chain_id.as_str(), CHAIN_ID);
Expand Down Expand Up @@ -868,7 +868,7 @@ fn incoming_fixtures() {
} = result.data.into()
{
let b = block.unwrap();
assert!(b.data.get(0).is_none());
assert!(b.data.first().is_none());
assert!(b.evidence.iter().next().is_none());
assert!(!b.header.app_hash.as_bytes().is_empty());
assert_eq!(b.header.chain_id.as_str(), CHAIN_ID);
Expand Down Expand Up @@ -945,7 +945,7 @@ fn incoming_fixtures() {
} = result.data.into()
{
let b = block.unwrap();
assert!(b.data.get(0).is_none());
assert!(b.data.first().is_none());
assert!(b.evidence.iter().next().is_none());
assert!(!b.header.app_hash.as_bytes().is_empty());
assert_eq!(b.header.chain_id.as_str(), CHAIN_ID);
Expand Down Expand Up @@ -1000,7 +1000,7 @@ fn incoming_fixtures() {
} = result.data.into()
{
let b = block.unwrap();
assert!(b.data.get(0).is_none());
assert!(b.data.first().is_none());
assert!(b.evidence.iter().next().is_none());
assert!(!b.header.app_hash.as_bytes().is_empty());
assert_eq!(b.header.chain_id.as_str(), CHAIN_ID);
Expand Down Expand Up @@ -1055,7 +1055,7 @@ fn incoming_fixtures() {
} = result.data.into()
{
let b = block.unwrap();
assert!(b.data.get(0).is_none());
assert!(b.data.first().is_none());
assert!(b.evidence.iter().next().is_none());
assert!(!b.header.app_hash.as_bytes().is_empty());
assert_eq!(b.header.chain_id.as_str(), CHAIN_ID);
Expand Down
14 changes: 7 additions & 7 deletions rpc/tests/kvstore_fixtures/v0_37.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ fn incoming_fixtures() {
},
"block_at_height_1" => {
let result = endpoint::block::Response::from_string(content).unwrap();
assert!(result.block.data.get(0).is_none());
assert!(result.block.data.first().is_none());
assert!(result.block.evidence.iter().next().is_none());
assert!(result.block.header.app_hash.as_bytes().is_empty());
assert_eq!(result.block.header.chain_id.as_str(), CHAIN_ID);
Expand Down Expand Up @@ -372,7 +372,7 @@ fn incoming_fixtures() {
},
"block_at_height_10" => {
let result = endpoint::block::Response::from_string(content).unwrap();
assert!(result.block.data.get(0).is_none());
assert!(result.block.data.first().is_none());
assert!(result.block.evidence.iter().next().is_none());
assert_eq!(result.block.header.app_hash.as_bytes(), &[0u8; 8]);
assert_eq!(result.block.header.chain_id.as_str(), CHAIN_ID);
Expand Down Expand Up @@ -807,7 +807,7 @@ fn incoming_fixtures() {
} = result.data.into()
{
let b = block.unwrap();
assert!(b.data.get(0).is_none());
assert!(b.data.first().is_none());
assert!(b.evidence.iter().next().is_none());
assert!(!b.header.app_hash.as_bytes().is_empty());
assert_eq!(b.header.chain_id.as_str(), CHAIN_ID);
Expand Down Expand Up @@ -862,7 +862,7 @@ fn incoming_fixtures() {
} = result.data.into()
{
let b = block.unwrap();
assert!(b.data.get(0).is_none());
assert!(b.data.first().is_none());
assert!(b.evidence.iter().next().is_none());
assert!(!b.header.app_hash.as_bytes().is_empty());
assert_eq!(b.header.chain_id.as_str(), CHAIN_ID);
Expand Down Expand Up @@ -939,7 +939,7 @@ fn incoming_fixtures() {
} = result.data.into()
{
let b = block.unwrap();
assert!(b.data.get(0).is_none());
assert!(b.data.first().is_none());
assert!(b.evidence.iter().next().is_none());
assert!(!b.header.app_hash.as_bytes().is_empty());
assert_eq!(b.header.chain_id.as_str(), CHAIN_ID);
Expand Down Expand Up @@ -994,7 +994,7 @@ fn incoming_fixtures() {
} = result.data.into()
{
let b = block.unwrap();
assert!(b.data.get(0).is_none());
assert!(b.data.first().is_none());
assert!(b.evidence.iter().next().is_none());
assert!(!b.header.app_hash.as_bytes().is_empty());
assert_eq!(b.header.chain_id.as_str(), CHAIN_ID);
Expand Down Expand Up @@ -1049,7 +1049,7 @@ fn incoming_fixtures() {
} = result.data.into()
{
let b = block.unwrap();
assert!(b.data.get(0).is_none());
assert!(b.data.first().is_none());
assert!(b.evidence.iter().next().is_none());
assert!(!b.header.app_hash.as_bytes().is_empty());
assert_eq!(b.header.chain_id.as_str(), CHAIN_ID);
Expand Down
14 changes: 7 additions & 7 deletions rpc/tests/kvstore_fixtures/v0_38.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ fn incoming_fixtures() {
},
"block_at_height_1" => {
let result = endpoint::block::Response::from_string(content).unwrap();
assert!(result.block.data.get(0).is_none());
assert!(result.block.data.first().is_none());
assert!(result.block.evidence.iter().next().is_none());
assert_eq!(result.block.header.app_hash.as_bytes(), [0u8; 8]);
assert_eq!(result.block.header.chain_id.as_str(), CHAIN_ID);
Expand Down Expand Up @@ -372,7 +372,7 @@ fn incoming_fixtures() {
},
"block_at_height_10" => {
let result = endpoint::block::Response::from_string(content).unwrap();
assert!(result.block.data.get(0).is_none());
assert!(result.block.data.first().is_none());
assert!(result.block.evidence.iter().next().is_none());
assert_eq!(result.block.header.app_hash.as_bytes(), &[0u8; 8]);
assert_eq!(result.block.header.chain_id.as_str(), CHAIN_ID);
Expand Down Expand Up @@ -806,7 +806,7 @@ fn incoming_fixtures() {
} = result.data.into()
{
let b = block.unwrap();
assert!(b.data.get(0).is_none());
assert!(b.data.first().is_none());
assert!(b.evidence.iter().next().is_none());
assert!(!b.header.app_hash.as_bytes().is_empty());
assert_eq!(b.header.chain_id.as_str(), CHAIN_ID);
Expand Down Expand Up @@ -864,7 +864,7 @@ fn incoming_fixtures() {
} = result.data.into()
{
let b = block.unwrap();
assert!(b.data.get(0).is_none());
assert!(b.data.first().is_none());
assert!(b.evidence.iter().next().is_none());
assert!(!b.header.app_hash.as_bytes().is_empty());
assert_eq!(b.header.chain_id.as_str(), CHAIN_ID);
Expand Down Expand Up @@ -922,7 +922,7 @@ fn incoming_fixtures() {
} = result.data.into()
{
let b = block.unwrap();
assert!(b.data.get(0).is_none());
assert!(b.data.first().is_none());
assert!(b.evidence.iter().next().is_none());
assert!(!b.header.app_hash.as_bytes().is_empty());
assert_eq!(b.header.chain_id.as_str(), CHAIN_ID);
Expand Down Expand Up @@ -980,7 +980,7 @@ fn incoming_fixtures() {
} = result.data.into()
{
let b = block.unwrap();
assert!(b.data.get(0).is_none());
assert!(b.data.first().is_none());
assert!(b.evidence.iter().next().is_none());
assert!(!b.header.app_hash.as_bytes().is_empty());
assert_eq!(b.header.chain_id.as_str(), CHAIN_ID);
Expand Down Expand Up @@ -1038,7 +1038,7 @@ fn incoming_fixtures() {
} = result.data.into()
{
let b = block.unwrap();
assert!(b.data.get(0).is_none());
assert!(b.data.first().is_none());
assert!(b.evidence.iter().next().is_none());
assert!(!b.header.app_hash.as_bytes().is_empty());
assert_eq!(b.header.chain_id.as_str(), CHAIN_ID);
Expand Down
2 changes: 1 addition & 1 deletion tendermint/src/chain/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl Id {

/// Get the chain ID as a raw bytes.
pub fn as_bytes(&self) -> &[u8] {
self.0.as_str().as_bytes()
self.0.as_bytes()
}
}

Expand Down
3 changes: 1 addition & 2 deletions tendermint/src/crypto/ed25519/signing_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ impl TryFrom<SigningKey> for ed25519_consensus::SigningKey {
type Error = Error;

fn try_from(src: SigningKey) -> Result<Self, Error> {
ed25519_consensus::SigningKey::try_from(src.0)
.map_err(|_| Error::invalid_key("malformed Ed25519 private key".into()))
Ok(ed25519_consensus::SigningKey::from(src.0))
}
}
2 changes: 1 addition & 1 deletion tendermint/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ define_error! {

InvalidPartSetHeader
{ detail : String }
|_| { format_args!("invalid part set header") },
|e| { format_args!("invalid part set header: {}", e.detail) },

MissingHeader
|_| { format_args!("missing header field") },
Expand Down
4 changes: 2 additions & 2 deletions test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ test = true
[dev-dependencies]
ed25519-consensus = { version = "2", default-features = false }
flex-error = { version = "0.4.4", default-features = false }
flume = { version = "0.10", default-features = false }
flume = { version = "0.11", default-features = false }
rand_core = { version = "0.6", default-features = false, features = ["std"] }
readwrite = { version = "^0.1.1", default-features = false }
readwrite = { version = "0.2.0", default-features = false }
subtle-encoding = { version = "0.5", default-features = false }
x25519-dalek = { version = "1.1", default-features = false }

Expand Down
2 changes: 1 addition & 1 deletion testgen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ serde = { version = "1", default-features = false, features = ["derive"] }
serde_json = { version = "1", default-features = false, features = ["std"] }
ed25519-consensus = { version = "2", default-features = false }
gumdrop = { version = "0.8.0", default-features = false }
simple-error = { version = "0.2.1", default-features = false }
simple-error = { version = "0.3.0", default-features = false }
tempfile = { version = "3.1.0", default-features = false }
time = { package = "time", version = "0.3", default-features = false, features = ["std"] }

Expand Down
4 changes: 1 addition & 3 deletions testgen/src/tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,7 @@ impl Tester {
}

fn results_for(&mut self, name: &str) -> &mut Vec<(String, TestResult)> {
self.results
.entry(name.to_string())
.or_insert_with(Vec::new)
self.results.entry(name.to_string()).or_default()
}

fn add_result(&mut self, name: &str, path: &str, result: TestResult) {
Expand Down

0 comments on commit 1bee917

Please sign in to comment.