Skip to content

Commit

Permalink
Upgrade MultiTest to version 0.20.1 (#410)
Browse files Browse the repository at this point in the history
* Fixed failing tests.

* Upgraded MultiTest to version 0.20.1

* Reformatted changed lines.

* Reverted fixing tests, they pass in 1.68.0 toolchain.
  • Loading branch information
DariuszDepta authored Mar 21, 2024
1 parent 514d833 commit 148930e
Show file tree
Hide file tree
Showing 20 changed files with 95 additions and 317 deletions.
356 changes: 65 additions & 291 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,3 @@ strip = true

[patch.'https://github.com/astroport-fi/astroport-core']
astroport = { path = "packages/astroport" }

[patch.crates-io]
cw-multi-test = { git = "https://github.com/astroport-fi/cw-multi-test.git", rev = "269a2c829d1ad25d67caa4600f72d2a21fb8fdeb" }
2 changes: 1 addition & 1 deletion contracts/factory/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ cosmwasm-schema = "1.1"
cw-utils = "1.0.1"

[dev-dependencies]
cw-multi-test = "0.15"
cw-multi-test = "0.20.1"
astroport-token = { path = "../token" }
astroport-pair = { path = "../pair" }
cw20 = "0.15"
Expand Down
2 changes: 1 addition & 1 deletion contracts/pair_astro_xastro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ cosmwasm-schema = "1.1"
[dev-dependencies]
astroport-token = { path = "../token" }
astroport-factory = { path = "../factory" }
cw-multi-test = "0.15"
cw-multi-test = "0.20.1"
astroport-staking = { path = "../tokenomics/staking" }
astroport-xastro-token = { path = "../tokenomics/xastro_token" }
4 changes: 2 additions & 2 deletions contracts/pair_transmuter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ itertools = "0.12.0"
anyhow = "1"
derivative = "2"
astroport-token = { path = "../token" }
cw-multi-test = "0.20.0"
cw-multi-test = "0.20.1"
astroport-factory = { path = "../factory" }
astroport-native-coin-registry = { path = "../periphery/native_coin_registry", version = "1" }
astroport-native-coin-registry = { path = "../periphery/native_coin_registry", version = "1" }
2 changes: 1 addition & 1 deletion contracts/periphery/fee_granter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ thiserror = "1"
cw2 = "1.0.1"

[dev-dependencies]
cw-multi-test = { version="0.16.4", features=["stargate"] }
cw-multi-test = "0.20.1"
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ fn test_update_admins() {
assert!(
err.root_cause()
.to_string()
.contains("Cannot execute Stargate"),
.contains("Unexpected stargate message"),
"{err}"
);

Expand Down
2 changes: 1 addition & 1 deletion contracts/periphery/liquidity_manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ astroport-pair-stable = { path = "../../pair_stable", features = ["library"], ve
astroport-factory = { path = "../../factory", features = ["library"], version = "1" }

[dev-dependencies]
cw-multi-test = "0.16.4"
cw-multi-test = "0.20.1"
astroport-token = { path = "../../token" }
astroport-native-coin-registry = { path = "../../periphery/native_coin_registry" }
astroport-generator = { path = "../../tokenomics/generator" }
Expand Down
2 changes: 1 addition & 1 deletion contracts/periphery/native-coin-wrapper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ thiserror = { version = "1.0" }
astroport = { path = "../../../packages/astroport", version = "3" }

[dev-dependencies]
cw-multi-test = "0.15"
cw-multi-test = "0.20.1"
astroport-token = { path = "../../token" }
2 changes: 1 addition & 1 deletion contracts/periphery/native_coin_registry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ thiserror = { version = "1.0" }
astroport = { path = "../../../packages/astroport", version = "3" }

[dev-dependencies]
cw-multi-test = "0.15"
cw-multi-test = "0.20.1"
2 changes: 1 addition & 1 deletion contracts/periphery/oracle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ astroport-token = { path = "../../token" }
astroport-factory = { path = "../../factory" }
astroport-pair = { path = "../../pair" }
astroport-pair-stable = { path = "../../pair_stable" }
cw-multi-test = "0.15"
cw-multi-test = "0.20.1"
itertools = "0.10"
anyhow = "1.0"
astroport-native-coin-registry = { path = "../../periphery/native_coin_registry" }
2 changes: 1 addition & 1 deletion contracts/router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ astroport-factory = { path = "../factory" }
astroport-token = { path = "../token" }
astroport-pair = { path = "../pair" }
anyhow = "1.0"
cw-multi-test = "0.15"
cw-multi-test = "0.20.1"
2 changes: 1 addition & 1 deletion contracts/tokenomics/incentives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ thiserror = "1"
itertools = "0.11"

[dev-dependencies]
cw-multi-test = { git = "https://github.com/astroport-fi/cw-multi-test", branch = "astroport_cozy_fork" }
cw-multi-test = "0.20.1"
anyhow = "1"
astroport-factory = { path = "../../factory" }
astroport-pair = { path = "../../pair" }
Expand Down
17 changes: 12 additions & 5 deletions contracts/tokenomics/incentives/tests/helper/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,24 @@ impl TestAddr {
}

impl AddressGenerator for TestAddr {
fn next_address(&self, storage: &mut dyn Storage) -> Addr {
fn contract_address(
&self,
_api: &dyn Api,
storage: &mut dyn Storage,
_code_id: u64,
_instance_id: u64,
) -> AnyResult<Addr> {
let count = if let Some(next) = storage.get(Self::COUNT_KEY) {
u64::from_be_bytes(next.as_slice().try_into().unwrap()) + 1
} else {
1u64
};
storage.set(Self::COUNT_KEY, &count.to_be_bytes());

Addr::unchecked(format!("{}_contract{count}", Self::ADDR_PREFIX))
Ok(Addr::unchecked(format!(
"{}_contract{count}",
Self::ADDR_PREFIX
)))
}
}

Expand Down Expand Up @@ -229,9 +238,7 @@ pub struct Helper {
impl Helper {
pub fn new(owner: &str, astro: &AssetInfo) -> AnyResult<Self> {
let mut app = AppBuilder::new()
.with_wasm::<FailingModule<_, _, Empty>, WasmKeeper<_, _>>(
WasmKeeper::new_with_custom_address_generator(TestAddr),
)
.with_wasm(WasmKeeper::new().with_address_generator(TestAddr))
.with_api(TestApi::new())
.with_block(BlockInfo {
height: 1,
Expand Down
2 changes: 1 addition & 1 deletion contracts/tokenomics/maker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ astro-satellite-package = { git = "https://github.com/astroport-fi/astroport_ibc
astroport-token = { path = "../../token" }
astroport-factory = { path = "../../factory" }
astroport-pair = { path = "../../pair" }
cw-multi-test = "0.15"
cw-multi-test = "0.20.1"
astroport-pair-stable = { path = "../../pair_stable" }
astroport-governance = { git = "https://github.com/astroport-fi/astroport-governance" }
astroport-escrow-fee-distributor = { git = "https://github.com/astroport-fi/astroport-governance" }
Expand Down
2 changes: 1 addition & 1 deletion contracts/tokenomics/staking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ cw-utils = "1.0.1"
[dev-dependencies]
astroport-token = { path = "../../token" }
astroport-xastro-token = { path = "../../tokenomics/xastro_token" }
cw-multi-test = "0.15"
cw-multi-test = "0.20.1"
2 changes: 1 addition & 1 deletion contracts/tokenomics/vesting/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ cw-utils = "0.15"
cosmwasm-schema = { version = "1.1", default-features = false }

[dev-dependencies]
cw-multi-test = "0.15"
cw-multi-test = "0.20.1"
astroport-token = { path = "../../token" }
2 changes: 1 addition & 1 deletion contracts/tokenomics/xastro_outpost_token/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ snafu = { version = "0.6" }
cosmwasm-schema = "1.1"

[dev-dependencies]
cw-multi-test = "0.15"
cw-multi-test = "0.20.1"
2 changes: 1 addition & 1 deletion contracts/tokenomics/xastro_token/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ snafu = { version = "0.6" }
cosmwasm-schema = "1.1"

[dev-dependencies]
cw-multi-test = "0.15"
cw-multi-test = "0.20.1"
2 changes: 1 addition & 1 deletion packages/astroport_mocks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ astroport-whitelist = { path = "../../contracts/whitelist" }
astroport-xastro-token = { path = "../../contracts/tokenomics/xastro_token" }
cosmwasm-schema = "1.2.5"
cosmwasm-std = "1.2.5"
cw-multi-test = { git = "https://github.com/astroport-fi/cw-multi-test.git", rev = "269a2c829d1ad25d67caa4600f72d2a21fb8fdeb" }
cw-multi-test = "0.20.1"
injective-cosmwasm = "0.2"
schemars = "0.8.1"
serde = "1.0"
Expand Down

0 comments on commit 148930e

Please sign in to comment.