Skip to content

Commit

Permalink
chore: Guard the new feature with cosmwasm_2_2 capability
Browse files Browse the repository at this point in the history
  • Loading branch information
kulikthebird committed Aug 29, 2024
1 parent 2626432 commit e19ee2c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion contracts/hackatom/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ cranelift = ["cosmwasm-vm/cranelift"]

[dependencies]
cosmwasm-schema = { path = "../../packages/schema" }
cosmwasm-std = { path = "../../packages/std", default-features = false, features = ["std", "abort"] }
cosmwasm-std = { path = "../../packages/std", default-features = false, features = ["std", "abort", "cosmwasm_2_2"] }
schemars = "0.8.12"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
sha2 = "0.10"
Expand Down
2 changes: 1 addition & 1 deletion contracts/hackatom/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fn make_init_msg(api: &MockApi) -> (InstantiateMsg, String) {
#[test]
fn proper_initialization() {
let mut deps = mock_instance(WASM, &[]);
assert_eq!(deps.required_capabilities().len(), 0);
assert_eq!(deps.required_capabilities().len(), 7);

let verifier = deps.api().addr_make("verifies");
let beneficiary = deps.api().addr_make("benefits");
Expand Down
2 changes: 1 addition & 1 deletion packages/derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ fn entry_point_impl(attr: TokenStream, item: TokenStream) -> TokenStream {
let fn_name = &function.sig.ident;
let wasm_export = format_ident!("__wasm_export_{fn_name}");

// Migrate entry point can take 2 or 3 arguments.
// Migrate entry point can take 2 or 3 arguments
let do_call = if fn_name == "migrate" && args == 3 {
format_ident!("do_migrate_with_info")
} else {
Expand Down
1 change: 1 addition & 0 deletions packages/std/src/exports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ where
/// - `M`: message type for request
/// - `C`: custom response message type (see CosmosMsg)
/// - `E`: error type for responses
#[cfg(feature = "cosmwasm_2_2")]
pub fn do_migrate_with_info<Q, M, C, E>(
migrate_with_info_fn: &dyn Fn(DepsMut<Q>, Env, M, MigrateInfo) -> Result<Response<C>, E>,
env_ptr: u32,
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 @@ -127,10 +127,12 @@ mod imports;
#[cfg(target_arch = "wasm32")]
mod memory; // Used by exports and imports only. This assumes pointers are 32 bit long, which makes it untestable on dev machines.

#[cfg(all(feature = "cosmwasm_2_2", target_arch = "wasm32"))]
pub use crate::exports::do_migrate_with_info;
#[cfg(target_arch = "wasm32")]
pub use crate::exports::{
do_execute, do_ibc_destination_callback, do_ibc_source_callback, do_instantiate, do_migrate,
do_migrate_with_info, do_query, do_reply, do_sudo,
do_query, do_reply, do_sudo,
};
#[cfg(all(feature = "stargate", target_arch = "wasm32"))]
pub use crate::exports::{
Expand Down

0 comments on commit e19ee2c

Please sign in to comment.