diff --git a/crates/papyrus_protobuf/Cargo.toml b/crates/papyrus_protobuf/Cargo.toml index 10833021dc4..071928db6f1 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 ea2eabddb36..82479eec77d 100644 --- a/crates/papyrus_protobuf/src/converters/common.rs +++ b/crates/papyrus_protobuf/src/converters/common.rs @@ -53,7 +53,10 @@ 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).unwrap(), + low: u64::try_from(value & u128::from(u64::MAX)).unwrap(), + } } } diff --git a/crates/papyrus_protobuf/src/converters/consensus.rs b/crates/papyrus_protobuf/src/converters/consensus.rs index 32463367c5f..72d2c5858ee 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()),