-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use concrete basic types for time, hash, bytes, validator id * cargo fmt * into_iter unnecessarily moves the Vec (clippy) * Resolve a bunch of clippy warnings about: https://rust-lang.github.io/rust-clippy/master/#try_err * make the lite client a module instead of a separate crate: This is just the simplest way to move forward implementing the traits of the lite package. There are alternatives: We do not want a create a circular dependency between lite and tendermint (which does not even compile). To avoid this we could: 1) make lite a module of tendermint, or, 2) replicate a lot of the types of the tendermint crate in the lite package (e.g. Time, Ids etc), or 3) have a dependency from tendermint to the lite package only (but then the trait impls do need to live in the lite crate instead with the types in the tendermint crate directly). * add amino type for header Version * working towards hashing the header: conversion between fields and their respective amino types, and, directly encode some * Header::hash works now (tested against JSON fixture only and yields: 2DC46AD76277039F1B65FE3C7F2064788B1C12FE701CFE7EC93F751586A48781) will add a test after #42 gets merged * remove todo * implement lite::Validator trait * implement lite::ValidatorSet trait * implement lite::Vote trait * bring back BufMut; fix clippy warnings * Address some review comments: - Consistency: Rename encode_bytes to bytes_enc - remove redundant return statement * Consistency: From<&vote::Vote> same order as the fields in the struct * deduplicate encoding a hash: add a helper * deduplicate encoding hashes and varints: add a helper for each * simplify sign_bytes to return Vec<u8> instead of passing in a BufMut * Add test for lite::Header.hash() in rpc tests * wrap the CanonicalVote in a struct that contains the validator ID and the signature
- Loading branch information
Showing
13 changed files
with
277 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use crate::block::*; | ||
|
||
#[derive(Clone, Message)] | ||
pub struct ConsensusVersion { | ||
/// Block version | ||
#[prost(uint64, tag = "1")] | ||
pub block: u64, | ||
|
||
/// App version | ||
#[prost(uint64, tag = "2")] | ||
pub app: u64, | ||
} | ||
|
||
impl From<&header::Version> for ConsensusVersion { | ||
fn from(version: &header::Version) -> Self { | ||
ConsensusVersion { | ||
block: version.block, | ||
app: version.app, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub use self::types::*; | ||
pub mod types; | ||
pub mod verifier; | ||
|
||
pub use self::types::*; | ||
pub use self::verifier::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.