Monero
Loading...
Searching...
No Matches
chaingen.h File Reference
#include <functional>
#include <vector>
#include <iostream>
#include <stdint.h>
#include <boost/program_options.hpp>
#include <boost/optional.hpp>
#include <boost/serialization/vector.hpp>
#include <boost/serialization/variant.hpp>
#include <boost/serialization/optional.hpp>
#include <boost/serialization/unordered_map.hpp>
#include <boost/functional/hash.hpp>
#include "include_base_utils.h"
#include "common/boost_serialization_helper.h"
#include "common/command_line.h"
#include "common/threadpool.h"
#include "cryptonote_basic/account_boost_serialization.h"
#include "cryptonote_basic/cryptonote_basic.h"
#include "cryptonote_basic/cryptonote_basic_impl.h"
#include "cryptonote_basic/cryptonote_format_utils.h"
#include "cryptonote_core/cryptonote_core.h"
#include "cryptonote_protocol/enums.h"
#include "cryptonote_basic/cryptonote_boost_serialization.h"
#include "misc_language.h"
Include dependency graph for chaingen.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  callback_entry
struct  serialized_object< T >
struct  event_visitor_settings
struct  event_replay_settings
class  test_chain_unit_base
class  test_generator
struct  test_generator::block_info
struct  output_index
struct  dest_wrapper_t
class  block_tracker
struct  push_core_event_visitor< t_test_class >
struct  get_test_options< t_test_class >

Macros

#define MONERO_DEFAULT_LOG_CATEGORY   "tests.core"
#define DEFAULT_HARDFORKS(HARDFORKS)
#define ADD_HARDFORK(HARDFORKS, FORK, HEIGHT)
#define GENERATE_ACCOUNT(account)
#define GENERATE_MULTISIG_ACCOUNT(account, threshold, total)
#define MAKE_ACCOUNT(VEC_EVENTS, account)
#define DO_CALLBACK(VEC_EVENTS, CB_NAME)
#define REGISTER_CALLBACK(CB_NAME, CLBACK)
#define REGISTER_CALLBACK_METHOD(CLASS, METHOD)
#define MAKE_GENESIS_BLOCK(VEC_EVENTS, BLK_NAME, MINER_ACC, TS)
#define MAKE_NEXT_BLOCK(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC)
#define MAKE_NEXT_BLOCK_HF(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC, HF)
#define MAKE_NEXT_BLOCK_TX1(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC, TX1)
#define MAKE_NEXT_BLOCK_TX1_HF(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC, TX1, HF)
#define MAKE_NEXT_BLOCK_TX_LIST(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC, TXLIST)
#define MAKE_NEXT_BLOCK_TX_LIST_HF(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC, TXLIST, HF)
#define REWIND_BLOCKS_N_HF(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC, COUNT, HF)
#define REWIND_BLOCKS_N(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC, COUNT)
#define REWIND_BLOCKS(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC)
#define REWIND_BLOCKS_HF(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC, HF)
#define MAKE_TX_MIX(VEC_EVENTS, TX_NAME, FROM, TO, AMOUNT, NMIX, HEAD)
#define MAKE_TX_MIX_RCT(VEC_EVENTS, TX_NAME, FROM, TO, AMOUNT, NMIX, HEAD)
#define MAKE_TX(VEC_EVENTS, TX_NAME, FROM, TO, AMOUNT, HEAD)
#define MAKE_TX_MIX_LIST(VEC_EVENTS, SET_NAME, FROM, TO, AMOUNT, NMIX, HEAD)
#define MAKE_TX_MIX_LIST_RCT(VEC_EVENTS, SET_NAME, FROM, TO, AMOUNT, NMIX, HEAD)
#define MAKE_TX_MIX_LIST_RCT_EX(VEC_EVENTS, SET_NAME, FROM, TO, AMOUNT, NMIX, HEAD, RCT_TYPE, BP_VER)
#define MAKE_TX_MIX_DEST_LIST_RCT(VEC_EVENTS, SET_NAME, FROM, TO, NMIX, HEAD)
#define MAKE_TX_MIX_DEST_LIST_RCT_EX(VEC_EVENTS, SET_NAME, FROM, TO, NMIX, HEAD, RCT_TYPE, BP_VER)
#define MAKE_TX_LIST(VEC_EVENTS, SET_NAME, FROM, TO, AMOUNT, HEAD)
#define MAKE_TX_LIST_START(VEC_EVENTS, SET_NAME, FROM, TO, AMOUNT, HEAD)
#define MAKE_TX_LIST_START_RCT(VEC_EVENTS, SET_NAME, FROM, TO, AMOUNT, NMIX, HEAD)
#define MAKE_MINER_TX_AND_KEY_AT_HF_MANUALLY(TX, BLK, HF_VERSION, KEY)
#define MAKE_MINER_TX_AND_KEY_MANUALLY(TX, BLK, KEY)
#define MAKE_MINER_TX_MANUALLY(TX, BLK)
#define SET_EVENT_VISITOR_SETT(VEC_EVENTS, SETT)
#define GENERATE(filename, genclass)
#define PLAY(filename, genclass)
#define CATCH_REPLAY(genclass)
#define REPLAY_CORE(genclass)
#define REPLAY_WITH_CORE(genclass, CORE)
#define CATCH_GENERATE_REPLAY(genclass)
#define CATCH_GENERATE_REPLAY_CORE(genclass, CORE)
#define GENERATE_AND_PLAY(genclass)
#define GENERATE_AND_PLAY_INSTANCE(genclass, ins, CORE)
#define CALL_TEST(test_name, function)
#define QUOTEME(x)
#define DEFINE_TESTS_ERROR_CONTEXT(text)
#define CHECK_TEST_CONDITION(cond)
#define CHECK_EQ(v1, v2)
#define CHECK_NOT_EQ(v1, v2)
#define MK_COINS(amount)
#define TESTS_DEFAULT_FEE   ((uint64_t)20000000000)

