From 78e2b5b69624bde895ec9ffbcb08474a5b923a9e Mon Sep 17 00:00:00 2001 From: Greg Szabo Date: Thu, 3 Sep 2020 12:01:08 -0400 Subject: [PATCH] Minor fixes and cleanup --- proto/Cargo.toml | 6 +++--- proto/src/domaintype.rs | 5 +++++ tendermint/Cargo.toml | 1 - tendermint/src/amino_types/block_id.rs | 6 +++--- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/proto/Cargo.toml b/proto/Cargo.toml index 1c76fcaf6..72ff2ff2d 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -23,6 +23,6 @@ default = ["tendermint-proto-derive"] prost = { version = "0.6" } prost-types = { version = "0.6" } tendermint-proto-derive = { path = "../proto-derive", optional = true } -bytes = "0.5.6" -anomaly = "0.2.0" -thiserror = "1.0.20" +bytes = "0.5" +anomaly = "0.2" +thiserror = "1.0" diff --git a/proto/src/domaintype.rs b/proto/src/domaintype.rs index bcddf9522..45f6f003f 100644 --- a/proto/src/domaintype.rs +++ b/proto/src/domaintype.rs @@ -11,6 +11,7 @@ pub trait DomainType>: Sized { /// Encodes the DomainType with a length-delimiter to a buffer. /// + /// The DomainType will be consumed. /// An error will be returned if the buffer does not have sufficient capacity. fn encode_length_delimited(self, buf: &mut B) -> Result<(), Error>; @@ -20,8 +21,12 @@ pub trait DomainType>: Sized { fn decode(buf: B) -> Result; /// Decodes a length-delimited instance of the message from the buffer. + /// + /// The entire buffer will be consumed. fn decode_length_delimited(buf: B) -> Result; /// Returns the encoded length of the message without a length delimiter. + /// + /// The DomainType will be consumed. fn encoded_len(self) -> usize; } diff --git a/tendermint/Cargo.toml b/tendermint/Cargo.toml index b966db170..f8d47b276 100644 --- a/tendermint/Cargo.toml +++ b/tendermint/Cargo.toml @@ -40,7 +40,6 @@ futures = "0.3" k256 = { version = "0.4", optional = true, features = ["ecdsa"] } once_cell = "1.3" prost = "0.6" -prost-derive = "0.6" prost-types = "0.6" serde = { version = "1", features = ["derive"] } serde_json = "1" diff --git a/tendermint/src/amino_types/block_id.rs b/tendermint/src/amino_types/block_id.rs index 8df26e546..8708710d1 100644 --- a/tendermint/src/amino_types/block_id.rs +++ b/tendermint/src/amino_types/block_id.rs @@ -196,7 +196,7 @@ impl ConsensusMessage for PartSetHeader { #[derive(Clone, PartialEq, DomainType)] #[rawtype(RawCanonicalPartSetHeader)] pub struct CanonicalPartSetHeader { - pub total: i64, + pub total: u32, pub hash: Vec, } @@ -205,7 +205,7 @@ impl TryFrom for CanonicalPartSetHeader { fn try_from(value: RawCanonicalPartSetHeader) -> Result { Ok(CanonicalPartSetHeader { - total: value.total as i64, + total: value.total, hash: value.hash, }) } @@ -214,7 +214,7 @@ impl TryFrom for CanonicalPartSetHeader { impl From for RawCanonicalPartSetHeader { fn from(value: CanonicalPartSetHeader) -> Self { RawCanonicalPartSetHeader { - total: value.total as u32, + total: value.total, hash: value.hash, } }