From b18dc700ecd5f0a6ae15e28e686d5961fce70fa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Bizjak?= Date: Mon, 22 Jan 2024 12:56:16 +0100 Subject: [PATCH] Release version 4. --- CHANGELOG.md | 3 +++ Cargo.toml | 16 ++++++++-------- concordium-base | 2 +- src/v2/conversions.rs | 26 ++++++++++++++++++-------- src/v2/dry_run.rs | 4 ++-- 5 files changed, 32 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2100970f..1dfb7b538 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Unreleased changes +## 4.0.0 + - Add a `From<&AccountInfo>` instance for `AccountAccessStructure` to ease verification of signatures using `GetAccountInfo` response. - Add a `get_finalized_block_item` method to the `Client` to retrieve a finalized block item from the node. - Remove the V1 API. @@ -22,6 +24,7 @@ to simulate smart contract updates. The return values of these can be used to immediately sign and send a transaction. - Update `rand` dependency to `0.8`. +- Update `tonic` to 0.10. ## 3.2.0 diff --git a/Cargo.toml b/Cargo.toml index cb637657f..60a3d6d93 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "concordium-rust-sdk" -version = "3.2.0" +version = "4.0.0" authors = ["Concordium "] edition = "2021" rust-version = "1.67" @@ -14,8 +14,8 @@ homepage = "https://github.com/Concordium/concordium-rust-sdk" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -tonic = {version = "0.8"} -prost = "0.11" +tonic = {version = "0.10"} +prost = "0.12" tokio = { version = "1.27", features = ["net"] } futures = "0.3" serde_json = "1.0" @@ -38,8 +38,8 @@ tokio-postgres = { version = "^0.7.8", features = ["with-serde_json-1"], optiona http = "0.2" tokio-stream = "0.1" -concordium_base = { version = "3.2.0", path = "./concordium-base/rust-src/concordium_base/", features = ["encryption"] } -concordium-smart-contract-engine = { version = "3.0", path = "./concordium-base/smart-contracts/wasm-chain-integration/", default-features = false, features = ["async"]} +concordium_base = { version = "4.0", path = "./concordium-base/rust-src/concordium_base/", features = ["encryption"] } +concordium-smart-contract-engine = { version = "4.0", path = "./concordium-base/smart-contracts/wasm-chain-integration/", default-features = false, features = ["async"]} aes-gcm = { version = "0.10", features = ["std"] } tracing = "0.1" @@ -53,7 +53,7 @@ clap = "2.34" csv = "1.1" tokio = { version = "1.27", features = ["full"] } tokio-test = { version = "0.4" } -tonic = {version = "0.8", features = ["tls", "tls-roots"]} # Use system trust roots. +tonic = {version = "0.10", features = ["tls", "tls-roots"]} # Use system trust roots. [[example]] name = "postgres" @@ -64,5 +64,5 @@ name = "monitor-postgres" required-features = ["postgres"] [build-dependencies] -tonic-build = {version = "0.8", optional = true} -git2 = {version = "0.14", optional = true} +tonic-build = {version = "0.10", optional = true} +git2 = {version = "0.18", optional = true} diff --git a/concordium-base b/concordium-base index 8024ceed0..6d9ad3500 160000 --- a/concordium-base +++ b/concordium-base @@ -1 +1 @@ -Subproject commit 8024ceed057aeccee59f158a64cd108e35f2a5fc +Subproject commit 6d9ad3500d0150062d8596715f6920ff33678c89 diff --git a/src/v2/conversions.rs b/src/v2/conversions.rs index 41584e642..167290d02 100644 --- a/src/v2/conversions.rs +++ b/src/v2/conversions.rs @@ -2153,8 +2153,8 @@ impl TryFrom for super::types::queries::ConsensusInfo { type Error = tonic::Status; fn try_from(value: ConsensusInfo) -> Result { - let protocol_version = ProtocolVersion::from_i32(value.protocol_version) - .ok_or_else(|| tonic::Status::internal("Unknown protocol version"))? + let protocol_version = ProtocolVersion::try_from(value.protocol_version) + .map_err(|_| tonic::Status::internal("Unknown protocol version"))? .into(); Ok(Self { last_finalized_block_height: value.last_finalized_block_height.require()?.into(), @@ -2414,8 +2414,8 @@ impl TryFrom for super::types::queries::BlockInfo { type Error = tonic::Status; fn try_from(value: BlockInfo) -> Result { - let protocol_version = ProtocolVersion::from_i32(value.protocol_version) - .ok_or_else(|| { + let protocol_version = ProtocolVersion::try_from(value.protocol_version) + .map_err(|_| { tonic::Status::internal(format!( "Unknown protocol version: {}", value.protocol_version @@ -2573,8 +2573,13 @@ impl TryFrom for super::types::RewardsOverview { match value.tokenomics.require()? { tokenomics_info::Tokenomics::V0(value) => Ok(Self::V0 { data: super::types::CommonRewardData { - protocol_version: ProtocolVersion::from_i32(value.protocol_version) - .require()? + protocol_version: ProtocolVersion::try_from(value.protocol_version) + .map_err(|_| { + tonic::Status::internal(format!( + "Unknown protocol version: {}", + value.protocol_version + )) + })? .into(), total_amount: value.total_amount.require()?.into(), total_encrypted_amount: value.total_encrypted_amount.require()?.into(), @@ -2588,8 +2593,13 @@ impl TryFrom for super::types::RewardsOverview { }), tokenomics_info::Tokenomics::V1(value) => Ok(Self::V1 { common: super::types::CommonRewardData { - protocol_version: ProtocolVersion::from_i32(value.protocol_version) - .require()? + protocol_version: ProtocolVersion::try_from(value.protocol_version) + .map_err(|_| { + tonic::Status::internal(format!( + "Unknown protocol version: {}", + value.protocol_version + )) + })? .into(), total_amount: value.total_amount.require()?.into(), total_encrypted_amount: value.total_encrypted_amount.require()?.into(), diff --git a/src/v2/dry_run.rs b/src/v2/dry_run.rs index 1aa8eabe5..7bb77cc45 100644 --- a/src/v2/dry_run.rs +++ b/src/v2/dry_run.rs @@ -233,8 +233,8 @@ impl TryFrom>> match response { generated::dry_run_success_response::Response::BlockStateLoaded(loaded) => { let protocol_version = - generated::ProtocolVersion::from_i32(loaded.protocol_version) - .ok_or_else(|| tonic::Status::unknown("Unknown protocol version"))? + generated::ProtocolVersion::try_from(loaded.protocol_version) + .map_err(|_| tonic::Status::unknown("Unknown protocol version"))? .into(); let loaded = BlockStateLoaded { current_timestamp: loaded.current_timestamp.require()?.into(),