Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::testing::base_tester Class Referenceabstract

#include <tester.hpp>

Inheritance diagram for sysio::testing::base_tester:
Collaboration diagram for sysio::testing::base_tester:

Public Types

typedef string action_result
 

Public Member Functions

virtual ~base_tester ()
 
void init (const setup_policy policy=setup_policy::full, db_read_mode read_mode=db_read_mode::SPECULATIVE, std::optional< uint32_t > genesis_max_inline_action_size=std::optional< uint32_t >{}, std::optional< uint32_t > config_max_nonprivileged_inline_action_size=std::optional< uint32_t >{})
 
void init (controller::config config, const snapshot_reader_ptr &snapshot)
 
void init (controller::config config, const genesis_state &genesis)
 
void init (controller::config config)
 
void init (controller::config config, protocol_feature_set &&pfs, const snapshot_reader_ptr &snapshot)
 
void init (controller::config config, protocol_feature_set &&pfs, const genesis_state &genesis)
 
void init (controller::config config, protocol_feature_set &&pfs)
 
void execute_setup_policy (const setup_policy policy)
 
void close ()
 
template<typename Lambda >
void open (protocol_feature_set &&pfs, std::optional< chain_id_type > expected_chain_id, Lambda lambda)
 
void open (protocol_feature_set &&pfs, const snapshot_reader_ptr &snapshot)
 
void open (protocol_feature_set &&pfs, const genesis_state &genesis)
 
void open (protocol_feature_set &&pfs, std::optional< chain_id_type > expected_chain_id={})
 
void open (const snapshot_reader_ptr &snapshot)
 
void open (const genesis_state &genesis)
 
void open (std::optional< chain_id_type > expected_chain_id={})
 
bool is_same_chain (base_tester &other)
 
virtual signed_block_ptr produce_block (fc::microseconds skip_time=fc::milliseconds(config::block_interval_ms))=0
 
virtual signed_block_ptr produce_empty_block (fc::microseconds skip_time=fc::milliseconds(config::block_interval_ms))=0
 
virtual signed_block_ptr finish_block ()=0
 
signed_block_ptr produce_block (std::vector< transaction_trace_ptr > &traces)
 
void produce_blocks (uint32_t n=1, bool empty=false)
 
void produce_blocks_until_end_of_round ()
 
void produce_blocks_for_n_rounds (const uint32_t num_of_rounds=1)
 
void produce_min_num_of_blocks_to_spend_time_wo_inactive_prod (const fc::microseconds target_elapsed_time=fc::microseconds())
 
void push_block (signed_block_ptr b)
 
vector< transaction_id_typeget_scheduled_transactions () const
 
unapplied_transaction_queueget_unapplied_transaction_queue ()
 
transaction_trace_ptr push_transaction (packed_transaction &trx, fc::time_point deadline=fc::time_point::maximum(), uint32_t billed_cpu_time_us=DEFAULT_BILLED_CPU_TIME_US)
 
transaction_trace_ptr push_transaction (signed_transaction &trx, fc::time_point deadline=fc::time_point::maximum(), uint32_t billed_cpu_time_us=DEFAULT_BILLED_CPU_TIME_US, bool no_throw=false)
 
action_result push_action (action &&cert_act, uint64_t authorizer)
 
transaction_trace_ptr push_action (const account_name &code, const action_name &acttype, const account_name &actor, const variant_object &data, uint32_t expiration=DEFAULT_EXPIRATION_DELTA, uint32_t delay_sec=0)
 
transaction_trace_ptr push_action (const account_name &code, const action_name &acttype, const vector< account_name > &actors, const variant_object &data, uint32_t expiration=DEFAULT_EXPIRATION_DELTA, uint32_t delay_sec=0)
 
transaction_trace_ptr push_action (const account_name &code, const action_name &acttype, const vector< permission_level > &auths, const variant_object &data, uint32_t expiration=DEFAULT_EXPIRATION_DELTA, uint32_t delay_sec=0)
 
action get_action (account_name code, action_name acttype, vector< permission_level > auths, const variant_object &data) const
 
void set_transaction_headers (transaction &trx, uint32_t expiration=DEFAULT_EXPIRATION_DELTA, uint32_t delay_sec=0) const
 
vector< transaction_trace_ptrcreate_accounts (vector< account_name > names, bool multisig=false, bool include_code=true)
 
void set_before_preactivate_bios_contract ()
 
void set_before_producer_authority_bios_contract ()
 
void set_bios_contract ()
 
vector< producer_authorityget_producer_authorities (const vector< account_name > &producer_names) const
 
transaction_trace_ptr set_producers (const vector< account_name > &producer_names)
 
transaction_trace_ptr set_producer_schedule (const vector< producer_authority > &schedule)
 
transaction_trace_ptr set_producers_legacy (const vector< account_name > &producer_names)
 
void link_authority (account_name account, account_name code, permission_name req, action_name type={})
 
void unlink_authority (account_name account, account_name code, action_name type={})
 
void set_authority (account_name account, permission_name perm, authority auth, permission_name parent, const vector< permission_level > &auths, const vector< private_key_type > &keys)
 
void set_authority (account_name account, permission_name perm, authority auth, permission_name parent=config::owner_name)
 
void delete_authority (account_name account, permission_name perm, const vector< permission_level > &auths, const vector< private_key_type > &keys)
 
void delete_authority (account_name account, permission_name perm)
 
transaction_trace_ptr create_account (account_name name, account_name creator=config::system_account_name, bool multisig=false, bool include_code=true)
 
transaction_trace_ptr push_reqauth (account_name from, const vector< permission_level > &auths, const vector< private_key_type > &keys)
 
transaction_trace_ptr push_reqauth (account_name from, string role, bool multi_sig=false)
 
transaction_trace_ptr push_dummy (account_name from, const string &v="blah", uint32_t billed_cpu_time_us=DEFAULT_BILLED_CPU_TIME_US)
 
transaction_trace_ptr transfer (account_name from, account_name to, asset amount, string memo, account_name currency)
 
transaction_trace_ptr transfer (account_name from, account_name to, string amount, string memo, account_name currency)
 
transaction_trace_ptr issue (account_name to, string amount, account_name currency, string memo)
 
template<typename ObjectType >
const auto & get (const chainbase::oid< ObjectType > &key)
 
template<typename ObjectType , typename IndexBy , typename... Args>
const auto & get (Args &&... args)
 
template<typename ObjectType , typename IndexBy , typename... Args>
const auto * find (Args &&... args)
 
void set_code (account_name name, const char *wast, const private_key_type *signer=nullptr)
 
void set_code (account_name name, const vector< uint8_t > wasm, const private_key_type *signer=nullptr)
 
void set_abi (account_name name, const char *abi_json, const private_key_type *signer=nullptr)
 
bool chain_has_transaction (const transaction_id_type &txid) const
 
const transaction_receiptget_transaction_receipt (const transaction_id_type &txid) const
 
asset get_currency_balance (const account_name &contract, const symbol &asset_symbol, const account_name &account) const
 
vector< char > get_row_by_account (name code, name scope, name table, const account_name &act) const
 
map< account_name, block_id_typeget_last_produced_block_map () const
 
void set_last_produced_block_map (const map< account_name, block_id_type > &lpb)
 
auto get_resolver ()
 
void sync_with (base_tester &other)
 
const table_id_objectfind_table (name code, name scope, name table)
 
template<typename Object >
bool get_table_entry (Object &obj, account_name code, account_name scope, account_name table, uint64_t key, bool require=true)
 
const controller::configget_config () const
 
void schedule_protocol_features_wo_preactivation (const vector< digest_type > feature_digests)
 
void preactivate_protocol_features (const vector< digest_type > feature_digests)
 
void preactivate_builtin_protocol_features (const std::vector< builtin_protocol_feature_t > &features)
 
void preactivate_all_builtin_protocol_features ()
 

Static Public Member Functions

template<typename KeyType = fc::ecc::private_key_shim>
static auto get_private_key (name keyname, string role="owner")
 
template<typename KeyType = fc::ecc::private_key_shim>
static auto get_public_key (name keyname, string role="owner")
 
static vector< uint8_tto_uint8_vector (const string &s)
 
static vector< uint8_tto_uint8_vector (uint64_t x)
 
static uint64_t to_uint64 (fc::variant x)
 
static string to_string (fc::variant x)
 
static action_result success ()
 
static action_result error (const string &msg)
 
static action_result wasm_assert_msg (const string &msg)
 
static action_result wasm_assert_code (uint64_t error_code)
 
static genesis_state default_genesis ()
 
static std::pair< controller::config, genesis_statedefault_config (const fc::temp_directory &tempdir, std::optional< uint32_t > genesis_max_inline_action_size=std::optional< uint32_t >{}, std::optional< uint32_t > config_max_nonprivileged_inline_action_size=std::optional< uint32_t >{})
 

Public Attributes

unique_ptr< controllercontrol
 
std::map< chain::public_key_type, chain::private_key_typeblock_signing_private_keys
 
vector< digest_typeprotocol_features_to_be_activated_wo_preactivation
 

Static Public Attributes

static const uint32_t DEFAULT_EXPIRATION_DELTA = 6
 
static const uint32_t DEFAULT_BILLED_CPU_TIME_US = 2000
 
static const fc::microseconds abi_serializer_max_time {1000*1000}
 

Protected Member Functions

signed_block_ptr _produce_block (fc::microseconds skip_time, bool skip_pending_trxs)
 
signed_block_ptr _produce_block (fc::microseconds skip_time, bool skip_pending_trxs, bool no_throw, std::vector< transaction_trace_ptr > &traces)
 
void _start_block (fc::time_point block_time)
 
signed_block_ptr _finish_block ()
 

Protected Attributes

fc::temp_directory tempdir
 
controller::config cfg
 
map< transaction_id_type, transaction_receiptchain_transactions
 
map< account_name, block_id_typelast_produced_block
 
