Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
chain_plugin.hpp
Go to the documentation of this file.
1#pragma once
13#include <sysio/chain/types.hpp>
15
16#include <boost/container/flat_set.hpp>
17#include <boost/multiprecision/cpp_int.hpp>
18
22
23#include <fc/static_variant.hpp>
24
25namespace fc { class variant; }
26
27namespace sysio {
28 using chain::controller;
29 using std::unique_ptr;
30 using std::pair;
31 using namespace appbase;
32 using chain::name;
33 using chain::uint128_t;
35 using chain::transaction;
37 using boost::container::flat_set;
38 using chain::asset;
39 using chain::symbol;
40 using chain::authority;
43 using chain::abi_def;
44 using chain::abi_serializer;
45
46class producer_plugin;
47
48namespace chain_apis {
49struct empty{};
50
53 std::optional<name> action;
54};
55
56struct permission {
60 std::optional<std::vector<linked_action>> linked_actions;
61};
62
63
64// see specializations for uint64_t and double in source file
65template<typename Type>
66Type convert_to_type(const string& str, const string& desc) {
67 try {
68 return fc::variant(str).as<Type>();
69 } FC_RETHROW_EXCEPTIONS(warn, "Could not convert ${desc} string '${str}' to key type.", ("desc", desc)("str",str) )
70}
71
72template<>
73uint64_t convert_to_type(const string& str, const string& desc);
74
75template<>
76double convert_to_type(const string& str, const string& desc);
77
78template<typename Type>
79string convert_to_string(const Type& source, const string& key_type, const string& encode_type, const string& desc);
80
81template<>
82string convert_to_string(const chain::key256_t& source, const string& key_type, const string& encode_type, const string& desc);
83
84template<>
85string convert_to_string(const float128_t& source, const string& key_type, const string& encode_type, const string& desc);
86
87
88class read_only {
89 const controller& db;
90 const std::optional<account_query_db>& aqdb;
91 const fc::microseconds abi_serializer_max_time;
92 bool shorten_abi_errors = true;
93 const producer_plugin* producer_plug;
94 const trx_finality_status_processing* trx_finality_status_proc;
95
96public:
97 static const string KEYi64;
98
99 read_only(const controller& db, const std::optional<account_query_db>& aqdb, const fc::microseconds& abi_serializer_max_time, const producer_plugin* producer_plug, const trx_finality_status_processing* trx_finality_status_proc)
100 : db(db), aqdb(aqdb), abi_serializer_max_time(abi_serializer_max_time), producer_plug(producer_plug), trx_finality_status_proc(trx_finality_status_proc) {
101 }
102
103 void validate() const {}
104
105 void set_shorten_abi_errors( bool f ) { shorten_abi_errors = f; }
106
108
136
140
157
158
160 std::optional<uint32_t> lower_bound;
161 std::optional<uint32_t> upper_bound;
162 uint32_t limit = 10;
164 bool reverse = false;
165 };
166
171
173
177
179
210
213 std::optional<symbol> expected_core_symbol;
214 };
216
217
220 string wast;
221 string wasm;
223 std::optional<abi_def> abi;
224 };
225
230
235
239
242 std::optional<abi_def> abi;
243 };
244
248
254
258
261 std::optional<fc::sha256> abi_hash;
262 };
263
270
271
277
278
279
288
290
291
300
302
303
306 flat_set<public_key_type> available_keys;
307 };
309 flat_set<public_key_type> required_keys;
310 };
311
313
316
318
321 };
322
324
328
330
334
336
338 bool json = false;
340 string scope;
342 string table_key;
345 uint32_t limit = 10;
346 string key_type; // type of key specified by index_position
347 string index_position; // 1 - primary (first), 2 - secondary index (in order defined by multi_index), 3 - third index, etc
348 string encode_type{"dec"}; //dec, hex , default=dec
349 std::optional<bool> reverse;
350 std::optional<bool> show_payer; // show RAM pyer
351 };
352
355 bool more = false;
356 string next_key;
357 };
358
360
362 name code; // mandatory
363 name table; // optional, act as filter
364 string lower_bound; // lower bound of scope, optional
365 string upper_bound; // upper bound of scope, optional
366 uint32_t limit = 10;
367 std::optional<bool> reverse;
368 };
380
382
386 std::optional<string> symbol;
387 };
388
390
395
396
402
404
406 bool json = false;
408 uint32_t limit = 50;
409 };
410
416
418
421
427
429
431 bool json = false;
432 string lower_bound;
433 uint32_t limit = 50;
434 };
435
440
444 fc::variant processed; // "processed" is expected JSON for trxs in clio
445 };
446
450
452
453 static void copy_inline_row(const chain::key_value_object& obj, vector<char>& data) {
454 data.resize( obj.value.size() );
455 memcpy( data.data(), obj.value.data(), obj.value.size() );
456 }
457
458 template<typename Function>
459 void walk_key_value_table(const name& code, const name& scope, const name& table, Function f) const
460 {
461 const auto& d = db.db();
462 const auto* t_id = d.find<chain::table_id_object, chain::by_code_scope_table>(boost::make_tuple(code, scope, table));
463 if (t_id != nullptr) {
464 const auto &idx = d.get_index<chain::key_value_index, chain::by_scope_primary>();
465 decltype(t_id->id) next_tid(t_id->id._id + 1);
466 auto lower = idx.lower_bound(boost::make_tuple(t_id->id));
467 auto upper = idx.lower_bound(boost::make_tuple(next_tid));
468
469 for (auto itr = lower; itr != upper; ++itr) {
470 if (!f(*itr)) {
471 break;
472 }
473 }
474 }
475 }
476
478
479 template <typename IndexType, typename SecKeyType, typename ConvFn>
482 const auto& d = db.db();
483
484 name scope{ convert_to_type<uint64_t>(p.scope, "scope") };
485
486 abi_serializer abis;
488 bool primary = false;
489 const uint64_t table_with_index = get_table_index_name(p, primary);
490 const auto* t_id = d.find<chain::table_id_object, chain::by_code_scope_table>(boost::make_tuple(p.code, scope, p.table));
491 const auto* index_t_id = d.find<chain::table_id_object, chain::by_code_scope_table>(boost::make_tuple(p.code, scope, name(table_with_index)));
492 if( t_id != nullptr && index_t_id != nullptr ) {
493 using secondary_key_type = std::result_of_t<decltype(conv)(SecKeyType)>;
494 static_assert( std::is_same<typename IndexType::value_type::secondary_key_type, secondary_key_type>::value, "Return type of conv does not match type of secondary key for IndexType" );
495
496 const auto& secidx = d.get_index<IndexType, chain::by_secondary>();
497 auto lower_bound_lookup_tuple = std::make_tuple( index_t_id->id._id,
499 std::numeric_limits<uint64_t>::lowest() );
500 auto upper_bound_lookup_tuple = std::make_tuple( index_t_id->id._id,
502 std::numeric_limits<uint64_t>::max() );
503
504 if( p.lower_bound.size() ) {
505 if( p.key_type == "name" ) {
506 name s(p.lower_bound);
507 SecKeyType lv = convert_to_type<SecKeyType>( s.to_string(), "lower_bound name" ); // avoids compiler error
508 std::get<1>(lower_bound_lookup_tuple) = conv( lv );
509 } else {
510 SecKeyType lv = convert_to_type<SecKeyType>( p.lower_bound, "lower_bound" );
511 std::get<1>(lower_bound_lookup_tuple) = conv( lv );
512 }
513 }
514
515 if( p.upper_bound.size() ) {
516 if( p.key_type == "name" ) {
517 name s(p.upper_bound);
518 SecKeyType uv = convert_to_type<SecKeyType>( s.to_string(), "upper_bound name" );
519 std::get<1>(upper_bound_lookup_tuple) = conv( uv );
520 } else {
521 SecKeyType uv = convert_to_type<SecKeyType>( p.upper_bound, "upper_bound" );
522 std::get<1>(upper_bound_lookup_tuple) = conv( uv );
523 }
524 }
525
526 if( upper_bound_lookup_tuple < lower_bound_lookup_tuple )
527 return result;
528
529 auto walk_table_row_range = [&]( auto itr, auto end_itr ) {
530 auto cur_time = fc::time_point::now();
531 auto end_time = cur_time + fc::microseconds(1000 * 10);
532 vector<char> data;
533 for( unsigned int count = 0; cur_time <= end_time && count < p.limit && itr != end_itr; ++itr, cur_time = fc::time_point::now() ) {
534 const auto* itr2 = d.find<chain::key_value_object, chain::by_scope_primary>( boost::make_tuple(t_id->id, itr->primary_key) );
535 if( itr2 == nullptr ) continue;
536 copy_inline_row(*itr2, data);
537
538 fc::variant data_var;
539 if( p.json ) {
540 data_var = abis.binary_to_variant( abis.get_table_type(p.table), data, abi_serializer::create_yield_function( abi_serializer_max_time ), shorten_abi_errors );
541 } else {
542 data_var = fc::variant( data );
543 }
544
545 if( p.show_payer && *p.show_payer ) {
546 result.rows.emplace_back( fc::mutable_variant_object("data", std::move(data_var))("payer", itr->payer) );
547 } else {
548 result.rows.emplace_back( std::move(data_var) );
549 }
550
551 ++count;
552 }
553 if( itr != end_itr ) {
554 result.more = true;
555 result.next_key = convert_to_string(itr->secondary_key, p.key_type, p.encode_type, "next_key - next lower bound");
556 }
557 };
558
559 auto lower = secidx.lower_bound( lower_bound_lookup_tuple );
560 auto upper = secidx.upper_bound( upper_bound_lookup_tuple );
561 if( p.reverse && *p.reverse ) {
562 walk_table_row_range( boost::make_reverse_iterator(upper), boost::make_reverse_iterator(lower) );
563 } else {
564 walk_table_row_range( lower, upper );
565 }
566 }
567 return result;
568 }
569
570 template <typename IndexType>
573 const auto& d = db.db();
574
575 uint64_t scope = convert_to_type<uint64_t>(p.scope, "scope");
576
577 abi_serializer abis;
579 const auto* t_id = d.find<chain::table_id_object, chain::by_code_scope_table>(boost::make_tuple(p.code, name(scope), p.table));
580 if( t_id != nullptr ) {
581 const auto& idx = d.get_index<IndexType, chain::by_scope_primary>();
582 auto lower_bound_lookup_tuple = std::make_tuple( t_id->id, std::numeric_limits<uint64_t>::lowest() );
583 auto upper_bound_lookup_tuple = std::make_tuple( t_id->id, std::numeric_limits<uint64_t>::max() );
584
585 if( p.lower_bound.size() ) {
586 if( p.key_type == "name" ) {
587 name s(p.lower_bound);
588 std::get<1>(lower_bound_lookup_tuple) = s.to_uint64_t();
589 } else {
590 auto lv = convert_to_type<typename IndexType::value_type::key_type>( p.lower_bound, "lower_bound" );
591 std::get<1>(lower_bound_lookup_tuple) = lv;
592 }
593 }
594
595 if( p.upper_bound.size() ) {
596 if( p.key_type == "name" ) {
597 name s(p.upper_bound);
598 std::get<1>(upper_bound_lookup_tuple) = s.to_uint64_t();
599 } else {
600 auto uv = convert_to_type<typename IndexType::value_type::key_type>( p.upper_bound, "upper_bound" );
601 std::get<1>(upper_bound_lookup_tuple) = uv;
602 }
603 }
604
605 if( upper_bound_lookup_tuple < lower_bound_lookup_tuple )
606 return result;
607
608 auto walk_table_row_range = [&]( auto itr, auto end_itr ) {
609 auto cur_time = fc::time_point::now();
610 auto end_time = cur_time + fc::microseconds(1000 * 10);
611 vector<char> data;
612 for( unsigned int count = 0; cur_time <= end_time && count < p.limit && itr != end_itr; ++count, ++itr, cur_time = fc::time_point::now() ) {
613 copy_inline_row(*itr, data);
614
615 fc::variant data_var;
616 if( p.json ) {
617 data_var = abis.binary_to_variant( abis.get_table_type(p.table), data, abi_serializer::create_yield_function( abi_serializer_max_time ), shorten_abi_errors );
618 } else {
619 data_var = fc::variant( data );
620 }
621
622 if( p.show_payer && *p.show_payer ) {
623 result.rows.emplace_back( fc::mutable_variant_object("data", std::move(data_var))("payer", itr->payer) );
624 } else {
625 result.rows.emplace_back( std::move(data_var) );
626 }
627 }
628 if( itr != end_itr ) {
629 result.more = true;
630 result.next_key = convert_to_string(itr->primary_key, p.key_type, p.encode_type, "next_key - next lower bound");
631 }
632 };
633
634 auto lower = idx.lower_bound( lower_bound_lookup_tuple );
635 auto upper = idx.upper_bound( upper_bound_lookup_tuple );
636 if( p.reverse && *p.reverse ) {
637 walk_table_row_range( boost::make_reverse_iterator(upper), boost::make_reverse_iterator(lower) );
638 } else {
639 walk_table_row_range( lower, upper );
640 }
641 }
642 return result;
643 }
644
648
650
651};
652
654 controller& db;
655 std::optional<trx_retry_db>& trx_retry;
656 const fc::microseconds abi_serializer_max_time;
657 const bool api_accept_transactions;
658public:
659 read_write(controller& db, std::optional<trx_retry_db>& trx_retry, const fc::microseconds& abi_serializer_max_time, bool api_accept_transactions);
660 void validate() const;
661
665
669 fc::variant processed; // "processed" is expected JSON for trxs in clio
670 };
672
673
677
681
684 bool retry_trx = false;
685 std::optional<uint16_t> retry_trx_num_blocks{};
687 };
689
690};
691
692 //support for --key_types [sha256,ripemd160] and --encoding [dec/hex]
693 constexpr const char i64[] = "i64";
694 constexpr const char i128[] = "i128";
695 constexpr const char i256[] = "i256";
696 constexpr const char float64[] = "float64";
697 constexpr const char float128[] = "float128";
698 constexpr const char sha256[] = "sha256";
699 constexpr const char ripemd160[] = "ripemd160";
700 constexpr const char dec[] = "dec";
701 constexpr const char hex[] = "hex";
702
703
704 template<const char*key_type , const char *encoding=chain_apis::dec>
706
707 template<>
711 static auto function() {
712 return [](const input_type& v) {
713 // The input is in big endian, i.e. f58262c8005bb64b8f99ec6083faf050c502d099d9929ae37ffed2fe1bb954fb
714 // fixed_bytes will convert the input to array of 2 uint128_t in little endian, i.e. 50f0fa8360ec998f4bb65b00c86282f5 fb54b91bfed2fe7fe39a92d999d002c5
715 // which is the format used by secondary index
716 uint8_t buffer[32];
717 memcpy(buffer, v.data(), 32);
718 fixed_bytes<32> fb(buffer);
719 return chain::key256_t(fb.get_array());
720 };
721 }
722 };
723
724 //key160 support with padding zeros in the end of key256
725 template<>
729 static auto function() {
730 return [](const input_type& v) {
731 // The input is in big endian, i.e. 83a83a3876c64c33f66f33c54f1869edef5b5d4a000000000000000000000000
732 // fixed_bytes will convert the input to array of 2 uint128_t in little endian, i.e. ed69184fc5336ff6334cc676383aa883 0000000000000000000000004a5d5bef
733 // which is the format used by secondary index
734 uint8_t buffer[20];
735 memcpy(buffer, v.data(), 20);
736 fixed_bytes<20> fb(buffer);
737 return chain::key256_t(fb.get_array());
738 };
739 }
740 };
741
742 template<>
743 struct keytype_converter<chain_apis::i256> {
744 using input_type = boost::multiprecision::uint256_t;
746 static auto function() {
747 return [](const input_type v) {
748 // The input is in little endian of uint256_t, i.e. fb54b91bfed2fe7fe39a92d999d002c550f0fa8360ec998f4bb65b00c86282f5
749 // the following will convert the input to array of 2 uint128_t in little endian, i.e. 50f0fa8360ec998f4bb65b00c86282f5 fb54b91bfed2fe7fe39a92d999d002c5
750 // which is the format used by secondary index
752 uint8_t buffer[32];
753 boost::multiprecision::export_bits(v, buffer, 8, false);
754 memcpy(&k[0], buffer + 16, 16);
755 memcpy(&k[1], buffer, 16);
756 return k;
757 };
758 }
759 };
760
761} // namespace chain_apis
762
763class chain_plugin : public plugin<chain_plugin> {
764public:
766
767 chain_plugin();
768 virtual ~chain_plugin();
769
770 virtual void set_program_options(options_description& cli, options_description& cfg) override;
771
772 void plugin_initialize(const variables_map& options);
773 void plugin_startup();
774 void plugin_shutdown();
775 void handle_sighup() override;
776
779
780 bool accept_block( const chain::signed_block_ptr& block, const chain::block_id_type& id, const chain::block_state_ptr& bsp );
782
783 // Only call this after plugin_initialize()!
784 controller& chain();
785 // Only call this after plugin_initialize()!
786 const controller& chain() const;
787
790 bool api_accept_transactions() const;
791 // set true by other plugins if any plugin allows transactions
792 bool accept_transactions() const;
794
796 void do_hard_replay(const variables_map& options);
797
798 static void handle_db_exhaustion();
799 static void handle_bad_alloc();
800
801 bool account_queries_enabled() const;
803
804 // return variant of trace for logging, trace is modified to minimize log output
806 // return variant of trx for logging, trace is modified to minimize log output
807 fc::variant get_log_trx(const transaction& trx) const;
808
809private:
810 static void log_guard_exception(const chain::guard_exception& e);
811
813};
814
815}
816
818FC_REFLECT( sysio::chain_apis::permission, (perm_name)(parent)(required_auth)(linked_actions) )
820FC_REFLECT(sysio::chain_apis::read_only::get_info_results,
821 (server_version)(chain_id)(head_block_num)(last_irreversible_block_num)(last_irreversible_block_id)
822 (head_block_id)(head_block_time)(head_block_producer)
823 (virtual_block_cpu_limit)(virtual_block_net_limit)(block_cpu_limit)(block_net_limit)
824 (server_version_string)(fork_db_head_block_num)(fork_db_head_block_id)(server_full_version_string)
825 (total_cpu_weight)(total_net_weight)(earliest_available_block_num)(last_irreversible_block_time))
826FC_REFLECT(sysio::chain_apis::read_only::get_transaction_status_params, (id) )
827FC_REFLECT(sysio::chain_apis::read_only::get_transaction_status_results, (state)(block_number)(block_id)(block_timestamp)(expiration)(head_number)(head_id)
828 (head_timestamp)(irreversible_number)(irreversible_id)(irreversible_timestamp)(earliest_tracked_block_id)(earliest_tracked_block_number) )
829FC_REFLECT(sysio::chain_apis::read_only::get_activated_protocol_features_params, (lower_bound)(upper_bound)(limit)(search_by_block_num)(reverse) )
830FC_REFLECT(sysio::chain_apis::read_only::get_activated_protocol_features_results, (activated_protocol_features)(more) )
831FC_REFLECT(sysio::chain_apis::read_only::get_block_params, (block_num_or_id))
832FC_REFLECT(sysio::chain_apis::read_only::get_block_info_params, (block_num))
833FC_REFLECT(sysio::chain_apis::read_only::get_block_header_state_params, (block_num_or_id))
834
835FC_REFLECT( sysio::chain_apis::read_write::push_transaction_results, (transaction_id)(processed) )
836FC_REFLECT( sysio::chain_apis::read_write::send_transaction2_params, (return_failure_trace)(retry_trx)(retry_trx_num_blocks)(transaction) )
837
838FC_REFLECT( sysio::chain_apis::read_only::get_table_rows_params, (json)(code)(scope)(table)(table_key)(lower_bound)(upper_bound)(limit)(key_type)(index_position)(encode_type)(reverse)(show_payer) )
839FC_REFLECT( sysio::chain_apis::read_only::get_table_rows_result, (rows)(more)(next_key) );
840
841FC_REFLECT( sysio::chain_apis::read_only::get_table_by_scope_params, (code)(table)(lower_bound)(upper_bound)(limit)(reverse) )
842FC_REFLECT( sysio::chain_apis::read_only::get_table_by_scope_result_row, (code)(scope)(table)(payer)(count));
843FC_REFLECT( sysio::chain_apis::read_only::get_table_by_scope_result, (rows)(more) );
844
845FC_REFLECT( sysio::chain_apis::read_only::get_currency_balance_params, (code)(account)(symbol));
846FC_REFLECT( sysio::chain_apis::read_only::get_currency_stats_params, (code)(symbol));
847FC_REFLECT( sysio::chain_apis::read_only::get_currency_stats_result, (supply)(max_supply)(issuer));
848
849FC_REFLECT( sysio::chain_apis::read_only::get_producers_params, (json)(lower_bound)(limit) )
850FC_REFLECT( sysio::chain_apis::read_only::get_producers_result, (rows)(total_producer_vote_weight)(more) );
851
852FC_REFLECT_EMPTY( sysio::chain_apis::read_only::get_producer_schedule_params )
853FC_REFLECT( sysio::chain_apis::read_only::get_producer_schedule_result, (active)(pending)(proposed) );
854
855FC_REFLECT( sysio::chain_apis::read_only::get_scheduled_transactions_params, (json)(lower_bound)(limit) )
856FC_REFLECT( sysio::chain_apis::read_only::get_scheduled_transactions_result, (transactions)(more) );
857
858FC_REFLECT( sysio::chain_apis::read_only::get_account_results,
859 (account_name)(head_block_num)(head_block_time)(privileged)(last_code_update)(created)
860 (core_liquid_balance)(ram_quota)(net_weight)(cpu_weight)(net_limit)(cpu_limit)(ram_usage)(permissions)
861 (total_resources)(self_delegated_bandwidth)(refund_request)(voter_info)(rex_info)
862 (subjective_cpu_bill_limit) (sysio_any_linked_actions) )
863// @swap code_hash
864FC_REFLECT( sysio::chain_apis::read_only::get_code_results, (account_name)(code_hash)(wast)(wasm)(abi) )
865FC_REFLECT( sysio::chain_apis::read_only::get_code_hash_results, (account_name)(code_hash) )
866FC_REFLECT( sysio::chain_apis::read_only::get_abi_results, (account_name)(abi) )
867FC_REFLECT( sysio::chain_apis::read_only::get_account_params, (account_name)(expected_core_symbol) )
868FC_REFLECT( sysio::chain_apis::read_only::get_code_params, (account_name)(code_as_wasm) )
869FC_REFLECT( sysio::chain_apis::read_only::get_code_hash_params, (account_name) )
870FC_REFLECT( sysio::chain_apis::read_only::get_abi_params, (account_name) )
871FC_REFLECT( sysio::chain_apis::read_only::get_raw_code_and_abi_params, (account_name) )
872FC_REFLECT( sysio::chain_apis::read_only::get_raw_code_and_abi_results, (account_name)(wasm)(abi) )
873FC_REFLECT( sysio::chain_apis::read_only::get_raw_abi_params, (account_name)(abi_hash) )
874FC_REFLECT( sysio::chain_apis::read_only::get_raw_abi_results, (account_name)(code_hash)(abi_hash)(abi) )
875FC_REFLECT( sysio::chain_apis::read_only::producer_info, (producer_name) )
876FC_REFLECT( sysio::chain_apis::read_only::abi_json_to_bin_params, (code)(action)(args) )
877FC_REFLECT( sysio::chain_apis::read_only::abi_json_to_bin_result, (binargs) )
878FC_REFLECT( sysio::chain_apis::read_only::abi_bin_to_json_params, (code)(action)(binargs) )
879FC_REFLECT( sysio::chain_apis::read_only::abi_bin_to_json_result, (args) )
880FC_REFLECT( sysio::chain_apis::read_only::get_required_keys_params, (transaction)(available_keys) )
881FC_REFLECT( sysio::chain_apis::read_only::get_required_keys_result, (required_keys) )
882FC_REFLECT( sysio::chain_apis::read_only::compute_transaction_params, (transaction))
883FC_REFLECT( sysio::chain_apis::read_only::compute_transaction_results, (transaction_id)(processed) )
884
const mie::Vuint & p
Definition bn.cpp:27
An order-preserving dictionary of variants.
static time_point now()
Definition time.cpp:14
An order-preserving dictionary of variants.
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
Definition variant.hpp:191
T as() const
Definition variant.hpp:327
const chainbase::database & db() const
The table_id_object class tracks the mapping of (scope, code, table) to an opaque identifier.
void walk_key_value_table(const name &code, const name &scope, const name &table, Function f) const
static void copy_inline_row(const chain::key_value_object &obj, vector< char > &data)
static const string KEYi64
read_only::get_table_rows_result get_table_rows_by_seckey(const read_only::get_table_rows_params &p, const abi_def &abi, ConvFn conv) const
abi_bin_to_json_result abi_bin_to_json(const abi_bin_to_json_params &params) const
abi_json_to_bin_result abi_json_to_bin(const abi_json_to_bin_params &params) const
chain::symbol extract_core_symbol() const
get_raw_code_and_abi_results get_raw_code_and_abi(const get_raw_code_and_abi_params &params) const
fc::variant get_block_info(const get_block_info_params &params) const
fc::variant get_block(const get_block_params &params) const
get_accounts_by_authorizers_result get_accounts_by_authorizers(const get_accounts_by_authorizers_params &args) const
vector< asset > get_currency_balance(const get_currency_balance_params &params) const
get_raw_abi_results get_raw_abi(const get_raw_abi_params &params) const
get_abi_results get_abi(const get_abi_params &params) const
fc::variant get_currency_stats(const get_currency_stats_params &params) const
void compute_transaction(const compute_transaction_params &params, chain::plugin_interface::next_function< compute_transaction_results > next) const
get_account_results get_account(const get_account_params &params) const
get_producers_result get_producers(const get_producers_params &params) const
read_only(const controller &db, const std::optional< account_query_db > &aqdb, const fc::microseconds &abi_serializer_max_time, const producer_plugin *producer_plug, const trx_finality_status_processing *trx_finality_status_proc)
get_table_rows_result get_table_rows(const get_table_rows_params &params) const
get_transaction_status_results get_transaction_status(const get_transaction_status_params &params) const
get_code_results get_code(const get_code_params &params) const
get_activated_protocol_features_results get_activated_protocol_features(const get_activated_protocol_features_params &params) const
get_scheduled_transactions_result get_scheduled_transactions(const get_scheduled_transactions_params &params) const
read_only::get_table_rows_result get_table_rows_ex(const read_only::get_table_rows_params &p, const abi_def &abi) const
get_required_keys_result get_required_keys(const get_required_keys_params &params) const
get_transaction_id_result get_transaction_id(const get_transaction_id_params &params) const
fc::variant get_block_header_state(const get_block_header_state_params &params) const
get_table_by_scope_result get_table_by_scope(const get_table_by_scope_params &params) const
get_producer_schedule_result get_producer_schedule(const get_producer_schedule_params &params) const
static uint64_t get_table_index_name(const read_only::get_table_rows_params &p, bool &primary)
void push_block(push_block_params &&params, chain::plugin_interface::next_function< push_block_results > next)
void push_transactions(const push_transactions_params &params, chain::plugin_interface::next_function< push_transactions_results > next)
void send_transaction(const send_transaction_params &params, chain::plugin_interface::next_function< send_transaction_results > next)
fc::variant_object push_transaction_params
void send_transaction2(const send_transaction2_params &params, chain::plugin_interface::next_function< send_transaction_results > next)
void push_transaction(const push_transaction_params &params, chain::plugin_interface::next_function< push_transaction_results > next)
void plugin_initialize(const variables_map &options)
static void handle_db_exhaustion()
bool accept_block(const chain::signed_block_ptr &block, const chain::block_id_type &id, const chain::block_state_ptr &bsp)
bool api_accept_transactions() const
fc::microseconds get_abi_serializer_max_time() const
chain_apis::read_write get_read_write_api()
bool account_queries_enabled() const
void do_hard_replay(const variables_map &options)
chain_apis::read_only get_read_only_api() const
static void handle_guard_exception(const chain::guard_exception &e)
bool transaction_finality_status_enabled() const
chain::chain_id_type get_chain_id() const
static void handle_bad_alloc()
virtual void set_program_options(options_description &cli, options_description &cfg) override
void accept_transaction(const chain::packed_transaction_ptr &trx, chain::plugin_interface::next_function< chain::transaction_trace_ptr > next)
fc::variant get_log_trx_trace(const chain::transaction_trace_ptr &trx_trace) const
bool accept_transactions() const
fc::variant get_log_trx(const transaction &trx) const
void handle_sighup() override
const auto & get_array() const
#define FC_RETHROW_EXCEPTIONS(LOG_LEVEL, FORMAT,...)
Catchs all exception's, std::exceptions, and ... and rethrows them after appending the provided log m...
int * count
namespace sysio::chain
Definition authority.cpp:3
@ read_write
std::vector< fc::variant > variants
Definition variant.hpp:173
std::function< void(const std::variant< fc::exception_ptr, T > &)> next_function
string convert_to_string(const Type &source, const string &key_type, const string &encode_type, const string &desc)
constexpr const char hex[]
constexpr const char i256[]
constexpr const char float64[]
constexpr const char i64[]
uint64_t convert_to_type(const string &str, const string &desc)
constexpr const char dec[]
constexpr const char i128[]
constexpr const char float128[]
fc::crypto::public_key public_key_type
Definition types.hpp:76
std::array< uint128_t, 2 > key256_t
std::shared_ptr< transaction_trace > transaction_trace_ptr
Definition trace.hpp:20
key Invalid authority Invalid transaction Invalid block ID Invalid packed transaction Invalid chain ID Invalid symbol Signature type is not a currently activated type Block can not be found Unlinkable block Block does not guarantee concurrent execution without conflicts Block exhausted allowed resources Block is from the future Block is not signed by expected producer Block includes an ill formed protocol feature activation extension Block includes an ill formed additional block signature extension Error decompressing transaction Transaction should have at least one required authority Expired Transaction Invalid Reference Block Duplicate deferred transaction The transaction can not be found Transaction is too big Invalid transaction extension Transaction includes disallowed Transaction exceeded transient resource limit Account name already exists sysio_assert_message assertion failure Action can not be found Attempt to use unaccessible API Inline Action exceeds maximum size limit sysio_assert_code assertion failure uses restricted error code value action return value size too big Permission Query Exception Contract Table Query Exception Database is an unknown or unsupported version guard_exception
std::shared_ptr< const packed_transaction > packed_transaction_ptr
sysio::chain::action_name action_name
unsigned __int128 uint128_t
Definition types.hpp:242
fc::ripemd160 checksum160_type
Definition types.hpp:235
secondary_index< key256_t, index256_object_type >::index_index index256_index
fc::sha256 checksum256_type
Definition types.hpp:233
std::shared_ptr< signed_block > signed_block_ptr
Definition block.hpp:105
checksum_type transaction_id_type
Definition types.hpp:236
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
name account_name
Definition types.hpp:120
#define APPBASE_PLUGIN_REQUIRES(PLUGINS)
Definition plugin.hpp:11
const CharType(& source)[N]
Definition pointer.h:1204
const fc::microseconds abi_serializer_max_time
Definition main.cpp:173
sysio::chain_apis::read_only::get_info_results get_info()
Definition main.cpp:287
producer_name(block_signing_key)) FC_REFLECT(producer_set_def
Type
Type of JSON value.
Definition rapidjson.h:644
#define FC_REFLECT(TYPE, MEMBERS)
Specializes fc::reflector for TYPE.
Definition reflect.hpp:311
#define FC_REFLECT_EMPTY(TYPE)
Definition reflect.hpp:317
signed __int64 int64_t
Definition stdint.h:135
unsigned int uint32_t
Definition stdint.h:126
unsigned char uint8_t
Definition stdint.h:124
unsigned __int64 uint64_t
Definition stdint.h:136
size_t size() const
Definition zm.h:519
static yield_function_t create_yield_function(const fc::microseconds &max_serialization_time)
void set_abi(const abi_def &abi, const yield_function_t &yield)
type_name get_table_type(name action) const
fc::variant binary_to_variant(const std::string_view &type, const bytes &binary, const yield_function_t &yield, bool short_path=false) const
Immutable except for fc::from_variant.
Definition name.hpp:43
std::optional< std::vector< linked_action > > linked_actions
std::optional< account_resource_limit > subjective_cpu_bill_limit
std::vector< linked_action > sysio_any_linked_actions
std::optional< uint32_t > earliest_available_block_num
std::optional< chain::block_id_type > fork_db_head_block_id
std::optional< fc::time_point > last_irreversible_block_time
vector< fc::variant > rows
one row per item, either encoded as hex string or JSON object
string more
fill lower_bound with this value to fetch more rows
string more
fill lower_bound with this to fetch next set of transactions
vector< get_table_by_scope_result_row > rows
string more
fill lower_bound with this value to fetch more rows
vector< fc::variant > rows
one row per item, either encoded as hex String or JSON object
string next_key
fill lower_bound with this value to fetch more rows
bool retry_trx
request transaction retry on validated transaction
std::optional< uint16_t > retry_trx_num_blocks
if retry_trx, report trace at specified blocks from executed or lib if not specified
void cli()
CK_ULONG d
char * s
memcpy((char *) pInfo->slotDescription, s, l)
struct @108 key_type