From 353b9c3aaf534d255d0e5c219b1464c30dd1a1c7 Mon Sep 17 00:00:00 2001 From: katelyn martin Date: Tue, 21 May 2024 18:02:25 -0400 Subject: [PATCH 01/28] =?UTF-8?q?ci:=20=F0=9F=A6=80=20fix=20nightly=20`car?= =?UTF-8?q?go=20test-all-features`=20(#1424)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit example: https://github.com/informalsystems/tendermint-rs/actions/runs/9181862633/job/25249544213?pr=1423 ``` error: unexpected `cfg` condition value: `grpc-client` --> proto/src/lib.rs:3:46 | 3 | #![cfg_attr(not(any(feature = "grpc-server", feature = "grpc-client")), no_std)] | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: expected values for `feature` are: `default`, `grpc`, `grpc-server`, `tonic` = help: consider adding `grpc-client` as a feature in `Cargo.toml` = note: see for more information about checking conditional configuration ``` --- proto/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/src/lib.rs b/proto/src/lib.rs index ebff4132f..54944fff9 100644 --- a/proto/src/lib.rs +++ b/proto/src/lib.rs @@ -1,6 +1,6 @@ //! tendermint-proto library gives the developer access to the Tendermint proto-defined structs. -#![cfg_attr(not(any(feature = "grpc-server", feature = "grpc-client")), no_std)] +#![cfg_attr(not(any(feature = "grpc-server")), no_std)] #![deny(warnings, trivial_casts, trivial_numeric_casts, unused_import_braces)] #![allow(clippy::large_enum_variant)] #![forbid(unsafe_code)] From 14343758049658f9b9600b0ceb513fe2bb1293ce Mon Sep 17 00:00:00 2001 From: katelyn martin Date: Wed, 22 May 2024 10:40:28 -0400 Subject: [PATCH 02/28] =?UTF-8?q?proto:=20=F0=9F=A7=AA=20upgrade=20to=20to?= =?UTF-8?q?nic=200.11=20(#1422)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * proto: ๐Ÿงช upgrade to tonic 0.11 * changelog: ๐Ÿ“œ add entry noting tonic upgrade --- CHANGELOG.md | 7 +++++++ proto/Cargo.toml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fa2bb8ea..857db9716 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # CHANGELOG +## v0.37.0 + +### IMPROVEMENTS + +- `[tendermint-proto]` upgrades its tonic dependency to tonic@0.11. + ([\#1422](https://github.com/informalsystems/tendermint-rs/pull/1422)) + ## v0.36.0 This release brings substantial performance improvements to the voting power computation within the light client, improves the handling of misformed blocks (eg. with empty `last_commit` on non-first block) when decoding them from Protobuf or RPC responses, and adds missing `serde` derives on some Protobuf definitions. diff --git a/proto/Cargo.toml b/proto/Cargo.toml index b5e0685a3..b47febeec 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -30,7 +30,7 @@ serde_bytes = { version = "0.11", default-features = false, features = ["alloc"] subtle-encoding = { version = "0.5", default-features = false, features = ["hex", "base64", "alloc"] } time = { version = "0.3", default-features = false, features = ["macros", "parsing"] } flex-error = { version = "0.4.4", default-features = false } -tonic = { version = "0.10", optional = true } +tonic = { version = "0.11", optional = true } [dev-dependencies] serde_json = { version = "1.0", default-features = false, features = ["alloc"] } From 10e91bc761ef30942f32398601f1519dcb78f58b Mon Sep 17 00:00:00 2001 From: Romain Ruetschi Date: Wed, 22 May 2024 16:42:45 +0200 Subject: [PATCH 03/28] Add changelog entry for #1422 in the .changelog directory instead of the CHANGELOG file --- .changelog/unreleased/breaking-changes/1422-tonic-011.md | 1 + CHANGELOG.md | 7 ------- 2 files changed, 1 insertion(+), 7 deletions(-) create mode 100644 .changelog/unreleased/breaking-changes/1422-tonic-011.md diff --git a/.changelog/unreleased/breaking-changes/1422-tonic-011.md b/.changelog/unreleased/breaking-changes/1422-tonic-011.md new file mode 100644 index 000000000..620f03411 --- /dev/null +++ b/.changelog/unreleased/breaking-changes/1422-tonic-011.md @@ -0,0 +1 @@ +- `[tendermint-proto]` Upgrade `tonic` to v0.11 ([\#1422](https://github.com/informalsystems/tendermint-rs/pull/1422)) diff --git a/CHANGELOG.md b/CHANGELOG.md index 857db9716..8fa2bb8ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,5 @@ # CHANGELOG -## v0.37.0 - -### IMPROVEMENTS - -- `[tendermint-proto]` upgrades its tonic dependency to tonic@0.11. - ([\#1422](https://github.com/informalsystems/tendermint-rs/pull/1422)) - ## v0.36.0 This release brings substantial performance improvements to the voting power computation within the light client, improves the handling of misformed blocks (eg. with empty `last_commit` on non-first block) when decoding them from Protobuf or RPC responses, and adds missing `serde` derives on some Protobuf definitions. From c00441f7f796d6b4b4ed6c656cb9c916b009c0e7 Mon Sep 17 00:00:00 2001 From: katelyn martin Date: Wed, 22 May 2024 14:05:04 -0400 Subject: [PATCH 04/28] =?UTF-8?q?light-client-verifier:=20=F0=9F=8C=B1=20r?= =?UTF-8?q?estore=20`verify=5Fcommit()`=20interface=20(#1423)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../1423-verify-commit-restore.md | 5 +++++ light-client-verifier/src/verifier.rs | 20 ++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 .changelog/unreleased/breaking-changes/1423-verify-commit-restore.md diff --git a/.changelog/unreleased/breaking-changes/1423-verify-commit-restore.md b/.changelog/unreleased/breaking-changes/1423-verify-commit-restore.md new file mode 100644 index 000000000..8b1234664 --- /dev/null +++ b/.changelog/unreleased/breaking-changes/1423-verify-commit-restore.md @@ -0,0 +1,5 @@ +- `[tendermint-light-client-verifier]` Restores the commit verification interfaces of `PredicateVerifier` from `<= 0.35.0`. + * `verify_commit(&self. untrusted: &UntrustedBlockState<'_>)` is restored, as in <= 0.35.0. + * `verify_commit(&self, untrusted: &UntrustedBlockState<'_>, trusted: &TrustedBlockState<'_>,)` introduced in 0.36.0 is renamed to `verify_commit_against_trusted`. + The performance improvements made in the `0.36.0` release are still intact. + ([\#1423](https://github.com/informalsystems/tendermint-rs/pull/1423)) diff --git a/light-client-verifier/src/verifier.rs b/light-client-verifier/src/verifier.rs index caec451ef..d26eb2c34 100644 --- a/light-client-verifier/src/verifier.rs +++ b/light-client-verifier/src/verifier.rs @@ -209,10 +209,24 @@ where Verdict::Success } + /// Verify that more than 2/3 of the validators correctly committed the block. + /// + /// Use [`PredicateVerifier::verify_commit_against_trusted()`] to also verify that there is + /// enough overlap between validator sets. + pub fn verify_commit(&self, untrusted: &UntrustedBlockState<'_>) -> Verdict { + verdict!(self.predicates.has_sufficient_signers_overlap( + untrusted.signed_header, + untrusted.validators, + &self.voting_power_calculator, + )); + + Verdict::Success + } + /// Verify that a) there is enough overlap between the validator sets of the /// trusted and untrusted blocks and b) more than 2/3 of the validators /// correctly committed the block. - pub fn verify_commit( + pub fn verify_commit_against_trusted( &self, untrusted: &UntrustedBlockState<'_>, trusted: &TrustedBlockState<'_>, @@ -288,7 +302,7 @@ where ensure_verdict_success!(self.verify_validator_sets(&untrusted)); ensure_verdict_success!(self.validate_against_trusted(&untrusted, &trusted, options, now)); ensure_verdict_success!(self.check_header_is_from_past(&untrusted, options, now)); - ensure_verdict_success!(self.verify_commit(&untrusted, &trusted, options)); + ensure_verdict_success!(self.verify_commit_against_trusted(&untrusted, &trusted, options)); Verdict::Success } @@ -305,7 +319,7 @@ where ) -> Verdict { ensure_verdict_success!(self.verify_validator_sets(&untrusted)); ensure_verdict_success!(self.validate_against_trusted(&untrusted, &trusted, options, now)); - ensure_verdict_success!(self.verify_commit(&untrusted, &trusted, options)); + ensure_verdict_success!(self.verify_commit_against_trusted(&untrusted, &trusted, options)); Verdict::Success } } From 9331d5c3f102c51fc84a45c67b27bf1f067e0583 Mon Sep 17 00:00:00 2001 From: MarkDaveny <168091250+MarkDaveny@users.noreply.github.com> Date: Wed, 29 May 2024 15:46:22 +0800 Subject: [PATCH 05/28] chore: remove repetitive words (#1418) Signed-off-by: MarkDaveny --- abci/src/application/kvstore.rs | 2 +- docs/spec/lightclient/verification/Lightclient_A_1.tla | 2 +- light-client-verifier/src/operations/commit_validator.rs | 2 +- .../tests/support/model_based/Lightclient_003_draft.tla | 2 +- tendermint/src/block/signed_header.rs | 2 +- tendermint/src/time.rs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/abci/src/application/kvstore.rs b/abci/src/application/kvstore.rs index 68691b40f..3eb53bf61 100644 --- a/abci/src/application/kvstore.rs +++ b/abci/src/application/kvstore.rs @@ -293,7 +293,7 @@ enum Command { key: String, result_tx: Sender<(i64, Option)>, }, - /// Set the value of `key` to to `value`. + /// Set the value of `key` to `value`. Set { key: String, value: String, diff --git a/docs/spec/lightclient/verification/Lightclient_A_1.tla b/docs/spec/lightclient/verification/Lightclient_A_1.tla index 64d3fc6a5..691cf6dc3 100644 --- a/docs/spec/lightclient/verification/Lightclient_A_1.tla +++ b/docs/spec/lightclient/verification/Lightclient_A_1.tla @@ -137,7 +137,7 @@ LCInit == /\ fetchedLightBlocks = [h \in {TRUSTED_HEIGHT} |-> trustedLightBlock] \* initially, lightBlockStatus is a function of one element, i.e., TRUSTED_HEIGHT /\ lightBlockStatus = [h \in {TRUSTED_HEIGHT} |-> "StateVerified"] - \* the latest verified block the the trusted block + \* the latest verified block the trusted block /\ latestVerified = trustedLightBlock \* block should contain a copy of the block from the reference chain, with a matching commit diff --git a/light-client-verifier/src/operations/commit_validator.rs b/light-client-verifier/src/operations/commit_validator.rs index 24908b74f..98bffc1d3 100644 --- a/light-client-verifier/src/operations/commit_validator.rs +++ b/light-client-verifier/src/operations/commit_validator.rs @@ -17,7 +17,7 @@ pub trait CommitValidator: Send + Sync { ) -> Result<(), VerificationError> { let signatures = &signed_header.commit.signatures; - // Check the the commit contains at least one non-absent signature. + // Check the commit contains at least one non-absent signature. // See https://github.com/informalsystems/tendermint-rs/issues/650 let has_present_signatures = signatures.iter().any(|cs| !cs.is_absent()); if !has_present_signatures { diff --git a/light-client/tests/support/model_based/Lightclient_003_draft.tla b/light-client/tests/support/model_based/Lightclient_003_draft.tla index 1178d9189..088764df4 100644 --- a/light-client/tests/support/model_based/Lightclient_003_draft.tla +++ b/light-client/tests/support/model_based/Lightclient_003_draft.tla @@ -188,7 +188,7 @@ LCInit == /\ fetchedLightBlocks = [h \in {TRUSTED_HEIGHT} |-> trustedLightBlock] \* initially, lightBlockStatus is a function of one element, i.e., TRUSTED_HEIGHT /\ lightBlockStatus = [h \in {TRUSTED_HEIGHT} |-> "StateVerified"] - \* the latest verified block the the trusted block + \* the latest verified block the trusted block /\ latestVerified = trustedLightBlock /\ InitMonitor(trustedLightBlock, trustedLightBlock, now, "SUCCESS") diff --git a/tendermint/src/block/signed_header.rs b/tendermint/src/block/signed_header.rs index 4cd852920..542be0262 100644 --- a/tendermint/src/block/signed_header.rs +++ b/tendermint/src/block/signed_header.rs @@ -1,4 +1,4 @@ -//! SignedHeader contains commit and and block header. +//! SignedHeader contains commit and block header. //! It is what the rpc endpoint /commit returns and hence can be used by a //! light client. diff --git a/tendermint/src/time.rs b/tendermint/src/time.rs index 1a873097d..fd5c3a4ff 100644 --- a/tendermint/src/time.rs +++ b/tendermint/src/time.rs @@ -288,7 +288,7 @@ mod tests { ] ) { // ser/de of rfc3339 timestamps is safe if it never panics. - // This differs from the the inverse test in that we are testing on + // This differs from the inverse test in that we are testing on // arbitrarily generated textual timestamps, rather than times in a // range. Tho we do incidentally test the inversion as well. let time: Time = stamp.parse().unwrap(); From 87455bcb9e33b0f4b44117b4637a040e58521b6f Mon Sep 17 00:00:00 2001 From: Pan chao <152830401+Pan-chao@users.noreply.github.com> Date: Wed, 29 May 2024 09:46:48 +0200 Subject: [PATCH 06/28] chore(docs): typo fix (#1384) * typo fix * typo fix * typo fix according to Chicago style and AP style --- docs/architecture/adr-002-light-client-adr-index.md | 2 +- docs/architecture/adr-010-time-api-sanity.md | 2 +- docs/architecture/adr-012-multi-version.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/architecture/adr-002-light-client-adr-index.md b/docs/architecture/adr-002-light-client-adr-index.md index cc145446a..cbac2a2d4 100644 --- a/docs/architecture/adr-002-light-client-adr-index.md +++ b/docs/architecture/adr-002-light-client-adr-index.md @@ -30,7 +30,7 @@ the core verification library to verify this data, and updates its state accordi It also makes requests to other full nodes to detect and report on forks. That said, as much as possible, we would like the implementation here to be -re-usable for the IBC protocol, which supports communiction between blockchains. +reusable for the IBC protocol, which supports communiction between blockchains. In this case, instead of making RPC requests, IBC-enabled blockchains receive the relevant data in transactions and verify it using the same core verification library. Thus implementations should abstract over the source of data as necessary. diff --git a/docs/architecture/adr-010-time-api-sanity.md b/docs/architecture/adr-010-time-api-sanity.md index 1e1d471b6..863de5723 100644 --- a/docs/architecture/adr-010-time-api-sanity.md +++ b/docs/architecture/adr-010-time-api-sanity.md @@ -45,7 +45,7 @@ The current API of `Time` has the following problems: If `Time` is meant to be used in performance-sensitive workloads for operations with date-time values, such as offsetting by a duration, time difference, or time comparisons, its internal representation should be - more optimized for integer arithmetics. + more optimized for integer arithmetic. * The `Time::as_rfc3339` conversion method is [named improperly][guideline-naming] with regard to Rust naming guidelines. diff --git a/docs/architecture/adr-012-multi-version.md b/docs/architecture/adr-012-multi-version.md index 12f32efea..96516cf15 100644 --- a/docs/architecture/adr-012-multi-version.md +++ b/docs/architecture/adr-012-multi-version.md @@ -47,7 +47,7 @@ multiple versions of CometBFT APIs, at this moment being 0.34 and 0.37. ### tendermint-proto -The generated Rust files providing bindings for Tendermint protobuf defitions +The generated Rust files providing bindings for Tendermint protobuf definitions will be emitted in two side-by-side modules, `tendermint::v0_34` and `tendermint::v0_37`. All names under the latter module are also reexported under the `tendermint` module, providing a low-change migration path for code bases From 21351963f9b86e14101bceea8ea17f2cc9815504 Mon Sep 17 00:00:00 2001 From: Sergey <83376337+freak12techno@users.noreply.github.com> Date: Wed, 29 May 2024 10:47:43 +0300 Subject: [PATCH 07/28] feat(rpc): add a way to provide a custom User-Agent (#1429) * feat: add a way to provide a custom User-Agent * chore: cargo fmt --- .../improvements/1425-add-http-client-user-agent.md | 2 ++ rpc/src/client/transport/http.rs | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .changelog/unreleased/improvements/1425-add-http-client-user-agent.md diff --git a/.changelog/unreleased/improvements/1425-add-http-client-user-agent.md b/.changelog/unreleased/improvements/1425-add-http-client-user-agent.md new file mode 100644 index 000000000..9d6f76215 --- /dev/null +++ b/.changelog/unreleased/improvements/1425-add-http-client-user-agent.md @@ -0,0 +1,2 @@ +* `[tendermint-rpc]` Add a way to specify custom User-Agent for HttpClient + ([#1425](https://github.com/informalsystems/tendermint-rs/issues/1425)) diff --git a/rpc/src/client/transport/http.rs b/rpc/src/client/transport/http.rs index ed1cff71c..e82ebee37 100644 --- a/rpc/src/client/transport/http.rs +++ b/rpc/src/client/transport/http.rs @@ -61,6 +61,7 @@ pub struct Builder { url: HttpClientUrl, compat: CompatMode, proxy_url: Option, + user_agent: Option, timeout: Duration, } @@ -93,10 +94,16 @@ impl Builder { self } + /// Specify the custom User-Agent header the client. + pub fn user_agent(mut self, agent: String) -> Self { + self.user_agent = Some(agent); + self + } + /// Try to create a client with the options specified for this builder. pub fn build(self) -> Result { let builder = reqwest::ClientBuilder::new() - .user_agent(USER_AGENT) + .user_agent(self.user_agent.unwrap_or(USER_AGENT.to_string())) .timeout(self.timeout); let inner = match self.proxy_url { None => builder.build().map_err(Error::http)?, @@ -152,6 +159,7 @@ impl HttpClient { url, compat: Default::default(), proxy_url: None, + user_agent: None, timeout: Duration::from_secs(30), } } From 04356a3e921b0ec4efd1e716d59b91447573f6ea Mon Sep 17 00:00:00 2001 From: "Karel L. Kubat" Date: Wed, 29 May 2024 09:53:16 +0100 Subject: [PATCH 08/28] feat(rpc): Allow overriding the underlying `reqwest` client of the `HttpClient` (#1421) * feat(rpc): expose reqwest client Previously, the reqwest client for HttpClient would be unconditionally built by the internal builder, meaning that useful middleware such as tower could not be applied. This commits adds two ways to create the HttpClient with a custom reqwest::Client, either through new_from_parts, or using the builder. * Add changelog entry --------- Co-authored-by: Romain Ruetschi --- .../features/1421-reqwest-client.md | 2 + rpc/src/client/transport/http.rs | 55 ++++++++++++++----- 2 files changed, 43 insertions(+), 14 deletions(-) create mode 100644 .changelog/unreleased/features/1421-reqwest-client.md diff --git a/.changelog/unreleased/features/1421-reqwest-client.md b/.changelog/unreleased/features/1421-reqwest-client.md new file mode 100644 index 000000000..a41cd9c66 --- /dev/null +++ b/.changelog/unreleased/features/1421-reqwest-client.md @@ -0,0 +1,2 @@ +- `[tendermint-rpc]` Add a `client(reqwest::Client)` method on `transport::http::Builder` to override the underlying `reqwest` client. + ([\#1421](https://github.com/informalsystems/tendermint-rs/pull/1421)) diff --git a/rpc/src/client/transport/http.rs b/rpc/src/client/transport/http.rs index e82ebee37..b5293e26f 100644 --- a/rpc/src/client/transport/http.rs +++ b/rpc/src/client/transport/http.rs @@ -63,6 +63,7 @@ pub struct Builder { proxy_url: Option, user_agent: Option, timeout: Duration, + client: Option, } impl Builder { @@ -94,28 +95,46 @@ impl Builder { self } - /// Specify the custom User-Agent header the client. + /// Specify the custom User-Agent header used by the client. pub fn user_agent(mut self, agent: String) -> Self { self.user_agent = Some(agent); self } + /// Use the provided client instead of building one internally. + /// + /// ## Warning + /// This will override the following options set on the builder: + /// `timeout`, `user_agent`, and `proxy_url`. + pub fn client(mut self, client: reqwest::Client) -> Self { + self.client = Some(client); + self + } + /// Try to create a client with the options specified for this builder. pub fn build(self) -> Result { - let builder = reqwest::ClientBuilder::new() - .user_agent(self.user_agent.unwrap_or(USER_AGENT.to_string())) - .timeout(self.timeout); - let inner = match self.proxy_url { - None => builder.build().map_err(Error::http)?, - Some(proxy_url) => { - let proxy = if self.url.0.is_secure() { - Proxy::https(reqwest::Url::from(proxy_url.0)).map_err(Error::invalid_proxy)? - } else { - Proxy::http(reqwest::Url::from(proxy_url.0)).map_err(Error::invalid_proxy)? - }; - builder.proxy(proxy).build().map_err(Error::http)? - }, + let inner = if let Some(inner) = self.client { + inner + } else { + let builder = reqwest::ClientBuilder::new() + .user_agent(self.user_agent.unwrap_or_else(|| USER_AGENT.to_string())) + .timeout(self.timeout); + + match self.proxy_url { + None => builder.build().map_err(Error::http)?, + Some(proxy_url) => { + let proxy = if self.url.0.is_secure() { + Proxy::https(reqwest::Url::from(proxy_url.0)) + .map_err(Error::invalid_proxy)? + } else { + Proxy::http(reqwest::Url::from(proxy_url.0)) + .map_err(Error::invalid_proxy)? + }; + builder.proxy(proxy).build().map_err(Error::http)? + }, + } }; + Ok(HttpClient { inner, url: self.url.into(), @@ -125,6 +144,13 @@ impl Builder { } impl HttpClient { + /// Construct a new Tendermint RPC HTTP/S client connecting to the given + /// URL. This avoids using the `Builder` and thus does not perform any + /// validation of the configuration. + pub fn new_from_parts(inner: reqwest::Client, url: reqwest::Url, compat: CompatMode) -> Self { + Self { inner, url, compat } + } + /// Construct a new Tendermint RPC HTTP/S client connecting to the given /// URL. pub fn new(url: U) -> Result @@ -161,6 +187,7 @@ impl HttpClient { proxy_url: None, user_agent: None, timeout: Duration::from_secs(30), + client: None, } } From 4ae4db615d1f0c70b3eeca749756fa97bc2b4042 Mon Sep 17 00:00:00 2001 From: Romain Ruetschi Date: Wed, 29 May 2024 10:54:38 +0200 Subject: [PATCH 09/28] Fix changelog entry --- .changelog/unreleased/features/1421-reqwest-client.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.changelog/unreleased/features/1421-reqwest-client.md b/.changelog/unreleased/features/1421-reqwest-client.md index a41cd9c66..1973dbd1b 100644 --- a/.changelog/unreleased/features/1421-reqwest-client.md +++ b/.changelog/unreleased/features/1421-reqwest-client.md @@ -1,2 +1,4 @@ -- `[tendermint-rpc]` Add a `client(reqwest::Client)` method on `transport::http::Builder` to override the underlying `reqwest` client. +- `[tendermint-rpc]` Add a `client()` method on `transport::http::Builder` to override the underlying `reqwest` client. + ([\#1421](https://github.com/informalsystems/tendermint-rs/pull/1421)) +- `[tendermint-rpc]` Add a `from_raw_parts()` method on `transport::http::HttpClient` to allow supplying the underlying `reqwest` client. ([\#1421](https://github.com/informalsystems/tendermint-rs/pull/1421)) From ec37ad23066b94c0711626b47738eca2e2d60dca Mon Sep 17 00:00:00 2001 From: Fabien Penso Date: Wed, 29 May 2024 10:59:04 +0200 Subject: [PATCH 10/28] fix(abci): Add serde `default` for `Event::type` (#1416) * Add test for DYDX fixtures * Fix test * Fix comment * Add Changelog --- .../bug-fixes/1415-fix-optional-event-type.md | 3 + rpc/Cargo.toml | 1 + rpc/tests/dydx_fixtures.rs | 49 +++++++++++++++ .../block_results_at_height_12791634.json | 61 +++++++++++++++++++ tendermint/src/abci/event.rs | 2 +- 5 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 .changelog/unreleased/bug-fixes/1415-fix-optional-event-type.md create mode 100644 rpc/tests/dydx_fixtures.rs create mode 100644 rpc/tests/dydx_fixtures/incoming/block_results_at_height_12791634.json diff --git a/.changelog/unreleased/bug-fixes/1415-fix-optional-event-type.md b/.changelog/unreleased/bug-fixes/1415-fix-optional-event-type.md new file mode 100644 index 000000000..c2b919258 --- /dev/null +++ b/.changelog/unreleased/bug-fixes/1415-fix-optional-event-type.md @@ -0,0 +1,3 @@ +- `[tendermint-abci]` Add serde default for Event.type since it has omitempty in the Go + implementation. + ([\#1416](https://github.com/informalsystems/tendermint-rs/pull/1416)) diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index cb40c8452..d545c5ed7 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -88,6 +88,7 @@ tracing = { version = "0.1", optional = true, default-features = false } tracing-subscriber = { version = "0.3", optional = true, default-features = false, features = ["fmt"] } [dev-dependencies] +tendermint = { version = "0.36.0", default-features = false, path = "../tendermint", features = ["secp256k1"] } http = { version = "1", default-features = false, features = ["std"] } lazy_static = { version = "1.4.0", default-features = false } tokio-test = { version = "0.4", default-features = false } diff --git a/rpc/tests/dydx_fixtures.rs b/rpc/tests/dydx_fixtures.rs new file mode 100644 index 000000000..9789a3201 --- /dev/null +++ b/rpc/tests/dydx_fixtures.rs @@ -0,0 +1,49 @@ +use std::{fs, path::PathBuf}; + +use tendermint_rpc::{endpoint, Response}; + +use walkdir::WalkDir; + +fn find_fixtures(in_out_folder_name: &str) -> Vec { + WalkDir::new( + PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .join("tests") + .join("dydx_fixtures") + .join(in_out_folder_name), + ) + .into_iter() + .filter_map(|e| e.ok()) + .filter(|e| { + e.file_type().is_file() + && e.path().extension().is_some() + && e.path().extension().unwrap() == "json" + }) + .map(|e| e.into_path()) + .collect::>() +} + +#[test] +fn incoming_fixtures() { + for json_file in find_fixtures("incoming") { + let file_name = json_file + .file_name() + .unwrap() + .to_str() + .unwrap() + .strip_suffix(".json") + .unwrap(); + let content = fs::read_to_string(&json_file).unwrap(); + match file_name { + // NOTE: for the purpose of the test I manually emptied `validator_updates` from the + // block_results, which has another unrelated issue deserializing the Secp256K1 public + // key + "block_results_at_height_12791634" => { + let r = endpoint::block_results::Response::from_string(content); + assert!(r.is_ok(), "block_results_at_height_12791634: {r:?}"); + }, + _ => { + panic!("unhandled incoming fixture: {file_name}"); + }, + } + } +} diff --git a/rpc/tests/dydx_fixtures/incoming/block_results_at_height_12791634.json b/rpc/tests/dydx_fixtures/incoming/block_results_at_height_12791634.json new file mode 100644 index 000000000..28be2f333 --- /dev/null +++ b/rpc/tests/dydx_fixtures/incoming/block_results_at_height_12791634.json @@ -0,0 +1,61 @@ +{ + "jsonrpc": "2.0", + "id": -1, + "result": { + "height": "12791634", + "txs_results": [ + { + "code": 0, + "data": "ChAIgICAAhD///////////8BEg4IoI0GEgQIgMYKGICAQBoJCgdlZDI1NTE5IgA=", + "log": "", + "info": "", + "gas_wanted": "0", + "gas_used": "0", + "events": [], + "codespace": "" + } + ], + "finalize_block_events": [ + { + "attributes": [ + { + "key": "", + "value": "\n0/dydxprotocol.clob.MsgProposedOperationsResponse", + "index": false + } + ] + }, + { + "attributes": [ + { + "key": "", + "value": "\n2/dydxprotocol.bridge.MsgAcknowledgeBridgesResponse", + "index": false + } + ] + }, + { + "attributes": [ + { + "key": "", + "value": "\n3/dydxprotocol.perpetuals.MsgAddPremiumVotesResponse", + "index": false + } + ] + }, + { + "attributes": [ + { + "key": "", + "value": "\n2/dydxprotocol.prices.MsgUpdateMarketPricesResponse", + "index": false + } + ] + } + ], + "validator_updates": [ + ], + "consensus_param_updates": null, + "app_hash": null + } +} diff --git a/tendermint/src/abci/event.rs b/tendermint/src/abci/event.rs index aafb66c27..77c034889 100644 --- a/tendermint/src/abci/event.rs +++ b/tendermint/src/abci/event.rs @@ -18,7 +18,7 @@ pub struct Event { /// /// Tendermint calls this the `type`, but we use `kind` to avoid confusion /// with Rust types and follow Rust conventions. - #[serde(rename = "type")] + #[serde(rename = "type", default)] pub kind: String, /// A list of [`EventAttribute`]s describing the event. From 9697006ce4dc195e50e14788a3659ea19fea1035 Mon Sep 17 00:00:00 2001 From: Eric Tu <6364934+ec2@users.noreply.github.com> Date: Wed, 29 May 2024 12:37:35 -0400 Subject: [PATCH 11/28] fix(tendermint): Make `FinalizeBlock::validator_updates` nullable when deserializing (#1428) --- .../improvements/1428-finalizeblock-deserialization.md | 1 + tendermint/src/abci/response/finalize_block.rs | 1 + 2 files changed, 2 insertions(+) create mode 100644 .changelog/unreleased/improvements/1428-finalizeblock-deserialization.md diff --git a/.changelog/unreleased/improvements/1428-finalizeblock-deserialization.md b/.changelog/unreleased/improvements/1428-finalizeblock-deserialization.md new file mode 100644 index 000000000..cc9ca040f --- /dev/null +++ b/.changelog/unreleased/improvements/1428-finalizeblock-deserialization.md @@ -0,0 +1 @@ +- `[tendermint]` Fix `FinalizeBlock::validator_updates` deserialization as `nullable` ([\#1428](https://github.com/informalsystems/tendermint-rs/pull/1428)) diff --git a/tendermint/src/abci/response/finalize_block.rs b/tendermint/src/abci/response/finalize_block.rs index 124ce1aca..0cc2c8128 100644 --- a/tendermint/src/abci/response/finalize_block.rs +++ b/tendermint/src/abci/response/finalize_block.rs @@ -16,6 +16,7 @@ pub struct FinalizeBlock { pub tx_results: Vec, /// A list of updates to the validator set. /// These will reflect the validator set at current height + 2. + #[serde(with = "serializers::nullable")] pub validator_updates: Vec, /// Updates to the consensus params, if any. #[serde(default)] From 94a5fc074964fca05df48acde88ce133a58f4ce7 Mon Sep 17 00:00:00 2001 From: Romain Ruetschi Date: Fri, 31 May 2024 12:45:10 +0200 Subject: [PATCH 12/28] Release v0.37.0 (#1431) * Bump version to 0.37.0 * Update changelog * Fix typos Co-authored-by: Luca Joss <43531661+ljoss17@users.noreply.github.com> --------- Co-authored-by: Luca Joss <43531661+ljoss17@users.noreply.github.com> --- .../breaking-changes/1422-tonic-011.md | 0 .../1423-verify-commit-restore.md | 0 .../bug-fixes/1415-fix-optional-event-type.md | 0 .../features/1421-reqwest-client.md | 0 .../1425-add-http-client-user-agent.md | 0 .../1428-finalizeblock-deserialization.md | 0 .changelog/v0.37.0/summary.md | 7 +++++ CHANGELOG.md | 31 +++++++++++++++++++ abci/Cargo.toml | 4 +-- config/Cargo.toml | 4 +-- light-client-cli/Cargo.toml | 10 +++--- light-client-detector/Cargo.toml | 10 +++--- light-client-js/Cargo.toml | 6 ++-- light-client-verifier/Cargo.toml | 4 +-- light-client/Cargo.toml | 8 ++--- p2p/Cargo.toml | 8 ++--- pbt-gen/Cargo.toml | 2 +- proto/Cargo.toml | 2 +- rpc/Cargo.toml | 10 +++--- std-ext/Cargo.toml | 2 +- tendermint/Cargo.toml | 4 +-- test/Cargo.toml | 2 +- testgen/Cargo.toml | 4 +-- tools/abci-test/Cargo.toml | 8 ++--- tools/kvstore-test/Cargo.toml | 6 ++-- tools/rpc-probe/Cargo.toml | 2 +- 26 files changed, 86 insertions(+), 48 deletions(-) rename .changelog/{unreleased => v0.37.0}/breaking-changes/1422-tonic-011.md (100%) rename .changelog/{unreleased => v0.37.0}/breaking-changes/1423-verify-commit-restore.md (100%) rename .changelog/{unreleased => v0.37.0}/bug-fixes/1415-fix-optional-event-type.md (100%) rename .changelog/{unreleased => v0.37.0}/features/1421-reqwest-client.md (100%) rename .changelog/{unreleased => v0.37.0}/improvements/1425-add-http-client-user-agent.md (100%) rename .changelog/{unreleased => v0.37.0}/improvements/1428-finalizeblock-deserialization.md (100%) create mode 100644 .changelog/v0.37.0/summary.md diff --git a/.changelog/unreleased/breaking-changes/1422-tonic-011.md b/.changelog/v0.37.0/breaking-changes/1422-tonic-011.md similarity index 100% rename from .changelog/unreleased/breaking-changes/1422-tonic-011.md rename to .changelog/v0.37.0/breaking-changes/1422-tonic-011.md diff --git a/.changelog/unreleased/breaking-changes/1423-verify-commit-restore.md b/.changelog/v0.37.0/breaking-changes/1423-verify-commit-restore.md similarity index 100% rename from .changelog/unreleased/breaking-changes/1423-verify-commit-restore.md rename to .changelog/v0.37.0/breaking-changes/1423-verify-commit-restore.md diff --git a/.changelog/unreleased/bug-fixes/1415-fix-optional-event-type.md b/.changelog/v0.37.0/bug-fixes/1415-fix-optional-event-type.md similarity index 100% rename from .changelog/unreleased/bug-fixes/1415-fix-optional-event-type.md rename to .changelog/v0.37.0/bug-fixes/1415-fix-optional-event-type.md diff --git a/.changelog/unreleased/features/1421-reqwest-client.md b/.changelog/v0.37.0/features/1421-reqwest-client.md similarity index 100% rename from .changelog/unreleased/features/1421-reqwest-client.md rename to .changelog/v0.37.0/features/1421-reqwest-client.md diff --git a/.changelog/unreleased/improvements/1425-add-http-client-user-agent.md b/.changelog/v0.37.0/improvements/1425-add-http-client-user-agent.md similarity index 100% rename from .changelog/unreleased/improvements/1425-add-http-client-user-agent.md rename to .changelog/v0.37.0/improvements/1425-add-http-client-user-agent.md diff --git a/.changelog/unreleased/improvements/1428-finalizeblock-deserialization.md b/.changelog/v0.37.0/improvements/1428-finalizeblock-deserialization.md similarity index 100% rename from .changelog/unreleased/improvements/1428-finalizeblock-deserialization.md rename to .changelog/v0.37.0/improvements/1428-finalizeblock-deserialization.md diff --git a/.changelog/v0.37.0/summary.md b/.changelog/v0.37.0/summary.md new file mode 100644 index 000000000..5b9130fdf --- /dev/null +++ b/.changelog/v0.37.0/summary.md @@ -0,0 +1,7 @@ +*May 30th, 2024* + +This release restores the commit verification interfaces of `PredicateVerifier` from tendermint-rs `0.35.0` and lower, but retains the performance improvements made in version `0.36.0`. + +This version also brings a few new features to the HTTP RPC client, notably a way to specify the User-Agent to send along HTTP requests, as well as a way to override the underlying `reqwest` client. + +Additionally, this release fixes a couple of issues with the `serde`-based deserialization of the `FinalizeBlock` and `Event` types. diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fa2bb8ea..57bdaa4c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,38 @@ # CHANGELOG +## v0.37.0 + +*May 30th, 2024* + +This release restores the commit verification interfaces of `PredicateVerifier` from tendermint-rs `0.35.0` and lower, but retains the performance improvements made in version `0.36.0`. + +This version also brings a few new features to the HTTP RPC client, notably a way to specify the User-Agent to send along HTTP requests, as well as a way to override the underlying `reqwest` client. + +Additionally, this release fixes a couple of issues with the `serde`-based deserialization of the `FinalizeBlock` and `Event` types. + +### BREAKING CHANGES + +- `[tendermint-proto]` Upgrade `tonic` to v0.11 ([\#1422](https://github.com/informalsystems/tendermint-rs/pull/1422)) +- `[tendermint-light-client-verifier]` Restores the commit verification interfaces of `PredicateVerifier` from `<= 0.35.0` ([\#1423](https://github.com/informalsystems/tendermint-rs/pull/1423)) + * `verify_commit(&self. untrusted: &UntrustedBlockState<'_>)` is restored, as in <= 0.35.0. + * `verify_commit(&self, untrusted: &UntrustedBlockState<'_>, trusted: &TrustedBlockState<'_>,)` introduced in 0.36.0 is renamed to `verify_commit_against_trusted`. + The performance improvements made in the `0.36.0` release are still intact. + +### FEATURES + +* `[tendermint-rpc]` Add a way to specify custom User-Agent for `HttpClient` ([#1425](https://github.com/informalsystems/tendermint-rs/issues/1425)) +- `[tendermint-rpc]` Add a `client()` method on `transport::http::Builder` to override the underlying `reqwest` client ([\#1421](https://github.com/informalsystems/tendermint-rs/pull/1421)) +- `[tendermint-rpc]` Add a `from_raw_parts()` method on `transport::http::HttpClient` to allow supplying the underlying `reqwest` client ([\#1421](https://github.com/informalsystems/tendermint-rs/pull/1421)) + +### BUG FIXES + +- `[tendermint]` Fix `FinalizeBlock::validator_updates` deserialization as `nullable` ([\#1428](https://github.com/informalsystems/tendermint-rs/pull/1428)) +- `[tendermint-abci]` Add serde `default` annotation for `Event::type` to match `omitempty` in the Go implementation ([\#1416](https://github.com/informalsystems/tendermint-rs/pull/1416)) + ## v0.36.0 +*April 25th, 2024* + This release brings substantial performance improvements to the voting power computation within the light client, improves the handling of misformed blocks (eg. with empty `last_commit` on non-first block) when decoding them from Protobuf or RPC responses, and adds missing `serde` derives on some Protobuf definitions. This release also technically contains a breaking change in `tendermint-proto`, but this should not impact normal use of the library, as the `ToPrimitive` impl that was removed on `BlockIdFlag` trait did not provide any additional functionality. diff --git a/abci/Cargo.toml b/abci/Cargo.toml index 551f265eb..a675e46e8 100644 --- a/abci/Cargo.toml +++ b/abci/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-abci" -version = "0.36.0" +version = "0.37.0" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" @@ -33,7 +33,7 @@ binary = [ [dependencies] bytes = { version = "1.0", default-features = false } prost = { version = "0.12", default-features = false } -tendermint-proto = { version = "0.36.0", default-features = false, path = "../proto" } +tendermint-proto = { version = "0.37.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 } diff --git a/config/Cargo.toml b/config/Cargo.toml index 0f8e61029..b7dca41b2 100644 --- a/config/Cargo.toml +++ b/config/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-config" -version = "0.36.0" # Also update depending crates (rpc, light-node, ..) when bumping this. +version = "0.37.0" # Also update depending crates (rpc, light-node, ..) when bumping this. license = "Apache-2.0" homepage = "https://www.tendermint.com/" repository = "https://github.com/informalsystems/tendermint-rs/tree/main/tendermint" @@ -24,7 +24,7 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [dependencies] -tendermint = { version = "0.36.0", default-features = false, features = ["rust-crypto"], path = "../tendermint" } +tendermint = { version = "0.37.0", default-features = false, features = ["rust-crypto"], path = "../tendermint" } flex-error = { version = "0.4.4", default-features = false } serde = { version = "1", features = ["derive"] } serde_json = "1" diff --git a/light-client-cli/Cargo.toml b/light-client-cli/Cargo.toml index b030a13f2..0e17c4156 100644 --- a/light-client-cli/Cargo.toml +++ b/light-client-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client-cli" -version = "0.36.0" +version = "0.37.0" edition = "2021" license = "Apache-2.0" readme = "README.md" @@ -23,10 +23,10 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [dependencies] -tendermint = { version = "0.36.0", path = "../tendermint" } -tendermint-rpc = { version = "0.36.0", path = "../rpc", features = ["http-client"] } -tendermint-light-client = { version = "0.36.0", path = "../light-client" } -tendermint-light-client-detector = { version = "0.36.0", path = "../light-client-detector" } +tendermint = { version = "0.37.0", path = "../tendermint" } +tendermint-rpc = { version = "0.37.0", path = "../rpc", features = ["http-client"] } +tendermint-light-client = { version = "0.37.0", path = "../light-client" } +tendermint-light-client-detector = { version = "0.37.0", path = "../light-client-detector" } clap = { version = "4.1.8", features = ["derive"] } color-eyre = "0.6.2" diff --git a/light-client-detector/Cargo.toml b/light-client-detector/Cargo.toml index a49852032..5dd097aec 100644 --- a/light-client-detector/Cargo.toml +++ b/light-client-detector/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client-detector" -version = "0.36.0" +version = "0.37.0" edition = "2021" license = "Apache-2.0" readme = "README.md" @@ -23,10 +23,10 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [dependencies] -tendermint = { version = "0.36.0", path = "../tendermint" } -tendermint-rpc = { version = "0.36.0", path = "../rpc", features = ["http-client"] } -tendermint-proto = { version = "0.36.0", path = "../proto" } -tendermint-light-client = { version = "0.36.0", path = "../light-client" } +tendermint = { version = "0.37.0", path = "../tendermint" } +tendermint-rpc = { version = "0.37.0", path = "../rpc", features = ["http-client"] } +tendermint-proto = { version = "0.37.0", path = "../proto" } +tendermint-light-client = { version = "0.37.0", path = "../light-client" } crossbeam-channel = { version = "0.5.11", default-features = false } derive_more = { version = "0.99.5", default-features = false, features = ["display"] } diff --git a/light-client-js/Cargo.toml b/light-client-js/Cargo.toml index 873fc7760..5af4f7c64 100644 --- a/light-client-js/Cargo.toml +++ b/light-client-js/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client-js" -version = "0.36.0" +version = "0.37.0" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" @@ -22,8 +22,8 @@ default = ["console_error_panic_hook"] [dependencies] serde = { version = "1.0", default-features = false, features = [ "derive" ] } serde_json = { version = "1.0", default-features = false } -tendermint = { version = "0.36.0", default-features = false, path = "../tendermint" } -tendermint-light-client-verifier = { version = "0.36.0", features = ["rust-crypto"], default-features = false, path = "../light-client-verifier" } +tendermint = { version = "0.37.0", default-features = false, path = "../tendermint" } +tendermint-light-client-verifier = { version = "0.37.0", features = ["rust-crypto"], default-features = false, path = "../light-client-verifier" } wasm-bindgen = { version = "0.2.63", default-features = false, features = [ "serde-serialize" ] } serde-wasm-bindgen = { version = "0.4.5", default-features = false } diff --git a/light-client-verifier/Cargo.toml b/light-client-verifier/Cargo.toml index 4bf08fb0c..f97ab96e6 100644 --- a/light-client-verifier/Cargo.toml +++ b/light-client-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client-verifier" -version = "0.36.0" +version = "0.37.0" edition = "2021" license = "Apache-2.0" readme = "README.md" @@ -27,7 +27,7 @@ default = ["rust-crypto", "flex-error/std"] rust-crypto = ["tendermint/rust-crypto"] [dependencies] -tendermint = { version = "0.36.0", path = "../tendermint", default-features = false } +tendermint = { version = "0.37.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 } diff --git a/light-client/Cargo.toml b/light-client/Cargo.toml index ce282595c..dc58b84d8 100644 --- a/light-client/Cargo.toml +++ b/light-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client" -version = "0.36.0" +version = "0.37.0" edition = "2021" license = "Apache-2.0" readme = "README.md" @@ -35,9 +35,9 @@ unstable = ["rust-crypto"] mbt = ["rust-crypto"] [dependencies] -tendermint = { version = "0.36.0", path = "../tendermint", default-features = false } -tendermint-rpc = { version = "0.36.0", path = "../rpc", default-features = false } -tendermint-light-client-verifier = { version = "0.36.0", path = "../light-client-verifier", default-features = false } +tendermint = { version = "0.37.0", path = "../tendermint", default-features = false } +tendermint-rpc = { version = "0.37.0", path = "../rpc", default-features = false } +tendermint-light-client-verifier = { version = "0.37.0", path = "../light-client-verifier", default-features = false } contracts = { version = "0.6.2", default-features = false } crossbeam-channel = { version = "0.5.11", default-features = false, features = ["std"] } diff --git a/p2p/Cargo.toml b/p2p/Cargo.toml index 8ece08be3..5db655bd5 100644 --- a/p2p/Cargo.toml +++ b/p2p/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-p2p" -version = "0.36.0" +version = "0.37.0" edition = "2021" license = "Apache-2.0" repository = "https://github.com/informalsystems/tendermint-rs" @@ -44,9 +44,9 @@ aead = { version = "0.5", default-features = false } flex-error = { version = "0.4.4", default-features = false } # path dependencies -tendermint = { path = "../tendermint", version = "0.36.0", default-features = false } -tendermint-proto = { path = "../proto", version = "0.36.0", default-features = false } -tendermint-std-ext = { path = "../std-ext", version = "0.36.0", default-features = false } +tendermint = { path = "../tendermint", version = "0.37.0", default-features = false } +tendermint-proto = { path = "../proto", version = "0.37.0", default-features = false } +tendermint-std-ext = { path = "../std-ext", version = "0.37.0", default-features = false } # optional dependencies prost-derive = { version = "0.12", optional = true } diff --git a/pbt-gen/Cargo.toml b/pbt-gen/Cargo.toml index b21ed7547..f809cbe5c 100644 --- a/pbt-gen/Cargo.toml +++ b/pbt-gen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-pbt-gen" -version = "0.36.0" +version = "0.37.0" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" diff --git a/proto/Cargo.toml b/proto/Cargo.toml index b47febeec..806788924 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-proto" -version = "0.36.0" +version = "0.37.0" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index d545c5ed7..d583787fe 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-rpc" -version = "0.36.0" +version = "0.37.0" edition = "2021" license = "Apache-2.0" homepage = "https://www.tendermint.com/" @@ -55,9 +55,9 @@ websocket-client = [ ] [dependencies] -tendermint = { version = "0.36.0", default-features = false, path = "../tendermint" } -tendermint-config = { version = "0.36.0", path = "../config", default-features = false } -tendermint-proto = { version = "0.36.0", path = "../proto", default-features = false } +tendermint = { version = "0.37.0", default-features = false, path = "../tendermint" } +tendermint-config = { version = "0.37.0", path = "../config", default-features = false } +tendermint-proto = { version = "0.37.0", path = "../proto", default-features = false } async-trait = { version = "0.1", default-features = false } bytes = { version = "1.0", default-features = false } @@ -88,7 +88,7 @@ tracing = { version = "0.1", optional = true, default-features = false } tracing-subscriber = { version = "0.3", optional = true, default-features = false, features = ["fmt"] } [dev-dependencies] -tendermint = { version = "0.36.0", default-features = false, path = "../tendermint", features = ["secp256k1"] } +tendermint = { version = "0.37.0", default-features = false, path = "../tendermint", features = ["secp256k1"] } http = { version = "1", default-features = false, features = ["std"] } lazy_static = { version = "1.4.0", default-features = false } tokio-test = { version = "0.4", default-features = false } diff --git a/std-ext/Cargo.toml b/std-ext/Cargo.toml index f3b1b6cf3..4a210d5f4 100644 --- a/std-ext/Cargo.toml +++ b/std-ext/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-std-ext" -version = "0.36.0" +version = "0.37.0" edition = "2021" license = "Apache-2.0" homepage = "https://www.tendermint.com/" diff --git a/tendermint/Cargo.toml b/tendermint/Cargo.toml index d79dca3b9..28edee9f4 100644 --- a/tendermint/Cargo.toml +++ b/tendermint/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint" -version = "0.36.0" # Also update depending crates (rpc, light-node, etc..) when bumping this . +version = "0.37.0" # Also update depending crates (rpc, light-node, etc..) when bumping this . license = "Apache-2.0" homepage = "https://www.tendermint.com/" repository = "https://github.com/informalsystems/tendermint-rs/tree/main/tendermint" @@ -44,7 +44,7 @@ serde_repr = { version = "0.1", default-features = false } signature = { version = "2", default-features = false, features = ["alloc"] } subtle = { version = "2", default-features = false } subtle-encoding = { version = "0.5", default-features = false, features = ["bech32-preview"] } -tendermint-proto = { version = "0.36.0", default-features = false, path = "../proto" } +tendermint-proto = { version = "0.37.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 } diff --git a/test/Cargo.toml b/test/Cargo.toml index 58ce9c5fa..de71dd772 100644 --- a/test/Cargo.toml +++ b/test/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tendermint-test" description = "Tendermint workspace tests and common utilities for testing." -version = "0.36.0" +version = "0.37.0" edition = "2021" license = "Apache-2.0" categories = ["development", "test", "tools"] diff --git a/testgen/Cargo.toml b/testgen/Cargo.toml index b25da98e1..5ca20e23e 100644 --- a/testgen/Cargo.toml +++ b/testgen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-testgen" -version = "0.36.0" +version = "0.37.0" authors = ["Informal Systems "] edition = "2021" readme = "README.md" @@ -16,7 +16,7 @@ description = """ """ [dependencies] -tendermint = { version = "0.36.0", path = "../tendermint", features = ["clock"] } +tendermint = { version = "0.37.0", path = "../tendermint", features = ["clock"] } serde = { version = "1", default-features = false, features = ["derive"] } serde_json = { version = "1", default-features = false, features = ["std"] } ed25519-consensus = { version = "2", default-features = false } diff --git a/tools/abci-test/Cargo.toml b/tools/abci-test/Cargo.toml index b8255d1ea..3c3a6a79b 100644 --- a/tools/abci-test/Cargo.toml +++ b/tools/abci-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "abci-test" -version = "0.36.0" +version = "0.37.0" authors = ["Informal Systems "] edition = "2021" description = """ @@ -14,9 +14,9 @@ description = """ flex-error = { version = "0.4.4", default-features = false, features = ["std"] } futures = "0.3" structopt = "0.3" -tendermint = { version = "0.36.0", path = "../../tendermint" } -tendermint-config = { version = "0.36.0", path = "../../config" } -tendermint-rpc = { version = "0.36.0", path = "../../rpc", features = [ "websocket-client" ] } +tendermint = { version = "0.37.0", path = "../../tendermint" } +tendermint-config = { version = "0.37.0", path = "../../config" } +tendermint-rpc = { version = "0.37.0", path = "../../rpc", features = [ "websocket-client" ] } tracing = "0.1" tracing-subscriber = "0.2" tokio = { version = "1.20", features = ["full"] } diff --git a/tools/kvstore-test/Cargo.toml b/tools/kvstore-test/Cargo.toml index b38d0e8e8..45cef858f 100644 --- a/tools/kvstore-test/Cargo.toml +++ b/tools/kvstore-test/Cargo.toml @@ -11,9 +11,9 @@ edition = "2021" [dev-dependencies] futures = "0.3" sha2 = "0.10" -tendermint = { version = "0.36.0", path = "../../tendermint" } -tendermint-light-client = { version = "0.36.0", path = "../../light-client", features = ["unstable"] } -tendermint-rpc = { version = "0.36.0", path = "../../rpc", features = [ "http-client", "websocket-client" ] } +tendermint = { version = "0.37.0", path = "../../tendermint" } +tendermint-light-client = { version = "0.37.0", path = "../../light-client", features = ["unstable"] } +tendermint-rpc = { version = "0.37.0", path = "../../rpc", features = [ "http-client", "websocket-client" ] } tokio = { version = "1.0", features = [ "rt-multi-thread", "macros" ] } tracing = "0.1" tracing-subscriber = "0.3" diff --git a/tools/rpc-probe/Cargo.toml b/tools/rpc-probe/Cargo.toml index fa80e9737..4dfede85b 100644 --- a/tools/rpc-probe/Cargo.toml +++ b/tools/rpc-probe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-rpc-probe" -version = "0.36.0" +version = "0.37.0" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" From ed576f2f479e58fd269a2725c5b4730bc2a1776d Mon Sep 17 00:00:00 2001 From: Erwan Or Date: Mon, 17 Jun 2024 14:13:22 -0400 Subject: [PATCH 13/28] tendermint: relax `Block` validation rules to avoid assumptions on initial height (#1436) --- .../1435-block-domain-type.md | 2 + tendermint/src/block.rs | 55 ++----------------- 2 files changed, 7 insertions(+), 50 deletions(-) create mode 100644 .changelog/unreleased/breaking-changes/1435-block-domain-type.md diff --git a/.changelog/unreleased/breaking-changes/1435-block-domain-type.md b/.changelog/unreleased/breaking-changes/1435-block-domain-type.md new file mode 100644 index 000000000..11c8aaca0 --- /dev/null +++ b/.changelog/unreleased/breaking-changes/1435-block-domain-type.md @@ -0,0 +1,2 @@ +- tendermint: relax validation rules on `Block` + ([\#1435](https://github.com/informalsystems/tendermint-rs/issues/1435)) diff --git a/tendermint/src/block.rs b/tendermint/src/block.rs index 4052ccf20..a5ca38e0e 100644 --- a/tendermint/src/block.rs +++ b/tendermint/src/block.rs @@ -26,12 +26,12 @@ pub use self::{ round::*, size::Size, }; -use crate::{error::Error, evidence, prelude::*}; +use crate::{evidence, prelude::*}; /// Blocks consist of a header, transactions, votes (the commit), and a list of /// evidence of malfeasance (i.e. signing conflicting votes). /// -/// +/// // Default serialization - all fields serialize; used by /block endpoint #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)] #[non_exhaustive] @@ -46,7 +46,7 @@ pub struct Block { /// Evidence of malfeasance pub evidence: evidence::List, - /// Last commit + /// Last commit, should be `None` for the initial block. pub last_commit: Option, } @@ -70,7 +70,7 @@ tendermint_pb_modules! { .transpose()? .filter(|c| c != &Commit::default()); - Ok(Block::new_unchecked( + Ok(Block::new( header, value.data.ok_or_else(Error::missing_data)?.txs, value.evidence.map(TryInto::try_into).transpose()?.unwrap_or_default(), @@ -93,57 +93,12 @@ tendermint_pb_modules! { } impl Block { - /// Builds a new [`Block`], enforcing a couple invariants on the given [`Commit`]: - /// - `last_commit` cannot be empty if the block is not the first one (ie. at height > 1) - /// - `last_commit` must be empty if the block is the first one (ie. at height == 1) - /// - /// # Errors - /// - If `last_commit` is empty on a non-first block - /// - If `last_commit` is filled on the first block + /// Builds a new [`Block`], based on the given [`Header`], data, evidence, and last commit. pub fn new( header: Header, data: Vec>, evidence: evidence::List, last_commit: Option, - ) -> Result { - let block = Self::new_unchecked(header, data, evidence, last_commit); - block.validate()?; - Ok(block) - } - - /// Check that the following invariants hold for this block: - /// - /// - `last_commit` cannot be empty if the block is not the first one (ie. at height > 1) - /// - `last_commit` must be empty if the block is the first one (ie. at height == 1) - /// - /// # Errors - /// - If `last_commit` is empty on a non-first block - /// - If `last_commit` is filled on the first block - pub fn validate(&self) -> Result<(), Error> { - if self.last_commit.is_none() && self.header.height.value() != 1 { - return Err(Error::invalid_block( - "last_commit is empty on non-first block".to_string(), - )); - } - if self.last_commit.is_some() && self.header.height.value() == 1 { - return Err(Error::invalid_block( - "last_commit is filled on first block".to_string(), - )); - } - - Ok(()) - } - - /// Builds a new [`Block`], but does not enforce any invariants on the given [`Commit`]. - /// - /// Use [`Block::new`] or [`Block::validate`] instead to enforce the following invariants, if necessary: - /// - `last_commit` cannot be empty if the block is not the first one (ie. at height > 1) - /// - `last_commit` must be empty if the block is the first one (ie. at height == 1) - pub fn new_unchecked( - header: Header, - data: Vec>, - evidence: evidence::List, - last_commit: Option, ) -> Self { Self { header, From 67c7923d8980658ca25584dd6edcbc443b48a95d Mon Sep 17 00:00:00 2001 From: Luca Joss <43531661+ljoss17@users.noreply.github.com> Date: Thu, 11 Jul 2024 20:27:26 +0200 Subject: [PATCH 14/28] rpc: Allow empty JSON object value for `consensus_param_updates` in `/block_results` response (#1441) --- ...40-allow-empty-consensus-params-updates.md | 4 +++ rpc/src/endpoint/block_results.rs | 4 +++ rpc/tests/kvstore_fixtures/v0_37.rs | 7 ++++- rpc/tests/kvstore_fixtures/v0_38.rs | 7 ++++- tendermint/src/consensus/params.rs | 11 +++++--- tendermint/src/serializers.rs | 1 + .../src/serializers/allow_empty_object.rs | 26 +++++++++++++++++++ 7 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 .changelog/unreleased/bug/1440-allow-empty-consensus-params-updates.md create mode 100644 tendermint/src/serializers/allow_empty_object.rs diff --git a/.changelog/unreleased/bug/1440-allow-empty-consensus-params-updates.md b/.changelog/unreleased/bug/1440-allow-empty-consensus-params-updates.md new file mode 100644 index 000000000..bed6db316 --- /dev/null +++ b/.changelog/unreleased/bug/1440-allow-empty-consensus-params-updates.md @@ -0,0 +1,4 @@ +- `[tendermint-rpc]` Deserialize an empty JSON object as `None` for the `consensus_param_updates` + field in the `/block_results` response. + Deserialize version in consensus params as `None` if it is an empty object, null or not found. + ([\#1440](https://github.com/informalsystems/tendermint-rs/issues/1440)) \ No newline at end of file diff --git a/rpc/src/endpoint/block_results.rs b/rpc/src/endpoint/block_results.rs index a1411072f..a633154f6 100644 --- a/rpc/src/endpoint/block_results.rs +++ b/rpc/src/endpoint/block_results.rs @@ -1,6 +1,7 @@ //! `/block_results` endpoint JSON-RPC wrapper use serde::{Deserialize, Serialize}; +use tendermint::serializers::allow_empty_object::allow_empty_object; use tendermint::{abci, block, consensus, serializers, validator, AppHash}; use crate::dialect::{self, Dialect}; @@ -78,6 +79,7 @@ pub struct Response { pub validator_updates: Vec, /// New consensus params (might be explicit null) + #[serde(deserialize_with = "allow_empty_object")] pub consensus_param_updates: Option, /// Merkle hash of the application state @@ -99,6 +101,7 @@ pub mod v0_34 { use crate::prelude::*; use crate::{dialect, serializers}; use serde::{Deserialize, Serialize}; + use tendermint::serializers::allow_empty_object::allow_empty_object; use tendermint::{block, consensus, validator}; /// RPC dialect helper for serialization of the response. @@ -121,6 +124,7 @@ pub mod v0_34 { pub validator_updates: Vec, /// New consensus params (might be explicit null) + #[serde(deserialize_with = "allow_empty_object")] pub consensus_param_updates: Option, } diff --git a/rpc/tests/kvstore_fixtures/v0_37.rs b/rpc/tests/kvstore_fixtures/v0_37.rs index 5efd62e78..def4a748d 100644 --- a/rpc/tests/kvstore_fixtures/v0_37.rs +++ b/rpc/tests/kvstore_fixtures/v0_37.rs @@ -1,3 +1,5 @@ +use tendermint::consensus::params::VersionParams; + use super::*; #[test] @@ -665,7 +667,10 @@ fn incoming_fixtures() { result.genesis.consensus_params.validator.pub_key_types[0], tendermint::public_key::Algorithm::Ed25519 ); - assert!(result.genesis.consensus_params.version.is_none()); + assert_eq!( + result.genesis.consensus_params.version, + Some(VersionParams { app: 0 }) + ); assert!( result .genesis diff --git a/rpc/tests/kvstore_fixtures/v0_38.rs b/rpc/tests/kvstore_fixtures/v0_38.rs index 0a8a6318b..8bece5bc1 100644 --- a/rpc/tests/kvstore_fixtures/v0_38.rs +++ b/rpc/tests/kvstore_fixtures/v0_38.rs @@ -1,3 +1,5 @@ +use tendermint::consensus::params::VersionParams; + use super::*; #[test] @@ -665,7 +667,10 @@ fn incoming_fixtures() { result.genesis.consensus_params.validator.pub_key_types[0], tendermint::public_key::Algorithm::Ed25519 ); - assert!(result.genesis.consensus_params.version.is_none()); + assert_eq!( + result.genesis.consensus_params.version, + Some(VersionParams { app: 0 }) + ); assert!( result .genesis diff --git a/tendermint/src/consensus/params.rs b/tendermint/src/consensus/params.rs index ea1a1e19d..8719b640b 100644 --- a/tendermint/src/consensus/params.rs +++ b/tendermint/src/consensus/params.rs @@ -2,7 +2,9 @@ use serde::{Deserialize, Serialize}; -use crate::{block, evidence, prelude::*, public_key}; +use crate::{ + block, evidence, prelude::*, public_key, serializers::allow_empty_object::allow_empty_object, +}; /// All consensus-relevant parameters that can be adjusted by the ABCI app. /// @@ -15,8 +17,9 @@ pub struct Params { pub evidence: evidence::Params, /// Parameters limiting the types of public keys validators can use. pub validator: ValidatorParams, - /// The ABCI application version. - #[serde(skip)] // FIXME: kvstore /genesis returns '{}' instead of '{app_version: "0"}' + /// The ABCI application version. Will default to None if not present. + #[serde(default, deserialize_with = "allow_empty_object")] + //#[serde(skip)] pub version: Option, /// Parameters specific to the Application Blockchain Interface. /// @@ -41,7 +44,7 @@ pub struct ValidatorParams { #[derive(Clone, Serialize, Deserialize, Debug, Eq, PartialEq, Default)] pub struct VersionParams { /// The ABCI application version. - #[serde(with = "crate::serializers::from_str")] + #[serde(with = "crate::serializers::from_str", alias = "app_version")] pub app: u64, } diff --git a/tendermint/src/serializers.rs b/tendermint/src/serializers.rs index 458f79c89..4845030f5 100644 --- a/tendermint/src/serializers.rs +++ b/tendermint/src/serializers.rs @@ -7,6 +7,7 @@ //! risk. pub use tendermint_proto::serializers::*; +pub mod allow_empty_object; pub mod apphash; pub mod apphash_base64; pub mod hash; diff --git a/tendermint/src/serializers/allow_empty_object.rs b/tendermint/src/serializers/allow_empty_object.rs new file mode 100644 index 000000000..e5b5494a9 --- /dev/null +++ b/tendermint/src/serializers/allow_empty_object.rs @@ -0,0 +1,26 @@ +use serde::{Deserialize, Deserializer}; + +/// Deserialize `null` or an empty object `{}` as `None`. +pub fn allow_empty_object<'de, D, T>(deserializer: D) -> Result, D::Error> +where + D: Deserializer<'de>, + T: Deserialize<'de>, +{ + #[derive(Deserialize)] + #[serde( + untagged, + deny_unknown_fields, + expecting = "object, empty object or null" + )] + enum Helper { + Data(T), + Empty {}, + Null, + } + + match Helper::deserialize(deserializer) { + Ok(Helper::Data(data)) => Ok(Some(data)), + Ok(Helper::Empty {} | Helper::Null) => Ok(None), + Err(e) => Err(e), + } +} From 66efaff43527c4e24eaed1b23dd0c6bc380ccc7f Mon Sep 17 00:00:00 2001 From: Luca Joss <43531661+ljoss17@users.noreply.github.com> Date: Sat, 13 Jul 2024 15:36:29 +0200 Subject: [PATCH 15/28] rpc: Add `/genesis_chunked` query (#1439) * Add /genesis_chunked query * Add changelog entry * Fix comments * Update types of GenesisChunked request and response * Convert chunk and total fields from GenesisChunked response * Improve genesis_chunked_stream method * Add genesis-chunked CLI * Fix dependencies for genesis_chunked_stream * Update changelog entry --------- Co-authored-by: Romain Ruetschi --- .../features/1438-genesis-chunked-endpoint.md | 2 + rpc/src/client.rs | 28 +++++++++ rpc/src/client/bin/main.rs | 16 ++++++ rpc/src/endpoint.rs | 1 + rpc/src/endpoint/genesis_chunked.rs | 57 +++++++++++++++++++ rpc/src/method.rs | 4 ++ 6 files changed, 108 insertions(+) create mode 100644 .changelog/unreleased/features/1438-genesis-chunked-endpoint.md create mode 100644 rpc/src/endpoint/genesis_chunked.rs diff --git a/.changelog/unreleased/features/1438-genesis-chunked-endpoint.md b/.changelog/unreleased/features/1438-genesis-chunked-endpoint.md new file mode 100644 index 000000000..e6502cdad --- /dev/null +++ b/.changelog/unreleased/features/1438-genesis-chunked-endpoint.md @@ -0,0 +1,2 @@ +- `[tendermint-rpc]` Add support for the `/genesis_chunked` RPC endpoint + ([\#1438](https://github.com/informalsystems/tendermint-rs/issues/1438)) \ No newline at end of file diff --git a/rpc/src/client.rs b/rpc/src/client.rs index b90472281..b073b47a8 100644 --- a/rpc/src/client.rs +++ b/rpc/src/client.rs @@ -271,6 +271,34 @@ pub trait Client { Ok(self.perform(genesis::Request::default()).await?.genesis) } + async fn genesis_chunked(&self, chunk: u64) -> Result { + self.perform(genesis_chunked::Request::new(chunk)).await + } + + /// `/genesis_chunked`: get genesis file in multiple chunks. + #[cfg(any(feature = "http-client", feature = "websocket-client"))] + async fn genesis_chunked_stream( + &self, + ) -> core::pin::Pin, Error>> + '_>> { + Box::pin(futures::stream::unfold(Some(0), move |chunk| async move { + // Verify if there are more chunks to fetch + let chunk = chunk?; + + match self.genesis_chunked(chunk).await { + Ok(response) => { + if response.chunk + 1 >= response.total { + // No more chunks to fetch + Some((Ok(response.data), None)) + } else { + // Emit this chunk and fetch the next chunk + Some((Ok(response.data), Some(response.chunk + 1))) + } + }, + Err(e) => Some((Err(e), None)), // Abort the stream + } + })) + } + /// `/net_info`: obtain information about P2P and other network connections. async fn net_info(&self) -> Result { self.perform(net_info::Request).await diff --git a/rpc/src/client/bin/main.rs b/rpc/src/client/bin/main.rs index d53de8602..7b15498cf 100644 --- a/rpc/src/client/bin/main.rs +++ b/rpc/src/client/bin/main.rs @@ -136,6 +136,8 @@ enum ClientRequest { ConsensusState, /// Get the node's genesis data. Genesis, + /// Get the node's genesis data by chunks + GenesisChunked, /// Get the node's health. Health, /// Request the latest block. @@ -413,6 +415,20 @@ where serde_json::to_string_pretty(&client.genesis::().await?) .map_err(Error::serde)? }, + ClientRequest::GenesisChunked => { + let mut data = Vec::new(); + let mut chunks = client.genesis_chunked_stream().await; + + while let Some(chunk) = chunks.next().await { + let mut chunk = chunk?; + data.append(&mut chunk); + } + + let genesis: tendermint::genesis::Genesis = + serde_json::from_slice(&data).map_err(Error::serde)?; + + serde_json::to_string_pretty(&genesis).map_err(Error::serde)? + }, ClientRequest::Health => { serde_json::to_string_pretty(&client.health().await?).map_err(Error::serde)? }, diff --git a/rpc/src/endpoint.rs b/rpc/src/endpoint.rs index f04c2a0df..bd8b79e3c 100644 --- a/rpc/src/endpoint.rs +++ b/rpc/src/endpoint.rs @@ -13,6 +13,7 @@ pub mod consensus_params; pub mod consensus_state; pub mod evidence; pub mod genesis; +pub mod genesis_chunked; pub mod header; pub mod header_by_hash; pub mod health; diff --git a/rpc/src/endpoint/genesis_chunked.rs b/rpc/src/endpoint/genesis_chunked.rs new file mode 100644 index 000000000..230b71be6 --- /dev/null +++ b/rpc/src/endpoint/genesis_chunked.rs @@ -0,0 +1,57 @@ +//! `/genesis_chunked` endpoint JSON-RPC wrapper + +use alloc::{ + string::{String, ToString}, + vec::Vec, +}; +use serde::{Deserialize, Serialize}; +use tendermint_proto::serializers; + +use crate::{dialect::Dialect, request::RequestMessage}; + +/// Get the genesis state in multiple chunks for the current chain +#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] +pub struct Request { + pub chunk: String, +} + +impl Request { + pub fn new(chunk: u64) -> Self { + Self { + chunk: chunk.to_string(), + } + } +} + +impl RequestMessage for Request { + fn method(&self) -> crate::Method { + crate::Method::GenesisChunked + } +} + +impl crate::Request for Request +where + S: Dialect, +{ + type Response = Response; +} + +impl crate::SimpleRequest for Request +where + S: Dialect, +{ + type Output = Response; +} + +/// Block responses +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct Response { + #[serde(with = "serializers::from_str")] + pub chunk: u64, + #[serde(with = "serializers::from_str")] + pub total: u64, + #[serde(with = "serializers::bytes::base64string")] + pub data: Vec, +} + +impl crate::Response for Response {} diff --git a/rpc/src/method.rs b/rpc/src/method.rs index 6f91c5d5f..8614a2620 100644 --- a/rpc/src/method.rs +++ b/rpc/src/method.rs @@ -56,6 +56,9 @@ pub enum Method { /// Get genesis file Genesis, + /// Get genesis file in multiple chunks + GenesisChunked, + /// Get block header Header, @@ -109,6 +112,7 @@ impl Method { Method::ConsensusParams => "consensus_params", Method::ConsensusState => "consensus_state", Method::Genesis => "genesis", + Method::GenesisChunked => "genesis_chunked", Method::Header => "header", Method::HeaderByHash => "header_by_hash", Method::Health => "health", From 321af79daa225ce42348efd17e271651de73f36d Mon Sep 17 00:00:00 2001 From: "Tony Arcieri (iqlusion)" Date: Wed, 17 Jul 2024 07:50:34 -0600 Subject: [PATCH 16/28] Bump `prost` to v0.13 and `tonic` to v0.12 (#1444) --- .../breaking-changes/prost-0.13+tonic-0.12.md | 2 + abci/Cargo.toml | 2 +- p2p/Cargo.toml | 4 +- proto/Cargo.toml | 6 +- proto/src/prost/v0_34/tendermint.abci.rs | 54 +++++------------- .../src/prost/v0_34/tendermint.blockchain.rs | 9 +-- proto/src/prost/v0_34/tendermint.consensus.rs | 9 +-- proto/src/prost/v0_34/tendermint.crypto.rs | 1 + proto/src/prost/v0_34/tendermint.libs.bits.rs | 1 + proto/src/prost/v0_34/tendermint.mempool.rs | 1 + proto/src/prost/v0_34/tendermint.p2p.rs | 9 +-- proto/src/prost/v0_34/tendermint.privval.rs | 5 +- proto/src/prost/v0_34/tendermint.rpc.grpc.rs | 29 +++------- proto/src/prost/v0_34/tendermint.state.rs | 1 + proto/src/prost/v0_34/tendermint.statesync.rs | 5 +- proto/src/prost/v0_34/tendermint.store.rs | 3 +- proto/src/prost/v0_34/tendermint.types.rs | 9 +-- proto/src/prost/v0_34/tendermint.version.rs | 3 +- proto/src/prost/v0_37/tendermint.abci.rs | 55 +++++------------- proto/src/prost/v0_37/tendermint.blocksync.rs | 9 +-- proto/src/prost/v0_37/tendermint.consensus.rs | 9 +-- proto/src/prost/v0_37/tendermint.crypto.rs | 1 + proto/src/prost/v0_37/tendermint.libs.bits.rs | 1 + proto/src/prost/v0_37/tendermint.mempool.rs | 1 + proto/src/prost/v0_37/tendermint.p2p.rs | 9 +-- proto/src/prost/v0_37/tendermint.privval.rs | 5 +- proto/src/prost/v0_37/tendermint.rpc.grpc.rs | 29 +++------- proto/src/prost/v0_37/tendermint.state.rs | 1 + proto/src/prost/v0_37/tendermint.statesync.rs | 5 +- proto/src/prost/v0_37/tendermint.store.rs | 3 +- proto/src/prost/v0_37/tendermint.types.rs | 9 +-- proto/src/prost/v0_37/tendermint.version.rs | 3 +- proto/src/prost/v0_38/tendermint.abci.rs | 57 ++++++------------- proto/src/prost/v0_38/tendermint.blocksync.rs | 9 +-- proto/src/prost/v0_38/tendermint.consensus.rs | 9 +-- proto/src/prost/v0_38/tendermint.crypto.rs | 1 + proto/src/prost/v0_38/tendermint.libs.bits.rs | 1 + proto/src/prost/v0_38/tendermint.mempool.rs | 1 + proto/src/prost/v0_38/tendermint.p2p.rs | 9 +-- proto/src/prost/v0_38/tendermint.privval.rs | 5 +- proto/src/prost/v0_38/tendermint.rpc.grpc.rs | 29 +++------- proto/src/prost/v0_38/tendermint.state.rs | 1 + proto/src/prost/v0_38/tendermint.statesync.rs | 5 +- proto/src/prost/v0_38/tendermint.store.rs | 3 +- proto/src/prost/v0_38/tendermint.types.rs | 11 ++-- proto/src/prost/v0_38/tendermint.version.rs | 3 +- proto/src/protobuf.rs | 9 ++- tools/proto-compiler/Cargo.toml | 4 +- 48 files changed, 192 insertions(+), 258 deletions(-) create mode 100644 .changelog/unreleased/breaking-changes/prost-0.13+tonic-0.12.md diff --git a/.changelog/unreleased/breaking-changes/prost-0.13+tonic-0.12.md b/.changelog/unreleased/breaking-changes/prost-0.13+tonic-0.12.md new file mode 100644 index 000000000..f1b5605f6 --- /dev/null +++ b/.changelog/unreleased/breaking-changes/prost-0.13+tonic-0.12.md @@ -0,0 +1,2 @@ +- `[tendermint-proto]`: Update `prost` to v0.13 and `tonic` to v0.12 + ([\#1444](https://github.com/informalsystems/tendermint-rs/pull/1444)) diff --git a/abci/Cargo.toml b/abci/Cargo.toml index a675e46e8..a9dfcad50 100644 --- a/abci/Cargo.toml +++ b/abci/Cargo.toml @@ -32,7 +32,7 @@ binary = [ [dependencies] bytes = { version = "1.0", default-features = false } -prost = { version = "0.12", default-features = false } +prost = { version = "0.13", default-features = false } tendermint-proto = { version = "0.37.0", default-features = false, path = "../proto" } tracing = { version = "0.1", default-features = false } flex-error = { version = "0.4.4", default-features = false } diff --git a/p2p/Cargo.toml b/p2p/Cargo.toml index 5db655bd5..2af28a7c2 100644 --- a/p2p/Cargo.toml +++ b/p2p/Cargo.toml @@ -34,7 +34,7 @@ eyre = { version = "0.6", default-features = false } flume = { version = "0.11.0", default-features = false } hkdf = { version = "0.12.3", default-features = false } merlin = { version = "3", default-features = false } -prost = { version = "0.12", default-features = false } +prost = { version = "0.13", default-features = false } rand_core = { version = "0.6", default-features = false, features = ["std"] } sha2 = { version = "0.10", default-features = false } subtle = { version = "2", default-features = false } @@ -49,4 +49,4 @@ tendermint-proto = { path = "../proto", version = "0.37.0", default-features = f tendermint-std-ext = { path = "../std-ext", version = "0.37.0", default-features = false } # optional dependencies -prost-derive = { version = "0.12", optional = true } +prost-derive = { version = "0.13", optional = true } diff --git a/proto/Cargo.toml b/proto/Cargo.toml index 806788924..cad98fb2d 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -22,15 +22,15 @@ grpc-server = ["tonic"] all-features = true [dependencies] -prost = { version = "0.12", default-features = false } -prost-types = { version = "0.12", default-features = false } +prost = { version = "0.13", default-features = false } +prost-types = { version = "0.13", default-features = false } bytes = { version = "1.0", default-features = false, features = ["serde"]} serde = { version = "1.0", default-features = false, features = ["derive"] } serde_bytes = { version = "0.11", default-features = false, features = ["alloc"] } subtle-encoding = { version = "0.5", default-features = false, features = ["hex", "base64", "alloc"] } time = { version = "0.3", default-features = false, features = ["macros", "parsing"] } flex-error = { version = "0.4.4", default-features = false } -tonic = { version = "0.11", optional = true } +tonic = { version = "0.12", optional = true } [dev-dependencies] serde_json = { version = "1.0", default-features = false, features = ["alloc"] } diff --git a/proto/src/prost/v0_34/tendermint.abci.rs b/proto/src/prost/v0_34/tendermint.abci.rs index e4a78b783..1719f446a 100644 --- a/proto/src/prost/v0_34/tendermint.abci.rs +++ b/proto/src/prost/v0_34/tendermint.abci.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -55,7 +56,7 @@ pub struct RequestEcho { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RequestFlush {} #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] @@ -139,19 +140,19 @@ pub struct RequestDeliverTx { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RequestEndBlock { #[prost(int64, tag = "1")] pub height: i64, } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RequestCommit {} /// lists available snapshots #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RequestListSnapshots {} /// offers a snapshot to the application #[derive(::serde::Deserialize, ::serde::Serialize)] @@ -168,7 +169,7 @@ pub struct RequestOfferSnapshot { /// loads a snapshot chunk #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RequestLoadSnapshotChunk { #[prost(uint64, tag = "1")] pub height: u64, @@ -256,7 +257,7 @@ pub struct ResponseEcho { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct ResponseFlush {} #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] @@ -422,7 +423,7 @@ pub struct ResponseListSnapshots { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct ResponseOfferSnapshot { #[prost(enumeration = "response_offer_snapshot::Result", tag = "1")] pub result: i32, @@ -581,7 +582,7 @@ pub struct ConsensusParams { /// BlockParams contains limits on the block size. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct BlockParams { /// Note: must be greater than 0 #[prost(int64, tag = "1")] @@ -870,19 +871,17 @@ pub mod abci_application_server { } #[derive(Debug)] pub struct AbciApplicationServer { - inner: _Inner, + inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } - struct _Inner(Arc); impl AbciApplicationServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { - let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), @@ -945,7 +944,6 @@ pub mod abci_application_server { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); match req.uri().path() { "/tendermint.abci.ABCIApplication/Echo" => { #[allow(non_camel_case_types)] @@ -975,7 +973,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = EchoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1020,7 +1017,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = FlushSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1065,7 +1061,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = InfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1111,7 +1106,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = SetOptionSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1157,7 +1151,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = DeliverTxSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1203,7 +1196,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = CheckTxSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1248,7 +1240,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = QuerySvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1294,7 +1285,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = CommitSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1340,7 +1330,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = InitChainSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1386,7 +1375,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = BeginBlockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1432,7 +1420,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = EndBlockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1479,7 +1466,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = ListSnapshotsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1526,7 +1512,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = OfferSnapshotSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1573,7 +1558,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = LoadSnapshotChunkSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1623,7 +1607,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = ApplySnapshotChunkSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1645,8 +1628,11 @@ pub mod abci_application_server { Ok( http::Response::builder() .status(200) - .header("grpc-status", "12") - .header("content-type", "application/grpc") + .header("grpc-status", tonic::Code::Unimplemented as i32) + .header( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ) .body(empty_body()) .unwrap(), ) @@ -1667,16 +1653,6 @@ pub mod abci_application_server { } } } - impl Clone for _Inner { - fn clone(&self) -> Self { - Self(Arc::clone(&self.0)) - } - } - impl std::fmt::Debug for _Inner { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } - } impl tonic::server::NamedService for AbciApplicationServer { const NAME: &'static str = "tendermint.abci.ABCIApplication"; } diff --git a/proto/src/prost/v0_34/tendermint.blockchain.rs b/proto/src/prost/v0_34/tendermint.blockchain.rs index 4480ece49..094e3aeea 100644 --- a/proto/src/prost/v0_34/tendermint.blockchain.rs +++ b/proto/src/prost/v0_34/tendermint.blockchain.rs @@ -1,13 +1,14 @@ +// This file is @generated by prost-build. /// BlockRequest requests a block for a specific height #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct BlockRequest { #[prost(int64, tag = "1")] pub height: i64, } /// NoBlockResponse informs the node that the peer does not have block at the requested height #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct NoBlockResponse { #[prost(int64, tag = "1")] pub height: i64, @@ -21,11 +22,11 @@ pub struct BlockResponse { } /// StatusRequest requests the status of a peer. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct StatusRequest {} /// StatusResponse is a peer response to inform their status. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct StatusResponse { #[prost(int64, tag = "1")] pub height: i64, diff --git a/proto/src/prost/v0_34/tendermint.consensus.rs b/proto/src/prost/v0_34/tendermint.consensus.rs index 95237cc78..c04bf2d5a 100644 --- a/proto/src/prost/v0_34/tendermint.consensus.rs +++ b/proto/src/prost/v0_34/tendermint.consensus.rs @@ -1,7 +1,8 @@ +// This file is @generated by prost-build. /// NewRoundStep is sent for every step taken in the ConsensusState. /// For every height/round/step transition #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct NewRoundStep { #[prost(int64, tag = "1")] pub height: i64, @@ -69,7 +70,7 @@ pub struct Vote { } /// HasVote is sent to indicate that a particular vote has been received. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct HasVote { #[prost(int64, tag = "1")] pub height: i64, @@ -150,7 +151,7 @@ pub struct MsgInfo { } /// TimeoutInfo internally generated messages which may update the state #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct TimeoutInfo { #[prost(message, optional, tag = "1")] pub duration: ::core::option::Option, @@ -164,7 +165,7 @@ pub struct TimeoutInfo { /// EndHeight marks the end of the given height inside WAL. /// @internal used by scripts/wal2json util. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct EndHeight { #[prost(int64, tag = "1")] pub height: i64, diff --git a/proto/src/prost/v0_34/tendermint.crypto.rs b/proto/src/prost/v0_34/tendermint.crypto.rs index 0b1c3e197..b62f77775 100644 --- a/proto/src/prost/v0_34/tendermint.crypto.rs +++ b/proto/src/prost/v0_34/tendermint.crypto.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/proto/src/prost/v0_34/tendermint.libs.bits.rs b/proto/src/prost/v0_34/tendermint.libs.bits.rs index 460876d21..7ddf7f64a 100644 --- a/proto/src/prost/v0_34/tendermint.libs.bits.rs +++ b/proto/src/prost/v0_34/tendermint.libs.bits.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/proto/src/prost/v0_34/tendermint.mempool.rs b/proto/src/prost/v0_34/tendermint.mempool.rs index 9fec1376b..056cddaf5 100644 --- a/proto/src/prost/v0_34/tendermint.mempool.rs +++ b/proto/src/prost/v0_34/tendermint.mempool.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Txs { diff --git a/proto/src/prost/v0_34/tendermint.p2p.rs b/proto/src/prost/v0_34/tendermint.p2p.rs index 1b96c2577..614ee2570 100644 --- a/proto/src/prost/v0_34/tendermint.p2p.rs +++ b/proto/src/prost/v0_34/tendermint.p2p.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -11,7 +12,7 @@ pub struct NetAddress { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct ProtocolVersion { #[prost(uint64, tag = "1")] pub p2p: u64, @@ -52,11 +53,11 @@ pub struct DefaultNodeInfoOther { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PacketPing {} #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PacketPong {} #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] @@ -101,7 +102,7 @@ pub struct AuthSigMessage { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PexRequest {} #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] diff --git a/proto/src/prost/v0_34/tendermint.privval.rs b/proto/src/prost/v0_34/tendermint.privval.rs index 8485c3816..04ed210fe 100644 --- a/proto/src/prost/v0_34/tendermint.privval.rs +++ b/proto/src/prost/v0_34/tendermint.privval.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct RemoteSignerError { @@ -60,11 +61,11 @@ pub struct SignedProposalResponse { } /// PingRequest is a request to confirm that the connection is alive. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PingRequest {} /// PingResponse is a response to confirm that the connection is alive. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PingResponse {} #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/proto/src/prost/v0_34/tendermint.rpc.grpc.rs b/proto/src/prost/v0_34/tendermint.rpc.grpc.rs index cef8f2f15..c6d678166 100644 --- a/proto/src/prost/v0_34/tendermint.rpc.grpc.rs +++ b/proto/src/prost/v0_34/tendermint.rpc.grpc.rs @@ -1,5 +1,6 @@ +// This file is @generated by prost-build. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RequestPing {} #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -8,7 +9,7 @@ pub struct RequestBroadcastTx { pub tx: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct ResponsePing {} #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -40,19 +41,17 @@ pub mod broadcast_api_server { } #[derive(Debug)] pub struct BroadcastApiServer { - inner: _Inner, + inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } - struct _Inner(Arc); impl BroadcastApiServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { - let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), @@ -115,7 +114,6 @@ pub mod broadcast_api_server { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); match req.uri().path() { "/tendermint.rpc.grpc.BroadcastAPI/Ping" => { #[allow(non_camel_case_types)] @@ -144,7 +142,6 @@ pub mod broadcast_api_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = PingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -190,7 +187,6 @@ pub mod broadcast_api_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = BroadcastTxSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -212,8 +208,11 @@ pub mod broadcast_api_server { Ok( http::Response::builder() .status(200) - .header("grpc-status", "12") - .header("content-type", "application/grpc") + .header("grpc-status", tonic::Code::Unimplemented as i32) + .header( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ) .body(empty_body()) .unwrap(), ) @@ -234,16 +233,6 @@ pub mod broadcast_api_server { } } } - impl Clone for _Inner { - fn clone(&self) -> Self { - Self(Arc::clone(&self.0)) - } - } - impl std::fmt::Debug for _Inner { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } - } impl tonic::server::NamedService for BroadcastApiServer { const NAME: &'static str = "tendermint.rpc.grpc.BroadcastAPI"; } diff --git a/proto/src/prost/v0_34/tendermint.state.rs b/proto/src/prost/v0_34/tendermint.state.rs index dd006a2c6..699bffe9d 100644 --- a/proto/src/prost/v0_34/tendermint.state.rs +++ b/proto/src/prost/v0_34/tendermint.state.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. /// ABCIResponses retains the responses /// of the various ABCI calls during block processing. /// It is persisted to disk for each height before calling Commit. diff --git a/proto/src/prost/v0_34/tendermint.statesync.rs b/proto/src/prost/v0_34/tendermint.statesync.rs index a2ad034e3..5e13924a8 100644 --- a/proto/src/prost/v0_34/tendermint.statesync.rs +++ b/proto/src/prost/v0_34/tendermint.statesync.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Message { @@ -20,7 +21,7 @@ pub mod message { } } #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct SnapshotsRequest {} #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -37,7 +38,7 @@ pub struct SnapshotsResponse { pub metadata: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct ChunkRequest { #[prost(uint64, tag = "1")] pub height: u64, diff --git a/proto/src/prost/v0_34/tendermint.store.rs b/proto/src/prost/v0_34/tendermint.store.rs index 98d20b0fc..4d8f23e94 100644 --- a/proto/src/prost/v0_34/tendermint.store.rs +++ b/proto/src/prost/v0_34/tendermint.store.rs @@ -1,5 +1,6 @@ +// This file is @generated by prost-build. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct BlockStoreState { #[prost(int64, tag = "1")] pub base: i64, diff --git a/proto/src/prost/v0_34/tendermint.types.rs b/proto/src/prost/v0_34/tendermint.types.rs index 1d31b82f6..09aade6a2 100644 --- a/proto/src/prost/v0_34/tendermint.types.rs +++ b/proto/src/prost/v0_34/tendermint.types.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -366,7 +367,7 @@ pub struct ConsensusParams { /// BlockParams contains limits on the block size. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct BlockParams { /// Max block size, in bytes. /// Note: must be greater than 0 @@ -386,7 +387,7 @@ pub struct BlockParams { /// EvidenceParams determine how we handle evidence of malfeasance. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct EvidenceParams { /// Max age of evidence, in blocks. /// @@ -421,7 +422,7 @@ pub struct ValidatorParams { /// VersionParams contains the ABCI application version. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct VersionParams { #[prost(uint64, tag = "1")] pub app_version: u64, @@ -430,7 +431,7 @@ pub struct VersionParams { /// /// It is hashed into the Header.ConsensusHash. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct HashedParams { #[prost(int64, tag = "1")] pub block_max_bytes: i64, diff --git a/proto/src/prost/v0_34/tendermint.version.rs b/proto/src/prost/v0_34/tendermint.version.rs index 8a77a26fc..8c781751e 100644 --- a/proto/src/prost/v0_34/tendermint.version.rs +++ b/proto/src/prost/v0_34/tendermint.version.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. /// App includes the protocol and software version for the application. /// This information is included in ResponseInfo. The App.Protocol can be /// updated in ResponseEndBlock. @@ -14,7 +15,7 @@ pub struct App { /// state transition machine. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct Consensus { #[prost(uint64, tag = "1")] #[serde(with = "crate::serializers::from_str")] diff --git a/proto/src/prost/v0_37/tendermint.abci.rs b/proto/src/prost/v0_37/tendermint.abci.rs index ed5a863e4..ba11419cc 100644 --- a/proto/src/prost/v0_37/tendermint.abci.rs +++ b/proto/src/prost/v0_37/tendermint.abci.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -57,7 +58,7 @@ pub struct RequestEcho { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RequestFlush {} #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] @@ -133,19 +134,19 @@ pub struct RequestDeliverTx { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RequestEndBlock { #[prost(int64, tag = "1")] pub height: i64, } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RequestCommit {} /// lists available snapshots #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RequestListSnapshots {} /// offers a snapshot to the application #[derive(::serde::Deserialize, ::serde::Serialize)] @@ -162,7 +163,7 @@ pub struct RequestOfferSnapshot { /// loads a snapshot chunk #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RequestLoadSnapshotChunk { #[prost(uint64, tag = "1")] pub height: u64, @@ -300,7 +301,7 @@ pub struct ResponseEcho { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct ResponseFlush {} #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] @@ -453,7 +454,7 @@ pub struct ResponseListSnapshots { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct ResponseOfferSnapshot { #[prost(enumeration = "response_offer_snapshot::Result", tag = "1")] pub result: i32, @@ -603,7 +604,7 @@ pub struct ResponsePrepareProposal { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct ResponseProcessProposal { #[prost(enumeration = "response_process_proposal::ProposalStatus", tag = "1")] pub status: i32, @@ -962,19 +963,17 @@ pub mod abci_application_server { } #[derive(Debug)] pub struct AbciApplicationServer { - inner: _Inner, + inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } - struct _Inner(Arc); impl AbciApplicationServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { - let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), @@ -1037,7 +1036,6 @@ pub mod abci_application_server { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); match req.uri().path() { "/tendermint.abci.ABCIApplication/Echo" => { #[allow(non_camel_case_types)] @@ -1067,7 +1065,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = EchoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1112,7 +1109,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = FlushSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1157,7 +1153,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = InfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1203,7 +1198,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = DeliverTxSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1249,7 +1243,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = CheckTxSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1294,7 +1287,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = QuerySvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1340,7 +1332,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = CommitSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1386,7 +1377,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = InitChainSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1432,7 +1422,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = BeginBlockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1478,7 +1467,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = EndBlockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1525,7 +1513,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = ListSnapshotsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1572,7 +1559,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = OfferSnapshotSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1619,7 +1605,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = LoadSnapshotChunkSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1669,7 +1654,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = ApplySnapshotChunkSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1716,7 +1700,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = PrepareProposalSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1763,7 +1746,6 @@ pub mod abci_application_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = ProcessProposalSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1785,8 +1767,11 @@ pub mod abci_application_server { Ok( http::Response::builder() .status(200) - .header("grpc-status", "12") - .header("content-type", "application/grpc") + .header("grpc-status", tonic::Code::Unimplemented as i32) + .header( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ) .body(empty_body()) .unwrap(), ) @@ -1807,16 +1792,6 @@ pub mod abci_application_server { } } } - impl Clone for _Inner { - fn clone(&self) -> Self { - Self(Arc::clone(&self.0)) - } - } - impl std::fmt::Debug for _Inner { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } - } impl tonic::server::NamedService for AbciApplicationServer { const NAME: &'static str = "tendermint.abci.ABCIApplication"; } diff --git a/proto/src/prost/v0_37/tendermint.blocksync.rs b/proto/src/prost/v0_37/tendermint.blocksync.rs index 4480ece49..094e3aeea 100644 --- a/proto/src/prost/v0_37/tendermint.blocksync.rs +++ b/proto/src/prost/v0_37/tendermint.blocksync.rs @@ -1,13 +1,14 @@ +// This file is @generated by prost-build. /// BlockRequest requests a block for a specific height #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct BlockRequest { #[prost(int64, tag = "1")] pub height: i64, } /// NoBlockResponse informs the node that the peer does not have block at the requested height #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct NoBlockResponse { #[prost(int64, tag = "1")] pub height: i64, @@ -21,11 +22,11 @@ pub struct BlockResponse { } /// StatusRequest requests the status of a peer. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct StatusRequest {} /// StatusResponse is a peer response to inform their status. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct StatusResponse { #[prost(int64, tag = "1")] pub height: i64, diff --git a/proto/src/prost/v0_37/tendermint.consensus.rs b/proto/src/prost/v0_37/tendermint.consensus.rs index 95237cc78..c04bf2d5a 100644 --- a/proto/src/prost/v0_37/tendermint.consensus.rs +++ b/proto/src/prost/v0_37/tendermint.consensus.rs @@ -1,7 +1,8 @@ +// This file is @generated by prost-build. /// NewRoundStep is sent for every step taken in the ConsensusState. /// For every height/round/step transition #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct NewRoundStep { #[prost(int64, tag = "1")] pub height: i64, @@ -69,7 +70,7 @@ pub struct Vote { } /// HasVote is sent to indicate that a particular vote has been received. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct HasVote { #[prost(int64, tag = "1")] pub height: i64, @@ -150,7 +151,7 @@ pub struct MsgInfo { } /// TimeoutInfo internally generated messages which may update the state #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct TimeoutInfo { #[prost(message, optional, tag = "1")] pub duration: ::core::option::Option, @@ -164,7 +165,7 @@ pub struct TimeoutInfo { /// EndHeight marks the end of the given height inside WAL. /// @internal used by scripts/wal2json util. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct EndHeight { #[prost(int64, tag = "1")] pub height: i64, diff --git a/proto/src/prost/v0_37/tendermint.crypto.rs b/proto/src/prost/v0_37/tendermint.crypto.rs index 0b1c3e197..b62f77775 100644 --- a/proto/src/prost/v0_37/tendermint.crypto.rs +++ b/proto/src/prost/v0_37/tendermint.crypto.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/proto/src/prost/v0_37/tendermint.libs.bits.rs b/proto/src/prost/v0_37/tendermint.libs.bits.rs index 460876d21..7ddf7f64a 100644 --- a/proto/src/prost/v0_37/tendermint.libs.bits.rs +++ b/proto/src/prost/v0_37/tendermint.libs.bits.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/proto/src/prost/v0_37/tendermint.mempool.rs b/proto/src/prost/v0_37/tendermint.mempool.rs index 9fec1376b..056cddaf5 100644 --- a/proto/src/prost/v0_37/tendermint.mempool.rs +++ b/proto/src/prost/v0_37/tendermint.mempool.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Txs { diff --git a/proto/src/prost/v0_37/tendermint.p2p.rs b/proto/src/prost/v0_37/tendermint.p2p.rs index 1b96c2577..614ee2570 100644 --- a/proto/src/prost/v0_37/tendermint.p2p.rs +++ b/proto/src/prost/v0_37/tendermint.p2p.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -11,7 +12,7 @@ pub struct NetAddress { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct ProtocolVersion { #[prost(uint64, tag = "1")] pub p2p: u64, @@ -52,11 +53,11 @@ pub struct DefaultNodeInfoOther { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PacketPing {} #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PacketPong {} #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] @@ -101,7 +102,7 @@ pub struct AuthSigMessage { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PexRequest {} #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] diff --git a/proto/src/prost/v0_37/tendermint.privval.rs b/proto/src/prost/v0_37/tendermint.privval.rs index 8485c3816..04ed210fe 100644 --- a/proto/src/prost/v0_37/tendermint.privval.rs +++ b/proto/src/prost/v0_37/tendermint.privval.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct RemoteSignerError { @@ -60,11 +61,11 @@ pub struct SignedProposalResponse { } /// PingRequest is a request to confirm that the connection is alive. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PingRequest {} /// PingResponse is a response to confirm that the connection is alive. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PingResponse {} #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/proto/src/prost/v0_37/tendermint.rpc.grpc.rs b/proto/src/prost/v0_37/tendermint.rpc.grpc.rs index cef8f2f15..c6d678166 100644 --- a/proto/src/prost/v0_37/tendermint.rpc.grpc.rs +++ b/proto/src/prost/v0_37/tendermint.rpc.grpc.rs @@ -1,5 +1,6 @@ +// This file is @generated by prost-build. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RequestPing {} #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -8,7 +9,7 @@ pub struct RequestBroadcastTx { pub tx: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct ResponsePing {} #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -40,19 +41,17 @@ pub mod broadcast_api_server { } #[derive(Debug)] pub struct BroadcastApiServer { - inner: _Inner, + inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } - struct _Inner(Arc); impl BroadcastApiServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { - let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), @@ -115,7 +114,6 @@ pub mod broadcast_api_server { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); match req.uri().path() { "/tendermint.rpc.grpc.BroadcastAPI/Ping" => { #[allow(non_camel_case_types)] @@ -144,7 +142,6 @@ pub mod broadcast_api_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = PingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -190,7 +187,6 @@ pub mod broadcast_api_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = BroadcastTxSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -212,8 +208,11 @@ pub mod broadcast_api_server { Ok( http::Response::builder() .status(200) - .header("grpc-status", "12") - .header("content-type", "application/grpc") + .header("grpc-status", tonic::Code::Unimplemented as i32) + .header( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ) .body(empty_body()) .unwrap(), ) @@ -234,16 +233,6 @@ pub mod broadcast_api_server { } } } - impl Clone for _Inner { - fn clone(&self) -> Self { - Self(Arc::clone(&self.0)) - } - } - impl std::fmt::Debug for _Inner { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } - } impl tonic::server::NamedService for BroadcastApiServer { const NAME: &'static str = "tendermint.rpc.grpc.BroadcastAPI"; } diff --git a/proto/src/prost/v0_37/tendermint.state.rs b/proto/src/prost/v0_37/tendermint.state.rs index dd006a2c6..699bffe9d 100644 --- a/proto/src/prost/v0_37/tendermint.state.rs +++ b/proto/src/prost/v0_37/tendermint.state.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. /// ABCIResponses retains the responses /// of the various ABCI calls during block processing. /// It is persisted to disk for each height before calling Commit. diff --git a/proto/src/prost/v0_37/tendermint.statesync.rs b/proto/src/prost/v0_37/tendermint.statesync.rs index a2ad034e3..5e13924a8 100644 --- a/proto/src/prost/v0_37/tendermint.statesync.rs +++ b/proto/src/prost/v0_37/tendermint.statesync.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Message { @@ -20,7 +21,7 @@ pub mod message { } } #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct SnapshotsRequest {} #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -37,7 +38,7 @@ pub struct SnapshotsResponse { pub metadata: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct ChunkRequest { #[prost(uint64, tag = "1")] pub height: u64, diff --git a/proto/src/prost/v0_37/tendermint.store.rs b/proto/src/prost/v0_37/tendermint.store.rs index 98d20b0fc..4d8f23e94 100644 --- a/proto/src/prost/v0_37/tendermint.store.rs +++ b/proto/src/prost/v0_37/tendermint.store.rs @@ -1,5 +1,6 @@ +// This file is @generated by prost-build. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct BlockStoreState { #[prost(int64, tag = "1")] pub base: i64, diff --git a/proto/src/prost/v0_37/tendermint.types.rs b/proto/src/prost/v0_37/tendermint.types.rs index 1b0f6ba68..a34889656 100644 --- a/proto/src/prost/v0_37/tendermint.types.rs +++ b/proto/src/prost/v0_37/tendermint.types.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -446,7 +447,7 @@ pub struct ConsensusParams { /// BlockParams contains limits on the block size. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct BlockParams { /// Max block size, in bytes. /// Note: must be greater than 0 @@ -460,7 +461,7 @@ pub struct BlockParams { /// EvidenceParams determine how we handle evidence of malfeasance. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct EvidenceParams { /// Max age of evidence, in blocks. /// @@ -495,7 +496,7 @@ pub struct ValidatorParams { /// VersionParams contains the ABCI application version. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct VersionParams { #[prost(uint64, tag = "1")] pub app: u64, @@ -504,7 +505,7 @@ pub struct VersionParams { /// /// It is hashed into the Header.ConsensusHash. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct HashedParams { #[prost(int64, tag = "1")] pub block_max_bytes: i64, diff --git a/proto/src/prost/v0_37/tendermint.version.rs b/proto/src/prost/v0_37/tendermint.version.rs index 8a77a26fc..8c781751e 100644 --- a/proto/src/prost/v0_37/tendermint.version.rs +++ b/proto/src/prost/v0_37/tendermint.version.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. /// App includes the protocol and software version for the application. /// This information is included in ResponseInfo. The App.Protocol can be /// updated in ResponseEndBlock. @@ -14,7 +15,7 @@ pub struct App { /// state transition machine. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct Consensus { #[prost(uint64, tag = "1")] #[serde(with = "crate::serializers::from_str")] diff --git a/proto/src/prost/v0_38/tendermint.abci.rs b/proto/src/prost/v0_38/tendermint.abci.rs index 34ab13e8d..a30f9bdc7 100644 --- a/proto/src/prost/v0_38/tendermint.abci.rs +++ b/proto/src/prost/v0_38/tendermint.abci.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -57,7 +58,7 @@ pub struct RequestEcho { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RequestFlush {} #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] @@ -113,12 +114,12 @@ pub struct RequestCheckTx { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RequestCommit {} /// lists available snapshots #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RequestListSnapshots {} /// offers a snapshot to the application #[derive(::serde::Deserialize, ::serde::Serialize)] @@ -135,7 +136,7 @@ pub struct RequestOfferSnapshot { /// loads a snapshot chunk #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RequestLoadSnapshotChunk { #[prost(uint64, tag = "1")] pub height: u64, @@ -338,7 +339,7 @@ pub struct ResponseEcho { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct ResponseFlush {} #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] @@ -424,7 +425,7 @@ pub struct ResponseCheckTx { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct ResponseCommit { #[prost(int64, tag = "3")] pub retain_height: i64, @@ -438,7 +439,7 @@ pub struct ResponseListSnapshots { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct ResponseOfferSnapshot { #[prost(enumeration = "response_offer_snapshot::Result", tag = "1")] pub result: i32, @@ -588,7 +589,7 @@ pub struct ResponsePrepareProposal { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct ResponseProcessProposal { #[prost(enumeration = "response_process_proposal::ProposalStatus", tag = "1")] pub status: i32, @@ -645,7 +646,7 @@ pub struct ResponseExtendVote { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct ResponseVerifyVoteExtension { #[prost(enumeration = "response_verify_vote_extension::VerifyStatus", tag = "1")] pub status: i32, @@ -1062,19 +1063,17 @@ pub mod abci_server { } #[derive(Debug)] pub struct AbciServer { - inner: _Inner, + inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } - struct _Inner(Arc); impl AbciServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { - let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), @@ -1137,7 +1136,6 @@ pub mod abci_server { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); match req.uri().path() { "/tendermint.abci.ABCI/Echo" => { #[allow(non_camel_case_types)] @@ -1166,7 +1164,6 @@ pub mod abci_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = EchoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1210,7 +1207,6 @@ pub mod abci_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = FlushSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1254,7 +1250,6 @@ pub mod abci_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = InfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1298,7 +1293,6 @@ pub mod abci_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = CheckTxSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1342,7 +1336,6 @@ pub mod abci_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = QuerySvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1386,7 +1379,6 @@ pub mod abci_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = CommitSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1430,7 +1422,6 @@ pub mod abci_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = InitChainSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1476,7 +1467,6 @@ pub mod abci_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = ListSnapshotsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1522,7 +1512,6 @@ pub mod abci_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = OfferSnapshotSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1568,7 +1557,6 @@ pub mod abci_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = LoadSnapshotChunkSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1614,7 +1602,6 @@ pub mod abci_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = ApplySnapshotChunkSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1660,7 +1647,6 @@ pub mod abci_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = PrepareProposalSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1706,7 +1692,6 @@ pub mod abci_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = ProcessProposalSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1750,7 +1735,6 @@ pub mod abci_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = ExtendVoteSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1796,7 +1780,6 @@ pub mod abci_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = VerifyVoteExtensionSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1842,7 +1825,6 @@ pub mod abci_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = FinalizeBlockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1864,8 +1846,11 @@ pub mod abci_server { Ok( http::Response::builder() .status(200) - .header("grpc-status", "12") - .header("content-type", "application/grpc") + .header("grpc-status", tonic::Code::Unimplemented as i32) + .header( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ) .body(empty_body()) .unwrap(), ) @@ -1886,16 +1871,6 @@ pub mod abci_server { } } } - impl Clone for _Inner { - fn clone(&self) -> Self { - Self(Arc::clone(&self.0)) - } - } - impl std::fmt::Debug for _Inner { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } - } impl tonic::server::NamedService for AbciServer { const NAME: &'static str = "tendermint.abci.ABCI"; } diff --git a/proto/src/prost/v0_38/tendermint.blocksync.rs b/proto/src/prost/v0_38/tendermint.blocksync.rs index ae51fa7d7..380da98b9 100644 --- a/proto/src/prost/v0_38/tendermint.blocksync.rs +++ b/proto/src/prost/v0_38/tendermint.blocksync.rs @@ -1,13 +1,14 @@ +// This file is @generated by prost-build. /// BlockRequest requests a block for a specific height #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct BlockRequest { #[prost(int64, tag = "1")] pub height: i64, } /// NoBlockResponse informs the node that the peer does not have block at the requested height #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct NoBlockResponse { #[prost(int64, tag = "1")] pub height: i64, @@ -23,11 +24,11 @@ pub struct BlockResponse { } /// StatusRequest requests the status of a peer. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct StatusRequest {} /// StatusResponse is a peer response to inform their status. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct StatusResponse { #[prost(int64, tag = "1")] pub height: i64, diff --git a/proto/src/prost/v0_38/tendermint.consensus.rs b/proto/src/prost/v0_38/tendermint.consensus.rs index 95237cc78..c04bf2d5a 100644 --- a/proto/src/prost/v0_38/tendermint.consensus.rs +++ b/proto/src/prost/v0_38/tendermint.consensus.rs @@ -1,7 +1,8 @@ +// This file is @generated by prost-build. /// NewRoundStep is sent for every step taken in the ConsensusState. /// For every height/round/step transition #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct NewRoundStep { #[prost(int64, tag = "1")] pub height: i64, @@ -69,7 +70,7 @@ pub struct Vote { } /// HasVote is sent to indicate that a particular vote has been received. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct HasVote { #[prost(int64, tag = "1")] pub height: i64, @@ -150,7 +151,7 @@ pub struct MsgInfo { } /// TimeoutInfo internally generated messages which may update the state #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct TimeoutInfo { #[prost(message, optional, tag = "1")] pub duration: ::core::option::Option, @@ -164,7 +165,7 @@ pub struct TimeoutInfo { /// EndHeight marks the end of the given height inside WAL. /// @internal used by scripts/wal2json util. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct EndHeight { #[prost(int64, tag = "1")] pub height: i64, diff --git a/proto/src/prost/v0_38/tendermint.crypto.rs b/proto/src/prost/v0_38/tendermint.crypto.rs index 0b1c3e197..b62f77775 100644 --- a/proto/src/prost/v0_38/tendermint.crypto.rs +++ b/proto/src/prost/v0_38/tendermint.crypto.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/proto/src/prost/v0_38/tendermint.libs.bits.rs b/proto/src/prost/v0_38/tendermint.libs.bits.rs index 460876d21..7ddf7f64a 100644 --- a/proto/src/prost/v0_38/tendermint.libs.bits.rs +++ b/proto/src/prost/v0_38/tendermint.libs.bits.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/proto/src/prost/v0_38/tendermint.mempool.rs b/proto/src/prost/v0_38/tendermint.mempool.rs index 9fec1376b..056cddaf5 100644 --- a/proto/src/prost/v0_38/tendermint.mempool.rs +++ b/proto/src/prost/v0_38/tendermint.mempool.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Txs { diff --git a/proto/src/prost/v0_38/tendermint.p2p.rs b/proto/src/prost/v0_38/tendermint.p2p.rs index 1b96c2577..614ee2570 100644 --- a/proto/src/prost/v0_38/tendermint.p2p.rs +++ b/proto/src/prost/v0_38/tendermint.p2p.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -11,7 +12,7 @@ pub struct NetAddress { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct ProtocolVersion { #[prost(uint64, tag = "1")] pub p2p: u64, @@ -52,11 +53,11 @@ pub struct DefaultNodeInfoOther { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PacketPing {} #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PacketPong {} #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] @@ -101,7 +102,7 @@ pub struct AuthSigMessage { } #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PexRequest {} #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] diff --git a/proto/src/prost/v0_38/tendermint.privval.rs b/proto/src/prost/v0_38/tendermint.privval.rs index 8485c3816..04ed210fe 100644 --- a/proto/src/prost/v0_38/tendermint.privval.rs +++ b/proto/src/prost/v0_38/tendermint.privval.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct RemoteSignerError { @@ -60,11 +61,11 @@ pub struct SignedProposalResponse { } /// PingRequest is a request to confirm that the connection is alive. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PingRequest {} /// PingResponse is a response to confirm that the connection is alive. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PingResponse {} #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/proto/src/prost/v0_38/tendermint.rpc.grpc.rs b/proto/src/prost/v0_38/tendermint.rpc.grpc.rs index 0084885c0..505d0ec78 100644 --- a/proto/src/prost/v0_38/tendermint.rpc.grpc.rs +++ b/proto/src/prost/v0_38/tendermint.rpc.grpc.rs @@ -1,5 +1,6 @@ +// This file is @generated by prost-build. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RequestPing {} #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -8,7 +9,7 @@ pub struct RequestBroadcastTx { pub tx: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct ResponsePing {} #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -44,19 +45,17 @@ pub mod broadcast_api_server { /// broadcast API, and is scheduled for removal after v0.38. #[derive(Debug)] pub struct BroadcastApiServer { - inner: _Inner, + inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } - struct _Inner(Arc); impl BroadcastApiServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { - let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), @@ -119,7 +118,6 @@ pub mod broadcast_api_server { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); match req.uri().path() { "/tendermint.rpc.grpc.BroadcastAPI/Ping" => { #[allow(non_camel_case_types)] @@ -148,7 +146,6 @@ pub mod broadcast_api_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = PingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -194,7 +191,6 @@ pub mod broadcast_api_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = BroadcastTxSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -216,8 +212,11 @@ pub mod broadcast_api_server { Ok( http::Response::builder() .status(200) - .header("grpc-status", "12") - .header("content-type", "application/grpc") + .header("grpc-status", tonic::Code::Unimplemented as i32) + .header( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ) .body(empty_body()) .unwrap(), ) @@ -238,16 +237,6 @@ pub mod broadcast_api_server { } } } - impl Clone for _Inner { - fn clone(&self) -> Self { - Self(Arc::clone(&self.0)) - } - } - impl std::fmt::Debug for _Inner { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } - } impl tonic::server::NamedService for BroadcastApiServer { const NAME: &'static str = "tendermint.rpc.grpc.BroadcastAPI"; } diff --git a/proto/src/prost/v0_38/tendermint.state.rs b/proto/src/prost/v0_38/tendermint.state.rs index 014ddd6dc..a286f0155 100644 --- a/proto/src/prost/v0_38/tendermint.state.rs +++ b/proto/src/prost/v0_38/tendermint.state.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. /// LegacyABCIResponses retains the responses /// of the legacy ABCI calls during block processing. /// Note ReponseDeliverTx is renamed to ExecTxResult but they are semantically the same diff --git a/proto/src/prost/v0_38/tendermint.statesync.rs b/proto/src/prost/v0_38/tendermint.statesync.rs index a2ad034e3..5e13924a8 100644 --- a/proto/src/prost/v0_38/tendermint.statesync.rs +++ b/proto/src/prost/v0_38/tendermint.statesync.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Message { @@ -20,7 +21,7 @@ pub mod message { } } #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct SnapshotsRequest {} #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -37,7 +38,7 @@ pub struct SnapshotsResponse { pub metadata: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct ChunkRequest { #[prost(uint64, tag = "1")] pub height: u64, diff --git a/proto/src/prost/v0_38/tendermint.store.rs b/proto/src/prost/v0_38/tendermint.store.rs index 98d20b0fc..4d8f23e94 100644 --- a/proto/src/prost/v0_38/tendermint.store.rs +++ b/proto/src/prost/v0_38/tendermint.store.rs @@ -1,5 +1,6 @@ +// This file is @generated by prost-build. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct BlockStoreState { #[prost(int64, tag = "1")] pub base: i64, diff --git a/proto/src/prost/v0_38/tendermint.types.rs b/proto/src/prost/v0_38/tendermint.types.rs index 863ef73f4..4e1651388 100644 --- a/proto/src/prost/v0_38/tendermint.types.rs +++ b/proto/src/prost/v0_38/tendermint.types.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -496,7 +497,7 @@ pub struct ConsensusParams { /// BlockParams contains limits on the block size. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct BlockParams { /// Max block size, in bytes. /// Note: must be greater than 0 @@ -510,7 +511,7 @@ pub struct BlockParams { /// EvidenceParams determine how we handle evidence of malfeasance. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct EvidenceParams { /// Max age of evidence, in blocks. /// @@ -545,7 +546,7 @@ pub struct ValidatorParams { /// VersionParams contains the ABCI application version. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct VersionParams { #[prost(uint64, tag = "1")] pub app: u64, @@ -554,7 +555,7 @@ pub struct VersionParams { /// /// It is hashed into the Header.ConsensusHash. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct HashedParams { #[prost(int64, tag = "1")] pub block_max_bytes: i64, @@ -564,7 +565,7 @@ pub struct HashedParams { /// ABCIParams configure functionality specific to the Application Blockchain Interface. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct AbciParams { /// vote_extensions_enable_height configures the first height during which /// vote extensions will be enabled. During this specified height, and for all diff --git a/proto/src/prost/v0_38/tendermint.version.rs b/proto/src/prost/v0_38/tendermint.version.rs index 8a77a26fc..8c781751e 100644 --- a/proto/src/prost/v0_38/tendermint.version.rs +++ b/proto/src/prost/v0_38/tendermint.version.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. /// App includes the protocol and software version for the application. /// This information is included in ResponseInfo. The App.Protocol can be /// updated in ResponseEndBlock. @@ -14,7 +15,7 @@ pub struct App { /// state transition machine. #[derive(::serde::Deserialize, ::serde::Serialize)] #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct Consensus { #[prost(uint64, tag = "1")] #[serde(with = "crate::serializers::from_str")] diff --git a/proto/src/protobuf.rs b/proto/src/protobuf.rs index 8cececae9..7a587c209 100644 --- a/proto/src/protobuf.rs +++ b/proto/src/protobuf.rs @@ -16,8 +16,11 @@ /// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By /// restricting to that range, we ensure that we can convert to and from [RFC /// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. -#[derive(Clone, PartialEq, ::prost::Message, ::serde::Deserialize, ::serde::Serialize)] -#[serde(from = "crate::serializers::timestamp::Rfc3339", into = "crate::serializers::timestamp::Rfc3339")] +#[derive(Copy, Clone, PartialEq, ::prost::Message, ::serde::Deserialize, ::serde::Serialize)] +#[serde( + from = "crate::serializers::timestamp::Rfc3339", + into = "crate::serializers::timestamp::Rfc3339" +)] pub struct Timestamp { /// Represents seconds of UTC time since Unix epoch /// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to @@ -38,7 +41,7 @@ pub struct Timestamp { /// or "month". It is related to Timestamp in that the difference between /// two Timestamp values is a Duration and it can be added or subtracted /// from a Timestamp. Range is approximately +-10,000 years. -#[derive(Clone, PartialEq, ::prost::Message, ::serde::Deserialize, ::serde::Serialize)] +#[derive(Copy, Clone, PartialEq, ::prost::Message, ::serde::Deserialize, ::serde::Serialize)] pub struct Duration { /// Signed seconds of the span of time. Must be from -315,576,000,000 /// to +315,576,000,000 inclusive. Note: these bounds are computed from: diff --git a/tools/proto-compiler/Cargo.toml b/tools/proto-compiler/Cargo.toml index 0eb8f885b..48830f186 100644 --- a/tools/proto-compiler/Cargo.toml +++ b/tools/proto-compiler/Cargo.toml @@ -7,11 +7,11 @@ publish = false [dependencies] walkdir = { version = "2.3" } -prost-build = { version = "0.12.0" } +prost-build = { version = "0.13" } git2 = { version = "0.16" } tempfile = { version = "3.5.0" } subtle-encoding = { version = "0.5" } serde = { version = "1.0", features = ["derive"] } serde_yaml = { version = "0.9" } thiserror = { version = "1.0" } -tonic-build = { version = "0.10.0" } +tonic-build = { version = "0.12" } From 475a1f8792ae72bf69653656d4d213d9565d6f88 Mon Sep 17 00:00:00 2001 From: Luca Joss <43531661+ljoss17@users.noreply.github.com> Date: Thu, 18 Jul 2024 10:09:27 +0200 Subject: [PATCH 17/28] Release v0.38.0 (#1442) * Build changelog for v0.38.0 * Update CHANGELOG.md * Bump versions --- .../1435-block-domain-type.md | 0 .../breaking-changes/prost-0.13+tonic-0.12.md | 0 ...40-allow-empty-consensus-params-updates.md | 0 .../features/1438-genesis-chunked-endpoint.md | 0 .changelog/v0.38.0/summary.md | 3 +++ CHANGELOG.md | 26 +++++++++++++++++++ abci/Cargo.toml | 4 +-- config/Cargo.toml | 4 +-- light-client-cli/Cargo.toml | 10 +++---- light-client-detector/Cargo.toml | 10 +++---- light-client-js/Cargo.toml | 6 ++--- light-client-verifier/Cargo.toml | 4 +-- light-client/Cargo.toml | 8 +++--- p2p/Cargo.toml | 8 +++--- pbt-gen/Cargo.toml | 2 +- proto/Cargo.toml | 2 +- rpc/Cargo.toml | 10 +++---- std-ext/Cargo.toml | 2 +- tendermint/Cargo.toml | 4 +-- test/Cargo.toml | 2 +- testgen/Cargo.toml | 4 +-- tools/abci-test/Cargo.toml | 8 +++--- tools/kvstore-test/Cargo.toml | 6 ++--- tools/rpc-probe/Cargo.toml | 2 +- 24 files changed, 77 insertions(+), 48 deletions(-) rename .changelog/{unreleased => v0.38.0}/breaking-changes/1435-block-domain-type.md (100%) rename .changelog/{unreleased => v0.38.0}/breaking-changes/prost-0.13+tonic-0.12.md (100%) rename .changelog/{unreleased => v0.38.0}/bug/1440-allow-empty-consensus-params-updates.md (100%) rename .changelog/{unreleased => v0.38.0}/features/1438-genesis-chunked-endpoint.md (100%) create mode 100644 .changelog/v0.38.0/summary.md diff --git a/.changelog/unreleased/breaking-changes/1435-block-domain-type.md b/.changelog/v0.38.0/breaking-changes/1435-block-domain-type.md similarity index 100% rename from .changelog/unreleased/breaking-changes/1435-block-domain-type.md rename to .changelog/v0.38.0/breaking-changes/1435-block-domain-type.md diff --git a/.changelog/unreleased/breaking-changes/prost-0.13+tonic-0.12.md b/.changelog/v0.38.0/breaking-changes/prost-0.13+tonic-0.12.md similarity index 100% rename from .changelog/unreleased/breaking-changes/prost-0.13+tonic-0.12.md rename to .changelog/v0.38.0/breaking-changes/prost-0.13+tonic-0.12.md diff --git a/.changelog/unreleased/bug/1440-allow-empty-consensus-params-updates.md b/.changelog/v0.38.0/bug/1440-allow-empty-consensus-params-updates.md similarity index 100% rename from .changelog/unreleased/bug/1440-allow-empty-consensus-params-updates.md rename to .changelog/v0.38.0/bug/1440-allow-empty-consensus-params-updates.md diff --git a/.changelog/unreleased/features/1438-genesis-chunked-endpoint.md b/.changelog/v0.38.0/features/1438-genesis-chunked-endpoint.md similarity index 100% rename from .changelog/unreleased/features/1438-genesis-chunked-endpoint.md rename to .changelog/v0.38.0/features/1438-genesis-chunked-endpoint.md diff --git a/.changelog/v0.38.0/summary.md b/.changelog/v0.38.0/summary.md new file mode 100644 index 000000000..35b7a54be --- /dev/null +++ b/.changelog/v0.38.0/summary.md @@ -0,0 +1,3 @@ +*July 15th, 2024* + +This release enhances `/block_results` response handling, relaxes `Block` validation, and adds support for the `/genesis_chunked` RPC endpoint. \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 57bdaa4c2..0da2cbca7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,31 @@ # CHANGELOG +## v0.38.0 + +*July 15th, 2024* + +This release enhances `/block_results` response handling, relaxes `Block` validation, and adds support for the `/genesis_chunked` RPC endpoint. + +### BREAKING CHANGES + +- tendermint: relax validation rules on `Block` + ([\#1435](https://github.com/informalsystems/tendermint-rs/issues/1435)) +- `[tendermint-proto]`: Update `prost` to v0.13 and `tonic` to v0.12 + ([\#1444](https://github.com/informalsystems/tendermint-rs/pull/1444)) + + +### BUG + +- `[tendermint-rpc]` Deserialize an empty JSON object as `None` for the `consensus_param_updates` + field in the `/block_results` response. + Deserialize version in consensus params as `None` if it is an empty object, null or not found. + ([\#1440](https://github.com/informalsystems/tendermint-rs/issues/1440)) + +### FEATURES + +- `[tendermint-rpc]` Add support for the `/genesis_chunked` RPC endpoint + ([\#1438](https://github.com/informalsystems/tendermint-rs/issues/1438)) + ## v0.37.0 *May 30th, 2024* diff --git a/abci/Cargo.toml b/abci/Cargo.toml index a9dfcad50..af3199395 100644 --- a/abci/Cargo.toml +++ b/abci/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-abci" -version = "0.37.0" +version = "0.38.0" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" @@ -33,7 +33,7 @@ binary = [ [dependencies] bytes = { version = "1.0", default-features = false } prost = { version = "0.13", default-features = false } -tendermint-proto = { version = "0.37.0", default-features = false, path = "../proto" } +tendermint-proto = { version = "0.38.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 } diff --git a/config/Cargo.toml b/config/Cargo.toml index b7dca41b2..b77d83a62 100644 --- a/config/Cargo.toml +++ b/config/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-config" -version = "0.37.0" # Also update depending crates (rpc, light-node, ..) when bumping this. +version = "0.38.0" # Also update depending crates (rpc, light-node, ..) when bumping this. license = "Apache-2.0" homepage = "https://www.tendermint.com/" repository = "https://github.com/informalsystems/tendermint-rs/tree/main/tendermint" @@ -24,7 +24,7 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [dependencies] -tendermint = { version = "0.37.0", default-features = false, features = ["rust-crypto"], path = "../tendermint" } +tendermint = { version = "0.38.0", default-features = false, features = ["rust-crypto"], path = "../tendermint" } flex-error = { version = "0.4.4", default-features = false } serde = { version = "1", features = ["derive"] } serde_json = "1" diff --git a/light-client-cli/Cargo.toml b/light-client-cli/Cargo.toml index 0e17c4156..78e67aec3 100644 --- a/light-client-cli/Cargo.toml +++ b/light-client-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client-cli" -version = "0.37.0" +version = "0.38.0" edition = "2021" license = "Apache-2.0" readme = "README.md" @@ -23,10 +23,10 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [dependencies] -tendermint = { version = "0.37.0", path = "../tendermint" } -tendermint-rpc = { version = "0.37.0", path = "../rpc", features = ["http-client"] } -tendermint-light-client = { version = "0.37.0", path = "../light-client" } -tendermint-light-client-detector = { version = "0.37.0", path = "../light-client-detector" } +tendermint = { version = "0.38.0", path = "../tendermint" } +tendermint-rpc = { version = "0.38.0", path = "../rpc", features = ["http-client"] } +tendermint-light-client = { version = "0.38.0", path = "../light-client" } +tendermint-light-client-detector = { version = "0.38.0", path = "../light-client-detector" } clap = { version = "4.1.8", features = ["derive"] } color-eyre = "0.6.2" diff --git a/light-client-detector/Cargo.toml b/light-client-detector/Cargo.toml index 5dd097aec..b02067db3 100644 --- a/light-client-detector/Cargo.toml +++ b/light-client-detector/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client-detector" -version = "0.37.0" +version = "0.38.0" edition = "2021" license = "Apache-2.0" readme = "README.md" @@ -23,10 +23,10 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [dependencies] -tendermint = { version = "0.37.0", path = "../tendermint" } -tendermint-rpc = { version = "0.37.0", path = "../rpc", features = ["http-client"] } -tendermint-proto = { version = "0.37.0", path = "../proto" } -tendermint-light-client = { version = "0.37.0", path = "../light-client" } +tendermint = { version = "0.38.0", path = "../tendermint" } +tendermint-rpc = { version = "0.38.0", path = "../rpc", features = ["http-client"] } +tendermint-proto = { version = "0.38.0", path = "../proto" } +tendermint-light-client = { version = "0.38.0", path = "../light-client" } crossbeam-channel = { version = "0.5.11", default-features = false } derive_more = { version = "0.99.5", default-features = false, features = ["display"] } diff --git a/light-client-js/Cargo.toml b/light-client-js/Cargo.toml index 5af4f7c64..9cd988d78 100644 --- a/light-client-js/Cargo.toml +++ b/light-client-js/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client-js" -version = "0.37.0" +version = "0.38.0" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" @@ -22,8 +22,8 @@ default = ["console_error_panic_hook"] [dependencies] serde = { version = "1.0", default-features = false, features = [ "derive" ] } serde_json = { version = "1.0", default-features = false } -tendermint = { version = "0.37.0", default-features = false, path = "../tendermint" } -tendermint-light-client-verifier = { version = "0.37.0", features = ["rust-crypto"], default-features = false, path = "../light-client-verifier" } +tendermint = { version = "0.38.0", default-features = false, path = "../tendermint" } +tendermint-light-client-verifier = { version = "0.38.0", features = ["rust-crypto"], default-features = false, path = "../light-client-verifier" } wasm-bindgen = { version = "0.2.63", default-features = false, features = [ "serde-serialize" ] } serde-wasm-bindgen = { version = "0.4.5", default-features = false } diff --git a/light-client-verifier/Cargo.toml b/light-client-verifier/Cargo.toml index f97ab96e6..944165008 100644 --- a/light-client-verifier/Cargo.toml +++ b/light-client-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client-verifier" -version = "0.37.0" +version = "0.38.0" edition = "2021" license = "Apache-2.0" readme = "README.md" @@ -27,7 +27,7 @@ default = ["rust-crypto", "flex-error/std"] rust-crypto = ["tendermint/rust-crypto"] [dependencies] -tendermint = { version = "0.37.0", path = "../tendermint", default-features = false } +tendermint = { version = "0.38.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 } diff --git a/light-client/Cargo.toml b/light-client/Cargo.toml index dc58b84d8..a791ebcdc 100644 --- a/light-client/Cargo.toml +++ b/light-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client" -version = "0.37.0" +version = "0.38.0" edition = "2021" license = "Apache-2.0" readme = "README.md" @@ -35,9 +35,9 @@ unstable = ["rust-crypto"] mbt = ["rust-crypto"] [dependencies] -tendermint = { version = "0.37.0", path = "../tendermint", default-features = false } -tendermint-rpc = { version = "0.37.0", path = "../rpc", default-features = false } -tendermint-light-client-verifier = { version = "0.37.0", path = "../light-client-verifier", default-features = false } +tendermint = { version = "0.38.0", path = "../tendermint", default-features = false } +tendermint-rpc = { version = "0.38.0", path = "../rpc", default-features = false } +tendermint-light-client-verifier = { version = "0.38.0", path = "../light-client-verifier", default-features = false } contracts = { version = "0.6.2", default-features = false } crossbeam-channel = { version = "0.5.11", default-features = false, features = ["std"] } diff --git a/p2p/Cargo.toml b/p2p/Cargo.toml index 2af28a7c2..221be360e 100644 --- a/p2p/Cargo.toml +++ b/p2p/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-p2p" -version = "0.37.0" +version = "0.38.0" edition = "2021" license = "Apache-2.0" repository = "https://github.com/informalsystems/tendermint-rs" @@ -44,9 +44,9 @@ aead = { version = "0.5", default-features = false } flex-error = { version = "0.4.4", default-features = false } # path dependencies -tendermint = { path = "../tendermint", version = "0.37.0", default-features = false } -tendermint-proto = { path = "../proto", version = "0.37.0", default-features = false } -tendermint-std-ext = { path = "../std-ext", version = "0.37.0", default-features = false } +tendermint = { path = "../tendermint", version = "0.38.0", default-features = false } +tendermint-proto = { path = "../proto", version = "0.38.0", default-features = false } +tendermint-std-ext = { path = "../std-ext", version = "0.38.0", default-features = false } # optional dependencies prost-derive = { version = "0.13", optional = true } diff --git a/pbt-gen/Cargo.toml b/pbt-gen/Cargo.toml index f809cbe5c..40fc2bdc0 100644 --- a/pbt-gen/Cargo.toml +++ b/pbt-gen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-pbt-gen" -version = "0.37.0" +version = "0.38.0" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" diff --git a/proto/Cargo.toml b/proto/Cargo.toml index cad98fb2d..f08997f67 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-proto" -version = "0.37.0" +version = "0.38.0" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index d583787fe..c8ecfa743 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-rpc" -version = "0.37.0" +version = "0.38.0" edition = "2021" license = "Apache-2.0" homepage = "https://www.tendermint.com/" @@ -55,9 +55,9 @@ websocket-client = [ ] [dependencies] -tendermint = { version = "0.37.0", default-features = false, path = "../tendermint" } -tendermint-config = { version = "0.37.0", path = "../config", default-features = false } -tendermint-proto = { version = "0.37.0", path = "../proto", default-features = false } +tendermint = { version = "0.38.0", default-features = false, path = "../tendermint" } +tendermint-config = { version = "0.38.0", path = "../config", default-features = false } +tendermint-proto = { version = "0.38.0", path = "../proto", default-features = false } async-trait = { version = "0.1", default-features = false } bytes = { version = "1.0", default-features = false } @@ -88,7 +88,7 @@ tracing = { version = "0.1", optional = true, default-features = false } tracing-subscriber = { version = "0.3", optional = true, default-features = false, features = ["fmt"] } [dev-dependencies] -tendermint = { version = "0.37.0", default-features = false, path = "../tendermint", features = ["secp256k1"] } +tendermint = { version = "0.38.0", default-features = false, path = "../tendermint", features = ["secp256k1"] } http = { version = "1", default-features = false, features = ["std"] } lazy_static = { version = "1.4.0", default-features = false } tokio-test = { version = "0.4", default-features = false } diff --git a/std-ext/Cargo.toml b/std-ext/Cargo.toml index 4a210d5f4..0a5cfa9a1 100644 --- a/std-ext/Cargo.toml +++ b/std-ext/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-std-ext" -version = "0.37.0" +version = "0.38.0" edition = "2021" license = "Apache-2.0" homepage = "https://www.tendermint.com/" diff --git a/tendermint/Cargo.toml b/tendermint/Cargo.toml index 28edee9f4..bf1605dc9 100644 --- a/tendermint/Cargo.toml +++ b/tendermint/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint" -version = "0.37.0" # Also update depending crates (rpc, light-node, etc..) when bumping this . +version = "0.38.0" # Also update depending crates (rpc, light-node, etc..) when bumping this . license = "Apache-2.0" homepage = "https://www.tendermint.com/" repository = "https://github.com/informalsystems/tendermint-rs/tree/main/tendermint" @@ -44,7 +44,7 @@ serde_repr = { version = "0.1", default-features = false } signature = { version = "2", default-features = false, features = ["alloc"] } subtle = { version = "2", default-features = false } subtle-encoding = { version = "0.5", default-features = false, features = ["bech32-preview"] } -tendermint-proto = { version = "0.37.0", default-features = false, path = "../proto" } +tendermint-proto = { version = "0.38.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 } diff --git a/test/Cargo.toml b/test/Cargo.toml index de71dd772..c7bc3d182 100644 --- a/test/Cargo.toml +++ b/test/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tendermint-test" description = "Tendermint workspace tests and common utilities for testing." -version = "0.37.0" +version = "0.38.0" edition = "2021" license = "Apache-2.0" categories = ["development", "test", "tools"] diff --git a/testgen/Cargo.toml b/testgen/Cargo.toml index 5ca20e23e..50af3b565 100644 --- a/testgen/Cargo.toml +++ b/testgen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-testgen" -version = "0.37.0" +version = "0.38.0" authors = ["Informal Systems "] edition = "2021" readme = "README.md" @@ -16,7 +16,7 @@ description = """ """ [dependencies] -tendermint = { version = "0.37.0", path = "../tendermint", features = ["clock"] } +tendermint = { version = "0.38.0", path = "../tendermint", features = ["clock"] } serde = { version = "1", default-features = false, features = ["derive"] } serde_json = { version = "1", default-features = false, features = ["std"] } ed25519-consensus = { version = "2", default-features = false } diff --git a/tools/abci-test/Cargo.toml b/tools/abci-test/Cargo.toml index 3c3a6a79b..5166bf3e3 100644 --- a/tools/abci-test/Cargo.toml +++ b/tools/abci-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "abci-test" -version = "0.37.0" +version = "0.38.0" authors = ["Informal Systems "] edition = "2021" description = """ @@ -14,9 +14,9 @@ description = """ flex-error = { version = "0.4.4", default-features = false, features = ["std"] } futures = "0.3" structopt = "0.3" -tendermint = { version = "0.37.0", path = "../../tendermint" } -tendermint-config = { version = "0.37.0", path = "../../config" } -tendermint-rpc = { version = "0.37.0", path = "../../rpc", features = [ "websocket-client" ] } +tendermint = { version = "0.38.0", path = "../../tendermint" } +tendermint-config = { version = "0.38.0", path = "../../config" } +tendermint-rpc = { version = "0.38.0", path = "../../rpc", features = [ "websocket-client" ] } tracing = "0.1" tracing-subscriber = "0.2" tokio = { version = "1.20", features = ["full"] } diff --git a/tools/kvstore-test/Cargo.toml b/tools/kvstore-test/Cargo.toml index 45cef858f..a629bb35b 100644 --- a/tools/kvstore-test/Cargo.toml +++ b/tools/kvstore-test/Cargo.toml @@ -11,9 +11,9 @@ edition = "2021" [dev-dependencies] futures = "0.3" sha2 = "0.10" -tendermint = { version = "0.37.0", path = "../../tendermint" } -tendermint-light-client = { version = "0.37.0", path = "../../light-client", features = ["unstable"] } -tendermint-rpc = { version = "0.37.0", path = "../../rpc", features = [ "http-client", "websocket-client" ] } +tendermint = { version = "0.38.0", path = "../../tendermint" } +tendermint-light-client = { version = "0.38.0", path = "../../light-client", features = ["unstable"] } +tendermint-rpc = { version = "0.38.0", path = "../../rpc", features = [ "http-client", "websocket-client" ] } tokio = { version = "1.0", features = [ "rt-multi-thread", "macros" ] } tracing = "0.1" tracing-subscriber = "0.3" diff --git a/tools/rpc-probe/Cargo.toml b/tools/rpc-probe/Cargo.toml index 4dfede85b..dfa160ea9 100644 --- a/tools/rpc-probe/Cargo.toml +++ b/tools/rpc-probe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-rpc-probe" -version = "0.37.0" +version = "0.38.0" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" From 981bc34fb69189533c1ec069537644435ec5b82a Mon Sep 17 00:00:00 2001 From: Romain Ruetschi Date: Mon, 22 Jul 2024 13:28:13 +0200 Subject: [PATCH 18/28] fix: Bump `prost` and `prost-types` to latest versions in `tendermint` crate (#1446) * Bump prost and tonic to latest versions in `tendermint` crate * Add changelog entry * Update .changelog/unreleased/breaking-changes/1446-fix-prost-version.md --- .../unreleased/breaking-changes/1446-fix-prost-version.md | 5 +++++ tendermint/Cargo.toml | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changelog/unreleased/breaking-changes/1446-fix-prost-version.md diff --git a/.changelog/unreleased/breaking-changes/1446-fix-prost-version.md b/.changelog/unreleased/breaking-changes/1446-fix-prost-version.md new file mode 100644 index 000000000..a13bf258a --- /dev/null +++ b/.changelog/unreleased/breaking-changes/1446-fix-prost-version.md @@ -0,0 +1,5 @@ +- `[tendermint]` Bump `prost` and `prost-types` to their latest versions in the `tendermint` crate. + This was missed in [#1444](https://github.com/informalsystems/tendermint-rs/pull/1444), + which only updated the two dependencies in `tendermint-rpc`, leading to duplicate versions + of both crates to be present in the dependency graph. + ([#1446](https://github.com/informalsystems/tendermint-rs/pull/1446)) diff --git a/tendermint/Cargo.toml b/tendermint/Cargo.toml index bf1605dc9..07e5083c0 100644 --- a/tendermint/Cargo.toml +++ b/tendermint/Cargo.toml @@ -35,8 +35,8 @@ ed25519 = { version = "2", default-features = false, features = ["alloc"] } futures = { version = "0.3", default-features = false } num-traits = { version = "0.2", default-features = false } once_cell = { version = "1.3", default-features = false } -prost = { version = "0.12", default-features = false } -prost-types = { version = "0.12", default-features = false } +prost = { version = "0.13", default-features = false } +prost-types = { version = "0.13", default-features = false } serde = { version = "1", default-features = false, features = ["derive"] } serde_json = { version = "1", default-features = false, features = ["alloc"] } serde_bytes = { version = "0.11", default-features = false } From 58ff7662fccfc06787e72eadee38c09acc5c9ff1 Mon Sep 17 00:00:00 2001 From: Luca Joss <43531661+ljoss17@users.noreply.github.com> Date: Tue, 23 Jul 2024 12:27:08 +0200 Subject: [PATCH 19/28] rpc: Fix `AppHash` decoding failure in `/block_results` response (#1449) * If AppHash decoding fails, try with decoding with base64 * Add changelog entry * Update .changelog/unreleased/improvements/1449-allow-base64-apphash.md Co-authored-by: Romain Ruetschi --------- Co-authored-by: Romain Ruetschi --- .../improvements/1449-allow-base64-apphash.md | 2 + tendermint/src/hash.rs | 56 ++++++++++++++++++- tendermint/src/serializers/apphash.rs | 11 ++-- 3 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 .changelog/unreleased/improvements/1449-allow-base64-apphash.md diff --git a/.changelog/unreleased/improvements/1449-allow-base64-apphash.md b/.changelog/unreleased/improvements/1449-allow-base64-apphash.md new file mode 100644 index 000000000..0968b1609 --- /dev/null +++ b/.changelog/unreleased/improvements/1449-allow-base64-apphash.md @@ -0,0 +1,2 @@ +- `[tendermint-rpc]` If `AppHash` fails to decode as hex, try to decode it as base64. + ([\#1449](https://github.com/informalsystems/tendermint-rs/issues/1449)) \ No newline at end of file diff --git a/tendermint/src/hash.rs b/tendermint/src/hash.rs index 8b91e0206..9926a0ab3 100644 --- a/tendermint/src/hash.rs +++ b/tendermint/src/hash.rs @@ -7,7 +7,7 @@ use core::{ use bytes::Bytes; use serde::{de::Error as _, Deserialize, Deserializer, Serialize, Serializer}; -use subtle_encoding::{Encoding, Hex}; +use subtle_encoding::{base64, Encoding, Hex}; use tendermint_proto::Protobuf; use crate::{error::Error, prelude::*}; @@ -253,6 +253,12 @@ impl AppHash { .map_err(Error::subtle_encoding)?; Ok(AppHash(h)) } + + /// Decode a `Hash` from base64-encoded string + pub fn from_base64(s: &str) -> Result { + let h = base64::decode(s).map_err(Error::subtle_encoding)?; + Ok(AppHash(h)) + } } impl AsRef<[u8]> for AppHash { @@ -285,6 +291,52 @@ impl FromStr for AppHash { type Err = Error; fn from_str(s: &str) -> Result { - Self::from_hex_upper(s) + Self::from_hex_upper(s).or_else(|_| Self::from_base64(s)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[derive(Debug, serde::Deserialize)] + struct Test { + #[serde(default)] + #[serde(with = "crate::serializers::apphash")] + pub app_hash: AppHash, + } + + #[test] + fn apphash_decode_base64() { + let test = serde_json::from_str::( + r#"{"app_hash":"MfX9f+bYoI8IioRb4YT/8/VhPvtNjgWFgTi4mmMSkBc="}"#, + ) + .unwrap(); + + assert_eq!( + test.app_hash.as_ref(), + &[ + 0x31, 0xF5, 0xFD, 0x7F, 0xE6, 0xD8, 0xA0, 0x8F, 0x08, 0x8A, 0x84, 0x5B, 0xE1, 0x84, + 0xFF, 0xF3, 0xF5, 0x61, 0x3E, 0xFB, 0x4D, 0x8E, 0x05, 0x85, 0x81, 0x38, 0xB8, 0x9A, + 0x63, 0x12, 0x90, 0x17 + ] + ); + } + + #[test] + fn apphash_decode_hex() { + let test = serde_json::from_str::( + r#"{"app_hash":"31F5FD7FE6D8A08F088A845BE184FFF3F5613EFB4D8E05858138B89A63129017"}"#, + ) + .unwrap(); + + assert_eq!( + test.app_hash.as_ref(), + &[ + 0x31, 0xF5, 0xFD, 0x7F, 0xE6, 0xD8, 0xA0, 0x8F, 0x08, 0x8A, 0x84, 0x5B, 0xE1, 0x84, + 0xFF, 0xF3, 0xF5, 0x61, 0x3E, 0xFB, 0x4D, 0x8E, 0x05, 0x85, 0x81, 0x38, 0xB8, 0x9A, + 0x63, 0x12, 0x90, 0x17 + ] + ); } } diff --git a/tendermint/src/serializers/apphash.rs b/tendermint/src/serializers/apphash.rs index d5c34a588..390b0224a 100644 --- a/tendermint/src/serializers/apphash.rs +++ b/tendermint/src/serializers/apphash.rs @@ -1,9 +1,10 @@ //! AppHash serialization with validation +use core::str::FromStr; + use alloc::borrow::Cow; -use serde::{de, ser, Deserialize, Deserializer, Serializer}; -use subtle_encoding::hex; +use serde::{de, Deserialize, Deserializer, Serializer}; use crate::{prelude::*, AppHash}; @@ -13,7 +14,7 @@ where D: Deserializer<'de>, { let hexstring = Option::>::deserialize(deserializer)?.unwrap_or(Cow::Borrowed("")); - AppHash::from_hex_upper(&hexstring).map_err(de::Error::custom) + AppHash::from_str(&hexstring).map_err(de::Error::custom) } /// Serialize from AppHash into hexstring @@ -21,8 +22,6 @@ pub fn serialize(value: &AppHash, serializer: S) -> Result where S: Serializer, { - let hex_bytes = hex::encode_upper(value.as_ref()); - let hex_string = String::from_utf8(hex_bytes).map_err(ser::Error::custom)?; // Serialize as Option for symmetry with deserialize - serializer.serialize_some(&hex_string) + serializer.serialize_some(&value.to_string()) } From 88d582e1ba01ab898b9f19e1788c2547877854ee Mon Sep 17 00:00:00 2001 From: Luca Joss <43531661+ljoss17@users.noreply.github.com> Date: Tue, 23 Jul 2024 14:48:31 +0200 Subject: [PATCH 20/28] Release v0.38.1 (#1450) * Build changelog release * Update CHANGELOG * Bump versions from v0.38.0 to v0.38.1 * Apply suggestions from code review Co-authored-by: Romain Ruetschi --------- Co-authored-by: Romain Ruetschi --- ...-0.12.md => 1444-prost-0.13+tonic-0.12.md} | 0 .../1446-fix-prost-version.md | 0 .../improvements/1449-allow-base64-apphash.md | 0 .changelog/v0.38.1/summary.md | 4 ++++ CHANGELOG.md | 20 +++++++++++++++++++ abci/Cargo.toml | 4 ++-- config/Cargo.toml | 4 ++-- light-client-cli/Cargo.toml | 10 +++++----- light-client-detector/Cargo.toml | 10 +++++----- light-client-js/Cargo.toml | 6 +++--- light-client-verifier/Cargo.toml | 4 ++-- light-client/Cargo.toml | 8 ++++---- p2p/Cargo.toml | 8 ++++---- pbt-gen/Cargo.toml | 2 +- proto/Cargo.toml | 2 +- rpc/Cargo.toml | 10 +++++----- std-ext/Cargo.toml | 2 +- tendermint/Cargo.toml | 4 ++-- test/Cargo.toml | 2 +- testgen/Cargo.toml | 4 ++-- tools/abci-test/Cargo.toml | 8 ++++---- tools/kvstore-test/Cargo.toml | 6 +++--- tools/rpc-probe/Cargo.toml | 2 +- 23 files changed, 72 insertions(+), 48 deletions(-) rename .changelog/v0.38.0/breaking-changes/{prost-0.13+tonic-0.12.md => 1444-prost-0.13+tonic-0.12.md} (100%) rename .changelog/{unreleased => v0.38.1}/breaking-changes/1446-fix-prost-version.md (100%) rename .changelog/{unreleased => v0.38.1}/improvements/1449-allow-base64-apphash.md (100%) create mode 100644 .changelog/v0.38.1/summary.md diff --git a/.changelog/v0.38.0/breaking-changes/prost-0.13+tonic-0.12.md b/.changelog/v0.38.0/breaking-changes/1444-prost-0.13+tonic-0.12.md similarity index 100% rename from .changelog/v0.38.0/breaking-changes/prost-0.13+tonic-0.12.md rename to .changelog/v0.38.0/breaking-changes/1444-prost-0.13+tonic-0.12.md diff --git a/.changelog/unreleased/breaking-changes/1446-fix-prost-version.md b/.changelog/v0.38.1/breaking-changes/1446-fix-prost-version.md similarity index 100% rename from .changelog/unreleased/breaking-changes/1446-fix-prost-version.md rename to .changelog/v0.38.1/breaking-changes/1446-fix-prost-version.md diff --git a/.changelog/unreleased/improvements/1449-allow-base64-apphash.md b/.changelog/v0.38.1/improvements/1449-allow-base64-apphash.md similarity index 100% rename from .changelog/unreleased/improvements/1449-allow-base64-apphash.md rename to .changelog/v0.38.1/improvements/1449-allow-base64-apphash.md diff --git a/.changelog/v0.38.1/summary.md b/.changelog/v0.38.1/summary.md new file mode 100644 index 000000000..548fd2d47 --- /dev/null +++ b/.changelog/v0.38.1/summary.md @@ -0,0 +1,4 @@ +*July 23rd, 2024* + +This release enhances decoding of the `AppHash` type by trying to decode it as base64 if it fails to decode as hex. +This release also updates `prost` and `prost-types` to their latest version in the `tendermint` crate, something that was missed in the v0.38.0 release. \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 0da2cbca7..ab3793c32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # CHANGELOG +## v0.38.1 + +*July 23rd, 2024* + +This release enhances decoding of the `AppHash` type by trying to decode it as base64 if it fails to decode as hex. +This release also updates `prost` and `prost-types` to their latest version in the `tendermint` crate, something that was missed in the v0.38.0 release. + +### BREAKING CHANGES + +- `[tendermint]` Bump `prost` and `prost-types` to their latest versions in the `tendermint` crate. + This was missed in [#1444](https://github.com/informalsystems/tendermint-rs/pull/1444), + which only updated the two dependencies in `tendermint-rpc`, leading to duplicate versions + of both crates to be present in the dependency graph. + ([#1446](https://github.com/informalsystems/tendermint-rs/pull/1446)) + +### IMPROVEMENTS + +- `[tendermint-rpc]` If `AppHash` fails to decode as hex, try to decode it as base64. + ([\#1449](https://github.com/informalsystems/tendermint-rs/issues/1449)) + ## v0.38.0 *July 15th, 2024* diff --git a/abci/Cargo.toml b/abci/Cargo.toml index af3199395..36ada0999 100644 --- a/abci/Cargo.toml +++ b/abci/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-abci" -version = "0.38.0" +version = "0.38.1" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" @@ -33,7 +33,7 @@ binary = [ [dependencies] bytes = { version = "1.0", default-features = false } prost = { version = "0.13", default-features = false } -tendermint-proto = { version = "0.38.0", default-features = false, path = "../proto" } +tendermint-proto = { version = "0.38.1", 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 } diff --git a/config/Cargo.toml b/config/Cargo.toml index b77d83a62..ea9e997ed 100644 --- a/config/Cargo.toml +++ b/config/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-config" -version = "0.38.0" # Also update depending crates (rpc, light-node, ..) when bumping this. +version = "0.38.1" # Also update depending crates (rpc, light-node, ..) when bumping this. license = "Apache-2.0" homepage = "https://www.tendermint.com/" repository = "https://github.com/informalsystems/tendermint-rs/tree/main/tendermint" @@ -24,7 +24,7 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [dependencies] -tendermint = { version = "0.38.0", default-features = false, features = ["rust-crypto"], path = "../tendermint" } +tendermint = { version = "0.38.1", default-features = false, features = ["rust-crypto"], path = "../tendermint" } flex-error = { version = "0.4.4", default-features = false } serde = { version = "1", features = ["derive"] } serde_json = "1" diff --git a/light-client-cli/Cargo.toml b/light-client-cli/Cargo.toml index 78e67aec3..4419862cc 100644 --- a/light-client-cli/Cargo.toml +++ b/light-client-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client-cli" -version = "0.38.0" +version = "0.38.1" edition = "2021" license = "Apache-2.0" readme = "README.md" @@ -23,10 +23,10 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [dependencies] -tendermint = { version = "0.38.0", path = "../tendermint" } -tendermint-rpc = { version = "0.38.0", path = "../rpc", features = ["http-client"] } -tendermint-light-client = { version = "0.38.0", path = "../light-client" } -tendermint-light-client-detector = { version = "0.38.0", path = "../light-client-detector" } +tendermint = { version = "0.38.1", path = "../tendermint" } +tendermint-rpc = { version = "0.38.1", path = "../rpc", features = ["http-client"] } +tendermint-light-client = { version = "0.38.1", path = "../light-client" } +tendermint-light-client-detector = { version = "0.38.1", path = "../light-client-detector" } clap = { version = "4.1.8", features = ["derive"] } color-eyre = "0.6.2" diff --git a/light-client-detector/Cargo.toml b/light-client-detector/Cargo.toml index b02067db3..eb138c386 100644 --- a/light-client-detector/Cargo.toml +++ b/light-client-detector/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client-detector" -version = "0.38.0" +version = "0.38.1" edition = "2021" license = "Apache-2.0" readme = "README.md" @@ -23,10 +23,10 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [dependencies] -tendermint = { version = "0.38.0", path = "../tendermint" } -tendermint-rpc = { version = "0.38.0", path = "../rpc", features = ["http-client"] } -tendermint-proto = { version = "0.38.0", path = "../proto" } -tendermint-light-client = { version = "0.38.0", path = "../light-client" } +tendermint = { version = "0.38.1", path = "../tendermint" } +tendermint-rpc = { version = "0.38.1", path = "../rpc", features = ["http-client"] } +tendermint-proto = { version = "0.38.1", path = "../proto" } +tendermint-light-client = { version = "0.38.1", path = "../light-client" } crossbeam-channel = { version = "0.5.11", default-features = false } derive_more = { version = "0.99.5", default-features = false, features = ["display"] } diff --git a/light-client-js/Cargo.toml b/light-client-js/Cargo.toml index 9cd988d78..1532431c8 100644 --- a/light-client-js/Cargo.toml +++ b/light-client-js/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client-js" -version = "0.38.0" +version = "0.38.1" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" @@ -22,8 +22,8 @@ default = ["console_error_panic_hook"] [dependencies] serde = { version = "1.0", default-features = false, features = [ "derive" ] } serde_json = { version = "1.0", default-features = false } -tendermint = { version = "0.38.0", default-features = false, path = "../tendermint" } -tendermint-light-client-verifier = { version = "0.38.0", features = ["rust-crypto"], default-features = false, path = "../light-client-verifier" } +tendermint = { version = "0.38.1", default-features = false, path = "../tendermint" } +tendermint-light-client-verifier = { version = "0.38.1", features = ["rust-crypto"], default-features = false, path = "../light-client-verifier" } wasm-bindgen = { version = "0.2.63", default-features = false, features = [ "serde-serialize" ] } serde-wasm-bindgen = { version = "0.4.5", default-features = false } diff --git a/light-client-verifier/Cargo.toml b/light-client-verifier/Cargo.toml index 944165008..b51db50e4 100644 --- a/light-client-verifier/Cargo.toml +++ b/light-client-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client-verifier" -version = "0.38.0" +version = "0.38.1" edition = "2021" license = "Apache-2.0" readme = "README.md" @@ -27,7 +27,7 @@ default = ["rust-crypto", "flex-error/std"] rust-crypto = ["tendermint/rust-crypto"] [dependencies] -tendermint = { version = "0.38.0", path = "../tendermint", default-features = false } +tendermint = { version = "0.38.1", path = "../tendermint", default-features = false } derive_more = { version = "0.99.5", default-features = false, features = ["display"] } serde = { version = "1.0.106", default-features = false } diff --git a/light-client/Cargo.toml b/light-client/Cargo.toml index a791ebcdc..af4b7624f 100644 --- a/light-client/Cargo.toml +++ b/light-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client" -version = "0.38.0" +version = "0.38.1" edition = "2021" license = "Apache-2.0" readme = "README.md" @@ -35,9 +35,9 @@ unstable = ["rust-crypto"] mbt = ["rust-crypto"] [dependencies] -tendermint = { version = "0.38.0", path = "../tendermint", default-features = false } -tendermint-rpc = { version = "0.38.0", path = "../rpc", default-features = false } -tendermint-light-client-verifier = { version = "0.38.0", path = "../light-client-verifier", default-features = false } +tendermint = { version = "0.38.1", path = "../tendermint", default-features = false } +tendermint-rpc = { version = "0.38.1", path = "../rpc", default-features = false } +tendermint-light-client-verifier = { version = "0.38.1", path = "../light-client-verifier", default-features = false } contracts = { version = "0.6.2", default-features = false } crossbeam-channel = { version = "0.5.11", default-features = false, features = ["std"] } diff --git a/p2p/Cargo.toml b/p2p/Cargo.toml index 221be360e..c14bf4f3a 100644 --- a/p2p/Cargo.toml +++ b/p2p/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-p2p" -version = "0.38.0" +version = "0.38.1" edition = "2021" license = "Apache-2.0" repository = "https://github.com/informalsystems/tendermint-rs" @@ -44,9 +44,9 @@ aead = { version = "0.5", default-features = false } flex-error = { version = "0.4.4", default-features = false } # path dependencies -tendermint = { path = "../tendermint", version = "0.38.0", default-features = false } -tendermint-proto = { path = "../proto", version = "0.38.0", default-features = false } -tendermint-std-ext = { path = "../std-ext", version = "0.38.0", default-features = false } +tendermint = { path = "../tendermint", version = "0.38.1", default-features = false } +tendermint-proto = { path = "../proto", version = "0.38.1", default-features = false } +tendermint-std-ext = { path = "../std-ext", version = "0.38.1", default-features = false } # optional dependencies prost-derive = { version = "0.13", optional = true } diff --git a/pbt-gen/Cargo.toml b/pbt-gen/Cargo.toml index 40fc2bdc0..e6bff97ab 100644 --- a/pbt-gen/Cargo.toml +++ b/pbt-gen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-pbt-gen" -version = "0.38.0" +version = "0.38.1" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" diff --git a/proto/Cargo.toml b/proto/Cargo.toml index f08997f67..94a11f7e7 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-proto" -version = "0.38.0" +version = "0.38.1" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index c8ecfa743..05acf1a60 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-rpc" -version = "0.38.0" +version = "0.38.1" edition = "2021" license = "Apache-2.0" homepage = "https://www.tendermint.com/" @@ -55,9 +55,9 @@ websocket-client = [ ] [dependencies] -tendermint = { version = "0.38.0", default-features = false, path = "../tendermint" } -tendermint-config = { version = "0.38.0", path = "../config", default-features = false } -tendermint-proto = { version = "0.38.0", path = "../proto", default-features = false } +tendermint = { version = "0.38.1", default-features = false, path = "../tendermint" } +tendermint-config = { version = "0.38.1", path = "../config", default-features = false } +tendermint-proto = { version = "0.38.1", path = "../proto", default-features = false } async-trait = { version = "0.1", default-features = false } bytes = { version = "1.0", default-features = false } @@ -88,7 +88,7 @@ tracing = { version = "0.1", optional = true, default-features = false } tracing-subscriber = { version = "0.3", optional = true, default-features = false, features = ["fmt"] } [dev-dependencies] -tendermint = { version = "0.38.0", default-features = false, path = "../tendermint", features = ["secp256k1"] } +tendermint = { version = "0.38.1", default-features = false, path = "../tendermint", features = ["secp256k1"] } http = { version = "1", default-features = false, features = ["std"] } lazy_static = { version = "1.4.0", default-features = false } tokio-test = { version = "0.4", default-features = false } diff --git a/std-ext/Cargo.toml b/std-ext/Cargo.toml index 0a5cfa9a1..970400f2a 100644 --- a/std-ext/Cargo.toml +++ b/std-ext/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-std-ext" -version = "0.38.0" +version = "0.38.1" edition = "2021" license = "Apache-2.0" homepage = "https://www.tendermint.com/" diff --git a/tendermint/Cargo.toml b/tendermint/Cargo.toml index 07e5083c0..cb7f79456 100644 --- a/tendermint/Cargo.toml +++ b/tendermint/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint" -version = "0.38.0" # Also update depending crates (rpc, light-node, etc..) when bumping this . +version = "0.38.1" # Also update depending crates (rpc, light-node, etc..) when bumping this . license = "Apache-2.0" homepage = "https://www.tendermint.com/" repository = "https://github.com/informalsystems/tendermint-rs/tree/main/tendermint" @@ -44,7 +44,7 @@ serde_repr = { version = "0.1", default-features = false } signature = { version = "2", default-features = false, features = ["alloc"] } subtle = { version = "2", default-features = false } subtle-encoding = { version = "0.5", default-features = false, features = ["bech32-preview"] } -tendermint-proto = { version = "0.38.0", default-features = false, path = "../proto" } +tendermint-proto = { version = "0.38.1", 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 } diff --git a/test/Cargo.toml b/test/Cargo.toml index c7bc3d182..60706a234 100644 --- a/test/Cargo.toml +++ b/test/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tendermint-test" description = "Tendermint workspace tests and common utilities for testing." -version = "0.38.0" +version = "0.38.1" edition = "2021" license = "Apache-2.0" categories = ["development", "test", "tools"] diff --git a/testgen/Cargo.toml b/testgen/Cargo.toml index 50af3b565..782e29bd2 100644 --- a/testgen/Cargo.toml +++ b/testgen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-testgen" -version = "0.38.0" +version = "0.38.1" authors = ["Informal Systems "] edition = "2021" readme = "README.md" @@ -16,7 +16,7 @@ description = """ """ [dependencies] -tendermint = { version = "0.38.0", path = "../tendermint", features = ["clock"] } +tendermint = { version = "0.38.1", path = "../tendermint", features = ["clock"] } serde = { version = "1", default-features = false, features = ["derive"] } serde_json = { version = "1", default-features = false, features = ["std"] } ed25519-consensus = { version = "2", default-features = false } diff --git a/tools/abci-test/Cargo.toml b/tools/abci-test/Cargo.toml index 5166bf3e3..66389e704 100644 --- a/tools/abci-test/Cargo.toml +++ b/tools/abci-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "abci-test" -version = "0.38.0" +version = "0.38.1" authors = ["Informal Systems "] edition = "2021" description = """ @@ -14,9 +14,9 @@ description = """ flex-error = { version = "0.4.4", default-features = false, features = ["std"] } futures = "0.3" structopt = "0.3" -tendermint = { version = "0.38.0", path = "../../tendermint" } -tendermint-config = { version = "0.38.0", path = "../../config" } -tendermint-rpc = { version = "0.38.0", path = "../../rpc", features = [ "websocket-client" ] } +tendermint = { version = "0.38.1", path = "../../tendermint" } +tendermint-config = { version = "0.38.1", path = "../../config" } +tendermint-rpc = { version = "0.38.1", path = "../../rpc", features = [ "websocket-client" ] } tracing = "0.1" tracing-subscriber = "0.2" tokio = { version = "1.20", features = ["full"] } diff --git a/tools/kvstore-test/Cargo.toml b/tools/kvstore-test/Cargo.toml index a629bb35b..609ca5f79 100644 --- a/tools/kvstore-test/Cargo.toml +++ b/tools/kvstore-test/Cargo.toml @@ -11,9 +11,9 @@ edition = "2021" [dev-dependencies] futures = "0.3" sha2 = "0.10" -tendermint = { version = "0.38.0", path = "../../tendermint" } -tendermint-light-client = { version = "0.38.0", path = "../../light-client", features = ["unstable"] } -tendermint-rpc = { version = "0.38.0", path = "../../rpc", features = [ "http-client", "websocket-client" ] } +tendermint = { version = "0.38.1", path = "../../tendermint" } +tendermint-light-client = { version = "0.38.1", path = "../../light-client", features = ["unstable"] } +tendermint-rpc = { version = "0.38.1", path = "../../rpc", features = [ "http-client", "websocket-client" ] } tokio = { version = "1.0", features = [ "rt-multi-thread", "macros" ] } tracing = "0.1" tracing-subscriber = "0.3" diff --git a/tools/rpc-probe/Cargo.toml b/tools/rpc-probe/Cargo.toml index dfa160ea9..b11723057 100644 --- a/tools/rpc-probe/Cargo.toml +++ b/tools/rpc-probe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-rpc-probe" -version = "0.38.0" +version = "0.38.1" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" From 61e6899cb2963b13f12c3f84b3893193e4a6193e Mon Sep 17 00:00:00 2001 From: Romain Ruetschi Date: Tue, 30 Jul 2024 10:04:13 +0200 Subject: [PATCH 21/28] Fix new clippy warnings on Rust 1.80 (#1451) --- light-client-verifier/src/operations/voting_power.rs | 8 ++++---- light-client/src/components/scheduler.rs | 4 ++-- p2p/src/secret_connection.rs | 4 ++-- pbt-gen/src/lib.rs | 3 +-- rpc/src/client/transport/router.rs | 10 ++++++---- test/src/test/unit/p2p/secret_connection.rs | 2 +- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/light-client-verifier/src/operations/voting_power.rs b/light-client-verifier/src/operations/voting_power.rs index 2cb466cd8..8feba60f2 100644 --- a/light-client-verifier/src/operations/voting_power.rs +++ b/light-client-verifier/src/operations/voting_power.rs @@ -278,10 +278,10 @@ impl NonAbsentCommitVotes { /// isnโ€™t critical for correctness. Itโ€™s a matter of performance to avoid /// reallocations. /// - /// Note: As of protocol 0.38, maximum length of the sign bytes is `115 + (N - /// > 13) + N` where `N` is the length of the chain id. Chain id can be at - /// most 50 bytes (see [`tendermint::chain::id::MAX_LEN`]) thus the largest - /// buffer weโ€™ll ever need is 166 bytes long. + /// Note: As of protocol 0.38, maximum length of the sign bytes is `115 + (N > 13) + N` + /// where `N` is the length of the chain id. + /// Chain id can be at most 50 bytes (see [`tendermint::chain::id::MAX_LEN`]) + /// thus the largest buffer weโ€™ll ever need is 166 bytes long. const SIGN_BYTES_INITIAL_CAPACITY: usize = 166; pub fn new(signed_header: &SignedHeader) -> Result { diff --git a/light-client/src/components/scheduler.rs b/light-client/src/components/scheduler.rs index 3e4a4214f..49b67d85f 100644 --- a/light-client/src/components/scheduler.rs +++ b/light-client/src/components/scheduler.rs @@ -77,10 +77,10 @@ pub fn basic_bisecting_schedule( /// following specification. /// /// - i) If `latest_verified_height == current_height` and `latest_verified_height < target_height` -/// then `current_height < scheduled_height <= target_height`. +/// then `current_height < scheduled_height <= target_height`. /// /// - ii) If `latest_verified_height < current_height` and `latest_verified_height < target_height` -/// then `latest_verified_height < scheduled_height < current_height`. +/// then `latest_verified_height < scheduled_height < current_height`. /// /// - iii) If `latest_verified_height = target_height` then `scheduled_height == target_height`. /// diff --git a/p2p/src/secret_connection.rs b/p2p/src/secret_connection.rs index c4e336985..c9b6a5b24 100644 --- a/p2p/src/secret_connection.rs +++ b/p2p/src/secret_connection.rs @@ -177,7 +177,7 @@ impl Handshake { /// /// * if signature scheme isn't supported pub fn got_signature( - &mut self, + &self, auth_sig_msg: proto::p2p::AuthSigMessage, ) -> Result { let pk_sum = auth_sig_msg @@ -296,7 +296,7 @@ impl SecretConnection { share_eph_pubkey(&mut io_handler, &local_eph_pubkey, protocol_version)?; // Compute a local signature (also recv_cipher & send_cipher) - let mut h = h.got_key(remote_eph_pubkey)?; + let h = h.got_key(remote_eph_pubkey)?; let mut sc = Self { io_handler, diff --git a/pbt-gen/src/lib.rs b/pbt-gen/src/lib.rs index 9815eef46..7e20f2771 100644 --- a/pbt-gen/src/lib.rs +++ b/pbt-gen/src/lib.rs @@ -4,8 +4,7 @@ //! Conditions for inclusion in this crate are: //! //! 1. The utilities are relatively general. -//! 2. The utilities don't rely on any code internal to the other crates of -//! this repository. +//! 2. The utilities don't rely on any code internal to the other crates of this repository. //! //! The each module of this crate (and the module's dependencies) are guarded by //! a feature, documented along with the module. diff --git a/rpc/src/client/transport/router.rs b/rpc/src/client/transport/router.rs index 4a27a606a..0d4a3f853 100644 --- a/rpc/src/client/transport/router.rs +++ b/rpc/src/client/transport/router.rs @@ -9,7 +9,7 @@ use crate::{client::subscription::SubscriptionTx, error::Error, event::Event, pr pub type SubscriptionQuery = String; pub type SubscriptionId = String; -#[cfg_attr(not(feature = "websocket"), allow(dead_code))] +#[cfg_attr(not(feature = "websocket-client"), allow(dead_code))] pub type SubscriptionIdRef<'a> = &'a str; /// Provides a mechanism for tracking [`Subscription`]s and routing [`Event`]s @@ -28,7 +28,7 @@ pub struct SubscriptionRouter { impl SubscriptionRouter { /// Publishes the given error to all of the subscriptions to which the /// error is relevant, based on the given subscription id query. - #[cfg_attr(not(feature = "websocket"), allow(dead_code))] + #[cfg_attr(not(feature = "websocket-client"), allow(dead_code))] pub fn publish_error(&mut self, id: SubscriptionIdRef<'_>, err: Error) -> PublishResult { if let Some(query) = self.subscription_query(id).cloned() { self.publish(query, Err(err)) @@ -38,7 +38,7 @@ impl SubscriptionRouter { } /// Get the query associated with the given subscription. - #[cfg_attr(not(feature = "websocket"), allow(dead_code))] + #[cfg_attr(not(feature = "websocket-client"), allow(dead_code))] fn subscription_query(&self, id: SubscriptionIdRef<'_>) -> Option<&SubscriptionQuery> { for (query, subs) in &self.subscriptions { if subs.contains_key(id) { @@ -51,7 +51,7 @@ impl SubscriptionRouter { /// Publishes the given event to all of the subscriptions to which the /// event is relevant, based on the associated query. - #[cfg_attr(not(feature = "websocket"), allow(dead_code))] + #[cfg_attr(not(feature = "websocket-client"), allow(dead_code))] pub fn publish_event(&mut self, ev: Event) -> PublishResult { self.publish(ev.query.clone(), Ok(ev)) } @@ -128,6 +128,8 @@ impl SubscriptionRouter { pub enum PublishResult { Success, NoSubscribers, + + #[cfg_attr(not(feature = "websocket-client"), allow(dead_code))] // All subscriptions for the given query have disconnected. AllDisconnected(String), } diff --git a/test/src/test/unit/p2p/secret_connection.rs b/test/src/test/unit/p2p/secret_connection.rs index f7d88c992..ff3dc34c5 100644 --- a/test/src/test/unit/p2p/secret_connection.rs +++ b/test/src/test/unit/p2p/secret_connection.rs @@ -109,7 +109,7 @@ fn test_evil_peer_shares_invalid_auth_sig() { let res = h.got_key(X25519_BASEPOINT); assert!(res.is_ok()); - let mut h = res.unwrap(); + let h = res.unwrap(); let res = h.got_signature(proto::p2p::AuthSigMessage { pub_key: None, sig: vec![], From dd3303080e5e2def4caa4512feb7db43bdc1fe42 Mon Sep 17 00:00:00 2001 From: Romain Ruetschi Date: Tue, 6 Aug 2024 10:17:02 +0200 Subject: [PATCH 22/28] proto: Add `Any` Protobuf type and improve `Duration` and `Timestamp` Protobuf types (#1452) * proto: Expose well-known types `Any`, `Duration` and `Timestamp` * Add proper JSON serialization for `Duration` * Add non-compliant JSON serialization for `Any` * Fix no_std compatibility * Add changelog entries * Add `json-schema` feature flag to enable derivation of `schemars::JsonSchema` on well-known types * Add conversion from and into `core::time::Duration` for `google::protobuf::Duration` * Add conversion from and into `std::time::SystemTime` for `google::protobuf::Timestamp`, feature-guarded by an `std` feature * Add `borsh` and `parity-scale-codec` features with corresponding derivations --- .../unreleased/features/1445-any-proto.md | 1 + .../improvements/1452-proto-name.md | 2 + .../improvements/1452-proto-serialization.md | 1 + proto/Cargo.toml | 17 +- proto/src/google/mod.rs | 1 + proto/src/google/protobuf/any.rs | 336 ++++++++++++++++++ proto/src/google/protobuf/duration.rs | 314 ++++++++++++++++ proto/src/google/protobuf/mod.rs | 12 + proto/src/google/protobuf/timestamp.rs | 179 ++++++++++ proto/src/google/protobuf/type_url.rs | 72 ++++ proto/src/lib.rs | 9 +- proto/src/protobuf.rs | 59 --- tools/proto-compiler/src/main.rs | 6 +- 13 files changed, 939 insertions(+), 70 deletions(-) create mode 100644 .changelog/unreleased/features/1445-any-proto.md create mode 100644 .changelog/unreleased/improvements/1452-proto-name.md create mode 100644 .changelog/unreleased/improvements/1452-proto-serialization.md create mode 100644 proto/src/google/mod.rs create mode 100644 proto/src/google/protobuf/any.rs create mode 100644 proto/src/google/protobuf/duration.rs create mode 100644 proto/src/google/protobuf/mod.rs create mode 100644 proto/src/google/protobuf/timestamp.rs create mode 100644 proto/src/google/protobuf/type_url.rs delete mode 100644 proto/src/protobuf.rs diff --git a/.changelog/unreleased/features/1445-any-proto.md b/.changelog/unreleased/features/1445-any-proto.md new file mode 100644 index 000000000..6b3619e32 --- /dev/null +++ b/.changelog/unreleased/features/1445-any-proto.md @@ -0,0 +1 @@ +- `[tendermint-proto]` Add `Any` type under `tendermint_proto::google::protobuf::Any` ([#1445](https://github.com/informalsystems/tendermint-rs/issues/1445)) diff --git a/.changelog/unreleased/improvements/1452-proto-name.md b/.changelog/unreleased/improvements/1452-proto-name.md new file mode 100644 index 000000000..e0424cc3e --- /dev/null +++ b/.changelog/unreleased/improvements/1452-proto-name.md @@ -0,0 +1,2 @@ +- `[tendermint-proto]` Implement `prost::Name` for `tendermint_proto::google::protobuf::{Duration, Timestamp}` ([#1452](https://github.com/informalsystems/tendermint-rs/pull/1452/)) + diff --git a/.changelog/unreleased/improvements/1452-proto-serialization.md b/.changelog/unreleased/improvements/1452-proto-serialization.md new file mode 100644 index 000000000..5edf40ac9 --- /dev/null +++ b/.changelog/unreleased/improvements/1452-proto-serialization.md @@ -0,0 +1 @@ +- `[tendermint-proto]` Improve ProtoJSON serialization of `tendermint_proto::google::protobuf::{Duration, Timestamp}` ([#1452](https://github.com/informalsystems/tendermint-rs/pull/1452/)) diff --git a/proto/Cargo.toml b/proto/Cargo.toml index 94a11f7e7..107e32d54 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -15,8 +15,12 @@ description = """ [features] default = [] +std = [] grpc = ["grpc-server"] -grpc-server = ["tonic"] +grpc-server = ["dep:tonic"] +json-schema = ["dep:schemars"] +borsh = ["dep:borsh"] +parity-scale-codec = ["dep:parity-scale-codec", "dep:scale-info"] [package.metadata.docs.rs] all-features = true @@ -32,5 +36,16 @@ time = { version = "0.3", default-features = false, features = ["macros", "parsi flex-error = { version = "0.4.4", default-features = false } tonic = { version = "0.12", optional = true } +## Optional: enabled by the `json-schema` feature +schemars = { version = "0.8", optional = true } + +## Optional: enabled by the `borsh` feature +## For borsh encode or decode, needs to track `anchor-lang` and `near-sdk-rs` borsh version +borsh = { version = "1", default-features = false, features = ["derive"], optional = true } + +## Optional: enabled by the `parity-scale-codec` feature +parity-scale-codec = { version = "3.0.0", default-features = false, features = ["full"], optional = true } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"], optional = true } + [dev-dependencies] serde_json = { version = "1.0", default-features = false, features = ["alloc"] } diff --git a/proto/src/google/mod.rs b/proto/src/google/mod.rs new file mode 100644 index 000000000..91e41667b --- /dev/null +++ b/proto/src/google/mod.rs @@ -0,0 +1 @@ +pub mod protobuf; diff --git a/proto/src/google/protobuf/any.rs b/proto/src/google/protobuf/any.rs new file mode 100644 index 000000000..a901edcdd --- /dev/null +++ b/proto/src/google/protobuf/any.rs @@ -0,0 +1,336 @@ +// Original code from +// Copyright 2022 Dan Burkert & Tokio Contributors + +use prost::{DecodeError, EncodeError, Message, Name}; +use subtle_encoding::base64; + +use crate::prelude::*; + +use super::type_url::{type_url_for, TypeUrl}; +use super::PACKAGE; + +/// `Any` contains an arbitrary serialized protocol buffer message along with a +/// URL that describes the type of the serialized message. +/// +/// Protobuf library provides support to pack/unpack Any values in the form +/// of utility functions or additional generated methods of the Any type. +/// +/// # Example +/// +/// Pack and unpack a message in Rust: +/// +/// ```rust,ignore +/// let foo1 = Foo { ... }; +/// let any = Any::from_msg(&foo1)?; +/// let foo2 = any.to_msg::()?; +/// assert_eq!(foo1, foo2); +/// ``` +/// +/// The pack methods provided by protobuf library will by default use +/// 'type.googleapis.com/full.type.name' as the type URL and the unpack +/// methods only use the fully qualified type name after the last '/' +/// in the type URL, for example "foo.bar.com/x/y.z" will yield type +/// name "y.z". +/// +/// # JSON +/// +/// JSON serialization of Any cannot be made compatible with the specification. +/// See for more information. +/// +/// At the moment, an `Any` struct will be serialized as a JSON object with two fields: +/// - `typeUrl` (string): the type URL of the message +/// - `value` (string): the base64-encoded serialized message +/// +/// For example: +/// ```json +/// { +/// "typeUrl": "type.googleapis.com/google.protobuf.Duration", +/// "value": "Cg0KB2NvcnA=" +/// } +/// ``` +#[derive(Clone, PartialEq, Eq, ::prost::Message)] +#[cfg_attr(feature = "json-schema", derive(::schemars::JsonSchema))] +pub struct Any { + /// A URL/resource name that uniquely identifies the type of the serialized + /// protocol buffer message. This string must contain at least + /// one "/" character. The last segment of the URL's path must represent + /// the fully qualified name of the type (as in + /// `path/google.protobuf.Duration`). The name should be in a canonical form + /// (e.g., leading "." is not accepted). + /// + /// In practice, teams usually precompile into the binary all types that they + /// expect it to use in the context of Any. However, for URLs which use the + /// scheme `http`, `https`, or no scheme, one can optionally set up a type + /// server that maps type URLs to message definitions as follows: + /// + /// * If no scheme is provided, `https` is assumed. + /// * An HTTP GET on the URL must yield a \[google.protobuf.Type\]\[\] + /// value in binary format, or produce an error. + /// * Applications are allowed to cache lookup results based on the + /// URL, or have them precompiled into a binary to avoid any + /// lookup. Therefore, binary compatibility needs to be preserved + /// on changes to types. (Use versioned type names to manage + /// breaking changes.) + /// + /// Note: this functionality is not currently available in the official + /// protobuf release, and it is not used for type URLs beginning with + /// type.googleapis.com. + /// + /// Schemes other than `http`, `https` (or the empty scheme) might be + /// used with implementation specific semantics. + #[prost(string, tag = "1")] + pub type_url: ::prost::alloc::string::String, + /// Must be a valid serialized protocol buffer of the above specified type. + #[prost(bytes = "vec", tag = "2")] + pub value: ::prost::alloc::vec::Vec, +} + +impl Any { + /// Serialize the given message type `M` as [`Any`]. + pub fn from_msg(msg: &M) -> Result + where + M: Name, + { + let type_url = M::type_url(); + let mut value = Vec::new(); + Message::encode(msg, &mut value)?; + Ok(Any { type_url, value }) + } + + /// Decode the given message type `M` from [`Any`], validating that it has + /// the expected type URL. + pub fn to_msg(&self) -> Result + where + M: Default + Name + Sized, + { + let expected_type_url = M::type_url(); + + if let (Some(expected), Some(actual)) = ( + TypeUrl::new(&expected_type_url), + TypeUrl::new(&self.type_url), + ) { + if expected == actual { + return M::decode(self.value.as_slice()); + } + } + + let mut err = DecodeError::new(format!( + "expected type URL: \"{}\" (got: \"{}\")", + expected_type_url, &self.type_url + )); + err.push("unexpected type URL", "type_url"); + Err(err) + } +} + +impl Name for Any { + const PACKAGE: &'static str = PACKAGE; + const NAME: &'static str = "Any"; + + fn type_url() -> String { + type_url_for::() + } +} + +impl serde::Serialize for Any { + fn serialize(&self, serializer: S) -> core::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.type_url.is_empty() { + len += 1; + } + if !self.value.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("google.protobuf.Any", len)?; + if !self.type_url.is_empty() { + struct_ser.serialize_field("typeUrl", &self.type_url)?; + } + if !self.value.is_empty() { + // NOTE: A base64 string is always valid UTF-8. + struct_ser.serialize_field( + "value", + &String::from_utf8_lossy(&base64::encode(&self.value)), + )?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for Any { + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &["type_url", "typeUrl", "value"]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + TypeUrl, + Value, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting( + &self, + formatter: &mut core::fmt::Formatter<'_>, + ) -> core::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> core::result::Result + where + E: serde::de::Error, + { + match value { + "typeUrl" | "type_url" => Ok(GeneratedField::TypeUrl), + "value" => Ok(GeneratedField::Value), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Any; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + formatter.write_str("struct google.protobuf.Any") + } + + fn visit_map(self, mut map_: V) -> core::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut type_url__ = None; + let mut value__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::TypeUrl => { + if type_url__.is_some() { + return Err(serde::de::Error::duplicate_field("typeUrl")); + } + type_url__ = Some(map_.next_value()?); + }, + GeneratedField::Value => { + if value__.is_some() { + return Err(serde::de::Error::duplicate_field("value")); + } + let b64_str = map_.next_value::()?; + let value = base64::decode(b64_str.as_bytes()).map_err(|e| { + serde::de::Error::custom(format!("base64 decode error: {e}")) + })?; + value__ = Some(value); + }, + } + } + Ok(Any { + type_url: type_url__.unwrap_or_default(), + value: value__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("google.protobuf.Any", FIELDS, GeneratedVisitor) + } +} + +#[cfg(any(feature = "borsh", feature = "parity-scale-codec"))] +mod sealed { + use super::Any; + + use alloc::string::String; + use alloc::vec::Vec; + + #[cfg_attr( + feature = "parity-scale-codec", + derive( + parity_scale_codec::Encode, + parity_scale_codec::Decode, + scale_info::TypeInfo + ) + )] + #[cfg_attr( + feature = "borsh", + derive(borsh::BorshSerialize, borsh::BorshDeserialize) + )] + struct InnerAny { + pub type_url: String, + pub value: Vec, + } + + #[cfg(feature = "borsh")] + impl borsh::BorshSerialize for Any { + fn serialize(&self, writer: &mut W) -> borsh::io::Result<()> { + let inner_any = InnerAny { + type_url: self.type_url.clone(), + value: self.value.clone(), + }; + + borsh::BorshSerialize::serialize(&inner_any, writer) + } + } + + #[cfg(feature = "borsh")] + impl borsh::BorshDeserialize for Any { + fn deserialize_reader(reader: &mut R) -> borsh::io::Result { + let inner_any = InnerAny::deserialize_reader(reader)?; + + Ok(Any { + type_url: inner_any.type_url, + value: inner_any.value, + }) + } + } + + #[cfg(feature = "parity-scale-codec")] + impl parity_scale_codec::Encode for Any { + fn encode_to(&self, writer: &mut T) { + let inner_any = InnerAny { + type_url: self.type_url.clone(), + value: self.value.clone(), + }; + inner_any.encode_to(writer); + } + } + #[cfg(feature = "parity-scale-codec")] + impl parity_scale_codec::Decode for Any { + fn decode( + input: &mut I, + ) -> Result { + let inner_any = InnerAny::decode(input)?; + Ok(Any { + type_url: inner_any.type_url.clone(), + value: inner_any.value, + }) + } + } + + #[cfg(feature = "parity-scale-codec")] + impl scale_info::TypeInfo for Any { + type Identity = Self; + + fn type_info() -> scale_info::Type { + scale_info::Type::builder() + .path(scale_info::Path::new("Any", "ibc_proto::google::protobuf")) + // i128 is chosen before we represent the timestamp is nanoseconds, which is represented as a i128 by Time + .composite( + scale_info::build::Fields::named() + .field(|f| f.ty::().name("type_url").type_name("String")) + .field(|f| f.ty::>().name("value").type_name("Vec")), + ) + } + } +} diff --git a/proto/src/google/protobuf/duration.rs b/proto/src/google/protobuf/duration.rs new file mode 100644 index 000000000..b684abc32 --- /dev/null +++ b/proto/src/google/protobuf/duration.rs @@ -0,0 +1,314 @@ +// Original code from +// Copyright 2022 Dan Burkert & Tokio Contributors +// +// Original serialization code from +// Copyright (c) 2020 InfluxData + +use core::convert::TryFrom; + +use prost::Name; + +use crate::prelude::*; + +use super::type_url::type_url_for; +use super::PACKAGE; + +/// A Duration represents a signed, fixed-length span of time represented +/// as a count of seconds and fractions of seconds at nanosecond +/// resolution. It is independent of any calendar and concepts like "day" +/// or "month". It is related to Timestamp in that the difference between +/// two Timestamp values is a Duration and it can be added or subtracted +/// from a Timestamp. Range is approximately +-10,000 years. +#[derive(Copy, Clone, PartialEq, Eq, ::prost::Message)] +#[cfg_attr(feature = "json-schema", derive(::schemars::JsonSchema))] +pub struct Duration { + /// Signed seconds of the span of time. Must be from -315,576,000,000 + /// to +315,576,000,000 inclusive. Note: these bounds are computed from: + /// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + #[prost(int64, tag = "1")] + pub seconds: i64, + /// Signed fractions of a second at nanosecond resolution of the span + /// of time. Durations less than one second are represented with a 0 + /// `seconds` field and a positive or negative `nanos` field. For durations + /// of one second or more, a non-zero value for the `nanos` field must be + /// of the same sign as the `seconds` field. Must be from -999,999,999 + /// to +999,999,999 inclusive. + #[prost(int32, tag = "2")] + pub nanos: i32, +} + +impl Name for Duration { + const PACKAGE: &'static str = PACKAGE; + const NAME: &'static str = "Duration"; + + fn type_url() -> String { + type_url_for::() + } +} + +const NANOS_PER_SECOND: i32 = 1_000_000_000; +const NANOS_MAX: i32 = NANOS_PER_SECOND - 1; + +impl Duration { + /// Normalizes the duration to a canonical format. + pub fn normalize(&mut self) { + // Make sure nanos is in the range. + if self.nanos <= -NANOS_PER_SECOND || self.nanos >= NANOS_PER_SECOND { + if let Some(seconds) = self + .seconds + .checked_add((self.nanos / NANOS_PER_SECOND) as i64) + { + self.seconds = seconds; + self.nanos %= NANOS_PER_SECOND; + } else if self.nanos < 0 { + // Negative overflow! Set to the least normal value. + self.seconds = i64::MIN; + self.nanos = -NANOS_MAX; + } else { + // Positive overflow! Set to the greatest normal value. + self.seconds = i64::MAX; + self.nanos = NANOS_MAX; + } + } + + // nanos should have the same sign as seconds. + if self.seconds < 0 && self.nanos > 0 { + if let Some(seconds) = self.seconds.checked_add(1) { + self.seconds = seconds; + self.nanos -= NANOS_PER_SECOND; + } else { + // Positive overflow! Set to the greatest normal value. + debug_assert_eq!(self.seconds, i64::MAX); + self.nanos = NANOS_MAX; + } + } else if self.seconds > 0 && self.nanos < 0 { + if let Some(seconds) = self.seconds.checked_sub(1) { + self.seconds = seconds; + self.nanos += NANOS_PER_SECOND; + } else { + // Negative overflow! Set to the least normal value. + debug_assert_eq!(self.seconds, i64::MIN); + self.nanos = -NANOS_MAX; + } + } + } +} + +/// Converts a `core::time::Duration` to a `Duration`. +impl From for Duration { + fn from(duration: core::time::Duration) -> Duration { + let seconds = duration.as_secs(); + let seconds = if seconds > i64::MAX as u64 { + i64::MAX + } else { + seconds as i64 + }; + let nanos = duration.subsec_nanos(); + let nanos = if nanos > i32::MAX as u32 { + i32::MAX + } else { + nanos as i32 + }; + let mut duration = Duration { seconds, nanos }; + duration.normalize(); + duration + } +} + +impl TryFrom for core::time::Duration { + type Error = core::time::Duration; + + /// Converts a `Duration` to a result containing a positive (`Ok`) or negative (`Err`) + /// `std::time::Duration`. + fn try_from(mut duration: Duration) -> Result { + duration.normalize(); + if duration.seconds >= 0 { + Ok(core::time::Duration::new( + duration.seconds as u64, + duration.nanos as u32, + )) + } else { + Err(core::time::Duration::new( + (-duration.seconds) as u64, + (-duration.nanos) as u32, + )) + } + } +} + +impl serde::Serialize for Duration { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + if self.seconds != 0 && self.nanos != 0 && (self.nanos < 0) != (self.seconds < 0) { + return Err(serde::ser::Error::custom("Duration has inconsistent signs")); + } + + let mut s = if self.seconds == 0 { + if self.nanos < 0 { + "-0".to_string() + } else { + "0".to_string() + } + } else { + self.seconds.to_string() + }; + + if self.nanos != 0 { + s.push('.'); + let f = match split_nanos(self.nanos.unsigned_abs()) { + (millis, 0, 0) => format!("{:03}", millis), + (millis, micros, 0) => format!("{:03}{:03}", millis, micros), + (millis, micros, nanos) => format!("{:03}{:03}{:03}", millis, micros, nanos), + }; + s.push_str(&f); + } + + s.push('s'); + serializer.serialize_str(&s) + } +} + +struct DurationVisitor; + +impl<'de> serde::de::Visitor<'de> for DurationVisitor { + type Value = Duration; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + formatter.write_str("a duration string") + } + + fn visit_str(self, s: &str) -> Result + where + E: serde::de::Error, + { + let s = s + .strip_suffix('s') + .ok_or_else(|| serde::de::Error::custom("missing 's' suffix"))?; + + let (negative, s) = match s.strip_prefix('-') { + Some(s) => (true, s), + None => (false, s), + }; + + let duration = match s.split_once('.') { + Some((seconds_str, decimal_str)) => { + let exp = 9_u32 + .checked_sub(decimal_str.len() as u32) + .ok_or_else(|| serde::de::Error::custom("too many decimal places"))?; + + let pow = 10_u32.pow(exp); + let seconds = seconds_str.parse().map_err(serde::de::Error::custom)?; + let decimal: u32 = decimal_str.parse().map_err(serde::de::Error::custom)?; + + Duration { + seconds, + nanos: (decimal * pow) as i32, + } + }, + None => Duration { + seconds: s.parse().map_err(serde::de::Error::custom)?, + nanos: 0, + }, + }; + + Ok(match negative { + true => Duration { + seconds: -duration.seconds, + nanos: -duration.nanos, + }, + false => duration, + }) + } +} + +impl<'de> serde::Deserialize<'de> for Duration { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + deserializer.deserialize_str(DurationVisitor) + } +} + +/// Splits nanoseconds into whole milliseconds, microseconds, and nanoseconds +fn split_nanos(mut nanos: u32) -> (u32, u32, u32) { + let millis = nanos / 1_000_000; + nanos -= millis * 1_000_000; + let micros = nanos / 1_000; + nanos -= micros * 1_000; + (millis, micros, nanos) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_duration() { + let verify = |duration: &Duration, expected: &str| { + assert_eq!(serde_json::to_string(duration).unwrap().as_str(), expected); + assert_eq!( + &serde_json::from_str::(expected).unwrap(), + duration + ) + }; + + let duration = Duration { + seconds: 0, + nanos: 0, + }; + verify(&duration, "\"0s\""); + + let duration = Duration { + seconds: 0, + nanos: 123, + }; + verify(&duration, "\"0.000000123s\""); + + let duration = Duration { + seconds: 0, + nanos: 123456, + }; + verify(&duration, "\"0.000123456s\""); + + let duration = Duration { + seconds: 0, + nanos: 123456789, + }; + verify(&duration, "\"0.123456789s\""); + + let duration = Duration { + seconds: 0, + nanos: -67088, + }; + verify(&duration, "\"-0.000067088s\""); + + let duration = Duration { + seconds: 121, + nanos: 3454, + }; + verify(&duration, "\"121.000003454s\""); + + let duration = Duration { + seconds: -90, + nanos: -2456301, + }; + verify(&duration, "\"-90.002456301s\""); + + let duration = Duration { + seconds: -90, + nanos: 234, + }; + serde_json::to_string(&duration).unwrap_err(); + + let duration = Duration { + seconds: 90, + nanos: -234, + }; + serde_json::to_string(&duration).unwrap_err(); + + serde_json::from_str::("90.1234567891s").unwrap_err(); + } +} diff --git a/proto/src/google/protobuf/mod.rs b/proto/src/google/protobuf/mod.rs new file mode 100644 index 000000000..92710470a --- /dev/null +++ b/proto/src/google/protobuf/mod.rs @@ -0,0 +1,12 @@ +pub const PACKAGE: &str = "google.protobuf"; + +mod any; +pub use any::Any; + +mod duration; +pub use duration::Duration; + +mod timestamp; +pub use timestamp::Timestamp; + +mod type_url; diff --git a/proto/src/google/protobuf/timestamp.rs b/proto/src/google/protobuf/timestamp.rs new file mode 100644 index 000000000..879cea7d9 --- /dev/null +++ b/proto/src/google/protobuf/timestamp.rs @@ -0,0 +1,179 @@ +// Original code from +// Copyright 2022 Dan Burkert & Tokio Contributors + +use prost::Name; + +use crate::prelude::*; + +use super::type_url::type_url_for; +use super::PACKAGE; + +/// A Timestamp represents a point in time independent of any time zone or local +/// calendar, encoded as a count of seconds and fractions of seconds at +/// nanosecond resolution. The count is relative to an epoch at UTC midnight on +/// January 1, 1970, in the proleptic Gregorian calendar which extends the +/// Gregorian calendar backwards to year one. +/// +/// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap +/// second table is needed for interpretation, using a +/// [24-hour linear smear](https://developers.google.com/time/smear). +/// +/// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By +/// restricting to that range, we ensure that we can convert to and from +/// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. +#[derive(Copy, Clone, PartialEq, ::prost::Message, ::serde::Deserialize, ::serde::Serialize)] +#[serde( + from = "crate::serializers::timestamp::Rfc3339", + into = "crate::serializers::timestamp::Rfc3339" +)] +#[cfg_attr(feature = "json-schema", derive(::schemars::JsonSchema))] +pub struct Timestamp { + /// Represents seconds of UTC time since Unix epoch + /// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + /// 9999-12-31T23:59:59Z inclusive. + #[prost(int64, tag = "1")] + pub seconds: i64, + /// Non-negative fractions of a second at nanosecond resolution. Negative + /// second values with fractions must still have non-negative nanos values + /// that count forward in time. Must be from 0 to 999,999,999 + /// inclusive. + #[prost(int32, tag = "2")] + pub nanos: i32, +} + +impl Name for Timestamp { + const PACKAGE: &'static str = PACKAGE; + const NAME: &'static str = "Timestamp"; + + fn type_url() -> String { + type_url_for::() + } +} + +const NANOS_PER_SECOND: i32 = 1_000_000_000; + +impl Timestamp { + /// Normalizes the timestamp to a canonical format. + pub fn normalize(&mut self) { + // Make sure nanos is in the range. + if self.nanos <= -NANOS_PER_SECOND || self.nanos >= NANOS_PER_SECOND { + if let Some(seconds) = self + .seconds + .checked_add((self.nanos / NANOS_PER_SECOND) as i64) + { + self.seconds = seconds; + self.nanos %= NANOS_PER_SECOND; + } else if self.nanos < 0 { + // Negative overflow! Set to the earliest normal value. + self.seconds = i64::MIN; + self.nanos = 0; + } else { + // Positive overflow! Set to the latest normal value. + self.seconds = i64::MAX; + self.nanos = 999_999_999; + } + } + + // For Timestamp nanos should be in the range [0, 999999999]. + if self.nanos < 0 { + if let Some(seconds) = self.seconds.checked_sub(1) { + self.seconds = seconds; + self.nanos += NANOS_PER_SECOND; + } else { + // Negative overflow! Set to the earliest normal value. + debug_assert_eq!(self.seconds, i64::MIN); + self.nanos = 0; + } + } + } +} + +/// Implements the unstable/naive version of `Eq`: a basic equality check on the internal fields of the `Timestamp`. +/// This implies that `normalized_ts != non_normalized_ts` even if `normalized_ts == non_normalized_ts.normalized()`. +impl Eq for Timestamp {} + +// Derived logic is correct: comparing the 2 fields for equality +#[allow(clippy::derived_hash_with_manual_eq)] +impl core::hash::Hash for Timestamp { + fn hash(&self, state: &mut H) { + self.seconds.hash(state); + self.nanos.hash(state); + } +} + +#[cfg(feature = "std")] +impl From for Timestamp { + fn from(system_time: std::time::SystemTime) -> Timestamp { + let (seconds, nanos) = match system_time.duration_since(std::time::UNIX_EPOCH) { + Ok(duration) => { + let seconds = i64::try_from(duration.as_secs()).unwrap(); + (seconds, duration.subsec_nanos() as i32) + }, + Err(error) => { + let duration = error.duration(); + let seconds = i64::try_from(duration.as_secs()).unwrap(); + let nanos = duration.subsec_nanos() as i32; + if nanos == 0 { + (-seconds, 0) + } else { + (-seconds - 1, 1_000_000_000 - nanos) + } + }, + }; + Timestamp { seconds, nanos } + } +} + +/// Indicates that a [`Timestamp`] could not be converted to +/// [`SystemTime`][std::time::SystemTime] because it is out of range. +/// +/// The range of times that can be represented by `SystemTime` depends on the platform. +/// All `Timestamp`s are likely representable on 64-bit Unix-like platforms, but +/// other platforms, such as Windows and 32-bit Linux, may not be able to represent +/// the full range of `Timestamp`s. +#[cfg(feature = "std")] +#[derive(Debug)] +#[non_exhaustive] +pub struct TimestampOutOfSystemRangeError { + pub timestamp: Timestamp, +} + +#[cfg(feature = "std")] +impl core::fmt::Display for TimestampOutOfSystemRangeError { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!( + f, + "{self:?} is not representable as a `SystemTime` because it is out of range" + ) + } +} + +#[cfg(feature = "std")] +impl std::error::Error for TimestampOutOfSystemRangeError {} + +#[cfg(feature = "std")] +impl TryFrom for std::time::SystemTime { + type Error = TimestampOutOfSystemRangeError; + + fn try_from(mut timestamp: Timestamp) -> Result { + let orig_timestamp = timestamp; + + timestamp.normalize(); + + let system_time = if timestamp.seconds >= 0 { + std::time::UNIX_EPOCH + .checked_add(core::time::Duration::from_secs(timestamp.seconds as u64)) + } else { + std::time::UNIX_EPOCH + .checked_sub(core::time::Duration::from_secs((-timestamp.seconds) as u64)) + }; + + let system_time = system_time.and_then(|system_time| { + system_time.checked_add(core::time::Duration::from_nanos(timestamp.nanos as u64)) + }); + + system_time.ok_or(TimestampOutOfSystemRangeError { + timestamp: orig_timestamp, + }) + } +} diff --git a/proto/src/google/protobuf/type_url.rs b/proto/src/google/protobuf/type_url.rs new file mode 100644 index 000000000..1b79bca26 --- /dev/null +++ b/proto/src/google/protobuf/type_url.rs @@ -0,0 +1,72 @@ +use prost::Name; + +use crate::prelude::*; + +/// URL/resource name that uniquely identifies the type of the serialized protocol buffer message, +/// e.g. `type.googleapis.com/google.protobuf.Duration`. +/// +/// This string must contain at least one "/" character. +/// +/// The last segment of the URL's path must represent the fully qualified name of the type (as in +/// `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading "." is +/// not accepted). +/// +/// If no scheme is provided, `https` is assumed. +/// +/// Schemes other than `http`, `https` (or the empty scheme) might be used with implementation +/// specific semantics. +#[derive(Debug, Eq, PartialEq)] +pub(crate) struct TypeUrl<'a> { + /// Fully qualified name of the type, e.g. `google.protobuf.Duration` + pub(crate) full_name: &'a str, +} + +impl<'a> TypeUrl<'a> { + pub(crate) fn new(s: &'a str) -> core::option::Option { + // Must contain at least one "/" character. + let slash_pos = s.rfind('/')?; + + // The last segment of the URL's path must represent the fully qualified name + // of the type (as in `path/google.protobuf.Duration`) + let full_name = s.get((slash_pos + 1)..)?; + + // The name should be in a canonical form (e.g., leading "." is not accepted). + if full_name.starts_with('.') { + return None; + } + + Some(Self { full_name }) + } +} + +/// Compute the type URL for the given `google.protobuf` type, using `type.googleapis.com` as the +/// authority for the URL. +pub(crate) fn type_url_for() -> String { + format!("type.googleapis.com/{}.{}", T::PACKAGE, T::NAME) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn check_type_url_parsing() { + let example_type_name = "google.protobuf.Duration"; + + let url = TypeUrl::new("type.googleapis.com/google.protobuf.Duration").unwrap(); + assert_eq!(url.full_name, example_type_name); + + let full_url = + TypeUrl::new("https://type.googleapis.com/google.protobuf.Duration").unwrap(); + assert_eq!(full_url.full_name, example_type_name); + + let relative_url = TypeUrl::new("/google.protobuf.Duration").unwrap(); + assert_eq!(relative_url.full_name, example_type_name); + + // The name should be in a canonical form (e.g., leading "." is not accepted). + assert_eq!(TypeUrl::new("/.google.protobuf.Duration"), None); + + // Must contain at least one "/" character. + assert_eq!(TypeUrl::new("google.protobuf.Duration"), None); + } +} diff --git a/proto/src/lib.rs b/proto/src/lib.rs index 54944fff9..86cb6750a 100644 --- a/proto/src/lib.rs +++ b/proto/src/lib.rs @@ -22,13 +22,8 @@ pub mod serializers; use prelude::*; -/// Built-in prost_types with slight customization to enable JSON-encoding -pub mod google { - pub mod protobuf { - // custom Timeout and Duration types that have valid doctest documentation texts - include!("protobuf.rs"); - } -} +/// Built-in `prost_types` with slight customization to enable JSON-encoding. +pub mod google; /// Allows for easy Google Protocol Buffers encoding and decoding of domain /// types with validation. diff --git a/proto/src/protobuf.rs b/proto/src/protobuf.rs deleted file mode 100644 index 7a587c209..000000000 --- a/proto/src/protobuf.rs +++ /dev/null @@ -1,59 +0,0 @@ -// Google protobuf Timestamp and Duration types reimplemented because their comments are turned -// into invalid documentation texts and doctest chokes on them. See https://github.com/danburkert/prost/issues/374 -// Prost does not seem to have a way yet to remove documentations defined in protobuf files. -// These structs are defined in gogoproto v1.3.1 at https://github.com/gogo/protobuf/tree/v1.3.1/protobuf/google/protobuf - -/// A Timestamp represents a point in time independent of any time zone or local -/// calendar, encoded as a count of seconds and fractions of seconds at -/// nanosecond resolution. The count is relative to an epoch at UTC midnight on -/// January 1, 1970, in the proleptic Gregorian calendar which extends the -/// Gregorian calendar backwards to year one. -/// -/// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap -/// second table is needed for interpretation, using a [24-hour linear -/// smear](https://developers.google.com/time/smear). -/// -/// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By -/// restricting to that range, we ensure that we can convert to and from [RFC -/// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. -#[derive(Copy, Clone, PartialEq, ::prost::Message, ::serde::Deserialize, ::serde::Serialize)] -#[serde( - from = "crate::serializers::timestamp::Rfc3339", - into = "crate::serializers::timestamp::Rfc3339" -)] -pub struct Timestamp { - /// Represents seconds of UTC time since Unix epoch - /// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - /// 9999-12-31T23:59:59Z inclusive. - #[prost(int64, tag = "1")] - pub seconds: i64, - /// Non-negative fractions of a second at nanosecond resolution. Negative - /// second values with fractions must still have non-negative nanos values - /// that count forward in time. Must be from 0 to 999,999,999 - /// inclusive. - #[prost(int32, tag = "2")] - pub nanos: i32, -} - -/// A Duration represents a signed, fixed-length span of time represented -/// as a count of seconds and fractions of seconds at nanosecond -/// resolution. It is independent of any calendar and concepts like "day" -/// or "month". It is related to Timestamp in that the difference between -/// two Timestamp values is a Duration and it can be added or subtracted -/// from a Timestamp. Range is approximately +-10,000 years. -#[derive(Copy, Clone, PartialEq, ::prost::Message, ::serde::Deserialize, ::serde::Serialize)] -pub struct Duration { - /// Signed seconds of the span of time. Must be from -315,576,000,000 - /// to +315,576,000,000 inclusive. Note: these bounds are computed from: - /// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years - #[prost(int64, tag = "1")] - pub seconds: i64, - /// Signed fractions of a second at nanosecond resolution of the span - /// of time. Durations less than one second are represented with a 0 - /// `seconds` field and a positive or negative `nanos` field. For durations - /// of one second or more, a non-zero value for the `nanos` field must be - /// of the same sign as the `seconds` field. Must be from -999,999,999 - /// to +999,999,999 inclusive. - #[prost(int32, tag = "2")] - pub nanos: i32, -} diff --git a/tools/proto-compiler/src/main.rs b/tools/proto-compiler/src/main.rs index 29c7b4a5a..4d1439a14 100644 --- a/tools/proto-compiler/src/main.rs +++ b/tools/proto-compiler/src/main.rs @@ -96,9 +96,8 @@ fn main() { for field_attribute in CUSTOM_FIELD_ATTRIBUTES { pb.field_attribute(field_attribute.0, field_attribute.1); } - // The below in-place path redirection replaces references to the Duration - // and Timestamp WKTs with our own versions that have valid doctest comments. - // See also https://github.com/danburkert/prost/issues/374 . + // The below in-place path redirection replaces references to the + // Duration, Timestamp, and Any "well-know types" with our own versions. pb.extern_path( ".google.protobuf.Duration", "crate::google::protobuf::Duration", @@ -107,6 +106,7 @@ fn main() { ".google.protobuf.Timestamp", "crate::google::protobuf::Timestamp", ); + pb.extern_path(".google.protobuf.Any", "crate::google::protobuf::Any"); println!("[info] => Creating structs and interfaces."); let builder = tonic_build::configure() From 7a4113a481138bc22fca28e7e682ba72b7057adb Mon Sep 17 00:00:00 2001 From: renshuncui Date: Tue, 6 Aug 2024 19:08:16 +0900 Subject: [PATCH 23/28] chore: fix some comments (#1437) Signed-off-by: renshuncui --- proto/src/prost/v0_34/tendermint.abci.rs | 2 +- proto/src/prost/v0_37/tendermint.abci.rs | 2 +- proto/src/prost/v0_38/tendermint.abci.rs | 2 +- rpc/src/client/transport/websocket.rs | 2 +- rpc/src/dialect/check_tx.rs | 2 +- tendermint/src/abci/response/finalize_block.rs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/proto/src/prost/v0_34/tendermint.abci.rs b/proto/src/prost/v0_34/tendermint.abci.rs index 1719f446a..291a8a163 100644 --- a/proto/src/prost/v0_34/tendermint.abci.rs +++ b/proto/src/prost/v0_34/tendermint.abci.rs @@ -365,7 +365,7 @@ pub struct ResponseCheckTx { #[prost(int64, tag = "10")] pub priority: i64, /// mempool_error is set by CometBFT. - /// ABCI applictions creating a ResponseCheckTX should not set mempool_error. + /// ABCI applications creating a ResponseCheckTX should not set mempool_error. #[prost(string, tag = "11")] pub mempool_error: ::prost::alloc::string::String, } diff --git a/proto/src/prost/v0_37/tendermint.abci.rs b/proto/src/prost/v0_37/tendermint.abci.rs index ba11419cc..6419a690d 100644 --- a/proto/src/prost/v0_37/tendermint.abci.rs +++ b/proto/src/prost/v0_37/tendermint.abci.rs @@ -396,7 +396,7 @@ pub struct ResponseCheckTx { #[prost(int64, tag = "10")] pub priority: i64, /// mempool_error is set by CometBFT. - /// ABCI applictions creating a ResponseCheckTX should not set mempool_error. + /// ABCI applications creating a ResponseCheckTX should not set mempool_error. #[prost(string, tag = "11")] pub mempool_error: ::prost::alloc::string::String, } diff --git a/proto/src/prost/v0_38/tendermint.abci.rs b/proto/src/prost/v0_38/tendermint.abci.rs index a30f9bdc7..e97cd43c9 100644 --- a/proto/src/prost/v0_38/tendermint.abci.rs +++ b/proto/src/prost/v0_38/tendermint.abci.rs @@ -706,7 +706,7 @@ pub struct ResponseFinalizeBlock { #[prost(message, repeated, tag = "1")] pub events: ::prost::alloc::vec::Vec, /// the result of executing each transaction including the events - /// the particular transction emitted. This should match the order + /// the particular transaction emitted. This should match the order /// of the transactions delivered in the block itself #[prost(message, repeated, tag = "2")] pub tx_results: ::prost::alloc::vec::Vec, diff --git a/rpc/src/client/transport/websocket.rs b/rpc/src/client/transport/websocket.rs index 36cc5fd77..585d3f1ab 100644 --- a/rpc/src/client/transport/websocket.rs +++ b/rpc/src/client/transport/websocket.rs @@ -156,7 +156,7 @@ impl Builder { self } - /// Use the specfied low-level WebSocket configuration options. + /// Use the specified low-level WebSocket configuration options. pub fn config(mut self, config: WebSocketConfig) -> Self { self.transport_config = Some(config); self diff --git a/rpc/src/dialect/check_tx.rs b/rpc/src/dialect/check_tx.rs index 47b8d17c9..67452f18e 100644 --- a/rpc/src/dialect/check_tx.rs +++ b/rpc/src/dialect/check_tx.rs @@ -42,7 +42,7 @@ pub struct CheckTx { #[serde(with = "serializers::from_str")] pub priority: i64, /// mempool_error is set by Tendermint. - /// ABCI applictions should not set mempool_error. + /// ABCI applications should not set mempool_error. pub mempool_error: String, } diff --git a/tendermint/src/abci/response/finalize_block.rs b/tendermint/src/abci/response/finalize_block.rs index 0cc2c8128..350c35a92 100644 --- a/tendermint/src/abci/response/finalize_block.rs +++ b/tendermint/src/abci/response/finalize_block.rs @@ -10,7 +10,7 @@ pub struct FinalizeBlock { #[serde(default)] pub events: Vec, /// The result of executing each transaction including the events - /// the particular transction emitted. This should match the order + /// the particular transaction emitted. This should match the order /// of the transactions delivered in the block itself #[serde(default)] pub tx_results: Vec, From 439abf5cdd87424a880def1b2895c627c6e7adf4 Mon Sep 17 00:00:00 2001 From: Romain Ruetschi Date: Tue, 6 Aug 2024 12:26:50 +0200 Subject: [PATCH 24/28] Release v0.39.0 (#1453) * Bump crates version to v0.39.0 * Update changelog --- .../features/1445-any-proto.md | 0 .../improvements/1452-proto-name.md | 0 .../improvements/1452-proto-serialization.md | 0 .changelog/v0.39.0/summary.md | 3 +++ CHANGELOG.md | 15 +++++++++++++++ abci/Cargo.toml | 4 ++-- config/Cargo.toml | 4 ++-- light-client-cli/Cargo.toml | 10 +++++----- light-client-detector/Cargo.toml | 10 +++++----- light-client-js/Cargo.toml | 6 +++--- light-client-verifier/Cargo.toml | 4 ++-- light-client/Cargo.toml | 8 ++++---- p2p/Cargo.toml | 8 ++++---- pbt-gen/Cargo.toml | 2 +- proto/Cargo.toml | 2 +- rpc/Cargo.toml | 10 +++++----- std-ext/Cargo.toml | 2 +- tendermint/Cargo.toml | 4 ++-- test/Cargo.toml | 2 +- testgen/Cargo.toml | 4 ++-- tools/abci-test/Cargo.toml | 8 ++++---- tools/kvstore-test/Cargo.toml | 6 +++--- tools/rpc-probe/Cargo.toml | 2 +- 23 files changed, 66 insertions(+), 48 deletions(-) rename .changelog/{unreleased => v0.39.0}/features/1445-any-proto.md (100%) rename .changelog/{unreleased => v0.39.0}/improvements/1452-proto-name.md (100%) rename .changelog/{unreleased => v0.39.0}/improvements/1452-proto-serialization.md (100%) create mode 100644 .changelog/v0.39.0/summary.md diff --git a/.changelog/unreleased/features/1445-any-proto.md b/.changelog/v0.39.0/features/1445-any-proto.md similarity index 100% rename from .changelog/unreleased/features/1445-any-proto.md rename to .changelog/v0.39.0/features/1445-any-proto.md diff --git a/.changelog/unreleased/improvements/1452-proto-name.md b/.changelog/v0.39.0/improvements/1452-proto-name.md similarity index 100% rename from .changelog/unreleased/improvements/1452-proto-name.md rename to .changelog/v0.39.0/improvements/1452-proto-name.md diff --git a/.changelog/unreleased/improvements/1452-proto-serialization.md b/.changelog/v0.39.0/improvements/1452-proto-serialization.md similarity index 100% rename from .changelog/unreleased/improvements/1452-proto-serialization.md rename to .changelog/v0.39.0/improvements/1452-proto-serialization.md diff --git a/.changelog/v0.39.0/summary.md b/.changelog/v0.39.0/summary.md new file mode 100644 index 000000000..2092ba565 --- /dev/null +++ b/.changelog/v0.39.0/summary.md @@ -0,0 +1,3 @@ +*August 6th, 2024* + +This release bundles the `google.protobuf.Any` Protobuf type in `tendermint-proto` and brings improvements to `google.protobuf.Duration` and `google.protobuf.Timestamp`. diff --git a/CHANGELOG.md b/CHANGELOG.md index ab3793c32..9a0954045 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # CHANGELOG +## v0.39.0 + +*August 6th, 2024* + +This release bundles the `google.protobuf.Any` Protobuf type in `tendermint-proto` and brings improvements to `google.protobuf.Duration` and `google.protobuf.Timestamp`. + +### FEATURES + +- `[tendermint-proto]` Add `Any` type under `tendermint_proto::google::protobuf::Any` ([#1445](https://github.com/informalsystems/tendermint-rs/issues/1445)) + +### IMPROVEMENTS + +- `[tendermint-proto]` Implement `prost::Name` for `tendermint_proto::google::protobuf::{Duration, Timestamp}` ([#1452](https://github.com/informalsystems/tendermint-rs/pull/1452/)) +- `[tendermint-proto]` Improve ProtoJSON serialization of `tendermint_proto::google::protobuf::{Duration, Timestamp}` ([#1452](https://github.com/informalsystems/tendermint-rs/pull/1452/)) + ## v0.38.1 *July 23rd, 2024* diff --git a/abci/Cargo.toml b/abci/Cargo.toml index 36ada0999..e4e60f959 100644 --- a/abci/Cargo.toml +++ b/abci/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-abci" -version = "0.38.1" +version = "0.39.0" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" @@ -33,7 +33,7 @@ binary = [ [dependencies] bytes = { version = "1.0", default-features = false } prost = { version = "0.13", default-features = false } -tendermint-proto = { version = "0.38.1", default-features = false, path = "../proto" } +tendermint-proto = { version = "0.39.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 } diff --git a/config/Cargo.toml b/config/Cargo.toml index ea9e997ed..25ad97189 100644 --- a/config/Cargo.toml +++ b/config/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-config" -version = "0.38.1" # Also update depending crates (rpc, light-node, ..) when bumping this. +version = "0.39.0" # Also update depending crates (rpc, light-node, ..) when bumping this. license = "Apache-2.0" homepage = "https://www.tendermint.com/" repository = "https://github.com/informalsystems/tendermint-rs/tree/main/tendermint" @@ -24,7 +24,7 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [dependencies] -tendermint = { version = "0.38.1", default-features = false, features = ["rust-crypto"], path = "../tendermint" } +tendermint = { version = "0.39.0", default-features = false, features = ["rust-crypto"], path = "../tendermint" } flex-error = { version = "0.4.4", default-features = false } serde = { version = "1", features = ["derive"] } serde_json = "1" diff --git a/light-client-cli/Cargo.toml b/light-client-cli/Cargo.toml index 4419862cc..7b906c628 100644 --- a/light-client-cli/Cargo.toml +++ b/light-client-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client-cli" -version = "0.38.1" +version = "0.39.0" edition = "2021" license = "Apache-2.0" readme = "README.md" @@ -23,10 +23,10 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [dependencies] -tendermint = { version = "0.38.1", path = "../tendermint" } -tendermint-rpc = { version = "0.38.1", path = "../rpc", features = ["http-client"] } -tendermint-light-client = { version = "0.38.1", path = "../light-client" } -tendermint-light-client-detector = { version = "0.38.1", path = "../light-client-detector" } +tendermint = { version = "0.39.0", path = "../tendermint" } +tendermint-rpc = { version = "0.39.0", path = "../rpc", features = ["http-client"] } +tendermint-light-client = { version = "0.39.0", path = "../light-client" } +tendermint-light-client-detector = { version = "0.39.0", path = "../light-client-detector" } clap = { version = "4.1.8", features = ["derive"] } color-eyre = "0.6.2" diff --git a/light-client-detector/Cargo.toml b/light-client-detector/Cargo.toml index eb138c386..9616f2a55 100644 --- a/light-client-detector/Cargo.toml +++ b/light-client-detector/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client-detector" -version = "0.38.1" +version = "0.39.0" edition = "2021" license = "Apache-2.0" readme = "README.md" @@ -23,10 +23,10 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [dependencies] -tendermint = { version = "0.38.1", path = "../tendermint" } -tendermint-rpc = { version = "0.38.1", path = "../rpc", features = ["http-client"] } -tendermint-proto = { version = "0.38.1", path = "../proto" } -tendermint-light-client = { version = "0.38.1", path = "../light-client" } +tendermint = { version = "0.39.0", path = "../tendermint" } +tendermint-rpc = { version = "0.39.0", path = "../rpc", features = ["http-client"] } +tendermint-proto = { version = "0.39.0", path = "../proto" } +tendermint-light-client = { version = "0.39.0", path = "../light-client" } crossbeam-channel = { version = "0.5.11", default-features = false } derive_more = { version = "0.99.5", default-features = false, features = ["display"] } diff --git a/light-client-js/Cargo.toml b/light-client-js/Cargo.toml index 1532431c8..fb7ce8e12 100644 --- a/light-client-js/Cargo.toml +++ b/light-client-js/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client-js" -version = "0.38.1" +version = "0.39.0" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" @@ -22,8 +22,8 @@ default = ["console_error_panic_hook"] [dependencies] serde = { version = "1.0", default-features = false, features = [ "derive" ] } serde_json = { version = "1.0", default-features = false } -tendermint = { version = "0.38.1", default-features = false, path = "../tendermint" } -tendermint-light-client-verifier = { version = "0.38.1", features = ["rust-crypto"], default-features = false, path = "../light-client-verifier" } +tendermint = { version = "0.39.0", default-features = false, path = "../tendermint" } +tendermint-light-client-verifier = { version = "0.39.0", features = ["rust-crypto"], default-features = false, path = "../light-client-verifier" } wasm-bindgen = { version = "0.2.63", default-features = false, features = [ "serde-serialize" ] } serde-wasm-bindgen = { version = "0.4.5", default-features = false } diff --git a/light-client-verifier/Cargo.toml b/light-client-verifier/Cargo.toml index b51db50e4..b2a203470 100644 --- a/light-client-verifier/Cargo.toml +++ b/light-client-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client-verifier" -version = "0.38.1" +version = "0.39.0" edition = "2021" license = "Apache-2.0" readme = "README.md" @@ -27,7 +27,7 @@ default = ["rust-crypto", "flex-error/std"] rust-crypto = ["tendermint/rust-crypto"] [dependencies] -tendermint = { version = "0.38.1", path = "../tendermint", default-features = false } +tendermint = { version = "0.39.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 } diff --git a/light-client/Cargo.toml b/light-client/Cargo.toml index af4b7624f..9cd5685b7 100644 --- a/light-client/Cargo.toml +++ b/light-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client" -version = "0.38.1" +version = "0.39.0" edition = "2021" license = "Apache-2.0" readme = "README.md" @@ -35,9 +35,9 @@ unstable = ["rust-crypto"] mbt = ["rust-crypto"] [dependencies] -tendermint = { version = "0.38.1", path = "../tendermint", default-features = false } -tendermint-rpc = { version = "0.38.1", path = "../rpc", default-features = false } -tendermint-light-client-verifier = { version = "0.38.1", path = "../light-client-verifier", default-features = false } +tendermint = { version = "0.39.0", path = "../tendermint", default-features = false } +tendermint-rpc = { version = "0.39.0", path = "../rpc", default-features = false } +tendermint-light-client-verifier = { version = "0.39.0", path = "../light-client-verifier", default-features = false } contracts = { version = "0.6.2", default-features = false } crossbeam-channel = { version = "0.5.11", default-features = false, features = ["std"] } diff --git a/p2p/Cargo.toml b/p2p/Cargo.toml index c14bf4f3a..99d1349d9 100644 --- a/p2p/Cargo.toml +++ b/p2p/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-p2p" -version = "0.38.1" +version = "0.39.0" edition = "2021" license = "Apache-2.0" repository = "https://github.com/informalsystems/tendermint-rs" @@ -44,9 +44,9 @@ aead = { version = "0.5", default-features = false } flex-error = { version = "0.4.4", default-features = false } # path dependencies -tendermint = { path = "../tendermint", version = "0.38.1", default-features = false } -tendermint-proto = { path = "../proto", version = "0.38.1", default-features = false } -tendermint-std-ext = { path = "../std-ext", version = "0.38.1", default-features = false } +tendermint = { path = "../tendermint", version = "0.39.0", default-features = false } +tendermint-proto = { path = "../proto", version = "0.39.0", default-features = false } +tendermint-std-ext = { path = "../std-ext", version = "0.39.0", default-features = false } # optional dependencies prost-derive = { version = "0.13", optional = true } diff --git a/pbt-gen/Cargo.toml b/pbt-gen/Cargo.toml index e6bff97ab..f06d769a6 100644 --- a/pbt-gen/Cargo.toml +++ b/pbt-gen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-pbt-gen" -version = "0.38.1" +version = "0.39.0" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" diff --git a/proto/Cargo.toml b/proto/Cargo.toml index 107e32d54..7aa970db4 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-proto" -version = "0.38.1" +version = "0.39.0" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 05acf1a60..3a0491135 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-rpc" -version = "0.38.1" +version = "0.39.0" edition = "2021" license = "Apache-2.0" homepage = "https://www.tendermint.com/" @@ -55,9 +55,9 @@ websocket-client = [ ] [dependencies] -tendermint = { version = "0.38.1", default-features = false, path = "../tendermint" } -tendermint-config = { version = "0.38.1", path = "../config", default-features = false } -tendermint-proto = { version = "0.38.1", path = "../proto", default-features = false } +tendermint = { version = "0.39.0", default-features = false, path = "../tendermint" } +tendermint-config = { version = "0.39.0", path = "../config", default-features = false } +tendermint-proto = { version = "0.39.0", path = "../proto", default-features = false } async-trait = { version = "0.1", default-features = false } bytes = { version = "1.0", default-features = false } @@ -88,7 +88,7 @@ tracing = { version = "0.1", optional = true, default-features = false } tracing-subscriber = { version = "0.3", optional = true, default-features = false, features = ["fmt"] } [dev-dependencies] -tendermint = { version = "0.38.1", default-features = false, path = "../tendermint", features = ["secp256k1"] } +tendermint = { version = "0.39.0", default-features = false, path = "../tendermint", features = ["secp256k1"] } http = { version = "1", default-features = false, features = ["std"] } lazy_static = { version = "1.4.0", default-features = false } tokio-test = { version = "0.4", default-features = false } diff --git a/std-ext/Cargo.toml b/std-ext/Cargo.toml index 970400f2a..f542d136e 100644 --- a/std-ext/Cargo.toml +++ b/std-ext/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-std-ext" -version = "0.38.1" +version = "0.39.0" edition = "2021" license = "Apache-2.0" homepage = "https://www.tendermint.com/" diff --git a/tendermint/Cargo.toml b/tendermint/Cargo.toml index cb7f79456..fe24d374f 100644 --- a/tendermint/Cargo.toml +++ b/tendermint/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint" -version = "0.38.1" # Also update depending crates (rpc, light-node, etc..) when bumping this . +version = "0.39.0" # Also update depending crates (rpc, light-node, etc..) when bumping this . license = "Apache-2.0" homepage = "https://www.tendermint.com/" repository = "https://github.com/informalsystems/tendermint-rs/tree/main/tendermint" @@ -44,7 +44,7 @@ serde_repr = { version = "0.1", default-features = false } signature = { version = "2", default-features = false, features = ["alloc"] } subtle = { version = "2", default-features = false } subtle-encoding = { version = "0.5", default-features = false, features = ["bech32-preview"] } -tendermint-proto = { version = "0.38.1", default-features = false, path = "../proto" } +tendermint-proto = { version = "0.39.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 } diff --git a/test/Cargo.toml b/test/Cargo.toml index 60706a234..4c1ea0ef6 100644 --- a/test/Cargo.toml +++ b/test/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tendermint-test" description = "Tendermint workspace tests and common utilities for testing." -version = "0.38.1" +version = "0.39.0" edition = "2021" license = "Apache-2.0" categories = ["development", "test", "tools"] diff --git a/testgen/Cargo.toml b/testgen/Cargo.toml index 782e29bd2..ad003d684 100644 --- a/testgen/Cargo.toml +++ b/testgen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-testgen" -version = "0.38.1" +version = "0.39.0" authors = ["Informal Systems "] edition = "2021" readme = "README.md" @@ -16,7 +16,7 @@ description = """ """ [dependencies] -tendermint = { version = "0.38.1", path = "../tendermint", features = ["clock"] } +tendermint = { version = "0.39.0", path = "../tendermint", features = ["clock"] } serde = { version = "1", default-features = false, features = ["derive"] } serde_json = { version = "1", default-features = false, features = ["std"] } ed25519-consensus = { version = "2", default-features = false } diff --git a/tools/abci-test/Cargo.toml b/tools/abci-test/Cargo.toml index 66389e704..0b50b62ad 100644 --- a/tools/abci-test/Cargo.toml +++ b/tools/abci-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "abci-test" -version = "0.38.1" +version = "0.39.0" authors = ["Informal Systems "] edition = "2021" description = """ @@ -14,9 +14,9 @@ description = """ flex-error = { version = "0.4.4", default-features = false, features = ["std"] } futures = "0.3" structopt = "0.3" -tendermint = { version = "0.38.1", path = "../../tendermint" } -tendermint-config = { version = "0.38.1", path = "../../config" } -tendermint-rpc = { version = "0.38.1", path = "../../rpc", features = [ "websocket-client" ] } +tendermint = { version = "0.39.0", path = "../../tendermint" } +tendermint-config = { version = "0.39.0", path = "../../config" } +tendermint-rpc = { version = "0.39.0", path = "../../rpc", features = [ "websocket-client" ] } tracing = "0.1" tracing-subscriber = "0.2" tokio = { version = "1.20", features = ["full"] } diff --git a/tools/kvstore-test/Cargo.toml b/tools/kvstore-test/Cargo.toml index 609ca5f79..b97de3598 100644 --- a/tools/kvstore-test/Cargo.toml +++ b/tools/kvstore-test/Cargo.toml @@ -11,9 +11,9 @@ edition = "2021" [dev-dependencies] futures = "0.3" sha2 = "0.10" -tendermint = { version = "0.38.1", path = "../../tendermint" } -tendermint-light-client = { version = "0.38.1", path = "../../light-client", features = ["unstable"] } -tendermint-rpc = { version = "0.38.1", path = "../../rpc", features = [ "http-client", "websocket-client" ] } +tendermint = { version = "0.39.0", path = "../../tendermint" } +tendermint-light-client = { version = "0.39.0", path = "../../light-client", features = ["unstable"] } +tendermint-rpc = { version = "0.39.0", path = "../../rpc", features = [ "http-client", "websocket-client" ] } tokio = { version = "1.0", features = [ "rt-multi-thread", "macros" ] } tracing = "0.1" tracing-subscriber = "0.3" diff --git a/tools/rpc-probe/Cargo.toml b/tools/rpc-probe/Cargo.toml index b11723057..b8b3234b1 100644 --- a/tools/rpc-probe/Cargo.toml +++ b/tools/rpc-probe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-rpc-probe" -version = "0.38.1" +version = "0.39.0" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" From 685d104ec01690cbadfe1ab59de9254d3da78318 Mon Sep 17 00:00:00 2001 From: "Tony Arcieri (iqlusion)" Date: Thu, 8 Aug 2024 12:11:10 -0600 Subject: [PATCH 25/28] Ensure each and every feature flags can be used independently (#1455) --- .../bug-fixes/1454-fix-feature-flags.md | 2 ++ .github/workflows/test.yml | 20 ++++++++------ light-client/Cargo.toml | 1 + proto/Cargo.toml | 4 +-- proto/src/lib.rs | 2 +- rpc/Cargo.toml | 16 +++++++++--- rpc/src/client.rs | 26 +++++++++++++++---- rpc/src/client/subscription.rs | 2 +- rpc/src/client/transport.rs | 3 ++- rpc/src/lib.rs | 13 ++++++---- tendermint/Cargo.toml | 4 +-- 11 files changed, 65 insertions(+), 28 deletions(-) create mode 100644 .changelog/unreleased/bug-fixes/1454-fix-feature-flags.md diff --git a/.changelog/unreleased/bug-fixes/1454-fix-feature-flags.md b/.changelog/unreleased/bug-fixes/1454-fix-feature-flags.md new file mode 100644 index 000000000..44bcb0138 --- /dev/null +++ b/.changelog/unreleased/bug-fixes/1454-fix-feature-flags.md @@ -0,0 +1,2 @@ +- Fix newly introduced `std` and `json-schema` features, and ensure all feature flag can be used independently and in isolation. + ([\#1454](https://github.com/informalsystems/tendermint-rs/issues/1454)) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bea99c508..4aa3ef2c9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,32 +34,36 @@ jobs: steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - - run: cargo test-all-features -p tendermint + - uses: taiki-e/install-action@cargo-hack + - run: cargo test -p tendermint + - run: cargo hack test --each-feature -p tendermint tendermint-rpc: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - - run: cargo test-all-features -p tendermint-rpc + - uses: taiki-e/install-action@cargo-hack + - run: cargo test -p tendermint-rpc + - run: cargo hack test --each-feature -p tendermint-rpc tendermint-proto: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - - run: cargo test-all-features -p tendermint-proto + - uses: taiki-e/install-action@cargo-hack + - run: cargo test -p tendermint-proto + - run: cargo hack test --each-feature -p tendermint-proto tendermint-light-client: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - # NOTE: We test with default features to make sure things work without "unstable". - - name: Test with default features - run: cargo test -p tendermint-light-client - - name: Test with all features - run: cargo test-all-features -p tendermint-light-client + - uses: taiki-e/install-action@cargo-hack + - run: cargo test -p tendermint-light-client + - run: cargo hack test --each-feature -p tendermint-light-client # From https://rustwasm.github.io/docs/wasm-bindgen/wasm-bindgen-test/continuous-integration.html#github-actions tendermint-light-client-js: diff --git a/light-client/Cargo.toml b/light-client/Cargo.toml index 9cd5685b7..fa05dc384 100644 --- a/light-client/Cargo.toml +++ b/light-client/Cargo.toml @@ -57,6 +57,7 @@ regex = { version = "1.7.3" } [dev-dependencies] tendermint-testgen = { path = "../testgen", default-features = false } +tendermint-light-client-verifier = { version = "0.39.0", path = "../light-client-verifier", features = ["rust-crypto"] } serde_json = { version = "1.0.51", default-features = false } gumdrop = { version = "0.8.0", default-features = false } diff --git a/proto/Cargo.toml b/proto/Cargo.toml index 7aa970db4..5f6ab1986 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -17,8 +17,8 @@ description = """ default = [] std = [] grpc = ["grpc-server"] -grpc-server = ["dep:tonic"] -json-schema = ["dep:schemars"] +grpc-server = ["dep:tonic", "std"] +json-schema = ["dep:schemars", "std"] borsh = ["dep:borsh"] parity-scale-codec = ["dep:parity-scale-codec", "dep:scale-info"] diff --git a/proto/src/lib.rs b/proto/src/lib.rs index 86cb6750a..f14887202 100644 --- a/proto/src/lib.rs +++ b/proto/src/lib.rs @@ -1,6 +1,6 @@ //! tendermint-proto library gives the developer access to the Tendermint proto-defined structs. -#![cfg_attr(not(any(feature = "grpc-server")), no_std)] +#![cfg_attr(not(feature = "std"), no_std)] #![deny(warnings, trivial_casts, trivial_numeric_casts, unused_import_braces)] #![allow(clippy::large_enum_variant)] #![forbid(unsafe_code)] diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 3a0491135..998ce7ea2 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -29,7 +29,13 @@ path = "src/client/bin/main.rs" required-features = [ "cli" ] [features] -default = ["flex-error/std", "flex-error/eyre_tracer"] +default = [ + "flex-error/std", + "flex-error/eyre_tracer" +] +secp256k1 = [ + "tendermint/secp256k1" +] cli = [ "http-client", "structopt", @@ -42,17 +48,20 @@ http-client = [ "tokio/macros", "tracing" ] -secp256k1 = [ "tendermint/secp256k1" ] websocket-client = [ "async-tungstenite", "futures", "tokio/rt-multi-thread", - "tokio/fs", "tokio/macros", "tokio/sync", "tokio/time", "tracing" ] +mock-client = [ + "futures", + "tracing", + "tokio/macros" +] [dependencies] tendermint = { version = "0.39.0", default-features = false, path = "../tendermint" } @@ -92,3 +101,4 @@ tendermint = { version = "0.39.0", default-features = false, path = "../tendermi http = { version = "1", default-features = false, features = ["std"] } lazy_static = { version = "1.4.0", default-features = false } tokio-test = { version = "0.4", default-features = false } +tokio = { version = "1.0", default-features = false, features = ["rt-multi-thread", "fs"] } diff --git a/rpc/src/client.rs b/rpc/src/client.rs index b073b47a8..dabb4f8dc 100644 --- a/rpc/src/client.rs +++ b/rpc/src/client.rs @@ -3,15 +3,31 @@ mod compat; pub use compat::CompatMode; -#[cfg(any(feature = "http-client", feature = "websocket-client"))] +#[cfg(any( + feature = "http-client", + feature = "websocket-client", + feature = "mock-client" +))] mod subscription; -#[cfg(any(feature = "http-client", feature = "websocket-client"))] +#[cfg(any( + feature = "http-client", + feature = "websocket-client", + feature = "mock-client" +))] pub use subscription::{Subscription, SubscriptionClient}; -#[cfg(any(feature = "http-client", feature = "websocket-client"))] +#[cfg(any( + feature = "http-client", + feature = "websocket-client", + feature = "mock-client" +))] pub mod sync; -#[cfg(any(feature = "http-client", feature = "websocket-client"))] +#[cfg(any( + feature = "http-client", + feature = "websocket-client", + feature = "mock-client" +))] mod transport; #[cfg(feature = "http-client")] @@ -21,7 +37,7 @@ pub use transport::websocket::{ self, WebSocketClient, WebSocketClientDriver, WebSocketClientUrl, WebSocketConfig, }; -#[cfg(any(feature = "http-client", feature = "websocket-client"))] +#[cfg(feature = "mock-client")] pub use transport::mock::{MockClient, MockRequestMatcher, MockRequestMethodMatcher}; use core::fmt; diff --git a/rpc/src/client/subscription.rs b/rpc/src/client/subscription.rs index 1686ebd67..afc054db6 100644 --- a/rpc/src/client/subscription.rs +++ b/rpc/src/client/subscription.rs @@ -90,7 +90,7 @@ impl Stream for Subscription { } impl Subscription { - pub(crate) fn new(id: String, query: Query, rx: SubscriptionRx) -> Self { + pub fn new(id: String, query: Query, rx: SubscriptionRx) -> Self { Self { id, query, rx } } diff --git a/rpc/src/client/transport.rs b/rpc/src/client/transport.rs index 3eb72ee5f..658fedd97 100644 --- a/rpc/src/client/transport.rs +++ b/rpc/src/client/transport.rs @@ -1,7 +1,6 @@ //! Tendermint RPC client implementations for different transports. mod auth; -pub mod mock; mod router; macro_rules! perform_with_compat { @@ -24,5 +23,7 @@ macro_rules! perform_with_compat { #[cfg(feature = "http-client")] pub mod http; +#[cfg(feature = "mock-client")] +pub mod mock; #[cfg(feature = "websocket-client")] pub mod websocket; diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index 1e8d05c28..6636c5078 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -34,13 +34,16 @@ mod prelude; pub mod client; -#[cfg(any(feature = "http-client", feature = "websocket-client"))] -pub use client::{ - Client, MockClient, MockRequestMatcher, MockRequestMethodMatcher, Subscription, - SubscriptionClient, -}; +#[cfg(any( + feature = "http-client", + feature = "websocket-client", + feature = "mock-client" +))] +pub use client::{Client, Subscription, SubscriptionClient}; #[cfg(feature = "http-client")] pub use client::{HttpClient, HttpClientUrl}; +#[cfg(feature = "mock-client")] +pub use client::{MockClient, MockRequestMatcher, MockRequestMethodMatcher}; #[cfg(feature = "websocket-client")] pub use client::{WebSocketClient, WebSocketClientDriver, WebSocketClientUrl, WebSocketConfig}; diff --git a/tendermint/Cargo.toml b/tendermint/Cargo.toml index fe24d374f..21c2ab9ce 100644 --- a/tendermint/Cargo.toml +++ b/tendermint/Cargo.toml @@ -57,8 +57,8 @@ ripemd = { version = "0.1.3", optional = true, default-features = false } default = ["std", "rust-crypto"] std = ["flex-error/std", "clock"] clock = ["time/std"] -secp256k1 = ["k256", "ripemd"] -rust-crypto = ["sha2", "ed25519-consensus"] +secp256k1 = ["rust-crypto", "dep:k256", "dep:ripemd"] +rust-crypto = ["dep:sha2", "dep:ed25519-consensus"] [dev-dependencies] k256 = { version = "0.13", default-features = false, features = ["ecdsa"] } From f1ebab84321de74d7770672d54f4bdf28a9ac65c Mon Sep 17 00:00:00 2001 From: Romain Ruetschi Date: Thu, 8 Aug 2024 21:05:19 +0200 Subject: [PATCH 26/28] proto: Align `TryFrom` impls for `Duration` with `prost-types` (#1456) * Fix `TryFrom` impl to return a `DurationError` as per `prost-types` * Remove conflicting `From` impl --- proto/src/google/protobuf/duration.rs | 75 ++++++++++++++++++--------- 1 file changed, 50 insertions(+), 25 deletions(-) diff --git a/proto/src/google/protobuf/duration.rs b/proto/src/google/protobuf/duration.rs index b684abc32..c14957511 100644 --- a/proto/src/google/protobuf/duration.rs +++ b/proto/src/google/protobuf/duration.rs @@ -5,6 +5,7 @@ // Copyright (c) 2020 InfluxData use core::convert::TryFrom; +use core::fmt; use prost::Name; @@ -94,48 +95,72 @@ impl Duration { } } -/// Converts a `core::time::Duration` to a `Duration`. -impl From for Duration { - fn from(duration: core::time::Duration) -> Duration { - let seconds = duration.as_secs(); - let seconds = if seconds > i64::MAX as u64 { - i64::MAX - } else { - seconds as i64 - }; - let nanos = duration.subsec_nanos(); - let nanos = if nanos > i32::MAX as u32 { - i32::MAX - } else { - nanos as i32 - }; - let mut duration = Duration { seconds, nanos }; - duration.normalize(); - duration +/// A duration handling error. +#[derive(Debug, PartialEq, Eq)] +#[non_exhaustive] +pub enum DurationError { + /// Indicates failure to convert a [`Duration`] to a [`core::time::Duration`] because + /// the duration is negative. The included [`core::time::Duration`] matches the magnitude of the + /// original negative [`Duration`]. + NegativeDuration(core::time::Duration), + + /// Indicates failure to convert a [`core::time::Duration`] to a [`Duration`]. + /// + /// Converting a [`core::time::Duration`] to a [`Duration`] fails if the magnitude + /// exceeds that representable by [`Duration`]. + OutOfRange, +} + +impl fmt::Display for DurationError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + DurationError::NegativeDuration(duration) => { + write!(f, "failed to convert negative duration: {duration:?}") + }, + DurationError::OutOfRange => { + write!(f, "failed to convert duration out of range") + }, + } } } +#[cfg(feature = "std")] +impl std::error::Error for DurationError {} + impl TryFrom for core::time::Duration { - type Error = core::time::Duration; + type Error = DurationError; - /// Converts a `Duration` to a result containing a positive (`Ok`) or negative (`Err`) - /// `std::time::Duration`. - fn try_from(mut duration: Duration) -> Result { + /// Converts a `Duration` to a `core::time::Duration`, failing if the duration is negative. + fn try_from(mut duration: Duration) -> Result { duration.normalize(); - if duration.seconds >= 0 { + if duration.seconds >= 0 && duration.nanos >= 0 { Ok(core::time::Duration::new( duration.seconds as u64, duration.nanos as u32, )) } else { - Err(core::time::Duration::new( + Err(DurationError::NegativeDuration(core::time::Duration::new( (-duration.seconds) as u64, (-duration.nanos) as u32, - )) + ))) } } } +impl TryFrom for Duration { + type Error = DurationError; + + /// Converts a `core::time::Duration` to a `Duration`, failing if the duration is too large. + fn try_from(duration: core::time::Duration) -> Result { + let seconds = i64::try_from(duration.as_secs()).map_err(|_| DurationError::OutOfRange)?; + let nanos = duration.subsec_nanos() as i32; + + let mut duration = Duration { seconds, nanos }; + duration.normalize(); + Ok(duration) + } +} + impl serde::Serialize for Duration { fn serialize(&self, serializer: S) -> Result where From a2b4f0a9419eea4502598b629100ba66d8089885 Mon Sep 17 00:00:00 2001 From: "Tony Arcieri (iqlusion)" Date: Fri, 9 Aug 2024 02:03:16 -0600 Subject: [PATCH 27/28] proto: remove `prost-types` dependency (#1457) * proto: remove `prost-types` dependency Now that #1452 has landed `prost-types` isn't used. This removes it as a dependency. * Add changelog entry --------- Co-authored-by: Romain Ruetschi --- .changelog/unreleased/bug-fixes/1457-remove-prost-types-dep.md | 3 +++ proto/Cargo.toml | 3 +-- tendermint/Cargo.toml | 1 - 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 .changelog/unreleased/bug-fixes/1457-remove-prost-types-dep.md diff --git a/.changelog/unreleased/bug-fixes/1457-remove-prost-types-dep.md b/.changelog/unreleased/bug-fixes/1457-remove-prost-types-dep.md new file mode 100644 index 000000000..e139bedfa --- /dev/null +++ b/.changelog/unreleased/bug-fixes/1457-remove-prost-types-dep.md @@ -0,0 +1,3 @@ +- Remove dependency on `prost-types` as it is not needed anymore now that + [#1452](https://github.com/informalsystems/tendermint-rs/pull/1452) has landed + ([\#1457](https://github.com/informalsystems/tendermint-rs/pull/1457)) \ No newline at end of file diff --git a/proto/Cargo.toml b/proto/Cargo.toml index 5f6ab1986..e8f197a25 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -26,8 +26,7 @@ parity-scale-codec = ["dep:parity-scale-codec", "dep:scale-info"] all-features = true [dependencies] -prost = { version = "0.13", default-features = false } -prost-types = { version = "0.13", default-features = false } +prost = { version = "0.13", default-features = false, features = ["derive"] } bytes = { version = "1.0", default-features = false, features = ["serde"]} serde = { version = "1.0", default-features = false, features = ["derive"] } serde_bytes = { version = "0.11", default-features = false, features = ["alloc"] } diff --git a/tendermint/Cargo.toml b/tendermint/Cargo.toml index 21c2ab9ce..8d942d9f9 100644 --- a/tendermint/Cargo.toml +++ b/tendermint/Cargo.toml @@ -36,7 +36,6 @@ futures = { version = "0.3", default-features = false } num-traits = { version = "0.2", default-features = false } once_cell = { version = "1.3", default-features = false } prost = { version = "0.13", default-features = false } -prost-types = { version = "0.13", default-features = false } serde = { version = "1", default-features = false, features = ["derive"] } serde_json = { version = "1", default-features = false, features = ["alloc"] } serde_bytes = { version = "0.11", default-features = false } From 14fd628e82ae51b9f15c135a6db8870219fe3c33 Mon Sep 17 00:00:00 2001 From: Romain Ruetschi Date: Fri, 9 Aug 2024 10:44:53 +0200 Subject: [PATCH 28/28] Release v0.39.1 (#1458) * Bump crates version to v0.39.1 * Release changelog * Fix release date --- .../bug-fixes/1454-fix-feature-flags.md | 0 .../bug-fixes/1457-remove-prost-types-dep.md | 0 .changelog/v0.39.1/summary.md | 5 +++++ CHANGELOG.md | 16 ++++++++++++++++ abci/Cargo.toml | 4 ++-- config/Cargo.toml | 4 ++-- light-client-cli/Cargo.toml | 10 +++++----- light-client-detector/Cargo.toml | 10 +++++----- light-client-js/Cargo.toml | 6 +++--- light-client-verifier/Cargo.toml | 4 ++-- light-client/Cargo.toml | 10 +++++----- p2p/Cargo.toml | 8 ++++---- pbt-gen/Cargo.toml | 2 +- proto/Cargo.toml | 2 +- rpc/Cargo.toml | 10 +++++----- std-ext/Cargo.toml | 2 +- tendermint/Cargo.toml | 4 ++-- test/Cargo.toml | 2 +- testgen/Cargo.toml | 4 ++-- tools/abci-test/Cargo.toml | 8 ++++---- tools/kvstore-test/Cargo.toml | 6 +++--- tools/rpc-probe/Cargo.toml | 2 +- 22 files changed, 70 insertions(+), 49 deletions(-) rename .changelog/{unreleased => v0.39.1}/bug-fixes/1454-fix-feature-flags.md (100%) rename .changelog/{unreleased => v0.39.1}/bug-fixes/1457-remove-prost-types-dep.md (100%) create mode 100644 .changelog/v0.39.1/summary.md diff --git a/.changelog/unreleased/bug-fixes/1454-fix-feature-flags.md b/.changelog/v0.39.1/bug-fixes/1454-fix-feature-flags.md similarity index 100% rename from .changelog/unreleased/bug-fixes/1454-fix-feature-flags.md rename to .changelog/v0.39.1/bug-fixes/1454-fix-feature-flags.md diff --git a/.changelog/unreleased/bug-fixes/1457-remove-prost-types-dep.md b/.changelog/v0.39.1/bug-fixes/1457-remove-prost-types-dep.md similarity index 100% rename from .changelog/unreleased/bug-fixes/1457-remove-prost-types-dep.md rename to .changelog/v0.39.1/bug-fixes/1457-remove-prost-types-dep.md diff --git a/.changelog/v0.39.1/summary.md b/.changelog/v0.39.1/summary.md new file mode 100644 index 000000000..ade66fff3 --- /dev/null +++ b/.changelog/v0.39.1/summary.md @@ -0,0 +1,5 @@ +*August 9th, 2024* + +This is a bugfix release which addresses a few issues found in the v0.39.0 release. + +Users of v0.39.0 are strongly encouraged to upgrade to v0.39.1. diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a0954045..beff85438 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # CHANGELOG +## v0.39.1 + +*August 9th, 2024* + +This is a bugfix release which addresses a couple issues found in the v0.39.0 release. + +Users of v0.39.0 are strongly encouraged to upgrade to v0.39.1. + +### BUG FIXES + +- Fix newly introduced `std` and `json-schema` features, and ensure all feature flag can be used independently and in isolation. + ([\#1454](https://github.com/informalsystems/tendermint-rs/issues/1454)) +- Remove dependency on `prost-types` as it is not needed anymore now that + [#1452](https://github.com/informalsystems/tendermint-rs/pull/1452) has landed + ([\#1457](https://github.com/informalsystems/tendermint-rs/pull/1457)) + ## v0.39.0 *August 6th, 2024* diff --git a/abci/Cargo.toml b/abci/Cargo.toml index e4e60f959..28eb0eaae 100644 --- a/abci/Cargo.toml +++ b/abci/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-abci" -version = "0.39.0" +version = "0.39.1" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" @@ -33,7 +33,7 @@ binary = [ [dependencies] bytes = { version = "1.0", default-features = false } prost = { version = "0.13", default-features = false } -tendermint-proto = { version = "0.39.0", default-features = false, path = "../proto" } +tendermint-proto = { version = "0.39.1", 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 } diff --git a/config/Cargo.toml b/config/Cargo.toml index 25ad97189..8532c1cdc 100644 --- a/config/Cargo.toml +++ b/config/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-config" -version = "0.39.0" # Also update depending crates (rpc, light-node, ..) when bumping this. +version = "0.39.1" # Also update depending crates (rpc, light-node, ..) when bumping this. license = "Apache-2.0" homepage = "https://www.tendermint.com/" repository = "https://github.com/informalsystems/tendermint-rs/tree/main/tendermint" @@ -24,7 +24,7 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [dependencies] -tendermint = { version = "0.39.0", default-features = false, features = ["rust-crypto"], path = "../tendermint" } +tendermint = { version = "0.39.1", default-features = false, features = ["rust-crypto"], path = "../tendermint" } flex-error = { version = "0.4.4", default-features = false } serde = { version = "1", features = ["derive"] } serde_json = "1" diff --git a/light-client-cli/Cargo.toml b/light-client-cli/Cargo.toml index 7b906c628..f06531cdf 100644 --- a/light-client-cli/Cargo.toml +++ b/light-client-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client-cli" -version = "0.39.0" +version = "0.39.1" edition = "2021" license = "Apache-2.0" readme = "README.md" @@ -23,10 +23,10 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [dependencies] -tendermint = { version = "0.39.0", path = "../tendermint" } -tendermint-rpc = { version = "0.39.0", path = "../rpc", features = ["http-client"] } -tendermint-light-client = { version = "0.39.0", path = "../light-client" } -tendermint-light-client-detector = { version = "0.39.0", path = "../light-client-detector" } +tendermint = { version = "0.39.1", path = "../tendermint" } +tendermint-rpc = { version = "0.39.1", path = "../rpc", features = ["http-client"] } +tendermint-light-client = { version = "0.39.1", path = "../light-client" } +tendermint-light-client-detector = { version = "0.39.1", path = "../light-client-detector" } clap = { version = "4.1.8", features = ["derive"] } color-eyre = "0.6.2" diff --git a/light-client-detector/Cargo.toml b/light-client-detector/Cargo.toml index 9616f2a55..993109de6 100644 --- a/light-client-detector/Cargo.toml +++ b/light-client-detector/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client-detector" -version = "0.39.0" +version = "0.39.1" edition = "2021" license = "Apache-2.0" readme = "README.md" @@ -23,10 +23,10 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [dependencies] -tendermint = { version = "0.39.0", path = "../tendermint" } -tendermint-rpc = { version = "0.39.0", path = "../rpc", features = ["http-client"] } -tendermint-proto = { version = "0.39.0", path = "../proto" } -tendermint-light-client = { version = "0.39.0", path = "../light-client" } +tendermint = { version = "0.39.1", path = "../tendermint" } +tendermint-rpc = { version = "0.39.1", path = "../rpc", features = ["http-client"] } +tendermint-proto = { version = "0.39.1", path = "../proto" } +tendermint-light-client = { version = "0.39.1", path = "../light-client" } crossbeam-channel = { version = "0.5.11", default-features = false } derive_more = { version = "0.99.5", default-features = false, features = ["display"] } diff --git a/light-client-js/Cargo.toml b/light-client-js/Cargo.toml index fb7ce8e12..c0fe7624c 100644 --- a/light-client-js/Cargo.toml +++ b/light-client-js/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client-js" -version = "0.39.0" +version = "0.39.1" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" @@ -22,8 +22,8 @@ default = ["console_error_panic_hook"] [dependencies] serde = { version = "1.0", default-features = false, features = [ "derive" ] } serde_json = { version = "1.0", default-features = false } -tendermint = { version = "0.39.0", default-features = false, path = "../tendermint" } -tendermint-light-client-verifier = { version = "0.39.0", features = ["rust-crypto"], default-features = false, path = "../light-client-verifier" } +tendermint = { version = "0.39.1", default-features = false, path = "../tendermint" } +tendermint-light-client-verifier = { version = "0.39.1", features = ["rust-crypto"], default-features = false, path = "../light-client-verifier" } wasm-bindgen = { version = "0.2.63", default-features = false, features = [ "serde-serialize" ] } serde-wasm-bindgen = { version = "0.4.5", default-features = false } diff --git a/light-client-verifier/Cargo.toml b/light-client-verifier/Cargo.toml index b2a203470..899f76cea 100644 --- a/light-client-verifier/Cargo.toml +++ b/light-client-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client-verifier" -version = "0.39.0" +version = "0.39.1" edition = "2021" license = "Apache-2.0" readme = "README.md" @@ -27,7 +27,7 @@ default = ["rust-crypto", "flex-error/std"] rust-crypto = ["tendermint/rust-crypto"] [dependencies] -tendermint = { version = "0.39.0", path = "../tendermint", default-features = false } +tendermint = { version = "0.39.1", path = "../tendermint", default-features = false } derive_more = { version = "0.99.5", default-features = false, features = ["display"] } serde = { version = "1.0.106", default-features = false } diff --git a/light-client/Cargo.toml b/light-client/Cargo.toml index fa05dc384..673dd4c1d 100644 --- a/light-client/Cargo.toml +++ b/light-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-light-client" -version = "0.39.0" +version = "0.39.1" edition = "2021" license = "Apache-2.0" readme = "README.md" @@ -35,9 +35,9 @@ unstable = ["rust-crypto"] mbt = ["rust-crypto"] [dependencies] -tendermint = { version = "0.39.0", path = "../tendermint", default-features = false } -tendermint-rpc = { version = "0.39.0", path = "../rpc", default-features = false } -tendermint-light-client-verifier = { version = "0.39.0", path = "../light-client-verifier", default-features = false } +tendermint = { version = "0.39.1", path = "../tendermint", default-features = false } +tendermint-rpc = { version = "0.39.1", path = "../rpc", default-features = false } +tendermint-light-client-verifier = { version = "0.39.1", path = "../light-client-verifier", default-features = false } contracts = { version = "0.6.2", default-features = false } crossbeam-channel = { version = "0.5.11", default-features = false, features = ["std"] } @@ -57,7 +57,7 @@ regex = { version = "1.7.3" } [dev-dependencies] tendermint-testgen = { path = "../testgen", default-features = false } -tendermint-light-client-verifier = { version = "0.39.0", path = "../light-client-verifier", features = ["rust-crypto"] } +tendermint-light-client-verifier = { version = "0.39.1", path = "../light-client-verifier", features = ["rust-crypto"] } serde_json = { version = "1.0.51", default-features = false } gumdrop = { version = "0.8.0", default-features = false } diff --git a/p2p/Cargo.toml b/p2p/Cargo.toml index 99d1349d9..8c644fcee 100644 --- a/p2p/Cargo.toml +++ b/p2p/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-p2p" -version = "0.39.0" +version = "0.39.1" edition = "2021" license = "Apache-2.0" repository = "https://github.com/informalsystems/tendermint-rs" @@ -44,9 +44,9 @@ aead = { version = "0.5", default-features = false } flex-error = { version = "0.4.4", default-features = false } # path dependencies -tendermint = { path = "../tendermint", version = "0.39.0", default-features = false } -tendermint-proto = { path = "../proto", version = "0.39.0", default-features = false } -tendermint-std-ext = { path = "../std-ext", version = "0.39.0", default-features = false } +tendermint = { path = "../tendermint", version = "0.39.1", default-features = false } +tendermint-proto = { path = "../proto", version = "0.39.1", default-features = false } +tendermint-std-ext = { path = "../std-ext", version = "0.39.1", default-features = false } # optional dependencies prost-derive = { version = "0.13", optional = true } diff --git a/pbt-gen/Cargo.toml b/pbt-gen/Cargo.toml index f06d769a6..b2641a308 100644 --- a/pbt-gen/Cargo.toml +++ b/pbt-gen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-pbt-gen" -version = "0.39.0" +version = "0.39.1" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" diff --git a/proto/Cargo.toml b/proto/Cargo.toml index e8f197a25..a41e2f504 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-proto" -version = "0.39.0" +version = "0.39.1" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 998ce7ea2..002dc99a6 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-rpc" -version = "0.39.0" +version = "0.39.1" edition = "2021" license = "Apache-2.0" homepage = "https://www.tendermint.com/" @@ -64,9 +64,9 @@ mock-client = [ ] [dependencies] -tendermint = { version = "0.39.0", default-features = false, path = "../tendermint" } -tendermint-config = { version = "0.39.0", path = "../config", default-features = false } -tendermint-proto = { version = "0.39.0", path = "../proto", default-features = false } +tendermint = { version = "0.39.1", default-features = false, path = "../tendermint" } +tendermint-config = { version = "0.39.1", path = "../config", default-features = false } +tendermint-proto = { version = "0.39.1", path = "../proto", default-features = false } async-trait = { version = "0.1", default-features = false } bytes = { version = "1.0", default-features = false } @@ -97,7 +97,7 @@ tracing = { version = "0.1", optional = true, default-features = false } tracing-subscriber = { version = "0.3", optional = true, default-features = false, features = ["fmt"] } [dev-dependencies] -tendermint = { version = "0.39.0", default-features = false, path = "../tendermint", features = ["secp256k1"] } +tendermint = { version = "0.39.1", default-features = false, path = "../tendermint", features = ["secp256k1"] } http = { version = "1", default-features = false, features = ["std"] } lazy_static = { version = "1.4.0", default-features = false } tokio-test = { version = "0.4", default-features = false } diff --git a/std-ext/Cargo.toml b/std-ext/Cargo.toml index f542d136e..53d1538b5 100644 --- a/std-ext/Cargo.toml +++ b/std-ext/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-std-ext" -version = "0.39.0" +version = "0.39.1" edition = "2021" license = "Apache-2.0" homepage = "https://www.tendermint.com/" diff --git a/tendermint/Cargo.toml b/tendermint/Cargo.toml index 8d942d9f9..a4937ba9c 100644 --- a/tendermint/Cargo.toml +++ b/tendermint/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint" -version = "0.39.0" # Also update depending crates (rpc, light-node, etc..) when bumping this . +version = "0.39.1" # Also update depending crates (rpc, light-node, etc..) when bumping this . license = "Apache-2.0" homepage = "https://www.tendermint.com/" repository = "https://github.com/informalsystems/tendermint-rs/tree/main/tendermint" @@ -43,7 +43,7 @@ serde_repr = { version = "0.1", default-features = false } signature = { version = "2", default-features = false, features = ["alloc"] } subtle = { version = "2", default-features = false } subtle-encoding = { version = "0.5", default-features = false, features = ["bech32-preview"] } -tendermint-proto = { version = "0.39.0", default-features = false, path = "../proto" } +tendermint-proto = { version = "0.39.1", 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 } diff --git a/test/Cargo.toml b/test/Cargo.toml index 4c1ea0ef6..6dc9a4a6a 100644 --- a/test/Cargo.toml +++ b/test/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tendermint-test" description = "Tendermint workspace tests and common utilities for testing." -version = "0.39.0" +version = "0.39.1" edition = "2021" license = "Apache-2.0" categories = ["development", "test", "tools"] diff --git a/testgen/Cargo.toml b/testgen/Cargo.toml index ad003d684..e53c90356 100644 --- a/testgen/Cargo.toml +++ b/testgen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-testgen" -version = "0.39.0" +version = "0.39.1" authors = ["Informal Systems "] edition = "2021" readme = "README.md" @@ -16,7 +16,7 @@ description = """ """ [dependencies] -tendermint = { version = "0.39.0", path = "../tendermint", features = ["clock"] } +tendermint = { version = "0.39.1", path = "../tendermint", features = ["clock"] } serde = { version = "1", default-features = false, features = ["derive"] } serde_json = { version = "1", default-features = false, features = ["std"] } ed25519-consensus = { version = "2", default-features = false } diff --git a/tools/abci-test/Cargo.toml b/tools/abci-test/Cargo.toml index 0b50b62ad..6a96fd8c1 100644 --- a/tools/abci-test/Cargo.toml +++ b/tools/abci-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "abci-test" -version = "0.39.0" +version = "0.39.1" authors = ["Informal Systems "] edition = "2021" description = """ @@ -14,9 +14,9 @@ description = """ flex-error = { version = "0.4.4", default-features = false, features = ["std"] } futures = "0.3" structopt = "0.3" -tendermint = { version = "0.39.0", path = "../../tendermint" } -tendermint-config = { version = "0.39.0", path = "../../config" } -tendermint-rpc = { version = "0.39.0", path = "../../rpc", features = [ "websocket-client" ] } +tendermint = { version = "0.39.1", path = "../../tendermint" } +tendermint-config = { version = "0.39.1", path = "../../config" } +tendermint-rpc = { version = "0.39.1", path = "../../rpc", features = [ "websocket-client" ] } tracing = "0.1" tracing-subscriber = "0.2" tokio = { version = "1.20", features = ["full"] } diff --git a/tools/kvstore-test/Cargo.toml b/tools/kvstore-test/Cargo.toml index b97de3598..86ac43b18 100644 --- a/tools/kvstore-test/Cargo.toml +++ b/tools/kvstore-test/Cargo.toml @@ -11,9 +11,9 @@ edition = "2021" [dev-dependencies] futures = "0.3" sha2 = "0.10" -tendermint = { version = "0.39.0", path = "../../tendermint" } -tendermint-light-client = { version = "0.39.0", path = "../../light-client", features = ["unstable"] } -tendermint-rpc = { version = "0.39.0", path = "../../rpc", features = [ "http-client", "websocket-client" ] } +tendermint = { version = "0.39.1", path = "../../tendermint" } +tendermint-light-client = { version = "0.39.1", path = "../../light-client", features = ["unstable"] } +tendermint-rpc = { version = "0.39.1", path = "../../rpc", features = [ "http-client", "websocket-client" ] } tokio = { version = "1.0", features = [ "rt-multi-thread", "macros" ] } tracing = "0.1" tracing-subscriber = "0.3" diff --git a/tools/rpc-probe/Cargo.toml b/tools/rpc-probe/Cargo.toml index b8b3234b1..3a1bd0766 100644 --- a/tools/rpc-probe/Cargo.toml +++ b/tools/rpc-probe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-rpc-probe" -version = "0.39.0" +version = "0.39.1" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0"