Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prep release v0.15.0 #454

Merged
merged 18 commits into from
Jul 20, 2020
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
## Pending
## [0.15.0] (2020-07-17)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should maybe update the date here. I'll merge this for now and publish the crates this afternoon.

This release is mostly about the revamped [light-client] library and the [light-node] command-line interface.
Note that both crates are to be considered experimental software that will still undergo a lot of improvements and iterations.
The goal of releasing an early version of our Light Client is to make it accessible, to get people use it, and to receive feedback.

⚠️ ️Deprecation warning ⚠️ : This might be that last release containing the [lite] module. Please take a look at the [light-client] crate.
liamsi marked this conversation as resolved.
Show resolved Hide resolved

### Light Client:

Expand All @@ -21,6 +26,8 @@
- Add `latest_status` to the supervisor `Handle` ([#449])
- Add JSONRPC endpoints to query the light-node ([#363], [#449])

[0.15.0]: https://github.com/informalsystems/tendermint-rs/pull/454

[#302]: https://github.com/informalsystems/tendermint-rs/pull/302
[#336]: https://github.com/informalsystems/tendermint-rs/pull/336
[#360]: https://github.com/informalsystems/tendermint-rs/pull/360
Expand All @@ -42,11 +49,14 @@

[ADR-007]: https://github.com/informalsystems/tendermint-rs/blob/master/docs/architecture/adr-007-light-client-supervisor-ergonomics.md

[light-node]: ./light-node/README.md

## [0.14.1] (2020-06-23)

- Update `prost-amino`/`prost-amino-derive` to v0.6 ([#367])

[#367]: https://github.com/informalsystems/tendermint-rs/issues/367
[0.14.1]: https://github.com/informalsystems/tendermint-rs/pull/368

## [0.14.0] (2020-06-19)

Expand Down
11 changes: 6 additions & 5 deletions light-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
[package]
name = "tendermint-light-client"
version = "0.14.0"
version = "0.15.0"
authors = ["Romain Ruetschi <romain@informal.systems>"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@romac who would you like to add here? @brapse for sure, and who else?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ git shortlog -n -s -- light-client

shows

    22  Romain Ruetschi
     6  Alexander Simmerl
     4  Ismail Khoffi
     1  Ethan Buchman
     1  Shivani Joshi
     1  yihuang

edition = "2018"
publish = false
license = "Apache-2.0"
keywords = ["blockchain", "bft", "consensus", "cosmos", "tendermint"]

[dependencies]
tendermint = { path = "../tendermint" }
tendermint-rpc = { version = "0.14.0", path = "../rpc", features = ["client"] }
tendermint = { version = "0.15.0", path = "../tendermint" }
tendermint-rpc = { version = "0.15.0", path = "../rpc", features = ["client"] }

anomaly = { version = "0.2.0", features = ["serializer"] }
contracts = "0.4.0"
crossbeam-channel = "0.4.2"
derive_more = "0.99.5"
futures = "0.3.4"
prost-amino = "0.5.0"
prost-amino = "0.6.0"
Copy link
Member Author

@liamsi liamsi Jul 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tarcieri and I recently updated this. This is only to speed up build times. Compare: #368

serde = "1.0.106"
serde_cbor = "0.11.1"
serde_derive = "1.0.106"
Expand Down
9 changes: 5 additions & 4 deletions light-client/src/components/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ pub fn basic_bisecting_schedule(
/// ## Note
///
/// - Case i. captures the case where the light block at height `current_height` has been verified,
/// and we can choose a height closer to the `target_height`. As we get the `light_store` as parameter,
/// the choice of the next height can depend on the `light_store`, e.g., we can pick a height
/// for which we have already downloaded a light block.
/// - In Case ii. the header at `current_height` could not be verified, and we need to pick a lesser height.
/// and we can choose a height closer to the `target_height`. As we get the `light_store` as
/// parameter, the choice of the next height can depend on the `light_store`, e.g., we can pick a
/// height for which we have already downloaded a light block.
/// - In Case ii. the header at `current_height` could not be verified, and we need to pick a lesser
/// height.
/// - In Case iii. is a special case when we have verified the `target_height`.
///
/// ## Implements
Expand Down
6 changes: 2 additions & 4 deletions light-client/src/fork_detector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ pub trait ForkDetector: Send {
/// the given trusted state, and then:
///
/// - If the verification succeeds, we have a real fork
/// - If verification fails because of lack of trust,
/// we have a potential fork.
/// - If verification fails for any other reason, the
/// witness is deemed faulty.
/// - If verification fails because of lack of trust, we have a potential fork.
/// - If verification fails for any other reason, the witness is deemed faulty.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually never enforce the rules we have via CI by running fmt via nightly at least there.
See:

unstable_features = true
# comments
comment_width = 100
wrap_comments = true
# imports
reorder_imports = true
# strings
format_strings = false
max_width = 100

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably change this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah let's remove the nightly-only formatting directives.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ref: #153 and #121

Either remove them or reject PRs via CI that do not comply with these rules.

pub struct ProdForkDetector {
hasher: Box<dyn Hasher>,
}
Expand Down
34 changes: 19 additions & 15 deletions light-client/src/light_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ impl LightClient {
///
/// This is the main function and uses the following components:
///
/// - The I/O component is called to fetch the next light block.
/// It is the only component that communicates with other nodes.
/// - The Verifier component checks whether a header is valid and checks if a new
/// light block should be trusted based on a previously verified light block.
/// - The Scheduler component decides which height to try to verify next, in case
/// the current block pass verification but cannot be trusted yet.
/// - The I/O component is called to fetch the next light block. It is the only component that
/// communicates with other nodes.
/// - The Verifier component checks whether a header is valid and checks if a new light block
/// should be trusted based on a previously verified light block.
/// - The Scheduler component decides which height to try to verify next, in case the current
/// block pass verification but cannot be trusted yet.
///
/// ## Implements
/// - [LCV-DIST-SAFE.1]
Expand All @@ -120,8 +120,8 @@ impl LightClient {
/// - The light store contains a light block within the trusting period [LCV-PRE-TP.1]
///
/// ## Postcondition
/// - The light store contains a light block that corresponds
/// to a block of the blockchain of height `target_height` [LCV-POST-LS.1]
/// - The light store contains a light block that corresponds to a block of the blockchain of
/// height `target_height` [LCV-POST-LS.1]
///
/// ## Error conditions
/// - If the precondition is violated [LVC-PRE-TP.1]
Expand All @@ -146,7 +146,8 @@ impl LightClient {
target_height: Height,
state: &mut State,
) -> Result<LightBlock, Error> {
// Let's first look in the store to see whether we have already successfully verified this block
// Let's first look in the store to see whether we have already successfully verified this
// block
liamsi marked this conversation as resolved.
Show resolved Hide resolved
if let Some(light_block) = state.light_store.get_trusted_or_verified(target_height) {
return Ok(light_block);
}
Expand Down Expand Up @@ -180,7 +181,8 @@ impl LightClient {
// Log the current height as a dependency of the block at the target height
state.trace_block(target_height, current_height);

// If the trusted state is now at a height equal to the target height, we are done. [LCV-DIST-LIFE.1]
// If the trusted state is now at a height equal to the target height, we are done.
// [LCV-DIST-LIFE.1]
if target_height == trusted_state.height() {
return Ok(trusted_state);
}
Expand All @@ -202,16 +204,18 @@ impl LightClient {
state.light_store.update(&current_block, new_status);
}
Verdict::Invalid(e) => {
// Verification failed, add the block to the light store with `Failed` status, and abort.
// Verification failed, add the block to the light store with `Failed` status,
// and abort.
state.light_store.update(&current_block, Status::Failed);

bail!(ErrorKind::InvalidLightBlock(e))
}
Verdict::NotEnoughTrust(_) => {
// The current block cannot be trusted because of missing overlap in the validator sets.
// Add the block to the light store with `Unverified` status.
// This will engage bisection in an attempt to raise the height of the highest
// trusted state until there is enough overlap.
// The current block cannot be trusted because of missing overlap in the
liamsi marked this conversation as resolved.
Show resolved Hide resolved
// validator sets. Add the block to the light store with
// `Unverified` status. This will engage bisection in an
liamsi marked this conversation as resolved.
Show resolved Hide resolved
// attempt to raise the height of the highest trusted state
// until there is enough overlap.
state.light_store.update(&current_block, Status::Unverified);
}
}
Expand Down
3 changes: 2 additions & 1 deletion light-client/src/supervisor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ impl Supervisor {
self.verify(Some(height))
}

/// Verify either to the latest block (if `height == None`) or to a given block (if `height == Some(height)`).
/// Verify either to the latest block (if `height == None`) or to a given block (if `height ==
/// Some(height)`).
fn verify(&mut self, height: Option<Height>) -> Result<LightBlock, Error> {
let primary = self.peers.primary_mut();

Expand Down
19 changes: 14 additions & 5 deletions light-node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
[package]
name = "tendermint-light-node"
authors = ["Ethan Buchman <ethan@coinculture.info>", "Ismail Khoffi <Ismail.Khoffi@gmail.com>"]
version = "0.14.0"
version = "0.15.0"
edition = "2018"
publish = false
license = "Apache-2.0"
repository = "https://github.com/informalsystems/tendermint-rs"
readme = "README.md"
keywords = ["blockchain", "bft", "consensus", "cosmos", "tendermint"]

description = """
The Tendermint light-node wraps the light-client crate into a command-line interface tool.
It can be used as a standalone light client daemon and exposes a JSONRPC endpoint from which you can
query the current state of the light node.
"""

[dependencies]
abscissa_tokio = "0.5"
Expand All @@ -17,9 +26,9 @@ jsonrpc-derive = "14.2"
serde = { version = "1", features = ["serde_derive"] }
serde_json = "1.0"
sled = "0.31.0"
tendermint = { version = "0.14.0", path = "../tendermint" }
tendermint-light-client = { version = "0.14.0", path = "../light-client" }
tendermint-rpc = { version = "0.14.0", path = "../rpc", features = [ "client" ] }
tendermint = { version = "0.15.0", path = "../tendermint" }
tendermint-light-client = { version = "0.15.0", path = "../light-client" }
tendermint-rpc = { version = "0.15.0", path = "../rpc", features = [ "client" ] }
thiserror = "1.0"
tokio = { version = "0.2", features = ["full"] }

Expand Down
2 changes: 1 addition & 1 deletion light-node/src/bin/light-node/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Main entry point for LightNode
//! Main entry point for light-node
liamsi marked this conversation as resolved.
Show resolved Hide resolved

#![deny(warnings, missing_docs, trivial_casts, unused_qualifications)]
#![forbid(unsafe_code)]
Expand Down
4 changes: 2 additions & 2 deletions light-node/src/commands/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ use tendermint_light_client::supervisor::Handle;
use tendermint_light_client::supervisor::{Instance, Supervisor};

/// `start` subcommand
///
#[derive(Command, Debug, Options)]
pub struct StartCmd {
/// Path to configuration file
Expand Down Expand Up @@ -93,7 +92,8 @@ impl config::Override<LightNodeConfig> for StartCmd {
&self,
mut config: LightNodeConfig,
) -> Result<LightNodeConfig, FrameworkError> {
// TODO(liamsi): figure out if other options would be reasonable to overwrite via CLI arguments.
// TODO(liamsi): figure out if other options would be reasonable to overwrite via CLI
// arguments.
if let Some(addr) = self.listen_addr {
config.rpc_config.listen_addr = addr;
}
Expand Down
8 changes: 4 additions & 4 deletions light-node/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! LightNode
//! Light-Node
liamsi marked this conversation as resolved.
Show resolved Hide resolved
//!
//! Application based on the [Abscissa] framework.
//!
//! [Abscissa]: https://github.com/iqlusioninc/abscissa
//! The Tendermint light-node wraps the light-client crate into a command-line interface tool.
//! It can be used as a standalone light client daemon and exposes a JSONRPC endpoint
//! from which you can query the current state of the light node.

// Tip: Deny warnings with `RUSTFLAGS="-D warnings"` environment variable in CI

Expand Down
8 changes: 4 additions & 4 deletions light-node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ pub use sealed::{Client, Rpc, Server};

/// Run the given [`Server`] on the given address and blocks until closed.
///
/// n.b. The underlying server has semantics to close on drop. Also does it does not offer any way to
/// get the underlying Future to await, so we are left with this rather rudimentary way to control
/// the lifecycle. Should we be interested in a more controlled way to close the server we can
/// expose a handle in the future.
/// n.b. The underlying server has semantics to close on drop. Also does it does not offer any way
liamsi marked this conversation as resolved.
Show resolved Hide resolved
/// to get the underlying Future to await, so we are left with this rather rudimentary way to
/// control the lifecycle. Should we be interested in a more controlled way to close the server we
/// can expose a handle in the future.
pub fn run<H>(server: Server<H>, addr: &str) -> Result<(), error::Error>
where
H: Handle + Send + Sync + 'static,
Expand Down
4 changes: 2 additions & 2 deletions rpc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tendermint-rpc"
version = "0.14.0"
version = "0.15.0"
authors = ["Alexander Simmerl <a.simmerl@gmail.com>"]
edition = "2018"
license = "Apache-2.0"
Expand Down Expand Up @@ -28,7 +28,7 @@ getrandom = "0.1"
serde = { version = "1", features = [ "derive" ] }
serde_bytes = "0.11"
serde_json = "1"
tendermint = { version = "0.14.0", path = "../tendermint" }
tendermint = { version = "0.15.0", path = "../tendermint" }
thiserror = "1"
uuid = { version = "0.8", default-features = false }

Expand Down
4 changes: 2 additions & 2 deletions tendermint/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "tendermint"
version = "0.14.1" # Also update `html_root_url` in lib.rs and
version = "0.15.0" # Also update `html_root_url` in lib.rs and
# depending crates (rpc, light-node, ..) when bumping this
license = "Apache-2.0"
homepage = "https://www.tendermint.com/"
repository = "https://github.com/interchainio/tendermint-rs/tree/master/tendermint"
repository = "https://github.com/informalsystems/tendermint-rs/tree/master/tendermint"
readme = "../README.md"
categories = ["cryptography", "cryptography::cryptocurrencies", "database"]
keywords = ["blockchain", "bft", "consensus", "cosmos", "tendermint"]
Expand Down
2 changes: 1 addition & 1 deletion tendermint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
)]
#![forbid(unsafe_code)]
#![doc(
html_root_url = "https://docs.rs/tendermint/0.14.1",
html_root_url = "https://docs.rs/tendermint/0.15.0",
html_logo_url = "https://raw.githubusercontent.com/informalsystems/tendermint-rs/master/img/logo-tendermint-rs.png"
)]

Expand Down
2 changes: 1 addition & 1 deletion tendermint/src/lite/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl TrustThresholdFraction {
/// numerator are valid.
///
/// The parameters are valid iff `1/3 <= numerator/denominator <= 1`.
/// In any other case we return [`Error::InvalidTrustThreshold`].
/// In any other case we return [`Kind::InvalidTrustThreshold`].
pub fn new(numerator: u64, denominator: u64) -> Result<Self, Error> {
if numerator <= denominator && denominator > 0 && 3 * numerator >= denominator {
return Ok(Self {
Expand Down
4 changes: 2 additions & 2 deletions tendermint/src/lite_impl/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ mod test {
fn test_hash_height_1() {
// JSON extracted from https://github.com/tendermint/tendermint/tree/v0.33
// more precisely `curl`ed from locally build docker image of:
// git log --pretty=format:"%H" -1 15:35:44
// git log --pretty=format:"%H" -1
// 606d0a89ccabbd3e59cff521f9f4d875cc366ac9
// via
// curl -X GET "http://localhost:26657/commit?height=1" -H "accept: application/json" | jq .result.signed_header.header
Expand Down Expand Up @@ -135,7 +135,7 @@ mod test {
fn test_hash_height_2() {
// JSON test-vector extracted from https://github.com/tendermint/tendermint/tree/v0.33
// more precisely `curl`ed from locally build docker image of:
// git log --pretty=format:"%H" -1 15:35:44
// git log --pretty=format:"%H" -1
// 606d0a89ccabbd3e59cff521f9f4d875cc366ac9
// via
// curl -X GET "http://localhost:26657/commit?height=2" -H "accept: application/json" | jq .result.signed_header.header
Expand Down