Typedefs

typedef serialized_object< cryptonote::blockserialized_block
typedef serialized_object< cryptonote::transactionserialized_transaction
typedef std::vector< std::pair< uint8_t, uint64_t > > v_hardforks_t
typedef boost::variant< cryptonote::block, cryptonote::transaction, std::vector< cryptonote::transaction >, cryptonote::account_base, callback_entry, serialized_block, serialized_transaction, event_visitor_settings, event_replay_settingstest_event_entry
typedef std::unordered_map< crypto::hash, const cryptonote::transaction * > map_hash2tx_t
typedef std::tuple< uint64_t, crypto::public_key, rct::keyget_outs_entry
typedef std::pair< crypto::hash, size_t > output_hasher
typedef boost::hash< output_hasheroutput_hasher_hasher
typedef std::map< uint64_t, std::vector< size_t > > map_output_t
typedef std::map< uint64_t, std::vector< output_index > > map_output_idx_t
typedef std::unordered_map< crypto::hash, cryptonote::blockmap_block_t
typedef std::unordered_map< output_hasher, output_index, output_hasher_hashermap_txid_output_t
typedef std::unordered_map< crypto::public_key, cryptonote::subaddress_indexsubaddresses_t
typedef std::pair< uint64_t, size_t > outloc_t
typedef boost::variant< cryptonote::account_public_address, cryptonote::account_keys, cryptonote::account_base, cryptonote::tx_destination_entryvar_addr_t

Functions

 VARIANT_TAG (binary_archive, callback_entry, 0xcb)
 VARIANT_TAG (binary_archive, cryptonote::account_base, 0xcc)
 VARIANT_TAG (binary_archive, serialized_block, 0xcd)
 VARIANT_TAG (binary_archive, serialized_transaction, 0xce)
 VARIANT_TAG (binary_archive, event_visitor_settings, 0xcf)
 VARIANT_TAG (binary_archive, event_replay_settings, 0xda)
template<typename T>
std::string dump_keys (T *buff32)
std::string dump_data (const cryptonote::transaction &tx)
cryptonote::account_public_address get_address (const var_addr_t &inp)
cryptonote::account_public_address get_address (const cryptonote::account_public_address &inp)
cryptonote::account_public_address get_address (const cryptonote::account_keys &inp)
cryptonote::account_public_address get_address (const cryptonote::account_base &inp)
cryptonote::account_public_address get_address (const cryptonote::tx_destination_entry &inp)
cryptonote::difficulty_type get_test_difficulty (const boost::optional< uint8_t > &hf_ver=boost::none)
uint64_t current_difficulty_window (const boost::optional< uint8_t > &hf_ver=boost::none)
cryptonote::tx_destination_entry build_dst (const var_addr_t &to, bool is_subaddr=false, uint64_t amount=0)
std::vector< cryptonote::tx_destination_entrybuild_dsts (const var_addr_t &to1, bool sub1=false, uint64_t am1=0)
std::vector< cryptonote::tx_destination_entrybuild_dsts (std::initializer_list< dest_wrapper_t > inps)
uint64_t sum_amount (const std::vector< cryptonote::tx_destination_entry > &destinations)
uint64_t sum_amount (const std::vector< cryptonote::tx_source_entry > &sources)
bool construct_miner_tx_manually (size_t height, uint64_t already_generated_coins, const cryptonote::account_public_address &miner_address, cryptonote::transaction &tx, uint64_t fee, uint8_t hf_version=1, cryptonote::keypair *p_txkey=nullptr)
bool construct_tx_to_key (const std::vector< test_event_entry > &events, cryptonote::transaction &tx, const cryptonote::block &blk_head, const cryptonote::account_base &from, const var_addr_t &to, uint64_t amount, uint64_t fee, size_t nmix, bool rct=false, rct::RangeProofType range_proof_type=rct::RangeProofBorromean, int bp_version=0)
bool construct_tx_to_key (const std::vector< test_event_entry > &events, cryptonote::transaction &tx, const cryptonote::block &blk_head, const cryptonote::account_base &from, std::vector< cryptonote::tx_destination_entry > destinations, uint64_t fee, size_t nmix, bool rct=false, rct::RangeProofType range_proof_type=rct::RangeProofBorromean, int bp_version=0)
bool construct_tx_to_key (cryptonote::transaction &tx, const cryptonote::account_base &from, const var_addr_t &to, uint64_t amount, std::vector< cryptonote::tx_source_entry > &sources, uint64_t fee, bool rct=false, rct::RangeProofType range_proof_type=rct::RangeProofBorromean, int bp_version=0)
bool construct_tx_to_key (cryptonote::transaction &tx, const cryptonote::account_base &from, const std::vector< cryptonote::tx_destination_entry > &destinations, std::vector< cryptonote::tx_source_entry > &sources, uint64_t fee, bool rct, rct::RangeProofType range_proof_type, int bp_version=0)
cryptonote::transaction construct_tx_with_fee (std::vector< test_event_entry > &events, const cryptonote::block &blk_head, const cryptonote::account_base &acc_from, const var_addr_t &to, uint64_t amount, uint64_t fee)
bool construct_tx_rct (const cryptonote::account_keys &sender_account_keys, std::vector< cryptonote::tx_source_entry > &sources, const std::vector< cryptonote::tx_destination_entry > &destinations, const boost::optional< cryptonote::account_public_address > &change_addr, std::vector< uint8_t > extra, cryptonote::transaction &tx, bool rct=false, rct::RangeProofType range_proof_type=rct::RangeProofBorromean, int bp_version=0)
uint64_t num_blocks (const std::vector< test_event_entry > &events)
cryptonote::block get_head_block (const std::vector< test_event_entry > &events)
void get_confirmed_txs (const std::vector< cryptonote::block > &blockchain, const map_hash2tx_t &mtx, map_hash2tx_t &confirmed_txs)
bool trim_block_chain (std::vector< cryptonote::block > &blockchain, const crypto::hash &tail)
bool trim_block_chain (std::vector< const cryptonote::block * > &blockchain, const crypto::hash &tail)
bool find_block_chain (const std::vector< test_event_entry > &events, std::vector< cryptonote::block > &blockchain, map_hash2tx_t &mtx, const crypto::hash &head)
bool find_block_chain (const std::vector< test_event_entry > &events, std::vector< const cryptonote::block * > &blockchain, map_hash2tx_t &mtx, const crypto::hash &head)
void fill_tx_destinations (const var_addr_t &from, const cryptonote::account_public_address &to, uint64_t amount, uint64_t fee, const std::vector< cryptonote::tx_source_entry > &sources, std::vector< cryptonote::tx_destination_entry > &destinations, bool always_change=false)
void fill_tx_destinations (const var_addr_t &from, const std::vector< cryptonote::tx_destination_entry > &dests, uint64_t fee, const std::vector< cryptonote::tx_source_entry > &sources, std::vector< cryptonote::tx_destination_entry > &destinations, bool always_change)
void fill_tx_destinations (const var_addr_t &from, const cryptonote::account_public_address &to, uint64_t amount, uint64_t fee, const std::vector< cryptonote::tx_source_entry > &sources, std::vector< cryptonote::tx_destination_entry > &destinations, std::vector< cryptonote::tx_destination_entry > &destinations_pure, bool always_change=false)
void fill_tx_sources_and_destinations (const std::vector< test_event_entry > &events, const cryptonote::block &blk_head, const cryptonote::account_base &from, const cryptonote::account_public_address &to, uint64_t amount, uint64_t fee, size_t nmix, std::vector< cryptonote::tx_source_entry > &sources, std::vector< cryptonote::tx_destination_entry > &destinations)
void fill_tx_sources_and_destinations (const std::vector< test_event_entry > &events, const cryptonote::block &blk_head, const cryptonote::account_base &from, const cryptonote::account_base &to, uint64_t amount, uint64_t fee, size_t nmix, std::vector< cryptonote::tx_source_entry > &sources, std::vector< cryptonote::tx_destination_entry > &destinations)
uint64_t get_balance (const cryptonote::account_base &addr, const std::vector< cryptonote::block > &blockchain, const map_hash2tx_t &mtx)
bool extract_hard_forks (const std::vector< test_event_entry > &events, v_hardforks_t &hard_forks)
bool extract_hard_forks_from_blocks (const std::vector< test_event_entry > &events, v_hardforks_t &hard_forks)
template<class t_test_class>
bool replay_events_through_core (cryptonote::core &cr, const std::vector< test_event_entry > &events, t_test_class &validator)
template<class t_test_class>
bool replay_events_through_core_plain (cryptonote::core &cr, const std::vector< test_event_entry > &events, t_test_class &validator, bool reinit=true)
template<class t_test_class>
bool do_replay_events_get_core (std::vector< test_event_entry > &events, cryptonote::core *core)
template<class t_test_class>
bool replay_events_through_core_validate (std::vector< test_event_entry > &events, cryptonote::core &c)
template<class t_test_class>
bool do_replay_events (std::vector< test_event_entry > &events)
template<class t_test_class>
bool do_replay_file (const std::string &filename)

