-
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.
Split out verifier parts of
tendermint-light-client
to `tendermint-…
…light-client-verifier` (#1071) * Split out verifier parts of tendermint-light-client to tendermint-light-client-verifier * Add Time::now() method behind clock feature * light-client refactor: Re-export new verifier crate from `tendermint-light-client` (#1074) * Re-export tendermint_light_client_verifier as verifier from tendermint_light_client Signed-off-by: Thane Thomson <[email protected]> * Remove unnecessary tendermint-light-client import Signed-off-by: Thane Thomson <[email protected]> * Fix crate docs to reflect verifier extraction Signed-off-by: Thane Thomson <[email protected]> * Add changelog entry Signed-off-by: Thane Thomson <[email protected]> * Re-export the original exports in light-client crate Co-authored-by: Thane Thomson <[email protected]>
- Loading branch information
1 parent
8d77986
commit b52a5af
Showing
48 changed files
with
305 additions
and
187 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
.changelog/unreleased/breaking-changes/1027-light-client-verifier.md
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,5 @@ | ||
- `[tendermint-light-client]` Split out the verification functionality from the | ||
`tendermint-light-client` crate into its own `no_std`-compatible crate: | ||
`tendermint-light-client-verifier`. This helps move us closer to `no_std` | ||
compliance in both tendermint-rs and ibc-rs | ||
([#1027](https://github.com/informalsystems/tendermint-rs/issues/1027)) |
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
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,38 @@ | ||
[package] | ||
name = "tendermint-light-client-verifier" | ||
version = "0.23.0" | ||
edition = "2021" | ||
license = "Apache-2.0" | ||
readme = "README.md" | ||
keywords = ["blockchain", "bft", "consensus", "cosmos", "tendermint"] | ||
categories = ["cryptography::cryptocurrencies", "network-programming"] | ||
repository = "https://github.com/informalsystems/tendermint-rs" | ||
authors = [ | ||
"Informal Systems <[email protected]>", | ||
] | ||
|
||
description = """ | ||
Implementation of the Tendermint Light Client Verification Algorithm. | ||
""" | ||
|
||
# docs.rs-specific configuration | ||
[package.metadata.docs.rs] | ||
# document all features | ||
all-features = true | ||
# defines the configuration attribute `docsrs` | ||
rustdoc-args = ["--cfg", "docsrs"] | ||
|
||
[features] | ||
default = ["flex-error/std", "flex-error/eyre_tracer"] | ||
|
||
[dependencies] | ||
tendermint = { version = "0.23.0", path = "../tendermint", default-features = false } | ||
tendermint-rpc = { version = "0.23.0", path = "../rpc", default-features = false } | ||
|
||
derive_more = { version = "0.99.5", default-features = false, features = ["display"] } | ||
serde = { version = "1.0.106", default-features = false } | ||
time = { version = "0.3.5", default-features = false } | ||
flex-error = { version = "0.4.4", default-features = false } | ||
|
||
[dev-dependencies] | ||
tendermint-testgen = { path = "../testgen", default-features = false } |
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,14 @@ | ||
#![no_std] | ||
|
||
extern crate alloc; | ||
|
||
mod prelude; | ||
|
||
pub mod errors; | ||
pub mod operations; | ||
pub mod options; | ||
pub mod predicates; | ||
pub mod types; | ||
mod verifier; | ||
|
||
pub use verifier::{PredicateVerifier, ProdVerifier, Verdict, Verifier}; |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...client/src/operations/commit_validator.rs → ...rifier/src/operations/commit_validator.rs
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
File renamed without changes.
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,30 @@ | ||
//! Light client implementation as per the [Core Verification specification][1]. | ||
//! | ||
//! [1]: https://github.com/informalsystems/tendermint-rs/blob/master/docs/spec/lightclient/verification/verification.md | ||
use core::time::Duration; | ||
|
||
use derive_more::Display; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::types::TrustThreshold; | ||
|
||
/// Verification parameters | ||
#[derive(Copy, Clone, Debug, PartialEq, Display, Serialize, Deserialize)] | ||
#[display(fmt = "{:?}", self)] | ||
pub struct Options { | ||
/// Defines what fraction of the total voting power of a known | ||
/// and trusted validator set is sufficient for a commit to be | ||
/// accepted going forward. | ||
pub trust_threshold: TrustThreshold, | ||
|
||
/// How long a validator set is trusted for (must be shorter than the chain's | ||
/// unbonding period) | ||
pub trusting_period: Duration, | ||
|
||
/// Correction parameter dealing with only approximately synchronized clocks. | ||
/// The local clock should always be ahead of timestamps from the blockchain; this | ||
/// is the maximum amount that the local clock may drift behind a timestamp from the | ||
/// blockchain. | ||
pub clock_drift: Duration, | ||
} |
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,14 @@ | ||
pub use core::prelude::v1::*; | ||
|
||
// Re-export according to alloc::prelude::v1 because it is not yet stabilized | ||
// https://doc.rust-lang.org/src/alloc/prelude/v1.rs.html | ||
pub use alloc::borrow::ToOwned; | ||
pub use alloc::boxed::Box; | ||
pub use alloc::string::{String, ToString}; | ||
pub use alloc::vec::Vec; | ||
|
||
pub use alloc::format; | ||
pub use alloc::vec; | ||
|
||
// will be included in 2021 edition. | ||
pub use core::convert::{TryFrom, TryInto}; |
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
9 changes: 3 additions & 6 deletions
9
light-client/src/components/verifier.rs → light-client-verifier/src/verifier.rs
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.