unapplied_transaction_queue unapplied_transactions
 

Detailed Description

Definition at line 146 of file tester.hpp.

Member Typedef Documentation

◆ action_result

Constructor & Destructor Documentation

◆ ~base_tester()

virtual sysio::testing::base_tester::~base_tester ( )
inlinevirtual

Definition at line 155 of file tester.hpp.

155{};

Member Function Documentation

◆ _finish_block()

signed_block_ptr sysio::testing::base_tester::_finish_block ( )
protected

Definition at line 416 of file tester.cpp.

416 {
417 FC_ASSERT( control->is_building_block(), "must first start a block before it can be finished" );
418
419 auto producer = control->head_block_state()->get_scheduled_producer( control->pending_block_time() );
420 vector<private_key_type> signing_keys;
421
422 auto default_active_key = get_public_key( producer.producer_name, "active");
423 producer.for_each_key([&](const public_key_type& key){
424 const auto& iter = block_signing_private_keys.find(key);
425 if(iter != block_signing_private_keys.end()) {
426 signing_keys.push_back(iter->second);
427 } else if (key == default_active_key) {
428 signing_keys.emplace_back( get_private_key( producer.producer_name, "active") );
429 }
430 });
431
432 control->finalize_block( [&]( digest_type d ) {
433 std::vector<signature_type> result;
434 result.reserve(signing_keys.size());
435 for (const auto& k: signing_keys)
436 result.emplace_back(k.sign(d));
437
438 return result;
439 } );
440
441 control->commit_block();
442 last_produced_block[control->head_block_state()->header.producer] = control->head_block_state()->id;
443
444 return control->head_block_state()->block;
445 }
std::map< chain::public_key_type, chain::private_key_type > block_signing_private_keys
Definition tester.hpp:437
static auto get_private_key(name keyname, string role="owner")
Definition tester.hpp:293
unique_ptr< controller > control
Definition tester.hpp:436
map< account_name, block_id_type > last_produced_block
Definition tester.hpp:441
static auto get_public_key(name keyname, string role="owner")
Definition tester.hpp:303
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
fc::crypto::public_key public_key_type
Definition types.hpp:76
checksum_type digest_type
Definition types.hpp:237
Here is the caller graph for this function:

◆ _produce_block() [1/2]

signed_block_ptr sysio::testing::base_tester::_produce_block ( fc::microseconds skip_time,
bool skip_pending_trxs )
protected

Definition at line 338 of file tester.cpp.

338 {
339 std::vector<transaction_trace_ptr> traces;
340 return _produce_block( skip_time, skip_pending_trxs, false, traces );
341 }
signed_block_ptr _produce_block(fc::microseconds skip_time, bool skip_pending_trxs)
Definition tester.cpp:338
Here is the caller graph for this function:

◆ _produce_block() [2/2]

signed_block_ptr sysio::testing::base_tester::_produce_block ( fc::microseconds skip_time,
bool skip_pending_trxs,
bool no_throw,
std::vector< transaction_trace_ptr > & traces )
protected

Definition at line 343 of file tester.cpp.

344 {
345 auto head = control->head_block_state();
346 auto head_time = control->head_block_time();
347 auto next_time = head_time + skip_time;
348
349 if( !control->is_building_block() || control->pending_block_time() != next_time ) {
350 _start_block( next_time );
351 }
352
353 if( !skip_pending_trxs ) {
354 for( auto itr = unapplied_transactions.begin(); itr != unapplied_transactions.end(); ) {
355 auto trace = control->push_transaction( itr->trx_meta, fc::time_point::maximum(), fc::microseconds::maximum(), DEFAULT_BILLED_CPU_TIME_US, true, 0 );
356 traces.emplace_back( trace );
357 if(!no_throw && trace->except) {
358 // this always throws an fc::exception, since the original exception is copied into an fc::exception
359 trace->except->dynamic_rethrow_exception();
360 }
361 itr = unapplied_transactions.erase( itr );
362 }
363
364 vector<transaction_id_type> scheduled_trxs;
365 while ((scheduled_trxs = get_scheduled_transactions()).size() > 0 ) {
366 for( const auto& trx : scheduled_trxs ) {
367 auto trace = control->push_scheduled_transaction( trx, fc::time_point::maximum(), fc::microseconds::maximum(), DEFAULT_BILLED_CPU_TIME_US, true );
368 traces.emplace_back( trace );
369 if( !no_throw && trace->except ) {
370 // this always throws an fc::exception, since the original exception is copied into an fc::exception
371 trace->except->dynamic_rethrow_exception();
372 }
373 }
374 }
375 }
376
377 auto head_block = _finish_block();
378
379 _start_block( next_time + fc::microseconds(config::block_interval_us));
380 return head_block;
381 }
static constexpr microseconds maximum()
Definition time.hpp:14
static constexpr time_point maximum()
Definition time.hpp:46
iterator erase(iterator itr)
caller's responsibility to call next() if applicable
static const uint32_t DEFAULT_BILLED_CPU_TIME_US
Definition tester.hpp:152
vector< transaction_id_type > get_scheduled_transactions() const
Definition tester.cpp:461
void _start_block(fc::time_point block_time)
Definition tester.cpp:383
unapplied_transaction_queue unapplied_transactions
Definition tester.hpp:442
signed_block_ptr _finish_block()
Definition tester.cpp:416
Here is the call graph for this function:

◆ _start_block()

void sysio::testing::base_tester::_start_block ( fc::time_point block_time)
protected

Definition at line 383 of file tester.cpp.

383 {
384 auto head_block_number = control->head_block_num();
385 auto producer = control->head_block_state()->get_scheduled_producer(block_time);
386
387 auto last_produced_block_num = control->last_irreversible_block_num();
388 auto itr = last_produced_block.find(producer.producer_name);
389 if (itr != last_produced_block.end()) {
390 last_produced_block_num = std::max(control->last_irreversible_block_num(), block_header::num_from_id(itr->second));
391 }
392
394
395 vector<digest_type> feature_to_be_activated;
396 // First add protocol features to be activated WITHOUT preactivation
397 feature_to_be_activated.insert(
398 feature_to_be_activated.end(),
401 );
402 // Then add protocol features to be activated WITH preactivation
403 const auto preactivated_protocol_features = control->get_preactivated_protocol_features();
404 feature_to_be_activated.insert(
405 feature_to_be_activated.end(),
406 preactivated_protocol_features.begin(),
407 preactivated_protocol_features.end()
408 );
409
410 control->start_block( block_time, head_block_number - last_produced_block_num, feature_to_be_activated );
411
412 // Clear the list, if start block finishes successfuly, the protocol features should be assumed to be activated
414 }
void add_aborted(std::vector< transaction_metadata_ptr > aborted_trxs)
vector< digest_type > protocol_features_to_be_activated_wo_preactivation
Definition tester.hpp:445
static uint32_t num_from_id(const block_id_type &id)
Here is the call graph for this function:

◆ chain_has_transaction()

bool sysio::testing::base_tester::chain_has_transaction ( const transaction_id_type & txid) const

Definition at line 953 of file tester.cpp.

953 {
954 return chain_transactions.count(txid) != 0;
955 }
map< transaction_id_type, transaction_receipt > chain_transactions
Definition tester.hpp:440

◆ close()

void sysio::testing::base_tester::close ( )

Definition at line 255 of file tester.cpp.

255 {
256 control.reset();
257 chain_transactions.clear();
258 }

◆ create_account()

transaction_trace_ptr sysio::testing::base_tester::create_account ( account_name name,
account_name creator = config::system_account_name,
bool multisig = false,
bool include_code = true )

Definition at line 516 of file tester.cpp.

516 {
517 signed_transaction trx;
519
520 authority owner_auth;
521 if( multisig ) {
522 // multisig between account's owner key and creators active permission
523 owner_auth = authority(2, {key_weight{get_public_key( a, "owner" ), 1}}, {permission_level_weight{{creator, config::active_name}, 1}});
524 } else {
525 owner_auth = authority( get_public_key( a, "owner" ) );
526 }
527
528 authority active_auth( get_public_key( a, "active" ) );
529
530 auto sort_permissions = []( authority& auth ) {
531 std::sort( auth.accounts.begin(), auth.accounts.end(),
532 []( const permission_level_weight& lhs, const permission_level_weight& rhs ) {
533 return lhs.permission < rhs.permission;
534 }
535 );
536 };
537
538 if( include_code ) {
539 FC_ASSERT( owner_auth.threshold <= std::numeric_limits<weight_type>::max(), "threshold is too high" );
540 FC_ASSERT( active_auth.threshold <= std::numeric_limits<weight_type>::max(), "threshold is too high" );
541 owner_auth.accounts.push_back( permission_level_weight{ {a, config::sysio_code_name},
542 static_cast<weight_type>(owner_auth.threshold) } );
543 sort_permissions(owner_auth);
544 active_auth.accounts.push_back( permission_level_weight{ {a, config::sysio_code_name},
545 static_cast<weight_type>(active_auth.threshold) } );
546 sort_permissions(active_auth);
547 }
548
549 trx.actions.emplace_back( vector<permission_level>{{creator,config::active_name}},
550 newaccount{
551 .creator = creator,
552 .name = a,
553 .owner = owner_auth,
554 .active = active_auth,
555 });
556
558 trx.sign( get_private_key( creator, "active" ), control->get_chain_id() );
559 return push_transaction( trx );
560 }
transaction_trace_ptr push_transaction(packed_transaction &trx, fc::time_point deadline=fc::time_point::maximum(), uint32_t billed_cpu_time_us=DEFAULT_BILLED_CPU_TIME_US)
Definition tester.cpp:562
void set_transaction_headers(transaction &trx, uint32_t expiration=DEFAULT_EXPIRATION_DELTA, uint32_t delay_sec=0) const
Definition tester.cpp:506
uint16_t weight_type
Definition types.hpp:238
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_accounts()