Macro Definition Documentation

◆ ADD_HARDFORK

#define ADD_HARDFORK ( HARDFORKS,
FORK,
HEIGHT )
Value:
HARDFORKS.push_back(std::make_pair((uint8_t)FORK, (uint64_t)HEIGHT))
unsigned char uint8_t
Definition stdint.h:124
unsigned __int64 uint64_t
Definition stdint.h:136

◆ CALL_TEST

#define CALL_TEST ( test_name,
function )
Value:
{ \
if(!function()) \
{ \
MERROR("#TEST# Failed " << test_name); \
return 1; \
} \
else \
{ \
MGINFO_GREEN("#TEST# Succeeded " << test_name); \
} \
}

◆ CATCH_GENERATE_REPLAY

#define CATCH_GENERATE_REPLAY ( genclass)
Value:
CATCH_REPLAY(genclass); \
REPLAY_CORE(genclass);
#define CATCH_REPLAY(genclass)
Definition chaingen.h:1004

◆ CATCH_GENERATE_REPLAY_CORE

#define CATCH_GENERATE_REPLAY_CORE ( genclass,
CORE )
Value:
CATCH_REPLAY(genclass); \
REPLAY_WITH_CORE(genclass, CORE);

◆ CATCH_REPLAY

#define CATCH_REPLAY ( genclass)
Value:
catch (const std::exception& ex) \
{ \
MERROR(#genclass << " generation failed: what=" << ex.what()); \
} \
catch (...) \
{ \
MERROR(#genclass << " generation failed: generic exception"); \
}

◆ CHECK_EQ

#define CHECK_EQ ( v1,
v2 )
Value:
CHECK_AND_ASSERT_MES(v1 == v2, false, "[" << perr_context << "] failed: \"" << QUOTEME(v1) << " == " << QUOTEME(v2) << "\", " << v1 << " != " << v2)
#define v1(p)
Definition aesb.c:117
#define v2(p)
Definition aesb.c:118
#define QUOTEME(x)
Definition chaingen.h:1086

◆ CHECK_NOT_EQ

#define CHECK_NOT_EQ ( v1,
v2 )
Value:
CHECK_AND_ASSERT_MES(!(v1 == v2), false, "[" << perr_context << "] failed: \"" << QUOTEME(v1) << " != " << QUOTEME(v2) << "\", " << v1 << " == " << v2)

◆ CHECK_TEST_CONDITION

#define CHECK_TEST_CONDITION ( cond)
Value:
CHECK_AND_ASSERT_MES(cond, false, "[" << perr_context << "] failed: \"" << QUOTEME(cond) << "\"")

◆ DEFAULT_HARDFORKS

