Skip to content

Commit

Permalink
feat: prepare for release v0.7.0
Browse files Browse the repository at this point in the history
- bump workspace_optimizer to v0.14.0
- bump Rust dependencies and organize them into workspace
- set release profile at workspace Cargo.toml
- bump Rust toolchain to v1.71.0
- bump protobuf codegen to v3.3.0
- prepare shell scripts for sdk v47: use broadcast mode sync
  • Loading branch information
foxpy committed Oct 3, 2023
1 parent 31af063 commit e51021e
Show file tree
Hide file tree
Showing 22 changed files with 282 additions and 227 deletions.
23 changes: 23 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@
members = ["contracts/*", "packages/*"]

[profile.release]
opt-level = 3
debug = false
rpath = false
lto = true
debug-assertions = false
codegen-units = 1
panic = 'abort'
incremental = false
overflow-checks = true

[workspace.dependencies]
cosmwasm-std = "1.4.0"
cw2 = "1.1.1"
schemars = "0.8.15"
serde = { version = "1.0.188", default-features = false }
serde-json-wasm = "1.0.0"
cw-storage-plus = "1.1.0"
cosmwasm-schema = { version = "1.4.0", default-features = false }
base64 = "0.21.4"
prost = "0.12.1"
prost-types = "0.12.1"
cosmos-sdk-proto = { version = "0.20.0", default-features = false }
bech32 = "0.9.1"
thiserror = "1.0.49"
protobuf = { version = "3.3.0" }
hex = "0.4.3"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ We provide sample contracts that either implement or consume these specification

### Environment Setup

- Rust v1.68.2+
- Rust v1.71.0+
- `wasm32-unknown-unknown` target
- Docker

