Skip to content

Commit

Permalink
Merge pull request #734 from CosmWasm/remove-untyped-msg
Browse files Browse the repository at this point in the history
Use standard CosmosMsg
  • Loading branch information
ethanfrey authored Jun 7, 2022
2 parents e360fed + aef5e80 commit 4485280
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 103 deletions.
11 changes: 6 additions & 5 deletions packages/multi-test/src/app.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use std::fmt::{self, Debug};
use std::marker::PhantomData;

use anyhow::bail;
use anyhow::Result as AnyResult;
use cosmwasm_std::testing::{mock_env, MockApi, MockStorage};
use cosmwasm_std::{
from_slice, to_binary, Addr, Api, Binary, BlockInfo, ContractResult, CustomQuery, Empty,
Querier, QuerierResult, QuerierWrapper, QueryRequest, Record, Storage, SystemError,
from_slice, to_binary, Addr, Api, Binary, BlockInfo, ContractResult, CosmosMsg, CustomQuery,
Empty, Querier, QuerierResult, QuerierWrapper, QueryRequest, Record, Storage, SystemError,
SystemResult,
};
use schemars::JsonSchema;
Expand All @@ -18,7 +19,6 @@ use crate::executor::{AppResponse, Executor};
use crate::module::{FailingModule, Module};
use crate::staking::{Distribution, FailingDistribution, FailingStaking, Staking, StakingSudo};
use crate::transactions::transactional;
use crate::untyped_msg::CosmosMsg;
use crate::wasm::{ContractData, Wasm, WasmKeeper, WasmSudo};

pub fn next_block(block: &mut BlockInfo) {
Expand Down Expand Up @@ -627,7 +627,7 @@ where

transactional(&mut *storage, |write_cache, _| {
msgs.into_iter()
.map(|msg| router.execute(&*api, write_cache, block, sender.clone(), msg.into()))
.map(|msg| router.execute(&*api, write_cache, block, sender.clone(), msg))
.collect()
})
}
Expand Down Expand Up @@ -799,6 +799,7 @@ where
CosmosMsg::Distribution(msg) => self
.distribution
.execute(api, storage, self, block, sender, msg),
_ => bail!("Cannot execute {:?}", msg),
}
}

Expand Down Expand Up @@ -1498,7 +1499,7 @@ mod test {
lucky_winner: winner.clone(),
runner_up: second.clone(),
});
app.execute(Addr::unchecked("anyone"), msg.into()).unwrap();
app.execute(Addr::unchecked("anyone"), msg).unwrap();

// see if coins were properly added
let big_win = app.wrap().query_balance(&winner, denom).unwrap();
Expand Down
1 change: 0 additions & 1 deletion packages/multi-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ mod module;
mod staking;
mod test_helpers;
mod transactions;
mod untyped_msg;
mod wasm;

pub use crate::app::{
Expand Down
95 changes: 0 additions & 95 deletions packages/multi-test/src/untyped_msg.rs

This file was deleted.

4 changes: 2 additions & 2 deletions packages/multi-test/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ where
amount: amount.to_vec(),
}
.into();
let res = router.execute(api, storage, block, sender.into(), msg.into())?;
let res = router.execute(api, storage, block, sender.into(), msg)?;
Ok(res)
} else {
Ok(AppResponse::default())
Expand Down Expand Up @@ -502,7 +502,7 @@ where

// execute in cache
let res = transactional(storage, |write_cache, _| {
router.execute(api, write_cache, block, contract.clone(), msg.into())
router.execute(api, write_cache, block, contract.clone(), msg)
});

// call reply if meaningful
Expand Down

0 comments on commit 4485280

Please sign in to comment.