Skip to content

Commit

Permalink
Minor fixes and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-szabo committed Sep 3, 2020
1 parent e924629 commit 78e2b5b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
6 changes: 3 additions & 3 deletions proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
5 changes: 5 additions & 0 deletions proto/src/domaintype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub trait DomainType<T: Message + From<Self>>: 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<B: BufMut>(self, buf: &mut B) -> Result<(), Error>;

Expand All @@ -20,8 +21,12 @@ pub trait DomainType<T: Message + From<Self>>: Sized {
fn decode<B: Buf>(buf: B) -> Result<Self, Error>;

/// Decodes a length-delimited instance of the message from the buffer.
///
/// The entire buffer will be consumed.
fn decode_length_delimited<B: Buf>(buf: B) -> Result<Self, Error>;

/// Returns the encoded length of the message without a length delimiter.
///
/// The DomainType will be consumed.
fn encoded_len(self) -> usize;
}
1 change: 0 additions & 1 deletion tendermint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions tendermint/src/amino_types/block_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8>,
}

Expand All @@ -205,7 +205,7 @@ impl TryFrom<RawCanonicalPartSetHeader> for CanonicalPartSetHeader {

fn try_from(value: RawCanonicalPartSetHeader) -> Result<Self, Self::Error> {
Ok(CanonicalPartSetHeader {
total: value.total as i64,
total: value.total,
hash: value.hash,
})
}
Expand All @@ -214,7 +214,7 @@ impl TryFrom<RawCanonicalPartSetHeader> for CanonicalPartSetHeader {
impl From<CanonicalPartSetHeader> for RawCanonicalPartSetHeader {
fn from(value: CanonicalPartSetHeader) -> Self {
RawCanonicalPartSetHeader {
total: value.total as u32,
total: value.total,
hash: value.hash,
}
}
Expand Down

0 comments on commit 78e2b5b

Please sign in to comment.