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

⬆ Bump cosmwasm 2.0.x #605

Merged
merged 10 commits into from
Aug 7, 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
611 changes: 550 additions & 61 deletions Cargo.lock

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ axone-objectarium = { path = "contracts/axone-objectarium", features = [
axone-objectarium-client = { path = "packages/axone-objectarium-client" }
axone-rdf = { path = "packages/axone-rdf" }
axone-wasm = { path = "packages/axone-wasm" }
cosmwasm-schema = "1.5.5"
cosmwasm-std = { version = "1.5.5", features = ["cosmwasm_1_2"] }
cosmwasm-schema = "2.1.1"
cosmwasm-std = { version = "2.1.1", features = ["cosmwasm_2_1"] }
cosmwasm-storage = "1.5.2"
cw-multi-test = "0.20.1"
cw-storage-plus = "1.2.0"
cw-utils = "1.0.3"
cw2 = "1.1.1"
cw-multi-test = "2.1.0"
cw-storage-plus = "2.0.0"
cw-utils = "2.0.0"
cw2 = "2.0.0"
iref = "3.1.3"
langtag = "0.3.4"
rdf-types = "0.18.2"
Expand All @@ -41,4 +41,5 @@ rio_xml = "0.8.4"
schemars = "0.8.21"
serde = { version = "1.0.204", default-features = false, features = ["derive"] }
serde-json-wasm = "1.0.1"
testing = { path = "packages/testing" }
thiserror = { version = "1.0.63" }
2 changes: 1 addition & 1 deletion Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ install_crate = { crate_name = "cargo-llvm-cov", min_version = "0.6.9" }
install_crate_args = ["--force"]

[tasks.install-cosmwasm-check]
install_crate = { crate_name = "cosmwasm-check", min_version = "1.5.3" }
install_crate = { crate_name = "cosmwasm-check", min_version = "2.1.1" }

[tasks.install-ffizer]
install_script = '''
Expand Down
3 changes: 1 addition & 2 deletions contracts/axone-cognitarium/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ cw-multi-test.workspace = true
futures = "0.3.30"
serde_json = "1.0.121"
serde_yaml = "0.9.34"
testing.workspace = true

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
# use library feature to disable all instantiate/execute/query exports
library = []

Expand Down
47 changes: 24 additions & 23 deletions contracts/axone-cognitarium/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ mod tests {
namespaces, triples, Namespace, Node, Object, StoreLimits, StoreStat, Subject, Triple,
};
use crate::{msg, state};
use cosmwasm_std::testing::{mock_dependencies, mock_env, mock_info};
use cosmwasm_std::testing::{message_info, mock_dependencies, mock_env};
use cosmwasm_std::{coins, from_json, Addr, Attribute, Order, Uint128};
use cw_utils::PaymentError;
use cw_utils::PaymentError::NonPayable;
Expand All @@ -452,6 +452,7 @@ mod tests {
use std::io::Read;
use std::path::Path;
use std::{env, u128};
use testing::addr::{addr, OWNER, SENDER};

#[test]
fn proper_initialization() {
Expand All @@ -469,7 +470,7 @@ mod tests {
},
};

let info = mock_info("owner", &[]);
let info = message_info(&addr(OWNER), &[]);
let res = instantiate(deps.as_mut(), mock_env(), info.clone(), msg).unwrap();
assert_eq!(0, res.messages.len());

Expand Down Expand Up @@ -507,7 +508,7 @@ mod tests {
fn funds_initialization() {
let mut deps = mock_dependencies();
let env = mock_env();
let info = mock_info("sender", &coins(10, "uaxone"));
let info = message_info(&addr(SENDER), &coins(10, "uaxone"));

let msg = InstantiateMsg::default();

Expand All @@ -520,7 +521,7 @@ mod tests {
fn execute_fail_with_funds() {
let mut deps = mock_dependencies();
let env = mock_env();
let info = mock_info("sender", &coins(10, "uaxone"));
let info = message_info(&addr("sender"), &coins(10, "uaxone"));

let messages = vec![
InsertData {
Expand Down Expand Up @@ -572,7 +573,7 @@ mod tests {
for case in cases {
let mut deps = mock_dependencies();

let info = mock_info("owner", &[]);
let info = message_info(&addr(OWNER), &[]);
instantiate(
deps.as_mut(),
mock_env(),
Expand Down Expand Up @@ -667,7 +668,7 @@ mod tests {
fn proper_insert_blank_nodes() {
let mut deps = mock_dependencies();

let info = mock_info("owner", &[]);
let info = message_info(&addr(OWNER), &[]);
instantiate(
deps.as_mut(),
mock_env(),
Expand Down Expand Up @@ -701,7 +702,7 @@ mod tests {
fn insert_existing_triples() {
let mut deps = mock_dependencies();

let info = mock_info("owner", &[]);
let info = message_info(&addr(OWNER), &[]);
instantiate(
deps.as_mut(),
mock_env(),
Expand Down Expand Up @@ -763,15 +764,15 @@ mod tests {
instantiate(
deps.as_mut(),
mock_env(),
mock_info("owner", &[]),
message_info(&addr(OWNER), &[]),
InstantiateMsg::default(),
)
.unwrap();

let res = execute(
deps.as_mut(),
mock_env(),
mock_info("not-owner", &[]),
message_info(&addr("not-owner"), &[]),
InsertData {
format: Some(DataFormat::RDFXml),
data: read_test_data("sample.rdf.xml"),
Expand Down Expand Up @@ -870,7 +871,7 @@ mod tests {
for case in cases {
let mut deps = mock_dependencies();

let info = mock_info("owner", &[]);
let info = message_info(&addr(OWNER), &[]);
instantiate(
deps.as_mut(),
mock_env(),
Expand Down Expand Up @@ -1086,7 +1087,7 @@ mod tests {
for case in cases {
let mut deps = mock_dependencies();

let info = mock_info("owner", &[]);
let info = message_info(&addr(OWNER), &[]);
instantiate(
deps.as_mut(),
mock_env(),
Expand Down Expand Up @@ -1196,7 +1197,7 @@ mod tests {
for case in cases {
let mut deps = mock_dependencies();

let info = mock_info("owner", &[]);
let info = message_info(&addr(OWNER), &[]);
instantiate(
deps.as_mut(),
mock_env(),
Expand Down Expand Up @@ -1230,7 +1231,7 @@ mod tests {
.save(
deps.as_mut().storage,
&Store {
owner: Addr::unchecked("owner"),
owner: Addr::unchecked(OWNER),
limits: StoreLimits {
max_triple_count: 1u128.into(),
max_byte_size: 2u128.into(),
Expand All @@ -1254,7 +1255,7 @@ mod tests {
assert_eq!(
from_json::<StoreResponse>(&res.unwrap()).unwrap(),
StoreResponse {
owner: "owner".to_string(),
owner: OWNER.to_string(),
limits: msg::StoreLimits {
max_triple_count: 1u128.into(),
max_byte_size: 2u128.into(),
Expand Down Expand Up @@ -1455,7 +1456,7 @@ mod tests {

let mut deps = mock_dependencies();

let info = mock_info("owner", &[]);
let info = message_info(&addr(OWNER), &[]);
instantiate(
deps.as_mut(),
mock_env(),
Expand Down Expand Up @@ -1676,7 +1677,7 @@ mod tests {

let mut deps = mock_dependencies();

let info = mock_info("owner", &[]);
let info = message_info(&addr(OWNER), &[]);
instantiate(
deps.as_mut(),
mock_env(),
Expand Down Expand Up @@ -1776,7 +1777,7 @@ mod tests {

let mut deps = mock_dependencies();

let info = mock_info("owner", &[]);
let info = message_info(&addr(OWNER), &[]);
instantiate(
deps.as_mut(),
mock_env(),
Expand Down Expand Up @@ -1928,7 +1929,7 @@ mod tests {

let mut deps = mock_dependencies();

let info = mock_info("owner", &[]);
let info = message_info(&addr(OWNER), &[]);
instantiate(
deps.as_mut(),
mock_env(),
Expand Down Expand Up @@ -1998,7 +1999,7 @@ mod tests {

let mut deps = mock_dependencies();

let info = mock_info("owner", &[]);
let info = message_info(&addr(OWNER), &[]);
instantiate(
deps.as_mut(),
mock_env(),
Expand Down Expand Up @@ -2063,7 +2064,7 @@ mod tests {

let mut deps = mock_dependencies();

let info = mock_info("owner", &[]);
let info = message_info(&addr(OWNER), &[]);
instantiate(
deps.as_mut(),
mock_env(),
Expand Down Expand Up @@ -2128,7 +2129,7 @@ mod tests {

let mut deps = mock_dependencies();

let info = mock_info("owner", &[]);
let info = message_info(&addr(OWNER), &[]);
instantiate(
deps.as_mut(),
mock_env(),
Expand Down Expand Up @@ -2197,7 +2198,7 @@ mod tests {

let mut deps = mock_dependencies();

let info = mock_info("owner", &[]);
let info = message_info(&addr(OWNER), &[]);
instantiate(
deps.as_mut(),
mock_env(),
Expand Down Expand Up @@ -2374,7 +2375,7 @@ mod tests {
for (data, q, expected) in cases {
let mut deps = mock_dependencies();

let info = mock_info("owner", &[]);
let info = message_info(&addr(OWNER), &[]);
instantiate(
deps.as_mut(),
mock_env(),
Expand Down
2 changes: 1 addition & 1 deletion contracts/axone-cognitarium/src/state/blank_nodes.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use cw_storage_plus::Item;

/// A counter serving as blank node unique identifier generator.
pub const BLANK_NODE_IDENTIFIER_COUNTER: Item<'_, u128> = Item::new("blank_node_key");
pub const BLANK_NODE_IDENTIFIER_COUNTER: Item<u128> = Item::new("blank_node_key");
4 changes: 2 additions & 2 deletions contracts/axone-cognitarium/src/state/namespaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::rc::Rc;

/// Store a key increment used a unique key for referencing a namespace. Given the size of an `u128`
/// there is no need to implement a garbage collector mechanism in case some namespaces are removed.
pub const NAMESPACE_KEY_INCREMENT: Item<'_, u128> = Item::new("namespace_key");
pub const NAMESPACE_KEY_INCREMENT: Item<u128> = Item::new("namespace_key");

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
pub struct Namespace {
Expand All @@ -32,7 +32,7 @@ impl IndexList<Namespace> for NamespaceIndexes<'_> {
}
}

pub fn namespaces<'a>() -> IndexedMap<'a, String, Namespace, NamespaceIndexes<'a>> {
pub fn namespaces<'a>() -> IndexedMap<String, Namespace, NamespaceIndexes<'a>> {
IndexedMap::new(
"NAMESPACE",
NamespaceIndexes {
Expand Down
2 changes: 1 addition & 1 deletion contracts/axone-cognitarium/src/state/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use cosmwasm_std::{Addr, Uint128};
use cw_storage_plus::Item;
use serde::{Deserialize, Serialize};

pub const STORE: Item<'_, Store> = Item::new("store");
pub const STORE: Item<Store> = Item::new("store");

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
pub struct Store {
Expand Down
2 changes: 1 addition & 1 deletion contracts/axone-cognitarium/src/state/triples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl IndexList<Triple> for TripleIndexes<'_> {
}
}

pub fn triples<'a>() -> IndexedMap<'a, TriplePK<'a>, Triple, TripleIndexes<'a>> {
pub fn triples<'a>() -> IndexedMap<TriplePK<'a>, Triple, TripleIndexes<'a>> {
IndexedMap::new(
"TRIPLE",
TripleIndexes {
Expand Down
5 changes: 3 additions & 2 deletions contracts/axone-cognitarium/tests/e2e/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use axone_cognitarium::ContractError;
use base64::engine::general_purpose;
use base64::Engine;
use cosmwasm_std::testing::{
mock_dependencies, mock_env, mock_info, MockApi, MockQuerier, MockStorage,
message_info, mock_dependencies, mock_env, MockApi, MockQuerier, MockStorage,
};
use cosmwasm_std::{MessageInfo, OwnedDeps, Response};
use cucumber::parser::{Basic, Error};
Expand All @@ -13,6 +13,7 @@ use serde_yaml::Value;
use std::fmt::Debug;
use std::path::Path;
use std::vec;
use testing::addr::addr;

#[derive(World)]
#[world(init = Self::new)]
Expand All @@ -26,7 +27,7 @@ impl SmartContractWorld {
fn new() -> Self {
SmartContractWorld {
deps: mock_dependencies(),
info: mock_info("owner", &[]),
info: message_info(&addr("owner"), &[]),
response: Ok(Response::new()),
}
}
Expand Down
3 changes: 1 addition & 2 deletions contracts/axone-dataverse/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ unsigned-varint = "0.8.0"
[dev-dependencies]
base64 = "0.22.1"
cw-multi-test.workspace = true
testing.workspace = true
url = "2.5.2"

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
# use library feature to disable all instantiate/execute/query exports
library = []
Loading
Loading