#define DEFAULT_HARDFORKS ( HARDFORKS)
Value:
do { \
HARDFORKS.push_back(std::make_pair((uint8_t)1, (uint64_t)0)); \
} while(0)

◆ DEFINE_TESTS_ERROR_CONTEXT

#define DEFINE_TESTS_ERROR_CONTEXT ( text)
Value:
const char* perr_context = text; (void) perr_context;
const char * text
Definition minihttptestserver.c:269

◆ DO_CALLBACK

#define DO_CALLBACK ( VEC_EVENTS,
CB_NAME )
Value:
{ \
callback_entry CALLBACK_ENTRY; \
CALLBACK_ENTRY.callback_name = CB_NAME; \
VEC_EVENTS.push_back(CALLBACK_ENTRY); \
}
Definition chaingen.h:66
std::string callback_name
Definition chaingen.h:67

◆ GENERATE

#define GENERATE ( filename,
genclass )
Value:
{ \
std::vector<test_event_entry> events; \
genclass g; \
g.generate(events); \
if (!tools::serialize_obj_to_file(events, filename)) \
{ \
MERROR("Failed to serialize data to file: " << filename); \
throw std::runtime_error("Failed to serialize data to file"); \
} \
}
bool serialize_obj_to_file(t_object &obj, const std::string &file_path)
Definition boost_serialization_helper.h:43

◆ GENERATE_ACCOUNT

#define GENERATE_ACCOUNT ( account)
Value:
account.generate();
Definition account.h:74
crypto::secret_key generate(const crypto::secret_key &recovery_key=crypto::secret_key(), bool recover=false, bool two_random=false)
Definition account.cpp:166

◆ GENERATE_AND_PLAY

#define GENERATE_AND_PLAY ( genclass)
Value:
if (list_tests) \
std::cout << #genclass << std::endl; \
else if (filter.empty() || boost::regex_match(std::string(#genclass), match, boost::regex(filter))) \
{ \
std::vector<test_event_entry> events; \
++tests_count; \
bool generated = false; \
try \
{ \
genclass g; \
generated = g.generate(events); \
} \
CATCH_GENERATE_REPLAY(genclass); \
}

◆ GENERATE_AND_PLAY_INSTANCE

#define GENERATE_AND_PLAY_INSTANCE ( genclass,
ins,
CORE )
Value:
if (filter.empty() || boost::regex_match(std::string(#genclass), match, boost::regex(filter))) \
{ \
std::vector<test_event_entry> events; \
++tests_count; \
bool generated = false; \
try \
{ \
generated = ins.generate(events); \
} \
CATCH_GENERATE_REPLAY_CORE(genclass, CORE); \
}

◆ GENERATE_MULTISIG_ACCOUNT

#define GENERATE_MULTISIG_ACCOUNT ( account,
threshold,
total )
Value:
CHECK_AND_ASSERT_MES(threshold >= 2 && threshold <= total, false, "Invalid multisig scheme"); \
std::vector<cryptonote::account_base> account(total); \
do \
{ \
for (size_t msidx = 0; msidx < total; ++msidx) \
account[msidx].generate(); \
CHECK_AND_ASSERT_MES(make_multisig_accounts(account, threshold), false, "Failed to make multisig accounts."); \
} while(0)
void generate(randomx::Program &p, uint32_t nonce)
Definition perf-simulation.cpp:62
static bool make_multisig_accounts(std::vector< cryptonote::account_base > &accounts, const uint32_t threshold)
Definition multisig.cpp:56

◆ MAKE_ACCOUNT

#define MAKE_ACCOUNT ( VEC_EVENTS,
account )
Value:
account.generate(); \
VEC_EVENTS.push_back(account);

◆ MAKE_GENESIS_BLOCK

#define MAKE_GENESIS_BLOCK ( VEC_EVENTS,
BLK_NAME,
MINER_ACC,
TS )
Value:
test_generator generator; \
cryptonote::block BLK_NAME; \
generator.construct_block(BLK_NAME, MINER_ACC, TS); \
VEC_EVENTS.push_back(BLK_NAME);
Definition chaingen.h:183
bool construct_block(cryptonote::block &blk, uint64_t height, const crypto::hash &prev_id, const cryptonote::account_base &miner_acc, uint64_t timestamp, uint64_t already_generated_coins, std::vector< size_t > &block_weights, const std::list< cryptonote::transaction > &tx_list, const boost::optional< uint8_t > &hf_ver=boost::none)
Definition chaingen.cpp:235
Definition cryptonote_basic.h:475

◆ MAKE_MINER_TX_AND_KEY_AT_HF_MANUALLY

#define MAKE_MINER_TX_AND_KEY_AT_HF_MANUALLY ( TX,
BLK,
HF_VERSION,
KEY )
Value:
transaction TX; \
if (!construct_miner_tx_manually(get_block_height(BLK) + 1, generator.get_already_generated_coins(BLK), \
miner_account.get_keys().m_account_address, TX, 0, HF_VERSION, KEY)) \
return false;
bool construct_miner_tx_manually(size_t height, uint64_t already_generated_coins, const account_public_address &miner_address, transaction &tx, uint64_t fee, uint8_t hf_version, keypair *p_txkey)
Definition chaingen.cpp:975

◆ MAKE_MINER_TX_AND_KEY_MANUALLY

#define MAKE_MINER_TX_AND_KEY_MANUALLY ( TX,
BLK,
KEY )
Value:
#define MAKE_MINER_TX_AND_KEY_AT_HF_MANUALLY(TX, BLK, HF_VERSION, KEY)
Definition chaingen.h:972

◆ MAKE_MINER_TX_MANUALLY

#define MAKE_MINER_TX_MANUALLY ( TX,
BLK )
Value:
#define MAKE_MINER_TX_AND_KEY_MANUALLY(TX, BLK, KEY)
Definition chaingen.h:978

◆ MAKE_NEXT_BLOCK

