Skip to content

Commit

Permalink
Merge branch 'main' into mikhail/multi-tc-version-support
Browse files Browse the repository at this point in the history
  • Loading branch information
mzabaluev committed Nov 3, 2022
2 parents 27c53dc + b849fdd commit 2e4d38b
Show file tree
Hide file tree
Showing 31 changed files with 125 additions and 64 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Allow a `TrustThresholdFraction` of 1
([#1208](https://github.com/informalsystems/tendermint-rs/issues/1208))
12 changes: 12 additions & 0 deletions .changelog/v0.26.0/summary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*Oct 31, 2022*

The highlight of this release is the addition of domain types specifically for
ABCI. Previously, Rust-based Tendermint application developers would have had to
exclusively rely on the generated Protobuf types. Many thanks to @hdevalence for
the heavy lifting on this, and to @mzabaluev for the porting work after the
Tendermint v0.35 retraction!

While we will endeavour to keep this API as stable as possible, we know that we
will have to evolve it over the coming months to reduce duplication of
functionality and types across the ABCI module and RPC crate, so please expect
further breaking changes in subsequent breaking releases.
62 changes: 51 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
# CHANGELOG

## v0.26.0

*Oct 31, 2022*

The highlight of this release is the addition of domain types specifically for
ABCI. Previously, Rust-based Tendermint application developers would have had to
exclusively rely on the generated Protobuf types. Many thanks to @hdevalence for
the heavy lifting on this, and to @mzabaluev for the porting work after the
Tendermint v0.35 retraction!

While we will endeavour to keep this API as stable as possible, we know that we
will have to evolve it over the coming months to reduce duplication of
functionality and types across the ABCI module and RPC crate, so please expect
further breaking changes in subsequent breaking releases.

### BREAKING CHANGES

- `[tendermint]` Added domain types for ABCI
([#862](https://github.com/informalsystems/tendermint-rs/issues/862))
- `[tendermint-proto]` Use `Bytes` for byte array fields of ABCI protobuf types.
([#1203](https://github.com/informalsystems/tendermint-rs/pull/1203))

### BUG FIXES

- `[tendermint-rpc]` The encoding of the `hash` field for requests to the `/block_by_hash`
endpoint has been changed to base64 (from hex) to accommodate discrepancies in
how the Tendermint RPC encodes this field for different RPC interfaces
([#942](https://github.com/informalsystems/tendermint-rs/issues/942))
- Allow a `TrustThresholdFraction` of 1
([#1208](https://github.com/informalsystems/tendermint-rs/issues/1208))

### ENHANCEMENTS

- `[tendermint-abci]` Deprecate `Client::set_option`.
([#1203](https://github.com/informalsystems/tendermint-rs/pull/1203))

### FEATURES

- `[tendermint-rpc]` Add support for the `/block_by_hash` RPC endpoint. See <https://docs.tendermint.com/master/rpc/#/Info/block_by_hash> for details ([#832](https://github.com/informalsystems/tendermint-rs/issues/832)).

## v0.25.0

*Sep 23, 2022*
Expand Down Expand Up @@ -99,12 +139,12 @@ Pre-releases will continue along this line until v0.34.20 is released.

### FEATURES

- `[tendermint-proto]` Regenerate protos from Tendermint
v0.34.20-rc0, including prioritized mempool fields in `ResponseCheckTx`
([#1148](https://github.com/informalsystems/tendermint-rs/issues/1148))
- `[tendermint-rpc]` Update `broadcast_tx_*` result to include
prioritized new mempool fields available from v0.34.20-rc0
([#1148](https://github.com/informalsystems/tendermint-rs/issues/1148))
- `[tendermint-proto]` Regenerate protos from Tendermint
v0.34.20-rc0, including prioritized mempool fields in `ResponseCheckTx`
([#1148](https://github.com/informalsystems/tendermint-rs/issues/1148))

## v0.23.7

Expand Down Expand Up @@ -261,18 +301,18 @@ not yet support `no_std`.
- Upgraded Prost to the official v0.9 release to finally resolve the security
issue introduced by v0.7
([#925](https://github.com/informalsystems/tendermint-rs/issues/925))
- `[tendermint]` The `tendermint::node::info::ListenAddress::to_net_address`
method was replaced with a simple `as_str` method toward facilitating
`no_std` compatibility ([#983](https://github.com/informalsystems/tendermint-
rs/issues/983))
- `[tendermint]` The `tendermint::node::info::OtherInfo::rpc_address`
field type has been changed from `tendermint::net::Address`
to `String` toward facilitating `no_std` compatibility
([#983](https://github.com/informalsystems/tendermint-rs/issues/983))
- `[tendermint, tendermint-config]` The `tendermint::config`
module has now been broken out into its own crate (`tendermint-
config`) to help towards facilitating `no_std` compatibility
([#983](https://github.com/informalsystems/tendermint-rs/issues/983))
- `[tendermint]` The `tendermint::node::info::OtherInfo::rpc_address`
field type has been changed from `tendermint::net::Address`
to `String` toward facilitating `no_std` compatibility
([#983](https://github.com/informalsystems/tendermint-rs/issues/983))
- `[tendermint]` The `tendermint::node::info::ListenAddress::to_net_address`
method was replaced with a simple `as_str` method toward facilitating
`no_std` compatibility ([#983](https://github.com/informalsystems/tendermint-
rs/issues/983))

### FEATURES

Expand Down
4 changes: 2 additions & 2 deletions abci/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tendermint-abci"
version = "0.25.0"
version = "0.26.0"
authors = ["Informal Systems <[email protected]>"]
edition = "2018"
license = "Apache-2.0"
Expand Down Expand Up @@ -33,7 +33,7 @@ binary = [
[dependencies]
bytes = { version = "1.0", default-features = false }
prost = { version = "0.11", default-features = false }
tendermint-proto = { version = "0.25.0", default-features = false, path = "../proto" }
tendermint-proto = { version = "0.26.0", default-features = false, path = "../proto" }
tracing = { version = "0.1", default-features = false }
flex-error = { version = "0.4.4", default-features = false }
structopt = { version = "0.3", optional = true, default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tendermint-config"
version = "0.25.0" # Also update `html_root_url` in lib.rs and
version = "0.26.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/"
Expand All @@ -25,7 +25,7 @@ all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
tendermint = { version = "0.25.0", default-features = false, path = "../tendermint" }
tendermint = { version = "0.26.0", default-features = false, path = "../tendermint" }
flex-error = { version = "0.4.4", default-features = false }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
Expand Down
6 changes: 3 additions & 3 deletions light-client-js/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tendermint-light-client-js"
version = "0.25.0"
version = "0.26.0"
authors = ["Informal Systems <[email protected]>"]
edition = "2018"
license = "Apache-2.0"
Expand All @@ -24,8 +24,8 @@ serde = { version = "1.0", default-features = false, features = [ "derive" ] }
serde_json = { version = "1.0", default-features = false }
# TODO(thane): Remove once https://github.com/rustwasm/wasm-bindgen/issues/2508 is resolved
syn = { version = "=1.0.65", default-features = false }
tendermint = { version = "0.25.0", default-features = false, path = "../tendermint" }
tendermint-light-client-verifier = { version = "0.25.0", default-features = false, path = "../light-client-verifier" }
tendermint = { version = "0.26.0", default-features = false, path = "../tendermint" }
tendermint-light-client-verifier = { version = "0.26.0", default-features = false, path = "../light-client-verifier" }
wasm-bindgen = { version = "0.2.63", default-features = false, features = [ "serde-serialize" ] }

# The `console_error_panic_hook` crate provides better debugging of panics by
Expand Down
4 changes: 2 additions & 2 deletions light-client-verifier/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tendermint-light-client-verifier"
version = "0.25.0"
version = "0.26.0"
edition = "2021"
license = "Apache-2.0"
readme = "README.md"
Expand All @@ -26,7 +26,7 @@ rustdoc-args = ["--cfg", "docsrs"]
default = ["flex-error/std", "flex-error/eyre_tracer"]

[dependencies]
tendermint = { version = "0.25.0", path = "../tendermint", default-features = false }
tendermint = { version = "0.26.0", path = "../tendermint", default-features = false }

derive_more = { version = "0.99.5", default-features = false, features = ["display"] }
serde = { version = "1.0.106", default-features = false }
Expand Down
8 changes: 4 additions & 4 deletions light-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tendermint-light-client"
version = "0.25.0"
version = "0.26.0"
edition = "2018"
license = "Apache-2.0"
readme = "README.md"
Expand Down Expand Up @@ -34,9 +34,9 @@ unstable = []
mbt = []

[dependencies]
tendermint = { version = "0.25.0", path = "../tendermint", default-features = false }
tendermint-rpc = { version = "0.25.0", path = "../rpc", default-features = false }
tendermint-light-client-verifier = { version = "0.25.0", path = "../light-client-verifier", default-features = false }
tendermint = { version = "0.26.0", path = "../tendermint", default-features = false }
tendermint-rpc = { version = "0.26.0", path = "../rpc", default-features = false }
tendermint-light-client-verifier = { version = "0.26.0", path = "../light-client-verifier", default-features = false }

contracts = { version = "0.6.2", default-features = false }
crossbeam-channel = { version = "0.4.2", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion light-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
nonstandard_style
)]
#![doc(
html_root_url = "https://docs.rs/tendermint-light-client/0.25.0",
html_root_url = "https://docs.rs/tendermint-light-client/0.26.0",
html_logo_url = "https://raw.githubusercontent.com/informalsystems/tendermint-rs/master/img/logo-tendermint-rs_3961x4001.png"
)]
#![cfg_attr(docsrs, feature(doc_cfg))]
Expand Down
8 changes: 4 additions & 4 deletions p2p/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tendermint-p2p"
version = "0.25.0"
version = "0.26.0"
edition = "2018"
license = "Apache-2.0"
repository = "https://github.com/informalsystems/tendermint-rs"
Expand Down Expand Up @@ -44,9 +44,9 @@ aead = { version = "0.4.1", default-features = false }
flex-error = { version = "0.4.4", default-features = false }

# path dependencies
tendermint = { path = "../tendermint", version = "0.25.0", default-features = false }
tendermint-proto = { path = "../proto", version = "0.25.0", default-features = false }
tendermint-std-ext = { path = "../std-ext", version = "0.25.0", default-features = false }
tendermint = { path = "../tendermint", version = "0.26.0", default-features = false }
tendermint-proto = { path = "../proto", version = "0.26.0", default-features = false }
tendermint-std-ext = { path = "../std-ext", version = "0.26.0", default-features = false }

# optional dependencies
prost-derive = { version = "0.11", optional = true }
2 changes: 1 addition & 1 deletion p2p/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
unused_qualifications
)]
#![doc(
html_root_url = "https://docs.rs/tendermint-p2p/0.25.0",
html_root_url = "https://docs.rs/tendermint-p2p/0.26.0",
html_logo_url = "https://raw.githubusercontent.com/informalsystems/tendermint-rs/master/img/logo-tendermint-rs_3961x4001.png"
)]

Expand Down
2 changes: 1 addition & 1 deletion pbt-gen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tendermint-pbt-gen"
version = "0.25.0"
version = "0.26.0"
authors = ["Informal Systems <[email protected]>"]
edition = "2018"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion proto/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tendermint-proto"
version = "0.25.0"
version = "0.26.0"
authors = ["Informal Systems <[email protected]>"]
edition = "2018"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion proto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#![deny(warnings, trivial_casts, trivial_numeric_casts, unused_import_braces)]
#![allow(clippy::large_enum_variant)]
#![forbid(unsafe_code)]
#![doc(html_root_url = "https://docs.rs/tendermint-proto/0.25.0")]
#![doc(html_root_url = "https://docs.rs/tendermint-proto/0.26.0")]

extern crate alloc;

Expand Down
8 changes: 4 additions & 4 deletions proto/src/serializers/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub mod hexstring {

use crate::prelude::*;

/// Deserialize hexstring into `Vec<u8>`
/// Deserialize a hex-encoded string into `Vec<u8>`
pub fn deserialize<'de, D>(deserializer: D) -> Result<Vec<u8>, D::Error>
where
D: Deserializer<'de>,
Expand All @@ -18,7 +18,7 @@ pub mod hexstring {
.map_err(serde::de::Error::custom)
}

/// Serialize from `T` into hexstring
/// Serialize from a byte slice into a hex-encoded string.
pub fn serialize<S, T>(value: &T, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down Expand Up @@ -70,7 +70,7 @@ pub mod base64string {
}
}

/// Serialize into `Vec<base64string>`, deserialize from `Vec<base64string>`
/// Serialize into and deserialize from a sequence of _base64string_.
pub mod vec_base64string {
use serde::{Deserialize, Deserializer, Serializer};
use subtle_encoding::base64;
Expand Down Expand Up @@ -105,7 +105,7 @@ pub mod vec_base64string {
}
}

/// Serialize into `Option<base64string>`, deserialize from `Option<base64string>`
/// Serialize into and deserialize from an optional _base64string_.
pub mod option_base64string {
use serde::{Deserialize, Deserializer, Serializer};
use subtle_encoding::base64;
Expand Down
8 changes: 4 additions & 4 deletions rpc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tendermint-rpc"
version = "0.25.0"
version = "0.26.0"
edition = "2018"
license = "Apache-2.0"
homepage = "https://www.tendermint.com/"
Expand Down Expand Up @@ -69,9 +69,9 @@ pin-project = { version = "1.0.1", default-features = false }
serde = { version = "1", default-features = false, features = [ "derive" ] }
serde_bytes = { version = "0.11", default-features = false }
serde_json = { version = "1", default-features = false, features = ["std"] }
tendermint-config = { version = "0.25.0", path = "../config", default-features = false }
tendermint = { version = "0.25.0", default-features = false, path = "../tendermint" }
tendermint-proto = { version = "0.25.0", default-features = false, path = "../proto" }
tendermint-config = { version = "0.26.0", path = "../config", default-features = false }
tendermint = { version = "0.26.0", default-features = false, path = "../tendermint" }
tendermint-proto = { version = "0.26.0", default-features = false, path = "../proto" }
thiserror = { version = "1", default-features = false }
time = { version = "0.3", default-features = false, features = ["macros", "parsing"] }
uuid = { version = "0.8", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion std-ext/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tendermint-std-ext"
version = "0.25.0"
version = "0.26.0"
edition = "2018"
license = "Apache-2.0"
homepage = "https://www.tendermint.com/"
Expand Down
4 changes: 2 additions & 2 deletions tendermint/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tendermint"
version = "0.25.0" # Also update `html_root_url` in lib.rs and
version = "0.26.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/"
Expand Down Expand Up @@ -47,7 +47,7 @@ sha2 = { version = "0.9", default-features = false }
signature = { version = "1", default-features = false }
subtle = { version = "2", default-features = false }
subtle-encoding = { version = "0.5", default-features = false, features = ["bech32-preview"] }
tendermint-proto = { version = "0.25.0", default-features = false, path = "../proto" }
tendermint-proto = { version = "0.26.0", default-features = false, path = "../proto" }
time = { version = "0.3", default-features = false, features = ["macros", "parsing"] }
zeroize = { version = "1.1", default-features = false, features = ["zeroize_derive", "alloc"] }
flex-error = { version = "0.4.4", default-features = false }
Expand Down
7 changes: 7 additions & 0 deletions tendermint/proptest-regressions/trust_threshold.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Seeds for failure cases proptest has generated in the past. It is
# automatically read and these particular cases re-run before any
# novel cases are generated.
#
# It is recommended to check this file in to source control so that
# everyone who runs the test benefits from these saved cases.
cc 5f12a01ebfd5d2efb4e16c1267e4d876465cfa3294d159abf2051d5aba03f74c # shrinks to num = 1
2 changes: 1 addition & 1 deletion tendermint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
)]
#![forbid(unsafe_code)]
#![doc(
html_root_url = "https://docs.rs/tendermint/0.25.0",
html_root_url = "https://docs.rs/tendermint/0.26.0",
html_logo_url = "https://raw.githubusercontent.com/informalsystems/tendermint-rs/master/img/logo-tendermint-rs_3961x4001.png"
)]

Expand Down
16 changes: 8 additions & 8 deletions tendermint/src/trust_threshold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ impl TrustThresholdFraction {
/// Instantiate a TrustThresholdFraction if the given denominator and
/// numerator are valid.
///
/// The parameters are valid iff `1/3 <= numerator/denominator < 1`.
/// The parameters are valid iff `1/3 <= numerator/denominator <= 1`.
/// In any other case we return an error.
pub fn new(numerator: u64, denominator: u64) -> Result<Self, Error> {
if numerator >= denominator {
if numerator > denominator {
return Err(Error::trust_threshold_too_large());
}
if denominator == 0 {
Expand Down Expand Up @@ -159,12 +159,6 @@ mod test {
assert!(from_json(num, denom).is_err());
}

#[test]
fn cannot_be_one(num in 1..1000u64) {
assert!(TrustThresholdFraction::new(num, num).is_err());
assert!(from_json(num, num).is_err());
}

#[test]
fn undefined(num in 1..1000u64) {
// Numerator should be irrelevant
Expand All @@ -191,5 +185,11 @@ mod test {
assert_eq!(frac.numerator(), num);
assert_eq!(frac.denominator(), denom);
}

#[test]
fn can_be_one(num in 1..1000u64) {
assert!(TrustThresholdFraction::new(num, num).is_ok());
assert!(from_json(num, num).is_ok());
}
}
}
Loading

0 comments on commit 2e4d38b

Please sign in to comment.