From 662d28cde76b7c67cec03acc247263b1a6f87485 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Fri, 23 Aug 2024 12:19:50 +0200 Subject: [PATCH] build(deps)!: update prost, tokio, tonic --- Cargo.toml | 5 +++++ abci/Cargo.toml | 16 +++++----------- abci/src/lib.rs | 2 +- abci/src/server/codec.rs | 12 +++++++----- abci/src/signatures.rs | 3 +-- abci/tests/grpc.rs | 15 +++++++++------ proto-compiler/Cargo.toml | 16 +++++++++------- proto/Cargo.toml | 20 +++++++++++--------- proto/src/lib.rs | 1 + proto/src/protobuf.rs | 4 ++-- proto/tests/unit.rs | 7 +++++-- scripts/release.sh | 2 +- 12 files changed, 57 insertions(+), 46 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 78f7333..781858b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,8 @@ [workspace] resolver = "2" members = ["abci", "proto-compiler", "proto"] + +[workspace.package] + +rust-version = "1.76" +version = "1.1.0" diff --git a/abci/Cargo.toml b/abci/Cargo.toml index d5b5d18..d2c670a 100644 --- a/abci/Cargo.toml +++ b/abci/Cargo.toml @@ -1,5 +1,4 @@ [package] -version = "1.1.0" name = "tenderdash-abci" edition = "2021" license = "Apache-2.0" @@ -12,6 +11,9 @@ documentation = "https://dashpay.github.io/rs-tenderdash-abci/tenderdash_abci/" description = """tenderdash-abci provides a simple framework with which to build\ low-level applications on top of Tenderdash.""" +rust-version.workspace = true +version.workspace = true + [features] default = [ "server", @@ -46,7 +48,6 @@ required-features = ["server"] uuid = { version = "1.8.0", features = ["v4", "fast-rng"], optional = true } tenderdash-proto = { path = "../proto", default-features = false } bytes = { version = "1.6.0" } -prost = { version = "0.12.4" } tracing = { version = "0.1.40", default-features = false } tracing-subscriber = { version = "0.3.18", optional = true, default-features = false, features = [ "ansi", @@ -75,16 +76,9 @@ futures = { version = "0.3.30", optional = true } anyhow = { version = "1.0.82" } bincode = { version = "2.0.0-rc.3" } blake2 = { version = "0.10.6" } -bollard = { version = "0.16.1" } +bollard = { version = "0.17" } futures = { version = "0.3.30" } -tokio = { version = "1.37.0", features = [ - "macros", - "signal", - "time", - "io-std", -] } +tokio = { version = "1.39", features = ["macros", "signal", "time", "io-std"] } hex = { version = "0.4.3" } lazy_static = { version = "1.4.0" } -# For tests of gRPC server -tonic = { version = "0.11.0" } pollster = { version = "0.3.0" } diff --git a/abci/src/lib.rs b/abci/src/lib.rs index fc86059..98d3abd 100644 --- a/abci/src/lib.rs +++ b/abci/src/lib.rs @@ -19,11 +19,11 @@ mod server; use std::io; pub use application::{check_version, Application, RequestDispatcher}; -use prost::{DecodeError, EncodeError}; #[allow(deprecated)] #[cfg(feature = "server")] pub use server::{start_server, CancellationToken, Server, ServerBuilder, ServerRuntime}; pub use tenderdash_proto as proto; +use tenderdash_proto::prost::{DecodeError, EncodeError}; #[cfg(feature = "crypto")] pub mod signatures; diff --git a/abci/src/server/codec.rs b/abci/src/server/codec.rs index 8d531e3..8996d71 100644 --- a/abci/src/server/codec.rs +++ b/abci/src/server/codec.rs @@ -8,8 +8,11 @@ use std::{fmt::Debug, sync::Arc}; use bytes::{Buf, BufMut, BytesMut}; use futures::{SinkExt, StreamExt}; -use prost::Message; use proto::abci::{Request, Response}; +use tenderdash_proto::prost::{ + encoding::{decode_varint, encode_varint}, + Message, +}; use tokio::{ io::{AsyncRead, AsyncWrite}, sync::{ @@ -162,7 +165,7 @@ impl Decoder for Coder { let src_len = src.len(); let mut tmp = src.clone().freeze(); - let encoded_len = match prost::encoding::decode_varint(&mut tmp) { + let encoded_len = match decode_varint(&mut tmp) { Ok(len) => len, // We've potentially only received a partial length delimiter Err(_) if src_len <= MAX_VARINT_LENGTH => return Ok(None), @@ -198,7 +201,7 @@ impl Encoder for Coder { message.encode(&mut buf)?; let buf = buf.freeze(); - prost::encoding::encode_varint(buf.len() as u64, dst); + encode_varint(buf.len() as u64, dst); dst.put(buf); Ok(()) } @@ -206,8 +209,7 @@ impl Encoder for Coder { #[cfg(test)] mod test { - use prost::Message; - use tenderdash_proto::abci; + use tenderdash_proto::{abci, prost::Message}; use tokio::{io::AsyncWriteExt, sync::mpsc}; use tokio_util::sync::CancellationToken; diff --git a/abci/src/signatures.rs b/abci/src/signatures.rs index 649fb9e..3004193 100644 --- a/abci/src/signatures.rs +++ b/abci/src/signatures.rs @@ -23,8 +23,7 @@ use std::{ }; use bytes::BufMut; -use prost::Message; -use tenderdash_proto::types::CanonicalVote; +use tenderdash_proto::{prost::Message, types::CanonicalVote}; use crate::{ proto::types::{ diff --git a/abci/tests/grpc.rs b/abci/tests/grpc.rs index 6754a0f..fde8e00 100644 --- a/abci/tests/grpc.rs +++ b/abci/tests/grpc.rs @@ -18,7 +18,7 @@ use tenderdash_abci::{ }; mod common; use tenderdash_abci::proto; -use tonic::{async_trait, Response, Status}; +use tenderdash_proto::tonic::{async_trait, Response, Status}; #[cfg(feature = "docker-tests")] #[tokio::test(flavor = "multi_thread", worker_threads = 2)] @@ -58,7 +58,7 @@ async fn grpc_server_test(test_name: &str, bind_address: &str) { use core::panic; use proto::abci::abci_application_server::AbciApplicationServer; - use tonic::transport::Server; + use tenderdash_proto::tonic::transport::Server; tracing_subscriber::fmt() .with_env_filter(tracing_subscriber::EnvFilter::new("debug")) @@ -125,8 +125,8 @@ pub struct TestApp { impl AbciApplication for TestApp { async fn echo( &self, - request: tonic::Request, - ) -> Result, Status> { + request: tenderdash_proto::tonic::Request, + ) -> Result, Status> { tracing::info!(?request, "Echo called"); Ok(Response::new(proto::abci::ResponseEcho { message: request.into_inner().message, @@ -134,8 +134,11 @@ impl AbciApplication for TestApp { } async fn info( &self, - _request: tonic::Request, - ) -> std::result::Result, tonic::Status> { + _request: tenderdash_proto::tonic::Request, + ) -> std::result::Result< + tenderdash_proto::tonic::Response, + tenderdash_proto::tonic::Status, + > { tracing::info!("Info called, test successful"); let resp = ResponseInfo { ..Default::default() diff --git a/proto-compiler/Cargo.toml b/proto-compiler/Cargo.toml index 1697a03..5dc7033 100644 --- a/proto-compiler/Cargo.toml +++ b/proto-compiler/Cargo.toml @@ -1,23 +1,25 @@ [package] -version = "1.1.0" name = "tenderdash-proto-compiler" authors = ["Informal Systems ", "Dash Core Group"] edition = "2021" description = "Internal tool to download and build tenderdash protobuf definitions; used by proto/build.rs" publish = false +rust-version.workspace = true +version.workspace = true + [lib] [dependencies] walkdir = { version = "2.5.0" } -prost-build = { version = "0.12.4" } -tempfile = { version = "3.10.1" } -regex = { "version" = "1.10.4" } +prost-build = { version = "0.13" } +tempfile = { version = "3.12" } +regex = { "version" = "1.10" } # Use of native-tls-vendored should build vendored openssl, which is required for Alpine build -ureq = { "version" = "2.9.6" } -zip = { version = "2.1.3", default-features = false, features = ["deflate"] } +ureq = { "version" = "2.10" } +zip = { version = "2.2", default-features = false, features = ["deflate"] } fs_extra = { version = "1.3.0" } -tonic-build = { version = "0.11.0", optional = true } +tonic-build = { version = "0.12", optional = true } [features] diff --git a/proto/Cargo.toml b/proto/Cargo.toml index 83c6bcb..b31346c 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -1,5 +1,4 @@ [package] -version = "1.1.0" name = "tenderdash-proto" edition = "2021" license = "Apache-2.0" @@ -19,6 +18,9 @@ description = """ tenderdash-proto is a the Rust implementation of the Tenderdash proto structs. """ +rust-version.workspace = true +version.workspace = true + [package.metadata.docs.rs] all-features = true @@ -44,30 +46,30 @@ grpc = [ ] [dependencies] -prost = { version = "0.12.4", default-features = false, features = [ +prost = { version = "0.13", default-features = false, features = [ "prost-derive", ] } -tonic = { version = "0.11.0", optional = true } -bytes = { version = "1.6.0", default-features = false, features = ["serde"] } -serde = { version = "1.0.197", default-features = false, features = ["derive"] } +tonic = { version = "0.12", optional = true } +bytes = { version = "1.7", default-features = false, features = ["serde"] } +serde = { version = "1.0.208", default-features = false, features = ["derive"] } subtle-encoding = { version = "0.5.1", default-features = false, features = [ "hex", "base64", "alloc", ] } -num-traits = { version = "0.2.18", default-features = false } +num-traits = { version = "0.2.19", default-features = false } num-derive = { version = "0.4.2", default-features = false } time = { version = "0.3.36", default-features = false, features = [ "macros", "parsing", ] } flex-error = { version = "0.4.4", default-features = false } -chrono = { version = "0.4.37", default-features = false } -derive_more = { version = "0.99.17" } +chrono = { version = "0.4.38", default-features = false } +derive_more = { version = "1.0", features = ["from", "from_str"] } [dev-dependencies] -serde_json = { version = "1.0.115", default-features = false, features = [ +serde_json = { version = "1.0.125", default-features = false, features = [ "alloc", ] } diff --git a/proto/src/lib.rs b/proto/src/lib.rs index 79b11f1..9dc2fc8 100644 --- a/proto/src/lib.rs +++ b/proto/src/lib.rs @@ -31,6 +31,7 @@ use std::fmt::Display; use bytes::{Buf, BufMut}; pub use error::Error; +pub use prost; use prost::{encoding::encoded_len_varint, Message}; #[rustfmt::skip] pub mod tenderdash_nostd; diff --git a/proto/src/protobuf.rs b/proto/src/protobuf.rs index 04237ac..52ed3fa 100644 --- a/proto/src/protobuf.rs +++ b/proto/src/protobuf.rs @@ -21,7 +21,7 @@ use std::fmt; /// 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)] +#[derive(Clone, Copy, PartialEq, ::prost::Message, ::serde::Deserialize, ::serde::Serialize)] #[serde( from = "crate::serializers::timestamp::Rfc3339", into = "crate::serializers::timestamp::Rfc3339" @@ -46,7 +46,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)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] 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/proto/tests/unit.rs b/proto/tests/unit.rs index 229c353..ec986af 100644 --- a/proto/tests/unit.rs +++ b/proto/tests/unit.rs @@ -124,13 +124,16 @@ pub fn protobuf_struct_conveniences_example() { #[test] pub fn test_response_exception_from() { - assert_eq!(ResponseException::from("string").error, "string"); assert_eq!( ResponseException::from(String::from("string")).error, "string" ); assert_eq!( - ResponseException::from(&String::from("string")).error, + ResponseException::from(String::from("string")).error, + "string" + ); + assert_eq!( + ResponseException::from(String::from("string")).error, "string" ); } diff --git a/scripts/release.sh b/scripts/release.sh index e0d4534..9a65a89 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -74,7 +74,7 @@ rs_tenderdash_abci_version=${rs_tenderdash_abci_version#v} # remove 'v' if it ex set -ex # Update the version in the Cargo.toml files. -sed -i "s/^version = .*/version = \"$rs_tenderdash_abci_version\"/" ./*/Cargo.toml +sed -i "s/^version = .*/version = \"$rs_tenderdash_abci_version\"/" ./Cargo.toml sed -i "s/^\s*const DEFAULT_VERSION: &str = \".*\";/const DEFAULT_VERSION: \&str = \"v$td_version\";/" ./proto/build.rs cargo fmt -- ./proto/build.rs 2>/dev/null