forked from lthn/blockchain
coretests: hard_fork_2_no_new_structures_before_hf added
This commit is contained in:
parent
c1e3b80191
commit
4271875709
3 changed files with 99 additions and 2 deletions
|
|
@ -712,7 +712,7 @@ int main(int argc, char* argv[])
|
|||
run_single_test = command_line::get_arg(g_vm, arg_run_single_test);
|
||||
}
|
||||
|
||||
if (run_single_test.empty())
|
||||
/*if (run_single_test.empty())
|
||||
{
|
||||
CALL_TEST("Random text test", get_random_text_test);
|
||||
CALL_TEST("Random state manipulation test", random_state_manupulation_test);
|
||||
|
|
@ -721,7 +721,7 @@ int main(int argc, char* argv[])
|
|||
CALL_TEST("check_allowed_types_in_variant_container() test", check_allowed_types_in_variant_container_test);
|
||||
CALL_TEST("check_u8_str_case_funcs", check_u8_str_case_funcs);
|
||||
CALL_TEST("chec_u8_str_matching", chec_u8_str_matching);
|
||||
}
|
||||
}*/
|
||||
|
||||
//CALL_TEST("check_hash_and_difficulty_monte_carlo_test", check_hash_and_difficulty_monte_carlo_test); // it's rather an experiment with unclean results than a solid test, for further research...
|
||||
std::set<std::string> postponed_tests;
|
||||
|
|
@ -741,6 +741,9 @@ int main(int argc, char* argv[])
|
|||
|
||||
#undef MARK_TEST_AS_POSTPONED
|
||||
|
||||
GENERATE_AND_PLAY(hard_fork_2_no_new_structures_before_hf);
|
||||
|
||||
/*
|
||||
GENERATE_AND_PLAY(pos_minting_tx_packing);
|
||||
|
||||
GENERATE_AND_PLAY(multisig_wallet_test);
|
||||
|
|
@ -1004,6 +1007,7 @@ int main(int argc, char* argv[])
|
|||
GENERATE_AND_PLAY(hard_fork_2_tx_receiver_in_wallet);
|
||||
GENERATE_AND_PLAY(hard_fork_2_tx_extra_alias_entry_in_wallet);
|
||||
GENERATE_AND_PLAY(hard_fork_2_auditable_addresses_basics);
|
||||
GENERATE_AND_PLAY(hard_fork_2_no_new_structures_before_hf);
|
||||
|
||||
|
||||
// GENERATE_AND_PLAY(gen_block_reward);
|
||||
|
|
|
|||
|
|
@ -505,3 +505,89 @@ bool hard_fork_2_auditable_addresses_basics::c1(currency::core& c, size_t ev_ind
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
hard_fork_2_no_new_structures_before_hf::hard_fork_2_no_new_structures_before_hf()
|
||||
: hard_fork_2_base_test(13)
|
||||
{
|
||||
}
|
||||
|
||||
bool hard_fork_2_no_new_structures_before_hf::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
m_accounts.resize(TOTAL_ACCS_COUNT);
|
||||
account_base& miner_acc = m_accounts[MINER_ACC_IDX]; miner_acc.generate();
|
||||
account_base& alice_acc = m_accounts[ALICE_ACC_IDX]; alice_acc.generate();
|
||||
|
||||
MAKE_GENESIS_BLOCK(events, blk_0, miner_acc, test_core_time::get_time());
|
||||
generator.set_hardfork_height(1, m_hardfork_height);
|
||||
generator.set_hardfork_height(2, m_hardfork_height);
|
||||
DO_CALLBACK(events, "configure_core");
|
||||
REWIND_BLOCKS_N(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
std::vector<currency::extra_v> extra;
|
||||
|
||||
// extra with tx_payer -- not allowed before HF2
|
||||
tx_payer payer = AUTO_VAL_INIT(payer);
|
||||
payer.acc_addr = miner_acc.get_public_address();
|
||||
extra.push_back(payer);
|
||||
MAKE_TX_MIX_ATTR_EXTRA(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(1), 0, blk_0r, 0, extra, true);
|
||||
|
||||
// blk_1b_1 is invalid as containing tx_0
|
||||
DO_CALLBACK(events, "mark_invalid_block");
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1b_1, blk_0r, miner_acc, tx_0);
|
||||
|
||||
|
||||
// extra with tx_receiver -- not allowed before HF2
|
||||
extra.clear();
|
||||
tx_receiver receiver = AUTO_VAL_INIT(receiver);
|
||||
receiver.acc_addr = miner_acc.get_public_address();
|
||||
extra.push_back(receiver);
|
||||
MAKE_TX_MIX_ATTR_EXTRA(events, tx_1, miner_acc, alice_acc, MK_TEST_COINS(1), 0, blk_0r, 0, extra, true);
|
||||
|
||||
// blk_1b_2 is invalid as containing tx_1
|
||||
DO_CALLBACK(events, "mark_invalid_block");
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1b_2, blk_1b_1, miner_acc, tx_1);
|
||||
|
||||
|
||||
// extra with tx_receiver -- not allowed before HF2
|
||||
extra.clear();
|
||||
|
||||
extra_alias_entry alias_entry = AUTO_VAL_INIT(alias_entry);
|
||||
alias_entry.m_address = miner_acc.get_public_address();
|
||||
alias_entry.m_alias = "aabbcc";
|
||||
extra.push_back(alias_entry);
|
||||
|
||||
std::list<transaction> tx_set;
|
||||
bool r = put_alias_via_tx_to_list(events, tx_set, blk_0r, miner_acc, alias_entry, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
transaction tx_2 = tx_set.front();
|
||||
|
||||
// blk_1b_3 is invalid as containing tx_2
|
||||
DO_CALLBACK(events, "mark_invalid_block");
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1b_3, blk_1b_2, miner_acc, tx_2);
|
||||
|
||||
// activate HF2
|
||||
MAKE_NEXT_BLOCK(events, blk_1, blk_0r, miner_acc);
|
||||
MAKE_NEXT_BLOCK(events, blk_2, blk_1, miner_acc);
|
||||
MAKE_NEXT_BLOCK(events, blk_3, blk_2, miner_acc);
|
||||
MAKE_NEXT_BLOCK(events, blk_4, blk_3, miner_acc);
|
||||
|
||||
|
||||
// tx_0 with tx_payer should be accepted after HF2
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_5, blk_4, miner_acc, tx_0);
|
||||
|
||||
// tx_1 with tx_receiver should be accepted after HF2
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_6, blk_5, miner_acc, tx_1);
|
||||
|
||||
// tx_2 with extra_alias_entry should be accepted after HF2
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_7, blk_6, miner_acc, tx_2);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool hard_fork_2_no_new_structures_before_hf::c1(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,3 +43,10 @@ struct hard_fork_2_auditable_addresses_basics : public wallet_test, public hard_
|
|||
bool generate(std::vector<test_event_entry>& events) const;
|
||||
bool c1(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
|
||||
};
|
||||
|
||||
struct hard_fork_2_no_new_structures_before_hf : public wallet_test, public hard_fork_2_base_test
|
||||
{
|
||||
hard_fork_2_no_new_structures_before_hf();
|
||||
bool generate(std::vector<test_event_entry>& events) const;
|
||||
bool c1(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue