diff --git a/crates/papyrus_protobuf/Cargo.toml b/crates/papyrus_protobuf/Cargo.toml index 10833021dc..071928db6f 100644 --- a/crates/papyrus_protobuf/Cargo.toml +++ b/crates/papyrus_protobuf/Cargo.toml @@ -37,3 +37,6 @@ protoc-prebuilt.workspace = true [package.metadata.cargo-machete] # The `rand` and `rand_chacha` crates are used in the `testing` feature, which is optional. ignored = ["rand", "rand_chacha"] + +[lints] +workspace = true diff --git a/crates/papyrus_protobuf/src/converters/common.rs b/crates/papyrus_protobuf/src/converters/common.rs index ea2eabddb3..30ee7a81b7 100644 --- a/crates/papyrus_protobuf/src/converters/common.rs +++ b/crates/papyrus_protobuf/src/converters/common.rs @@ -53,7 +53,11 @@ impl From for protobuf::Address { impl From for protobuf::Uint128 { fn from(value: u128) -> Self { - Self { high: (value >> 64) as u64, low: value as u64 } + Self { + high: u64::try_from(value >> 64).expect("64-bit shift of u128 is a u64."), + low: u64::try_from(value & u128::from(u64::MAX)) + .expect("Bottom 64 bits of u128 are a u64."), + } } } diff --git a/crates/papyrus_protobuf/src/converters/consensus.rs b/crates/papyrus_protobuf/src/converters/consensus.rs index 32463367c5..72d2c5858e 100644 --- a/crates/papyrus_protobuf/src/converters/consensus.rs +++ b/crates/papyrus_protobuf/src/converters/consensus.rs @@ -114,7 +114,7 @@ impl From for protobuf::Vote { }; protobuf::Vote { - vote_type: vote_type as i32, + vote_type: i32::from(vote_type), height: value.height, round: value.round, block_hash: value.block_hash.map(|hash| hash.0.into()),