Skip to content

Commit

Permalink
feat: Add cosmwasm_3_0 feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
kulikthebird committed Jan 30, 2025
1 parent 5bc54f3 commit e41e668
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ jobs:
name: Clippy linting on std (all feature flags)
working_directory: ~/project/packages/std
# change to --all-features once `abort` is removed
command: cargo clippy --all-targets --tests --features staking,stargate,cosmwasm_2_2 -- -D warnings
command: cargo clippy --all-targets --tests --features staking,stargate,cosmwasm_3_0 -- -D warnings
- run:
name: Clippy linting on vm (no feature flags)
working_directory: ~/project/packages/vm
Expand Down
1 change: 1 addition & 0 deletions contracts/ibc-callbacks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ cosmwasm-schema = { path = "../../packages/schema" }
cosmwasm-std = { path = "../../packages/std", features = [
"iterator",
"stargate",
"cosmwasm_3_0"
] }
schemars = "0.8.3"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion packages/check/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use cosmwasm_vm::internals::{check_wasm, compile, make_compiling_engine, LogOutp
use cosmwasm_vm::{capabilities_from_csv, WasmLimits};

const DEFAULT_AVAILABLE_CAPABILITIES: &str =
"iterator,staking,stargate,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4,cosmwasm_2_0,cosmwasm_2_1,cosmwasm_2_2";
"iterator,staking,stargate,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4,cosmwasm_2_0,cosmwasm_2_1,cosmwasm_2_2,cosmwasm_3_0";

pub fn main() {
let matches = Command::new("Contract checking")
Expand Down
2 changes: 1 addition & 1 deletion packages/go-gen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ release = false

[dependencies]
cosmwasm-std = { version = "2.2.0-rc.1", path = "../std", features = [
"cosmwasm_2_2",
"cosmwasm_3_0",
"staking",
"stargate",
] }
Expand Down
3 changes: 3 additions & 0 deletions packages/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ cosmwasm_2_1 = ["cosmwasm_2_0"]
# This enables functionality that is only available on 2.2 chains.
# It adds `IbcMsg::PayPacketFee` and `IbcMsg::PayPacketFeeAsync`.
cosmwasm_2_2 = ["cosmwasm_2_1"]
# This enables functionality that is only available on 3.0 chains.
# It adds `IbcMsg::TransferV2` message
cosmwasm_3_0 = ["cosmwasm_2_2"]

[dependencies]
base64 = "0.22.0"
Expand Down
4 changes: 4 additions & 0 deletions packages/std/src/exports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ extern "C" fn requires_cosmwasm_2_1() {}
#[no_mangle]
extern "C" fn requires_cosmwasm_2_2() {}

#[cfg(feature = "cosmwasm_3_0")]
#[no_mangle]
extern "C" fn requires_cosmwasm_3_0() {}

/// interface_version_* exports mark which Wasm VM interface level this contract is compiled for.
/// They can be checked by cosmwasm_vm.
/// Update this whenever the Wasm VM interface breaks.
Expand Down
3 changes: 3 additions & 0 deletions packages/std/src/ibc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ use crate::{Addr, Timestamp};

mod callbacks;
mod transfer_msg_builder;
#[cfg(feature = "cosmwasm_3_0")]
mod transfer_msg_builder_v2;

pub use callbacks::*;
pub use transfer_msg_builder::*;
#[cfg(feature = "cosmwasm_3_0")]
pub use transfer_msg_builder_v2::*;

#[non_exhaustive]
Expand Down Expand Up @@ -68,6 +70,7 @@ pub enum IbcMsg {
/// and a matching module on the remote chain.
/// We cannot select the port_id, this is whatever the local chain has bound the ibctransfer
/// module to.
#[cfg(feature = "cosmwasm_3_0")]
TransferV2 {
/// existing channel to send the tokens over
channel_id: String,
Expand Down
4 changes: 3 additions & 1 deletion packages/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ pub use crate::errors::{
pub use crate::eureka::{EurekaMsg, EurekaPayload};
pub use crate::hex_binary::HexBinary;
pub use crate::ibc::IbcChannelOpenResponse;
#[cfg(feature = "cosmwasm_3_0")]
pub use crate::ibc::TransferMsgBuilderV2;
pub use crate::ibc::{
Hop, Ibc3ChannelOpenResponse, IbcAckCallbackMsg, IbcAcknowledgement, IbcBasicResponse,
IbcCallbackRequest, IbcChannel, IbcChannelCloseMsg, IbcChannelConnectMsg, IbcChannelOpenMsg,
IbcDestinationCallbackMsg, IbcDstCallback, IbcEndpoint, IbcFee, IbcMsg, IbcOrder, IbcPacket,
IbcPacketAckMsg, IbcPacketReceiveMsg, IbcPacketTimeoutMsg, IbcReceiveResponse,
IbcSourceCallbackMsg, IbcSrcCallback, IbcTimeout, IbcTimeoutBlock, IbcTimeoutCallbackMsg,
TransferMsgBuilder, TransferMsgBuilderV2,
TransferMsgBuilder,
};
#[cfg(feature = "iterator")]
pub use crate::iterator::{Order, Record};
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/src/testing/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl MockInstanceOptions<'_> {
fn default_capabilities() -> HashSet<String> {
#[allow(unused_mut)]
let mut out = capabilities_from_csv(
"iterator,staking,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4,cosmwasm_2_0,cosmwasm_2_1,cosmwasm_2_2",
"iterator,staking,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4,cosmwasm_2_0,cosmwasm_2_1,cosmwasm_2_2,cosmwasm_3_0",
);
#[cfg(feature = "stargate")]
out.insert("stargate".to_string());
Expand Down

0 comments on commit e41e668

Please sign in to comment.