vector< transaction_trace_ptr > sysio::testing::base_tester::create_accounts ( vector< account_name > names,
bool multisig = false,
bool include_code = true )
inline

Definition at line 234 of file tester.hpp.

238 {
239 vector<transaction_trace_ptr> traces;
240 traces.reserve(names.size());
241 for( auto n : names ) traces.emplace_back( create_account( n, config::system_account_name, multisig, include_code ) );
242 return traces;
243 }
transaction_trace_ptr create_account(account_name name, account_name creator=config::system_account_name, bool multisig=false, bool include_code=true)
Definition tester.cpp:516
Here is the call graph for this function:

◆ default_config()

static std::pair< controller::config, genesis_state > sysio::testing::base_tester::default_config ( const fc::temp_directory & tempdir,
std::optional< uint32_t > genesis_max_inline_action_size = std::optional<uint32_t>{},
std::optional< uint32_t > config_max_nonprivileged_inline_action_size = std::optional<uint32_t>{} )
inlinestatic

Definition at line 396 of file tester.hpp.

396 {}, std::optional<uint32_t> config_max_nonprivileged_inline_action_size = std::optional<uint32_t>{}) {
397 controller::config cfg;
398 cfg.blocks_dir = tempdir.path() / config::default_blocks_dir_name;
399 cfg.state_dir = tempdir.path() / config::default_state_dir_name;
400 cfg.state_size = 1024*1024*16;
402 cfg.contracts_console = true;
403 cfg.eosvmoc_config.cache_size = 1024*1024*8;
404
405 for(int i = 0; i < boost::unit_test::framework::master_test_suite().argc; ++i) {
406 if(boost::unit_test::framework::master_test_suite().argv[i] == std::string("--sys-vm"))
407 cfg.wasm_runtime = chain::wasm_interface::vm_type::eos_vm;
408 else if(boost::unit_test::framework::master_test_suite().argv[i] == std::string("--sys-vm-jit"))
409 cfg.wasm_runtime = chain::wasm_interface::vm_type::eos_vm_jit;
410 else if(boost::unit_test::framework::master_test_suite().argv[i] == std::string("--sys-vm-oc"))
411 cfg.wasm_runtime = chain::wasm_interface::vm_type::eos_vm_oc;
412 }
413 auto gen = default_genesis();
414 if (genesis_max_inline_action_size) {
415 gen.initial_configuration.max_inline_action_size = *genesis_max_inline_action_size;
416 }
417 if (config_max_nonprivileged_inline_action_size) {
418 cfg.max_nonprivileged_inline_action_size = *config_max_nonprivileged_inline_action_size;
419 }
420 return {cfg, gen};
421 }
const fc::path & path() const
static genesis_state default_genesis()
Definition tester.hpp:388
controller::config cfg
Definition tester.hpp:439
fc::temp_directory tempdir
Definition tester.hpp:434
char ** argv
wasm_interface::vm_type wasm_runtime
Here is the caller graph for this function:

◆ default_genesis()

static genesis_state sysio::testing::base_tester::default_genesis ( )
inlinestatic

Definition at line 388 of file tester.hpp.

388 {
389 genesis_state genesis;
390 genesis.initial_timestamp = fc::time_point::from_iso_string("2020-01-01T00:00:00.000");
391 genesis.initial_key = get_public_key( config::system_account_name, "active" );
392
393 return genesis;
394 }
static time_point from_iso_string(const fc::string &s)
Definition time.cpp:67
Here is the call graph for this function:
Here is the caller graph for this function:

◆ delete_authority() [1/2]

void sysio::testing::base_tester::delete_authority ( account_name account,
permission_name perm )

Definition at line 903 of file tester.cpp.

904 {
905 delete_authority(account, perm, { permission_level{ account, config::owner_name } }, { get_private_key( account, "owner" ) });
906 }
void delete_authority(account_name account, permission_name perm, const vector< permission_level > &auths, const vector< private_key_type > &keys)
Definition tester.cpp:886

◆ delete_authority() [2/2]

void sysio::testing::base_tester::delete_authority ( account_name account,
permission_name perm,
const vector< permission_level > & auths,
const vector< private_key_type > & keys )

Definition at line 886 of file tester.cpp.

889 { try {
890 signed_transaction trx;
891 trx.actions.emplace_back( auths,
892 deleteauth(account, perm) );
893
895 for (const auto& key: keys) {
896 trx.sign( key, control->get_chain_id() );
897 }
898
899 push_transaction( trx );
900 } FC_CAPTURE_AND_RETHROW( (account)(perm) ) }
#define FC_CAPTURE_AND_RETHROW(...)
Here is the call graph for this function:

◆ error()

static action_result sysio::testing::base_tester::error ( const string & msg)
inlinestatic

Definition at line 333 of file tester.hpp.

333{ return msg; }

◆ execute_setup_policy()

void sysio::testing::base_tester::execute_setup_policy ( const setup_policy policy)

Definition at line 192 of file tester.cpp.

192 {
193 const auto& pfm = control->get_protocol_feature_manager();
194
195 auto schedule_preactivate_protocol_feature = [&]() {
196 auto preactivate_feature_digest = pfm.get_builtin_digest(builtin_protocol_feature_t::preactivate_feature);
197 FC_ASSERT( preactivate_feature_digest, "PREACTIVATE_FEATURE not found" );
198 schedule_protocol_features_wo_preactivation( { *preactivate_feature_digest } );
199 };
200
201 switch (policy) {
204 break;
205 }
207 schedule_preactivate_protocol_feature();
208 produce_block(); // block production is required to activate protocol feature
209 break;
210 }
212 schedule_preactivate_protocol_feature();
215 break;
216 }
218 schedule_preactivate_protocol_feature();
222 builtin_protocol_feature_t::only_link_to_existing_permission,
223 builtin_protocol_feature_t::replace_deferred,
224 builtin_protocol_feature_t::no_duplicate_deferred_id,
225 builtin_protocol_feature_t::fix_linkauth_restriction,
226 builtin_protocol_feature_t::disallow_empty_producer_schedule,
227 builtin_protocol_feature_t::restrict_action_to_self,
228 builtin_protocol_feature_t::only_bill_first_authorizer,
229 builtin_protocol_feature_t::forward_setcode,
230 builtin_protocol_feature_t::get_sender,
231 builtin_protocol_feature_t::ram_restrictions,
232 builtin_protocol_feature_t::webauthn_key,
233 builtin_protocol_feature_t::wtmsig_block_signatures,
234 builtin_protocol_feature_t::em_key
235 });
238 break;
239 }
240 case setup_policy::full: {
241 schedule_preactivate_protocol_feature();
247 break;
248 }
250 default:
251 break;
252 };
253 }
virtual signed_block_ptr produce_block(fc::microseconds skip_time=fc::milliseconds(config::block_interval_ms))=0
void set_before_preactivate_bios_contract()
Definition tester.cpp:1063
void preactivate_all_builtin_protocol_features()
Definition tester.cpp:1158
void preactivate_builtin_protocol_features(const std::vector< builtin_protocol_feature_t > &features)
Definition tester.cpp:1145
void set_before_producer_authority_bios_contract()
Definition tester.cpp:1068
void schedule_protocol_features_wo_preactivation(const vector< digest_type > feature_digests)
Definition tester.cpp:1130
Here is the call graph for this function:
Here is the caller graph for this function:

◆ find()

template<typename ObjectType , typename IndexBy , typename... Args>
const auto * sysio::testing::base_tester::find ( Args &&... args)
inline

Definition at line 288 of file tester.hpp.

288 {
289 return control->db().find<ObjectType,IndexBy>( forward<Args>(args)... );
290 }

◆ find_table()

const table_id_object * sysio::testing::base_tester::find_table ( name code,
name scope,
name table )

Definition at line 1125 of file tester.cpp.

1125 {
1126 auto tid = control->db().find<table_id_object, by_code_scope_table>(boost::make_tuple(code, scope, table));
1127 return tid;
1128 }
Here is the caller graph for this function:

◆ finish_block()

virtual signed_block_ptr sysio::testing::base_tester::finish_block ( )
pure virtual

◆ get() [1/2]

template<typename ObjectType , typename IndexBy , typename... Args>
const auto & sysio::testing::base_tester::get ( Args &&... args)
inline

Definition at line 283 of file tester.hpp.

283 {
284 return control->db().get<ObjectType,IndexBy>( forward<Args>(args)... );
285 }

◆ get() [2/2]

template<typename ObjectType >
const auto & sysio::testing::base_tester::get ( const chainbase::oid< ObjectType > & key)
inline

Definition at line 278 of file tester.hpp.

278 {
279 return control->db().get<ObjectType>(key);
280 }
uint8_t key[16]
Definition yubico_otp.c:41

◆ get_action()

action sysio::testing::base_tester::get_action ( account_name code,
action_name acttype,
vector< permission_level > auths,
const variant_object & data ) const

Definition at line 680 of file tester.cpp.

