Skip to content

Commit

Permalink
Release version 4.
Browse files Browse the repository at this point in the history
  • Loading branch information
abizjak committed Jan 22, 2024
1 parent 4e47edc commit b18dc70
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 19 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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

Expand Down
16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "concordium-rust-sdk"
version = "3.2.0"
version = "4.0.0"
authors = ["Concordium <[email protected]>"]
edition = "2021"
rust-version = "1.67"
Expand All @@ -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"
Expand All @@ -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"

Expand All @@ -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"
Expand All @@ -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}
26 changes: 18 additions & 8 deletions src/v2/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2153,8 +2153,8 @@ impl TryFrom<ConsensusInfo> for super::types::queries::ConsensusInfo {
type Error = tonic::Status;

fn try_from(value: ConsensusInfo) -> Result<Self, Self::Error> {
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(),
Expand Down Expand Up @@ -2414,8 +2414,8 @@ impl TryFrom<BlockInfo> for super::types::queries::BlockInfo {
type Error = tonic::Status;

fn try_from(value: BlockInfo) -> Result<Self, Self::Error> {
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
Expand Down Expand Up @@ -2573,8 +2573,13 @@ impl TryFrom<TokenomicsInfo> 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(),
Expand All @@ -2588,8 +2593,13 @@ impl TryFrom<TokenomicsInfo> 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(),
Expand Down
4 changes: 2 additions & 2 deletions src/v2/dry_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ impl TryFrom<Option<Result<generated::DryRunResponse, tonic::Status>>>
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(),
Expand Down

0 comments on commit b18dc70

Please sign in to comment.