Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CosmWasm dependencies to v2 #1251

Merged
merged 10 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ members = [
# internal crates that are not published
"tests-integration",
]

exclude = [
"ci/cw-check",
"ci/no-std-check",
Expand Down Expand Up @@ -105,8 +106,7 @@ ibc-client-tendermint-types = { version = "0.53.0", path = "./ibc-clients/ics07-
ibc-client-wasm-types = { version = "0.53.0", path = "./ibc-clients/ics08-wasm/types", default-features = false }
ibc-app-transfer-types = { version = "0.53.0", path = "./ibc-apps/ics20-transfer/types", default-features = false }
ibc-app-nft-transfer-types = { version = "0.53.0", path = "./ibc-apps/ics721-nft-transfer/types", default-features = false }

ibc-proto = { version = "0.45.0", default-features = false }
ibc-proto = { version = "0.45.0", default-features = false }

# cosmos dependencies
tendermint = { version = "0.36.0", default-features = false }
Expand All @@ -120,10 +120,10 @@ tendermint-testgen = { version = "0.36.0", default-features = fals
### Note: Kept at the following version to match the CosmWasm module version
### used by chains supporting the wasm-enabled version of ibc-go v7.3
### (This is the min version of `ibc-go` that supports `08-wasm` light clients)
cosmwasm-schema = { version = "1.5.4" }
cosmwasm-std = { version = "1.5.4" }
cosmwasm-vm = { version = "1.5.4" }
cw-storage-plus = { version = "1.2.0" }
cosmwasm-schema = { version = "2.0.4" }
cosmwasm-std = { version = "2.0.4" }
cosmwasm-vm = { version = "2.0.4" }
cw-storage-plus = { version = "2.0.0" }

# parity dependencies
parity-scale-codec = { version = "3.6.5", default-features = false, features = [ "derive" ] }
Expand Down
40 changes: 15 additions & 25 deletions ci/cw-check/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ci/cw-check/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ crate-type = [ "cdylib", "rlib" ]
[dependencies]
ibc-apps = { path = "../../ibc-apps", default-features = false, features = [ "serde", "parity-scale-codec" ] }
ibc-core = { path = "../../ibc-core", features = [ "serde", "parity-scale-codec", "schema" ] }
cosmwasm-std = { version = "1.5.4", default-features = false }
cosmwasm-schema = { version = "1.5.4", default-features = false }
cosmwasm-std = { version = "2.0.4", default-features = false, features = [ "std" ] }
cosmwasm-schema = { version = "2.0.4", default-features = false }
serde-json = { package = "serde-json-wasm", version = "^1.0.1", default-features = false }
thiserror = { version = "^1.0", default-features = false }

Expand Down
2 changes: 1 addition & 1 deletion ibc-clients/cw-context/src/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
/// - Only a sorted set is needed. So the value type is set to
/// [`Empty`] following
/// ([cosmwasm-book](https://book.cosmwasm.com/cross-contract/map-storage.html#maps-as-sets)).
pub const CONSENSUS_STATE_HEIGHT_MAP: Map<'_, (u64, u64), Empty> =
pub const CONSENSUS_STATE_HEIGHT_MAP: Map<(u64, u64), Empty> =
Map::new(ITERATE_CONSENSUS_STATE_PREFIX);

/// Context is a wrapper around the deps and env that provides access
Expand Down Expand Up @@ -152,7 +152,7 @@
.map(|deserialized_result| {
let (rev_number, rev_height) =
deserialized_result.map_err(|e| ClientError::Other {
description: e.to_string(),

Check warning on line 155 in ibc-clients/cw-context/src/context/mod.rs

View check run for this annotation

Codecov / codecov/patch

ibc-clients/cw-context/src/context/mod.rs#L155

Added line #L155 was not covered by tests
})?;
Height::new(rev_number, rev_height)
})
Expand Down Expand Up @@ -191,7 +191,7 @@
.map(|deserialized_result| {
let ((rev_number, rev_height), _) =
deserialized_result.map_err(|e| ClientError::Other {
description: e.to_string(),

Check warning on line 194 in ibc-clients/cw-context/src/context/mod.rs

View check run for this annotation

Codecov / codecov/patch

ibc-clients/cw-context/src/context/mod.rs#L194

Added line #L194 was not covered by tests
})?;
Height::new(rev_number, rev_height)
})
Expand Down Expand Up @@ -226,48 +226,48 @@
pub fn get_metadata(&self) -> Result<Option<Vec<GenesisMetadata>>, ContractError> {
let mut metadata = Vec::<GenesisMetadata>::new();

let iterator = CONSENSUS_STATE_HEIGHT_MAP
.keys(self.storage_ref(), None, None, Order::Ascending)
.map(|deserialized_result| {
let (rev_number, rev_height) =
deserialized_result.map_err(|e| ClientError::Other {
description: e.to_string(),
})?;
Height::new(rev_number, rev_height)
});

Check warning on line 237 in ibc-clients/cw-context/src/context/mod.rs

View check run for this annotation

Codecov / codecov/patch

ibc-clients/cw-context/src/context/mod.rs#L229-L237

Added lines #L229 - L237 were not covered by tests

for height_result in iterator {
let height = height_result?;

Check warning on line 240 in ibc-clients/cw-context/src/context/mod.rs

View check run for this annotation

Codecov / codecov/patch

ibc-clients/cw-context/src/context/mod.rs#L239-L240

Added lines #L239 - L240 were not covered by tests

let processed_height_key = self.client_update_height_key(&height);
metadata.push(GenesisMetadata {
key: processed_height_key.clone(),
value: self.retrieve(&processed_height_key)?,

Check warning on line 245 in ibc-clients/cw-context/src/context/mod.rs

View check run for this annotation

Codecov / codecov/patch

ibc-clients/cw-context/src/context/mod.rs#L242-L245

Added lines #L242 - L245 were not covered by tests
});
let processed_time_key = self.client_update_time_key(&height);
metadata.push(GenesisMetadata {
key: processed_time_key.clone(),
value: self.retrieve(&processed_time_key)?,

Check warning on line 250 in ibc-clients/cw-context/src/context/mod.rs

View check run for this annotation

Codecov / codecov/patch

ibc-clients/cw-context/src/context/mod.rs#L247-L250

Added lines #L247 - L250 were not covered by tests
});
}

let iterator = CONSENSUS_STATE_HEIGHT_MAP
.keys(self.storage_ref(), None, None, Order::Ascending)
.map(|deserialized_result| {
let (rev_number, rev_height) =
deserialized_result.map_err(|e| ClientError::Other {
description: e.to_string(),
})?;
Height::new(rev_number, rev_height)
});

Check warning on line 262 in ibc-clients/cw-context/src/context/mod.rs

View check run for this annotation

Codecov / codecov/patch

ibc-clients/cw-context/src/context/mod.rs#L254-L262

Added lines #L254 - L262 were not covered by tests

for height_result in iterator {
let height = height_result?;

Check warning on line 265 in ibc-clients/cw-context/src/context/mod.rs

View check run for this annotation

Codecov / codecov/patch

ibc-clients/cw-context/src/context/mod.rs#L264-L265

Added lines #L264 - L265 were not covered by tests

metadata.push(GenesisMetadata {
key: iteration_key(height.revision_number(), height.revision_height()),
value: height.encode_vec(),
});

Check warning on line 270 in ibc-clients/cw-context/src/context/mod.rs

View check run for this annotation

Codecov / codecov/patch

ibc-clients/cw-context/src/context/mod.rs#L267-L270

Added lines #L267 - L270 were not covered by tests
}

Ok(Some(metadata))
Expand Down
7 changes: 5 additions & 2 deletions tests-integration/tests/cosmwasm/helper.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
use std::str::FromStr;

use cosmwasm_std::testing::{mock_env, mock_info};
use cosmwasm_std::testing::{message_info, mock_dependencies, mock_env};
use cosmwasm_std::{coins, Env, MessageInfo, Timestamp as CwTimestamp};
use ibc::clients::tendermint::types::ConsensusState;
use ibc::core::primitives::Timestamp as IbcTimestamp;
use tendermint::Hash;

pub fn dummy_msg_info() -> MessageInfo {
mock_info("creator", &coins(1000, "ibc"))
let deps = mock_dependencies();
let creator = deps.api.addr_make("creator");

message_info(&creator, &coins(1000, "ibc"))
}

pub fn dummy_checksum() -> Vec<u8> {
Expand Down
Loading