#define MAKE_NEXT_BLOCK ( VEC_EVENTS,
BLK_NAME,
PREV_BLOCK,
MINER_ACC )
Value:
cryptonote::block BLK_NAME; \
generator.construct_block(BLK_NAME, PREV_BLOCK, MINER_ACC); \
VEC_EVENTS.push_back(BLK_NAME);

◆ MAKE_NEXT_BLOCK_HF

#define MAKE_NEXT_BLOCK_HF ( VEC_EVENTS,
BLK_NAME,
PREV_BLOCK,
MINER_ACC,
HF )
Value:
cryptonote::block BLK_NAME; \
generator.construct_block(BLK_NAME, PREV_BLOCK, MINER_ACC, std::list<cryptonote::transaction>(), HF); \
VEC_EVENTS.push_back(BLK_NAME);

◆ MAKE_NEXT_BLOCK_TX1

#define MAKE_NEXT_BLOCK_TX1 ( VEC_EVENTS,
BLK_NAME,
PREV_BLOCK,
MINER_ACC,
TX1 )
Value:
cryptonote::block BLK_NAME; \
{ \
std::list<cryptonote::transaction> tx_list; \
tx_list.push_back(TX1); \
generator.construct_block(BLK_NAME, PREV_BLOCK, MINER_ACC, tx_list); \
} \
VEC_EVENTS.push_back(BLK_NAME);

◆ MAKE_NEXT_BLOCK_TX1_HF

#define MAKE_NEXT_BLOCK_TX1_HF ( VEC_EVENTS,
BLK_NAME,
PREV_BLOCK,
MINER_ACC,
TX1,
HF )
Value:
cryptonote::block BLK_NAME; \
{ \
std::list<cryptonote::transaction> tx_list; \
tx_list.push_back(TX1); \
generator.construct_block(BLK_NAME, PREV_BLOCK, MINER_ACC, tx_list, HF); \
} \
VEC_EVENTS.push_back(BLK_NAME);

◆ MAKE_NEXT_BLOCK_TX_LIST

#define MAKE_NEXT_BLOCK_TX_LIST ( VEC_EVENTS,
BLK_NAME,
PREV_BLOCK,
MINER_ACC,
TXLIST )
Value:
cryptonote::block BLK_NAME; \
generator.construct_block(BLK_NAME, PREV_BLOCK, MINER_ACC, TXLIST); \
VEC_EVENTS.push_back(BLK_NAME);

◆ MAKE_NEXT_BLOCK_TX_LIST_HF

#define MAKE_NEXT_BLOCK_TX_LIST_HF ( VEC_EVENTS,
BLK_NAME,
PREV_BLOCK,
MINER_ACC,
TXLIST,
HF )
Value:
cryptonote::block BLK_NAME; \
generator.construct_block(BLK_NAME, PREV_BLOCK, MINER_ACC, TXLIST, HF); \
VEC_EVENTS.push_back(BLK_NAME);

◆ MAKE_TX

#define MAKE_TX ( VEC_EVENTS,
TX_NAME,
FROM,
TO,
AMOUNT,
HEAD )
Value:
MAKE_TX_MIX(VEC_EVENTS, TX_NAME, FROM, TO, AMOUNT, 0, HEAD)
#define MAKE_TX_MIX(VEC_EVENTS, TX_NAME, FROM, TO, AMOUNT, NMIX, HEAD)
Definition chaingen.h:922

◆ MAKE_TX_LIST

#define MAKE_TX_LIST ( VEC_EVENTS,
SET_NAME,
FROM,
TO,
AMOUNT,
HEAD )
Value:
MAKE_TX_MIX_LIST(VEC_EVENTS, SET_NAME, FROM, TO, AMOUNT, 0, HEAD)
#define MAKE_TX_MIX_LIST(VEC_EVENTS, SET_NAME, FROM, TO, AMOUNT, NMIX, HEAD)
Definition chaingen.h:934

◆ MAKE_TX_LIST_START

#define MAKE_TX_LIST_START ( VEC_EVENTS,
SET_NAME,
FROM,
TO,
AMOUNT,
HEAD )
Value:
std::list<cryptonote::transaction> SET_NAME; \
MAKE_TX_LIST(VEC_EVENTS, SET_NAME, FROM, TO, AMOUNT, HEAD);

◆ MAKE_TX_LIST_START_RCT

#define MAKE_TX_LIST_START_RCT ( VEC_EVENTS,
SET_NAME,
FROM,
TO,
AMOUNT,
NMIX,
HEAD )
Value:
std::list<cryptonote::transaction> SET_NAME; \
MAKE_TX_MIX_LIST_RCT(VEC_EVENTS, SET_NAME, FROM, TO, AMOUNT, NMIX, HEAD);

◆ MAKE_TX_MIX

#define MAKE_TX_MIX ( VEC_EVENTS,
TX_NAME,
FROM,
TO,
AMOUNT,
NMIX,
HEAD )
Value:
construct_tx_to_key(VEC_EVENTS, TX_NAME, HEAD, FROM, TO, AMOUNT, TESTS_DEFAULT_FEE, NMIX); \
VEC_EVENTS.push_back(TX_NAME);
#define TESTS_DEFAULT_FEE
Definition chaingen.h:1092
Definition cryptonote_basic.h:205

◆ MAKE_TX_MIX_DEST_LIST_RCT

#define MAKE_TX_MIX_DEST_LIST_RCT ( VEC_EVENTS,
SET_NAME,
FROM,
TO,
NMIX,
HEAD )
Value:
MAKE_TX_MIX_DEST_LIST_RCT_EX(VEC_EVENTS, SET_NAME, FROM, TO, NMIX, HEAD, rct::RangeProofPaddedBulletproof, 1)
#define MAKE_TX_MIX_DEST_LIST_RCT_EX(VEC_EVENTS, SET_NAME, FROM, TO, NMIX, HEAD, RCT_TYPE, BP_VER)
Definition chaingen.h:954
@ RangeProofPaddedBulletproof
Definition rctTypes.h:307