681 { try {
682 const auto& acnt = control->get_account(code);
683 auto abi = acnt.get_abi();
684 chain::abi_serializer abis(abi, abi_serializer::create_yield_function( abi_serializer_max_time ));
685
686 string action_type_name = abis.get_action_type(acttype);
687 FC_ASSERT( action_type_name != string(), "unknown action type ${a}", ("a",acttype) );
688
689
690 action act;
691 act.account = code;
692 act.name = acttype;
693 act.authorization = auths;
694 act.data = abis.variant_to_binary(action_type_name, data, abi_serializer::create_yield_function( abi_serializer_max_time ));
695 return act;
static const fc::microseconds abi_serializer_max_time
Definition tester.hpp:153
static yield_function_t create_yield_function(const fc::microseconds &max_serialization_time)
Here is the call graph for this function:

◆ get_config()

const controller::config & sysio::testing::base_tester::get_config ( ) const
inline

Definition at line 379 of file tester.hpp.

379 {
380 return cfg;
381 }

◆ get_currency_balance()

asset sysio::testing::base_tester::get_currency_balance ( const account_name & code,
const symbol & asset_symbol,
const account_name & account ) const

Reads balance as stored by generic_currency contract

Definition at line 966 of file tester.cpp.

968 {
969 const auto& db = control->db();
970 const auto* tbl = db.template find<table_id_object, by_code_scope_table>(boost::make_tuple(code, account, "accounts"_n));
971 share_type result = 0;
972
973 // the balance is implied to be 0 if either the table or row does not exist
974 if (tbl) {
975 const auto *obj = db.template find<key_value_object, by_scope_primary>(boost::make_tuple(tbl->id, asset_symbol.to_symbol_code().value));
976 if (obj) {
977 //balance is the first field in the serialization
978 fc::datastream<const char *> ds(obj->value.data(), obj->value.size());
979 fc::raw::unpack(ds, result);
980 }
981 }
982 return asset(result, asset_symbol);
983 }
const auto * find(Args &&... args)
Definition tester.hpp:288
const struct Ptn tbl[]
static const Segment ds(Segment::ds)
void unpack(Stream &s, std::deque< T > &value)
Definition raw.hpp:540
int64_t share_type
Definition types.hpp:240
Here is the call graph for this function:

◆ get_last_produced_block_map()

map< account_name, block_id_type > sysio::testing::base_tester::get_last_produced_block_map ( ) const
inline

Definition at line 320 of file tester.hpp.

320{ return last_produced_block; };

◆ get_private_key()

template<typename KeyType = fc::ecc::private_key_shim>
static auto sysio::testing::base_tester::get_private_key ( name keyname,
string role = "owner" )
inlinestatic

Definition at line 293 of file tester.hpp.

293 {
294 auto secret = fc::sha256::hash(keyname.to_string() + role);
295 if constexpr (std::is_same_v<KeyType, mock::webauthn_private_key>) {
297 } else {
299 }
300 }
static private_key regenerate(const typename KeyType::data_type &data)
static sha256 hash(const char *d, uint32_t dlen)
Definition sha256.cpp:44
static auto regenerate(const fc::sha256 &secret)
Definition tester.hpp:100
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_producer_authorities()

vector< producer_authority > sysio::testing::base_tester::get_producer_authorities ( const vector< account_name > & producer_names) const

Definition at line 1079 of file tester.cpp.

1079 {
1080 // Create producer schedule
1081 vector<producer_authority> schedule;
1082 for (auto& producer_name: producer_names) {
1083 schedule.emplace_back(producer_authority{ producer_name, block_signing_authority_v0{1, {{ get_public_key( producer_name, "active" ), 1}} } });
1084 }
1085 return schedule;
1086 }
producer_name(block_signing_key)) FC_REFLECT(producer_set_def
Here is the call graph for this function:

◆ get_public_key()

template<typename KeyType = fc::ecc::private_key_shim>
static auto sysio::testing::base_tester::get_public_key ( name keyname,
string role = "owner" )
inlinestatic

Definition at line 303 of file tester.hpp.

303 {
304 return get_private_key<KeyType>( keyname, role ).get_public_key();
305 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_resolver()

auto sysio::testing::base_tester::get_resolver ( )
inline

Definition at line 339 of file tester.hpp.

339 {
340 return [this]( const account_name& name ) -> std::optional<abi_serializer> {
341 try {
342 const auto& accnt = control->db().get<account_object, by_name>( name );
343 abi_def abi;
344 if( abi_serializer::to_abi( accnt.abi, abi )) {
345 return abi_serializer( abi, abi_serializer::create_yield_function( abi_serializer_max_time ) );
346 }
347 return std::optional<abi_serializer>();
348 } FC_RETHROW_EXCEPTIONS( error, "Failed to find or parse ABI for ${name}", ("name", name))
349 };
350 }
std::string name
#define FC_RETHROW_EXCEPTIONS(LOG_LEVEL, FORMAT,...)
Catchs all exception's, std::exceptions, and ... and rethrows them after appending the provided log m...
name account_name
Definition types.hpp:120
static bool to_abi(const Vec &abi_vec, abi_def &abi)
Here is the call graph for this function:

◆ get_row_by_account()

vector< char > sysio::testing::base_tester::get_row_by_account ( name code,
name scope,
name table,
const account_name & act ) const

Definition at line 986 of file tester.cpp.

986 {
987 vector<char> data;
988 const auto& db = control->db();
989 const auto* t_id = db.find<chain::table_id_object, chain::by_code_scope_table>( boost::make_tuple( code, scope, table ) );
990 if ( !t_id ) {
991 return data;
992 }
993 //FC_ASSERT( t_id != 0, "object not found" );
994
995 const auto& idx = db.get_index<chain::key_value_index, chain::by_scope_primary>();
996
997 auto itr = idx.lower_bound( boost::make_tuple( t_id->id, act.to_uint64_t() ) );
998 if ( itr == idx.end() || itr->t_id != t_id->id || act.to_uint64_t() != itr->primary_key ) {
999 return data;
1000 }
1001
1002 data.resize( itr->value.size() );
1003 memcpy( data.data(), itr->value.data(), data.size() );
1004 return data;
1005 }
chainbase::shared_multi_index_container< key_value_object, indexed_by< ordered_unique< tag< by_id >, member< key_value_object, key_value_object::id_type, &key_value_object::id > >, ordered_unique< tag< by_scope_primary >, composite_key< key_value_object, member< key_value_object, table_id, &key_value_object::t_id >, member< key_value_object, uint64_t, &key_value_object::primary_key > >, composite_key_compare< std::less< table_id >, std::less< uint64_t > > > > > key_value_index
memcpy((char *) pInfo->slotDescription, s, l)
Here is the call graph for this function:

◆ get_scheduled_transactions()

vector< transaction_id_type > sysio::testing::base_tester::get_scheduled_transactions ( ) const

These transaction IDs represent transactions available in the head chain state as scheduled or otherwise generated transactions.

calling push_scheduled_transaction with these IDs will remove the associated transaction from the chain state IFF it succeeds or objectively fails

Returns

Definition at line 461 of file tester.cpp.

461 {
462 const auto& idx = control->db().get_index<generated_transaction_multi_index,by_delay>();
463
464 vector<transaction_id_type> result;
465
466 auto itr = idx.begin();
467 while( itr != idx.end() && itr->delay_until <= control->pending_block_time() ) {
468 result.emplace_back(itr->trx_id);
469 ++itr;
470 }
471 return result;
472 }
chainbase::shared_multi_index_container< generated_transaction_object, indexed_by< ordered_unique< tag< by_id >, BOOST_MULTI_INDEX_MEMBER(generated_transaction_object, generated_transaction_object::id_type, id)>, ordered_unique< tag< by_trx_id >, BOOST_MULTI_INDEX_MEMBER(generated_transaction_object, transaction_id_type, trx_id)>, ordered_unique< tag< by_expiration >, composite_key< generated_transaction_object, BOOST_MULTI_INDEX_MEMBER(generated_transaction_object, time_point, expiration), > >, ordered_unique< tag< by_delay >, composite_key< generated_transaction_object, BOOST_MULTI_INDEX_MEMBER(generated_transaction_object, time_point, delay_until), > >, ordered_unique< tag< by_sender_id >, composite_key< generated_transaction_object, BOOST_MULTI_INDEX_MEMBER(generated_transaction_object, account_name, sender), > > > > generated_transaction_multi_index

◆ get_table_entry()

template<typename Object >
bool sysio::testing::base_tester::get_table_entry ( Object & obj,
account_name code,
account_name scope,
account_name table,
uint64_t key,
bool require = true )
inline

Definition at line 358 of file tester.hpp.

358 {
359 auto* maybe_tid = find_table(code, scope, table);
360 if( maybe_tid == nullptr ) {
361 BOOST_FAIL( "table for code=\"" + code.to_string()
362 + "\" scope=\"" + scope.to_string()
363 + "\" table=\"" + table.to_string()
364 + "\" does not exist" );
365 }
366
367 auto* o = control->db().find<key_value_object, by_scope_primary>(boost::make_tuple(maybe_tid->id, key));
368 if( o == nullptr ) {
369 if( require )
370 BOOST_FAIL("object does not exist for primary_key=\"" + name(key).to_string() + "\"");
371
372 return false;
373 }
374
375 fc::raw::unpack(o->value.data(), o->value.size(), obj);
376 return true;
377 }
static string to_string(fc::variant x)
Definition tester.cpp:1030
const table_id_object * find_table(name code, name scope, name table)
Definition tester.cpp:1125
Here is the call graph for this function:

◆ get_transaction_receipt()

const transaction_receipt & sysio::testing::base_tester::get_transaction_receipt ( const transaction_id_type & txid) const

Definition at line 958 of file tester.cpp.

958 {
959 return chain_transactions.at(txid);
960 }

◆ get_unapplied_transaction_queue()

unapplied_transaction_queue & sysio::testing::base_tester::get_unapplied_transaction_queue ( )
inline

Definition at line 199 of file tester.hpp.

199{ return unapplied_transactions; }

◆ init() [1/7]

void sysio::testing::base_tester::init ( const setup_policy policy = setup_policy::full,
db_read_mode read_mode = db_read_mode::SPECULATIVE,
std::optional< uint32_t > genesis_max_inline_action_size = std::optional<uint32_t>{},
std::optional< uint32_t > config_max_nonprivileged_inline_action_size = std::optional<uint32_t>{} )

Definition at line 153 of file tester.cpp.

153 {
154 auto def_conf = default_config(tempdir, genesis_max_inline_action_size, config_max_nonprivileged_inline_action_size);
155 def_conf.first.read_mode = read_mode;
156 cfg = def_conf.first;
157
158 open(def_conf.second);
159 execute_setup_policy(policy);
160 }
static std::pair< controller::config, genesis_state > default_config(const fc::temp_directory &tempdir, std::optional< uint32_t > genesis_max_inline_action_size=std::optional< uint32_t >{}, std::optional< uint32_t > config_max_nonprivileged_inline_action_size=std::optional< uint32_t >{})
Definition tester.hpp:396
void execute_setup_policy(const setup_policy policy)
Definition tester.cpp:192
void open(protocol_feature_set &&pfs, std::optional< chain_id_type > expected_chain_id, Lambda lambda)
Definition tester.cpp:273
Here is the call graph for this function:

◆ init() [2/7]

void sysio::testing::base_tester::init ( controller::config config)

Definition at line 172 of file tester.cpp.

172 {
173 cfg = config;
174 open(default_genesis().compute_chain_id());
175 }
Here is the call graph for this function:

◆ init() [3/7]

void sysio::testing::base_tester::init ( controller::config config,
const genesis_state & genesis )

Definition at line 167 of file tester.cpp.

167 {
168 cfg = config;
169 open(genesis);
170 }
Here is the call graph for this function:

◆ init() [4/7]

void sysio::testing::base_tester::init ( controller::config config,
const snapshot_reader_ptr & snapshot )

Definition at line 162 of file tester.cpp.

162 {
163 cfg = config;
164 open(snapshot);
165 }
Here is the call graph for this function:

◆ init() [5/7]

void sysio::testing::base_tester::init ( controller::config config,
protocol_feature_set && pfs )

Definition at line 187 of file tester.cpp.

187 {
188 cfg = config;
189 open(std::move(pfs), default_genesis().compute_chain_id());
190 }
Here is the call graph for this function:

◆ init() [6/7]

void sysio::testing::base_tester::init ( controller::config config,
protocol_feature_set && pfs,
const genesis_state & genesis )

Definition at line 182 of file tester.cpp.

182 {
183 cfg = config;
184 open(std::move(pfs), genesis);
185 }
Here is the call graph for this function:

◆ init() [7/7]

void sysio::testing::base_tester::init ( controller::config config,
protocol_feature_set && pfs,
const snapshot_reader_ptr & snapshot )

Definition at line 177 of file tester.cpp.

177 {
178 cfg = config;
179 open(std::move(pfs), snapshot);
180 }
Here is the call graph for this function:

◆ is_same_chain()

bool sysio::testing::base_tester::is_same_chain ( base_tester & other)

Definition at line 149 of file tester.cpp.

149 {
150 return control->head_block_id() == other.control->head_block_id();
151 }

◆ issue()

transaction_trace_ptr sysio::testing::base_tester::issue ( account_name to,
string amount,
account_name currency,
string memo )

Definition at line 800 of file tester.cpp.

800 {
802 ("actions", fc::variants({
804 ("account", currency)
805 ("name", "issue")
806 ("authorization", fc::variants({
808 ("actor", currency )
809 ("permission", name(config::active_name))
810 }))
812 ("to", to)
813 ("quantity", amount)
814 ("memo", memo)
815 )
816 })
817 );
818
819 signed_transaction trx;
822
823 trx.sign( get_private_key( currency, name(config::active_name).to_string() ), control->get_chain_id() );
824 return push_transaction( trx );
825 }
An order-preserving dictionary of variants.
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
Definition variant.hpp:191
std::vector< fc::variant > variants
Definition variant.hpp:173
static void from_variant(const fc::variant &v, T &o, Resolver resolver, const yield_function_t &yield)
Here is the call graph for this function:

◆ link_authority()

void sysio::testing::base_tester::link_authority ( account_name account,
account_name code,
permission_name req,
action_name type = {} )

Definition at line 828 of file tester.cpp.

828 {
829 signed_transaction trx;
830
831 trx.actions.emplace_back( vector<permission_level>{{account, config::active_name}},
832 linkauth(account, code, type, req));
834 trx.sign( get_private_key( account, "active" ), control->get_chain_id() );
835
836 push_transaction( trx );
837 }
Here is the call graph for this function:

◆ open() [1/7]

void sysio::testing::base_tester::open ( const genesis_state & genesis)

Definition at line 264 of file tester.cpp.

264 {
265 open( make_protocol_feature_set(), genesis );
266 }
protocol_feature_set make_protocol_feature_set(const subjective_restriction_map &custom_subjective_restrictions={})
Definition tester.cpp:110
Here is the call graph for this function:

◆ open() [2/7]

void sysio::testing::base_tester::open ( const snapshot_reader_ptr & snapshot)

Definition at line 260 of file tester.cpp.

260 {
261 open( make_protocol_feature_set(), snapshot );
262 }
Here is the call graph for this function:

◆ open() [3/7]

void sysio::testing::base_tester::open ( protocol_feature_set && pfs,
const genesis_state & genesis )

Definition at line 311 of file tester.cpp.

311 {
312 open(std::move(pfs), genesis.compute_chain_id(), [&genesis,&control=this->control]() {
313 control->startup( [](){}, []() { return false; }, genesis );
314 });
315 }
Here is the call graph for this function:

◆ open() [4/7]

void sysio::testing::base_tester::open ( protocol_feature_set && pfs,
const snapshot_reader_ptr & snapshot )

Definition at line 303 of file tester.cpp.

303 {
304 const auto& snapshot_chain_id = controller::extract_chain_id( *snapshot );
305 snapshot->return_to_header();
306 open(std::move(pfs), snapshot_chain_id, [&snapshot,&control=this->control]() {
307 control->startup( [](){}, []() { return false; }, snapshot );
308 });
309 }
static chain_id_type extract_chain_id(snapshot_reader &snapshot)
Here is the call graph for this function:

◆ open() [5/7]

template<typename Lambda >
void sysio::testing::base_tester::open ( protocol_feature_set && pfs,
std::optional< chain_id_type > expected_chain_id,
Lambda lambda )

Definition at line 273 of file tester.cpp.

273 {
274 if( !expected_chain_id ) {
276 if( !expected_chain_id ) {
277 if( fc::is_regular_file( cfg.blocks_dir / "blocks.log" ) ) {
278 expected_chain_id = block_log::extract_chain_id( cfg.blocks_dir );
279 } else {
280 expected_chain_id = genesis_state().compute_chain_id();
281 }
282 }
283 }
284
285 control.reset( new controller(cfg, std::move(pfs), *expected_chain_id) );
286 control->add_indices();
287 lambda();
288 chain_transactions.clear();
289 control->accepted_block.connect([this]( const block_state_ptr& block_state ){
290 FC_ASSERT( block_state->block );
291 for( auto receipt : block_state->block->transactions ) {
292 if( std::holds_alternative<packed_transaction>(receipt.trx) ) {
293 auto &pt = std::get<packed_transaction>(receipt.trx);
294 chain_transactions[pt.get_transaction().id()] = std::move(receipt);
295 } else {
296 auto& id = std::get<transaction_id_type>(receipt.trx);
297 chain_transactions[id] = std::move(receipt);
298 }
299 }
300 });
301 }
static chain_id_type extract_chain_id(const fc::path &data_dir)
static std::optional< chain_id_type > extract_chain_id_from_db(const path &state_dir)
uint64_t id
Definition code_cache.cpp:0
bool is_regular_file(const path &p)
std::shared_ptr< block_state > block_state_ptr
Here is the call graph for this function:
Here is the caller graph for this function:

◆ open() [6/7]

void sysio::testing::base_tester::open ( protocol_feature_set && pfs,
std::optional< chain_id_type > expected_chain_id = {} )

Definition at line 317 of file tester.cpp.

317 {
318 open(std::move(pfs), expected_chain_id, [&control=this->control]() {
319 control->startup( [](){}, []() { return false; } );
320 });
321 }

◆ open() [7/7]

void sysio::testing::base_tester::open ( std::optional< chain_id_type > expected_chain_id = {})

Definition at line 268 of file tester.cpp.

268 {
269 open( make_protocol_feature_set(), expected_chain_id );
270 }
Here is the call graph for this function:

◆ preactivate_all_builtin_protocol_features()

void sysio::testing::base_tester::preactivate_all_builtin_protocol_features ( )

Definition at line 1158 of file tester.cpp.

1158 {
1159 const auto& pfm = control->get_protocol_feature_manager();
1160 const auto& pfs = pfm.get_protocol_feature_set();
1161 const auto current_block_num = control->head_block_num() + (control->is_building_block() ? 1 : 0);
1162 const auto current_block_time = ( control->is_building_block() ? control->pending_block_time()
1163 : control->head_block_time() + fc::milliseconds(config::block_interval_ms) );
1164
1165 set<digest_type> preactivation_set;
1166 vector<digest_type> preactivations;
1167
1168 std::function<void(const digest_type&)> add_digests =
1169 [&pfm, &pfs, current_block_num, current_block_time, &preactivation_set, &preactivations, &add_digests]
1170 ( const digest_type& feature_digest ) {
1171 const auto& pf = pfs.get_protocol_feature( feature_digest );
1172 FC_ASSERT( pf.builtin_feature, "called add_digests on a non-builtin protocol feature" );
1173 if( !pf.enabled || pf.earliest_allowed_activation_time > current_block_time
1174 || pfm.is_builtin_activated( *pf.builtin_feature, current_block_num ) ) return;
1175
1176 auto res = preactivation_set.emplace( feature_digest );
1177 if( !res.second ) return;
1178
1179 for( const auto& dependency : pf.dependencies ) {
1180 add_digests( dependency );
1181 }
1182
1183 preactivations.emplace_back( feature_digest );
1184 };
1185
1186 std::vector<builtin_protocol_feature_t> ordered_builtins;
1187 for( const auto& f : builtin_protocol_feature_codenames ) {
1188 ordered_builtins.push_back( f.first );
1189 }
1190 std::sort( ordered_builtins.begin(), ordered_builtins.end() );
1191 for( const auto& f : ordered_builtins ) {
1192 auto digest = pfs.get_builtin_digest( f);
1193 if( !digest ) continue;
1194 add_digests( *digest );
1195 }
1196
1197 preactivate_protocol_features( preactivations );
1198 }
void preactivate_protocol_features(const vector< digest_type > feature_digests)
Definition tester.cpp:1138
fc::sha256 digest(const T &value)
Definition digest.hpp:9
constexpr microseconds milliseconds(int64_t s)
Definition time.hpp:33
const std::unordered_map< builtin_protocol_feature_t, builtin_protocol_feature_spec, enum_hash< builtin_protocol_feature_t > > builtin_protocol_feature_codenames
Here is the call graph for this function:
Here is the caller graph for this function:

◆ preactivate_builtin_protocol_features()

void sysio::testing::base_tester::preactivate_builtin_protocol_features ( const std::vector< builtin_protocol_feature_t > & features)

Definition at line 1145 of file tester.cpp.

1145 {
1146 const auto& pfs = control->get_protocol_feature_manager().get_protocol_feature_set();
1147
1148 // This behavior is disabled by configurable_wasm_limits
1149 std::vector<digest_type> features;
1150 for(builtin_protocol_feature_t feature : builtin_features ) {
1151 if( auto digest = pfs.get_builtin_digest( feature ) ) {
1152 features.push_back( *digest );
1153 }
1154 }
1156 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ preactivate_protocol_features()

void sysio::testing::base_tester::preactivate_protocol_features ( const vector< digest_type > feature_digests)

Definition at line 1138 of file tester.cpp.

1138 {
1139 for( const auto& feature_digest: feature_digests ) {
1140 push_action( config::system_account_name, "activate"_n, config::system_account_name,
1141 fc::mutable_variant_object()("feature_digest", feature_digest) );
1142 }
1143 }
action_result push_action(action &&cert_act, uint64_t authorizer)
Definition tester.cpp:609

◆ produce_block() [1/2]

virtual signed_block_ptr sysio::testing::base_tester::produce_block ( fc::microseconds skip_time = fc::milliseconds(config::block_interval_ms))
pure virtual

Implemented in sysio::testing::tester, and sysio::testing::validating_tester.

Here is the caller graph for this function:

◆ produce_block() [2/2]

signed_block_ptr sysio::testing::base_tester::produce_block ( std::vector< transaction_trace_ptr > & traces)

Definition at line 447 of file tester.cpp.

447 {
448 return _produce_block( fc::milliseconds(config::block_interval_ms), false, true, traces );
449 }
Here is the call graph for this function:

◆ produce_blocks()

void sysio::testing::base_tester::produce_blocks ( uint32_t n = 1,
bool empty = false )

Definition at line 451 of file tester.cpp.

451 {
452 if( empty ) {
453 for( uint32_t i = 0; i < n; ++i )
455 } else {
456 for( uint32_t i = 0; i < n; ++i )
458 }
459 }
virtual signed_block_ptr produce_empty_block(fc::microseconds skip_time=fc::milliseconds(config::block_interval_ms))=0
unsigned int uint32_t
Definition stdint.h:126
Here is the caller graph for this function:

◆ produce_blocks_for_n_rounds()

void sysio::testing::base_tester::produce_blocks_for_n_rounds ( const uint32_t num_of_rounds = 1)

Definition at line 483 of file tester.cpp.

483 {
484 for(uint32_t i = 0; i < num_of_rounds; i++) {
486 }
487 }
void produce_blocks_until_end_of_round()
Definition tester.cpp:474

◆ produce_blocks_until_end_of_round()

void sysio::testing::base_tester::produce_blocks_until_end_of_round ( )

Definition at line 474 of file tester.cpp.

474 {
475 uint64_t blocks_per_round;
476 while(true) {
477 blocks_per_round = control->active_producers().producers.size() * config::producer_repetitions;
479 if (control->head_block_num() % blocks_per_round == (blocks_per_round - 1)) break;
480 }
481 }
unsigned __int64 uint64_t
Definition stdint.h:136

◆ produce_empty_block()

virtual signed_block_ptr sysio::testing::base_tester::produce_empty_block ( fc::microseconds skip_time = fc::milliseconds(config::block_interval_ms))
pure virtual

◆ produce_min_num_of_blocks_to_spend_time_wo_inactive_prod()

void sysio::testing::base_tester::produce_min_num_of_blocks_to_spend_time_wo_inactive_prod ( const fc::microseconds target_elapsed_time = fc::microseconds())

Definition at line 489 of file tester.cpp.

489 {
490 fc::microseconds elapsed_time;
491 while (elapsed_time < target_elapsed_time) {
492 for(uint32_t i = 0; i < control->head_block_state()->active_schedule.producers.size(); i++) {
493 const auto time_to_skip = fc::milliseconds(config::producer_repetitions * config::block_interval_ms);
494 produce_block(time_to_skip);
495 elapsed_time += time_to_skip;
496 }
497 // if it is more than 24 hours, producer will be marked as inactive
498 const auto time_to_skip = fc::seconds(23 * 60 * 60);
499 produce_block(time_to_skip);
500 elapsed_time += time_to_skip;
501 }
502
503 }
constexpr microseconds seconds(int64_t s)
Definition time.hpp:32
Here is the call graph for this function:

◆ push_action() [1/4]

base_tester::action_result sysio::testing::base_tester::push_action ( action && cert_act,
uint64_t authorizer )
nodiscard

Definition at line 609 of file tester.cpp.

609 {
610 signed_transaction trx;
611 if (authorizer) {
612 act.authorization = vector<permission_level>{{account_name(authorizer), config::active_name}};
613 }
614 trx.actions.emplace_back(std::move(act));
616 if (authorizer) {
617 trx.sign(get_private_key(account_name(authorizer), "active"), control->get_chain_id());
618 }
619 try {
620 push_transaction(trx);
621 } catch (const fc::exception& ex) {
622 edump((ex.to_detail_string()));
623 return error(ex.top_message()); // top_message() is assumed by many tests; otherwise they fail
624 //return error(ex.to_detail_string());
625 }
627 BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id()));
628 return success();
629 }
Used to generate a useful error report when an exception is thrown.
Definition exception.hpp:58
std::string to_detail_string(log_level ll=log_level::all) const
std::string top_message() const
bool chain_has_transaction(const transaction_id_type &txid) const
Definition tester.cpp:953
static action_result error(const string &msg)
Definition tester.hpp:333
static action_result success()
Definition tester.hpp:331
#define edump(SEQ)
Definition logger.hpp:162
Here is the call graph for this function:
Here is the caller graph for this function:

◆ push_action() [2/4]

transaction_trace_ptr sysio::testing::base_tester::push_action ( const account_name & code,
const action_name & acttype,
const account_name & actor,
const variant_object & data,
uint32_t expiration = DEFAULT_EXPIRATION_DELTA,
uint32_t delay_sec = 0 )

Definition at line 631 of file tester.cpp.

639 {
640 vector<permission_level> auths;
641 auths.push_back( permission_level{actor, config::active_name} );
642 return push_action( code, acttype, auths, data, expiration, delay_sec );
643 }

◆ push_action() [3/4]

transaction_trace_ptr sysio::testing::base_tester::push_action ( const account_name & code,
const action_name & acttype,
const vector< account_name > & actors,
const variant_object & data,
uint32_t expiration = DEFAULT_EXPIRATION_DELTA,
uint32_t delay_sec = 0 )

Definition at line 645 of file tester.cpp.

653 {
654 vector<permission_level> auths;
655 for (const auto& actor : actors) {
656 auths.push_back( permission_level{actor, config::active_name} );
657 }
658 return push_action( code, acttype, auths, data, expiration, delay_sec );
659 }

◆ push_action() [4/4]

transaction_trace_ptr sysio::testing::base_tester::push_action ( const account_name & code,
const action_name & acttype,
const vector< permission_level > & auths,
const variant_object & data,
uint32_t expiration = DEFAULT_EXPIRATION_DELTA,
uint32_t delay_sec = 0 )

Definition at line 661 of file tester.cpp.

669 { try {
670 signed_transaction trx;
671 trx.actions.emplace_back( get_action( code, acttype, auths, data ) );
672 set_transaction_headers( trx, expiration, delay_sec );
673 for (const auto& auth : auths) {
674 trx.sign( get_private_key( auth.actor, auth.permission.to_string() ), control->get_chain_id() );
675 }
676
677 return push_transaction( trx );
678 } FC_CAPTURE_AND_RETHROW( (code)(acttype)(auths)(data)(expiration)(delay_sec) ) }
action get_action(account_name code, action_name acttype, vector< permission_level > auths, const variant_object &data) const
Definition tester.cpp:680
Here is the call graph for this function:

◆ push_block()

void sysio::testing::base_tester::push_block ( signed_block_ptr b)

Definition at line 323 of file tester.cpp.

323 {
324 auto bsf = control->create_block_state_future(b->calculate_id(), b);
326 control->push_block( bsf.get(), [this]( const branch_type& forked_branch ) {
327 unapplied_transactions.add_forked( forked_branch );
328 }, [this]( const transaction_id_type& id ) {
329 return unapplied_transactions.get_trx( id );
330 } );
331
332 auto itr = last_produced_block.find(b->producer);
333 if (itr == last_produced_block.end() || b->block_num() > block_header::num_from_id(itr->second)) {
334 last_produced_block[b->producer] = b->calculate_id();
335 }
336 }
deque< block_state_ptr > branch_type
checksum_type transaction_id_type
Definition types.hpp:236
void bsf(const Reg &reg, const Operand &op)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ push_dummy()

transaction_trace_ptr sysio::testing::base_tester::push_dummy ( account_name from,
const string & v = "blah",
uint32_t billed_cpu_time_us = DEFAULT_BILLED_CPU_TIME_US )

Definition at line 731 of file tester.cpp.

731 {
732 // use reqauth for a normal action, this could be anything
734 ("actions", fc::variants({
736 ("account", name(config::system_account_name))
737 ("name", "reqauth")
738 ("authorization", fc::variants({
740 ("actor", from)
741 ("permission", name(config::active_name))
742 }))
744 ("from", from)
745 )
746 })
747 )
748 // lets also push a context free action, the multi chain test will then also include a context free action
749 ("context_free_actions", fc::variants({
751 ("account", name(config::null_account_name))
752 ("name", "nonce")
753 ("data", fc::raw::pack(v))
754 })
755 );
756
757 signed_transaction trx;
760
761 trx.sign( get_private_key( from, "active" ), control->get_chain_id() );
762 return push_transaction( trx, fc::time_point::maximum(), billed_cpu_time_us );
763 }
void pack(Stream &s, const std::deque< T > &value)
Definition raw.hpp:531
Here is the call graph for this function:

◆ push_reqauth() [1/2]

transaction_trace_ptr sysio::testing::base_tester::push_reqauth ( account_name from,
const vector< permission_level > & auths,
const vector< private_key_type > & keys )

Definition at line 698 of file tester.cpp.

698 {
700 ("actions", fc::variants({
702 ("account", name(config::system_account_name))
703 ("name", "reqauth")
704 ("authorization", auths)
706 ("from", from)
707 )
708 })
709 );
710
711 signed_transaction trx;
714 for(auto iter = keys.begin(); iter != keys.end(); iter++)
715 trx.sign( *iter, control->get_chain_id() );
716 return push_transaction( trx );
717 }
Here is the call graph for this function:

◆ push_reqauth() [2/2]

transaction_trace_ptr sysio::testing::base_tester::push_reqauth ( account_name from,
string role,
bool multi_sig = false )

Definition at line 720 of file tester.cpp.

720 {
721 if (!multi_sig) {
722 return push_reqauth(from, vector<permission_level>{{from, config::owner_name}},
723 {get_private_key(from, role)});
724 } else {
725 return push_reqauth(from, vector<permission_level>{{from, config::owner_name}},
726 {get_private_key(from, role), get_private_key( config::system_account_name, "active" )} );
727 }
728 }
transaction_trace_ptr push_reqauth(account_name from, const vector< permission_level > &auths, const vector< private_key_type > &keys)
Definition tester.cpp:698

