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

build(deps): bump cosmwasm-std from 1.4.1 to 1.5.0 #408

Merged
merged 2 commits into from
Nov 15, 2023
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
27 changes: 21 additions & 6 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["contracts/*", "packages/*"]

[workspace.dependencies]
cosmwasm-schema = "1.5.0"
cosmwasm-std = "1.4.1"
cosmwasm-std = "1.5.0"
cosmwasm-storage = "1.4.1"
cw-multi-test = "0.15.1"
cw-storage-plus = "1.2.0"
Expand Down
28 changes: 14 additions & 14 deletions contracts/okp4-cognitarium/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[cfg(not(feature = "library"))]
use cosmwasm_std::entry_point;
use cosmwasm_std::{
to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdError, StdResult,
to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdError, StdResult,
};
use cw2::set_contract_version;

Expand Down Expand Up @@ -123,12 +123,12 @@ pub mod execute {
#[cfg_attr(not(feature = "library"), entry_point)]
pub fn query(deps: Deps<'_>, _env: Env, msg: QueryMsg) -> StdResult<Binary> {
match msg {
QueryMsg::Store => to_binary(&query::store(deps)?),
QueryMsg::Select { query } => to_binary(&query::select(deps, query)?),
QueryMsg::Store => to_json_binary(&query::store(deps)?),
QueryMsg::Select { query } => to_json_binary(&query::select(deps, query)?),
QueryMsg::Describe { query, format } => {
to_binary(&query::describe(deps, query, format.unwrap_or_default())?)
to_json_binary(&query::describe(deps, query, format.unwrap_or_default())?)
}
QueryMsg::Construct { query, format } => to_binary(&query::construct(
QueryMsg::Construct { query, format } => to_json_binary(&query::construct(
deps,
query,
format.unwrap_or(DataFormat::default()),
Expand Down Expand Up @@ -390,7 +390,7 @@ mod tests {
};
use crate::{msg, state};
use cosmwasm_std::testing::{mock_dependencies, mock_env, mock_info};
use cosmwasm_std::{from_binary, Addr, Attribute, Order, Uint128};
use cosmwasm_std::{from_json, Addr, Attribute, Order, Uint128};
use std::collections::BTreeMap;
use std::fs::File;
use std::io::Read;
Expand Down Expand Up @@ -1118,7 +1118,7 @@ mod tests {
let res = query(deps.as_ref(), mock_env(), QueryMsg::Store);
assert!(res.is_ok());
assert_eq!(
from_binary::<StoreResponse>(&res.unwrap()).unwrap(),
from_json::<StoreResponse>(&res.unwrap()).unwrap(),
StoreResponse {
owner: "owner".to_string(),
limits: msg::StoreLimits {
Expand Down Expand Up @@ -1345,7 +1345,7 @@ mod tests {
let res = query(deps.as_ref(), mock_env(), QueryMsg::Select { query: q });
assert!(res.is_ok());

let result = from_binary::<SelectResponse>(&res.unwrap()).unwrap();
let result = from_json::<SelectResponse>(&res.unwrap()).unwrap();
assert_eq!(result, expected);
}
}
Expand Down Expand Up @@ -1598,7 +1598,7 @@ mod tests {

assert!(res.is_ok());

let result = from_binary::<DescribeResponse>(&res.unwrap()).unwrap();
let result = from_json::<DescribeResponse>(&res.unwrap()).unwrap();

assert_eq!(result.format, expected.format);
assert_eq!(
Expand Down Expand Up @@ -1668,7 +1668,7 @@ mod tests {

assert!(res.is_ok());

let result = from_binary::<DescribeResponse>(&res.unwrap()).unwrap();
let result = from_json::<DescribeResponse>(&res.unwrap()).unwrap();

assert_eq!(result.format, expected.format);
assert_eq!(
Expand Down Expand Up @@ -1733,7 +1733,7 @@ mod tests {

assert!(res.is_ok());

let result = from_binary::<DescribeResponse>(&res.unwrap()).unwrap();
let result = from_json::<DescribeResponse>(&res.unwrap()).unwrap();

assert_eq!(result.format, expected.format);
assert_eq!(
Expand Down Expand Up @@ -1798,7 +1798,7 @@ mod tests {

assert!(res.is_ok());

let result = from_binary::<DescribeResponse>(&res.unwrap()).unwrap();
let result = from_json::<DescribeResponse>(&res.unwrap()).unwrap();

assert_eq!(result.format, expected.format);
assert_eq!(
Expand Down Expand Up @@ -1867,7 +1867,7 @@ mod tests {

assert!(res.is_ok());

let result = from_binary::<DescribeResponse>(&res.unwrap()).unwrap();
let result = from_json::<DescribeResponse>(&res.unwrap()).unwrap();

assert_eq!(result.format, expected.format);
assert_eq!(
Expand Down Expand Up @@ -1963,7 +1963,7 @@ mod tests {

assert!(res.is_ok());

let result = from_binary::<DescribeResponse>(&res.unwrap()).unwrap();
let result = from_json::<DescribeResponse>(&res.unwrap()).unwrap();

assert_eq!(result.format, expected.format);
assert_eq!(
Expand Down
54 changes: 27 additions & 27 deletions contracts/okp4-law-stone/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[cfg(not(feature = "library"))]
use cosmwasm_std::entry_point;
use cosmwasm_std::{
to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdError, StdResult,
to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdError, StdResult,
SubMsg, WasmMsg,
};
use cw2::set_contract_version;
Expand Down Expand Up @@ -38,7 +38,7 @@ pub fn instantiate(

let store_program_msg = WasmMsg::Execute {
contract_addr: msg.storage_address.clone(),
msg: to_binary(&store_msg)?,
msg: to_json_binary(&store_msg)?,
funds: vec![],
};

Expand Down Expand Up @@ -121,9 +121,9 @@ pub mod execute {
#[cfg_attr(not(feature = "library"), entry_point)]
pub fn query(deps: Deps<'_, LogicCustomQuery>, _env: Env, msg: QueryMsg) -> StdResult<Binary> {
match msg {
QueryMsg::Ask { query } => to_binary(&query::ask(deps, query)?),
QueryMsg::Program => to_binary(&query::program(deps)?),
QueryMsg::ProgramCode => to_binary(&query::program_code(deps)?),
QueryMsg::Ask { query } => to_json_binary(&query::ask(deps, query)?),
QueryMsg::Program => to_json_binary(&query::program(deps)?),
QueryMsg::ProgramCode => to_json_binary(&query::program_code(deps)?),
}
}

Expand Down Expand Up @@ -266,7 +266,7 @@ mod tests {
mock_dependencies, mock_env, mock_info, MockQuerierCustomHandlerResult,
};
use cosmwasm_std::{
from_binary, to_binary, ContractInfoResponse, ContractResult, CosmosMsg, Event, Order,
from_json, to_json_binary, ContractInfoResponse, ContractResult, CosmosMsg, Event, Order,
SubMsgResponse, SubMsgResult, SystemError, SystemResult, WasmQuery,
};
use okp4_logic_bindings::testing::mock::mock_dependencies_with_logic_handler;
Expand Down Expand Up @@ -295,7 +295,7 @@ mod tests {
if *query == exp_query && *program == exp_program =>
{
SystemResult::Ok(
to_binary(&AskResponse {
to_json_binary(&AskResponse {
height: 1,
gas_used: 1000,
answer: Some(Answer {
Expand Down Expand Up @@ -327,7 +327,7 @@ mod tests {
fn proper_initialization() {
let mut deps =
mock_dependencies_with_logic_handler(|_| SystemResult::Err(SystemError::Unknown {}));
let program = to_binary("foo(_) :- true.").unwrap();
let program = to_json_binary("foo(_) :- true.").unwrap();

let msg = InstantiateMsg {
program: program.clone(),
Expand All @@ -345,7 +345,7 @@ mod tests {
match &sub_msg.msg {
CosmosMsg::Wasm(wasm_msg) => match wasm_msg {
WasmMsg::Execute { msg, .. } => {
let result: StorageMsg = from_binary(msg).unwrap();
let result: StorageMsg = from_json(msg).unwrap();
match result {
StorageMsg::StoreObject {
data,
Expand Down Expand Up @@ -392,7 +392,7 @@ mod tests {
.unwrap();

let res = query(deps.as_ref(), mock_env(), QueryMsg::Program {}).unwrap();
let result: ProgramResponse = from_binary(&res).unwrap();
let result: ProgramResponse = from_json(&res).unwrap();

assert_eq!(object_id, result.object_id);
assert_eq!(storage_addr, result.storage_address);
Expand All @@ -408,14 +408,14 @@ mod tests {
mock_dependencies_with_logic_handler(|_| SystemResult::Err(SystemError::Unknown {}));
deps.querier.update_wasm(move |query| match query {
WasmQuery::Smart { contract_addr, msg } if contract_addr == CONTRACT_ID => {
let data = to_binary(&A_PROGRAM).unwrap();
let storage_query: StorageQuery = from_binary(msg).unwrap();
let data = to_json_binary(&A_PROGRAM).unwrap();
let storage_query: StorageQuery = from_json(msg).unwrap();

assert!(
matches!(storage_query, StorageQuery::ObjectData { id } if id == OBJECT_ID)
);

SystemResult::Ok(ContractResult::Ok(to_binary(&data).unwrap()))
SystemResult::Ok(ContractResult::Ok(to_json_binary(&data).unwrap()))
}
_ => {
panic!("UnsupportedRequest: query_wasm");
Expand All @@ -436,8 +436,8 @@ mod tests {
.unwrap();

let result = query(deps.as_ref(), mock_env(), QueryMsg::ProgramCode {}).unwrap();
let data: Binary = from_binary(&result).unwrap();
let program: String = from_binary(&data).unwrap();
let data: Binary = from_json(&result).unwrap();
let program: String = from_json(&data).unwrap();

assert_eq!(A_PROGRAM, program);
}
Expand All @@ -457,7 +457,7 @@ mod tests {
program,
query: queryy,
} if *queryy == exp_query && *program == exp_program => SystemResult::Ok(
to_binary(&AskResponse {
to_json_binary(&AskResponse {
height: 1,
gas_used: 1000,
answer: Some(Answer {
Expand Down Expand Up @@ -547,7 +547,7 @@ mod tests {

match res {
Ok(result) => {
let result: AskResponse = from_binary(&result).unwrap();
let result: AskResponse = from_json(&result).unwrap();

assert!(case.3.is_some());
assert!(result.answer.is_some());
Expand Down Expand Up @@ -696,7 +696,7 @@ mod tests {
match &sub_msg.msg {
CosmosMsg::Wasm(wasm_msg) => match wasm_msg {
WasmMsg::Execute { msg, .. } => {
let result: StorageMsg = from_binary(msg).unwrap();
let result: StorageMsg = from_json(msg).unwrap();
match result {
StorageMsg::PinObject { id } => Some(id),
_ => panic!("should contains only PinObject message(s)"),
Expand Down Expand Up @@ -798,16 +798,16 @@ mod tests {
WasmQuery::ContractInfo { .. } => {
let mut contract_info = ContractInfoResponse::default();
contract_info.admin = Some("creator".to_string());
SystemResult::Ok(ContractResult::Ok(to_binary(&contract_info).unwrap()))
SystemResult::Ok(ContractResult::Ok(to_json_binary(&contract_info).unwrap()))
}
WasmQuery::Smart { contract_addr, msg } if contract_addr == "okp4-objectarium1" => {
match from_binary(msg) {
match from_json(msg) {
Ok(StorageQuery::ObjectPins {
id,
first: Some(1u32),
after: None,
}) if id == "program-id" => SystemResult::Ok(ContractResult::Ok(
to_binary(&ObjectPinsResponse {
to_json_binary(&ObjectPinsResponse {
data: vec!["creator".to_string()],
page_info: PageInfo {
has_next_page: case.0 > 1,
Expand Down Expand Up @@ -863,14 +863,14 @@ mod tests {
}) => {
assert_eq!(contract_addr, "okp4-objectarium1".to_string());
if case.0 > 1 {
match from_binary(&msg) {
match from_json(&msg) {
Ok(StorageMsg::UnpinObject { id }) => {
assert_eq!(id, "program-id".to_string());
}
_ => panic!("storage message should be a UnpinObject message"),
}
} else {
match from_binary(&msg) {
match from_json(&msg) {
Ok(StorageMsg::ForgetObject { id }) => {
assert_eq!(id, "program-id".to_string());
}
Expand All @@ -892,7 +892,7 @@ mod tests {
contract_addr, msg, ..
}) => {
assert_eq!(contract_addr, dep.storage_address);
match from_binary(&msg) {
match from_json(&msg) {
Ok(StorageMsg::UnpinObject { id }) => {
assert_eq!(id, dep.object_id);
}
Expand Down Expand Up @@ -935,10 +935,10 @@ mod tests {
true => Some("admin".to_string()),
false => None,
};
SystemResult::Ok(ContractResult::Ok(to_binary(&contract_info).unwrap()))
SystemResult::Ok(ContractResult::Ok(to_json_binary(&contract_info).unwrap()))
}
WasmQuery::Smart { .. } => SystemResult::Ok(ContractResult::Ok(
to_binary(&ObjectPinsResponse {
to_json_binary(&ObjectPinsResponse {
data: vec!["creator".to_string()],
page_info: PageInfo {
has_next_page: false,
Expand Down Expand Up @@ -987,7 +987,7 @@ mod tests {
WasmQuery::ContractInfo { .. } => {
let mut contract_info = ContractInfoResponse::default();
contract_info.admin = Some("creator".to_string());
SystemResult::Ok(ContractResult::Ok(to_binary(&contract_info).unwrap()))
SystemResult::Ok(ContractResult::Ok(to_json_binary(&contract_info).unwrap()))
}
_ => SystemResult::Err(SystemError::Unknown {}),
});
Expand Down
Loading
Loading