1#include <boost/test/unit_test.hpp>
2#include <boost/algorithm/string/predicate.hpp>
8#include <boost/iostreams/filtering_stream.hpp>
9#include <boost/iostreams/copy.hpp>
10#include <boost/iostreams/filter/gzip.hpp>
14#include <contracts.hpp>
16namespace bio = boost::iostreams;
24 std::ifstream wast_file(fn);
25 FC_ASSERT( wast_file.is_open(),
"wast file cannot be found" );
26 wast_file.seekg(0, std::ios::end);
27 std::vector<char> wast;
28 int len = wast_file.tellg();
31 wast_file.seekg(0, std::ios::beg);
32 wast_file.read(wast.data(), wast.size());
33 wast[wast.size()-1] =
'\0';
39 std::ifstream wasm_file(fn, std::ios::binary);
40 FC_ASSERT( wasm_file.is_open(),
"wasm file cannot be found" );
41 wasm_file.seekg(0, std::ios::end);
42 std::vector<uint8_t> wasm;
43 int len = wasm_file.tellg();
46 wasm_file.seekg(0, std::ios::beg);
47 wasm_file.read((
char*)wasm.data(), wasm.size());
53 std::ifstream abi_file(fn);
54 FC_ASSERT( abi_file.is_open(),
"abi file cannot be found" );
55 abi_file.seekg(0, std::ios::end);
56 std::vector<char> abi;
57 int len = abi_file.tellg();
60 abi_file.seekg(0, std::ios::beg);
61 abi_file.read(abi.data(), abi.size());
62 abi[abi.size()-1] =
'\0';
68 std::string read_gzipped_snapshot(
const char* fn ) {
69 std::ifstream file(fn, std::ios_base::in | std::ios_base::binary);
70 bio::filtering_streambuf<bio::input> in;
72 in.push(bio::gzip_decompressor());
75 std::stringstream decompressed;
76 bio::copy(in, decompressed);
77 return decompressed.str();
82 return read_gzipped_snapshot(fn);
92 BOOST_TEST_MESSAGE(
"LOG : " <<
"expected: " << expected <<
", actual: " << ex.
get_log().at(0).get_message());
93 return (ex.
get_log().at(0).get_message().find(expected) != std::string::npos);
98 for(
auto& entry : filter ) {
99 auto it =
value.find(entry.key());
100 res( it->key(), it->value() );
113 map< builtin_protocol_feature_t, std::optional<digest_type> > visited_builtins;
116 [&pfs, &visited_builtins, &add_builtins, &custom_subjective_restrictions]
118 auto res = visited_builtins.emplace( codename, std::optional<digest_type>() );
120 SYS_ASSERT( res.first->second, protocol_feature_exception,
121 "invariant failure: cycle found in builtin protocol feature dependencies"
123 return *res.first->second;
128 return add_builtins(
d );
131 const auto itr = custom_subjective_restrictions.find(codename);
132 if( itr != custom_subjective_restrictions.end() ) {
133 f.subjective_restrictions = itr->second;
139 return pf.feature_digest;
143 add_builtins(
p.first );
150 return control->head_block_id() == other.control->head_block_id();
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;
158 open(def_conf.second);
179 open(std::move(pfs), snapshot);
184 open(std::move(pfs), genesis);
193 const auto& pfm =
control->get_protocol_feature_manager();
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" );
207 schedule_preactivate_protocol_feature();
212 schedule_preactivate_protocol_feature();
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
241 schedule_preactivate_protocol_feature();
272 template <
typename Lambda>
274 if( !expected_chain_id ) {
276 if( !expected_chain_id ) {
292 if( std::holds_alternative<packed_transaction>(receipt.trx) ) {
293 auto &pt = std::get<packed_transaction>(receipt.trx);
296 auto&
id = std::get<transaction_id_type>(receipt.trx);
305 snapshot->return_to_header();
307 control->startup( [](){}, []() {
return false; }, snapshot );
312 open(std::move(pfs), genesis.compute_chain_id(), [&genesis,&
control=this->control]() {
313 control->startup( [](){}, []() { return false; }, genesis );
318 open(std::move(pfs), expected_chain_id, [&control=this->control]() {
319 control->startup( [](){}, []() {
return false; } );
324 auto bsf = control->create_block_state_future(b->calculate_id(), b);
325 unapplied_transactions.add_aborted( control->abort_block() );
326 control->push_block(
bsf.get(), [
this](
const branch_type& forked_branch ) {
327 unapplied_transactions.add_forked( forked_branch );
329 return unapplied_transactions.get_trx( id );
332 auto itr = last_produced_block.find(b->producer);
334 last_produced_block[b->producer] = b->calculate_id();
339 std::vector<transaction_trace_ptr> traces;
340 return _produce_block( skip_time, skip_pending_trxs,
false, traces );
344 bool no_throw, std::vector<transaction_trace_ptr>& traces ) {
345 auto head = control->head_block_state();
346 auto head_time = control->head_block_time();
347 auto next_time = head_time + skip_time;
349 if( !control->is_building_block() || control->pending_block_time() != next_time ) {
350 _start_block( next_time );
353 if( !skip_pending_trxs ) {
354 for(
auto itr = unapplied_transactions.begin(); itr != unapplied_transactions.end(); ) {
356 traces.emplace_back( trace );
357 if(!no_throw && trace->except) {
359 trace->except->dynamic_rethrow_exception();
361 itr = unapplied_transactions.erase( itr );
365 while ((scheduled_trxs = get_scheduled_transactions()).size() > 0 ) {
366 for(
const auto& trx : scheduled_trxs ) {
368 traces.emplace_back( trace );
369 if( !no_throw && trace->except ) {
371 trace->except->dynamic_rethrow_exception();
377 auto head_block = _finish_block();
384 auto head_block_number = control->head_block_num();
385 auto producer = control->head_block_state()->get_scheduled_producer(block_time);
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()) {
393 unapplied_transactions.add_aborted( control->abort_block() );
397 feature_to_be_activated.insert(
398 feature_to_be_activated.end(),
399 protocol_features_to_be_activated_wo_preactivation.begin(),
400 protocol_features_to_be_activated_wo_preactivation.end()
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()
410 control->start_block( block_time, head_block_number - last_produced_block_num, feature_to_be_activated );
413 protocol_features_to_be_activated_wo_preactivation.clear();
417 FC_ASSERT( control->is_building_block(),
"must first start a block before it can be finished" );
419 auto producer = control->head_block_state()->get_scheduled_producer( control->pending_block_time() );
422 auto default_active_key = get_public_key( producer.producer_name,
"active");
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") );
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));
441 control->commit_block();
442 last_produced_block[control->head_block_state()->header.producer] = control->head_block_state()->id;
444 return control->head_block_state()->block;
447 signed_block_ptr base_tester::produce_block( std::vector<transaction_trace_ptr>& traces ) {
448 return _produce_block(
fc::milliseconds(config::block_interval_ms),
false,
true, traces );
451 void base_tester::produce_blocks(
uint32_t n,
bool empty ) {
454 produce_empty_block();
466 auto itr = idx.begin();
467 while( itr != idx.end() && itr->delay_until <= control->pending_block_time() ) {
468 result.emplace_back(itr->trx_id);
474 void base_tester::produce_blocks_until_end_of_round() {
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;
483 void base_tester::produce_blocks_for_n_rounds(
const uint32_t num_of_rounds) {
484 for(
uint32_t i = 0; i < num_of_rounds; i++) {
485 produce_blocks_until_end_of_round();
489 void base_tester::produce_min_num_of_blocks_to_spend_time_wo_inactive_prod(
const fc::microseconds target_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;
498 const auto time_to_skip =
fc::seconds(23 * 60 * 60);
499 produce_block(time_to_skip);
500 elapsed_time += time_to_skip;
518 set_transaction_headers(trx);
525 owner_auth =
authority( get_public_key(
a,
"owner" ) );
528 authority active_auth( get_public_key(
a,
"active" ) );
530 auto sort_permissions = [](
authority& auth ) {
531 std::sort( auth.accounts.begin(), auth.accounts.end(),
533 return lhs.permission < rhs.permission;
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" );
543 sort_permissions(owner_auth);
546 sort_permissions(active_auth);
554 .active = active_auth,
557 set_transaction_headers(trx);
558 trx.
sign( get_private_key( creator,
"active" ), control->get_chain_id() );
567 if( !control->is_building_block() )
568 _start_block(control->head_block_time() +
fc::microseconds(config::block_interval_us));
570 auto ptrx = std::make_shared<packed_transaction>(trx);
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;
587 if( !control->is_building_block() )
588 _start_block(control->head_block_time() +
fc::microseconds(config::block_interval_us));
598 auto ptrx = std::make_shared<packed_transaction>( trx, c );
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;
614 trx.
actions.emplace_back(std::move(act));
615 set_transaction_headers(trx);
617 trx.
sign(get_private_key(
account_name(authorizer),
"active"), control->get_chain_id());
627 BOOST_REQUIRE_EQUAL(
true, chain_has_transaction(trx.
id()));
642 return push_action( code, acttype, auths, data, expiration, delay_sec );
655 for (
const auto&
actor : actors) {
658 return push_action( code, acttype, auths, data, expiration, delay_sec );
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() );
682 const auto& acnt = control->get_account(code);
683 auto abi = acnt.get_abi();
687 FC_ASSERT( action_type_name !=
string(),
"unknown action type ${a}", (
"a",acttype) );
702 (
"account",
name(config::system_account_name))
704 (
"authorization", auths)
713 set_transaction_headers(trx);
714 for(
auto iter = keys.begin(); iter != keys.end(); iter++)
715 trx.
sign( *iter, control->get_chain_id() );
723 {get_private_key(from, role)});
726 {get_private_key(from, role), get_private_key( config::system_account_name,
"active" )} );
736 (
"account",
name(config::system_account_name))
741 (
"permission",
name(config::active_name))
751 (
"account",
name(config::null_account_name))
759 set_transaction_headers(trx);
761 trx.
sign( get_private_key( from,
"active" ), control->get_chain_id() );
775 (
"account", currency)
780 (
"permission",
name(config::active_name))
793 set_transaction_headers(trx);
795 trx.
sign( get_private_key( from,
name(config::active_name).
to_string() ), control->get_chain_id() );
804 (
"account", currency)
809 (
"permission",
name(config::active_name))
821 set_transaction_headers(trx);
823 trx.
sign( get_private_key( currency,
name(config::active_name).
to_string() ), control->get_chain_id() );
832 linkauth(account, code, type, req));
833 set_transaction_headers(trx);
834 trx.
sign( get_private_key( account,
"active" ), control->get_chain_id() );
845 set_transaction_headers(trx);
846 trx.
sign( get_private_key( account,
"active" ), control->get_chain_id() );
860 trx.
actions.emplace_back( auths,
868 set_transaction_headers(trx);
869 for (
const auto& key: keys) {
870 trx.
sign( key, control->get_chain_id() );
881 set_authority(account, perm, auth, parent, { { account, config::owner_name } }, { get_private_key( account,
"owner" ) });
891 trx.
actions.emplace_back( auths,
894 set_transaction_headers(trx);
895 for (
const auto& key: keys) {
896 trx.
sign( key, control->get_chain_id() );
905 delete_authority(account, perm, {
permission_level{ account, config::owner_name } }, { get_private_key( account,
"owner" ) });
921 .code =
bytes(wasm.begin(), wasm.end())
924 set_transaction_headers(trx);
926 trx.
sign( *signer, control->get_chain_id() );
936 signed_transaction trx;
937 trx.
actions.emplace_back( vector<permission_level>{{account,config::active_name}},
943 set_transaction_headers(trx);
945 trx.sign( *signer, control->get_chain_id() );
947 trx.sign(
get_private_key( account,
"active" ), control->get_chain_id() );
954 return chain_transactions.count(txid) != 0;
959 return chain_transactions.at(txid);
967 const symbol& asset_symbol,
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));
975 const auto *obj = db.template find<key_value_object, by_scope_primary>(boost::make_tuple(
tbl->id, asset_symbol.
to_symbol_code().
value));
982 return asset(result, asset_symbol);
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 ) );
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 ) {
1002 data.resize( itr->value.size() );
1003 memcpy( data.data(), itr->value.data(), data.size() );
1010 copy(
s.begin(),
s.end(), v.begin());
1017 *
reinterpret_cast<uint64_t*
>(v.data()) = x;
1033 string s(v.size(), 0);
1034 copy(v.begin(), v.end(),
s.begin());
1041 if (control->head_block_id() == other.control->head_block_id())
1044 if (control->head_block_num() < other.control->head_block_num())
1045 return other.sync_with(*
this);
1048 for(
uint32_t i = 1; i <=
a.control->head_block_num(); ++i ) {
1050 auto block =
a.control->fetch_block_by_number(i);
1052 auto bsf = b.control->create_block_state_future( block->calculate_id(), block );
1053 b.control->abort_block();
1059 sync_dbs(*
this, other);
1060 sync_dbs(other, *
this);
1063 void base_tester::set_before_preactivate_bios_contract() {
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());
1068 void base_tester::set_before_producer_authority_bios_contract() {
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());
1073 void base_tester::set_bios_contract() {
1074 set_code(config::system_account_name, contracts::sysio_bios_wasm());
1075 set_abi(config::system_account_name, contracts::sysio_bios_abi().data());
1091 return set_producer_schedule(schedule);
1097 schedule_variant.reserve(schedule.size());
1098 for(
const auto& e: schedule ) {
1099 schedule_variant.emplace_back(e.get_abi_variant());
1102 return push_action( config::system_account_name,
"setprods"_n, config::system_account_name,
1112 legacy_keys.reserve(schedule.size());
1113 for (
const auto &
p : schedule) {
1114 std::visit([&legacy_keys, &
p](
const auto& auth){
1119 return push_action( config::system_account_name,
"setprods"_n, config::system_account_name,
1126 auto tid = control->db().find<
table_id_object, by_code_scope_table>(boost::make_tuple(code, scope, table));
1131 protocol_features_to_be_activated_wo_preactivation.insert(
1132 protocol_features_to_be_activated_wo_preactivation.end(),
1133 feature_digests.begin(),
1134 feature_digests.end()
1139 for(
const auto& feature_digest: feature_digests ) {
1140 push_action( config::system_account_name,
"activate"_n, config::system_account_name,
1145 void base_tester::preactivate_builtin_protocol_features(
const std::vector<builtin_protocol_feature_t>& builtin_features) {
1146 const auto& pfs = control->get_protocol_feature_manager().get_protocol_feature_set();
1149 std::vector<digest_type> features;
1151 if(
auto digest = pfs.get_builtin_digest( feature ) ) {
1152 features.push_back( *
digest );
1155 preactivate_protocol_features(features);
1158 void base_tester::preactivate_all_builtin_protocol_features() {
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) );
1165 set<digest_type> preactivation_set;
1168 std::function<void(
const digest_type&)> add_digests =
1169 [&pfm, &pfs, current_block_num, current_block_time, &preactivation_set, &preactivations, &add_digests]
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;
1176 auto res = preactivation_set.emplace( feature_digest );
1177 if( !res.second )
return;
1179 for(
const auto& dependency : pf.dependencies ) {
1180 add_digests( dependency );
1183 preactivations.emplace_back( feature_digest );
1186 std::vector<builtin_protocol_feature_t> ordered_builtins;
1188 ordered_builtins.push_back(
f.first );
1190 std::sort( ordered_builtins.begin(), ordered_builtins.end() );
1191 for(
const auto&
f : ordered_builtins ) {
1192 auto digest = pfs.get_builtin_digest(
f);
1197 preactivate_protocol_features( preactivations );
1201 auto message = ex.
get_log().at( 0 ).get_message();
1202 bool match = (message == expected);
1204 BOOST_TEST_MESSAGE(
"LOG: expected: " << expected <<
", actual: " << message );
1210 auto message = ex.
get_log().at( 0 ).get_message();
1211 bool match = boost::algorithm::starts_with( message, expected );
1213 BOOST_TEST_MESSAGE(
"LOG: expected: " << expected <<
", actual: " << message );
1218 bool fc_assert_exception_message_is::operator()(
const fc::assert_exception& ex ) {
1219 auto message = ex.get_log().at( 0 ).get_message();
1221 auto pos = message.find(
": " );
1222 if( pos != std::string::npos ) {
1223 message = message.substr( pos + 2 );
1224 match = (message == expected);
1227 BOOST_TEST_MESSAGE(
"LOG: expected: " << expected <<
", actual: " << message );
1232 bool fc_assert_exception_message_starts_with::operator()(
const fc::assert_exception& ex ) {
1233 auto message = ex.get_log().at( 0 ).get_message();
1235 auto pos = message.find(
": " );
1236 if( pos != std::string::npos ) {
1237 message = message.substr( pos + 2 );
1238 match = boost::algorithm::starts_with( message, expected );
1241 BOOST_TEST_MESSAGE(
"LOG: expected: " << expected <<
", actual: " << message );
1246 bool sysio_assert_message_is::operator()(
const sysio_assert_message_exception& ex ) {
1247 auto message = ex.get_log().at( 0 ).get_message();
1248 bool match = (message == expected);
1250 BOOST_TEST_MESSAGE(
"LOG: expected: " << expected <<
", actual: " << message );
1255 bool sysio_assert_message_starts_with::operator()(
const sysio_assert_message_exception& ex ) {
1256 auto message = ex.get_log().at( 0 ).get_message();
1257 bool match = boost::algorithm::starts_with( message, expected );
1259 BOOST_TEST_MESSAGE(
"LOG: expected: " << expected <<
", actual: " << message );
1264 bool sysio_assert_code_is::operator()(
const sysio_assert_code_exception& ex ) {
1265 auto message = ex.get_log().at( 0 ).get_message();
1266 bool match = (message == expected);
1268 BOOST_TEST_MESSAGE(
"LOG: expected: " << expected <<
", actual: " << message );
1273 const std::string mock::webauthn_private_key::_origin =
"mock.webauthn.invalid";
1274 const sha256 mock::webauthn_private_key::_origin_hash =
fc::sha256::hash(mock::webauthn_private_key::_origin);
1289 osm <<
"{ " << e.
key() <<
": " << e.
value() <<
" }";
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
const char * data() const
Used to generate a useful error report when an exception is thrown.
const log_messages & get_log() const
std::string to_detail_string(log_level ll=log_level::all) const
std::string top_message() const
static string to_pretty_string(const variant &v, const yield_function_t &yield, const output_formatting format=output_formatting::stringify_large_ints_and_doubles)
static variant from_string(const string &utf8_str, const parse_type ptype=parse_type::legacy_parser, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
static constexpr microseconds maximum()
An order-preserving dictionary of variants.
static sha256 hash(const char *d, uint32_t dlen)
static constexpr time_point maximum()
const string & key() const
const variant & value() const
An order-preserving dictionary of variants.
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
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)
static chain_id_type extract_chain_id(snapshot_reader &snapshot)
static builtin_protocol_feature make_default_builtin_protocol_feature(builtin_protocol_feature_t codename, const std::function< digest_type(builtin_protocol_feature_t dependency)> &handle_dependency)
const protocol_feature & add_feature(const builtin_protocol_feature &f)
symbol_code to_symbol_code() const
The table_id_object class tracks the mapping of (scope, code, table) to an opaque identifier.
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 >{})
static const fc::microseconds abi_serializer_max_time
virtual signed_block_ptr produce_block(fc::microseconds skip_time=fc::milliseconds(config::block_interval_ms))=0
static genesis_state default_genesis()
void execute_setup_policy(const setup_policy policy)
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 set_before_preactivate_bios_contract()
bool is_same_chain(base_tester &other)
map< transaction_id_type, transaction_receipt > chain_transactions
unique_ptr< controller > control
void preactivate_all_builtin_protocol_features()
void preactivate_builtin_protocol_features(const std::vector< builtin_protocol_feature_t > &features)
fc::temp_directory tempdir
void set_before_producer_authority_bios_contract()
void schedule_protocol_features_wo_preactivation(const vector< digest_type > feature_digests)
void open(protocol_feature_set &&pfs, std::optional< chain_id_type > expected_chain_id, Lambda lambda)
#define FC_CAPTURE_AND_RETHROW(...)
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
#define FC_RETHROW_EXCEPTIONS(LOG_LEVEL, FORMAT,...)
Catchs all exception's, std::exceptions, and ... and rethrows them after appending the provided log m...
void unpack(Stream &s, std::deque< T > &value)
void pack(Stream &s, const std::deque< T > &value)
size_t pack_size(const T &v)
fc::sha256 digest(const T &value)
fc::string to_string(double)
bool is_regular_file(const path &p)
constexpr microseconds milliseconds(int64_t s)
void copy(const path &from, const path &to)
std::vector< fc::variant > variants
constexpr microseconds seconds(int64_t s)
void from_variant(const fc::variant &v, sysio::chain::chain_id_type &cid)
const std::unordered_map< builtin_protocol_feature_t, builtin_protocol_feature_spec, enum_hash< builtin_protocol_feature_t > > builtin_protocol_feature_codenames
checksum_type digest_type
deque< block_state_ptr > branch_type
builtin_protocol_feature_t
std::shared_ptr< transaction_trace > transaction_trace_ptr
sysio::chain::action_name action_name
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
std::shared_ptr< signed_block > signed_block_ptr
std::shared_ptr< snapshot_reader > snapshot_reader_ptr
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
std::shared_ptr< block_state > block_state_ptr
fc::crypto::private_key private_key_type
std::function< transaction_metadata_ptr(const transaction_id_type &)> trx_meta_cache_lookup
std::function< void(const branch_type &)> forked_branch_callback
std::vector< uint8_t > wast_to_wasm(const std::string &wast)
void copy_row(const chain::key_value_object &obj, vector< char > &data)
std::string read_wast(const char *fn)
fc::variant read_json_snapshot(const char *fn)
std::string read_binary_snapshot(const char *fn)
protocol_feature_set make_protocol_feature_set(const subjective_restriction_map &custom_subjective_restrictions={})
bool expect_assert_message(const fc::exception &ex, string expected)
@ preactivate_feature_only
@ preactivate_feature_and_new_bios
std::map< builtin_protocol_feature_t, protocol_feature_subjective_restrictions > subjective_restriction_map
fc::variant_object filter_fields(const fc::variant_object &filter, const fc::variant_object &value)
std::vector< uint8_t > read_wasm(const char *fn)
std::vector< char > read_abi(const char *fn)
auto get_private_key(chain::name keyname, std::string role="owner")
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
const fc::microseconds abi_serializer_max_time
fc::variant push_transaction(signed_transaction &trx, packed_transaction::compression_type compression=packed_transaction::compression_type::none)
producer_name(block_signing_key)) FC_REFLECT(producer_set_def
unsigned __int64 uint64_t
static yield_function_t create_yield_function(const fc::microseconds &max_serialization_time)
bytes variant_to_binary(const std::string_view &type, const fc::variant &var, const fc::microseconds &max_serialization_time, bool short_path=false) const
type_name get_action_type(name action) const
static void from_variant(const fc::variant &v, T &o, Resolver resolver, const yield_function_t &yield)
vector< permission_level > authorization
static asset from_string(const string &from)
vector< permission_level_weight > accounts
chain_id_type compute_chain_id() const
Immutable except for fc::from_variant.
name(std::string_view str)
constexpr uint64_t to_uint64_t() const
const transaction & get_transaction() const
digest_type feature_digest
const signature_type & sign(const private_key_type &key, const chain_id_type &chain_id)
transaction_id_type id() const
sysio::chain::asset core_from_string(const std::string &s)
std::ostream & operator<<(std::ostream &osm, const fc::variant &v)
sysio::testing
void bsf(const Reg ®, const Operand &op)
memcpy((char *) pInfo->slotDescription, s, l)