Expand Down
2 changes: 1 addition & 1 deletion build_release.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/workspace-optimizer:0.12.13
cosmwasm/workspace-optimizer:0.14.0
30 changes: 8 additions & 22 deletions contracts/ibc_transfer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,23 @@ exclude = [
"hash.txt",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
crate-type = ["cdylib", "rlib"]

[profile.release]
opt-level = 3
debug = false
rpath = false
lto = true
debug-assertions = false
codegen-units = 1
panic = 'abort'
incremental = false
overflow-checks = true

[features]
# for quicker tests, cargo test --lib
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
library = []

[dependencies]
cosmwasm-std = { version = "1.3.0", features = ["staking", "stargate"] }
cw2 = "1.1.0"
schemars = "0.8.10"
serde = { version = "1.0.149", default-features = false, features = ["derive"] }
serde-json-wasm = { version = "0.5.1" }
cw-storage-plus = { version = "1.1.0", features = ["iterator"]}
neutron-sdk = { path = "../../packages/neutron-sdk", default-features = false, version = "0.6.1"}
protobuf = { version = "3.2.0", features = ["with-bytes"] }
cosmwasm-std = { workspace = true, features = ["staking", "stargate"] }
cw2 = { workspace = true }
schemars = { workspace = true }
serde = { workspace = true }
serde-json-wasm = { workspace = true }
cw-storage-plus = { workspace = true, features = ["iterator"]}
neutron-sdk = { path = "../../packages/neutron-sdk", default-features = false }

[dev-dependencies]
cosmwasm-schema = { version = "1.3.0", default-features = false }
cosmwasm-schema = { workspace = true }
37 changes: 10 additions & 27 deletions contracts/neutron_interchain_queries/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,24 @@ exclude = [
"hash.txt",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
crate-type = ["cdylib", "rlib"]

[profile.release]
opt-level = 3
debug = false
rpath = false
lto = true
debug-assertions = false
codegen-units = 1
panic = 'abort'
incremental = false
overflow-checks = true

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
library = []

[dependencies]
cosmwasm-std = { version = "1.3.0", features = ["staking"] }
cw2 = "1.1.0"
schemars = "0.8.10"
serde = { version = "1.0.149", default-features = false, features = ["derive"] }
neutron-sdk = { path = "../../packages/neutron-sdk", default-features = false, version = "0.6.1"}
base64 = "0.21.2"
cosmos-sdk-proto = { version = "0.16.0", default-features = false }
cw-storage-plus = { version = "1.1.0", features = ["iterator"]}
prost = "0.11"
serde-json-wasm = "0.5.1"
cosmwasm-std = { workspace = true }
cw2 = { workspace = true }
schemars = { workspace = true }
serde = { workspace = true }
neutron-sdk = { path = "../../packages/neutron-sdk", default-features = false }
cosmos-sdk-proto = { workspace = true }
cw-storage-plus = { workspace = true }
serde-json-wasm = { workspace = true }

[dev-dependencies]
cosmwasm-schema = { version = "1.3.0", default-features = false }



base64 = { workspace = true }
cosmwasm-schema = { workspace = true }
2 changes: 1 addition & 1 deletion contracts/neutron_interchain_queries/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use cosmos_sdk_proto::cosmos::bank::v1beta1::MsgSend;
use cosmos_sdk_proto::cosmos::tx::v1beta1::{TxBody, TxRaw};
use cosmos_sdk_proto::traits::Message;
use cosmwasm_std::{
entry_point, to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdError, StdResult,
Uint128,
};
use cw2::set_contract_version;
use prost::Message as ProstMessage;

use crate::msg::{
Cw20BalanceResponse, ExecuteMsg, GetRecipientTxsResponse, InstantiateMsg, MigrateMsg, QueryMsg,
Expand Down
2 changes: 1 addition & 1 deletion contracts/neutron_interchain_queries/src/testing/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use cosmos_sdk_proto::cosmos::gov::v1beta1::{
Proposal as CosmosProposal, TallyResult as CosmosTallyResult,
};
use cosmos_sdk_proto::cosmos::staking::v1beta1::Validator as CosmosValidator;
use cosmos_sdk_proto::traits::Message;
use cosmos_sdk_proto::Any;
use cosmwasm_std::testing::{mock_env, mock_info, MockApi, MockStorage};
use cosmwasm_std::{
Expand All @@ -36,7 +37,6 @@ use neutron_sdk::interchain_queries::v045::types::{
Balances, FeePool, GovernmentProposal, Proposal, StakingValidator, TallyResult, TotalSupply,
Validator, RECIPIENT_FIELD,
};
use prost::Message as ProstMessage;

use neutron_sdk::interchain_queries::v045::queries::{
BalanceResponse, DelegatorDelegationsResponse, FeePoolResponse, ProposalResponse,
Expand Down
39 changes: 10 additions & 29 deletions contracts/neutron_interchain_txs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,24 @@ exclude = [
"hash.txt",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
crate-type = ["cdylib", "rlib"]

[profile.release]
opt-level = 3
debug = false
rpath = false
lto = true
debug-assertions = false
codegen-units = 1
panic = 'abort'
incremental = false
overflow-checks = true

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
library = []

[dependencies]
cosmwasm-std = { version = "1.3.0", features = ["staking"] }
cw2 = "1.1.0"
schemars = "0.8.10"
serde = { version = "1.0.149", default-features = false, features = ["derive"] }
serde-json-wasm = { version = "0.5.1" }
cw-storage-plus = { version = "1.1.0", features = ["iterator"]}
cosmos-sdk-proto = { version = "0.16.0", default-features = false }
neutron-sdk = { path = "../../packages/neutron-sdk", default-features = false, version = "0.6.1"}
base64 = "0.21.2"
protobuf = { version = "3.2.0", features = ["with-bytes"] }
prost = "0.11"
prost-types = "0.11"
bech32 = "0.9.0"
thiserror = { version = "1.0" }

cosmwasm-std = { workspace = true }
cw2 = { workspace = true }
schemars = { workspace = true }
serde = { workspace = true }
serde-json-wasm = { workspace = true }
cw-storage-plus = { workspace = true }
cosmos-sdk-proto = { workspace = true }
neutron-sdk = { path = "../../packages/neutron-sdk", default-features = false }
prost-types = { workspace = true }

[dev-dependencies]
cosmwasm-schema = { version = "1.3.0", default-features = false }
cosmwasm-schema = { workspace = true }
2 changes: 1 addition & 1 deletion contracts/neutron_interchain_txs/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ use cosmos_sdk_proto::cosmos::base::v1beta1::Coin;
use cosmos_sdk_proto::cosmos::staking::v1beta1::{
MsgDelegate, MsgDelegateResponse, MsgUndelegate, MsgUndelegateResponse,
};
use cosmos_sdk_proto::traits::Message;
#[cfg(not(feature = "library"))]
use cosmwasm_std::entry_point;
use cosmwasm_std::{
to_binary, Binary, CosmosMsg, CustomQuery, Deps, DepsMut, Env, MessageInfo, Reply, Response,
StdError, StdResult, SubMsg,
};
use cw2::set_contract_version;
use prost::Message;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

Expand Down
43 changes: 13 additions & 30 deletions packages/neutron-sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,42 +1,25 @@
[package]
name = "neutron-sdk"
description = "Neutron CosmWasm SDK for interacting with Neutron blockchain"
version = "0.6.1"
version = "0.7.0"
edition = "2021"
license = "Apache-2.0"
repository = "https://github.com/neutron-org/neutron-sdk"
homepage = "https://neutron.org"
readme = "README.md"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[profile.release]
opt-level = 3
debug = false
rpath = false
lto = true
debug-assertions = false
codegen-units = 1
panic = 'abort'
incremental = false
overflow-checks = true

[dependencies]
cosmwasm-std = { version = "1.3.0", features = ["staking"] }
cosmos-sdk-proto = { version = "0.16.0", default-features = false }
prost = "0.11"
serde = { version = "1.0.149", default-features = false, features = ["derive"] }
schemars = "0.8.10"
serde-json-wasm = "0.5.1"
cw-storage-plus = { version = "1.1.0", features = ["iterator"]}
base64 = "0.21.2"
bech32 = "0.9.1"
thiserror = { version = "1.0" }
serde_json = { version = "1.0.87" }
protobuf = { version = "3.2.0", features = ["with-bytes"] }
cosmwasm-schema = "1.3.0"
cosmwasm-std = { workspace = true }
cosmos-sdk-proto = { workspace = true }
serde = { workspace = true }
schemars = { workspace = true }
serde-json-wasm = { workspace = true }
bech32 = { workspace = true }
thiserror = { workspace = true }
protobuf = { workspace = true }
cosmwasm-schema = { workspace = true }

[dev-dependencies]
cosmwasm-schema = { version = "1.3.0", default-features = false }
prost-types = "0.11.1"
hex = "0.4.3"
base64 = { workspace = true }
prost-types = { workspace = true }
hex = { workspace = true }
2 changes: 1 addition & 1 deletion packages/neutron-sdk/src/errors/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub enum NeutronError {
Bech32(#[from] bech32::Error),

#[error("Prost protobuf error")]
ProstProtobuf(#[from] prost::DecodeError),
ProstProtobuf(#[from] cosmos_sdk_proto::prost::DecodeError),

#[error("Serde JSON (Wasm) error")]
SerdeJSONWasm(String),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ use cosmos_sdk_proto::cosmos::gov::v1beta1::{
use cosmos_sdk_proto::cosmos::staking::v1beta1::{
Commission, CommissionRates, Delegation, Description, Validator,
};
use cosmos_sdk_proto::traits::Message;
use cosmwasm_std::{
to_binary, Addr, Binary, Coin as StdCoin, Decimal, Delegation as StdDelegation, Uint128,
};
use hex;
use prost::Message as ProstMessage;
use std::ops::Mul;
use std::str::FromStr;

Expand Down
2 changes: 1 addition & 1 deletion packages/neutron-sdk/src/interchain_queries/v045/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use cosmos_sdk_proto::cosmos::{
gov::v1beta1::Proposal as CosmosProposal,
staking::v1beta1::{Delegation, Validator as CosmosValidator},
};
use cosmos_sdk_proto::traits::Message;
use cosmwasm_std::{from_binary, Addr, Coin, Decimal, StdError, Uint128};
use prost::Message as ProstMessage;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use std::{ops::Div, str::FromStr};
Expand Down
19 changes: 14 additions & 5 deletions packages/neutron-sdk/src/interchain_txs/helpers.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
use cosmos_sdk_proto::cosmos::base::abci::v1beta1::{MsgData, TxMsgData};
use cosmos_sdk_proto::{
cosmos::base::abci::v1beta1::{MsgData, TxMsgData},
traits::Message,
};
use cosmwasm_std::{Binary, StdError, StdResult};
use prost::{DecodeError, Message};

/// Decodes acknowledgement into `Vec<MsgData>` structure
pub fn decode_acknowledgement_response(data: Binary) -> StdResult<Vec<MsgData>> {
let msg_data: Result<TxMsgData, DecodeError> = TxMsgData::decode(data.as_slice());
let msg_data: Result<TxMsgData, _> = TxMsgData::decode(data.as_slice());
match msg_data {
Err(e) => Err(StdError::generic_err(format!(
"Can't decode response: {}",
e
))),
Ok(msg) => Ok(msg.data),
Ok(msg) => Ok(msg
.msg_responses
.into_iter()
.map(|response| MsgData {
msg_type: response.type_url,
data: response.value,
})
.collect()),
}
}

/// Decodes protobuf any item into T structure
pub fn decode_message_response<T: prost::Message + Default>(item: &Vec<u8>) -> StdResult<T> {
pub fn decode_message_response<T: Message + Default>(item: &Vec<u8>) -> StdResult<T> {
let res = T::decode(item.as_slice());
match res {
Err(e) => Err(StdError::generic_err(format!("Can't decode item: {}", e))),
Expand Down
6 changes: 3 additions & 3 deletions packages/neutron-sdk/src/proto_types/transfer.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 3.2.0. Do not edit
// This file is generated by rust-protobuf 3.3.0. Do not edit
// .proto file is parsed by protoc --rust-out=...
// @generated

Expand All @@ -23,12 +23,12 @@

/// Generated files are compatible only with the same version
/// of protobuf runtime.
const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_2_0;
const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0;

/// MsgTransferResponse is the modified response type for
/// ibc-go MsgTransfer.
#[derive(PartialEq,Clone,Default,Debug)]
// @@protoc_insertion_point(message:neutron.transfer.MsgTransferResponse)
#[derive(PartialEq,Clone,Default,Debug)]
pub struct MsgTransferResponse {
// message fields
/// channel's sequence_id for outgoing ibc packet. Unique per a channel.
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.68.2"
channel = "1.71.0"
Loading

0 comments on commit e51021e

Please sign in to comment.