compilation of core tests fixed

This commit is contained in:
cryptozoidberg 2022-05-12 18:22:53 +02:00
parent 186e1fdcf9
commit ce4b04014b
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
5 changed files with 13 additions and 12 deletions

View file

@ -41,7 +41,7 @@ struct ev_visitor : public boost::static_visitor<bool>
};
bool prun_ring_signatures::generate_blockchain_with_pruned_rs(std::vector<test_event_entry>& events)
bool prun_ring_signatures::generate_blockchain_with_pruned_rs(std::vector<test_event_entry>& events)const
{
uint64_t ts_start = 1338224400;
GENERATE_ACCOUNT(miner_account);

View file

@ -17,7 +17,7 @@ public:
bool set_check_points(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
bool check_blockchain(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
bool generate_blockchain_with_pruned_rs(std::vector<test_event_entry>& events);
bool generate_blockchain_with_pruned_rs(std::vector<test_event_entry>& events) const;
private:
};

View file

@ -17,6 +17,7 @@ using namespace currency;
bool test_transaction_generation_and_ring_signature()
{
currency::hard_forks_descriptor hf = AUTO_VAL_INIT(hf);
account_base miner_acc1;
miner_acc1.generate();
@ -98,7 +99,7 @@ bool test_transaction_generation_and_ring_signature()
transaction tx_rc1;
std::vector<currency::attachment_v> attachments;
bool r = construct_tx(miner_acc2.get_keys(), sources, destinations, attachments, tx_rc1, 0);
bool r = construct_tx(miner_acc2.get_keys(), sources, destinations, attachments, tx_rc1, get_tx_version(0, hf), 0);
CHECK_AND_ASSERT_MES(r, false, "failed to construct transaction");
crypto::hash pref_hash = get_transaction_prefix_hash(tx_rc1);

View file

@ -1221,7 +1221,7 @@ bool tx_expiration_time::generate(std::vector<test_event_entry>& events) const
r = fill_tx_sources_and_destinations(events, blk_2, alice_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(1), TESTS_DEFAULT_FEE, 0, sources, destinations);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction tx_2 = AUTO_VAL_INIT(tx_2);
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_2, 0);
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_2, get_tx_version_from_events(events), 0);
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
set_tx_expiration_time(tx_2, ts_median + TX_EXPIRATION_MEDIAN_SHIFT + 1); // one second greather than minimum allowed
r = resign_tx(alice_acc.get_keys(), sources, tx_2);
@ -1239,7 +1239,7 @@ bool tx_expiration_time::generate(std::vector<test_event_entry>& events) const
r = fill_tx_sources_and_destinations(events, blk_3, alice_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(1), TESTS_DEFAULT_FEE, 0, sources, destinations);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction tx_3 = AUTO_VAL_INIT(tx_3);
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_3, 0);
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_3, get_tx_version_from_events(events), 0);
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
set_tx_expiration_time(tx_3, ts_median + TX_EXPIRATION_MEDIAN_SHIFT + 0); // exact expiration time, should not pass (see core condition above)
r = resign_tx(alice_acc.get_keys(), sources, tx_3);
@ -1304,7 +1304,7 @@ bool tx_expiration_time_and_block_template::generate(std::vector<test_event_entr
bool r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), miner_acc.get_public_address(), MK_TEST_COINS(1), TESTS_DEFAULT_FEE, 0, sources, destinations);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction tx_1 = AUTO_VAL_INIT(tx_1);
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_from_events(events), 0);
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
uint64_t tx_1_expiration_time = ts_median + TX_EXPIRATION_MEDIAN_SHIFT + 1; // one second greather than minimum allowed
set_tx_expiration_time(tx_1, tx_1_expiration_time);
@ -1376,7 +1376,7 @@ bool tx_expiration_time_and_chain_switching::generate(std::vector<test_event_ent
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), miner_acc.get_public_address(), MK_TEST_COINS(1), TESTS_DEFAULT_FEE, 0, sources, destinations);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction tx_0 = AUTO_VAL_INIT(tx_0);
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, 0);
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_from_events(events), 0);
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
uint64_t tx_0_expiration_time = ts_median + TX_EXPIRATION_MEDIAN_SHIFT + 0; // one second less than minimum allowed (see condition above)
set_tx_expiration_time(tx_0, tx_0_expiration_time);
@ -1497,7 +1497,7 @@ bool tx_key_image_pool_conflict::generate(std::vector<test_event_entry>& events)
r = fill_tx_sources_and_destinations(events, blk_0r, m_miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(1), TESTS_DEFAULT_FEE, 0, sources, destinations);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction tx_0 = AUTO_VAL_INIT(tx_0);
r = construct_tx(m_miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, 0);
r = construct_tx(m_miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_from_events(events), 0);
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
LOG_PRINT_YELLOW("tx_0 = " << get_transaction_hash(tx_0), LOG_LEVEL_0);
// do not push tx_0 into events yet

