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

migrations to unified for old tests #1851

Open
wants to merge 1 commit into
base: rc/v0.55
Choose a base branch
from
Open
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
6 changes: 1 addition & 5 deletions contracts/examples/multisig/tests/multisig_whitebox_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,11 +627,7 @@ fn test_deploy_and_upgrade_from_source() {
const ADDER_PATH_EXPR: MxscPath = MxscPath::new("mxsc:test-contracts/adder.mxsc.json");

world.register_contract(ADDER_PATH_EXPR, adder::ContractBuilder);
world.set_state_step(SetStateStep::new().new_address(
MULTISIG_ADDRESS.eval_to_expr().as_str(),
0,
NEW_ADDER_ADDRESS.eval_to_expr().as_str(),
));
world.new_address(MULTISIG_ADDRESS, 0, NEW_ADDER_ADDRESS);

world.account(ADDER_OWNER_ADDRESS).nonce(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ impl RewardsDistributionTestState {
.typed(mock_seed_nft_minter_proxy::MockSeedNftMinterProxy)
.init(NFT_TOKEN_ID)
.code(SEED_NFT_MINTER_PATH)
.new_address(SEED_NFT_MINTER_ADDRESS)
.run();

self.world
Expand Down Expand Up @@ -85,6 +86,7 @@ impl RewardsDistributionTestState {
.typed(rewards_distribution_proxy::RewardsDistributionProxy)
.init(SEED_NFT_MINTER_ADDRESS.to_address(), brackets)
.code(REWARDS_DISTRIBUTION_PATH)
.new_address(REWARDS_DISTRIBUTION_ADDRESS)
.run();

self
Expand Down Expand Up @@ -159,12 +161,6 @@ fn test_raffle_and_claim() {
}
}

state.world.set_state_step(
SetStateStep::new()
.new_address(OWNER_ADDRESS, 1, SEED_NFT_MINTER_ADDRESS)
.new_address(OWNER_ADDRESS, 3, REWARDS_DISTRIBUTION_ADDRESS),
);

state
.deploy_seed_nft_minter_contract()
.deploy_rewards_distribution_contract();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ fn setup() -> ScenarioWorld {
let mut world = world();
let code = world.code_expression(CODE_EXPR);

world.set_state_step(
SetStateStep::new()
.put_account(OWNER_ADDRESS, Account::new().nonce(1))
.put_account(SC_PMF, Account::new().code(code)),
);
world.account(OWNER_ADDRESS).nonce(1);
world.account(SC_PMF).code(code);

world
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use num_bigint::BigUint;
use scenario_tester::*;

const ADDER_PATH_EXPR: &str = "mxsc:output/adder.mxsc.json";
const ADDER: TestSCAddress = TestSCAddress::new("adder");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a backwards compatibility test. Do not change!


const OWNER: TestAddress = TestAddress::new("owner");
const CODE_EXPR: MxscPath = MxscPath::new("output/adder.mxsc.json");
Expand All @@ -21,16 +22,12 @@ fn world() -> ScenarioWorld {
#[test]
fn st_blackbox_legacy_proxy() {
let mut world = world();
let owner_address = "address:owner";
let mut st_contract = ContractInfo::<scenario_tester::Proxy<StaticApi>>::new("sc:adder");

world.start_trace();

world.set_state_step(
SetStateStep::new()
.put_account(owner_address, Account::new().nonce(1))
.new_address(owner_address, 1, "sc:adder"),
);
world.account(OWNER).nonce(1);
world.new_address(OWNER, 1, ADDER);

world
.tx()
Expand Down Expand Up @@ -68,7 +65,7 @@ fn st_blackbox_legacy_proxy() {

world.check_state_step(
CheckStateStep::new()
.put_account(owner_address, CheckAccount::new())
.put_account(OWNER, CheckAccount::new())
.put_account(
&st_contract,
CheckAccount::new().check_storage("str:sum", "8"),
Expand Down
Loading