◆ MAKE_TX_MIX_DEST_LIST_RCT_EX

#define MAKE_TX_MIX_DEST_LIST_RCT_EX ( VEC_EVENTS,
SET_NAME,
FROM,
TO,
NMIX,
HEAD,
RCT_TYPE,
BP_VER )
Value:
{ \
construct_tx_to_key(VEC_EVENTS, t, HEAD, FROM, TO, TESTS_DEFAULT_FEE, NMIX, true, RCT_TYPE, BP_VER); \
SET_NAME.push_back(t); \
VEC_EVENTS.push_back(t); \
}

◆ MAKE_TX_MIX_LIST

#define MAKE_TX_MIX_LIST ( VEC_EVENTS,
SET_NAME,
FROM,
TO,
AMOUNT,
NMIX,
HEAD )
Value:
{ \
construct_tx_to_key(VEC_EVENTS, t, HEAD, FROM, TO, AMOUNT, TESTS_DEFAULT_FEE, NMIX); \
SET_NAME.push_back(t); \
VEC_EVENTS.push_back(t); \
}

◆ MAKE_TX_MIX_LIST_RCT

#define MAKE_TX_MIX_LIST_RCT ( VEC_EVENTS,
SET_NAME,
FROM,
TO,
AMOUNT,
NMIX,
HEAD )
Value:
MAKE_TX_MIX_LIST_RCT_EX(VEC_EVENTS, SET_NAME, FROM, TO, AMOUNT, NMIX, HEAD, rct::RangeProofPaddedBulletproof, 1)
#define MAKE_TX_MIX_LIST_RCT_EX(VEC_EVENTS, SET_NAME, FROM, TO, AMOUNT, NMIX, HEAD, RCT_TYPE, BP_VER)
Definition chaingen.h:944

◆ MAKE_TX_MIX_LIST_RCT_EX

#define MAKE_TX_MIX_LIST_RCT_EX ( VEC_EVENTS,
SET_NAME,
FROM,
TO,
AMOUNT,
NMIX,
HEAD,
RCT_TYPE,
BP_VER )
Value:
{ \
construct_tx_to_key(VEC_EVENTS, t, HEAD, FROM, TO, AMOUNT, TESTS_DEFAULT_FEE, NMIX, true, RCT_TYPE, BP_VER); \
SET_NAME.push_back(t); \
VEC_EVENTS.push_back(t); \
}

◆ MAKE_TX_MIX_RCT

#define MAKE_TX_MIX_RCT ( VEC_EVENTS,
TX_NAME,
FROM,
TO,
AMOUNT,
NMIX,
HEAD )
Value:
construct_tx_to_key(VEC_EVENTS, TX_NAME, HEAD, FROM, TO, AMOUNT, TESTS_DEFAULT_FEE, NMIX, true, rct::RangeProofPaddedBulletproof); \
VEC_EVENTS.push_back(TX_NAME);

◆ MK_COINS

#define MK_COINS ( amount)
Value:
(UINT64_C(amount) * COIN)
#define COIN
Definition cryptonote_config.h:67
#define UINT64_C(val)
Definition stdint.h:284

◆ MONERO_DEFAULT_LOG_CATEGORY

#define MONERO_DEFAULT_LOG_CATEGORY   "tests.core"

◆ PLAY

#define PLAY ( filename,
genclass )
Value:
if(!do_replay_file<genclass>(filename)) \
{ \
MERROR("Failed to pass test : " << #genclass); \
return 1; \
}
bool do_replay_file(const std::string &filename)
Definition chaingen.h:812

◆ QUOTEME

#define QUOTEME ( x)
Value:
#x

◆ REGISTER_CALLBACK

#define REGISTER_CALLBACK ( CB_NAME,
CLBACK )
Value:
register_callback(CB_NAME, std::bind(&CLBACK, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));

◆ REGISTER_CALLBACK_METHOD