View file

@ -2208,7 +2208,7 @@ bool gen_wallet_offers_size_limit::generate(std::vector<test_event_entry>& event
}
// generates such an offer so that result tx will most like have its size within the giving limits
bool generate_oversized_offer(size_t min_size, size_t max_size, bc_services::offer_details_ex& result)
bool generate_oversized_offer(size_t min_size, size_t max_size, bc_services::offer_details_ex& result, uint64_t tx_version)
{
bc_services::offer_details_ex r = AUTO_VAL_INIT(r);
result = r;
@ -2226,7 +2226,7 @@ bool generate_oversized_offer(size_t min_size, size_t max_size, bc_services::off
// construct fake tx to estimate it's size
transaction tx = AUTO_VAL_INIT(tx);
crypto::secret_key one_time_secret_key;
if (!construct_tx(account_keys(), std::vector<tx_source_entry>(), std::vector<tx_destination_entry>(), empty_extra, att_container, tx, one_time_secret_key, 0, 0, true, 0))
if (!construct_tx(account_keys(), std::vector<tx_source_entry>(), std::vector<tx_destination_entry>(), empty_extra, att_container, tx, tx_version, one_time_secret_key, 0, 0, true, 0))
return false;
size_t sz = get_object_blobsize(tx);
@ -2257,12 +2257,12 @@ bool gen_wallet_offers_size_limit::c1(currency::core& c, size_t ev_index, const
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
bc_services::offer_details_ex od_normal = AUTO_VAL_INIT(od_normal);
bool r = generate_oversized_offer(CURRENCY_MAX_TRANSACTION_BLOB_SIZE - 2048, CURRENCY_MAX_TRANSACTION_BLOB_SIZE - 1024, od_normal); // generate biggest offer but within tx size limits
bool r = generate_oversized_offer(CURRENCY_MAX_TRANSACTION_BLOB_SIZE - 2048, CURRENCY_MAX_TRANSACTION_BLOB_SIZE - 1024, od_normal, c.get_current_tx_version()); // generate biggest offer but within tx size limits
CHECK_AND_ASSERT_MES(r, false, "generate_oversized_offer failed");
od_normal.fee = TESTS_DEFAULT_FEE;
bc_services::offer_details_ex od_oversized = AUTO_VAL_INIT(od_oversized);
r = generate_oversized_offer(CURRENCY_MAX_TRANSACTION_BLOB_SIZE, CURRENCY_MAX_TRANSACTION_BLOB_SIZE + 1024, od_oversized);
r = generate_oversized_offer(CURRENCY_MAX_TRANSACTION_BLOB_SIZE, CURRENCY_MAX_TRANSACTION_BLOB_SIZE + 1024, od_oversized, c.get_current_tx_version());
CHECK_AND_ASSERT_MES(r, false, "generate_oversized_offer failed");
od_oversized.fee = TESTS_DEFAULT_FEE;