◆ push_transaction() [1/2]

transaction_trace_ptr sysio::testing::base_tester::push_transaction ( packed_transaction & trx,
fc::time_point deadline = fc::time_point::maximum(),
uint32_t billed_cpu_time_us = DEFAULT_BILLED_CPU_TIME_US )

Definition at line 562 of file tester.cpp.

566 { try {
567 if( !control->is_building_block() )
568 _start_block(control->head_block_time() + fc::microseconds(config::block_interval_us));
569
570 auto ptrx = std::make_shared<packed_transaction>(trx);
571 auto time_limit = deadline == fc::time_point::maximum() ?
573 fc::microseconds( deadline - fc::time_point::now() );
574 auto fut = transaction_metadata::start_recover_keys( ptrx, control->get_thread_pool(), control->get_chain_id(), time_limit, transaction_metadata::trx_type::input );
575 auto r = control->push_transaction( fut.get(), deadline, fc::microseconds::maximum(), billed_cpu_time_us, billed_cpu_time_us > 0, 0 );
576 if( r->except_ptr ) std::rethrow_exception( r->except_ptr );
577 if( r->except ) throw *r->except;
578 return r;
579 } FC_RETHROW_EXCEPTIONS( warn, "transaction_header: ${header}", ("header", transaction_header(trx.get_transaction()) )) }
const mie::Vuint & r
Definition bn.cpp:28
static recover_keys_future start_recover_keys(packed_transaction_ptr trx, boost::asio::io_context &thread_pool, const chain_id_type &chain_id, fc::microseconds time_limit, trx_type t, uint32_t max_variable_sig_size=UINT32_MAX)
namespace sysio::chain
Definition authority.cpp:3
Here is the call graph for this function:

◆ push_transaction() [2/2]

transaction_trace_ptr sysio::testing::base_tester::push_transaction ( signed_transaction & trx,
fc::time_point deadline = fc::time_point::maximum(),
uint32_t billed_cpu_time_us = DEFAULT_BILLED_CPU_TIME_US,
bool no_throw = false )

Definition at line 581 of file tester.cpp.

586 { try {
587 if( !control->is_building_block() )
588 _start_block(control->head_block_time() + fc::microseconds(config::block_interval_us));
590
591 if( fc::raw::pack_size(trx) > 1000 ) {
593 }
594
595 auto time_limit = deadline == fc::time_point::maximum() ?
597 fc::microseconds( deadline - fc::time_point::now() );
598 auto ptrx = std::make_shared<packed_transaction>( trx, c );
599 auto fut = transaction_metadata::start_recover_keys( ptrx, control->get_thread_pool(), control->get_chain_id(), time_limit, transaction_metadata::trx_type::input );
600 auto r = control->push_transaction( fut.get(), deadline, fc::microseconds::maximum(), billed_cpu_time_us, billed_cpu_time_us > 0, 0 );
601 if (no_throw) return r;
602 if( r->except_ptr ) std::rethrow_exception( r->except_ptr );
603 if( r->except) throw *r->except;
604 return r;
605 } FC_RETHROW_EXCEPTIONS( warn, "transaction_header: ${header}, billed_cpu_time_us: ${billed}",
606 ("header", transaction_header(trx) ) ("billed", billed_cpu_time_us))
607 }
size_t pack_size(const T &v)
Definition raw.hpp:671
Here is the call graph for this function:

◆ schedule_protocol_features_wo_preactivation()

void sysio::testing::base_tester::schedule_protocol_features_wo_preactivation ( const vector< digest_type > feature_digests)

Definition at line 1130 of file tester.cpp.

1130 {
1133 feature_digests.begin(),
1134 feature_digests.end()
1135 );
1136 }
Here is the caller graph for this function:

◆ set_abi()

void sysio::testing::base_tester::set_abi ( account_name name,
const char * abi_json,
const private_key_type * signer = nullptr )

◆ set_authority() [1/2]

void sysio::testing::base_tester::set_authority ( account_name account,
permission_name perm,
authority auth,
permission_name parent,
const vector< permission_level > & auths,
const vector< private_key_type > & keys )

Definition at line 852 of file tester.cpp.

857 { try {
858 signed_transaction trx;
859
860 trx.actions.emplace_back( auths,
861 updateauth{
862 .account = account,
863 .permission = perm,
864 .parent = parent,
865 .auth = move(auth),
866 });
867
869 for (const auto& key: keys) {
870 trx.sign( key, control->get_chain_id() );
871 }
872
873 push_transaction( trx );
874 } FC_CAPTURE_AND_RETHROW( (account)(perm)(auth)(parent) ) }
Here is the call graph for this function:

◆ set_authority() [2/2]

void sysio::testing::base_tester::set_authority ( account_name account,
permission_name perm,
authority auth,
permission_name parent = config::owner_name )

Definition at line 877 of file tester.cpp.

880 {
881 set_authority(account, perm, auth, parent, { { account, config::owner_name } }, { get_private_key( account, "owner" ) });
882 }
void set_authority(account_name account, permission_name perm, authority auth, permission_name parent, const vector< permission_level > &auths, const vector< private_key_type > &keys)
Definition tester.cpp:852

◆ set_before_preactivate_bios_contract()

void sysio::testing::base_tester::set_before_preactivate_bios_contract ( )

Definition at line 1063 of file tester.cpp.

1063 {
1064 set_code(config::system_account_name, contracts::before_preactivate_sysio_bios_wasm());
1065 set_abi(config::system_account_name, contracts::before_preactivate_sysio_bios_abi().data());
1066 }
void set_code(account_name name, const char *wast, const private_key_type *signer=nullptr)
Definition tester.cpp:909
void set_abi(account_name name, const char *abi_json, const private_key_type *signer=nullptr)
Here is the caller graph for this function:

◆ set_before_producer_authority_bios_contract()

void sysio::testing::base_tester::set_before_producer_authority_bios_contract ( )

Definition at line 1068 of file tester.cpp.

1068 {
1069 set_code(config::system_account_name, contracts::before_producer_authority_sysio_bios_wasm());
1070 set_abi(config::system_account_name, contracts::before_producer_authority_sysio_bios_abi().data());
1071 }
Here is the caller graph for this function:

◆ set_bios_contract()

void sysio::testing::base_tester::set_bios_contract ( )

Definition at line 1073 of file tester.cpp.

1073 {
1074 set_code(config::system_account_name, contracts::sysio_bios_wasm());
1075 set_abi(config::system_account_name, contracts::sysio_bios_abi().data());
1076 }
Here is the caller graph for this function:

◆ set_code() [1/2]

void sysio::testing::base_tester::set_code ( account_name name,
const char * wast,
const private_key_type * signer = nullptr )

Definition at line 909 of file tester.cpp.

909 {
910 set_code(account, wast_to_wasm(wast), signer);
911 } FC_CAPTURE_AND_RETHROW( (account) )
std::vector< uint8_t > wast_to_wasm(const std::string &wast)
Here is the call graph for this function:

◆ set_code() [2/2]

void sysio::testing::base_tester::set_code ( account_name name,
const vector< uint8_t > wasm,
const private_key_type * signer = nullptr )

◆ set_last_produced_block_map()

void sysio::testing::base_tester::set_last_produced_block_map ( const map< account_name, block_id_type > & lpb)
inline

Definition at line 321 of file tester.hpp.

321{ last_produced_block = lpb; }

◆ set_producer_schedule()

transaction_trace_ptr sysio::testing::base_tester::set_producer_schedule ( const vector< producer_authority > & schedule)

Definition at line 1094 of file tester.cpp.