#define REGISTER_CALLBACK_METHOD ( CLASS,
METHOD )
Value:
register_callback(#METHOD, std::bind(&CLASS::METHOD, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));

◆ REPLAY_CORE

#define REPLAY_CORE ( genclass)
Value:
if (generated && do_replay_events< genclass >(events)) \
{ \
MGINFO_GREEN("#TEST# Succeeded " << #genclass); \
} \
else \
{ \
MERROR("#TEST# Failed " << #genclass); \
failed_tests.push_back(#genclass); \
}
bool do_replay_events(std::vector< test_event_entry > &events)
Definition chaingen.h:803

◆ REPLAY_WITH_CORE

#define REPLAY_WITH_CORE ( genclass,
CORE )
Value:
if (generated && replay_events_through_core_validate< genclass >(events, CORE)) \
{ \
MGINFO_GREEN("#TEST# Succeeded " << #genclass); \
} \
else \
{ \
MERROR("#TEST# Failed " << #genclass); \
failed_tests.push_back(#genclass); \
}
bool replay_events_through_core_validate(std::vector< test_event_entry > &events, cryptonote::core &c)
Definition chaingen.h:788

◆ REWIND_BLOCKS

#define REWIND_BLOCKS ( VEC_EVENTS,
BLK_NAME,
PREV_BLOCK,
MINER_ACC )
Value:
REWIND_BLOCKS_N(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC, CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW)
#define REWIND_BLOCKS_N(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC, COUNT)
Definition chaingen.h:918
#define CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW
Definition cryptonote_config.h:44

◆ REWIND_BLOCKS_HF

#define REWIND_BLOCKS_HF ( VEC_EVENTS,
BLK_NAME,
PREV_BLOCK,
MINER_ACC,
HF )
Value:
REWIND_BLOCKS_N_HF(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC, CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW, HF)
#define REWIND_BLOCKS_N_HF(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC, COUNT, HF)
Definition chaingen.h:906

◆ REWIND_BLOCKS_N

#define REWIND_BLOCKS_N ( VEC_EVENTS,
BLK_NAME,
PREV_BLOCK,
MINER_ACC,
COUNT )
Value:
REWIND_BLOCKS_N_HF(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC, COUNT, boost::none)

◆ REWIND_BLOCKS_N_HF

#define REWIND_BLOCKS_N_HF ( VEC_EVENTS,
BLK_NAME,
PREV_BLOCK,
MINER_ACC,
COUNT,
HF )
Value:
cryptonote::block BLK_NAME; \
{ \
cryptonote::block blk_last = PREV_BLOCK; \
for (size_t i = 0; i < COUNT; ++i) \
{ \
MAKE_NEXT_BLOCK_HF(VEC_EVENTS, blk, blk_last, MINER_ACC, HF); \
blk_last = blk; \
} \
BLK_NAME = blk_last; \
}

◆ SET_EVENT_VISITOR_SETT

#define SET_EVENT_VISITOR_SETT ( VEC_EVENTS,
SETT )
Value:
VEC_EVENTS.push_back(event_visitor_settings(SETT));
Definition chaingen.h:111

◆ TESTS_DEFAULT_FEE

#define TESTS_DEFAULT_FEE   ((uint64_t)20000000000)

Typedef Documentation

◆ get_outs_entry

◆ map_block_t

typedef std::unordered_map<crypto::hash, cryptonote::block> map_block_t

◆ map_hash2tx_t

◆ map_output_idx_t

typedef std::map<uint64_t, std::vector<output_index> > map_output_idx_t

◆ map_output_t

typedef std::map<uint64_t, std::vector<size_t> > map_output_t

◆ map_txid_output_t

◆ outloc_t

typedef std::pair<uint64_t, size_t> outloc_t

◆ output_hasher

typedef std::pair<crypto::hash, size_t> output_hasher

◆ output_hasher_hasher

typedef boost::hash<output_hasher> output_hasher_hasher

◆ serialized_block

◆ serialized_transaction

◆ subaddresses_t

◆ test_event_entry

◆ v_hardforks_t

typedef std::vector<std::pair<uint8_t, uint64_t> > v_hardforks_t

◆ var_addr_t

Function Documentation

◆ build_dst()

cryptonote::tx_destination_entry build_dst ( const var_addr_t & to,
bool is_subaddr = false,
uint64_t amount = 0 )

◆ build_dsts() [1/2]

std::vector< cryptonote::tx_destination_entry > build_dsts ( const var_addr_t & to1,
bool sub1 = false,
uint64_t am1 = 0 )

◆ build_dsts() [2/2]

std::vector< cryptonote::tx_destination_entry > build_dsts ( std::initializer_list< dest_wrapper_t > inps)

◆ construct_miner_tx_manually()

bool construct_miner_tx_manually ( size_t height,
uint64_t already_generated_coins,
const cryptonote::account_public_address & miner_address,
cryptonote::transaction & tx,
uint64_t fee,
uint8_t hf_version = 1,
cryptonote::keypair * p_txkey = nullptr )

◆ construct_tx_rct()

bool construct_tx_rct ( const cryptonote::account_keys & sender_account_keys,
std::vector< cryptonote::tx_source_entry > & sources,
const std::vector< cryptonote::tx_destination_entry > & destinations,
const boost::optional< cryptonote::account_public_address > & change_addr,
std::vector< uint8_t > extra,
cryptonote::transaction & tx,
bool rct = false,
rct::RangeProofType range_proof_type = rct::RangeProofBorromean,
int bp_version = 0 )

◆ construct_tx_to_key() [1/4]

bool construct_tx_to_key ( const std::vector< test_event_entry > & events,
cryptonote::transaction & tx,
const cryptonote::block & blk_head,
const cryptonote::account_base & from,
const var_addr_t & to,
uint64_t amount,
uint64_t fee,
size_t nmix,
bool rct = false,
rct::RangeProofType range_proof_type = rct::RangeProofBorromean,
int bp_version = 0 )

◆ construct_tx_to_key() [2/4]

bool construct_tx_to_key ( const std::vector< test_event_entry > & events,
cryptonote::transaction & tx,
const cryptonote::block & blk_head,
const cryptonote::account_base & from,
std::vector< cryptonote::tx_destination_entry > destinations,
uint64_t fee,
size_t nmix,
bool rct = false,
rct::RangeProofType range_proof_type = rct::RangeProofBorromean,
int bp_version = 0 )

◆ construct_tx_to_key() [3/4]

bool construct_tx_to_key ( cryptonote::transaction & tx,
const cryptonote::account_base & from,
const std::vector< cryptonote::tx_destination_entry > & destinations,
std::vector< cryptonote::tx_source_entry > & sources,
uint64_t fee,
bool rct,
rct::RangeProofType range_proof_type,
int bp_version = 0 )

◆ construct_tx_to_key() [4/4]

bool construct_tx_to_key ( cryptonote::transaction & tx,
const cryptonote::account_base & from,
const var_addr_t & to,
uint64_t amount,
std::vector< cryptonote::tx_source_entry > & sources,
uint64_t fee,
bool rct = false,
rct::RangeProofType range_proof_type = rct::RangeProofBorromean,
int bp_version = 0 )

◆ construct_tx_with_fee()

cryptonote::transaction construct_tx_with_fee ( std::vector< test_event_entry > & events,
const cryptonote::block & blk_head,
const cryptonote::account_base & acc_from,
const var_addr_t & to,
uint64_t amount,
uint64_t fee )

◆ current_difficulty_window()

uint64_t current_difficulty_window ( const boost::optional< uint8_t > & hf_ver = boost::none)
inline

◆ do_replay_events()

template<class t_test_class>
bool do_replay_events ( std::vector< test_event_entry > & events)
inline

◆ do_replay_events_get_core()

template<class t_test_class>
bool do_replay_events_get_core ( std::vector< test_event_entry > & events,
cryptonote::core * core )
inline

◆ do_replay_file()

template<class t_test_class>
bool do_replay_file ( const std::string & filename)
inline

◆ dump_data()

std::string dump_data ( const cryptonote::transaction & tx)

◆ dump_keys()

template<typename T>
std::string dump_keys ( T * buff32)

◆ extract_hard_forks()

bool extract_hard_forks ( const std::vector< test_event_entry > & events,
v_hardforks_t & hard_forks )

◆ extract_hard_forks_from_blocks()

bool extract_hard_forks_from_blocks ( const std::vector< test_event_entry > & events,
v_hardforks_t & hard_forks )

◆ fill_tx_destinations() [1/3]

void fill_tx_destinations ( const var_addr_t & from,
const cryptonote::account_public_address & to,
uint64_t amount,
uint64_t fee,
const std::vector< cryptonote::tx_source_entry > & sources,
std::vector< cryptonote::tx_destination_entry > & destinations,
bool always_change = false )

◆ fill_tx_destinations() [2/3]

void fill_tx_destinations ( const var_addr_t & from,
const cryptonote::account_public_address & to,
uint64_t amount,
uint64_t fee,
const std::vector< cryptonote::tx_source_entry > & sources,
std::vector< cryptonote::tx_destination_entry > & destinations,
std::vector< cryptonote::tx_destination_entry > & destinations_pure,
bool always_change = false )

◆ fill_tx_destinations() [3/3]

void fill_tx_destinations ( const var_addr_t & from,
const std::vector< cryptonote::tx_destination_entry > & dests,
uint64_t fee,
const std::vector< cryptonote::tx_source_entry > & sources,
std::vector< cryptonote::tx_destination_entry > & destinations,
bool always_change )

◆ fill_tx_sources_and_destinations() [1/2]

void fill_tx_sources_and_destinations ( const std::vector< test_event_entry > & events,
const cryptonote::block & blk_head,
const cryptonote::account_base & from,
const cryptonote::account_base & to,
uint64_t amount,
uint64_t fee,
size_t nmix,
std::vector< cryptonote::tx_source_entry > & sources,
std::vector< cryptonote::tx_destination_entry > & destinations )

◆ fill_tx_sources_and_destinations() [2/2]

void fill_tx_sources_and_destinations ( const std::vector< test_event_entry > & events,
const cryptonote::block & blk_head,
const cryptonote::account_base & from,
const cryptonote::account_public_address & to,
uint64_t amount,
uint64_t fee,
size_t nmix,
std::vector< cryptonote::tx_source_entry > & sources,
std::vector< cryptonote::tx_destination_entry > & destinations )

◆ find_block_chain() [1/2]

bool find_block_chain ( const std::vector< test_event_entry > & events,
std::vector< const cryptonote::block * > & blockchain,
map_hash2tx_t & mtx,
const crypto::hash & head )

◆ find_block_chain() [2/2]

bool find_block_chain ( const std::vector< test_event_entry > & events,
std::vector< cryptonote::block > & blockchain,
map_hash2tx_t & mtx,
const crypto::hash & head )

◆ get_address() [1/5]

◆ get_address() [2/5]

◆ get_address() [3/5]

◆ get_address() [4/5]

◆ get_address() [5/5]

◆ get_balance()

uint64_t get_balance ( const cryptonote::account_base & addr,
const std::vector< cryptonote::block > & blockchain,
const map_hash2tx_t & mtx )

◆ get_confirmed_txs()

void get_confirmed_txs ( const std::vector< cryptonote::block > & blockchain,
const map_hash2tx_t & mtx,
map_hash2tx_t & confirmed_txs )

◆ get_head_block()

cryptonote::block get_head_block ( const std::vector< test_event_entry > & events)

◆ get_test_difficulty()

cryptonote::difficulty_type get_test_difficulty ( const boost::optional< uint8_t > & hf_ver = boost::none)
inline

◆ num_blocks()

uint64_t num_blocks ( const std::vector< test_event_entry > & events)

◆ replay_events_through_core()

template<class t_test_class>
bool replay_events_through_core ( cryptonote::core & cr,
const std::vector< test_event_entry > & events,
t_test_class & validator )
inline

◆ replay_events_through_core_plain()

template<class t_test_class>
bool replay_events_through_core_plain ( cryptonote::core & cr,
const std::vector< test_event_entry > & events,
t_test_class & validator,
bool reinit = true )
inline

◆ replay_events_through_core_validate()

template<class t_test_class>
bool replay_events_through_core_validate ( std::vector< test_event_entry > & events,
cryptonote::core & c )
inline

◆ sum_amount() [1/2]

uint64_t sum_amount ( const std::vector< cryptonote::tx_destination_entry > & destinations)

◆ sum_amount() [2/2]

uint64_t sum_amount ( const std::vector< cryptonote::tx_source_entry > & sources)

◆ trim_block_chain() [1/2]

bool trim_block_chain ( std::vector< const cryptonote::block * > & blockchain,
const crypto::hash & tail )

◆ trim_block_chain() [2/2]

bool trim_block_chain ( std::vector< cryptonote::block > & blockchain,
const crypto::hash & tail )

◆ VARIANT_TAG() [1/6]

VARIANT_TAG ( binary_archive ,
callback_entry ,
0xcb  )

◆ VARIANT_TAG() [2/6]

VARIANT_TAG ( binary_archive ,
cryptonote::account_base ,
0xcc  )

◆ VARIANT_TAG() [3/6]

VARIANT_TAG ( binary_archive ,
event_replay_settings ,
0xda  )

◆ VARIANT_TAG() [4/6]

VARIANT_TAG ( binary_archive ,
event_visitor_settings ,
0xcf  )

◆ VARIANT_TAG() [5/6]

VARIANT_TAG ( binary_archive ,
serialized_block ,
0xcd  )

◆ VARIANT_TAG() [6/6]

VARIANT_TAG ( binary_archive ,
serialized_transaction ,
0xce  )