1094 {
1095 // FC reflection does not create variants that are compatible with ABI 1.1 so we manually translate.
1096 fc::variants schedule_variant;
1097 schedule_variant.reserve(schedule.size());
1098 for( const auto& e: schedule ) {
1099 schedule_variant.emplace_back(e.get_abi_variant());
1100 }
1101
1102 return push_action( config::system_account_name, "setprods"_n, config::system_account_name,
1103 fc::mutable_variant_object()("schedule", schedule_variant));
1104
1105 }

◆ set_producers()

transaction_trace_ptr sysio::testing::base_tester::set_producers ( const vector< account_name > & producer_names)

Definition at line 1088 of file tester.cpp.

1088 {
1089 auto schedule = get_producer_authorities( producer_names );
1090
1091 return set_producer_schedule(schedule);
1092 }
transaction_trace_ptr set_producer_schedule(const vector< producer_authority > &schedule)
Definition tester.cpp:1094
vector< producer_authority > get_producer_authorities(const vector< account_name > &producer_names) const
Definition tester.cpp:1079

◆ set_producers_legacy()

transaction_trace_ptr sysio::testing::base_tester::set_producers_legacy ( const vector< account_name > & producer_names)

Definition at line 1107 of file tester.cpp.

1107 {
1108 auto schedule = get_producer_authorities( producer_names );
1109 // down-rank to old version
1110
1111 vector<legacy::producer_key> legacy_keys;
1112 legacy_keys.reserve(schedule.size());
1113 for (const auto &p : schedule) {
1114 std::visit([&legacy_keys, &p](const auto& auth){
1115 legacy_keys.emplace_back(legacy::producer_key{p.producer_name, auth.keys.front().key});
1116 }, p.authority);
1117 }
1118
1119 return push_action( config::system_account_name, "setprods"_n, config::system_account_name,
1120 fc::mutable_variant_object()("schedule", legacy_keys));
1121
1122 }
const mie::Vuint & p
Definition bn.cpp:27

◆ set_transaction_headers()

void sysio::testing::base_tester::set_transaction_headers ( transaction & trx,
uint32_t expiration = DEFAULT_EXPIRATION_DELTA,
uint32_t delay_sec = 0 ) const

Definition at line 506 of file tester.cpp.

506 {
507 trx.expiration = control->head_block_time() + fc::seconds(expiration);
508 trx.set_reference_block( control->head_block_id() );
509
510 trx.max_net_usage_words = 0; // No limit
511 trx.max_cpu_usage_ms = 0; // No limit
512 trx.delay_sec = delay_sec;
513 }
Here is the call graph for this function:

◆ success()

static action_result sysio::testing::base_tester::success ( )
inlinestatic

Definition at line 331 of file tester.hpp.

331{ return string(); }
std::string string
Definition string.hpp:10

◆ sync_with()

void sysio::testing::base_tester::sync_with ( base_tester & other)

Definition at line 1039 of file tester.cpp.

1039 {
1040 // Already in sync?
1041 if (control->head_block_id() == other.control->head_block_id())
1042 return;
1043 // If other has a longer chain than we do, sync it to us first
1044 if (control->head_block_num() < other.control->head_block_num())
1045 return other.sync_with(*this);
1046
1047 auto sync_dbs = [](base_tester& a, base_tester& b) {
1048 for( uint32_t i = 1; i <= a.control->head_block_num(); ++i ) {
1049
1050 auto block = a.control->fetch_block_by_number(i);
1051 if( block ) { //&& !b.control->is_known_block(block->id()) ) {
1052 auto bsf = b.control->create_block_state_future( block->calculate_id(), block );
1053 b.control->abort_block();
1054 b.control->push_block(bsf.get(), forked_branch_callback{}, trx_meta_cache_lookup{}); //, sysio::chain::validation_steps::created_block);
1055 }
1056 }
1057 };
1058
1059 sync_dbs(*this, other);
1060 sync_dbs(other, *this);
1061 }
std::function< transaction_metadata_ptr(const transaction_id_type &)> trx_meta_cache_lookup
std::function< void(const branch_type &)> forked_branch_callback
Here is the call graph for this function:

◆ to_string()

string sysio::testing::base_tester::to_string ( fc::variant x)
static

Definition at line 1030 of file tester.cpp.

1030 {
1031 vector<uint8_t> v;
1033 string s(v.size(), 0);
1034 copy(v.begin(), v.end(), s.begin());
1035 return s;
1036 }
void copy(const path &from, const path &to)
void from_variant(const fc::variant &v, sysio::chain::chain_id_type &cid)
char * s
Here is the call graph for this function:
Here is the caller graph for this function:

◆ to_uint64()

uint64_t sysio::testing::base_tester::to_uint64 ( fc::variant x)
static

Definition at line 1022 of file tester.cpp.

1022 {
1023 vector<uint8_t> blob;
1025 FC_ASSERT(8 == blob.size());
1026 return *reinterpret_cast<uint64_t*>(blob.data());
1027 }
Here is the call graph for this function:

◆ to_uint8_vector() [1/2]

vector< uint8_t > sysio::testing::base_tester::to_uint8_vector ( const string & s)
static

Definition at line 1008 of file tester.cpp.

1008 {
1009 vector<uint8_t> v(s.size());
1010 copy(s.begin(), s.end(), v.begin());
1011 return v;
1012 };
Here is the call graph for this function:

◆ to_uint8_vector() [2/2]

vector< uint8_t > sysio::testing::base_tester::to_uint8_vector ( uint64_t x)
static

Definition at line 1015 of file tester.cpp.

1015 {
1016 vector<uint8_t> v(sizeof(x));
1017 *reinterpret_cast<uint64_t*>(v.data()) = x;
1018 return v;
1019 };

◆ transfer() [1/2]

transaction_trace_ptr sysio::testing::base_tester::transfer ( account_name from,
account_name to,
asset amount,
string memo,
account_name currency )

Definition at line 771 of file tester.cpp.

771 {
773 ("actions", fc::variants({
775 ("account", currency)
776 ("name", "transfer")
777 ("authorization", fc::variants({
779 ("actor", from)
780 ("permission", name(config::active_name))
781 }))
783 ("from", from)
784 ("to", to)
785 ("quantity", amount)
786 ("memo", memo)
787 )
788 })
789 );
790
791 signed_transaction trx;
794
795 trx.sign( get_private_key( from, name(config::active_name).to_string() ), control->get_chain_id() );
796 return push_transaction( trx );
797 }
Here is the call graph for this function:

◆ transfer() [2/2]

transaction_trace_ptr sysio::testing::base_tester::transfer ( account_name from,
account_name to,
string amount,
string memo,
account_name currency )

Definition at line 766 of file tester.cpp.

766 {
767 return transfer( from, to, asset::from_string(amount), memo, currency );
768 }
transaction_trace_ptr transfer(account_name from, account_name to, asset amount, string memo, account_name currency)
Definition tester.cpp:771
static asset from_string(const string &from)
Definition asset.cpp:31
Here is the call graph for this function:

◆ unlink_authority()

void sysio::testing::base_tester::unlink_authority ( account_name account,
account_name code,
action_name type = {} )

Definition at line 840 of file tester.cpp.

840 {
841 signed_transaction trx;
842
843 trx.actions.emplace_back( vector<permission_level>{{account, config::active_name}},
844 unlinkauth(account, code, type ));
846 trx.sign( get_private_key( account, "active" ), control->get_chain_id() );
847
848 push_transaction( trx );
849 }
Here is the call graph for this function:

◆ wasm_assert_code()

static action_result sysio::testing::base_tester::wasm_assert_code ( uint64_t error_code)
inlinestatic

Definition at line 337 of file tester.hpp.

337{ return "assertion failure with error code: " + std::to_string(error_code); }

◆ wasm_assert_msg()

static action_result sysio::testing::base_tester::wasm_assert_msg ( const string & msg)
inlinestatic

Definition at line 335 of file tester.hpp.

335{ return "assertion failure with message: " + msg; }

Member Data Documentation

◆ abi_serializer_max_time

const fc::microseconds sysio::testing::base_tester::abi_serializer_max_time {1000*1000}
static

Definition at line 153 of file tester.hpp.

◆ block_signing_private_keys

std::map<chain::public_key_type, chain::private_key_type> sysio::testing::base_tester::block_signing_private_keys

Definition at line 437 of file tester.hpp.

◆ cfg

controller::config sysio::testing::base_tester::cfg
protected

Definition at line 439 of file tester.hpp.

◆ chain_transactions

map<transaction_id_type, transaction_receipt> sysio::testing::base_tester::chain_transactions
protected

Definition at line 440 of file tester.hpp.

◆ control

unique_ptr<controller> sysio::testing::base_tester::control

Definition at line 436 of file tester.hpp.

◆ DEFAULT_BILLED_CPU_TIME_US

const uint32_t sysio::testing::base_tester::DEFAULT_BILLED_CPU_TIME_US = 2000
static

Definition at line 152 of file tester.hpp.

◆ DEFAULT_EXPIRATION_DELTA

const uint32_t sysio::testing::base_tester::DEFAULT_EXPIRATION_DELTA = 6
static

Definition at line 150 of file tester.hpp.

◆ last_produced_block

map<account_name, block_id_type> sysio::testing::base_tester::last_produced_block
protected

Definition at line 441 of file tester.hpp.

◆ protocol_features_to_be_activated_wo_preactivation

vector<digest_type> sysio::testing::base_tester::protocol_features_to_be_activated_wo_preactivation

Definition at line 445 of file tester.hpp.

◆ tempdir

fc::temp_directory sysio::testing::base_tester::tempdir
protected

Definition at line 434 of file tester.hpp.

◆ unapplied_transactions

unapplied_transaction_queue sysio::testing::base_tester::unapplied_transactions
protected

Definition at line 442 of file tester.hpp.


The documentation for this class was generated from the following files: