diff --git a/eosio-wasm-spec-tests b/eosio-wasm-spec-tests index 870d22f1025..10bd2209261 160000 --- a/eosio-wasm-spec-tests +++ b/eosio-wasm-spec-tests @@ -1 +1 @@ -Subproject commit 870d22f1025742406c83c231121ffd4dee9c5eeb +Subproject commit 10bd2209261792d7b5306e4b282072a8f9d51805 diff --git a/libraries/chain/apply_context.cpp b/libraries/chain/apply_context.cpp index 713daacc549..5d74fccc192 100644 --- a/libraries/chain/apply_context.cpp +++ b/libraries/chain/apply_context.cpp @@ -116,7 +116,7 @@ void apply_context::exec_one() if( ( receiver_account->code_hash != digest_type() ) && ( !( act->account == config::system_account_name - && act->name == N( setcode ) + && act->name == "setcode"_n && receiver == config::system_account_name ) || control.is_builtin_activated( builtin_protocol_feature_t::forward_setcode ) ) diff --git a/libraries/chain/controller.cpp b/libraries/chain/controller.cpp index af0e0788929..ddf8effb48d 100644 --- a/libraries/chain/controller.cpp +++ b/libraries/chain/controller.cpp @@ -2538,7 +2538,7 @@ struct controller_impl { { action on_block_act; on_block_act.account = config::system_account_name; - on_block_act.name = N(onblock); + on_block_act.name = "onblock"_n; on_block_act.authorization = vector{{config::system_account_name, config::active_name}}; on_block_act.data = fc::raw::pack(self.head_block_header()); diff --git a/libraries/chain/include/eosio/chain/config.hpp b/libraries/chain/include/eosio/chain/config.hpp index ed74296a97f..4e2d11e41af 100644 --- a/libraries/chain/include/eosio/chain/config.hpp +++ b/libraries/chain/include/eosio/chain/config.hpp @@ -23,21 +23,21 @@ const static auto default_state_size = 1*1024*1024*1024ll; const static auto default_state_guard_size = 128*1024*1024ll; -const static name system_account_name { N(eosio) }; -const static name null_account_name { N(eosio.null) }; -const static name producers_account_name { N(eosio.prods) }; +const static name system_account_name { "eosio"_n }; +const static name null_account_name { "eosio.null"_n }; +const static name producers_account_name { "eosio.prods"_n }; // Active permission of producers account requires greater than 2/3 of the producers to authorize -const static name majority_producers_permission_name { N(prod.major) }; // greater than 1/2 of producers needed to authorize -const static name minority_producers_permission_name { N(prod.minor) }; // greater than 1/3 of producers needed to authorize0 +const static name majority_producers_permission_name { "prod.major"_n }; // greater than 1/2 of producers needed to authorize +const static name minority_producers_permission_name { "prod.minor"_n }; // greater than 1/3 of producers needed to authorize0 -const static name eosio_auth_scope { N(eosio.auth) }; -const static name eosio_all_scope { N(eosio.all) }; +const static name eosio_auth_scope { "eosio.auth"_n }; +const static name eosio_all_scope { "eosio.all"_n }; -const static name active_name { N(active) }; -const static name owner_name { N(owner) }; -const static name eosio_any_name { N(eosio.any) }; -const static name eosio_code_name { N(eosio.code) }; +const static name active_name { "active"_n }; +const static name owner_name { "owner"_n }; +const static name eosio_any_name { "eosio.any"_n }; +const static name eosio_code_name { "eosio.code"_n }; const static int block_interval_ms = 500; const static int block_interval_us = block_interval_ms*1000; diff --git a/libraries/chain/include/eosio/chain/contract_types.hpp b/libraries/chain/include/eosio/chain/contract_types.hpp index 3870f9b8440..54c0f8212ba 100644 --- a/libraries/chain/include/eosio/chain/contract_types.hpp +++ b/libraries/chain/include/eosio/chain/contract_types.hpp @@ -18,7 +18,7 @@ struct newaccount { } static action_name get_name() { - return N(newaccount); + return "newaccount"_n; } }; @@ -33,7 +33,7 @@ struct setcode { } static action_name get_name() { - return N(setcode); + return "setcode"_n; } }; @@ -46,7 +46,7 @@ struct setabi { } static action_name get_name() { - return N(setabi); + return "setabi"_n; } }; @@ -62,7 +62,7 @@ struct updateauth { } static action_name get_name() { - return N(updateauth); + return "updateauth"_n; } }; @@ -80,7 +80,7 @@ struct deleteauth { } static action_name get_name() { - return N(deleteauth); + return "deleteauth"_n; } }; @@ -100,7 +100,7 @@ struct linkauth { } static action_name get_name() { - return N(linkauth); + return "linkauth"_n; } }; @@ -119,7 +119,7 @@ struct unlinkauth { } static action_name get_name() { - return N(unlinkauth); + return "unlinkauth"_n; } }; @@ -132,7 +132,7 @@ struct canceldelay { } static action_name get_name() { - return N(canceldelay); + return "canceldelay"_n; } }; @@ -148,7 +148,7 @@ struct onerror { } static action_name get_name() { - return N(onerror); + return "onerror"_n; } }; diff --git a/libraries/chain/include/eosio/chain/kv_context.hpp b/libraries/chain/include/eosio/chain/kv_context.hpp index 2765288cfc7..dcff3197609 100644 --- a/libraries/chain/include/eosio/chain/kv_context.hpp +++ b/libraries/chain/include/eosio/chain/kv_context.hpp @@ -14,7 +14,7 @@ namespace eosio { namespace chain { class apply_context; - inline constexpr name kvram_id = N(eosio.kvram); + inline constexpr name kvram_id = "eosio.kvram"_n; enum class kv_it_stat { iterator_ok = 0, // Iterator is positioned at a key-value pair diff --git a/libraries/chain/include/eosio/chain/name.hpp b/libraries/chain/include/eosio/chain/name.hpp index 5ed13d99db3..2551da692c8 100644 --- a/libraries/chain/include/eosio/chain/name.hpp +++ b/libraries/chain/include/eosio/chain/name.hpp @@ -15,7 +15,7 @@ namespace fc { } // fc namespace eosio::chain { - static constexpr uint64_t char_to_symbol( char c ) { + constexpr uint64_t char_to_symbol( char c ) { if( c >= 'a' && c <= 'z' ) return (c - 'a') + 6; if( c >= '1' && c <= '5' ) @@ -24,7 +24,7 @@ namespace eosio::chain { return 0; else FC_THROW_EXCEPTION(name_type_exception, "Name contains invalid character: (${c}) ", ("c", std::string(1, c))); - + //unreachable return 0; } @@ -32,26 +32,23 @@ namespace eosio::chain { // true if std::string can be converted to name bool is_string_valid_name(std::string_view str); - static constexpr uint64_t string_to_uint64_t( std::string_view str ) { + constexpr uint64_t string_to_uint64_t( std::string_view str ) { EOS_ASSERT(str.size() <= 13, name_type_exception, "Name is longer than 13 characters (${name}) ", ("name", std::string(str))); uint64_t n = 0; - int i = 0; - for ( ; str[i] && i < 12; ++i) { - // NOTE: char_to_symbol() returns char type, and without this explicit - // expansion to uint64 type, the compilation fails at the point of usage - // of string_to_name(), where the usage requires constant (compile time) expression. - n |= char_to_symbol(str[i]) << (64 - 5 * (i + 1)); + int i = (int) str.size(); + if (i >= 13) { + // Only the first 12 characters can be full-range ([.1-5a-z]). + i = 12; + + // The 13th character must be in the range [.1-5a-j] because it needs to be encoded + // using only four bits (64_bits - 5_bits_per_char * 12_chars). + n = char_to_symbol(str[12]); + EOS_ASSERT(n <= 0x0Full, name_type_exception, "invalid 13th character: (${c})", ("c", std::string(1, str[12]))); } - - // The for-loop encoded up to 60 high bits into uint64 'name' variable, - // if (strlen(str) > 12) then encode str[12] into the low (remaining) - // 4 bits of 'name' - if (i == 12 && str[12]) - { - uint64_t cur_v = char_to_symbol(str[12]); - EOS_ASSERT(cur_v <= 0x0Full, name_type_exception, "invalid 13th character: (${c})", ("c", std::string(1, str[12]))); - n |= cur_v; + // Encode full-range characters. + while (--i >= 0) { + n |= char_to_symbol(str[i]) << (64 - 5 * (i + 1)); } return n; } @@ -98,12 +95,21 @@ namespace eosio::chain { // to its 5-bit slot starting with the highest slot for the first char. // The 13th char, if str is long enough, is encoded into 4-bit chunk // and placed in the lowest 4 bits. 64 = 12 * 5 + 4 - static constexpr name string_to_name( std::string_view str ) + constexpr name string_to_name( std::string_view str ) { return name( string_to_uint64_t( str ) ); } -#define N(X) eosio::chain::string_to_name(#X) + inline namespace literals { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu-string-literal-operator-template" + template + inline constexpr name operator""_n() { + constexpr const char buf[] = {Str...}; + return name{std::integral_constant::value}; + } +#pragma clang diagnostic pop + } // namespace literals } // eosio::chain diff --git a/libraries/chain/include/eosio/chain/trace.hpp b/libraries/chain/include/eosio/chain/trace.hpp index a6ad3c7f45c..6a7b05012a8 100644 --- a/libraries/chain/include/eosio/chain/trace.hpp +++ b/libraries/chain/include/eosio/chain/trace.hpp @@ -73,7 +73,7 @@ namespace eosio { namespace chain { if (tt.action_traces.empty()) return false; const auto& act = tt.action_traces[0].act; - if (act.account != eosio::chain::config::system_account_name || act.name != N(onblock) || + if (act.account != eosio::chain::config::system_account_name || act.name != "onblock"_n || act.authorization.size() != 1) return false; const auto& auth = act.authorization[0]; diff --git a/libraries/state_history/include/eosio/state_history/log.hpp b/libraries/state_history/include/eosio/state_history/log.hpp index fb0f2d7eeb2..d0feb3daf2d 100644 --- a/libraries/state_history/include/eosio/state_history/log.hpp +++ b/libraries/state_history/include/eosio/state_history/log.hpp @@ -37,8 +37,14 @@ namespace bfs = boost::filesystem; * payload */ -inline uint64_t ship_magic(uint32_t version) { return N(ship).to_uint64_t() | version; } -inline bool is_ship(uint64_t magic) { return (magic & 0xffff'ffff'0000'0000) == N(ship).to_uint64_t(); } +inline uint64_t ship_magic(uint32_t version) { + using namespace eosio::chain::literals; + return "ship"_n.to_uint64_t() | version; +} +inline bool is_ship(uint64_t magic) { + using namespace eosio::chain::literals; + return (magic & 0xffff'ffff'0000'0000) == "ship"_n.to_uint64_t(); +} inline uint32_t get_ship_version(uint64_t magic) { return magic; } inline bool is_ship_supported_version(uint64_t magic) { return get_ship_version(magic) <= 1; } static const uint32_t ship_current_version = 1; diff --git a/libraries/state_history/transaction_trace_cache.cpp b/libraries/state_history/transaction_trace_cache.cpp index 971de616cfb..1fef5486eda 100644 --- a/libraries/state_history/transaction_trace_cache.cpp +++ b/libraries/state_history/transaction_trace_cache.cpp @@ -11,7 +11,8 @@ bool is_onblock(const transaction_trace_ptr& p) { if (p->action_traces.size() != 1) return false; auto& act = p->action_traces[0].act; - if (act.account != eosio::chain::config::system_account_name || act.name != N(onblock) || + using namespace eosio::chain::literals; + if (act.account != eosio::chain::config::system_account_name || act.name != "onblock"_n || act.authorization.size() != 1) return false; auto& auth = act.authorization[0]; diff --git a/libraries/testing/tester.cpp b/libraries/testing/tester.cpp index 9012ab2a0f5..087e759a795 100644 --- a/libraries/testing/tester.cpp +++ b/libraries/testing/tester.cpp @@ -966,7 +966,7 @@ namespace eosio { namespace testing { const symbol& asset_symbol, const account_name& account ) const { const auto& db = control->db(); - const auto* tbl = db.template find(boost::make_tuple(code, account, N(accounts))); + const auto* tbl = db.template find(boost::make_tuple(code, account, "accounts"_n)); share_type result = 0; // the balance is implied to be 0 if either the table or row does not exist @@ -1098,7 +1098,7 @@ namespace eosio { namespace testing { schedule_variant.emplace_back(e.get_abi_variant()); } - return push_action( config::system_account_name, N(setprods), config::system_account_name, + return push_action( config::system_account_name, "setprods"_n, config::system_account_name, fc::mutable_variant_object()("schedule", schedule_variant)); } @@ -1115,7 +1115,7 @@ namespace eosio { namespace testing { }, p.authority); } - return push_action( config::system_account_name, N(setprods), config::system_account_name, + return push_action( config::system_account_name, "setprods"_n, config::system_account_name, fc::mutable_variant_object()("schedule", legacy_keys)); } @@ -1136,7 +1136,7 @@ namespace eosio { namespace testing { void base_tester::preactivate_protocol_features(const vector feature_digests) { for( const auto& feature_digest: feature_digests ) { - push_action( config::system_account_name, N(activate), config::system_account_name, + push_action( config::system_account_name, "activate"_n, config::system_account_name, fc::mutable_variant_object()("feature_digest", feature_digest) ); } } diff --git a/plugins/chain_plugin/account_query_db.cpp b/plugins/chain_plugin/account_query_db.cpp index b5c5e8d4504..f3d5d8fffc2 100644 --- a/plugins/chain_plugin/account_query_db.cpp +++ b/plugins/chain_plugin/account_query_db.cpp @@ -16,6 +16,7 @@ #include using namespace eosio; +using namespace eosio::chain::literals; using namespace boost::multi_index; using namespace boost::bimaps; @@ -68,7 +69,7 @@ namespace { if (p->action_traces.empty()) return false; const auto& act = p->action_traces[0].act; - if (act.account != eosio::chain::config::system_account_name || act.name != N(onblock) || + if (act.account != eosio::chain::config::system_account_name || act.name != "onblock"_n || act.authorization.size() != 1) return false; const auto& auth = act.authorization[0]; @@ -288,8 +289,8 @@ namespace eosio::chain_apis { updated.erase(*itr); } else if (at.act.name == chain::newaccount::get_name()) { auto data = at.act.data_as(); - updated.emplace(chain::permission_level{data.name, N(owner)}); - updated.emplace(chain::permission_level{data.name, N(active)}); + updated.emplace(chain::permission_level{data.name, "owner"_n}); + updated.emplace(chain::permission_level{data.name, "active"_n}); } } }; diff --git a/plugins/chain_plugin/chain_plugin.cpp b/plugins/chain_plugin/chain_plugin.cpp index e0173de0c43..97592962f8c 100644 --- a/plugins/chain_plugin/chain_plugin.cpp +++ b/plugins/chain_plugin/chain_plugin.cpp @@ -1963,7 +1963,7 @@ vector read_only::get_currency_balance( const read_only::get_currency_bal (void)get_table_type( abi, name("accounts") ); vector results; - walk_key_value_table(p.code, p.account, N(accounts), [&](const key_value_object& obj){ + walk_key_value_table(p.code, p.account, "accounts"_n, [&](const key_value_object& obj){ EOS_ASSERT( obj.value.size() >= sizeof(asset), chain::asset_type_exception, "Invalid data on table"); asset cursor; @@ -1991,7 +1991,7 @@ fc::variant read_only::get_currency_stats( const read_only::get_currency_stats_p uint64_t scope = ( eosio::chain::string_to_symbol( 0, boost::algorithm::to_upper_copy(p.symbol).c_str() ) >> 8 ); - walk_key_value_table(p.code, name(scope), N(stat), [&](const key_value_object& obj){ + walk_key_value_table(p.code, name(scope), "stat"_n, [&](const key_value_object& obj){ EOS_ASSERT( obj.value.size() >= sizeof(read_only::get_currency_stats_result), chain::asset_type_exception, "Invalid data on table"); fc::datastream ds(obj.value.data(), obj.value.size()); @@ -2009,24 +2009,24 @@ fc::variant read_only::get_currency_stats( const read_only::get_currency_stats_p } fc::variant get_global_row( const database& db, const abi_def& abi, const abi_serializer& abis, const fc::microseconds& abi_serializer_max_time_us, bool shorten_abi_errors ) { - const auto table_type = get_table_type(abi, N(global)); + const auto table_type = get_table_type(abi, "global"_n); EOS_ASSERT(table_type == read_only::KEYi64, chain::contract_table_query_exception, "Invalid table type ${type} for table global", ("type",table_type)); - const auto* const table_id = db.find(boost::make_tuple(config::system_account_name, config::system_account_name, N(global))); + const auto* const table_id = db.find(boost::make_tuple(config::system_account_name, config::system_account_name, "global"_n)); EOS_ASSERT(table_id, chain::contract_table_query_exception, "Missing table global"); const auto& kv_index = db.get_index(); - const auto it = kv_index.find(boost::make_tuple(table_id->id, N(global).to_uint64_t())); + const auto it = kv_index.find(boost::make_tuple(table_id->id, "global"_n.to_uint64_t())); EOS_ASSERT(it != kv_index.end(), chain::contract_table_query_exception, "Missing row in table global"); vector data; read_only::copy_inline_row(*it, data); - return abis.binary_to_variant(abis.get_table_type(N(global)), data, abi_serializer::create_yield_function( abi_serializer_max_time_us ), shorten_abi_errors ); + return abis.binary_to_variant(abis.get_table_type("global"_n), data, abi_serializer::create_yield_function( abi_serializer_max_time_us ), shorten_abi_errors ); } read_only::get_producers_result read_only::get_producers( const read_only::get_producers_params& p ) const try { const abi_def abi = eosio::chain_apis::get_abi(db, config::system_account_name); - const auto table_type = get_table_type(abi, N(producers)); + const auto table_type = get_table_type(abi, "producers"_n); const abi_serializer abis{ abi, abi_serializer::create_yield_function( abi_serializer_max_time ) }; EOS_ASSERT(table_type == KEYi64, chain::contract_table_query_exception, "Invalid table type ${type} for table producers", ("type",table_type)); @@ -2035,9 +2035,9 @@ read_only::get_producers_result read_only::get_producers( const read_only::get_p static const uint8_t secondary_index_num = 0; const auto* const table_id = d.find( - boost::make_tuple(config::system_account_name, config::system_account_name, N(producers))); + boost::make_tuple(config::system_account_name, config::system_account_name, "producers"_n)); const auto* const secondary_table_id = d.find( - boost::make_tuple(config::system_account_name, config::system_account_name, name(N(producers).to_uint64_t() | secondary_index_num))); + boost::make_tuple(config::system_account_name, config::system_account_name, name("producers"_n.to_uint64_t() | secondary_index_num))); EOS_ASSERT(table_id && secondary_table_id, chain::contract_table_query_exception, "Missing producers table"); const auto& kv_index = d.get_index(); @@ -2066,7 +2066,7 @@ read_only::get_producers_result read_only::get_producers( const read_only::get_p } copy_inline_row(*kv_index.find(boost::make_tuple(table_id->id, it->primary_key)), data); if (p.json) - result.rows.emplace_back( abis.binary_to_variant( abis.get_table_type(N(producers)), data, abi_serializer::create_yield_function( abi_serializer_max_time ), shorten_abi_errors ) ); + result.rows.emplace_back( abis.binary_to_variant( abis.get_table_type("producers"_n), data, abi_serializer::create_yield_function( abi_serializer_max_time ), shorten_abi_errors ) ); else result.rows.emplace_back(fc::variant(data)); } @@ -2599,14 +2599,14 @@ read_only::get_account_results read_only::get_account( const get_account_params& if( abi_serializer::to_abi(code_account.abi, abi) ) { abi_serializer abis( abi, abi_serializer::create_yield_function( abi_serializer_max_time ) ); - const auto token_code = N(eosio.token); + const auto token_code = "eosio.token"_n; auto core_symbol = extract_core_symbol(); if (params.expected_core_symbol) core_symbol = *(params.expected_core_symbol); - const auto* t_id = d.find(boost::make_tuple( token_code, params.account_name, N(accounts) )); + const auto* t_id = d.find(boost::make_tuple( token_code, params.account_name, "accounts"_n )); if( t_id != nullptr ) { const auto &idx = d.get_index(); auto it = idx.find(boost::make_tuple( t_id->id, core_symbol.to_symbol_code() )); @@ -2621,7 +2621,7 @@ read_only::get_account_results read_only::get_account( const get_account_params& } } - t_id = d.find(boost::make_tuple( config::system_account_name, params.account_name, N(userres) )); + t_id = d.find(boost::make_tuple( config::system_account_name, params.account_name, "userres"_n )); if (t_id != nullptr) { const auto &idx = d.get_index(); auto it = idx.find(boost::make_tuple( t_id->id, params.account_name.to_uint64_t() )); @@ -2632,7 +2632,7 @@ read_only::get_account_results read_only::get_account( const get_account_params& } } - t_id = d.find(boost::make_tuple( config::system_account_name, params.account_name, N(delband) )); + t_id = d.find(boost::make_tuple( config::system_account_name, params.account_name, "delband"_n )); if (t_id != nullptr) { const auto &idx = d.get_index(); auto it = idx.find(boost::make_tuple( t_id->id, params.account_name.to_uint64_t() )); @@ -2643,7 +2643,7 @@ read_only::get_account_results read_only::get_account( const get_account_params& } } - t_id = d.find(boost::make_tuple( config::system_account_name, params.account_name, N(refunds) )); + t_id = d.find(boost::make_tuple( config::system_account_name, params.account_name, "refunds"_n )); if (t_id != nullptr) { const auto &idx = d.get_index(); auto it = idx.find(boost::make_tuple( t_id->id, params.account_name.to_uint64_t() )); @@ -2654,7 +2654,7 @@ read_only::get_account_results read_only::get_account( const get_account_params& } } - t_id = d.find(boost::make_tuple( config::system_account_name, config::system_account_name, N(voters) )); + t_id = d.find(boost::make_tuple( config::system_account_name, config::system_account_name, "voters"_n )); if (t_id != nullptr) { const auto &idx = d.get_index(); auto it = idx.find(boost::make_tuple( t_id->id, params.account_name.to_uint64_t() )); @@ -2665,7 +2665,7 @@ read_only::get_account_results read_only::get_account( const get_account_params& } } - t_id = d.find(boost::make_tuple( config::system_account_name, config::system_account_name, N(rexbal) )); + t_id = d.find(boost::make_tuple( config::system_account_name, config::system_account_name, "rexbal"_n )); if (t_id != nullptr) { const auto &idx = d.get_index(); auto it = idx.find(boost::make_tuple( t_id->id, params.account_name.to_uint64_t() )); @@ -2760,7 +2760,7 @@ chain::symbol read_only::extract_core_symbol()const { // The following code makes assumptions about the contract deployed on eosio account (i.e. the system contract) and how it stores its data. const auto& d = db.db(); - const auto* t_id = d.find(boost::make_tuple( N(eosio), N(eosio), N(rammarket) )); + const auto* t_id = d.find(boost::make_tuple( "eosio"_n, "eosio"_n, "rammarket"_n )); if( t_id != nullptr ) { const auto &idx = d.get_index(); auto it = idx.find(boost::make_tuple( t_id->id, eosio::chain::string_to_symbol_c(4,"RAMCORE") )); diff --git a/plugins/chain_plugin/test/test_account_query_db.cpp b/plugins/chain_plugin/test/test_account_query_db.cpp index 36cceb67647..a62bdcb3a59 100644 --- a/plugins/chain_plugin/test/test_account_query_db.cpp +++ b/plugins/chain_plugin/test/test_account_query_db.cpp @@ -50,7 +50,7 @@ BOOST_FIXTURE_TEST_CASE(newaccount_test, TESTER) { try { produce_blocks(10); - account_name tester_account = N(tester); + account_name tester_account = "tester"_n; const auto trace_ptr = create_account(tester_account); aq_db.cache_transaction_trace(trace_ptr); produce_block(); @@ -75,14 +75,14 @@ BOOST_FIXTURE_TEST_CASE(updateauth_test, TESTER) { try { produce_blocks(10); - const auto& tester_account = N(tester); + const auto& tester_account = "tester"_n; const string role = "first"; produce_block(); create_account(tester_account); const auto trace_ptr = push_action(config::system_account_name, updateauth::get_name(), tester_account, fc::mutable_variant_object() ("account", tester_account) - ("permission", N(role)) + ("permission", "role"_n) ("parent", "active") ("auth", authority(get_public_key(tester_account, role), 5)) ); @@ -93,7 +93,7 @@ BOOST_FIXTURE_TEST_CASE(updateauth_test, TESTER) { try { pars.keys.emplace_back(get_public_key(tester_account, role)); const auto results = aq_db.get_accounts_by_authorizers(pars); - BOOST_TEST_REQUIRE(find_account_auth(results, tester_account, N(role)) == true); + BOOST_TEST_REQUIRE(find_account_auth(results, tester_account, "role"_n) == true); } FC_LOG_AND_RETHROW() } diff --git a/plugins/history_plugin/history_plugin.cpp b/plugins/history_plugin/history_plugin.cpp index 2df66d2568f..0020904ea57 100644 --- a/plugins/history_plugin/history_plugin.cpp +++ b/plugins/history_plugin/history_plugin.cpp @@ -226,15 +226,15 @@ namespace eosio { void on_system_action( const action_trace& at ) { auto& chain = chain_plug->chain(); chainbase::database& db = const_cast( chain.db() ); // Override read-only access to state DB (highly unrecommended practice!) - if( at.act.name == N(newaccount) ) + if( at.act.name == "newaccount"_n ) { const auto create = at.act.data_as(); - add(db, create.owner.keys, create.name, N(owner)); - add(db, create.owner.accounts, create.name, N(owner)); - add(db, create.active.keys, create.name, N(active)); - add(db, create.active.accounts, create.name, N(active)); + add(db, create.owner.keys, create.name, "owner"_n); + add(db, create.owner.accounts, create.name, "owner"_n); + add(db, create.active.keys, create.name, "active"_n); + add(db, create.active.accounts, create.name, "active"_n); } - else if( at.act.name == N(updateauth) ) + else if( at.act.name == "updateauth"_n ) { const auto update = at.act.data_as(); remove(db, update.account, update.permission); @@ -242,7 +242,7 @@ namespace eosio { add(db, update.auth.keys, update.account, update.permission); add(db, update.auth.accounts, update.account, update.permission); } - else if( at.act.name == N(deleteauth) ) + else if( at.act.name == "deleteauth"_n ) { const auto del = at.act.data_as(); remove(db, del.account, del.permission); diff --git a/plugins/txn_test_gen_plugin/txn_test_gen_plugin.cpp b/plugins/txn_test_gen_plugin/txn_test_gen_plugin.cpp index 9d50f62ce4a..ba7e058bbd6 100644 --- a/plugins/txn_test_gen_plugin/txn_test_gen_plugin.cpp +++ b/plugins/txn_test_gen_plugin/txn_test_gen_plugin.cpp @@ -207,7 +207,7 @@ struct txn_test_gen_plugin_impl { { action act; act.account = newaccountT; - act.name = N(create); + act.name = "create"_n; act.authorization = vector{{newaccountT,config::active_name}}; act.data = eosio_token_serializer.variant_to_binary("create", fc::json::from_string(fc::format_string("{\"issuer\":\"${issuer}\",\"maximum_supply\":\"1000000000.0000 CUR\"}}", @@ -218,7 +218,7 @@ struct txn_test_gen_plugin_impl { { action act; act.account = newaccountT; - act.name = N(issue); + act.name = "issue"_n; act.authorization = vector{{newaccountT,config::active_name}}; act.data = eosio_token_serializer.variant_to_binary("issue", fc::json::from_string(fc::format_string("{\"to\":\"${to}\",\"quantity\":\"60000.0000 CUR\",\"memo\":\"\"}", @@ -229,7 +229,7 @@ struct txn_test_gen_plugin_impl { { action act; act.account = newaccountT; - act.name = N(transfer); + act.name = "transfer"_n; act.authorization = vector{{newaccountT,config::active_name}}; act.data = eosio_token_serializer.variant_to_binary("transfer", fc::json::from_string(fc::format_string("{\"from\":\"${from}\",\"to\":\"${to}\",\"quantity\":\"20000.0000 CUR\",\"memo\":\"\"}", @@ -240,7 +240,7 @@ struct txn_test_gen_plugin_impl { { action act; act.account = newaccountT; - act.name = N(transfer); + act.name = "transfer"_n; act.authorization = vector{{newaccountT,config::active_name}}; act.data = eosio_token_serializer.variant_to_binary("transfer", fc::json::from_string(fc::format_string("{\"from\":\"${from}\",\"to\":\"${to}\",\"quantity\":\"20000.0000 CUR\",\"memo\":\"\"}", @@ -289,7 +289,7 @@ struct txn_test_gen_plugin_impl { abi_serializer eosio_token_serializer{fc::json::from_string(contracts::eosio_token_abi().data()).as(), abi_serializer::create_yield_function( abi_serializer_max_time )}; //create the actions here act_a_to_b.account = newaccountT; - act_a_to_b.name = N(transfer); + act_a_to_b.name = "transfer"_n; act_a_to_b.authorization = vector{{newaccountA,config::active_name}}; act_a_to_b.data = eosio_token_serializer.variant_to_binary("transfer", fc::json::from_string(fc::format_string("{\"from\":\"${from}\",\"to\":\"${to}\",\"quantity\":\"1.0000 CUR\",\"memo\":\"${l}\"}", @@ -297,7 +297,7 @@ struct txn_test_gen_plugin_impl { abi_serializer::create_yield_function( abi_serializer_max_time )); act_b_to_a.account = newaccountT; - act_b_to_a.name = N(transfer); + act_b_to_a.name = "transfer"_n; act_b_to_a.authorization = vector{{newaccountB,config::active_name}}; act_b_to_a.data = eosio_token_serializer.variant_to_binary("transfer", fc::json::from_string(fc::format_string("{\"from\":\"${from}\",\"to\":\"${to}\",\"quantity\":\"1.0000 CUR\",\"memo\":\"${l}\"}", diff --git a/programs/cleos/main.cpp b/programs/cleos/main.cpp index 93f69292125..52bcd8cae84 100644 --- a/programs/cleos/main.cpp +++ b/programs/cleos/main.cpp @@ -671,7 +671,7 @@ chain::action create_buyram(const name& creator, const name& newaccount, const a ("receiver", newaccount.to_string()) ("quant", quantity.to_string()); return create_action(get_account_permissions(tx_permission, {creator,config::active_name}), - config::system_account_name, N(buyram), act_payload); + config::system_account_name, "buyram"_n, act_payload); } chain::action create_buyrambytes(const name& creator, const name& newaccount, uint32_t numbytes) { @@ -680,7 +680,7 @@ chain::action create_buyrambytes(const name& creator, const name& newaccount, ui ("receiver", newaccount.to_string()) ("bytes", numbytes); return create_action(get_account_permissions(tx_permission, {creator,config::active_name}), - config::system_account_name, N(buyrambytes), act_payload); + config::system_account_name, "buyrambytes"_n, act_payload); } chain::action create_delegate(const name& from, const name& receiver, const asset& net, const asset& cpu, bool transfer) { @@ -691,7 +691,7 @@ chain::action create_delegate(const name& from, const name& receiver, const asse ("stake_cpu_quantity", cpu.to_string()) ("transfer", transfer); return create_action(get_account_permissions(tx_permission, {from,config::active_name}), - config::system_account_name, N(delegatebw), act_payload); + config::system_account_name, "delegatebw"_n, act_payload); } fc::variant regproducer_variant(const account_name& producer, const public_key_type& key, const string& url, uint16_t location) { @@ -710,7 +710,7 @@ chain::action create_open(const string& contract, const name& owner, symbol sym, ("ram_payer", ram_payer); return action { get_account_permissions(tx_permission, {ram_payer, config::active_name}), - name(contract), N(open), variant_to_bin( name(contract), N(open), open_ ) + name(contract), "open"_n, variant_to_bin( name(contract), "open"_n, open_ ) }; } @@ -724,7 +724,7 @@ chain::action create_transfer(const string& contract, const name& sender, const return action { get_account_permissions(tx_permission, {sender,config::active_name}), - name(contract), N(transfer), variant_to_bin( name(contract), N(transfer), transfer ) + name(contract), "transfer"_n, variant_to_bin( name(contract), "transfer"_n, transfer ) }; } @@ -822,7 +822,7 @@ asset to_asset( account_name code, const string& s ) { } inline asset to_asset( const string& s ) { - return to_asset( N(eosio.token), s ); + return to_asset( "eosio.token"_n, s ); } struct set_account_permission_subcommand { @@ -1101,7 +1101,7 @@ struct register_producer_subcommand { auto regprod_var = regproducer_variant(name(producer_str), producer_key, url, loc ); auto accountPermissions = get_account_permissions(tx_permission, {name(producer_str), config::active_name}); - send_actions({create_action(accountPermissions, config::system_account_name, N(regproducer), regprod_var)}, signing_keys_opt.get_keys()); + send_actions({create_action(accountPermissions, config::system_account_name, "regproducer"_n, regprod_var)}, signing_keys_opt.get_keys()); }); } }; @@ -1213,7 +1213,7 @@ struct unregister_producer_subcommand { ("producer", producer_str); auto accountPermissions = get_account_permissions(tx_permission, {name(producer_str), config::active_name}); - send_actions({create_action(accountPermissions, config::system_account_name, N(unregprod), act_payload)}, signing_keys_opt.get_keys()); + send_actions({create_action(accountPermissions, config::system_account_name, "unregprod"_n, act_payload)}, signing_keys_opt.get_keys()); }); } }; @@ -1234,7 +1234,7 @@ struct vote_producer_proxy_subcommand { ("proxy", proxy_str) ("producers", std::vector{}); auto accountPermissions = get_account_permissions(tx_permission, {name(voter_str), config::active_name}); - send_actions({create_action(accountPermissions, config::system_account_name, N(voteproducer), act_payload)}, signing_keys_opt.get_keys()); + send_actions({create_action(accountPermissions, config::system_account_name, "voteproducer"_n, act_payload)}, signing_keys_opt.get_keys()); }); } }; @@ -1258,7 +1258,7 @@ struct vote_producers_subcommand { ("proxy", "") ("producers", producer_names); auto accountPermissions = get_account_permissions(tx_permission, {name(voter_str), config::active_name}); - send_actions({create_action(accountPermissions, config::system_account_name, N(voteproducer), act_payload)}, signing_keys_opt.get_keys()); + send_actions({create_action(accountPermissions, config::system_account_name, "voteproducer"_n, act_payload)}, signing_keys_opt.get_keys()); }); } }; @@ -1311,7 +1311,7 @@ struct approve_producer_subcommand { ("proxy", "") ("producers", prods); auto accountPermissions = get_account_permissions(tx_permission, {name(voter), config::active_name}); - send_actions({create_action(accountPermissions, config::system_account_name, N(voteproducer), act_payload)}, signing_keys_opt.get_keys()); + send_actions({create_action(accountPermissions, config::system_account_name, "voteproducer"_n, act_payload)}, signing_keys_opt.get_keys()); }); } }; @@ -1363,7 +1363,7 @@ struct unapprove_producer_subcommand { ("proxy", "") ("producers", prods); auto accountPermissions = get_account_permissions(tx_permission, {name(voter), config::active_name}); - send_actions({create_action(accountPermissions, config::system_account_name, N(voteproducer), act_payload)}, signing_keys_opt.get_keys()); + send_actions({create_action(accountPermissions, config::system_account_name, "voteproducer"_n, act_payload)}, signing_keys_opt.get_keys()); }); } }; @@ -1536,7 +1536,7 @@ struct delegate_bandwidth_subcommand { ("stake_cpu_quantity", to_asset(stake_cpu_amount)) ("transfer", transfer); auto accountPermissions = get_account_permissions(tx_permission, {name(from_str), config::active_name}); - std::vector acts{create_action(accountPermissions, config::system_account_name, N(delegatebw), act_payload)}; + std::vector acts{create_action(accountPermissions, config::system_account_name, "delegatebw"_n, act_payload)}; EOSC_ASSERT( !(buy_ram_amount.size()) || !buy_ram_bytes, "ERROR: --buyram and --buy-ram-bytes cannot be set at the same time" ); if (buy_ram_amount.size()) { acts.push_back( create_buyram(name(from_str), name(receiver_str), to_asset(buy_ram_amount)) ); @@ -1570,7 +1570,7 @@ struct undelegate_bandwidth_subcommand { ("unstake_net_quantity", to_asset(unstake_net_amount)) ("unstake_cpu_quantity", to_asset(unstake_cpu_amount)); auto accountPermissions = get_account_permissions(tx_permission, {name(from_str), config::active_name}); - send_actions({create_action(accountPermissions, config::system_account_name, N(undelegatebw), act_payload)}, signing_keys_opt.get_keys()); + send_actions({create_action(accountPermissions, config::system_account_name, "undelegatebw"_n, act_payload)}, signing_keys_opt.get_keys()); }); } }; @@ -1592,7 +1592,7 @@ struct bidname_subcommand { ("newname", newname_str) ("bid", to_asset(bid_amount)); auto accountPermissions = get_account_permissions(tx_permission, {name(bidder_str), config::active_name}); - send_actions({create_action(accountPermissions, config::system_account_name, N(bidname), act_payload)}, signing_keys_opt.get_keys()); + send_actions({create_action(accountPermissions, config::system_account_name, "bidname"_n, act_payload)}, signing_keys_opt.get_keys()); }); } }; @@ -1719,7 +1719,7 @@ struct sellram_subcommand { ("account", receiver_str) ("bytes", amount); auto accountPermissions = get_account_permissions(tx_permission, {name(receiver_str), config::active_name}); - send_actions({create_action(accountPermissions, config::system_account_name, N(sellram), act_payload)}, signing_keys_opt.get_keys()); + send_actions({create_action(accountPermissions, config::system_account_name, "sellram"_n, act_payload)}, signing_keys_opt.get_keys()); }); } }; @@ -1736,7 +1736,7 @@ struct claimrewards_subcommand { fc::variant act_payload = fc::mutable_variant_object() ("owner", owner); auto accountPermissions = get_account_permissions(tx_permission, {name(owner), config::active_name}); - send_actions({create_action(accountPermissions, config::system_account_name, N(claimrewards), act_payload)}, signing_keys_opt.get_keys()); + send_actions({create_action(accountPermissions, config::system_account_name, "claimrewards"_n, act_payload)}, signing_keys_opt.get_keys()); }); } }; @@ -1754,7 +1754,7 @@ struct regproxy_subcommand { ("proxy", proxy) ("isproxy", true); auto accountPermissions = get_account_permissions(tx_permission, {name(proxy), config::active_name}); - send_actions({create_action(accountPermissions, config::system_account_name, N(regproxy), act_payload)}, signing_keys_opt.get_keys()); + send_actions({create_action(accountPermissions, config::system_account_name, "regproxy"_n, act_payload)}, signing_keys_opt.get_keys()); }); } }; @@ -1772,7 +1772,7 @@ struct unregproxy_subcommand { ("proxy", proxy) ("isproxy", false); auto accountPermissions = get_account_permissions(tx_permission, {name(proxy), config::active_name}); - send_actions({create_action(accountPermissions, config::system_account_name, N(regproxy), act_payload)}, signing_keys_opt.get_keys()); + send_actions({create_action(accountPermissions, config::system_account_name, "regproxy"_n, act_payload)}, signing_keys_opt.get_keys()); }); } }; @@ -1795,7 +1795,7 @@ struct canceldelay_subcommand { ("canceling_auth", canceling_auth) ("trx_id", trx_id); auto accountPermissions = get_account_permissions(tx_permission, canceling_auth); - send_actions({create_action(accountPermissions, config::system_account_name, N(canceldelay), act_payload)}, signing_keys_opt.get_keys()); + send_actions({create_action(accountPermissions, config::system_account_name, "canceldelay"_n, act_payload)}, signing_keys_opt.get_keys()); }); } }; @@ -1803,7 +1803,7 @@ struct canceldelay_subcommand { struct deposit_subcommand { string owner_str; string amount_str; - const name act_name{ N(deposit) }; + const name act_name{ "deposit"_n }; deposit_subcommand(CLI::App* actionRoot) { auto deposit = actionRoot->add_subcommand("deposit", localized("Deposit into owner's REX fund by transfering from owner's liquid token balance")); @@ -1823,7 +1823,7 @@ struct deposit_subcommand { struct withdraw_subcommand { string owner_str; string amount_str; - const name act_name{ N(withdraw) }; + const name act_name{ "withdraw"_n }; withdraw_subcommand(CLI::App* actionRoot) { auto withdraw = actionRoot->add_subcommand("withdraw", localized("Withdraw from owner's REX fund by transfering to owner's liquid token balance")); @@ -1843,7 +1843,7 @@ struct withdraw_subcommand { struct buyrex_subcommand { string from_str; string amount_str; - const name act_name{ N(buyrex) }; + const name act_name{ "buyrex"_n }; buyrex_subcommand(CLI::App* actionRoot) { auto buyrex = actionRoot->add_subcommand("buyrex", localized("Buy REX using tokens in owner's REX fund")); @@ -1863,8 +1863,8 @@ struct buyrex_subcommand { struct lendrex_subcommand { string from_str; string amount_str; - const name act_name1{ N(deposit) }; - const name act_name2{ N(buyrex) }; + const name act_name1{ "deposit"_n }; + const name act_name2{ "buyrex"_n }; lendrex_subcommand(CLI::App* actionRoot) { auto lendrex = actionRoot->add_subcommand("lendrex", localized("Deposit tokens to REX fund and use the tokens to buy REX")); @@ -1890,7 +1890,7 @@ struct unstaketorex_subcommand { string receiver_str; string from_net_str; string from_cpu_str; - const name act_name{ N(unstaketorex) }; + const name act_name{ "unstaketorex"_n }; unstaketorex_subcommand(CLI::App* actionRoot) { auto unstaketorex = actionRoot->add_subcommand("unstaketorex", localized("Buy REX using staked tokens")); @@ -1914,7 +1914,7 @@ struct unstaketorex_subcommand { struct sellrex_subcommand { string from_str; string rex_str; - const name act_name{ N(sellrex) }; + const name act_name{ "sellrex"_n }; sellrex_subcommand(CLI::App* actionRoot) { auto sellrex = actionRoot->add_subcommand("sellrex", localized("Sell REX tokens")); @@ -1933,7 +1933,7 @@ struct sellrex_subcommand { struct cancelrexorder_subcommand { string owner_str; - const name act_name{ N(cnclrexorder) }; + const name act_name{ "cnclrexorder"_n }; cancelrexorder_subcommand(CLI::App* actionRoot) { auto cancelrexorder = actionRoot->add_subcommand("cancelrexorder", localized("Cancel queued REX sell order if one exists")); @@ -1952,7 +1952,7 @@ struct rentcpu_subcommand { string receiver_str; string loan_payment_str; string loan_fund_str; - const name act_name{ N(rentcpu) }; + const name act_name{ "rentcpu"_n }; rentcpu_subcommand(CLI::App* actionRoot) { auto rentcpu = actionRoot->add_subcommand("rentcpu", localized("Rent CPU bandwidth for 30 days")); @@ -1978,7 +1978,7 @@ struct rentnet_subcommand { string receiver_str; string loan_payment_str; string loan_fund_str; - const name act_name{ N(rentnet) }; + const name act_name{ "rentnet"_n }; rentnet_subcommand(CLI::App* actionRoot) { auto rentnet = actionRoot->add_subcommand("rentnet", localized("Rent Network bandwidth for 30 days")); @@ -2003,7 +2003,7 @@ struct fundcpuloan_subcommand { string from_str; string loan_num_str; string payment_str; - const name act_name{ N(fundcpuloan) }; + const name act_name{ "fundcpuloan"_n }; fundcpuloan_subcommand(CLI::App* actionRoot) { auto fundcpuloan = actionRoot->add_subcommand("fundcpuloan", localized("Deposit into a CPU loan fund")); @@ -2026,7 +2026,7 @@ struct fundnetloan_subcommand { string from_str; string loan_num_str; string payment_str; - const name act_name{ N(fundnetloan) }; + const name act_name{ "fundnetloan"_n }; fundnetloan_subcommand(CLI::App* actionRoot) { auto fundnetloan = actionRoot->add_subcommand("fundnetloan", localized("Deposit into a Network loan fund")); @@ -2049,7 +2049,7 @@ struct defcpuloan_subcommand { string from_str; string loan_num_str; string amount_str; - const name act_name{ N(defcpuloan) }; + const name act_name{ "defcpuloan"_n }; defcpuloan_subcommand(CLI::App* actionRoot) { auto defcpuloan = actionRoot->add_subcommand("defundcpuloan", localized("Withdraw from a CPU loan fund")); @@ -2072,7 +2072,7 @@ struct defnetloan_subcommand { string from_str; string loan_num_str; string amount_str; - const name act_name{ N(defnetloan) }; + const name act_name{ "defnetloan"_n }; defnetloan_subcommand(CLI::App* actionRoot) { auto defnetloan = actionRoot->add_subcommand("defundnetloan", localized("Withdraw from a Network loan fund")); @@ -2094,7 +2094,7 @@ struct defnetloan_subcommand { struct mvtosavings_subcommand { string owner_str; string rex_str; - const name act_name{ N(mvtosavings) }; + const name act_name{ "mvtosavings"_n }; mvtosavings_subcommand(CLI::App* actionRoot) { auto mvtosavings = actionRoot->add_subcommand("mvtosavings", localized("Move REX tokens to savings bucket")); @@ -2114,7 +2114,7 @@ struct mvtosavings_subcommand { struct mvfrsavings_subcommand { string owner_str; string rex_str; - const name act_name{ N(mvfrsavings) }; + const name act_name{ "mvfrsavings"_n }; mvfrsavings_subcommand(CLI::App* actionRoot) { auto mvfrsavings = actionRoot->add_subcommand("mvfromsavings", localized("Move REX tokens out of savings bucket")); @@ -2133,7 +2133,7 @@ struct mvfrsavings_subcommand { struct updaterex_subcommand { string owner_str; - const name act_name{ N(updaterex) }; + const name act_name{ "updaterex"_n }; updaterex_subcommand(CLI::App* actionRoot) { auto updaterex = actionRoot->add_subcommand("updaterex", localized("Update REX owner vote stake and vote weight")); @@ -2149,7 +2149,7 @@ struct updaterex_subcommand { struct consolidate_subcommand { string owner_str; - const name act_name{ N(consolidate) }; + const name act_name{ "consolidate"_n }; consolidate_subcommand(CLI::App* actionRoot) { auto consolidate = actionRoot->add_subcommand("consolidate", localized("Consolidate REX maturity buckets into one that matures in 4 days")); @@ -2166,7 +2166,7 @@ struct consolidate_subcommand { struct rexexec_subcommand { string user_str; string max_str; - const name act_name{ N(rexexec) }; + const name act_name{ "rexexec"_n }; rexexec_subcommand(CLI::App* actionRoot) { auto rexexec = actionRoot->add_subcommand("rexexec", localized("Perform REX maintenance by processing expired loans and unfilled sell orders")); @@ -2185,7 +2185,7 @@ struct rexexec_subcommand { struct closerex_subcommand { string owner_str; - const name act_name{ N(closerex) }; + const name act_name{ "closerex"_n }; closerex_subcommand(CLI::App* actionRoot) { auto closerex = actionRoot->add_subcommand("closerex", localized("Delete unused REX-related user table entries")); @@ -3679,7 +3679,7 @@ int main( int argc, char** argv ) { ("requested", requested_perm_var) ("trx", trx_var); - send_actions({chain::action{accountPermissions, N(eosio.msig), N(propose), variant_to_bin( N(eosio.msig), N(propose), args ) }}, signing_keys_opt.get_keys()); + send_actions({chain::action{accountPermissions, "eosio.msig"_n, "propose"_n, variant_to_bin( "eosio.msig"_n, "propose"_n, args ) }}, signing_keys_opt.get_keys()); }); //multisig propose transaction @@ -3712,7 +3712,7 @@ int main( int argc, char** argv ) { ("requested", requested_perm_var) ("trx", trx_var); - send_actions({chain::action{accountPermissions, N(eosio.msig), N(propose), variant_to_bin( N(eosio.msig), N(propose), args ) }}, signing_keys_opt.get_keys()); + send_actions({chain::action{accountPermissions, "eosio.msig"_n, "propose"_n, variant_to_bin( "eosio.msig"_n, "propose"_n, args ) }}, signing_keys_opt.get_keys()); }); @@ -3929,7 +3929,7 @@ int main( int argc, char** argv ) { } auto accountPermissions = get_account_permissions(tx_permission, {name(proposer), config::active_name}); - send_actions({chain::action{accountPermissions, N(eosio.msig), name(action), variant_to_bin( N(eosio.msig), name(action), args ) }}, signing_keys_opt.get_keys()); + send_actions({chain::action{accountPermissions, "eosio.msig"_n, name(action), variant_to_bin( "eosio.msig"_n, name(action), args ) }}, signing_keys_opt.get_keys()); }; // multisig approve @@ -3959,7 +3959,7 @@ int main( int argc, char** argv ) { ("account", invalidator); auto accountPermissions = get_account_permissions(tx_permission, {name(invalidator), config::active_name}); - send_actions({chain::action{accountPermissions, N(eosio.msig), N(invalidate), variant_to_bin( N(eosio.msig), N(invalidate), args ) }}, signing_keys_opt.get_keys()); + send_actions({chain::action{accountPermissions, "eosio.msig"_n, "invalidate"_n, variant_to_bin( "eosio.msig"_n, "invalidate"_n, args ) }}, signing_keys_opt.get_keys()); }); // multisig cancel @@ -3986,7 +3986,7 @@ int main( int argc, char** argv ) { ("proposal_name", proposal_name) ("canceler", canceler); - send_actions({chain::action{accountPermissions, N(eosio.msig), N(cancel), variant_to_bin( N(eosio.msig), N(cancel), args ) }}, signing_keys_opt.get_keys()); + send_actions({chain::action{accountPermissions, "eosio.msig"_n, "cancel"_n, variant_to_bin( "eosio.msig"_n, "cancel"_n, args ) }}, signing_keys_opt.get_keys()); } ); @@ -4015,7 +4015,7 @@ int main( int argc, char** argv ) { ("proposal_name", proposal_name) ("executer", executer); - send_actions({chain::action{accountPermissions, N(eosio.msig), N(exec), variant_to_bin( N(eosio.msig), N(exec), args ) }}, signing_keys_opt.get_keys()); + send_actions({chain::action{accountPermissions, "eosio.msig"_n, "exec"_n, variant_to_bin( "eosio.msig"_n, "exec"_n, args ) }}, signing_keys_opt.get_keys()); } ); @@ -4045,7 +4045,7 @@ int main( int argc, char** argv ) { ("executer", executer ) ("trx", trx_var); - send_actions({chain::action{accountPermissions, name(wrap_con), N(exec), variant_to_bin( name(wrap_con), N(exec), args ) }}, signing_keys_opt.get_keys()); + send_actions({chain::action{accountPermissions, name(wrap_con), "exec"_n, variant_to_bin( name(wrap_con), "exec"_n, args ) }}, signing_keys_opt.get_keys()); }); // system subcommand diff --git a/tests/chain_plugin_tests.cpp b/tests/chain_plugin_tests.cpp index 01790f6afce..f5e95461c65 100644 --- a/tests/chain_plugin_tests.cpp +++ b/tests/chain_plugin_tests.cpp @@ -37,12 +37,12 @@ BOOST_AUTO_TEST_SUITE(chain_plugin_tests) BOOST_FIXTURE_TEST_CASE( get_block_with_invalid_abi, TESTER ) try { produce_blocks(2); - create_accounts( {N(asserter)} ); + create_accounts( {"asserter"_n} ); produce_block(); // setup contract and abi - set_code( N(asserter), contracts::asserter_wasm() ); - set_abi( N(asserter), contracts::asserter_abi().data() ); + set_code( "asserter"_n, contracts::asserter_wasm() ); + set_abi( "asserter"_n, contracts::asserter_abi().data() ); produce_blocks(1); auto resolver = [&,this]( const account_name& name ) -> std::optional { @@ -57,7 +57,7 @@ BOOST_FIXTURE_TEST_CASE( get_block_with_invalid_abi, TESTER ) try { }; // abi should be resolved - BOOST_REQUIRE_EQUAL(true, resolver(N(asserter)).has_value()); + BOOST_REQUIRE_EQUAL(true, resolver("asserter"_n).has_value()); // make an action using the valid contract & abi fc::variant pretty_trx = mutable_variant_object() @@ -79,7 +79,7 @@ BOOST_FIXTURE_TEST_CASE( get_block_with_invalid_abi, TESTER ) try { signed_transaction trx; abi_serializer::from_variant(pretty_trx, trx, resolver, abi_serializer::create_yield_function( abi_serializer_max_time )); set_transaction_headers(trx); - trx.sign( get_private_key( N(asserter), "active" ), control->get_chain_id() ); + trx.sign( get_private_key( "asserter"_n, "active" ), control->get_chain_id() ); push_transaction( trx ); produce_blocks(1); @@ -104,11 +104,11 @@ BOOST_FIXTURE_TEST_CASE( get_block_with_invalid_abi, TESTER ) try { auto pos = abi2.find("int8"); BOOST_TEST(pos != std::string::npos); abi2.replace(pos, 4, "xxxx"); - set_abi(N(asserter), abi2.c_str()); + set_abi("asserter"_n, abi2.c_str()); produce_blocks(1); // resolving the invalid abi result in exception - BOOST_CHECK_THROW(resolver(N(asserter)), invalid_type_inside_abi); + BOOST_CHECK_THROW(resolver("asserter"_n), invalid_type_inside_abi); // get the same block as string, results in decode failed(invalid abi) but not exception std::string block_str2 = json::to_pretty_string(plugin.get_block(param)); diff --git a/tests/get_table_tests.cpp b/tests/get_table_tests.cpp index f3eaa720d78..5dd55ba940a 100644 --- a/tests/get_table_tests.cpp +++ b/tests/get_table_tests.cpp @@ -36,11 +36,11 @@ BOOST_AUTO_TEST_SUITE(get_table_tests) transaction_trace_ptr issue_tokens( TESTER& t, account_name issuer, account_name to, const asset& amount, - std::string memo = "", account_name token_contract = N(eosio.token) ) + std::string memo = "", account_name token_contract = "eosio.token"_n ) { signed_transaction trx; - trx.actions.emplace_back( t.get_action( token_contract, N(issue), + trx.actions.emplace_back( t.get_action( token_contract, "issue"_n, vector{{issuer, config::active_name}}, mutable_variant_object() ("to", issuer.to_string()) @@ -48,7 +48,7 @@ issue_tokens( TESTER& t, account_name issuer, account_name to, const asset& amou ("memo", memo) ) ); - trx.actions.emplace_back( t.get_action( token_contract, N(transfer), + trx.actions.emplace_back( t.get_action( token_contract, "transfer"_n, vector{{issuer, config::active_name}}, mutable_variant_object() ("from", issuer.to_string()) @@ -65,22 +65,22 @@ issue_tokens( TESTER& t, account_name issuer, account_name to, const asset& amou BOOST_FIXTURE_TEST_CASE( get_scope_test, TESTER ) try { produce_blocks(2); - create_accounts({ N(eosio.token), N(eosio.ram), N(eosio.ramfee), N(eosio.stake), - N(eosio.bpay), N(eosio.vpay), N(eosio.saving), N(eosio.names) }); + create_accounts({ "eosio.token"_n, "eosio.ram"_n, "eosio.ramfee"_n, "eosio.stake"_n, + "eosio.bpay"_n, "eosio.vpay"_n, "eosio.saving"_n, "eosio.names"_n }); - std::vector accs{N(inita), N(initb), N(initc), N(initd)}; + std::vector accs{"inita"_n, "initb"_n, "initc"_n, "initd"_n}; create_accounts(accs); produce_block(); - set_code( N(eosio.token), contracts::eosio_token_wasm() ); - set_abi( N(eosio.token), contracts::eosio_token_abi().data() ); + set_code( "eosio.token"_n, contracts::eosio_token_wasm() ); + set_abi( "eosio.token"_n, contracts::eosio_token_abi().data() ); produce_blocks(1); // create currency auto act = mutable_variant_object() ("issuer", "eosio") ("maximum_supply", eosio::chain::asset::from_string("1000000000.0000 SYS")); - push_action(N(eosio.token), N(create), N(eosio.token), act ); + push_action("eosio.token"_n, "create"_n, "eosio.token"_n, act ); // issue for (account_name a: accs) { @@ -90,21 +90,21 @@ BOOST_FIXTURE_TEST_CASE( get_scope_test, TESTER ) try { // iterate over scope eosio::chain_apis::read_only plugin(*(this->control), {}, fc::microseconds::maximum()); - eosio::chain_apis::read_only::get_table_by_scope_params param{N(eosio.token), N(accounts), "inita", "", 10}; + eosio::chain_apis::read_only::get_table_by_scope_params param{"eosio.token"_n, "accounts"_n, "inita", "", 10}; eosio::chain_apis::read_only::get_table_by_scope_result result = plugin.read_only::get_table_by_scope(param); BOOST_REQUIRE_EQUAL(4u, result.rows.size()); BOOST_REQUIRE_EQUAL("", result.more); if (result.rows.size() >= 4) { - BOOST_REQUIRE_EQUAL(name(N(eosio.token)), result.rows[0].code); - BOOST_REQUIRE_EQUAL(name(N(inita)), result.rows[0].scope); - BOOST_REQUIRE_EQUAL(name(N(accounts)), result.rows[0].table); - BOOST_REQUIRE_EQUAL(name(N(eosio)), result.rows[0].payer); + BOOST_REQUIRE_EQUAL(name("eosio.token"_n), result.rows[0].code); + BOOST_REQUIRE_EQUAL(name("inita"_n), result.rows[0].scope); + BOOST_REQUIRE_EQUAL(name("accounts"_n), result.rows[0].table); + BOOST_REQUIRE_EQUAL(name("eosio"_n), result.rows[0].payer); BOOST_REQUIRE_EQUAL(1u, result.rows[0].count); - BOOST_REQUIRE_EQUAL(name(N(initb)), result.rows[1].scope); - BOOST_REQUIRE_EQUAL(name(N(initc)), result.rows[2].scope); - BOOST_REQUIRE_EQUAL(name(N(initd)), result.rows[3].scope); + BOOST_REQUIRE_EQUAL(name("initb"_n), result.rows[1].scope); + BOOST_REQUIRE_EQUAL(name("initc"_n), result.rows[2].scope); + BOOST_REQUIRE_EQUAL(name("initd"_n), result.rows[3].scope); } param.lower_bound = "initb"; @@ -113,8 +113,8 @@ BOOST_FIXTURE_TEST_CASE( get_scope_test, TESTER ) try { BOOST_REQUIRE_EQUAL(2u, result.rows.size()); BOOST_REQUIRE_EQUAL("", result.more); if (result.rows.size() >= 2) { - BOOST_REQUIRE_EQUAL(name(N(initb)), result.rows[0].scope); - BOOST_REQUIRE_EQUAL(name(N(initc)), result.rows[1].scope); + BOOST_REQUIRE_EQUAL(name("initb"_n), result.rows[0].scope); + BOOST_REQUIRE_EQUAL(name("initc"_n), result.rows[1].scope); } param.limit = 1; @@ -127,7 +127,7 @@ BOOST_FIXTURE_TEST_CASE( get_scope_test, TESTER ) try { BOOST_REQUIRE_EQUAL(1u, result.rows.size()); BOOST_REQUIRE_EQUAL("initc", result.more); - param.table = N(invalid); + param.table = "invalid"_n; result = plugin.read_only::get_table_by_scope(param); BOOST_REQUIRE_EQUAL(0u, result.rows.size()); BOOST_REQUIRE_EQUAL("", result.more); @@ -137,22 +137,22 @@ BOOST_FIXTURE_TEST_CASE( get_scope_test, TESTER ) try { BOOST_FIXTURE_TEST_CASE( get_table_test, TESTER ) try { produce_blocks(2); - create_accounts({ N(eosio.token), N(eosio.ram), N(eosio.ramfee), N(eosio.stake), - N(eosio.bpay), N(eosio.vpay), N(eosio.saving), N(eosio.names) }); + create_accounts({ "eosio.token"_n, "eosio.ram"_n, "eosio.ramfee"_n, "eosio.stake"_n, + "eosio.bpay"_n, "eosio.vpay"_n, "eosio.saving"_n, "eosio.names"_n }); - std::vector accs{N(inita), N(initb)}; + std::vector accs{"inita"_n, "initb"_n}; create_accounts(accs); produce_block(); - set_code( N(eosio.token), contracts::eosio_token_wasm() ); - set_abi( N(eosio.token), contracts::eosio_token_abi().data() ); + set_code( "eosio.token"_n, contracts::eosio_token_wasm() ); + set_abi( "eosio.token"_n, contracts::eosio_token_abi().data() ); produce_blocks(1); // create currency auto act = mutable_variant_object() ("issuer", "eosio") ("maximum_supply", eosio::chain::asset::from_string("1000000000.0000 SYS")); - push_action(N(eosio.token), N(create), N(eosio.token), act ); + push_action("eosio.token"_n, "create"_n, "eosio.token"_n, act ); // issue for (account_name a: accs) { @@ -164,7 +164,7 @@ BOOST_FIXTURE_TEST_CASE( get_table_test, TESTER ) try { act = mutable_variant_object() ("issuer", "eosio") ("maximum_supply", eosio::chain::asset::from_string("1000000000.0000 AAA")); - push_action(N(eosio.token), N(create), N(eosio.token), act ); + push_action("eosio.token"_n, "create"_n, "eosio.token"_n, act ); // issue for (account_name a: accs) { issue_tokens( *this, config::system_account_name, a, eosio::chain::asset::from_string("9999.0000 AAA") ); @@ -175,7 +175,7 @@ BOOST_FIXTURE_TEST_CASE( get_table_test, TESTER ) try { act = mutable_variant_object() ("issuer", "eosio") ("maximum_supply", eosio::chain::asset::from_string("1000000000.0000 CCC")); - push_action(N(eosio.token), N(create), N(eosio.token), act ); + push_action("eosio.token"_n, "create"_n, "eosio.token"_n, act ); // issue for (account_name a: accs) { issue_tokens( *this, config::system_account_name, a, eosio::chain::asset::from_string("7777.0000 CCC") ); @@ -186,7 +186,7 @@ BOOST_FIXTURE_TEST_CASE( get_table_test, TESTER ) try { act = mutable_variant_object() ("issuer", "eosio") ("maximum_supply", eosio::chain::asset::from_string("1000000000.0000 BBB")); - push_action(N(eosio.token), N(create), N(eosio.token), act ); + push_action("eosio.token"_n, "create"_n, "eosio.token"_n, act ); // issue for (account_name a: accs) { issue_tokens( *this, config::system_account_name, a, eosio::chain::asset::from_string("8888.0000 BBB") ); @@ -196,9 +196,9 @@ BOOST_FIXTURE_TEST_CASE( get_table_test, TESTER ) try { // get table: normal case eosio::chain_apis::read_only plugin(*(this->control), {}, fc::microseconds::maximum()); eosio::chain_apis::read_only::get_table_rows_params p; - p.code = N(eosio.token); + p.code = "eosio.token"_n; p.scope = "inita"; - p.table = N(accounts); + p.table = "accounts"_n; p.json = true; p.index_position = "primary"; eosio::chain_apis::read_only::get_table_rows_result result = plugin.read_only::get_table_rows(p); @@ -316,22 +316,22 @@ BOOST_FIXTURE_TEST_CASE( get_table_test, TESTER ) try { BOOST_FIXTURE_TEST_CASE( get_table_by_seckey_test, TESTER ) try { produce_blocks(2); - create_accounts({ N(eosio.token), N(eosio.ram), N(eosio.ramfee), N(eosio.stake), - N(eosio.bpay), N(eosio.vpay), N(eosio.saving), N(eosio.names) }); + create_accounts({ "eosio.token"_n, "eosio.ram"_n, "eosio.ramfee"_n, "eosio.stake"_n, + "eosio.bpay"_n, "eosio.vpay"_n, "eosio.saving"_n, "eosio.names"_n }); - std::vector accs{N(inita), N(initb), N(initc), N(initd)}; + std::vector accs{"inita"_n, "initb"_n, "initc"_n, "initd"_n}; create_accounts(accs); produce_block(); - set_code( N(eosio.token), contracts::eosio_token_wasm() ); - set_abi( N(eosio.token), contracts::eosio_token_abi().data() ); + set_code( "eosio.token"_n, contracts::eosio_token_wasm() ); + set_abi( "eosio.token"_n, contracts::eosio_token_abi().data() ); produce_blocks(1); // create currency auto act = mutable_variant_object() ("issuer", "eosio") ("maximum_supply", eosio::chain::asset::from_string("1000000000.0000 SYS")); - push_action(N(eosio.token), N(create), N(eosio.token), act ); + push_action("eosio.token"_n, "create"_n, "eosio.token"_n, act ); // issue for (account_name a: accs) { @@ -342,32 +342,32 @@ BOOST_FIXTURE_TEST_CASE( get_table_by_seckey_test, TESTER ) try { set_code( config::system_account_name, contracts::eosio_system_wasm() ); set_abi( config::system_account_name, contracts::eosio_system_abi().data() ); - base_tester::push_action(config::system_account_name, N(init), + base_tester::push_action(config::system_account_name, "init"_n, config::system_account_name, mutable_variant_object() ("version", 0) ("core", "4,SYS")); // bidname auto bidname = [this]( const account_name& bidder, const account_name& newname, const asset& bid ) { - return push_action( N(eosio), N(bidname), bidder, fc::mutable_variant_object() + return push_action( "eosio"_n, "bidname"_n, bidder, fc::mutable_variant_object() ("bidder", bidder) ("newname", newname) ("bid", bid) ); }; - bidname(N(inita), N(com), eosio::chain::asset::from_string("10.0000 SYS")); - bidname(N(initb), N(org), eosio::chain::asset::from_string("11.0000 SYS")); - bidname(N(initc), N(io), eosio::chain::asset::from_string("12.0000 SYS")); - bidname(N(initd), N(html), eosio::chain::asset::from_string("14.0000 SYS")); + bidname("inita"_n, "com"_n, eosio::chain::asset::from_string("10.0000 SYS")); + bidname("initb"_n, "org"_n, eosio::chain::asset::from_string("11.0000 SYS")); + bidname("initc"_n, "io"_n, eosio::chain::asset::from_string("12.0000 SYS")); + bidname("initd"_n, "html"_n, eosio::chain::asset::from_string("14.0000 SYS")); produce_blocks(1); // get table: normal case eosio::chain_apis::read_only plugin(*(this->control), {}, fc::microseconds::maximum()); eosio::chain_apis::read_only::get_table_rows_params p; - p.code = N(eosio); + p.code = "eosio"_n; p.scope = "eosio"; - p.table = N(namebids); + p.table = "namebids"_n; p.json = true; p.index_position = "secondary"; // ordered by high_bid p.key_type = "i64"; @@ -450,20 +450,20 @@ BOOST_FIXTURE_TEST_CASE( get_table_by_seckey_test, TESTER ) try { BOOST_FIXTURE_TEST_CASE( get_table_next_key_test, TESTER ) try { - create_account(N(test)); + create_account("test"_n); // setup contract and abi - set_code( N(test), contracts::get_table_test_wasm() ); - set_abi( N(test), contracts::get_table_test_abi().data() ); + set_code( "test"_n, contracts::get_table_test_wasm() ); + set_abi( "test"_n, contracts::get_table_test_abi().data() ); produce_block(); // Init some data - push_action(N(test), N(addnumobj), N(test), mutable_variant_object()("input", 2)); - push_action(N(test), N(addnumobj), N(test), mutable_variant_object()("input", 5)); - push_action(N(test), N(addnumobj), N(test), mutable_variant_object()("input", 7)); - push_action(N(test), N(addhashobj), N(test), mutable_variant_object()("hashinput", "firstinput")); - push_action(N(test), N(addhashobj), N(test), mutable_variant_object()("hashinput", "secondinput")); - push_action(N(test), N(addhashobj), N(test), mutable_variant_object()("hashinput", "thirdinput")); + push_action("test"_n, "addnumobj"_n, "test"_n, mutable_variant_object()("input", 2)); + push_action("test"_n, "addnumobj"_n, "test"_n, mutable_variant_object()("input", 5)); + push_action("test"_n, "addnumobj"_n, "test"_n, mutable_variant_object()("input", 7)); + push_action("test"_n, "addhashobj"_n, "test"_n, mutable_variant_object()("hashinput", "firstinput")); + push_action("test"_n, "addhashobj"_n, "test"_n, mutable_variant_object()("hashinput", "secondinput")); + push_action("test"_n, "addhashobj"_n, "test"_n, mutable_variant_object()("hashinput", "thirdinput")); produce_block(); // The result of the init will populate @@ -519,13 +519,13 @@ BOOST_FIXTURE_TEST_CASE( get_table_next_key_test, TESTER ) try { chain_apis::read_only::get_table_rows_params params = []{ chain_apis::read_only::get_table_rows_params params{}; params.json=true; - params.code=N(test); + params.code="test"_n; params.scope="test"; params.limit=1; return params; }(); - params.table = N(numobjs); + params.table = "numobjs"_n; // i64 primary key type params.key_type = "i64"; @@ -608,7 +608,7 @@ BOOST_FIXTURE_TEST_CASE( get_table_next_key_test, TESTER ) try { float128_t more2_secldouble_res_value = more2_res_5.rows[0].get_object()["secldouble"].as(); BOOST_TEST(more2_secldouble_res_value == more2_secldouble_expected_value); - params.table = N(hashobjs); + params.table = "hashobjs"_n; // sha256 secondary key type params.key_type = "sha256"; diff --git a/unittests/abi_tests.cpp b/unittests/abi_tests.cpp index fbfc49d4b53..a6d872a92d0 100644 --- a/unittests/abi_tests.cpp +++ b/unittests/abi_tests.cpp @@ -1793,8 +1793,8 @@ struct action1 { uint64_t blah1; uint32_t blah2; uint8_t blah3; - static account_name get_account() { return N(acount1); } - static account_name get_name() { return N(action1); } + static account_name get_account() { return "acount1"_n; } + static account_name get_name() { return "action1"_n; } template friend Stream& operator<<( Stream& ds, const action1& act ) { @@ -1815,8 +1815,8 @@ struct action2 { uint32_t blah1; uint64_t blah2; uint8_t blah3; - static account_name get_account() { return N(acount2); } - static account_name get_name() { return N(action2); } + static account_name get_account() { return "acount2"_n; } + static account_name get_name() { return "action2"_n; } template friend Stream& operator<<( Stream& ds, const action2& act ) { @@ -1865,9 +1865,9 @@ BOOST_AUTO_TEST_CASE(packed_transaction) txn.ref_block_num = 1; txn.ref_block_prefix = 2; txn.expiration.from_iso_string("2021-12-20T15:30"); - name a = N(alice); + name a = "alice"_n; txn.context_free_actions.emplace_back( - vector{{N(testapi1), config::active_name}}, + vector{{"testapi1"_n, config::active_name}}, newaccount{ .creator = config::system_account_name, .name = a, @@ -1875,13 +1875,13 @@ BOOST_AUTO_TEST_CASE(packed_transaction) .active = authority( get_public_key( a, "active" ) ) }); txn.context_free_actions.emplace_back( - vector{{N(testapi2), config::active_name}}, + vector{{"testapi2"_n, config::active_name}}, action1{ 15, 23, (uint8_t)3}); txn.actions.emplace_back( - vector{{N(testapi3), config::active_name}}, + vector{{"testapi3"_n, config::active_name}}, action2{ 42, 67, (uint8_t)1}); txn.actions.emplace_back( - vector{{N(testapi4), config::active_name}}, + vector{{"testapi4"_n, config::active_name}}, action2{ 61, 23, (uint8_t)2}); txn.max_net_usage_words = 15; txn.max_cpu_usage_ms = 43; diff --git a/unittests/api_tests.cpp b/unittests/api_tests.cpp index 1c60d2485c1..26241ec46cc 100644 --- a/unittests/api_tests.cpp +++ b/unittests/api_tests.cpp @@ -54,19 +54,21 @@ struct u128_action { unsigned __int128 values[3]; //16*3 }; +using namespace eosio::chain::literals; + // Deferred Transaction Trigger Action struct dtt_action { static uint64_t get_name() { return WASM_TEST_ACTION("test_transaction", "send_deferred_tx_with_dtt_action"); } static uint64_t get_account() { - return N(testapi).to_uint64_t(); + return "testapi"_n.to_uint64_t(); } - uint64_t payer = N(testapi).to_uint64_t(); - uint64_t deferred_account = N(testapi).to_uint64_t(); + uint64_t payer = "testapi"_n.to_uint64_t(); + uint64_t deferred_account = "testapi"_n.to_uint64_t(); uint64_t deferred_action = WASM_TEST_ACTION("test_transaction", "deferred_print"); - uint64_t permission_name = N(active).to_uint64_t(); + uint64_t permission_name = "active"_n.to_uint64_t(); uint32_t delay_sec = 2; }; @@ -97,7 +99,7 @@ namespace bio = boost::iostreams; template struct test_api_action { static account_name get_account() { - return N(testapi); + return "testapi"_n; } static action_name get_name() { @@ -160,7 +162,7 @@ string U128Str(unsigned __int128 i) } template -transaction_trace_ptr CallAction(TESTER& test, T ac, const vector& scope = {N(testapi)}) { +transaction_trace_ptr CallAction(TESTER& test, T ac, const vector& scope = {"testapi"_n}) { signed_transaction trx; @@ -183,7 +185,7 @@ transaction_trace_ptr CallAction(TESTER& test, T ac, const vector& } template -std::pair _CallFunction(Tester& test, T ac, const vector& data, const vector& scope = {N(testapi)}, bool no_throw = false) { +std::pair _CallFunction(Tester& test, T ac, const vector& data, const vector& scope = {"testapi"_n}, bool no_throw = false) { { signed_transaction trx; @@ -194,7 +196,7 @@ std::pair _CallFunction(Tester& test, T action act(pl, ac); act.data = data; - act.authorization = {{N(testapi), config::active_name}}; + act.authorization = {{"testapi"_n, config::active_name}}; trx.actions.push_back(act); test.set_transaction_headers(trx, test.DEFAULT_EXPIRATION_DELTA); @@ -213,7 +215,7 @@ std::pair _CallFunction(Tester& test, T } template -transaction_trace_ptr CallFunction(Tester& test, T ac, const vector& data, const vector& scope = {N(testapi)}, bool no_throw = false) { +transaction_trace_ptr CallFunction(Tester& test, T ac, const vector& data, const vector& scope = {"testapi"_n}, bool no_throw = false) { { return _CallFunction(test, ac, data, scope, no_throw).first; } @@ -223,7 +225,7 @@ transaction_trace_ptr CallFunction(Tester& test, T ac, const vector& data, #define CALL_TEST_FUNCTION_WITH_BLOCK(_TESTER, CLS, MTH, DATA) _CallFunction(_TESTER, test_api_action{}, DATA) #define CALL_TEST_FUNCTION_SYSTEM(_TESTER, CLS, MTH, DATA) CallFunction(_TESTER, test_chain_action{}, DATA, {config::system_account_name} ) #define CALL_TEST_FUNCTION_SCOPE(_TESTER, CLS, MTH, DATA, ACCOUNT) CallFunction(_TESTER, test_api_action{}, DATA, ACCOUNT) -#define CALL_TEST_FUNCTION_NO_THROW(_TESTER, CLS, MTH, DATA) CallFunction(_TESTER, test_api_action{}, DATA, {N(testapi)}, true) +#define CALL_TEST_FUNCTION_NO_THROW(_TESTER, CLS, MTH, DATA) CallFunction(_TESTER, test_api_action{}, DATA, {"testapi"_n}, true) #define CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION(_TESTER, CLS, MTH, DATA, EXC, EXC_MESSAGE) \ BOOST_CHECK_EXCEPTION( \ CALL_TEST_FUNCTION( _TESTER, CLS, MTH, DATA), \ @@ -282,13 +284,13 @@ uint32_t last_fnc_err = 0; BOOST_FIXTURE_TEST_CASE(action_receipt_tests, TESTER) { try { produce_blocks(2); - create_account( N(test) ); - set_code( N(test), contracts::payloadless_wasm() ); + create_account( "test"_n ); + set_code( "test"_n, contracts::payloadless_wasm() ); produce_blocks(1); auto call_doit_and_check = [&]( account_name contract, account_name signer, auto&& checker ) { signed_transaction trx; - trx.actions.emplace_back( vector{{signer, config::active_name}}, contract, N(doit), bytes{} ); + trx.actions.emplace_back( vector{{signer, config::active_name}}, contract, "doit"_n, bytes{} ); this->set_transaction_headers( trx, this->DEFAULT_EXPIRATION_DELTA ); trx.sign( this->get_private_key(signer, "active"), control->get_chain_id() ); auto res = this->push_transaction(trx); @@ -297,7 +299,7 @@ BOOST_FIXTURE_TEST_CASE(action_receipt_tests, TESTER) { try { auto call_provereset_and_check = [&]( account_name contract, account_name signer, auto&& checker ) { signed_transaction trx; - trx.actions.emplace_back( vector{{signer, config::active_name}}, contract, N(provereset), bytes{} ); + trx.actions.emplace_back( vector{{signer, config::active_name}}, contract, "provereset"_n, bytes{} ); this->set_transaction_headers( trx, this->DEFAULT_EXPIRATION_DELTA ); trx.sign( this->get_private_key(signer, "active"), control->get_chain_id() ); auto res = this->push_transaction(trx); @@ -316,7 +318,7 @@ BOOST_FIXTURE_TEST_CASE(action_receipt_tests, TESTER) { try { uint64_t base_test_recv_seq_num = 0; uint64_t base_test_auth_seq_num = 0; - call_doit_and_check( N(test), N(test), [&]( const transaction_trace_ptr& res ) { + call_doit_and_check( "test"_n, "test"_n, [&]( const transaction_trace_ptr& res ) { BOOST_CHECK_EQUAL( res->receipt->status, transaction_receipt::executed ); BOOST_CHECK_EQUAL( res->action_traces[0].receipt->global_sequence, base_global_sequence_num + 1 ); BOOST_CHECK_EQUAL( res->action_traces[0].receipt->code_sequence.value, 1 ); @@ -332,10 +334,10 @@ BOOST_FIXTURE_TEST_CASE(action_receipt_tests, TESTER) { try { --base_test_auth_seq_num; } ); - set_code( N(test), contracts::asserter_wasm() ); + set_code( "test"_n, contracts::asserter_wasm() ); set_code( config::system_account_name, contracts::payloadless_wasm() ); - call_provereset_and_check( N(test), N(test), [&]( const transaction_trace_ptr& res ) { + call_provereset_and_check( "test"_n, "test"_n, [&]( const transaction_trace_ptr& res ) { BOOST_CHECK_EQUAL( res->receipt->status, transaction_receipt::executed ); BOOST_CHECK_EQUAL( res->action_traces[0].receipt->global_sequence, base_global_sequence_num + 4 ); BOOST_CHECK_EQUAL( res->action_traces[0].receipt->recv_sequence, base_test_recv_seq_num + 2 ); @@ -351,7 +353,7 @@ BOOST_FIXTURE_TEST_CASE(action_receipt_tests, TESTER) { try { // Adding a block also retires an onblock action which increments both the global sequence number // and the recv and auth sequences numbers for the system account. - call_doit_and_check( config::system_account_name, N(test), [&]( const transaction_trace_ptr& res ) { + call_doit_and_check( config::system_account_name, "test"_n, [&]( const transaction_trace_ptr& res ) { BOOST_CHECK_EQUAL( res->receipt->status, transaction_receipt::executed ); BOOST_CHECK_EQUAL( res->action_traces[0].receipt->global_sequence, base_global_sequence_num + 6 ); BOOST_CHECK_EQUAL( res->action_traces[0].receipt->recv_sequence, base_system_recv_seq_num + 4 ); @@ -365,11 +367,11 @@ BOOST_FIXTURE_TEST_CASE(action_receipt_tests, TESTER) { try { set_code( config::system_account_name, contracts::eosio_bios_wasm() ); - set_code( N(test), contracts::eosio_bios_wasm() ); - set_abi( N(test), contracts::eosio_bios_abi().data() ); - set_code( N(test), contracts::payloadless_wasm() ); + set_code( "test"_n, contracts::eosio_bios_wasm() ); + set_abi( "test"_n, contracts::eosio_bios_abi().data() ); + set_code( "test"_n, contracts::payloadless_wasm() ); - call_doit_and_check( N(test), N(test), [&]( const transaction_trace_ptr& res ) { + call_doit_and_check( "test"_n, "test"_n, [&]( const transaction_trace_ptr& res ) { BOOST_CHECK_EQUAL( res->receipt->status, transaction_receipt::executed); BOOST_CHECK_EQUAL( res->action_traces[0].receipt->global_sequence, base_global_sequence_num + 11 ); BOOST_CHECK_EQUAL( res->action_traces[0].receipt->recv_sequence, base_test_recv_seq_num + 3 ); @@ -388,13 +390,13 @@ BOOST_FIXTURE_TEST_CASE(action_receipt_tests, TESTER) { try { *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(action_tests, TESTER) { try { produce_blocks(2); - create_account( N(testapi) ); - create_account( N(acc1) ); - create_account( N(acc2) ); - create_account( N(acc3) ); - create_account( N(acc4) ); + create_account( "testapi"_n ); + create_account( "acc1"_n ); + create_account( "acc2"_n ); + create_account( "acc3"_n ); + create_account( "acc4"_n ); produce_blocks(10); - set_code( N(testapi), contracts::test_api_wasm() ); + set_code( "testapi"_n, contracts::test_api_wasm() ); produce_blocks(1); // test assert_true @@ -433,18 +435,18 @@ BOOST_FIXTURE_TEST_CASE(action_tests, TESTER) { try { ); // test require_notice - auto scope = std::vector{N(testapi)}; + auto scope = std::vector{"testapi"_n}; auto test_require_notice = [this](auto& test, std::vector& data, std::vector& scope){ signed_transaction trx; auto tm = test_api_action{}; - action act(std::vector{{N(testapi), config::active_name}}, tm); + action act(std::vector{{"testapi"_n, config::active_name}}, tm); vector& dest = *(vector *)(&act.data); std::copy(data.begin(), data.end(), std::back_inserter(dest)); trx.actions.push_back(act); test.set_transaction_headers(trx); - trx.sign(test.get_private_key(N(inita), "active"), control->get_chain_id()); + trx.sign(test.get_private_key("inita"_n, "active"), control->get_chain_id()); auto res = test.push_transaction(trx); BOOST_CHECK_EQUAL(res->receipt->status, transaction_receipt::executed); }; @@ -463,7 +465,7 @@ BOOST_FIXTURE_TEST_CASE(action_tests, TESTER) { try { ); // test require_auth - auto a3only = std::vector{{N(acc3), config::active_name}}; + auto a3only = std::vector{{"acc3"_n, config::active_name}}; BOOST_CHECK_EXCEPTION(CALL_TEST_FUNCTION( *this, "test_action", "require_auth", fc::raw::pack(a3only)), missing_auth_exception, [](const missing_auth_exception& e) { return expect_assert_message(e, "missing authority of"); @@ -471,7 +473,7 @@ BOOST_FIXTURE_TEST_CASE(action_tests, TESTER) { try { ); // test require_auth - auto a4only = std::vector{{N(acc4), config::active_name}}; + auto a4only = std::vector{{"acc4"_n, config::active_name}}; BOOST_CHECK_EXCEPTION(CALL_TEST_FUNCTION( *this, "test_action", "require_auth", fc::raw::pack(a4only)), missing_auth_exception, [](const missing_auth_exception& e) { return expect_assert_message(e, "missing authority of"); @@ -479,8 +481,8 @@ BOOST_FIXTURE_TEST_CASE(action_tests, TESTER) { try { ); // test require_auth - auto a3a4 = std::vector{{N(acc3), config::active_name}, {N(acc4), config::active_name}}; - auto a3a4_scope = std::vector{N(acc3), N(acc4)}; + auto a3a4 = std::vector{{"acc3"_n, config::active_name}, {"acc4"_n, config::active_name}}; + auto a3a4_scope = std::vector{"acc3"_n, "acc4"_n}; { signed_transaction trx; auto tm = test_api_action{}; @@ -493,13 +495,13 @@ BOOST_FIXTURE_TEST_CASE(action_tests, TESTER) { try { auto dat = fc::raw::pack(a3a4); vector& dest = *(vector *)(&act.data); std::copy(dat.begin(), dat.end(), std::back_inserter(dest)); - act.authorization = {{N(testapi), config::active_name}, {N(acc3), config::active_name}, {N(acc4), config::active_name}}; + act.authorization = {{"testapi"_n, config::active_name}, {"acc3"_n, config::active_name}, {"acc4"_n, config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key(N(testapi), "active"), control->get_chain_id()); - trx.sign(get_private_key(N(acc3), "active"), control->get_chain_id()); - trx.sign(get_private_key(N(acc4), "active"), control->get_chain_id()); + trx.sign(get_private_key("testapi"_n, "active"), control->get_chain_id()); + trx.sign(get_private_key("acc3"_n, "active"), control->get_chain_id()); + trx.sign(get_private_key("acc4"_n, "active"), control->get_chain_id()); auto res = push_transaction(trx); BOOST_CHECK_EQUAL(res->receipt->status, transaction_receipt::executed); } @@ -514,10 +516,10 @@ BOOST_FIXTURE_TEST_CASE(action_tests, TESTER) { try { eosio_assert_message_exception, eosio_assert_message_is("tmp == current_time()") ); // test test_current_receiver - CALL_TEST_FUNCTION( *this, "test_action", "test_current_receiver", fc::raw::pack(N(testapi))); + CALL_TEST_FUNCTION( *this, "test_action", "test_current_receiver", fc::raw::pack("testapi"_n)); // test send_action_sender - CALL_TEST_FUNCTION( *this, "test_transaction", "send_action_sender", fc::raw::pack(N(testapi))); + CALL_TEST_FUNCTION( *this, "test_transaction", "send_action_sender", fc::raw::pack("testapi"_n)); produce_block(); @@ -541,22 +543,22 @@ BOOST_FIXTURE_TEST_CASE(action_tests, TESTER) { try { // test require_recipient loop (doesn't cause infinite loop) BOOST_FIXTURE_TEST_CASE(require_notice_tests, TESTER) { try { produce_blocks(2); - create_account( N(testapi) ); - create_account( N(acc5) ); + create_account( "testapi"_n ); + create_account( "acc5"_n ); produce_blocks(1); - set_code( N(testapi), contracts::test_api_wasm() ); - set_code( N(acc5), contracts::test_api_wasm() ); + set_code( "testapi"_n, contracts::test_api_wasm() ); + set_code( "acc5"_n, contracts::test_api_wasm() ); produce_blocks(1); // test require_notice signed_transaction trx; auto tm = test_api_action{}; - action act( std::vector{{N( testapi ), config::active_name}}, tm ); + action act( std::vector{{"testapi"_n, config::active_name}}, tm ); trx.actions.push_back( act ); set_transaction_headers( trx ); - trx.sign( get_private_key( N( testapi ), "active" ), control->get_chain_id() ); + trx.sign( get_private_key( "testapi"_n, "active" ), control->get_chain_id() ); auto res = push_transaction( trx ); BOOST_CHECK_EQUAL( res->receipt->status, transaction_receipt::executed ); @@ -572,24 +574,24 @@ BOOST_AUTO_TEST_CASE(ram_billing_in_notify_tests) { try { chain.preactivate_protocol_features( {*d} ); chain.produce_blocks(2); - chain.create_account( N(testapi) ); - chain.create_account( N(testapi2) ); + chain.create_account( "testapi"_n ); + chain.create_account( "testapi2"_n ); chain.produce_blocks(10); - chain.set_code( N(testapi), contracts::test_api_wasm() ); + chain.set_code( "testapi"_n, contracts::test_api_wasm() ); chain.produce_blocks(1); - chain.set_code( N(testapi2), contracts::test_api_wasm() ); + chain.set_code( "testapi2"_n, contracts::test_api_wasm() ); chain.produce_blocks(1); BOOST_CHECK_EXCEPTION( CALL_TEST_FUNCTION( chain, "test_action", "test_ram_billing_in_notify", - fc::raw::pack( ((unsigned __int128)N(testapi2).to_uint64_t() << 64) | N(testapi).to_uint64_t() ) ), + fc::raw::pack( ((unsigned __int128)"testapi2"_n.to_uint64_t() << 64) | "testapi"_n.to_uint64_t() ) ), subjective_block_production_exception, fc_exception_message_is("Cannot charge RAM to other accounts during notify.") ); - CALL_TEST_FUNCTION( chain, "test_action", "test_ram_billing_in_notify", fc::raw::pack( ((unsigned __int128)N(testapi2).to_uint64_t() << 64) | 0 ) ); + CALL_TEST_FUNCTION( chain, "test_action", "test_ram_billing_in_notify", fc::raw::pack( ((unsigned __int128)"testapi2"_n.to_uint64_t() << 64) | 0 ) ); - CALL_TEST_FUNCTION( chain, "test_action", "test_ram_billing_in_notify", fc::raw::pack( ((unsigned __int128)N(testapi2).to_uint64_t() << 64) | N(testapi2).to_uint64_t() ) ); + CALL_TEST_FUNCTION( chain, "test_action", "test_ram_billing_in_notify", fc::raw::pack( ((unsigned __int128)"testapi2"_n.to_uint64_t() << 64) | "testapi2"_n.to_uint64_t() ) ); BOOST_REQUIRE_EQUAL( chain.validate(), true ); } FC_LOG_AND_RETHROW() } @@ -599,10 +601,10 @@ BOOST_AUTO_TEST_CASE(ram_billing_in_notify_tests) { try { *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(cf_action_tests, TESTER) { try { produce_blocks(2); - create_account( N(testapi) ); - create_account( N(dummy) ); + create_account( "testapi"_n ); + create_account( "dummy"_n ); produce_blocks(10); - set_code( N(testapi), contracts::test_api_wasm() ); + set_code( "testapi"_n, contracts::test_api_wasm() ); produce_blocks(1); cf_action cfa; signed_transaction trx; @@ -630,12 +632,12 @@ BOOST_FIXTURE_TEST_CASE(cf_action_tests, TESTER) { try { // add a normal action along with cfa dummy_action da = { DUMMY_ACTION_DEFAULT_A, DUMMY_ACTION_DEFAULT_B, DUMMY_ACTION_DEFAULT_C }; - auto pl = vector{{N(testapi), config::active_name}}; + auto pl = vector{{"testapi"_n, config::active_name}}; action act1(pl, da); trx.actions.push_back(act1); set_transaction_headers(trx); // run normal passing case - auto sigs = trx.sign(get_private_key(N(testapi), "active"), control->get_chain_id()); + auto sigs = trx.sign(get_private_key("testapi"_n, "active"), control->get_chain_id()); auto res = push_transaction(trx); BOOST_CHECK_EQUAL(res->receipt->status, transaction_receipt::executed); @@ -649,7 +651,7 @@ BOOST_FIXTURE_TEST_CASE(cf_action_tests, TESTER) { try { trx.actions.push_back(act2); set_transaction_headers(trx); // run (dummy_action.b = 200) case looking for invalid use of context_free api - sigs = trx.sign(get_private_key(N(testapi), "active"), control->get_chain_id()); + sigs = trx.sign(get_private_key("testapi"_n, "active"), control->get_chain_id()); BOOST_CHECK_EXCEPTION(push_transaction(trx), unaccessible_api, [](const fc::exception& e) { return expect_assert_message(e, "this API may only be called from context_free apply"); @@ -674,7 +676,7 @@ BOOST_FIXTURE_TEST_CASE(cf_action_tests, TESTER) { try { trx.context_free_actions.emplace_back(cfa_act); trx.signatures.clear(); set_transaction_headers(trx); - sigs = trx.sign(get_private_key(N(testapi), "active"), control->get_chain_id()); + sigs = trx.sign(get_private_key("testapi"_n, "active"), control->get_chain_id()); BOOST_CHECK_EXCEPTION(push_transaction(trx), unaccessible_api, [](const fc::exception& e) { return expect_assert_message(e, "only context free api's can be used in this context" ); @@ -725,11 +727,11 @@ BOOST_FIXTURE_TEST_CASE(cfa_tx_signature, TESTER) try { BOOST_FIXTURE_TEST_CASE(cfa_stateful_api, TESTER) try { - create_account( N(testapi) ); + create_account( "testapi"_n ); produce_blocks(1); - set_code( N(testapi), contracts::test_api_wasm() ); + set_code( "testapi"_n, contracts::test_api_wasm() ); - account_name a = N(testapi2); + account_name a = "testapi2"_n; account_name creator = config::system_account_name; signed_transaction trx; @@ -755,11 +757,11 @@ BOOST_FIXTURE_TEST_CASE(cfa_stateful_api, TESTER) try { BOOST_FIXTURE_TEST_CASE(deferred_cfa_failed, TESTER) try { - create_account( N(testapi) ); + create_account( "testapi"_n ); produce_blocks(1); - set_code( N(testapi), contracts::test_api_wasm() ); + set_code( "testapi"_n, contracts::test_api_wasm() ); - account_name a = N(testapi2); + account_name a = "testapi2"_n; account_name creator = config::system_account_name; signed_transaction trx; @@ -784,18 +786,18 @@ BOOST_FIXTURE_TEST_CASE(deferred_cfa_failed, TESTER) try { produce_blocks(10); // CFA failed, testapi2 not created - create_account( N(testapi2) ); + create_account( "testapi2"_n ); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE(deferred_cfa_success, TESTER) try { - create_account( N(testapi) ); + create_account( "testapi"_n ); produce_blocks(1); - set_code( N(testapi), contracts::test_api_wasm() ); + set_code( "testapi"_n, contracts::test_api_wasm() ); - account_name a = N(testapi2); + account_name a = "testapi2"_n; account_name creator = config::system_account_name; signed_transaction trx; @@ -820,7 +822,7 @@ BOOST_FIXTURE_TEST_CASE(deferred_cfa_success, TESTER) try { produce_blocks(10); // CFA success, testapi2 created - BOOST_CHECK_EXCEPTION(create_account( N(testapi2) ), fc::exception, + BOOST_CHECK_EXCEPTION(create_account( "testapi2"_n ), fc::exception, [&](const fc::exception &e) { return expect_assert_message(e, "Cannot create account named testapi2, as that name is already taken"); }); @@ -833,10 +835,10 @@ BOOST_AUTO_TEST_CASE(light_validation_skip_cfa) try { std::vector blocks; blocks.push_back(chain.produce_block()); - chain.create_account( N(testapi) ); - chain.create_account( N(dummy) ); + chain.create_account( "testapi"_n ); + chain.create_account( "dummy"_n ); blocks.push_back(chain.produce_block()); - chain.set_code( N(testapi), contracts::test_api_wasm() ); + chain.set_code( "testapi"_n, contracts::test_api_wasm() ); blocks.push_back(chain.produce_block()); cf_action cfa; @@ -847,11 +849,11 @@ BOOST_AUTO_TEST_CASE(light_validation_skip_cfa) try { trx.context_free_data.emplace_back(fc::raw::pack(200)); // add a normal action along with cfa dummy_action da = { DUMMY_ACTION_DEFAULT_A, DUMMY_ACTION_DEFAULT_B, DUMMY_ACTION_DEFAULT_C }; - action act1(vector{{N(testapi), config::active_name}}, da); + action act1(vector{{"testapi"_n, config::active_name}}, da); trx.actions.push_back(act1); chain.set_transaction_headers(trx); // run normal passing case - auto sigs = trx.sign(chain.get_private_key(N(testapi), "active"), chain.control->get_chain_id()); + auto sigs = trx.sign(chain.get_private_key("testapi"_n, "active"), chain.control->get_chain_id()); auto trace = chain.push_transaction(trx); blocks.push_back(chain.produce_block()); @@ -870,7 +872,7 @@ BOOST_AUTO_TEST_CASE(light_validation_skip_cfa) try { auto conf_genesis = tester::default_config( tempdir ); auto& cfg = conf_genesis.first; - cfg.trusted_producers = { N(eosio) }; // light validation + cfg.trusted_producers = { "eosio"_n }; // light validation tester other( conf_genesis.first, conf_genesis.second ); other.execute_setup_policy( setup_policy::full ); @@ -915,9 +917,9 @@ BOOST_AUTO_TEST_CASE(light_validation_skip_cfa) try { *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(checktime_pass_tests, TESTER) { try { produce_blocks(2); - create_account( N(testapi) ); + create_account( "testapi"_n ); produce_blocks(10); - set_code( N(testapi), contracts::test_api_wasm() ); + set_code( "testapi"_n, contracts::test_api_wasm() ); produce_blocks(1); // test checktime_pass @@ -930,13 +932,13 @@ template void call_test(TESTER& test, T ac, uint32_t billed_cpu_time_us , uint32_t max_cpu_usage_ms = 200, std::vector payload = {} ) { signed_transaction trx; - auto pl = vector{{N(testapi), config::active_name}}; + auto pl = vector{{"testapi"_n, config::active_name}}; action act(pl, ac); act.data = payload; trx.actions.push_back(act); test.set_transaction_headers(trx); - auto sigs = trx.sign(test.get_private_key(N(testapi), "active"), test.control->get_chain_id()); + auto sigs = trx.sign(test.get_private_key("testapi"_n, "active"), test.control->get_chain_id()); flat_set keys; trx.get_signature_keys(test.control->get_chain_id(), fc::time_point::maximum(), keys); auto res = test.push_transaction( trx, fc::time_point::now() + fc::milliseconds(max_cpu_usage_ms), billed_cpu_time_us ); @@ -949,14 +951,14 @@ BOOST_AUTO_TEST_CASE(checktime_fail_tests) { try { t.produce_blocks(2); ilog( "create account" ); - t.create_account( N(testapi) ); + t.create_account( "testapi"_n ); ilog( "set code" ); - t.set_code( N(testapi), contracts::test_api_wasm() ); + t.set_code( "testapi"_n, contracts::test_api_wasm() ); ilog( "produce block" ); t.produce_blocks(1); int64_t x; int64_t net; int64_t cpu; - t.control->get_resource_limits_manager().get_account_limits( N(testapi), x, net, cpu ); + t.control->get_resource_limits_manager().get_account_limits( "testapi"_n, x, net, cpu ); wdump((net)(cpu)); #warning TODO call the contract before testing to cache it, and validate that it was cached @@ -973,7 +975,7 @@ BOOST_AUTO_TEST_CASE(checktime_fail_tests) { try { std::string dummy_string = "nonce"; uint32_t increment = config::default_max_transaction_cpu_usage / 3; for( auto i = 0; time_left_in_block_us > 2*increment; ++i ) { - t.push_dummy( N(testapi), dummy_string + std::to_string(i), increment ); + t.push_dummy( "testapi"_n, dummy_string + std::to_string(i), increment ); time_left_in_block_us -= increment; } BOOST_CHECK_EXCEPTION( call_test( t, test_api_action{}, @@ -986,7 +988,7 @@ BOOST_AUTO_TEST_CASE(checktime_fail_tests) { try { BOOST_FIXTURE_TEST_CASE(checktime_intrinsic, TESTER) { try { produce_blocks(2); - create_account( N(testapi) ); + create_account( "testapi"_n ); produce_blocks(10); std::stringstream ss; @@ -1027,7 +1029,7 @@ BOOST_FIXTURE_TEST_CASE(checktime_intrinsic, TESTER) { try { )CONTRACT"; } ss<< "))"; - set_code( N(testapi), ss.str().c_str() ); + set_code( "testapi"_n, ss.str().c_str() ); produce_blocks(1); //initialize cache @@ -1045,9 +1047,9 @@ BOOST_FIXTURE_TEST_CASE(checktime_intrinsic, TESTER) { try { BOOST_FIXTURE_TEST_CASE(checktime_hashing_fail, TESTER) { try { produce_blocks(2); - create_account( N(testapi) ); + create_account( "testapi"_n ); produce_blocks(10); - set_code( N(testapi), contracts::test_api_wasm() ); + set_code( "testapi"_n, contracts::test_api_wasm() ); produce_blocks(1); //hit deadline exception, but cache the contract @@ -1098,9 +1100,9 @@ BOOST_FIXTURE_TEST_CASE(checktime_hashing_fail, TESTER) { try { *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(transaction_tests, TESTER) { try { produce_blocks(2); - create_account( N(testapi) ); + create_account( "testapi"_n ); produce_blocks(100); - set_code( N(testapi), contracts::test_api_wasm() ); + set_code( "testapi"_n, contracts::test_api_wasm() ); produce_blocks(1); // test for zero auth @@ -1179,7 +1181,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_tests, TESTER) { try { BOOST_CHECK( !test_trace->failed_dtrx_trace ); BOOST_CHECK_EQUAL(0, block_ids.count( trace->id ) ); // onerror id, not in block BOOST_CHECK_EQUAL(1, block_ids.count( trace->failed_dtrx_trace->id ) ); // deferred id since trace moved to failed_dtrx_trace - BOOST_CHECK( trace->action_traces.at(0).act.name == N(onerror) ); + BOOST_CHECK( trace->action_traces.at(0).act.name == "onerror"_n ); c.disconnect(); c2.disconnect(); @@ -1214,14 +1216,14 @@ BOOST_FIXTURE_TEST_CASE(transaction_tests, TESTER) { try { { signed_transaction trx; - auto pl = vector{{N( testapi ), config::active_name}}; + auto pl = vector{{"testapi"_n, config::active_name}}; action act( pl, test_api_action{} ); act.data = {}; - act.authorization = {{N( testapi ), config::active_name}}; + act.authorization = {{"testapi"_n, config::active_name}}; trx.actions.push_back( act ); set_transaction_headers( trx, DEFAULT_EXPIRATION_DELTA ); - auto sigs = trx.sign( get_private_key( N( testapi ), "active" ), control->get_chain_id() ); + auto sigs = trx.sign( get_private_key( "testapi"_n, "active" ), control->get_chain_id() ); auto time_limit = fc::microseconds::maximum(); auto ptrx = std::make_shared( signed_transaction(trx), true, packed_transaction::compression_type::none ); @@ -1258,12 +1260,12 @@ BOOST_AUTO_TEST_CASE(inline_action_subjective_limit) { try { block = chain.produce_block(); chain2.push_block(block); } - chain.create_account( N(testapi) ); + chain.create_account( "testapi"_n ); for (int n=0; n < 2; ++n) { block = chain.produce_block(); chain2.push_block(block); } - chain.set_code( N(testapi), contracts::test_api_wasm() ); + chain.set_code( "testapi"_n, contracts::test_api_wasm() ); block = chain.produce_block(); chain2.push_block(block); @@ -1281,12 +1283,12 @@ BOOST_AUTO_TEST_CASE(inline_action_objective_limit) { try { const uint32_t _4k = 4 * 1024; tester chain(setup_policy::full, db_read_mode::SPECULATIVE, {_4k}, {_4k - 1}); chain.produce_blocks(2); - chain.create_account( N(testapi) ); + chain.create_account( "testapi"_n ); chain.produce_blocks(100); - chain.set_code( N(testapi), contracts::test_api_wasm() ); + chain.set_code( "testapi"_n, contracts::test_api_wasm() ); chain.produce_block(); - chain.push_action(config::system_account_name, N(setpriv), config::system_account_name, mutable_variant_object() + chain.push_action(config::system_account_name, "setpriv"_n, config::system_account_name, mutable_variant_object() ("account", "testapi") ("is_priv", 1)); chain.produce_block(); @@ -1303,9 +1305,9 @@ BOOST_AUTO_TEST_CASE(deferred_inline_action_subjective_limit_failure) { try { const uint32_t _4k = 4 * 1024; tester chain(setup_policy::full, db_read_mode::SPECULATIVE, {_4k + 100}, {_4k}); chain.produce_blocks(2); - chain.create_accounts( {N(testapi), N(testapi2), N(alice)} ); - chain.set_code( N(testapi), contracts::test_api_wasm() ); - chain.set_code( N(testapi2), contracts::test_api_wasm() ); + chain.create_accounts( {"testapi"_n, "testapi2"_n, "alice"_n} ); + chain.set_code( "testapi"_n, contracts::test_api_wasm() ); + chain.set_code( "testapi2"_n, contracts::test_api_wasm() ); chain.produce_block(); transaction_trace_ptr trace; @@ -1315,7 +1317,7 @@ BOOST_AUTO_TEST_CASE(deferred_inline_action_subjective_limit_failure) { try { } ); CALL_TEST_FUNCTION(chain, "test_transaction", "send_deferred_transaction_4k_action", {} ); BOOST_CHECK(!trace); - BOOST_CHECK_EXCEPTION(chain.produce_block( fc::seconds(2) ), fc::exception, + BOOST_CHECK_EXCEPTION(chain.produce_block( fc::seconds(2) ), fc::exception, [](const fc::exception& e) { return expect_assert_message(e, "inline action too big for nonprivileged account"); } @@ -1340,9 +1342,9 @@ BOOST_AUTO_TEST_CASE(deferred_inline_action_subjective_limit) { try { block = chain.produce_block(); chain2.push_block(block); } - chain.create_accounts( {N(testapi), N(testapi2), N(alice)} ); - chain.set_code( N(testapi), contracts::test_api_wasm() ); - chain.set_code( N(testapi2), contracts::test_api_wasm() ); + chain.create_accounts( {"testapi"_n, "testapi2"_n, "alice"_n} ); + chain.set_code( "testapi"_n, contracts::test_api_wasm() ); + chain.set_code( "testapi2"_n, contracts::test_api_wasm() ); block = chain.produce_block(); chain2.push_block(block); @@ -1374,9 +1376,9 @@ BOOST_AUTO_TEST_CASE(deferred_inline_action_subjective_limit) { try { BOOST_FIXTURE_TEST_CASE(deferred_transaction_tests, TESTER) { try { produce_blocks(2); - create_accounts( {N(testapi), N(testapi2), N(alice)} ); - set_code( N(testapi), contracts::test_api_wasm() ); - set_code( N(testapi2), contracts::test_api_wasm() ); + create_accounts( {"testapi"_n, "testapi2"_n, "alice"_n} ); + set_code( "testapi"_n, contracts::test_api_wasm() ); + set_code( "testapi2"_n, contracts::test_api_wasm() ); produce_blocks(1); //schedule @@ -1502,19 +1504,19 @@ BOOST_FIXTURE_TEST_CASE(deferred_transaction_tests, TESTER) { try { // Trigger a tx which in turn sends a deferred tx with payer != receiver // Payer is alice in this case, this tx should fail since we don't have the authorization of alice dtt_action dtt_act1; - dtt_act1.payer = N(alice).to_uint64_t(); + dtt_act1.payer = "alice"_n.to_uint64_t(); BOOST_CHECK_THROW(CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_tx_with_dtt_action", fc::raw::pack(dtt_act1)), action_validate_exception); // Send a tx which in turn sends a deferred tx with the deferred tx's receiver != this tx receiver // This will include the authorization of the receiver, and impose any related delay associated with the authority // We set the authorization delay to be 10 sec here, and since the deferred tx delay is set to be 5 sec, so this tx should fail dtt_action dtt_act2; - dtt_act2.deferred_account = N(testapi2).to_uint64_t(); - dtt_act2.permission_name = N(additional).to_uint64_t(); + dtt_act2.deferred_account = "testapi2"_n.to_uint64_t(); + dtt_act2.permission_name = "additional"_n.to_uint64_t(); dtt_act2.delay_sec = 5; auto auth = authority(get_public_key(name("testapi"), name(dtt_act2.permission_name).to_string()), 10); - auth.accounts.push_back( permission_level_weight{{N(testapi), config::eosio_code_name}, 1} ); + auth.accounts.push_back( permission_level_weight{{"testapi"_n, config::eosio_code_name}, 1} ); push_action(config::system_account_name, updateauth::get_name(), name("testapi"), fc::mutable_variant_object() ("account", "testapi") @@ -1537,8 +1539,8 @@ BOOST_FIXTURE_TEST_CASE(deferred_transaction_tests, TESTER) { try { // But not anymore. With the RESTRICT_ACTION_TO_SELF protocol feature activated, it should now objectively // fail because testapi@additional permission is not unilaterally satisfied by testapi@eosio.code. dtt_action dtt_act3; - dtt_act3.deferred_account = N(testapi).to_uint64_t(); - dtt_act3.permission_name = N(additional).to_uint64_t(); + dtt_act3.deferred_account = "testapi"_n.to_uint64_t(); + dtt_act3.permission_name = "additional"_n.to_uint64_t(); push_action(config::system_account_name, linkauth::get_name(), name("testapi"), fc::mutable_variant_object() ("account", "testapi") ("code", name(dtt_act3.deferred_account)) @@ -1553,7 +1555,7 @@ BOOST_FIXTURE_TEST_CASE(deferred_transaction_tests, TESTER) { try { // If we make testapi account to be priviledged account: // - the deferred transaction will work no matter who is the payer // - the deferred transaction will not care about the delay of the authorization - push_action(config::system_account_name, N(setpriv), config::system_account_name, mutable_variant_object() + push_action(config::system_account_name, "setpriv"_n, config::system_account_name, mutable_variant_object() ("account", "testapi") ("is_priv", 1)); CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_tx_with_dtt_action", fc::raw::pack(dtt_act1)); @@ -1593,7 +1595,7 @@ BOOST_AUTO_TEST_CASE(more_deferred_transaction_tests) { try { BOOST_REQUIRE_EQUAL(0, index.size()); - chain.push_action( contract_account, N(delayedcall), test_account, fc::mutable_variant_object() + chain.push_action( contract_account, "delayedcall"_n, test_account, fc::mutable_variant_object() ("payer", test_account) ("sender_id", 0) ("contract", contract_account) @@ -1607,7 +1609,7 @@ BOOST_AUTO_TEST_CASE(more_deferred_transaction_tests) { try { signed_transaction trx; trx.actions.emplace_back( - chain.get_action( contract_account, N(delayedcall), + chain.get_action( contract_account, "delayedcall"_n, vector{{test_account, config::active_name}}, fc::mutable_variant_object() ("payer", test_account) @@ -1619,7 +1621,7 @@ BOOST_AUTO_TEST_CASE(more_deferred_transaction_tests) { try { ) ); trx.actions.emplace_back( - chain.get_action( contract_account, N(delayedcall), + chain.get_action( contract_account, "delayedcall"_n, vector{{test_account, config::active_name}}, fc::mutable_variant_object() ("payer", test_account) @@ -1631,7 +1633,7 @@ BOOST_AUTO_TEST_CASE(more_deferred_transaction_tests) { try { ) ); trx.actions.emplace_back( - chain.get_action( contract_account, N(fail), + chain.get_action( contract_account, "fail"_n, vector{}, fc::mutable_variant_object() ) @@ -1649,7 +1651,7 @@ BOOST_AUTO_TEST_CASE(more_deferred_transaction_tests) { try { chain.produce_blocks(2); - chain.push_action( contract_account, N(delayedcall), test_account, fc::mutable_variant_object() + chain.push_action( contract_account, "delayedcall"_n, test_account, fc::mutable_variant_object() ("payer", test_account) ("sender_id", 1) ("contract", contract_account) @@ -1658,7 +1660,7 @@ BOOST_AUTO_TEST_CASE(more_deferred_transaction_tests) { try { ("replace_existing", false) ); - chain.push_action( contract_account, N(delayedcall), test_account, fc::mutable_variant_object() + chain.push_action( contract_account, "delayedcall"_n, test_account, fc::mutable_variant_object() ("payer", test_account) ("sender_id", 2) ("contract", contract_account) @@ -1671,7 +1673,7 @@ BOOST_AUTO_TEST_CASE(more_deferred_transaction_tests) { try { print_deferred(); BOOST_REQUIRE_THROW( - chain.push_action( contract_account, N(delayedcall), test_account, fc::mutable_variant_object() + chain.push_action( contract_account, "delayedcall"_n, test_account, fc::mutable_variant_object() ("payer", test_account) ("sender_id", 2) ("contract", contract_account) @@ -1687,7 +1689,7 @@ BOOST_AUTO_TEST_CASE(more_deferred_transaction_tests) { try { signed_transaction trx2; trx2.actions.emplace_back( - chain.get_action( contract_account, N(delayedcall), + chain.get_action( contract_account, "delayedcall"_n, vector{{test_account, config::active_name}}, fc::mutable_variant_object() ("payer", test_account) @@ -1699,7 +1701,7 @@ BOOST_AUTO_TEST_CASE(more_deferred_transaction_tests) { try { ) ); trx2.actions.emplace_back( - chain.get_action( contract_account, N(delayedcall), + chain.get_action( contract_account, "delayedcall"_n, vector{{test_account, config::active_name}}, fc::mutable_variant_object() ("payer", test_account) @@ -1711,7 +1713,7 @@ BOOST_AUTO_TEST_CASE(more_deferred_transaction_tests) { try { ) ); trx2.actions.emplace_back( - chain.get_action( contract_account, N(delayedcall), + chain.get_action( contract_account, "delayedcall"_n, vector{{test_account, config::active_name}}, fc::mutable_variant_object() ("payer", test_account) @@ -1723,7 +1725,7 @@ BOOST_AUTO_TEST_CASE(more_deferred_transaction_tests) { try { ) ); trx2.actions.emplace_back( - chain.get_action( contract_account, N(fail), + chain.get_action( contract_account, "fail"_n, vector{}, fc::mutable_variant_object() ) @@ -1742,52 +1744,41 @@ BOOST_AUTO_TEST_CASE(more_deferred_transaction_tests) { try { BOOST_REQUIRE_EQUAL( chain.validate(), true ); } FC_LOG_AND_RETHROW() } -template -struct setprod_act { - static account_name get_account() { - return N(config::system_account_name); - } - - static action_name get_name() { - return action_name(NAME); - } -}; - /************************************************************************************* * chain_tests test case *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(chain_tests, TESTER) { try { produce_blocks(2); - create_account( N(testapi) ); - - vector producers = { N(inita), - N(initb), - N(initc), - N(initd), - N(inite), - N(initf), - N(initg), - N(inith), - N(initi), - N(initj), - N(initk), - N(initl), - N(initm), - N(initn), - N(inito), - N(initp), - N(initq), - N(initr), - N(inits), - N(initt), - N(initu) + create_account( "testapi"_n ); + + vector producers = { "inita"_n, + "initb"_n, + "initc"_n, + "initd"_n, + "inite"_n, + "initf"_n, + "initg"_n, + "inith"_n, + "initi"_n, + "initj"_n, + "initk"_n, + "initl"_n, + "initm"_n, + "initn"_n, + "inito"_n, + "initp"_n, + "initq"_n, + "initr"_n, + "inits"_n, + "initt"_n, + "initu"_n }; create_accounts( producers ); set_producers (producers ); - set_code( N(testapi), contracts::test_api_wasm() ); + set_code( "testapi"_n, contracts::test_api_wasm() ); produce_blocks(100); vector prods( control->active_producers().producers.size() ); @@ -1816,15 +1807,15 @@ static const char get_active_producers1_wast[] = R"=====( BOOST_FIXTURE_TEST_CASE(get_producers1_tests, TESTER) { try { produce_blocks(2); - create_account( N(getprods) ); - set_code( N(getprods), get_active_producers1_wast ); + create_account( "getprods"_n ); + set_code( "getprods"_n, get_active_producers1_wast ); produce_block(); for(int i = 0; i < 100; ++i) { signed_transaction trx; - trx.actions.push_back({ { { N(getprods), config::active_name } }, N(getprods), N(), bytes() }); + trx.actions.push_back({ { { "getprods"_n, config::active_name } }, "getprods"_n, ""_n, bytes() }); set_transaction_headers(trx); - trx.sign(get_private_key(N(getprods), "active"), control->get_chain_id()); + trx.sign(get_private_key("getprods"_n, "active"), control->get_chain_id()); BOOST_CHECK_THROW(push_transaction(trx), wasm_exception); produce_block(); } @@ -1856,14 +1847,14 @@ static const char get_active_producers2_wast[] = R"=====( BOOST_FIXTURE_TEST_CASE(get_active_producers2, TESTER) { produce_block(); - create_account( N(getprods) ); - set_code( N(getprods), get_active_producers2_wast ); + create_account( "getprods"_n ); + set_code( "getprods"_n, get_active_producers2_wast ); produce_block(); signed_transaction trx; - trx.actions.push_back({ { { N(getprods), config::active_name } }, N(getprods), N(), bytes() }); + trx.actions.push_back({ { { "getprods"_n, config::active_name } }, "getprods"_n, ""_n, bytes() }); set_transaction_headers(trx); - trx.sign(get_private_key(N(getprods), "active"), control->get_chain_id()); + trx.sign(get_private_key("getprods"_n, "active"), control->get_chain_id()); push_transaction(trx); produce_block(); } @@ -1882,15 +1873,15 @@ static const char get_active_producers3_wast[] = R"=====( BOOST_FIXTURE_TEST_CASE(get_active_producers3, TESTER) { produce_block(); - create_account( N(getprods) ); - set_code( N(getprods), get_active_producers3_wast ); + create_account( "getprods"_n ); + set_code( "getprods"_n, get_active_producers3_wast ); produce_block(); auto pushit = [&](int offset) { signed_transaction trx; - trx.actions.push_back({ { { N(getprods), config::active_name } }, N(getprods), name(offset), bytes() }); + trx.actions.push_back({ { { "getprods"_n, config::active_name } }, "getprods"_n, name(offset), bytes() }); set_transaction_headers(trx); - trx.sign(get_private_key(N(getprods), "active"), control->get_chain_id()); + trx.sign(get_private_key("getprods"_n, "active"), control->get_chain_id()); push_transaction(trx); produce_block(); }; @@ -1919,17 +1910,17 @@ static const char memalign_noleak_wast[] = R"=====( BOOST_FIXTURE_TEST_CASE(memalign_noleak_tests, TESTER) { try { produce_blocks(2); - create_account( N(noleak) ); - set_code( N(noleak), memalign_noleak_wast ); + create_account( "noleak"_n ); + set_code( "noleak"_n, memalign_noleak_wast ); produce_block(); // This will leak ~33 GiB if there's a memory leak, which should be // enough to be noticeable. for(int i = 0; i < 1000; ++i) { signed_transaction trx; - trx.actions.push_back({ { { N(noleak), config::active_name } }, N(noleak), N(), bytes() }); + trx.actions.push_back({ { { "noleak"_n, config::active_name } }, "noleak"_n, ""_n, bytes() }); set_transaction_headers(trx); - trx.sign(get_private_key(N(noleak), "active"), control->get_chain_id()); + trx.sign(get_private_key("noleak"_n, "active"), control->get_chain_id()); BOOST_CHECK_THROW(push_transaction(trx), wasm_exception); produce_block(); } @@ -1942,32 +1933,32 @@ BOOST_FIXTURE_TEST_CASE(memalign_noleak_tests, TESTER) { try { *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(db_tests, TESTER) { try { produce_blocks(2); - create_account( N(testapi) ); - create_account( N(testapi2) ); + create_account( "testapi"_n ); + create_account( "testapi2"_n ); produce_blocks(10); - set_code( N(testapi), contracts::test_api_db_wasm() ); - set_abi( N(testapi), contracts::test_api_db_abi().data() ); - set_code( N(testapi2), contracts::test_api_db_wasm() ); - set_abi( N(testapi2), contracts::test_api_db_abi().data() ); + set_code( "testapi"_n, contracts::test_api_db_wasm() ); + set_abi( "testapi"_n, contracts::test_api_db_abi().data() ); + set_code( "testapi2"_n, contracts::test_api_db_wasm() ); + set_abi( "testapi2"_n, contracts::test_api_db_abi().data() ); produce_blocks(1); - push_action( N(testapi), N(pg), N(testapi), mutable_variant_object() ); // primary_i64_general - push_action( N(testapi), N(pl), N(testapi), mutable_variant_object() ); // primary_i64_lowerbound - push_action( N(testapi), N(pu), N(testapi), mutable_variant_object() ); // primary_i64_upperbound - push_action( N(testapi), N(s1g), N(testapi), mutable_variant_object() ); // idx64_general - push_action( N(testapi), N(s1l), N(testapi), mutable_variant_object() ); // idx64_lowerbound - push_action( N(testapi), N(s1u), N(testapi), mutable_variant_object() ); // idx64_upperbound + push_action( "testapi"_n, "pg"_n, "testapi"_n, mutable_variant_object() ); // primary_i64_general + push_action( "testapi"_n, "pl"_n, "testapi"_n, mutable_variant_object() ); // primary_i64_lowerbound + push_action( "testapi"_n, "pu"_n, "testapi"_n, mutable_variant_object() ); // primary_i64_upperbound + push_action( "testapi"_n, "s1g"_n, "testapi"_n, mutable_variant_object() ); // idx64_general + push_action( "testapi"_n, "s1l"_n, "testapi"_n, mutable_variant_object() ); // idx64_lowerbound + push_action( "testapi"_n, "s1u"_n, "testapi"_n, mutable_variant_object() ); // idx64_upperbound // Store value in primary table - push_action( N(testapi), N(tia), N(testapi), mutable_variant_object() // test_invalid_access + push_action( "testapi"_n, "tia"_n, "testapi"_n, mutable_variant_object() // test_invalid_access ("code", "testapi") ("val", 10) ("index", 0) ("store", true) ); - // Attempt to change the value stored in the primary table under the code of N(testapi) - BOOST_CHECK_EXCEPTION( push_action( N(testapi2), N(tia), N(testapi2), mutable_variant_object() + // Attempt to change the value stored in the primary table under the code of "testapi"_n + BOOST_CHECK_EXCEPTION( push_action( "testapi2"_n, "tia"_n, "testapi2"_n, mutable_variant_object() ("code", "testapi") ("val", "20") ("index", 0) @@ -1977,7 +1968,7 @@ BOOST_FIXTURE_TEST_CASE(db_tests, TESTER) { try { ); // Verify that the value has not changed. - push_action( N(testapi), N(tia), N(testapi), mutable_variant_object() + push_action( "testapi"_n, "tia"_n, "testapi"_n, mutable_variant_object() ("code", "testapi") ("val", 10) ("index", 0) @@ -1985,15 +1976,15 @@ BOOST_FIXTURE_TEST_CASE(db_tests, TESTER) { try { ); // Store value in secondary table - push_action( N(testapi), N(tia), N(testapi), mutable_variant_object() // test_invalid_access + push_action( "testapi"_n, "tia"_n, "testapi"_n, mutable_variant_object() // test_invalid_access ("code", "testapi") ("val", 10) ("index", 1) ("store", true) ); - // Attempt to change the value stored in the secondary table under the code of N(testapi) - BOOST_CHECK_EXCEPTION( push_action( N(testapi2), N(tia), N(testapi2), mutable_variant_object() + // Attempt to change the value stored in the secondary table under the code of "testapi"_n + BOOST_CHECK_EXCEPTION( push_action( "testapi2"_n, "tia"_n, "testapi2"_n, mutable_variant_object() ("code", "testapi") ("val", "20") ("index", 1) @@ -2003,7 +1994,7 @@ BOOST_FIXTURE_TEST_CASE(db_tests, TESTER) { try { ); // Verify that the value has not changed. - push_action( N(testapi), N(tia), N(testapi), mutable_variant_object() + push_action( "testapi"_n, "tia"_n, "testapi"_n, mutable_variant_object() ("code", "testapi") ("val", 10) ("index", 1) @@ -2011,44 +2002,44 @@ BOOST_FIXTURE_TEST_CASE(db_tests, TESTER) { try { ); // idx_double_nan_create_fail - BOOST_CHECK_EXCEPTION( push_action( N(testapi), N(sdnancreate), N(testapi), mutable_variant_object() ), + BOOST_CHECK_EXCEPTION( push_action( "testapi"_n, "sdnancreate"_n, "testapi"_n, mutable_variant_object() ), transaction_exception, fc_exception_message_is("NaN is not an allowed value for a secondary key") ); // idx_double_nan_modify_fail - BOOST_CHECK_EXCEPTION( push_action( N(testapi), N(sdnanmodify), N(testapi), mutable_variant_object() ), + BOOST_CHECK_EXCEPTION( push_action( "testapi"_n, "sdnanmodify"_n, "testapi"_n, mutable_variant_object() ), transaction_exception, fc_exception_message_is("NaN is not an allowed value for a secondary key") ); // idx_double_nan_lookup_fail - BOOST_CHECK_EXCEPTION( push_action( N(testapi), N(sdnanlookup), N(testapi), mutable_variant_object() + BOOST_CHECK_EXCEPTION( push_action( "testapi"_n, "sdnanlookup"_n, "testapi"_n, mutable_variant_object() ("lookup_type", 0) // 0 for find ), transaction_exception, fc_exception_message_is("NaN is not an allowed value for a secondary key") ); - BOOST_CHECK_EXCEPTION( push_action( N(testapi), N(sdnanlookup), N(testapi), mutable_variant_object() + BOOST_CHECK_EXCEPTION( push_action( "testapi"_n, "sdnanlookup"_n, "testapi"_n, mutable_variant_object() ("lookup_type", 1) // 1 for lower bound ), transaction_exception, fc_exception_message_is("NaN is not an allowed value for a secondary key") ); - BOOST_CHECK_EXCEPTION( push_action( N(testapi), N(sdnanlookup), N(testapi), mutable_variant_object() + BOOST_CHECK_EXCEPTION( push_action( "testapi"_n, "sdnanlookup"_n, "testapi"_n, mutable_variant_object() ("lookup_type", 2) // 2 for upper bound ), transaction_exception, fc_exception_message_is("NaN is not an allowed value for a secondary key") ); - push_action( N(testapi), N(sk32align), N(testapi), mutable_variant_object() ); // misaligned_secondary_key256_tests + push_action( "testapi"_n, "sk32align"_n, "testapi"_n, mutable_variant_object() ); // misaligned_secondary_key256_tests BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } // The multi_index iterator cache is preserved across notifications for the same action. BOOST_FIXTURE_TEST_CASE(db_notify_tests, TESTER) { - create_accounts( { N(notifier), N(notified) } ); + create_accounts( { "notifier"_n, "notified"_n } ); const char notifier[] = R"=====( (module (func $db_store_i64 (import "env" "db_store_i64") (param i64 i64 i64 i64 i32 i32) (result i32)) @@ -2092,10 +2083,10 @@ BOOST_FIXTURE_TEST_CASE(db_notify_tests, TESTER) { (data (i32.const 160) "notifier: idx_long_double") ) )====="; - set_code( N(notifier), notifier ); - set_code( N(notified), notifier ); + set_code( "notifier"_n, notifier ); + set_code( "notified"_n, notifier ); - BOOST_TEST_REQUIRE(push_action( action({}, N(notifier), name(), {}), N(notifier).to_uint64_t() ) == ""); + BOOST_TEST_REQUIRE(push_action( action({}, "notifier"_n, name(), {}), "notifier"_n.to_uint64_t() ) == ""); } /************************************************************************************* @@ -2103,53 +2094,53 @@ BOOST_FIXTURE_TEST_CASE(db_notify_tests, TESTER) { *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(multi_index_tests, TESTER) { try { produce_blocks(1); - create_account( N(testapi) ); + create_account( "testapi"_n ); produce_blocks(1); - set_code( N(testapi), contracts::test_api_multi_index_wasm() ); - set_abi( N(testapi), contracts::test_api_multi_index_abi().data() ); + set_code( "testapi"_n, contracts::test_api_multi_index_wasm() ); + set_abi( "testapi"_n, contracts::test_api_multi_index_abi().data() ); produce_blocks(1); auto check_failure = [this]( action_name a, const char* expected_error_msg ) { - BOOST_CHECK_EXCEPTION( push_action( N(testapi), a, N(testapi), {} ), + BOOST_CHECK_EXCEPTION( push_action( "testapi"_n, a, "testapi"_n, {} ), eosio_assert_message_exception, eosio_assert_message_is( expected_error_msg ) ); }; - push_action( N(testapi), N(s1g), N(testapi), {} ); // idx64_general - push_action( N(testapi), N(s1store), N(testapi), {} ); // idx64_store_only - push_action( N(testapi), N(s1check), N(testapi), {} ); // idx64_check_without_storing - push_action( N(testapi), N(s2g), N(testapi), {} ); // idx128_general - push_action( N(testapi), N(s2store), N(testapi), {} ); // idx128_store_only - push_action( N(testapi), N(s2check), N(testapi), {} ); // idx128_check_without_storing - push_action( N(testapi), N(s2autoinc), N(testapi), {} ); // idx128_autoincrement_test - push_action( N(testapi), N(s2autoinc1), N(testapi), {} ); // idx128_autoincrement_test_part1 - push_action( N(testapi), N(s2autoinc2), N(testapi), {} ); // idx128_autoincrement_test_part2 - push_action( N(testapi), N(s3g), N(testapi), {} ); // idx256_general - push_action( N(testapi), N(sdg), N(testapi), {} ); // idx_double_general - push_action( N(testapi), N(sldg), N(testapi), {} ); // idx_long_double_general - - check_failure( N(s1pkend), "cannot increment end iterator" ); // idx64_pk_iterator_exceed_end - check_failure( N(s1skend), "cannot increment end iterator" ); // idx64_sk_iterator_exceed_end - check_failure( N(s1pkbegin), "cannot decrement iterator at beginning of table" ); // idx64_pk_iterator_exceed_begin - check_failure( N(s1skbegin), "cannot decrement iterator at beginning of index" ); // idx64_sk_iterator_exceed_begin - check_failure( N(s1pkref), "object passed to iterator_to is not in multi_index" ); // idx64_pass_pk_ref_to_other_table - check_failure( N(s1skref), "object passed to iterator_to is not in multi_index" ); // idx64_pass_sk_ref_to_other_table - check_failure( N(s1pkitrto), "object passed to iterator_to is not in multi_index" ); // idx64_pass_pk_end_itr_to_iterator_to - check_failure( N(s1pkmodify), "cannot pass end iterator to modify" ); // idx64_pass_pk_end_itr_to_modify - check_failure( N(s1pkerase), "cannot pass end iterator to erase" ); // idx64_pass_pk_end_itr_to_erase - check_failure( N(s1skitrto), "object passed to iterator_to is not in multi_index" ); // idx64_pass_sk_end_itr_to_iterator_to - check_failure( N(s1skmodify), "cannot pass end iterator to modify" ); // idx64_pass_sk_end_itr_to_modify - check_failure( N(s1skerase), "cannot pass end iterator to erase" ); // idx64_pass_sk_end_itr_to_erase - check_failure( N(s1modpk), "updater cannot change primary key when modifying an object" ); // idx64_modify_primary_key - check_failure( N(s1exhaustpk), "next primary key in table is at autoincrement limit" ); // idx64_run_out_of_avl_pk - check_failure( N(s1findfail1), "unable to find key" ); // idx64_require_find_fail - check_failure( N(s1findfail2), "unable to find primary key in require_find" );// idx64_require_find_fail_with_msg - check_failure( N(s1findfail3), "unable to find secondary key" ); // idx64_require_find_sk_fail - check_failure( N(s1findfail4), "unable to find sec key" ); // idx64_require_find_sk_fail_with_msg - - push_action( N(testapi), N(s1skcache), N(testapi), {} ); // idx64_sk_cache_pk_lookup - push_action( N(testapi), N(s1pkcache), N(testapi), {} ); // idx64_pk_cache_sk_lookup + push_action( "testapi"_n, "s1g"_n, "testapi"_n, {} ); // idx64_general + push_action( "testapi"_n, "s1store"_n, "testapi"_n, {} ); // idx64_store_only + push_action( "testapi"_n, "s1check"_n, "testapi"_n, {} ); // idx64_check_without_storing + push_action( "testapi"_n, "s2g"_n, "testapi"_n, {} ); // idx128_general + push_action( "testapi"_n, "s2store"_n, "testapi"_n, {} ); // idx128_store_only + push_action( "testapi"_n, "s2check"_n, "testapi"_n, {} ); // idx128_check_without_storing + push_action( "testapi"_n, "s2autoinc"_n, "testapi"_n, {} ); // idx128_autoincrement_test + push_action( "testapi"_n, "s2autoinc1"_n, "testapi"_n, {} ); // idx128_autoincrement_test_part1 + push_action( "testapi"_n, "s2autoinc2"_n, "testapi"_n, {} ); // idx128_autoincrement_test_part2 + push_action( "testapi"_n, "s3g"_n, "testapi"_n, {} ); // idx256_general + push_action( "testapi"_n, "sdg"_n, "testapi"_n, {} ); // idx_double_general + push_action( "testapi"_n, "sldg"_n, "testapi"_n, {} ); // idx_long_double_general + + check_failure( "s1pkend"_n, "cannot increment end iterator" ); // idx64_pk_iterator_exceed_end + check_failure( "s1skend"_n, "cannot increment end iterator" ); // idx64_sk_iterator_exceed_end + check_failure( "s1pkbegin"_n, "cannot decrement iterator at beginning of table" ); // idx64_pk_iterator_exceed_begin + check_failure( "s1skbegin"_n, "cannot decrement iterator at beginning of index" ); // idx64_sk_iterator_exceed_begin + check_failure( "s1pkref"_n, "object passed to iterator_to is not in multi_index" ); // idx64_pass_pk_ref_to_other_table + check_failure( "s1skref"_n, "object passed to iterator_to is not in multi_index" ); // idx64_pass_sk_ref_to_other_table + check_failure( "s1pkitrto"_n, "object passed to iterator_to is not in multi_index" ); // idx64_pass_pk_end_itr_to_iterator_to + check_failure( "s1pkmodify"_n, "cannot pass end iterator to modify" ); // idx64_pass_pk_end_itr_to_modify + check_failure( "s1pkerase"_n, "cannot pass end iterator to erase" ); // idx64_pass_pk_end_itr_to_erase + check_failure( "s1skitrto"_n, "object passed to iterator_to is not in multi_index" ); // idx64_pass_sk_end_itr_to_iterator_to + check_failure( "s1skmodify"_n, "cannot pass end iterator to modify" ); // idx64_pass_sk_end_itr_to_modify + check_failure( "s1skerase"_n, "cannot pass end iterator to erase" ); // idx64_pass_sk_end_itr_to_erase + check_failure( "s1modpk"_n, "updater cannot change primary key when modifying an object" ); // idx64_modify_primary_key + check_failure( "s1exhaustpk"_n, "next primary key in table is at autoincrement limit" ); // idx64_run_out_of_avl_pk + check_failure( "s1findfail1"_n, "unable to find key" ); // idx64_require_find_fail + check_failure( "s1findfail2"_n, "unable to find primary key in require_find" );// idx64_require_find_fail_with_msg + check_failure( "s1findfail3"_n, "unable to find secondary key" ); // idx64_require_find_sk_fail + check_failure( "s1findfail4"_n, "unable to find sec key" ); // idx64_require_find_sk_fail_with_msg + + push_action( "testapi"_n, "s1skcache"_n, "testapi"_n, {} ); // idx64_sk_cache_pk_lookup + push_action( "testapi"_n, "s1pkcache"_n, "testapi"_n, {} ); // idx64_pk_cache_sk_lookup BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } @@ -2159,17 +2150,17 @@ BOOST_FIXTURE_TEST_CASE(multi_index_tests, TESTER) { try { *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(crypto_tests, TESTER) { try { produce_block(); - create_account(N(testapi) ); + create_account("testapi"_n ); produce_block(); - set_code(N(testapi), contracts::test_api_wasm() ); + set_code("testapi"_n, contracts::test_api_wasm() ); produce_block(); { signed_transaction trx; - auto pl = vector{{N(testapi), config::active_name}}; + auto pl = vector{{"testapi"_n, config::active_name}}; action act(pl, test_api_action{}); - const auto priv_key = get_private_key(N(testapi), "active" ); + const auto priv_key = get_private_key("testapi"_n, "active" ); const auto pub_key = priv_key.get_public_key(); auto hash = trx.sig_digest( control->get_chain_id() ); auto sig = priv_key.sign(hash); @@ -2195,12 +2186,12 @@ BOOST_FIXTURE_TEST_CASE(crypto_tests, TESTER) { try { { signed_transaction trx; - auto pl = vector{{N(testapi), config::active_name}}; + auto pl = vector{{"testapi"_n, config::active_name}}; action act(pl, test_api_action{}); // construct a mock WebAuthN pubkey and signature, as it is the only type that would be variable-sized - const auto priv_key = get_private_key(N(testapi), "active" ); + const auto priv_key = get_private_key("testapi"_n, "active" ); const auto pub_key = priv_key.get_public_key(); auto hash = trx.sig_digest( control->get_chain_id() ); auto sig = priv_key.sign(hash); @@ -2372,13 +2363,13 @@ static const char memset_pass_wast[] = R"======( BOOST_FIXTURE_TEST_CASE(memory_tests, TESTER) { produce_block(); - create_accounts( { N(memcpy), N(memcpy2), N(memcpy3), N(memmove), N(memcmp), N(memset) } ); - set_code( N(memcpy), memcpy_pass_wast ); - set_code( N(memcpy2), memcpy_overlap_wast ); - set_code( N(memcpy3), memcpy_past_end_wast ); - set_code( N(memmove), memmove_pass_wast ); - set_code( N(memcmp), memcmp_pass_wast ); - set_code( N(memset), memset_pass_wast ); + create_accounts( { "memcpy"_n, "memcpy2"_n, "memcpy3"_n, "memmove"_n, "memcmp"_n, "memset"_n } ); + set_code( "memcpy"_n, memcpy_pass_wast ); + set_code( "memcpy2"_n, memcpy_overlap_wast ); + set_code( "memcpy3"_n, memcpy_past_end_wast ); + set_code( "memmove"_n, memmove_pass_wast ); + set_code( "memcmp"_n, memcmp_pass_wast ); + set_code( "memset"_n, memset_pass_wast ); auto pushit = [&](name acct, name act) { signed_transaction trx; trx.actions.push_back({ { {acct, config::active_name} }, acct, act, bytes()}); @@ -2386,18 +2377,18 @@ BOOST_FIXTURE_TEST_CASE(memory_tests, TESTER) { trx.sign(get_private_key(acct, "active"), control->get_chain_id()); push_transaction(trx); }; - pushit(N(memcpy), name()); - pushit(N(memcpy2), name(0)); - pushit(N(memcpy2), name(8)); - BOOST_CHECK_THROW(pushit(N(memcpy2), name(12)), overlapping_memory_error); - BOOST_CHECK_THROW(pushit(N(memcpy2), name(16)), overlapping_memory_error); - BOOST_CHECK_THROW(pushit(N(memcpy2), name(20)), overlapping_memory_error); - BOOST_CHECK_THROW(pushit(N(memcpy3), name()), wasm_execution_error); - pushit(N(memcpy2), name(24)); - - pushit(N(memmove), name()); - pushit(N(memcmp), name()); - pushit(N(memset), name()); + pushit("memcpy"_n, name()); + pushit("memcpy2"_n, name(0)); + pushit("memcpy2"_n, name(8)); + BOOST_CHECK_THROW(pushit("memcpy2"_n, name(12)), overlapping_memory_error); + BOOST_CHECK_THROW(pushit("memcpy2"_n, name(16)), overlapping_memory_error); + BOOST_CHECK_THROW(pushit("memcpy2"_n, name(20)), overlapping_memory_error); + BOOST_CHECK_THROW(pushit("memcpy3"_n, name()), wasm_execution_error); + pushit("memcpy2"_n, name(24)); + + pushit("memmove"_n, name()); + pushit("memcmp"_n, name()); + pushit("memset"_n, name()); } /************************************************************************************* @@ -2405,10 +2396,10 @@ BOOST_FIXTURE_TEST_CASE(memory_tests, TESTER) { *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(print_tests, TESTER) { try { produce_blocks(2); - create_account(N(testapi) ); + create_account("testapi"_n ); produce_blocks(1000); - set_code(N(testapi), contracts::test_api_wasm() ); + set_code("testapi"_n, contracts::test_api_wasm() ); produce_blocks(1000); string captured = ""; @@ -2531,10 +2522,10 @@ BOOST_FIXTURE_TEST_CASE(print_tests, TESTER) { try { *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(types_tests, TESTER) { try { produce_blocks(1000); - create_account( N(testapi) ); + create_account( "testapi"_n ); produce_blocks(1000); - set_code( N(testapi), contracts::test_api_wasm() ); + set_code( "testapi"_n, contracts::test_api_wasm() ); produce_blocks(1000); CALL_TEST_FUNCTION( *this, "test_types", "types_size", {}); @@ -2549,15 +2540,15 @@ BOOST_FIXTURE_TEST_CASE(types_tests, TESTER) { try { *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(permission_tests, TESTER) { try { produce_blocks(1); - create_account( N(testapi) ); + create_account( "testapi"_n ); produce_blocks(1); - set_code( N(testapi), contracts::test_api_wasm() ); + set_code( "testapi"_n, contracts::test_api_wasm() ); produce_blocks(1); auto get_result_int64 = [&]() -> int64_t { const auto& db = control->db(); - const auto* t_id = db.find(boost::make_tuple(N(testapi), N(testapi), N(testapi))); + const auto* t_id = db.find(boost::make_tuple("testapi"_n, "testapi"_n, "testapi"_n)); FC_ASSERT(t_id != 0, "Table id not found"); @@ -2572,10 +2563,10 @@ BOOST_FIXTURE_TEST_CASE(permission_tests, TESTER) { try { CALL_TEST_FUNCTION( *this, "test_permission", "check_authorization", fc::raw::pack( check_auth { - .account = N(testapi), - .permission = N(active), + .account = "testapi"_n, + .permission = "active"_n, .pubkeys = { - get_public_key(N(testapi), "active") + get_public_key("testapi"_n, "active") } }) ); @@ -2583,8 +2574,8 @@ BOOST_FIXTURE_TEST_CASE(permission_tests, TESTER) { try { CALL_TEST_FUNCTION( *this, "test_permission", "check_authorization", fc::raw::pack( check_auth { - .account = N(testapi), - .permission = N(active), + .account = "testapi"_n, + .permission = "active"_n, .pubkeys = { public_key_type(string("EOS7GfRtyDWWgxV88a5TRaYY59XmHptyfjsFmHHfioGNJtPjpSmGX")) } @@ -2594,10 +2585,10 @@ BOOST_FIXTURE_TEST_CASE(permission_tests, TESTER) { try { CALL_TEST_FUNCTION( *this, "test_permission", "check_authorization", fc::raw::pack( check_auth { - .account = N(testapi), - .permission = N(active), + .account = "testapi"_n, + .permission = "active"_n, .pubkeys = { - get_public_key(N(testapi), "active"), + get_public_key("testapi"_n, "active"), public_key_type(string("EOS7GfRtyDWWgxV88a5TRaYY59XmHptyfjsFmHHfioGNJtPjpSmGX")) } }) @@ -2606,10 +2597,10 @@ BOOST_FIXTURE_TEST_CASE(permission_tests, TESTER) { try { CALL_TEST_FUNCTION( *this, "test_permission", "check_authorization", fc::raw::pack( check_auth { - .account = N(noname), - .permission = N(active), + .account = "noname"_n, + .permission = "active"_n, .pubkeys = { - get_public_key(N(testapi), "active") + get_public_key("testapi"_n, "active") } }) ); @@ -2617,8 +2608,8 @@ BOOST_FIXTURE_TEST_CASE(permission_tests, TESTER) { try { CALL_TEST_FUNCTION( *this, "test_permission", "check_authorization", fc::raw::pack( check_auth { - .account = N(testapi), - .permission = N(active), + .account = "testapi"_n, + .permission = "active"_n, .pubkeys = {} }) ); @@ -2626,10 +2617,10 @@ BOOST_FIXTURE_TEST_CASE(permission_tests, TESTER) { try { CALL_TEST_FUNCTION( *this, "test_permission", "check_authorization", fc::raw::pack( check_auth { - .account = N(testapi), - .permission = N(noname), + .account = "testapi"_n, + .permission = "noname"_n, .pubkeys = { - get_public_key(N(testapi), "active") + get_public_key("testapi"_n, "active") } }) ); @@ -2705,28 +2696,28 @@ static const char get_resource_limits_null_cpu_wast[] = R"=====( )====="; BOOST_FIXTURE_TEST_CASE(resource_limits_tests, TESTER) { - create_accounts( { N(rlimits), N(testacnt) } ); - set_code(N(rlimits), resource_limits_wast); - push_action( N(eosio), N(setpriv), N(eosio), mutable_variant_object()("account", N(rlimits))("is_priv", 1)); + create_accounts( { "rlimits"_n, "testacnt"_n } ); + set_code("rlimits"_n, resource_limits_wast); + push_action( "eosio"_n, "setpriv"_n, "eosio"_n, mutable_variant_object()("account", "rlimits"_n)("is_priv", 1)); produce_block(); auto pushit = [&]{ signed_transaction trx; - trx.actions.push_back({ { { N(rlimits), config::active_name } }, N(rlimits), N(testacnt), bytes{}}); + trx.actions.push_back({ { { "rlimits"_n, config::active_name } }, "rlimits"_n, "testacnt"_n, bytes{}}); set_transaction_headers(trx); - trx.sign(get_private_key( N(rlimits), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "rlimits"_n, "active" ), control->get_chain_id()); push_transaction(trx); }; pushit(); produce_block(); - set_code(N(rlimits), get_resource_limits_null_ram_wast); + set_code("rlimits"_n, get_resource_limits_null_ram_wast); BOOST_CHECK_THROW(pushit(), wasm_exception); - set_code(N(rlimits), get_resource_limits_null_net_wast); + set_code("rlimits"_n, get_resource_limits_null_net_wast); BOOST_CHECK_THROW(pushit(), wasm_exception); - set_code(N(rlimits), get_resource_limits_null_cpu_wast); + set_code("rlimits"_n, get_resource_limits_null_cpu_wast); BOOST_CHECK_THROW(pushit(), wasm_exception); } @@ -2740,12 +2731,12 @@ static const char is_privileged_wast[] = R"======( )======"; BOOST_FIXTURE_TEST_CASE(is_privileged, TESTER) { - create_accounts( {N(priv), N(unpriv), N(a)} ); - push_action(config::system_account_name, N(setpriv), config::system_account_name, mutable_variant_object() + create_accounts( {"priv"_n, "unpriv"_n, "a"_n} ); + push_action(config::system_account_name, "setpriv"_n, config::system_account_name, mutable_variant_object() ("account", "priv") ("is_priv", 1)); - set_code( N(priv), is_privileged_wast ); - set_code( N(unpriv), is_privileged_wast ); + set_code( "priv"_n, is_privileged_wast ); + set_code( "unpriv"_n, is_privileged_wast ); auto pushit = [&](name account, name action) { signed_transaction trx; trx.actions.push_back({ { { account, config::active_name } }, account, action, bytes() }); @@ -2753,10 +2744,10 @@ BOOST_FIXTURE_TEST_CASE(is_privileged, TESTER) { trx.sign(get_private_key( account, "active" ), control->get_chain_id()); push_transaction(trx); }; - pushit(N(priv), N(a)); - BOOST_CHECK_EXCEPTION(pushit(N(unpriv), N(a)), chain::unaccessible_api, + pushit("priv"_n, "a"_n); + BOOST_CHECK_EXCEPTION(pushit("unpriv"_n, "a"_n), chain::unaccessible_api, fc_exception_message_is("unpriv does not have permission to call this API")); - BOOST_CHECK_THROW(pushit(N(priv), N(bcd)), fc::exception); + BOOST_CHECK_THROW(pushit("priv"_n, "bcd"_n), fc::exception); } static const char set_privileged1_wast[] = R"======( @@ -2769,12 +2760,12 @@ static const char set_privileged1_wast[] = R"======( )======"; BOOST_FIXTURE_TEST_CASE(set_privileged1, TESTER) { - create_accounts( {N(priv), N(unpriv), N(a)} ); - push_action(config::system_account_name, N(setpriv), config::system_account_name, mutable_variant_object() + create_accounts( {"priv"_n, "unpriv"_n, "a"_n} ); + push_action(config::system_account_name, "setpriv"_n, config::system_account_name, mutable_variant_object() ("account", "priv") ("is_priv", 1)); - set_code( N(priv), set_privileged1_wast ); - set_code( N(unpriv), set_privileged1_wast ); + set_code( "priv"_n, set_privileged1_wast ); + set_code( "unpriv"_n, set_privileged1_wast ); auto pushit = [&](name account, name action) { signed_transaction trx; trx.actions.push_back({ { { account, config::active_name } }, account, action, bytes() }); @@ -2782,10 +2773,10 @@ BOOST_FIXTURE_TEST_CASE(set_privileged1, TESTER) { trx.sign(get_private_key( account, "active" ), control->get_chain_id()); push_transaction(trx); }; - pushit(N(priv), N(a)); - BOOST_CHECK_EXCEPTION(pushit(N(unpriv), N(a)), chain::unaccessible_api, + pushit("priv"_n, "a"_n); + BOOST_CHECK_EXCEPTION(pushit("unpriv"_n, "a"_n), chain::unaccessible_api, fc_exception_message_is("unpriv does not have permission to call this API")); - BOOST_CHECK_THROW(pushit(N(priv), N(bcd)), fc::exception); + BOOST_CHECK_THROW(pushit("priv"_n, "bcd"_n), fc::exception); } // If an account marks itself as unprivileged, it takes effect at the end of the action. @@ -2805,11 +2796,11 @@ static const char set_privileged2_wast[] = R"======( )======"; BOOST_FIXTURE_TEST_CASE(set_privileged2, TESTER) { - create_accounts( {N(priv)} ); - push_action(config::system_account_name, N(setpriv), config::system_account_name, mutable_variant_object() + create_accounts( {"priv"_n} ); + push_action(config::system_account_name, "setpriv"_n, config::system_account_name, mutable_variant_object() ("account", "priv") ("is_priv", 1)); - set_code( N(priv), set_privileged2_wast ); + set_code( "priv"_n, set_privileged2_wast ); auto pushit = [&](name account, name action) { signed_transaction trx; trx.actions.push_back({ { { account, config::active_name } }, account, action, bytes() }); @@ -2817,7 +2808,7 @@ BOOST_FIXTURE_TEST_CASE(set_privileged2, TESTER) { trx.sign(get_private_key( account, "active" ), control->get_chain_id()); push_transaction(trx); }; - pushit(N(priv), N()); + pushit("priv"_n, ""_n); } #if 0 @@ -2826,39 +2817,39 @@ BOOST_FIXTURE_TEST_CASE(set_privileged2, TESTER) { *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(privileged_tests, tester) { try { produce_blocks(2); - create_account( N(testapi) ); - create_account( N(acc1) ); + create_account( "testapi"_n ); + create_account( "acc1"_n ); produce_blocks(100); - set_code( N(testapi), contracts::test_api_wasm() ); + set_code( "testapi"_n, contracts::test_api_wasm() ); produce_blocks(1); { signed_transaction trx; auto pl = vector{{config::system_account_name, config::active_name}}; - action act(pl, test_chain_action()); + action act(pl, test_chain_action<"setprods"_n>()); vector prod_keys = { - { N(inita), get_public_key( N(inita), "active" ) }, - { N(initb), get_public_key( N(initb), "active" ) }, - { N(initc), get_public_key( N(initc), "active" ) }, - { N(initd), get_public_key( N(initd), "active" ) }, - { N(inite), get_public_key( N(inite), "active" ) }, - { N(initf), get_public_key( N(initf), "active" ) }, - { N(initg), get_public_key( N(initg), "active" ) }, - { N(inith), get_public_key( N(inith), "active" ) }, - { N(initi), get_public_key( N(initi), "active" ) }, - { N(initj), get_public_key( N(initj), "active" ) }, - { N(initk), get_public_key( N(initk), "active" ) }, - { N(initl), get_public_key( N(initl), "active" ) }, - { N(initm), get_public_key( N(initm), "active" ) }, - { N(initn), get_public_key( N(initn), "active" ) }, - { N(inito), get_public_key( N(inito), "active" ) }, - { N(initp), get_public_key( N(initp), "active" ) }, - { N(initq), get_public_key( N(initq), "active" ) }, - { N(initr), get_public_key( N(initr), "active" ) }, - { N(inits), get_public_key( N(inits), "active" ) }, - { N(initt), get_public_key( N(initt), "active" ) }, - { N(initu), get_public_key( N(initu), "active" ) } + { "inita"_n, get_public_key( "inita"_n, "active" ) }, + { "initb"_n, get_public_key( "initb"_n, "active" ) }, + { "initc"_n, get_public_key( "initc"_n, "active" ) }, + { "initd"_n, get_public_key( "initd"_n, "active" ) }, + { "inite"_n, get_public_key( "inite"_n, "active" ) }, + { "initf"_n, get_public_key( "initf"_n, "active" ) }, + { "initg"_n, get_public_key( "initg"_n, "active" ) }, + { "inith"_n, get_public_key( "inith"_n, "active" ) }, + { "initi"_n, get_public_key( "initi"_n, "active" ) }, + { "initj"_n, get_public_key( "initj"_n, "active" ) }, + { "initk"_n, get_public_key( "initk"_n, "active" ) }, + { "initl"_n, get_public_key( "initl"_n, "active" ) }, + { "initm"_n, get_public_key( "initm"_n, "active" ) }, + { "initn"_n, get_public_key( "initn"_n, "active" ) }, + { "inito"_n, get_public_key( "inito"_n, "active" ) }, + { "initp"_n, get_public_key( "initp"_n, "active" ) }, + { "initq"_n, get_public_key( "initq"_n, "active" ) }, + { "initr"_n, get_public_key( "initr"_n, "active" ) }, + { "inits"_n, get_public_key( "inits"_n, "active" ) }, + { "initt"_n, get_public_key( "initt"_n, "active" ) }, + { "initu"_n, get_public_key( "initu"_n, "active" ) } }; vector data = fc::raw::pack(uint32_t(0)); vector keys = fc::raw::pack(prod_keys); @@ -2889,9 +2880,9 @@ BOOST_FIXTURE_TEST_CASE(privileged_tests, tester) { try { *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(datastream_tests, TESTER) { try { produce_blocks(1000); - create_account(N(testapi) ); + create_account("testapi"_n ); produce_blocks(1000); - set_code(N(testapi), contracts::test_api_wasm() ); + set_code("testapi"_n, contracts::test_api_wasm() ); produce_blocks(1000); CALL_TEST_FUNCTION( *this, "test_datastream", "test_basic", {} ); @@ -2904,16 +2895,16 @@ BOOST_FIXTURE_TEST_CASE(datastream_tests, TESTER) { try { *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(permission_usage_tests, TESTER) { try { produce_block(); - create_accounts( {N(testapi), N(alice), N(bob)} ); + create_accounts( {"testapi"_n, "alice"_n, "bob"_n} ); produce_block(); - set_code(N(testapi), contracts::test_api_wasm() ); + set_code("testapi"_n, contracts::test_api_wasm() ); produce_block(); - push_reqauth( N(alice), {{N(alice), config::active_name}}, {get_private_key(N(alice), "active")} ); + push_reqauth( "alice"_n, {{"alice"_n, config::active_name}}, {get_private_key("alice"_n, "active")} ); CALL_TEST_FUNCTION( *this, "test_permission", "test_permission_last_used", fc::raw::pack(test_permission_last_used_action{ - N(alice), config::active_name, + "alice"_n, config::active_name, control->pending_block_time() }) ); @@ -2921,16 +2912,16 @@ BOOST_FIXTURE_TEST_CASE(permission_usage_tests, TESTER) { try { // Fails because the last used time is updated after the transaction executes. BOOST_CHECK_THROW( CALL_TEST_FUNCTION( *this, "test_permission", "test_permission_last_used", fc::raw::pack(test_permission_last_used_action{ - N(testapi), config::active_name, + "testapi"_n, config::active_name, control->head_block_time() + fc::milliseconds(config::block_interval_ms) }) ), eosio_assert_message_exception ); produce_blocks(5); - set_authority( N(bob), N(perm1), authority( get_private_key(N(bob), "perm1").get_public_key() ) ); + set_authority( "bob"_n, "perm1"_n, authority( get_private_key("bob"_n, "perm1").get_public_key() ) ); - push_action(config::system_account_name, linkauth::get_name(), N(bob), fc::mutable_variant_object() + push_action(config::system_account_name, linkauth::get_name(), "bob"_n, fc::mutable_variant_object() ("account", "bob") ("code", "eosio") ("type", "reqauth") @@ -2943,34 +2934,34 @@ BOOST_FIXTURE_TEST_CASE(permission_usage_tests, TESTER) { try { CALL_TEST_FUNCTION( *this, "test_permission", "test_permission_last_used", fc::raw::pack(test_permission_last_used_action{ - N(bob), N(perm1), + "bob"_n, "perm1"_n, permission_creation_time }) ); produce_blocks(5); - push_reqauth( N(bob), {{N(bob), N(perm1)}}, {get_private_key(N(bob), "perm1")} ); + push_reqauth( "bob"_n, {{"bob"_n, "perm1"_n}}, {get_private_key("bob"_n, "perm1")} ); auto perm1_last_used_time = control->pending_block_time(); CALL_TEST_FUNCTION( *this, "test_permission", "test_permission_last_used", fc::raw::pack(test_permission_last_used_action{ - N(bob), config::active_name, + "bob"_n, config::active_name, permission_creation_time }) ); BOOST_CHECK_THROW( CALL_TEST_FUNCTION( *this, "test_permission", "test_permission_last_used", fc::raw::pack(test_permission_last_used_action{ - N(bob), N(perm1), + "bob"_n, "perm1"_n, permission_creation_time }) ), eosio_assert_message_exception ); CALL_TEST_FUNCTION( *this, "test_permission", "test_permission_last_used", fc::raw::pack(test_permission_last_used_action{ - N(bob), N(perm1), + "bob"_n, "perm1"_n, perm1_last_used_time }) ); @@ -2985,19 +2976,19 @@ BOOST_FIXTURE_TEST_CASE(permission_usage_tests, TESTER) { try { *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(account_creation_time_tests, TESTER) { try { produce_block(); - create_account( N(testapi) ); + create_account( "testapi"_n ); produce_block(); - set_code(N(testapi), contracts::test_api_wasm() ); + set_code("testapi"_n, contracts::test_api_wasm() ); produce_block(); - create_account( N(alice) ); + create_account( "alice"_n ); auto alice_creation_time = control->pending_block_time(); produce_blocks(10); CALL_TEST_FUNCTION( *this, "test_permission", "test_account_creation_time", fc::raw::pack(test_permission_last_used_action{ - N(alice), config::active_name, + "alice"_n, config::active_name, alice_creation_time }) ); @@ -3047,9 +3038,9 @@ BOOST_FIXTURE_TEST_CASE(extended_symbol_api_tests, TESTER) { try { *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(eosio_assert_code_tests, TESTER) { try { produce_block(); - create_account( N(testapi) ); + create_account( "testapi"_n ); produce_block(); - set_code(N(testapi), contracts::test_api_wasm() ); + set_code("testapi"_n, contracts::test_api_wasm() ); const char* abi_string = R"=====( { @@ -3067,7 +3058,7 @@ BOOST_FIXTURE_TEST_CASE(eosio_assert_code_tests, TESTER) { try { } )====="; - set_abi( N(testapi), abi_string ); + set_abi( "testapi"_n, abi_string ); auto var = fc::json::from_string(abi_string); abi_serializer abis(var.as(), abi_serializer::create_yield_function( abi_serializer_max_time )); @@ -3127,20 +3118,20 @@ BOOST_FIXTURE_TEST_CASE(eosio_assert_code_tests, TESTER) { try { BOOST_FIXTURE_TEST_CASE(action_ordinal_test, TESTER) { try { produce_blocks(1); - create_account(N(testapi) ); - set_code( N(testapi), contracts::test_api_wasm() ); + create_account("testapi"_n ); + set_code( "testapi"_n, contracts::test_api_wasm() ); produce_blocks(1); - create_account(N(bob) ); - set_code( N(bob), contracts::test_api_wasm() ); + create_account("bob"_n ); + set_code( "bob"_n, contracts::test_api_wasm() ); produce_blocks(1); - create_account(N(charlie) ); - set_code( N(charlie), contracts::test_api_wasm() ); + create_account("charlie"_n ); + set_code( "charlie"_n, contracts::test_api_wasm() ); produce_blocks(1); - create_account(N(david) ); - set_code( N(david), contracts::test_api_wasm() ); + create_account("david"_n ); + set_code( "david"_n, contracts::test_api_wasm() ); produce_blocks(1); - create_account(N(erin) ); - set_code( N(erin), contracts::test_api_wasm() ); + create_account("erin"_n ); + set_code( "erin"_n, contracts::test_api_wasm() ); produce_blocks(1); // prove act digest @@ -3174,7 +3165,7 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_test, TESTER) { try { }; transaction_trace_ptr txn_trace = CALL_TEST_FUNCTION_SCOPE( *this, "test_action", "test_action_ordinal1", - {}, vector{ N(testapi)}); + {}, vector{ "testapi"_n}); BOOST_REQUIRE_EQUAL( validate(), true ); @@ -3185,8 +3176,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_test, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[0].action_ordinal, 1); BOOST_REQUIRE_EQUAL((int)atrace[0].creator_action_ordinal, 0); BOOST_REQUIRE_EQUAL((int)atrace[0].closest_unnotified_ancestor_action_ordinal, 0); - BOOST_REQUIRE_EQUAL(atrace[0].receiver, N(testapi)); - BOOST_REQUIRE_EQUAL(atrace[0].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[0].receiver, "testapi"_n); + BOOST_REQUIRE_EQUAL(atrace[0].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[0].act.name, TEST_METHOD("test_action", "test_action_ordinal1")); BOOST_REQUIRE_EQUAL(atrace[0].receipt.has_value(), true); BOOST_REQUIRE_EQUAL(fc::raw::unpack(atrace[0].return_value), unsigned_int(1) ); @@ -3196,8 +3187,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_test, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[1].action_ordinal,2); BOOST_REQUIRE_EQUAL((int)atrace[1].creator_action_ordinal, 1); BOOST_REQUIRE_EQUAL((int)atrace[1].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[1].receiver, N(bob)); - BOOST_REQUIRE_EQUAL(atrace[1].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[1].receiver, "bob"_n); + BOOST_REQUIRE_EQUAL(atrace[1].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[1].act.name, TEST_METHOD("test_action", "test_action_ordinal1")); BOOST_REQUIRE_EQUAL(atrace[1].receipt.has_value(), true); BOOST_REQUIRE_EQUAL(fc::raw::unpack(atrace[1].return_value), "bob" ); @@ -3207,8 +3198,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_test, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[2].action_ordinal, 3); BOOST_REQUIRE_EQUAL((int)atrace[2].creator_action_ordinal, 1); BOOST_REQUIRE_EQUAL((int)atrace[2].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[2].receiver, N(testapi)); - BOOST_REQUIRE_EQUAL(atrace[2].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[2].receiver, "testapi"_n); + BOOST_REQUIRE_EQUAL(atrace[2].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[2].act.name, TEST_METHOD("test_action", "test_action_ordinal2")); BOOST_REQUIRE_EQUAL(atrace[2].receipt.has_value(), true); BOOST_REQUIRE_EQUAL(fc::raw::unpack(atrace[2].return_value), name("five") ); @@ -3218,8 +3209,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_test, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[3].action_ordinal, 4); BOOST_REQUIRE_EQUAL((int)atrace[3].creator_action_ordinal, 1); BOOST_REQUIRE_EQUAL((int)atrace[3].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[3].receiver, N(testapi)); - BOOST_REQUIRE_EQUAL(atrace[3].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[3].receiver, "testapi"_n); + BOOST_REQUIRE_EQUAL(atrace[3].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[3].act.name, TEST_METHOD("test_action", "test_action_ordinal3")); BOOST_REQUIRE_EQUAL(atrace[3].receipt.has_value(), true); BOOST_REQUIRE_EQUAL(fc::raw::unpack(atrace[3].return_value), unsigned_int(9) ); @@ -3229,8 +3220,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_test, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[4].action_ordinal, 5); BOOST_REQUIRE_EQUAL((int)atrace[4].creator_action_ordinal, 1); BOOST_REQUIRE_EQUAL((int)atrace[4].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[4].receiver, N(charlie)); - BOOST_REQUIRE_EQUAL(atrace[4].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[4].receiver, "charlie"_n); + BOOST_REQUIRE_EQUAL(atrace[4].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[4].act.name, TEST_METHOD("test_action", "test_action_ordinal1")); BOOST_REQUIRE_EQUAL(atrace[4].receipt.has_value(), true); BOOST_REQUIRE_EQUAL(fc::raw::unpack(atrace[4].return_value), "charlie" ); @@ -3240,8 +3231,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_test, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[5].action_ordinal, 6); BOOST_REQUIRE_EQUAL((int)atrace[5].creator_action_ordinal, 2); BOOST_REQUIRE_EQUAL((int)atrace[5].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[5].receiver, N(bob)); - BOOST_REQUIRE_EQUAL(atrace[5].act.account, N(bob)); + BOOST_REQUIRE_EQUAL(atrace[5].receiver, "bob"_n); + BOOST_REQUIRE_EQUAL(atrace[5].act.account, "bob"_n); BOOST_REQUIRE_EQUAL(atrace[5].act.name, TEST_METHOD("test_action", "test_action_ordinal_foo")); BOOST_REQUIRE_EQUAL(atrace[5].receipt.has_value(), true); BOOST_REQUIRE_EQUAL(fc::raw::unpack(atrace[5].return_value), 13.23 ); @@ -3251,8 +3242,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_test, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[6].action_ordinal, 7); BOOST_REQUIRE_EQUAL((int)atrace[6].creator_action_ordinal,2); BOOST_REQUIRE_EQUAL((int)atrace[6].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[6].receiver, N(david)); - BOOST_REQUIRE_EQUAL(atrace[6].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[6].receiver, "david"_n); + BOOST_REQUIRE_EQUAL(atrace[6].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[6].act.name, TEST_METHOD("test_action", "test_action_ordinal1")); BOOST_REQUIRE_EQUAL(atrace[6].receipt.has_value(), true); BOOST_REQUIRE_EQUAL(fc::raw::unpack(atrace[6].return_value), "david" ); @@ -3262,8 +3253,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_test, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[7].action_ordinal, 8); BOOST_REQUIRE_EQUAL((int)atrace[7].creator_action_ordinal, 5); BOOST_REQUIRE_EQUAL((int)atrace[7].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[7].receiver, N(charlie)); - BOOST_REQUIRE_EQUAL(atrace[7].act.account, N(charlie)); + BOOST_REQUIRE_EQUAL(atrace[7].receiver, "charlie"_n); + BOOST_REQUIRE_EQUAL(atrace[7].act.account, "charlie"_n); BOOST_REQUIRE_EQUAL(atrace[7].act.name, TEST_METHOD("test_action", "test_action_ordinal_bar")); BOOST_REQUIRE_EQUAL(atrace[7].receipt.has_value(), true); BOOST_REQUIRE_EQUAL(fc::raw::unpack(atrace[7].return_value), 11.42f ); @@ -3273,8 +3264,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_test, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[8].action_ordinal, 9); BOOST_REQUIRE_EQUAL((int)atrace[8].creator_action_ordinal, 3); BOOST_REQUIRE_EQUAL((int)atrace[8].closest_unnotified_ancestor_action_ordinal, 3); - BOOST_REQUIRE_EQUAL(atrace[8].receiver, N(david)); - BOOST_REQUIRE_EQUAL(atrace[8].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[8].receiver, "david"_n); + BOOST_REQUIRE_EQUAL(atrace[8].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[8].act.name, TEST_METHOD("test_action", "test_action_ordinal2")); BOOST_REQUIRE_EQUAL(atrace[8].receipt.has_value(), true); BOOST_REQUIRE_EQUAL(fc::raw::unpack(atrace[8].return_value), true ); @@ -3284,8 +3275,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_test, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[9].action_ordinal, 10); BOOST_REQUIRE_EQUAL((int)atrace[9].creator_action_ordinal, 3); BOOST_REQUIRE_EQUAL((int)atrace[9].closest_unnotified_ancestor_action_ordinal, 3); - BOOST_REQUIRE_EQUAL(atrace[9].receiver, N(erin)); - BOOST_REQUIRE_EQUAL(atrace[9].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[9].receiver, "erin"_n); + BOOST_REQUIRE_EQUAL(atrace[9].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[9].act.name, TEST_METHOD("test_action", "test_action_ordinal2")); BOOST_REQUIRE_EQUAL(atrace[9].receipt.has_value(), true); BOOST_REQUIRE_EQUAL(fc::raw::unpack(atrace[9].return_value), signed_int(7) ); @@ -3295,8 +3286,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_test, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[10].action_ordinal, 11); BOOST_REQUIRE_EQUAL((int)atrace[10].creator_action_ordinal, 3); BOOST_REQUIRE_EQUAL((int)atrace[10].closest_unnotified_ancestor_action_ordinal, 3); - BOOST_REQUIRE_EQUAL(atrace[10].receiver, N(testapi)); - BOOST_REQUIRE_EQUAL(atrace[10].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[10].receiver, "testapi"_n); + BOOST_REQUIRE_EQUAL(atrace[10].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[10].act.name, TEST_METHOD("test_action", "test_action_ordinal4")); BOOST_REQUIRE_EQUAL(atrace[10].receipt.has_value(), true); BOOST_REQUIRE_EQUAL(atrace[10].return_value.size(), 0 ); @@ -3310,23 +3301,23 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_test, TESTER) { try { BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest1, TESTER) { try { produce_blocks(1); - create_account(N(testapi) ); - set_code( N(testapi), contracts::test_api_wasm() ); + create_account("testapi"_n ); + set_code( "testapi"_n, contracts::test_api_wasm() ); produce_blocks(1); - create_account(N(bob) ); - set_code( N(bob), contracts::test_api_wasm() ); + create_account("bob"_n ); + set_code( "bob"_n, contracts::test_api_wasm() ); produce_blocks(1); - create_account(N(charlie) ); - set_code( N(charlie), contracts::test_api_wasm() ); + create_account("charlie"_n ); + set_code( "charlie"_n, contracts::test_api_wasm() ); produce_blocks(1); - create_account(N(david) ); - set_code( N(david), contracts::test_api_wasm() ); + create_account("david"_n ); + set_code( "david"_n, contracts::test_api_wasm() ); produce_blocks(1); - create_account(N(erin) ); - set_code( N(erin), contracts::test_api_wasm() ); + create_account("erin"_n ); + set_code( "erin"_n, contracts::test_api_wasm() ); produce_blocks(1); - create_account(N(fail1) ); // <- make first action fails in the middle + create_account("fail1"_n ); // <- make first action fails in the middle produce_blocks(1); transaction_trace_ptr txn_trace = @@ -3343,8 +3334,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest1, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[0].action_ordinal, 1); BOOST_REQUIRE_EQUAL((int)atrace[0].creator_action_ordinal, 0); BOOST_REQUIRE_EQUAL((int)atrace[0].closest_unnotified_ancestor_action_ordinal, 0); - BOOST_REQUIRE_EQUAL(atrace[0].receiver, N(testapi)); - BOOST_REQUIRE_EQUAL(atrace[0].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[0].receiver, "testapi"_n); + BOOST_REQUIRE_EQUAL(atrace[0].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[0].act.name, TEST_METHOD("test_action", "test_action_ordinal1")); BOOST_REQUIRE_EQUAL(atrace[0].receipt.has_value(), false); BOOST_REQUIRE_EQUAL(atrace[0].except.has_value(), true); @@ -3354,8 +3345,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest1, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[1].action_ordinal, 2); BOOST_REQUIRE_EQUAL((int)atrace[1].creator_action_ordinal, 1); BOOST_REQUIRE_EQUAL((int)atrace[1].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[1].receiver, N(bob)); - BOOST_REQUIRE_EQUAL(atrace[1].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[1].receiver, "bob"_n); + BOOST_REQUIRE_EQUAL(atrace[1].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[1].act.name, TEST_METHOD("test_action", "test_action_ordinal1")); BOOST_REQUIRE_EQUAL(atrace[1].receipt.has_value(), false); BOOST_REQUIRE_EQUAL(atrace[1].except.has_value(), false); @@ -3364,8 +3355,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest1, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[2].action_ordinal, 3); BOOST_REQUIRE_EQUAL((int)atrace[2].creator_action_ordinal, 1); BOOST_REQUIRE_EQUAL((int)atrace[2].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[2].receiver, N(testapi)); - BOOST_REQUIRE_EQUAL(atrace[2].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[2].receiver, "testapi"_n); + BOOST_REQUIRE_EQUAL(atrace[2].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[2].act.name, TEST_METHOD("test_action", "test_action_ordinal2")); BOOST_REQUIRE_EQUAL(atrace[2].receipt.has_value(), false); BOOST_REQUIRE_EQUAL(atrace[2].except.has_value(), false); @@ -3378,23 +3369,23 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest1, TESTER) { try { BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest2, TESTER) { try { produce_blocks(1); - create_account(N(testapi) ); - set_code( N(testapi), contracts::test_api_wasm() ); + create_account("testapi"_n ); + set_code( "testapi"_n, contracts::test_api_wasm() ); produce_blocks(1); - create_account(N(bob) ); - set_code( N(bob), contracts::test_api_wasm() ); + create_account("bob"_n ); + set_code( "bob"_n, contracts::test_api_wasm() ); produce_blocks(1); - create_account(N(charlie) ); - set_code( N(charlie), contracts::test_api_wasm() ); + create_account("charlie"_n ); + set_code( "charlie"_n, contracts::test_api_wasm() ); produce_blocks(1); - create_account(N(david) ); - set_code( N(david), contracts::test_api_wasm() ); + create_account("david"_n ); + set_code( "david"_n, contracts::test_api_wasm() ); produce_blocks(1); - create_account(N(erin) ); - set_code( N(erin), contracts::test_api_wasm() ); + create_account("erin"_n ); + set_code( "erin"_n, contracts::test_api_wasm() ); produce_blocks(1); - create_account(N(fail3) ); // <- make action 3 fails in the middle + create_account("fail3"_n ); // <- make action 3 fails in the middle produce_blocks(1); transaction_trace_ptr txn_trace = @@ -3411,8 +3402,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest2, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[0].action_ordinal, 1); BOOST_REQUIRE_EQUAL((int)atrace[0].creator_action_ordinal, 0); BOOST_REQUIRE_EQUAL((int)atrace[0].closest_unnotified_ancestor_action_ordinal, 0); - BOOST_REQUIRE_EQUAL(atrace[0].receiver, N(testapi)); - BOOST_REQUIRE_EQUAL(atrace[0].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[0].receiver, "testapi"_n); + BOOST_REQUIRE_EQUAL(atrace[0].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[0].act.name, TEST_METHOD("test_action", "test_action_ordinal1")); BOOST_REQUIRE_EQUAL(atrace[0].receipt.has_value(), true); BOOST_REQUIRE_EQUAL(fc::raw::unpack(atrace[0].return_value), unsigned_int(1) ); @@ -3423,8 +3414,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest2, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[1].action_ordinal,2); BOOST_REQUIRE_EQUAL((int)atrace[1].creator_action_ordinal, 1); BOOST_REQUIRE_EQUAL((int)atrace[1].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[1].receiver, N(bob)); - BOOST_REQUIRE_EQUAL(atrace[1].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[1].receiver, "bob"_n); + BOOST_REQUIRE_EQUAL(atrace[1].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[1].act.name, TEST_METHOD("test_action", "test_action_ordinal1")); BOOST_REQUIRE_EQUAL(atrace[1].receipt.has_value(), true); BOOST_REQUIRE_EQUAL(fc::raw::unpack(atrace[1].return_value), "bob" ); @@ -3434,8 +3425,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest2, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[2].action_ordinal, 3); BOOST_REQUIRE_EQUAL((int)atrace[2].creator_action_ordinal, 1); BOOST_REQUIRE_EQUAL((int)atrace[2].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[2].receiver, N(testapi)); - BOOST_REQUIRE_EQUAL(atrace[2].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[2].receiver, "testapi"_n); + BOOST_REQUIRE_EQUAL(atrace[2].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[2].act.name, TEST_METHOD("test_action", "test_action_ordinal2")); BOOST_REQUIRE_EQUAL(atrace[2].receipt.has_value(), false); BOOST_REQUIRE_EQUAL(atrace[2].except.has_value(), false); @@ -3444,8 +3435,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest2, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[3].action_ordinal, 4); BOOST_REQUIRE_EQUAL((int)atrace[3].creator_action_ordinal, 1); BOOST_REQUIRE_EQUAL((int)atrace[3].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[3].receiver, N(testapi)); - BOOST_REQUIRE_EQUAL(atrace[3].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[3].receiver, "testapi"_n); + BOOST_REQUIRE_EQUAL(atrace[3].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[3].act.name, TEST_METHOD("test_action", "test_action_ordinal3")); BOOST_REQUIRE_EQUAL(atrace[3].receipt.has_value(), false); BOOST_REQUIRE_EQUAL(atrace[3].except.has_value(), false); @@ -3454,8 +3445,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest2, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[4].action_ordinal, 5); BOOST_REQUIRE_EQUAL((int)atrace[4].creator_action_ordinal, 1); BOOST_REQUIRE_EQUAL((int)atrace[4].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[4].receiver, N(charlie)); - BOOST_REQUIRE_EQUAL(atrace[4].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[4].receiver, "charlie"_n); + BOOST_REQUIRE_EQUAL(atrace[4].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[4].act.name, TEST_METHOD("test_action", "test_action_ordinal1")); BOOST_REQUIRE_EQUAL(atrace[4].receipt.has_value(), false); BOOST_REQUIRE_EQUAL(atrace[4].except.has_value(), true); @@ -3465,8 +3456,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest2, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[5].action_ordinal, 6); BOOST_REQUIRE_EQUAL((int)atrace[5].creator_action_ordinal, 2); BOOST_REQUIRE_EQUAL((int)atrace[5].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[5].receiver, N(bob)); - BOOST_REQUIRE_EQUAL(atrace[5].act.account, N(bob)); + BOOST_REQUIRE_EQUAL(atrace[5].receiver, "bob"_n); + BOOST_REQUIRE_EQUAL(atrace[5].act.account, "bob"_n); BOOST_REQUIRE_EQUAL(atrace[5].act.name, TEST_METHOD("test_action", "test_action_ordinal_foo")); BOOST_REQUIRE_EQUAL(atrace[5].receipt.has_value(), false); BOOST_REQUIRE_EQUAL(atrace[5].except.has_value(), false); @@ -3475,8 +3466,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest2, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[6].action_ordinal, 7); BOOST_REQUIRE_EQUAL((int)atrace[6].creator_action_ordinal,2); BOOST_REQUIRE_EQUAL((int)atrace[6].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[6].receiver, N(david)); - BOOST_REQUIRE_EQUAL(atrace[6].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[6].receiver, "david"_n); + BOOST_REQUIRE_EQUAL(atrace[6].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[6].act.name, TEST_METHOD("test_action", "test_action_ordinal1")); BOOST_REQUIRE_EQUAL(atrace[6].receipt.has_value(), false); BOOST_REQUIRE_EQUAL(atrace[6].except.has_value(), false); @@ -3485,8 +3476,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest2, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[7].action_ordinal, 8); BOOST_REQUIRE_EQUAL((int)atrace[7].creator_action_ordinal, 5); BOOST_REQUIRE_EQUAL((int)atrace[7].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[7].receiver, N(charlie)); - BOOST_REQUIRE_EQUAL(atrace[7].act.account, N(charlie)); + BOOST_REQUIRE_EQUAL(atrace[7].receiver, "charlie"_n); + BOOST_REQUIRE_EQUAL(atrace[7].act.account, "charlie"_n); BOOST_REQUIRE_EQUAL(atrace[7].act.name, TEST_METHOD("test_action", "test_action_ordinal_bar")); BOOST_REQUIRE_EQUAL(atrace[7].receipt.has_value(), false); BOOST_REQUIRE_EQUAL(atrace[7].except.has_value(), false); @@ -3499,23 +3490,23 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest2, TESTER) { try { BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest3, TESTER) { try { produce_blocks(1); - create_account(N(testapi) ); - set_code( N(testapi), contracts::test_api_wasm() ); + create_account("testapi"_n ); + set_code( "testapi"_n, contracts::test_api_wasm() ); produce_blocks(1); - create_account(N(bob) ); - set_code( N(bob), contracts::test_api_wasm() ); + create_account("bob"_n ); + set_code( "bob"_n, contracts::test_api_wasm() ); produce_blocks(1); - create_account(N(charlie) ); - set_code( N(charlie), contracts::test_api_wasm() ); + create_account("charlie"_n ); + set_code( "charlie"_n, contracts::test_api_wasm() ); produce_blocks(1); - create_account(N(david) ); - set_code( N(david), contracts::test_api_wasm() ); + create_account("david"_n ); + set_code( "david"_n, contracts::test_api_wasm() ); produce_blocks(1); - create_account(N(erin) ); - set_code( N(erin), contracts::test_api_wasm() ); + create_account("erin"_n ); + set_code( "erin"_n, contracts::test_api_wasm() ); produce_blocks(1); - create_account(N(failnine) ); // <- make action 9 fails in the middle + create_account("failnine"_n ); // <- make action 9 fails in the middle produce_blocks(1); transaction_trace_ptr txn_trace = @@ -3532,8 +3523,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest3, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[0].action_ordinal, 1); BOOST_REQUIRE_EQUAL((int)atrace[0].creator_action_ordinal, 0); BOOST_REQUIRE_EQUAL((int)atrace[0].closest_unnotified_ancestor_action_ordinal, 0); - BOOST_REQUIRE_EQUAL(atrace[0].receiver, N(testapi)); - BOOST_REQUIRE_EQUAL(atrace[0].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[0].receiver, "testapi"_n); + BOOST_REQUIRE_EQUAL(atrace[0].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[0].act.name, TEST_METHOD("test_action", "test_action_ordinal1")); BOOST_REQUIRE_EQUAL(atrace[0].receipt.has_value(), true); BOOST_REQUIRE_EQUAL(fc::raw::unpack(atrace[0].return_value), unsigned_int(1) ); @@ -3544,8 +3535,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest3, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[1].action_ordinal,2); BOOST_REQUIRE_EQUAL((int)atrace[1].creator_action_ordinal, 1); BOOST_REQUIRE_EQUAL((int)atrace[1].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[1].receiver, N(bob)); - BOOST_REQUIRE_EQUAL(atrace[1].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[1].receiver, "bob"_n); + BOOST_REQUIRE_EQUAL(atrace[1].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[1].act.name, TEST_METHOD("test_action", "test_action_ordinal1")); BOOST_REQUIRE_EQUAL(atrace[1].receipt.has_value(), true); BOOST_REQUIRE_EQUAL(fc::raw::unpack(atrace[1].return_value), "bob" ); @@ -3555,8 +3546,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest3, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[2].action_ordinal, 3); BOOST_REQUIRE_EQUAL((int)atrace[2].creator_action_ordinal, 1); BOOST_REQUIRE_EQUAL((int)atrace[2].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[2].receiver, N(testapi)); - BOOST_REQUIRE_EQUAL(atrace[2].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[2].receiver, "testapi"_n); + BOOST_REQUIRE_EQUAL(atrace[2].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[2].act.name, TEST_METHOD("test_action", "test_action_ordinal2")); BOOST_REQUIRE_EQUAL(atrace[2].receipt.has_value(), true); BOOST_REQUIRE_EQUAL(fc::raw::unpack(atrace[2].return_value), name("five") ); @@ -3566,8 +3557,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest3, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[3].action_ordinal, 4); BOOST_REQUIRE_EQUAL((int)atrace[3].creator_action_ordinal, 1); BOOST_REQUIRE_EQUAL((int)atrace[3].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[3].receiver, N(testapi)); - BOOST_REQUIRE_EQUAL(atrace[3].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[3].receiver, "testapi"_n); + BOOST_REQUIRE_EQUAL(atrace[3].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[3].act.name, TEST_METHOD("test_action", "test_action_ordinal3")); BOOST_REQUIRE_EQUAL(atrace[3].receipt.has_value(), false); BOOST_REQUIRE_EQUAL(atrace[3].except.has_value(), true); @@ -3577,8 +3568,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest3, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[4].action_ordinal, 5); BOOST_REQUIRE_EQUAL((int)atrace[4].creator_action_ordinal, 1); BOOST_REQUIRE_EQUAL((int)atrace[4].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[4].receiver, N(charlie)); - BOOST_REQUIRE_EQUAL(atrace[4].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[4].receiver, "charlie"_n); + BOOST_REQUIRE_EQUAL(atrace[4].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[4].act.name, TEST_METHOD("test_action", "test_action_ordinal1")); BOOST_REQUIRE_EQUAL(atrace[4].receipt.has_value(), true); BOOST_REQUIRE_EQUAL(fc::raw::unpack(atrace[4].return_value), "charlie" ); @@ -3588,8 +3579,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest3, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[5].action_ordinal, 6); BOOST_REQUIRE_EQUAL((int)atrace[5].creator_action_ordinal, 2); BOOST_REQUIRE_EQUAL((int)atrace[5].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[5].receiver, N(bob)); - BOOST_REQUIRE_EQUAL(atrace[5].act.account, N(bob)); + BOOST_REQUIRE_EQUAL(atrace[5].receiver, "bob"_n); + BOOST_REQUIRE_EQUAL(atrace[5].act.account, "bob"_n); BOOST_REQUIRE_EQUAL(atrace[5].act.name, TEST_METHOD("test_action", "test_action_ordinal_foo")); BOOST_REQUIRE_EQUAL(atrace[5].receipt.has_value(), false); BOOST_REQUIRE_EQUAL(atrace[5].except.has_value(), false); @@ -3598,8 +3589,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest3, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[6].action_ordinal, 7); BOOST_REQUIRE_EQUAL((int)atrace[6].creator_action_ordinal,2); BOOST_REQUIRE_EQUAL((int)atrace[6].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[6].receiver, N(david)); - BOOST_REQUIRE_EQUAL(atrace[6].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[6].receiver, "david"_n); + BOOST_REQUIRE_EQUAL(atrace[6].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[6].act.name, TEST_METHOD("test_action", "test_action_ordinal1")); BOOST_REQUIRE_EQUAL(atrace[6].receipt.has_value(), true); BOOST_REQUIRE_EQUAL(fc::raw::unpack(atrace[6].return_value), "david" ); @@ -3609,8 +3600,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest3, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[7].action_ordinal, 8); BOOST_REQUIRE_EQUAL((int)atrace[7].creator_action_ordinal, 5); BOOST_REQUIRE_EQUAL((int)atrace[7].closest_unnotified_ancestor_action_ordinal, 1); - BOOST_REQUIRE_EQUAL(atrace[7].receiver, N(charlie)); - BOOST_REQUIRE_EQUAL(atrace[7].act.account, N(charlie)); + BOOST_REQUIRE_EQUAL(atrace[7].receiver, "charlie"_n); + BOOST_REQUIRE_EQUAL(atrace[7].act.account, "charlie"_n); BOOST_REQUIRE_EQUAL(atrace[7].act.name, TEST_METHOD("test_action", "test_action_ordinal_bar")); BOOST_REQUIRE_EQUAL(atrace[7].receipt.has_value(), false); BOOST_REQUIRE_EQUAL(atrace[7].except.has_value(), false); @@ -3619,8 +3610,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest3, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[8].action_ordinal, 9); BOOST_REQUIRE_EQUAL((int)atrace[8].creator_action_ordinal, 3); BOOST_REQUIRE_EQUAL((int)atrace[8].closest_unnotified_ancestor_action_ordinal, 3); - BOOST_REQUIRE_EQUAL(atrace[8].receiver, N(david)); - BOOST_REQUIRE_EQUAL(atrace[8].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[8].receiver, "david"_n); + BOOST_REQUIRE_EQUAL(atrace[8].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[8].act.name, TEST_METHOD("test_action", "test_action_ordinal2")); BOOST_REQUIRE_EQUAL(atrace[8].receipt.has_value(), true); BOOST_REQUIRE_EQUAL(fc::raw::unpack(atrace[8].return_value), true ); @@ -3630,8 +3621,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest3, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[9].action_ordinal, 10); BOOST_REQUIRE_EQUAL((int)atrace[9].creator_action_ordinal, 3); BOOST_REQUIRE_EQUAL((int)atrace[9].closest_unnotified_ancestor_action_ordinal, 3); - BOOST_REQUIRE_EQUAL(atrace[9].receiver, N(erin)); - BOOST_REQUIRE_EQUAL(atrace[9].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[9].receiver, "erin"_n); + BOOST_REQUIRE_EQUAL(atrace[9].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[9].act.name, TEST_METHOD("test_action", "test_action_ordinal2")); BOOST_REQUIRE_EQUAL(atrace[9].receipt.has_value(), true); BOOST_REQUIRE_EQUAL(fc::raw::unpack(atrace[9].return_value), signed_int(7) ); @@ -3641,8 +3632,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest3, TESTER) { try { BOOST_REQUIRE_EQUAL((int)atrace[10].action_ordinal, 11); BOOST_REQUIRE_EQUAL((int)atrace[10].creator_action_ordinal, 3); BOOST_REQUIRE_EQUAL((int)atrace[10].closest_unnotified_ancestor_action_ordinal, 3); - BOOST_REQUIRE_EQUAL(atrace[10].receiver, N(testapi)); - BOOST_REQUIRE_EQUAL(atrace[10].act.account, N(testapi)); + BOOST_REQUIRE_EQUAL(atrace[10].receiver, "testapi"_n); + BOOST_REQUIRE_EQUAL(atrace[10].act.account, "testapi"_n); BOOST_REQUIRE_EQUAL(atrace[10].act.name, TEST_METHOD("test_action", "test_action_ordinal4")); BOOST_REQUIRE_EQUAL(atrace[10].receipt.has_value(), true); BOOST_REQUIRE_EQUAL(atrace[10].return_value.size(), 0 ); @@ -3652,8 +3643,8 @@ BOOST_FIXTURE_TEST_CASE(action_ordinal_failtest3, TESTER) { try { BOOST_FIXTURE_TEST_CASE(action_results_tests, TESTER) { try { produce_blocks(2); - create_account( N(test) ); - set_code( N(test), contracts::action_results_wasm() ); + create_account( "test"_n ); + set_code( "test"_n, contracts::action_results_wasm() ); produce_blocks(1); auto call_autoresret_and_check = [&]( account_name contract, account_name signer, action_name action, auto&& checker ) { @@ -3665,7 +3656,7 @@ BOOST_FIXTURE_TEST_CASE(action_results_tests, TESTER) { try { checker( res ); }; - call_autoresret_and_check( N(test), N(test), N(actionresret), [&]( const transaction_trace_ptr& res ) { + call_autoresret_and_check( "test"_n, "test"_n, "actionresret"_n, [&]( const transaction_trace_ptr& res ) { BOOST_CHECK_EQUAL( res->receipt->status, transaction_receipt::executed ); auto &atrace = res->action_traces; @@ -3676,7 +3667,7 @@ BOOST_FIXTURE_TEST_CASE(action_results_tests, TESTER) { try { produce_blocks(1); - call_autoresret_and_check( N(test), N(test), N(retlim), [&]( const transaction_trace_ptr& res ) { + call_autoresret_and_check( "test"_n, "test"_n, "retlim"_n, [&]( const transaction_trace_ptr& res ) { BOOST_CHECK_EQUAL( res->receipt->status, transaction_receipt::executed ); auto &atrace = res->action_traces; @@ -3692,17 +3683,17 @@ BOOST_FIXTURE_TEST_CASE(action_results_tests, TESTER) { try { } ); produce_blocks(1); - BOOST_REQUIRE_THROW(call_autoresret_and_check( N(test), N(test), N(retoverlim), [&]( auto res ) {}), + BOOST_REQUIRE_THROW(call_autoresret_and_check( "test"_n, "test"_n, "retoverlim"_n, [&]( auto res ) {}), action_return_value_exception); produce_blocks(1); - BOOST_REQUIRE_THROW(call_autoresret_and_check( N(test), N(test), N(ret1overlim), [&]( auto res ) {}), + BOOST_REQUIRE_THROW(call_autoresret_and_check( "test"_n, "test"_n, "ret1overlim"_n, [&]( auto res ) {}), action_return_value_exception); produce_blocks(1); set_code( config::system_account_name, contracts::action_results_wasm() ); produce_blocks(1); call_autoresret_and_check( config::system_account_name, config::system_account_name, - N(retmaxlim), + "retmaxlim"_n, [&]( const transaction_trace_ptr& res ) { BOOST_CHECK_EQUAL( res->receipt->status, transaction_receipt::executed ); @@ -3719,7 +3710,7 @@ BOOST_FIXTURE_TEST_CASE(action_results_tests, TESTER) { try { produce_blocks(1); BOOST_REQUIRE_THROW(call_autoresret_and_check( config::system_account_name, config::system_account_name, - N(setliminv), + "setliminv"_n, [&]( auto res ) {}), action_validate_exception); diff --git a/unittests/auth_tests.cpp b/unittests/auth_tests.cpp index 5c2361bc04a..eca28859acf 100644 --- a/unittests/auth_tests.cpp +++ b/unittests/auth_tests.cpp @@ -21,11 +21,11 @@ using namespace eosio::testing; BOOST_AUTO_TEST_SUITE(auth_tests) BOOST_FIXTURE_TEST_CASE( missing_sigs, TESTER ) { try { - create_accounts( {N(alice)} ); + create_accounts( {"alice"_n} ); produce_block(); - BOOST_REQUIRE_THROW( push_reqauth( N(alice), {permission_level{N(alice), config::active_name}}, {} ), unsatisfied_authorization ); - auto trace = push_reqauth(N(alice), "owner"); + BOOST_REQUIRE_THROW( push_reqauth( "alice"_n, {permission_level{"alice"_n, config::active_name}}, {} ), unsatisfied_authorization ); + auto trace = push_reqauth("alice"_n, "owner"); produce_block(); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trace->id)); @@ -34,11 +34,11 @@ BOOST_FIXTURE_TEST_CASE( missing_sigs, TESTER ) { try { BOOST_FIXTURE_TEST_CASE( missing_multi_sigs, TESTER ) { try { produce_block(); - create_account(N(alice), config::system_account_name, true); + create_account("alice"_n, config::system_account_name, true); produce_block(); - BOOST_REQUIRE_THROW(push_reqauth(N(alice), "owner"), unsatisfied_authorization); // without multisig - auto trace = push_reqauth(N(alice), "owner", true); // with multisig + BOOST_REQUIRE_THROW(push_reqauth("alice"_n, "owner"), unsatisfied_authorization); // without multisig + auto trace = push_reqauth("alice"_n, "owner", true); // with multisig produce_block(); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trace->id)); @@ -46,11 +46,11 @@ BOOST_FIXTURE_TEST_CASE( missing_multi_sigs, TESTER ) { try { } FC_LOG_AND_RETHROW() } /// missing_multi_sigs BOOST_FIXTURE_TEST_CASE( missing_auths, TESTER ) { try { - create_accounts( {N(alice), N(bob)} ); + create_accounts( {"alice"_n, "bob"_n} ); produce_block(); /// action not provided from authority - BOOST_REQUIRE_THROW( push_reqauth( N(alice), {permission_level{N(bob), config::active_name}}, { get_private_key(N(bob), "active") } ), missing_auth_exception); + BOOST_REQUIRE_THROW( push_reqauth( "alice"_n, {permission_level{"bob"_n, config::active_name}}, { get_private_key("bob"_n, "active") } ), missing_auth_exception); } FC_LOG_AND_RETHROW() } /// transfer_test @@ -59,32 +59,32 @@ BOOST_FIXTURE_TEST_CASE( missing_auths, TESTER ) { try { * of another account by updating the active authority. */ BOOST_FIXTURE_TEST_CASE( delegate_auth, TESTER ) { try { - create_accounts( {N(alice),N(bob)}); + create_accounts( {"alice"_n,"bob"_n}); produce_block(); auto delegated_auth = authority( 1, {}, { - { .permission = {N(bob),config::active_name}, .weight = 1} + { .permission = {"bob"_n,config::active_name}, .weight = 1} }); - auto original_auth = static_cast(control->get_authorization_manager().get_permission({N(alice), config::active_name}).auth); + auto original_auth = static_cast(control->get_authorization_manager().get_permission({"alice"_n, config::active_name}).auth); wdump((original_auth)); - set_authority( N(alice), config::active_name, delegated_auth ); + set_authority( "alice"_n, config::active_name, delegated_auth ); - auto new_auth = static_cast(control->get_authorization_manager().get_permission({N(alice), config::active_name}).auth); + auto new_auth = static_cast(control->get_authorization_manager().get_permission({"alice"_n, config::active_name}).auth); wdump((new_auth)); BOOST_CHECK_EQUAL((new_auth == delegated_auth), true); produce_block(); produce_block(); - auto auth = static_cast(control->get_authorization_manager().get_permission({N(alice), config::active_name}).auth); + auto auth = static_cast(control->get_authorization_manager().get_permission({"alice"_n, config::active_name}).auth); wdump((auth)); BOOST_CHECK_EQUAL((new_auth == auth), true); /// execute nonce from alice signed by bob - auto trace = push_reqauth(N(alice), {permission_level{N(alice), config::active_name}}, { get_private_key(N(bob), "active") } ); + auto trace = push_reqauth("alice"_n, {permission_level{"alice"_n, config::active_name}}, { get_private_key("bob"_n, "active") } ); produce_block(); //todoBOOST_REQUIRE_EQUAL(true, chain_has_transaction(trace->id)); @@ -239,11 +239,11 @@ BOOST_AUTO_TEST_CASE(link_auths) { try { chain.set_authority(name("alice"), name("scud"), scud_pub_key, name("spending")); // Send req auth action with alice's spending key, it should fail - BOOST_CHECK_THROW(chain.push_reqauth(name("alice"), { permission_level{N(alice), name("spending")} }, { spending_priv_key }), irrelevant_auth_exception); + BOOST_CHECK_THROW(chain.push_reqauth(name("alice"), { permission_level{"alice"_n, name("spending")} }, { spending_priv_key }), irrelevant_auth_exception); // Link authority for eosio reqauth action with alice's spending key chain.link_authority(name("alice"), name("eosio"), name("spending"), name("reqauth")); // Now, req auth action with alice's spending key should succeed - chain.push_reqauth(name("alice"), { permission_level{N(alice), name("spending")} }, { spending_priv_key }); + chain.push_reqauth(name("alice"), { permission_level{"alice"_n, name("spending")} }, { spending_priv_key }); chain.produce_block(); @@ -253,18 +253,18 @@ BOOST_AUTO_TEST_CASE(link_auths) { try { // Unlink alice with eosio reqauth chain.unlink_authority(name("alice"), name("eosio"), name("reqauth")); // Now, req auth action with alice's spending key should fail - BOOST_CHECK_THROW(chain.push_reqauth(name("alice"), { permission_level{N(alice), name("spending")} }, { spending_priv_key }), irrelevant_auth_exception); + BOOST_CHECK_THROW(chain.push_reqauth(name("alice"), { permission_level{"alice"_n, name("spending")} }, { spending_priv_key }), irrelevant_auth_exception); chain.produce_block(); // Send req auth action with scud key, it should fail - BOOST_CHECK_THROW(chain.push_reqauth(name("alice"), { permission_level{N(alice), name("scud")} }, { scud_priv_key }), irrelevant_auth_exception); + BOOST_CHECK_THROW(chain.push_reqauth(name("alice"), { permission_level{"alice"_n, name("scud")} }, { scud_priv_key }), irrelevant_auth_exception); // Link authority for any eosio action with alice's scud key chain.link_authority(name("alice"), name("eosio"), name("scud")); // Now, req auth action with alice's scud key should succeed - chain.push_reqauth(name("alice"), { permission_level{N(alice), name("scud")} }, { scud_priv_key }); + chain.push_reqauth(name("alice"), { permission_level{"alice"_n, name("scud")} }, { scud_priv_key }); // req auth action with alice's spending key should also be fine, since it is the parent of alice's scud key - chain.push_reqauth(name("alice"), { permission_level{N(alice), name("spending")} }, { spending_priv_key }); + chain.push_reqauth(name("alice"), { permission_level{"alice"_n, name("spending")} }, { spending_priv_key }); } FC_LOG_AND_RETHROW() } @@ -281,16 +281,16 @@ BOOST_AUTO_TEST_CASE(link_then_update_auth) { try { chain.set_authority(name("alice"), name("first"), first_pub_key, name("active")); chain.link_authority(name("alice"), name("eosio"), name("first"), name("reqauth")); - chain.push_reqauth(name("alice"), { permission_level{N(alice), name("first")} }, { first_priv_key }); + chain.push_reqauth(name("alice"), { permission_level{"alice"_n, name("first")} }, { first_priv_key }); chain.produce_blocks(13); // Wait at least 6 seconds for first push_reqauth transaction to expire. // Update "first" auth public key chain.set_authority(name("alice"), name("first"), second_pub_key, name("active")); // Authority updated, using previous "first" auth should fail on linked auth - BOOST_CHECK_THROW(chain.push_reqauth(name("alice"), { permission_level{N(alice), name("first")} }, { first_priv_key }), unsatisfied_authorization); + BOOST_CHECK_THROW(chain.push_reqauth(name("alice"), { permission_level{"alice"_n, name("first")} }, { first_priv_key }), unsatisfied_authorization); // Using updated authority, should succeed - chain.push_reqauth(name("alice"), { permission_level{N(alice), name("first")} }, { second_priv_key }); + chain.push_reqauth(name("alice"), { permission_level{"alice"_n, name("first")} }, { second_priv_key }); } FC_LOG_AND_RETHROW() } @@ -347,21 +347,21 @@ BOOST_AUTO_TEST_CASE( any_auth ) { try { chain.set_authority(name("bob"), name("spending"), bob_spending_pub_key, name("active")); /// this should fail because spending is not active which is default for reqauth - BOOST_REQUIRE_THROW( chain.push_reqauth(name("alice"), { permission_level{N(alice), name("spending")} }, { spending_priv_key }), + BOOST_REQUIRE_THROW( chain.push_reqauth(name("alice"), { permission_level{"alice"_n, name("spending")} }, { spending_priv_key }), irrelevant_auth_exception ); chain.produce_block(); - //test.push_reqauth( N(alice), { permission_level{N(alice),"spending"} }, { spending_priv_key }); + //test.push_reqauth( "alice"_n, { permission_level{"alice"_n,"spending"} }, { spending_priv_key }); chain.link_authority( name("alice"), name("eosio"), name("eosio.any"), name("reqauth") ); chain.link_authority( name("bob"), name("eosio"), name("eosio.any"), name("reqauth") ); /// this should succeed because eosio::reqauth is linked to any permission - chain.push_reqauth(name("alice"), { permission_level{N(alice), name("spending")} }, { spending_priv_key }); + chain.push_reqauth(name("alice"), { permission_level{"alice"_n, name("spending")} }, { spending_priv_key }); /// this should fail because bob cannot authorize for alice, the permission given must be one-of alices - BOOST_REQUIRE_THROW( chain.push_reqauth(name("alice"), { permission_level{N(bob), name("spending")} }, { spending_priv_key }), + BOOST_REQUIRE_THROW( chain.push_reqauth(name("alice"), { permission_level{"bob"_n, name("spending")} }, { spending_priv_key }), missing_auth_exception ); @@ -377,9 +377,9 @@ try { chain.produce_block(); - account_name acc1 = N(bill1); - account_name acc2 = N(bill2); - account_name acc1a = N(bill1a); + account_name acc1 = "bill1"_n; + account_name acc2 = "bill2"_n; + account_name acc1a = "bill1a"_n; chain.create_account(acc1); chain.create_account(acc1a); @@ -435,10 +435,10 @@ try { chain.produce_block(); - account_name acc1 = N(acc1); - account_name acc2 = N(acc2); - account_name acc3 = N(acc3); - account_name acc4 = N(acc4); + account_name acc1 = "acc1"_n; + account_name acc2 = "acc2"_n; + account_name acc3 = "acc3"_n; + account_name acc4 = "acc4"_n; chain.create_account(acc1); chain.produce_block(); @@ -482,15 +482,15 @@ try { BOOST_AUTO_TEST_CASE( linkauth_special ) { try { TESTER chain; - const auto& tester_account = N(tester); + const auto& tester_account = "tester"_n; std::vector ids; chain.produce_blocks(); - chain.create_account(N(currency)); + chain.create_account("currency"_n); chain.produce_blocks(); - chain.create_account(N(tester)); - chain.create_account(N(tester2)); + chain.create_account("tester"_n); + chain.create_account("tester2"_n); chain.produce_blocks(); chain.push_action(config::system_account_name, updateauth::get_name(), tester_account, fc::mutable_variant_object() diff --git a/unittests/block_tests.cpp b/unittests/block_tests.cpp index 8d7650c98a6..1281af77324 100644 --- a/unittests/block_tests.cpp +++ b/unittests/block_tests.cpp @@ -12,7 +12,7 @@ BOOST_AUTO_TEST_CASE(block_with_invalid_tx_test) tester main; // First we create a valid block with valid transaction - main.create_account(N(newacc)); + main.create_account("newacc"_n); auto b = main.produce_block(); // Make a copy of the valid block and corrupt the transaction @@ -87,14 +87,14 @@ std::pair corrupt_trx_in_block(validating_te // verify that a block with a transaction with an incorrect signature, is blindly accepted from a trusted producer BOOST_AUTO_TEST_CASE(trusted_producer_test) { - flat_set trusted_producers = { N(defproducera), N(defproducerc) }; + flat_set trusted_producers = { "defproducera"_n, "defproducerc"_n }; validating_tester main(trusted_producers); // only using validating_tester to keep the 2 chains in sync, not to validate that the validating_node matches the main node, // since it won't be main.skip_validate = true; // First we create a valid block with valid transaction - std::set producers = { N(defproducera), N(defproducerb), N(defproducerc), N(defproducerd) }; + std::set producers = { "defproducera"_n, "defproducerb"_n, "defproducerc"_n, "defproducerd"_n }; for (auto prod : producers) main.create_account(prod); auto b = main.produce_block(); @@ -102,25 +102,25 @@ BOOST_AUTO_TEST_CASE(trusted_producer_test) std::vector schedule(producers.cbegin(), producers.cend()); auto trace = main.set_producers(schedule); - while (b->producer != N(defproducera)) { + while (b->producer != "defproducera"_n) { b = main.produce_block(); } - auto blocks = corrupt_trx_in_block(main, N(tstproducera)); + auto blocks = corrupt_trx_in_block(main, "tstproducera"_n); main.validate_push_block( blocks.second ); } // like trusted_producer_test, except verify that any entry in the trusted_producer list is accepted BOOST_AUTO_TEST_CASE(trusted_producer_verify_2nd_test) { - flat_set trusted_producers = { N(defproducera), N(defproducerc) }; + flat_set trusted_producers = { "defproducera"_n, "defproducerc"_n }; validating_tester main(trusted_producers); // only using validating_tester to keep the 2 chains in sync, not to validate that the validating_node matches the main node, // since it won't be main.skip_validate = true; // First we create a valid block with valid transaction - std::set producers = { N(defproducera), N(defproducerb), N(defproducerc), N(defproducerd) }; + std::set producers = { "defproducera"_n, "defproducerb"_n, "defproducerc"_n, "defproducerd"_n }; for (auto prod : producers) main.create_account(prod); auto b = main.produce_block(); @@ -128,25 +128,25 @@ BOOST_AUTO_TEST_CASE(trusted_producer_verify_2nd_test) std::vector schedule(producers.cbegin(), producers.cend()); auto trace = main.set_producers(schedule); - while (b->producer != N(defproducerc)) { + while (b->producer != "defproducerc"_n) { b = main.produce_block(); } - auto blocks = corrupt_trx_in_block(main, N(tstproducera)); + auto blocks = corrupt_trx_in_block(main, "tstproducera"_n); main.validate_push_block( blocks.second ); } // verify that a block with a transaction with an incorrect signature, is rejected if it is not from a trusted producer BOOST_AUTO_TEST_CASE(untrusted_producer_test) { - flat_set trusted_producers = { N(defproducera), N(defproducerc) }; + flat_set trusted_producers = { "defproducera"_n, "defproducerc"_n }; validating_tester main(trusted_producers); // only using validating_tester to keep the 2 chains in sync, not to validate that the validating_node matches the main node, // since it won't be main.skip_validate = true; // First we create a valid block with valid transaction - std::set producers = { N(defproducera), N(defproducerb), N(defproducerc), N(defproducerd) }; + std::set producers = { "defproducera"_n, "defproducerb"_n, "defproducerc"_n, "defproducerd"_n }; for (auto prod : producers) main.create_account(prod); auto b = main.produce_block(); @@ -154,11 +154,11 @@ BOOST_AUTO_TEST_CASE(untrusted_producer_test) std::vector schedule(producers.cbegin(), producers.cend()); auto trace = main.set_producers(schedule); - while (b->producer != N(defproducerb)) { + while (b->producer != "defproducerb"_n) { b = main.produce_block(); } - auto blocks = corrupt_trx_in_block(main, N(tstproducera)); + auto blocks = corrupt_trx_in_block(main, "tstproducera"_n); BOOST_REQUIRE_EXCEPTION(main.validate_push_block( blocks.second ), fc::exception , [] (const fc::exception &e)->bool { return e.code() == unsatisfied_authorization::code_value ; @@ -200,7 +200,7 @@ BOOST_FIXTURE_TEST_CASE( abort_block_transactions, validating_tester) { try { produce_blocks(2); signed_transaction trx; - account_name a = N(newco); + account_name a = "newco"_n; account_name creator = config::system_account_name; // account does not exist before test @@ -247,7 +247,7 @@ BOOST_FIXTURE_TEST_CASE( abort_block_transactions_tester, validating_tester) { t produce_blocks(2); signed_transaction trx; - account_name a = N(newco); + account_name a = "newco"_n; account_name creator = config::system_account_name; // account does not exist before test diff --git a/unittests/bootseq_tests.cpp b/unittests/bootseq_tests.cpp index 3195d36d107..3ae069c0303 100644 --- a/unittests/bootseq_tests.cpp +++ b/unittests/bootseq_tests.cpp @@ -29,38 +29,38 @@ struct genesis_account { }; std::vector test_genesis( { - {N(b1), 100'000'000'0000ll}, - {N(whale4), 40'000'000'0000ll}, - {N(whale3), 30'000'000'0000ll}, - {N(whale2), 20'000'000'0000ll}, - {N(proda), 1'000'000'0000ll}, - {N(prodb), 1'000'000'0000ll}, - {N(prodc), 1'000'000'0000ll}, - {N(prodd), 1'000'000'0000ll}, - {N(prode), 1'000'000'0000ll}, - {N(prodf), 1'000'000'0000ll}, - {N(prodg), 1'000'000'0000ll}, - {N(prodh), 1'000'000'0000ll}, - {N(prodi), 1'000'000'0000ll}, - {N(prodj), 1'000'000'0000ll}, - {N(prodk), 1'000'000'0000ll}, - {N(prodl), 1'000'000'0000ll}, - {N(prodm), 1'000'000'0000ll}, - {N(prodn), 1'000'000'0000ll}, - {N(prodo), 1'000'000'0000ll}, - {N(prodp), 1'000'000'0000ll}, - {N(prodq), 1'000'000'0000ll}, - {N(prodr), 1'000'000'0000ll}, - {N(prods), 1'000'000'0000ll}, - {N(prodt), 1'000'000'0000ll}, - {N(produ), 1'000'000'0000ll}, - {N(runnerup1), 1'000'000'0000ll}, - {N(runnerup2), 1'000'000'0000ll}, - {N(runnerup3), 1'000'000'0000ll}, - {N(minow1), 100'0000ll}, - {N(minow2), 1'0000ll}, - {N(minow3), 1'0000ll}, - {N(masses), 800'000'000'0000ll} + {"b1"_n, 100'000'000'0000ll}, + {"whale4"_n, 40'000'000'0000ll}, + {"whale3"_n, 30'000'000'0000ll}, + {"whale2"_n, 20'000'000'0000ll}, + {"proda"_n, 1'000'000'0000ll}, + {"prodb"_n, 1'000'000'0000ll}, + {"prodc"_n, 1'000'000'0000ll}, + {"prodd"_n, 1'000'000'0000ll}, + {"prode"_n, 1'000'000'0000ll}, + {"prodf"_n, 1'000'000'0000ll}, + {"prodg"_n, 1'000'000'0000ll}, + {"prodh"_n, 1'000'000'0000ll}, + {"prodi"_n, 1'000'000'0000ll}, + {"prodj"_n, 1'000'000'0000ll}, + {"prodk"_n, 1'000'000'0000ll}, + {"prodl"_n, 1'000'000'0000ll}, + {"prodm"_n, 1'000'000'0000ll}, + {"prodn"_n, 1'000'000'0000ll}, + {"prodo"_n, 1'000'000'0000ll}, + {"prodp"_n, 1'000'000'0000ll}, + {"prodq"_n, 1'000'000'0000ll}, + {"prodr"_n, 1'000'000'0000ll}, + {"prods"_n, 1'000'000'0000ll}, + {"prodt"_n, 1'000'000'0000ll}, + {"produ"_n, 1'000'000'0000ll}, + {"runnerup1"_n, 1'000'000'0000ll}, + {"runnerup2"_n, 1'000'000'0000ll}, + {"runnerup3"_n, 1'000'000'0000ll}, + {"minow1"_n, 100'0000ll}, + {"minow2"_n, 1'0000ll}, + {"minow3"_n, 1'0000ll}, + {"masses"_n, 800'000'000'0000ll} }); class bootseq_tester : public TESTER { @@ -69,7 +69,7 @@ class bootseq_tester : public TESTER { set_code( config::system_account_name, contracts::eosio_system_wasm() ); set_abi( config::system_account_name, contracts::eosio_system_abi().data() ); if( call_init ) { - base_tester::push_action(config::system_account_name, N(init), + base_tester::push_action(config::system_account_name, "init"_n, config::system_account_name, mutable_variant_object() ("version", 0) ("core", CORE_SYM_STR) @@ -82,13 +82,13 @@ class bootseq_tester : public TESTER { } fc::variant get_global_state() { - vector data = get_row_by_account( config::system_account_name, config::system_account_name, N(global), N(global) ); + vector data = get_row_by_account( config::system_account_name, config::system_account_name, "global"_n, "global"_n ); if (data.empty()) std::cout << "\nData is empty\n" << std::endl; return data.empty() ? fc::variant() : abi_ser.binary_to_variant( "eosio_global_state", data, abi_serializer::create_yield_function( abi_serializer_max_time ) ); } auto buyram( name payer, name receiver, asset ram ) { - auto r = base_tester::push_action(config::system_account_name, N(buyram), payer, mvo() + auto r = base_tester::push_action(config::system_account_name, "buyram"_n, payer, mvo() ("payer", payer) ("receiver", receiver) ("quant", ram) @@ -98,7 +98,7 @@ class bootseq_tester : public TESTER { } auto delegate_bandwidth( name from, name receiver, asset net, asset cpu, uint8_t transfer = 1) { - auto r = base_tester::push_action(config::system_account_name, N(delegatebw), from, mvo() + auto r = base_tester::push_action(config::system_account_name, "delegatebw"_n, from, mvo() ("from", from ) ("receiver", receiver) ("stake_net_quantity", net) @@ -114,11 +114,11 @@ class bootseq_tester : public TESTER { ("issuer", manager ) ("maximum_supply", maxsupply ); - base_tester::push_action(contract, N(create), contract, act ); + base_tester::push_action(contract, "create"_n, contract, act ); } auto issue( name contract, name manager, name to, asset amount ) { - auto r = base_tester::push_action( contract, N(issue), manager, mutable_variant_object() + auto r = base_tester::push_action( contract, "issue"_n, manager, mutable_variant_object() ("to", to ) ("quantity", amount ) ("memo", "") @@ -128,19 +128,19 @@ class bootseq_tester : public TESTER { } auto claim_rewards( name owner ) { - auto r = base_tester::push_action( config::system_account_name, N(claimrewards), owner, mvo()("owner", owner )); + auto r = base_tester::push_action( config::system_account_name, "claimrewards"_n, owner, mvo()("owner", owner )); produce_block(); return r; } auto set_privileged( name account ) { - auto r = base_tester::push_action(config::system_account_name, N(setpriv), config::system_account_name, mvo()("account", account)("is_priv", 1)); + auto r = base_tester::push_action(config::system_account_name, "setpriv"_n, config::system_account_name, mvo()("account", account)("is_priv", 1)); produce_block(); return r; } auto register_producer(name producer) { - auto r = base_tester::push_action(config::system_account_name, N(regproducer), producer, mvo() + auto r = base_tester::push_action(config::system_account_name, "regproducer"_n, producer, mvo() ("producer", name(producer)) ("producer_key", get_public_key( producer, "active" ) ) ("url", "" ) @@ -152,7 +152,7 @@ class bootseq_tester : public TESTER { auto undelegate_bandwidth( name from, name receiver, asset net, asset cpu ) { - auto r = base_tester::push_action(config::system_account_name, N(undelegatebw), from, mvo() + auto r = base_tester::push_action(config::system_account_name, "undelegatebw"_n, from, mvo() ("from", from ) ("receiver", receiver) ("unstake_net_quantity", net) @@ -163,7 +163,7 @@ class bootseq_tester : public TESTER { } asset get_balance( const account_name& act ) { - return get_currency_balance(N(eosio.token), symbol(CORE_SYMBOL), act); + return get_currency_balance("eosio.token"_n, symbol(CORE_SYMBOL), act); } void set_code_abi(const account_name& account, const vector& wasm, const char* abi, const private_key_type* signer = nullptr) { @@ -189,38 +189,38 @@ BOOST_FIXTURE_TEST_CASE( bootseq_test, bootseq_tester ) { try { // Create eosio.msig and eosio.token - create_accounts({N(eosio.msig), N(eosio.token), N(eosio.ram), N(eosio.ramfee), N(eosio.stake), N(eosio.vpay), N(eosio.bpay), N(eosio.saving) }); + create_accounts({"eosio.msig"_n, "eosio.token"_n, "eosio.ram"_n, "eosio.ramfee"_n, "eosio.stake"_n, "eosio.vpay"_n, "eosio.bpay"_n, "eosio.saving"_n }); // Set code for the following accounts: // - eosio (code: eosio.bios) (already set by tester constructor) // - eosio.msig (code: eosio.msig) // - eosio.token (code: eosio.token) - // set_code_abi(N(eosio.msig), contracts::eosio_msig_wasm(), contracts::eosio_msig_abi().data());//, &eosio_active_pk); - // set_code_abi(N(eosio.token), contracts::eosio_token_wasm(), contracts::eosio_token_abi().data()); //, &eosio_active_pk); + // set_code_abi("eosio.msig"_n, contracts::eosio_msig_wasm(), contracts::eosio_msig_abi().data());//, &eosio_active_pk); + // set_code_abi("eosio.token"_n, contracts::eosio_token_wasm(), contracts::eosio_token_abi().data()); //, &eosio_active_pk); - set_code_abi(N(eosio.msig), + set_code_abi("eosio.msig"_n, contracts::eosio_msig_wasm(), contracts::eosio_msig_abi().data());//, &eosio_active_pk); - set_code_abi(N(eosio.token), + set_code_abi("eosio.token"_n, contracts::eosio_token_wasm(), contracts::eosio_token_abi().data()); //, &eosio_active_pk); // Set privileged for eosio.msig and eosio.token - set_privileged(N(eosio.msig)); - set_privileged(N(eosio.token)); + set_privileged("eosio.msig"_n); + set_privileged("eosio.token"_n); // Verify eosio.msig and eosio.token is privileged - const auto& eosio_msig_acc = get(N(eosio.msig)); + const auto& eosio_msig_acc = get("eosio.msig"_n); BOOST_TEST(eosio_msig_acc.is_privileged() == true); - const auto& eosio_token_acc = get(N(eosio.token)); + const auto& eosio_token_acc = get("eosio.token"_n); BOOST_TEST(eosio_token_acc.is_privileged() == true); // Create SYS tokens in eosio.token, set its manager as eosio auto max_supply = core_from_string("10000000000.0000"); /// 1x larger than 1B initial tokens auto initial_supply = core_from_string("1000000000.0000"); /// 1x larger than 1B initial tokens - create_currency(N(eosio.token), config::system_account_name, max_supply); + create_currency("eosio.token"_n, config::system_account_name, max_supply); // Issue the genesis supply of 1 billion SYS tokens to eosio.system - issue(N(eosio.token), config::system_account_name, config::system_account_name, initial_supply); + issue("eosio.token"_n, config::system_account_name, config::system_account_name, initial_supply); auto actual = get_balance(config::system_account_name); BOOST_REQUIRE_EQUAL(initial_supply, actual); @@ -242,15 +242,15 @@ BOOST_FIXTURE_TEST_CASE( bootseq_test, bootseq_tester ) { auto r = buyram(config::system_account_name, a.aname, asset(ram)); BOOST_REQUIRE( !r->except_ptr ); - r = delegate_bandwidth(N(eosio.stake), a.aname, asset(net), asset(cpu)); + r = delegate_bandwidth("eosio.stake"_n, a.aname, asset(net), asset(cpu)); BOOST_REQUIRE( !r->except_ptr ); } auto producer_candidates = { - N(proda), N(prodb), N(prodc), N(prodd), N(prode), N(prodf), N(prodg), - N(prodh), N(prodi), N(prodj), N(prodk), N(prodl), N(prodm), N(prodn), - N(prodo), N(prodp), N(prodq), N(prodr), N(prods), N(prodt), N(produ), - N(runnerup1), N(runnerup2), N(runnerup3) + "proda"_n, "prodb"_n, "prodc"_n, "prodd"_n, "prode"_n, "prodf"_n, "prodg"_n, + "prodh"_n, "prodi"_n, "prodj"_n, "prodk"_n, "prodl"_n, "prodm"_n, "prodn"_n, + "prodo"_n, "prodp"_n, "prodq"_n, "prodr"_n, "prods"_n, "prodt"_n, "produ"_n, + "runnerup1"_n, "runnerup2"_n, "runnerup3"_n }; // Register producers @@ -261,20 +261,20 @@ BOOST_FIXTURE_TEST_CASE( bootseq_test, bootseq_tester ) { // Vote for producers auto votepro = [&]( account_name voter, vector producers ) { std::sort( producers.begin(), producers.end() ); - base_tester::push_action(config::system_account_name, N(voteproducer), voter, mvo() + base_tester::push_action(config::system_account_name, "voteproducer"_n, voter, mvo() ("voter", name(voter)) ("proxy", name(0) ) ("producers", producers) ); }; - votepro( N(b1), { N(proda), N(prodb), N(prodc), N(prodd), N(prode), N(prodf), N(prodg), - N(prodh), N(prodi), N(prodj), N(prodk), N(prodl), N(prodm), N(prodn), - N(prodo), N(prodp), N(prodq), N(prodr), N(prods), N(prodt), N(produ)} ); - votepro( N(whale2), {N(runnerup1), N(runnerup2), N(runnerup3)} ); - votepro( N(whale3), {N(proda), N(prodb), N(prodc), N(prodd), N(prode)} ); + votepro( "b1"_n, { "proda"_n, "prodb"_n, "prodc"_n, "prodd"_n, "prode"_n, "prodf"_n, "prodg"_n, + "prodh"_n, "prodi"_n, "prodj"_n, "prodk"_n, "prodl"_n, "prodm"_n, "prodn"_n, + "prodo"_n, "prodp"_n, "prodq"_n, "prodr"_n, "prods"_n, "prodt"_n, "produ"_n} ); + votepro( "whale2"_n, {"runnerup1"_n, "runnerup2"_n, "runnerup3"_n} ); + votepro( "whale3"_n, {"proda"_n, "prodb"_n, "prodc"_n, "prodd"_n, "prode"_n} ); // Total Stakes = b1 + whale2 + whale3 stake = (100,000,000 - 1,000) + (20,000,000 - 1,000) + (30,000,000 - 1,000) - vector data = get_row_by_account( config::system_account_name, config::system_account_name, N(global), N(global) ); + vector data = get_row_by_account( config::system_account_name, config::system_account_name, "global"_n, "global"_n ); BOOST_TEST(get_global_state()["total_activated_stake"].as() == 1499999997000); @@ -287,10 +287,10 @@ BOOST_FIXTURE_TEST_CASE( bootseq_test, bootseq_tester ) { // Spend some time so the producer pay pool is filled by the inflation rate produce_min_num_of_blocks_to_spend_time_wo_inactive_prod(fc::seconds(30 * 24 * 3600)); // 30 days // Since the total activated stake is less than 150,000,000, it shouldn't be possible to claim rewards - BOOST_REQUIRE_THROW(claim_rewards(N(runnerup1)), eosio_assert_message_exception); + BOOST_REQUIRE_THROW(claim_rewards("runnerup1"_n), eosio_assert_message_exception); // This will increase the total vote stake by (40,000,000 - 1,000) - votepro( N(whale4), {N(prodq), N(prodr), N(prods), N(prodt), N(produ)} ); + votepro( "whale4"_n, {"prodq"_n, "prodr"_n, "prods"_n, "prodt"_n, "produ"_n} ); BOOST_TEST(get_global_state()["total_activated_stake"].as() == 1899999996000); // Since the total vote stake is more than 150,000,000, the new producer set will be set @@ -322,8 +322,8 @@ BOOST_FIXTURE_TEST_CASE( bootseq_test, bootseq_tester ) { // Spend some time so the producer pay pool is filled by the inflation rate produce_min_num_of_blocks_to_spend_time_wo_inactive_prod(fc::seconds(30 * 24 * 3600)); // 30 days // Since the total activated stake is larger than 150,000,000, pool should be filled reward should be bigger than zero - claim_rewards(N(runnerup1)); - BOOST_TEST(get_balance(N(runnerup1)).get_amount() > 0); + claim_rewards("runnerup1"_n); + BOOST_TEST(get_balance("runnerup1"_n).get_amount() > 0); const auto first_june_2018 = fc::seconds(1527811200); // 2018-06-01 const auto first_june_2028 = fc::seconds(1843430400); // 2028-06-01 @@ -332,18 +332,18 @@ BOOST_FIXTURE_TEST_CASE( bootseq_test, bootseq_tester ) { // This should thrown an error, since block one can only unstake all his stake after 10 years - BOOST_REQUIRE_THROW(undelegate_bandwidth(N(b1), N(b1), core_from_string("49999500.0000"), core_from_string("49999500.0000")), eosio_assert_message_exception); + BOOST_REQUIRE_THROW(undelegate_bandwidth("b1"_n, "b1"_n, core_from_string("49999500.0000"), core_from_string("49999500.0000")), eosio_assert_message_exception); // Skip 10 years produce_block(first_june_2028 - control->head_block_time().time_since_epoch()); // Block one should be able to unstake all his stake now - undelegate_bandwidth(N(b1), N(b1), core_from_string("49999500.0000"), core_from_string("49999500.0000")); + undelegate_bandwidth("b1"_n, "b1"_n, core_from_string("49999500.0000"), core_from_string("49999500.0000")); return; produce_blocks(7000); /// produce blocks until virutal bandwidth can acomadate a small user wlog("minow" ); - votepro( N(minow1), {N(p1), N(p2)} ); + votepro( "minow1"_n, {"p1"_n, "p2"_n} ); // TODO: Complete this test diff --git a/unittests/currency_tests.cpp b/unittests/currency_tests.cpp index b81f5045cc7..f82d87d4c6a 100644 --- a/unittests/currency_tests.cpp +++ b/unittests/currency_tests.cpp @@ -32,7 +32,7 @@ class currency_tester : public TESTER { string action_type_name = abi_ser.get_action_type(name); action act; - act.account = N(eosio.token); + act.account = "eosio.token"_n; act.name = name; act.authorization = vector{{signer, config::active_name}}; act.data = abi_ser.variant_to_binary(action_type_name, data, abi_serializer::create_yield_function( abi_serializer_max_time )); @@ -46,11 +46,11 @@ class currency_tester : public TESTER { } asset get_balance(const account_name& account) const { - return get_currency_balance(N(eosio.token), symbol(SY(4,CUR)), account); + return get_currency_balance("eosio.token"_n, symbol(SY(4,CUR)), account); } auto transfer(const account_name& from, const account_name& to, const std::string& quantity, const std::string& memo = "") { - auto trace = push_action(from, N(transfer), mutable_variant_object() + auto trace = push_action(from, "transfer"_n, mutable_variant_object() ("from", from) ("to", to) ("quantity", quantity) @@ -61,7 +61,7 @@ class currency_tester : public TESTER { } auto issue(const account_name& to, const std::string& quantity, const std::string& memo = "") { - auto trace = push_action(N(eosio.token), N(issue), mutable_variant_object() + auto trace = push_action("eosio.token"_n, "issue"_n, mutable_variant_object() ("to", to) ("quantity", quantity) ("memo", memo) @@ -73,10 +73,10 @@ class currency_tester : public TESTER { currency_tester() :TESTER(),abi_ser(json::from_string(contracts::eosio_token_abi().data()).as(), abi_serializer::create_yield_function( abi_serializer_max_time )) { - create_account( N(eosio.token)); - set_code( N(eosio.token), contracts::eosio_token_wasm() ); + create_account( "eosio.token"_n); + set_code( "eosio.token"_n, contracts::eosio_token_wasm() ); - auto result = push_action(N(eosio.token), N(create), mutable_variant_object() + auto result = push_action("eosio.token"_n, "create"_n, mutable_variant_object() ("issuer", eosio_token) ("maximum_supply", "1000000000.0000 CUR") ("can_freeze", 0) @@ -85,7 +85,7 @@ class currency_tester : public TESTER { ); wdump((result)); - result = push_action(N(eosio.token), N(issue), mutable_variant_object() + result = push_action("eosio.token"_n, "issue"_n, mutable_variant_object() ("to", eosio_token) ("quantity", "1000000.0000 CUR") ("memo", "gggggggggggg") @@ -98,23 +98,23 @@ class currency_tester : public TESTER { static const name eosio_token; }; -const name currency_tester::eosio_token = N(eosio.token); +const name currency_tester::eosio_token = "eosio.token"_n; BOOST_AUTO_TEST_SUITE(currency_tests) BOOST_AUTO_TEST_CASE( bootstrap ) try { auto expected = asset::from_string( "1000000.0000 CUR" ); currency_tester t; - auto actual = t.get_currency_balance(N(eosio.token), expected.get_symbol(), N(eosio.token)); + auto actual = t.get_currency_balance("eosio.token"_n, expected.get_symbol(), "eosio.token"_n); BOOST_REQUIRE_EQUAL(expected, actual); } FC_LOG_AND_RETHROW() /// test_api_bootstrap BOOST_FIXTURE_TEST_CASE( test_transfer, currency_tester ) try { - create_accounts( {N(alice)} ); + create_accounts( {"alice"_n} ); // make a transfer from the contract to a user { - auto trace = push_action(N(eosio.token), N(transfer), mutable_variant_object() + auto trace = push_action("eosio.token"_n, "transfer"_n, mutable_variant_object() ("from", eosio_token) ("to", "alice") ("quantity", "100.0000 CUR") @@ -124,21 +124,21 @@ BOOST_FIXTURE_TEST_CASE( test_transfer, currency_tester ) try { produce_block(); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trace->id)); - BOOST_REQUIRE_EQUAL(get_balance(N(alice)), asset::from_string( "100.0000 CUR" ) ); + BOOST_REQUIRE_EQUAL(get_balance("alice"_n), asset::from_string( "100.0000 CUR" ) ); } } FC_LOG_AND_RETHROW() /// test_transfer BOOST_FIXTURE_TEST_CASE( test_duplicate_transfer, currency_tester ) { - create_accounts( {N(alice)} ); + create_accounts( {"alice"_n} ); - auto trace = push_action(N(eosio.token), N(transfer), mutable_variant_object() + auto trace = push_action("eosio.token"_n, "transfer"_n, mutable_variant_object() ("from", eosio_token) ("to", "alice") ("quantity", "100.0000 CUR") ("memo", "fund Alice") ); - BOOST_REQUIRE_THROW(push_action(N(eosio.token), N(transfer), mutable_variant_object() + BOOST_REQUIRE_THROW(push_action("eosio.token"_n, "transfer"_n, mutable_variant_object() ("from", eosio_token) ("to", "alice") ("quantity", "100.0000 CUR") @@ -148,15 +148,15 @@ BOOST_FIXTURE_TEST_CASE( test_duplicate_transfer, currency_tester ) { produce_block(); BOOST_CHECK_EQUAL(true, chain_has_transaction(trace->id)); - BOOST_CHECK_EQUAL(get_balance(N(alice)), asset::from_string( "100.0000 CUR" ) ); + BOOST_CHECK_EQUAL(get_balance("alice"_n), asset::from_string( "100.0000 CUR" ) ); } BOOST_FIXTURE_TEST_CASE( test_addtransfer, currency_tester ) try { - create_accounts( {N(alice)} ); + create_accounts( {"alice"_n} ); // make a transfer from the contract to a user { - auto trace = push_action(N(eosio.token), N(transfer), mutable_variant_object() + auto trace = push_action("eosio.token"_n, "transfer"_n, mutable_variant_object() ("from", eosio_token) ("to", "alice") ("quantity", "100.0000 CUR") @@ -166,12 +166,12 @@ BOOST_FIXTURE_TEST_CASE( test_addtransfer, currency_tester ) try { produce_block(); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trace->id)); - BOOST_REQUIRE_EQUAL(get_balance(N(alice)), asset::from_string( "100.0000 CUR" )); + BOOST_REQUIRE_EQUAL(get_balance("alice"_n), asset::from_string( "100.0000 CUR" )); } // make a transfer from the contract to a user { - auto trace = push_action(N(eosio.token), N(transfer), mutable_variant_object() + auto trace = push_action("eosio.token"_n, "transfer"_n, mutable_variant_object() ("from", eosio_token) ("to", "alice") ("quantity", "10.0000 CUR") @@ -181,17 +181,17 @@ BOOST_FIXTURE_TEST_CASE( test_addtransfer, currency_tester ) try { produce_block(); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trace->id)); - BOOST_REQUIRE_EQUAL(get_balance(N(alice)), asset::from_string( "110.0000 CUR" )); + BOOST_REQUIRE_EQUAL(get_balance("alice"_n), asset::from_string( "110.0000 CUR" )); } } FC_LOG_AND_RETHROW() /// test_transfer BOOST_FIXTURE_TEST_CASE( test_overspend, currency_tester ) try { - create_accounts( {N(alice), N(bob)} ); + create_accounts( {"alice"_n, "bob"_n} ); // make a transfer from the contract to a user { - auto trace = push_action(N(eosio.token), N(transfer), mutable_variant_object() + auto trace = push_action("eosio.token"_n, "transfer"_n, mutable_variant_object() ("from", eosio_token) ("to", "alice") ("quantity", "100.0000 CUR") @@ -201,7 +201,7 @@ BOOST_FIXTURE_TEST_CASE( test_overspend, currency_tester ) try { produce_block(); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trace->id)); - BOOST_REQUIRE_EQUAL(get_balance(N(alice)), asset::from_string( "100.0000 CUR" )); + BOOST_REQUIRE_EQUAL(get_balance("alice"_n), asset::from_string( "100.0000 CUR" )); } // Overspend! @@ -212,21 +212,21 @@ BOOST_FIXTURE_TEST_CASE( test_overspend, currency_tester ) try { ("quantity", "101.0000 CUR") ("memo", "overspend! Alice"); - BOOST_CHECK_EXCEPTION( push_action(N(alice), N(transfer), data), + BOOST_CHECK_EXCEPTION( push_action("alice"_n, "transfer"_n, data), eosio_assert_message_exception, eosio_assert_message_is("overdrawn balance") ); produce_block(); - BOOST_REQUIRE_EQUAL(get_balance(N(alice)), asset::from_string( "100.0000 CUR" )); - BOOST_REQUIRE_EQUAL(get_balance(N(bob)), asset::from_string( "0.0000 CUR" )); + BOOST_REQUIRE_EQUAL(get_balance("alice"_n), asset::from_string( "100.0000 CUR" )); + BOOST_REQUIRE_EQUAL(get_balance("bob"_n), asset::from_string( "0.0000 CUR" )); } } FC_LOG_AND_RETHROW() /// test_overspend BOOST_FIXTURE_TEST_CASE( test_fullspend, currency_tester ) try { - create_accounts( {N(alice), N(bob)} ); + create_accounts( {"alice"_n, "bob"_n} ); // make a transfer from the contract to a user { - auto trace = push_action(N(eosio.token), N(transfer), mutable_variant_object() + auto trace = push_action("eosio.token"_n, "transfer"_n, mutable_variant_object() ("from", eosio_token) ("to", "alice") ("quantity", "100.0000 CUR") @@ -236,7 +236,7 @@ BOOST_FIXTURE_TEST_CASE( test_fullspend, currency_tester ) try { produce_block(); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trace->id)); - BOOST_REQUIRE_EQUAL(get_balance(N(alice)), asset::from_string( "100.0000 CUR" )); + BOOST_REQUIRE_EQUAL(get_balance("alice"_n), asset::from_string( "100.0000 CUR" )); } // Full spend @@ -247,12 +247,12 @@ BOOST_FIXTURE_TEST_CASE( test_fullspend, currency_tester ) try { ("quantity", "100.0000 CUR") ("memo", "all in! Alice"); - auto trace = push_action(N(alice), N(transfer), data); + auto trace = push_action("alice"_n, "transfer"_n, data); produce_block(); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trace->id)); - BOOST_REQUIRE_EQUAL(get_balance(N(alice)), asset::from_string( "0.0000 CUR" )); - BOOST_REQUIRE_EQUAL(get_balance(N(bob)), asset::from_string( "100.0000 CUR" )); + BOOST_REQUIRE_EQUAL(get_balance("alice"_n), asset::from_string( "0.0000 CUR" )); + BOOST_REQUIRE_EQUAL(get_balance("bob"_n), asset::from_string( "100.0000 CUR" )); } } FC_LOG_AND_RETHROW() /// test_fullspend @@ -399,10 +399,10 @@ BOOST_FIXTURE_TEST_CASE(test_symbol, TESTER) try { BOOST_FIXTURE_TEST_CASE( test_proxy, currency_tester ) try { produce_blocks(2); - create_accounts( {N(alice), N(proxy)} ); + create_accounts( {"alice"_n, "proxy"_n} ); produce_block(); - set_code(N(proxy), contracts::proxy_wasm()); + set_code("proxy"_n, contracts::proxy_wasm()); produce_blocks(1); abi_serializer proxy_abi_ser(json::from_string(contracts::proxy_abi().data()).as(), abi_serializer::create_yield_function( abi_serializer_max_time )); @@ -411,9 +411,9 @@ BOOST_FIXTURE_TEST_CASE( test_proxy, currency_tester ) try { { signed_transaction trx; action setowner_act; - setowner_act.account = N(proxy); - setowner_act.name = N(setowner); - setowner_act.authorization = vector{{N(proxy), config::active_name}}; + setowner_act.account = "proxy"_n; + setowner_act.name = "setowner"_n; + setowner_act.authorization = vector{{"proxy"_n, config::active_name}}; setowner_act.data = proxy_abi_ser.variant_to_binary("setowner", mutable_variant_object() ("owner", "alice") ("delay", 10), @@ -422,7 +422,7 @@ BOOST_FIXTURE_TEST_CASE( test_proxy, currency_tester ) try { trx.actions.emplace_back(std::move(setowner_act)); set_transaction_headers(trx); - trx.sign(get_private_key(N(proxy), "active"), control->get_chain_id()); + trx.sign(get_private_key("proxy"_n, "active"), control->get_chain_id()); push_transaction(trx); produce_block(); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); @@ -431,7 +431,7 @@ BOOST_FIXTURE_TEST_CASE( test_proxy, currency_tester ) try { // for now wasm "time" is in seconds, so we have to truncate off any parts of a second that may have applied fc::time_point expected_delivery(fc::seconds(control->head_block_time().sec_since_epoch()) + fc::seconds(10)); { - auto trace = push_action(N(eosio.token), N(transfer), mutable_variant_object() + auto trace = push_action("eosio.token"_n, "transfer"_n, mutable_variant_object() ("from", eosio_token) ("to", "proxy") ("quantity", "5.0000 CUR") @@ -441,24 +441,24 @@ BOOST_FIXTURE_TEST_CASE( test_proxy, currency_tester ) try { while(control->head_block_time() < expected_delivery) { produce_block(); - BOOST_REQUIRE_EQUAL(get_balance( N(proxy)), asset::from_string("5.0000 CUR")); - BOOST_REQUIRE_EQUAL(get_balance( N(alice)), asset::from_string("0.0000 CUR")); + BOOST_REQUIRE_EQUAL(get_balance( "proxy"_n), asset::from_string("5.0000 CUR")); + BOOST_REQUIRE_EQUAL(get_balance( "alice"_n), asset::from_string("0.0000 CUR")); } produce_block(); - BOOST_REQUIRE_EQUAL(get_balance( N(proxy)), asset::from_string("0.0000 CUR")); - BOOST_REQUIRE_EQUAL(get_balance( N(alice)), asset::from_string("5.0000 CUR")); + BOOST_REQUIRE_EQUAL(get_balance( "proxy"_n), asset::from_string("0.0000 CUR")); + BOOST_REQUIRE_EQUAL(get_balance( "alice"_n), asset::from_string("5.0000 CUR")); } FC_LOG_AND_RETHROW() /// test_currency BOOST_FIXTURE_TEST_CASE( test_deferred_failure, currency_tester ) try { produce_blocks(2); - create_accounts( {N(alice), N(bob), N(proxy)} ); + create_accounts( {"alice"_n, "bob"_n, "proxy"_n} ); produce_block(); - set_code(N(proxy), contracts::proxy_wasm()); - set_code(N(bob), contracts::proxy_wasm()); + set_code("proxy"_n, contracts::proxy_wasm()); + set_code("bob"_n, contracts::proxy_wasm()); produce_blocks(1); abi_serializer proxy_abi_ser(json::from_string(contracts::proxy_abi().data()).as(), abi_serializer::create_yield_function( abi_serializer_max_time )); @@ -467,9 +467,9 @@ BOOST_FIXTURE_TEST_CASE( test_deferred_failure, currency_tester ) try { { signed_transaction trx; action setowner_act; - setowner_act.account = N(proxy); - setowner_act.name = N(setowner); - setowner_act.authorization = vector{{N(proxy), config::active_name}}; + setowner_act.account = "proxy"_n; + setowner_act.name = "setowner"_n; + setowner_act.authorization = vector{{"proxy"_n, config::active_name}}; setowner_act.data = proxy_abi_ser.variant_to_binary("setowner", mutable_variant_object() ("owner", "bob") ("delay", 10), @@ -478,7 +478,7 @@ BOOST_FIXTURE_TEST_CASE( test_deferred_failure, currency_tester ) try { trx.actions.emplace_back(std::move(setowner_act)); set_transaction_headers(trx); - trx.sign(get_private_key(N(proxy), "active"), control->get_chain_id()); + trx.sign(get_private_key("proxy"_n, "active"), control->get_chain_id()); push_transaction(trx); produce_block(); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); @@ -486,7 +486,7 @@ BOOST_FIXTURE_TEST_CASE( test_deferred_failure, currency_tester ) try { const auto& index = control->db().get_index(); BOOST_REQUIRE_EQUAL(0, index.size()); - auto trace = push_action(N(eosio.token), N(transfer), mutable_variant_object() + auto trace = push_action("eosio.token"_n, "transfer"_n, mutable_variant_object() ("from", eosio_token) ("to", "proxy") ("quantity", "5.0000 CUR") @@ -500,8 +500,8 @@ BOOST_FIXTURE_TEST_CASE( test_deferred_failure, currency_tester ) try { while( control->pending_block_time() < expected_delivery ) { produce_block(); - BOOST_REQUIRE_EQUAL(get_balance( N(proxy)), asset::from_string("5.0000 CUR")); - BOOST_REQUIRE_EQUAL(get_balance( N(bob)), asset::from_string("0.0000 CUR")); + BOOST_REQUIRE_EQUAL(get_balance( "proxy"_n), asset::from_string("5.0000 CUR")); + BOOST_REQUIRE_EQUAL(get_balance( "bob"_n), asset::from_string("0.0000 CUR")); BOOST_REQUIRE_EQUAL(1, index.size()); BOOST_REQUIRE_EQUAL(false, chain_has_transaction(deferred_id)); } @@ -518,9 +518,9 @@ BOOST_FIXTURE_TEST_CASE( test_deferred_failure, currency_tester ) try { { signed_transaction trx; action setowner_act; - setowner_act.account = N(bob); - setowner_act.name = N(setowner); - setowner_act.authorization = vector{{N(bob), config::active_name}}; + setowner_act.account = "bob"_n; + setowner_act.name = "setowner"_n; + setowner_act.authorization = vector{{"bob"_n, config::active_name}}; setowner_act.data = proxy_abi_ser.variant_to_binary("setowner", mutable_variant_object() ("owner", "alice") ("delay", 0), @@ -529,7 +529,7 @@ BOOST_FIXTURE_TEST_CASE( test_deferred_failure, currency_tester ) try { trx.actions.emplace_back(std::move(setowner_act)); set_transaction_headers(trx); - trx.sign(get_private_key(N(bob), "active"), control->get_chain_id()); + trx.sign(get_private_key("bob"_n, "active"), control->get_chain_id()); push_transaction(trx); produce_block(); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); @@ -537,9 +537,9 @@ BOOST_FIXTURE_TEST_CASE( test_deferred_failure, currency_tester ) try { while( control->pending_block_time() < expected_redelivery ) { produce_block(); - BOOST_REQUIRE_EQUAL(get_balance( N(proxy)), asset::from_string("5.0000 CUR")); - BOOST_REQUIRE_EQUAL(get_balance( N(alice)), asset::from_string("0.0000 CUR")); - BOOST_REQUIRE_EQUAL(get_balance( N(bob)), asset::from_string("0.0000 CUR")); + BOOST_REQUIRE_EQUAL(get_balance( "proxy"_n), asset::from_string("5.0000 CUR")); + BOOST_REQUIRE_EQUAL(get_balance( "alice"_n), asset::from_string("0.0000 CUR")); + BOOST_REQUIRE_EQUAL(get_balance( "bob"_n), asset::from_string("0.0000 CUR")); BOOST_REQUIRE_EQUAL(1, index.size()); BOOST_REQUIRE_EQUAL(false, chain_has_transaction(deferred2_id)); } @@ -555,9 +555,9 @@ BOOST_FIXTURE_TEST_CASE( test_deferred_failure, currency_tester ) try { BOOST_REQUIRE_EQUAL(0, index.size()); BOOST_REQUIRE_EQUAL(get_transaction_receipt(deferred2_id).status, transaction_receipt::executed); - BOOST_REQUIRE_EQUAL(get_balance( N(proxy)), asset::from_string("0.0000 CUR")); - BOOST_REQUIRE_EQUAL(get_balance( N(alice)), asset::from_string("5.0000 CUR")); - BOOST_REQUIRE_EQUAL(get_balance( N(bob)), asset::from_string("0.0000 CUR")); + BOOST_REQUIRE_EQUAL(get_balance( "proxy"_n), asset::from_string("0.0000 CUR")); + BOOST_REQUIRE_EQUAL(get_balance( "alice"_n), asset::from_string("5.0000 CUR")); + BOOST_REQUIRE_EQUAL(get_balance( "bob"_n), asset::from_string("0.0000 CUR")); } FC_LOG_AND_RETHROW() /// test_currency @@ -565,28 +565,28 @@ BOOST_FIXTURE_TEST_CASE( test_input_quantity, currency_tester ) try { produce_blocks(2); - create_accounts( {N(alice), N(bob), N(carl)} ); + create_accounts( {"alice"_n, "bob"_n, "carl"_n} ); // transfer to alice using right precision { - auto trace = transfer(eosio_token, N(alice), "100.0000 CUR"); + auto trace = transfer(eosio_token, "alice"_n, "100.0000 CUR"); BOOST_CHECK_EQUAL(true, chain_has_transaction(trace->id)); - BOOST_CHECK_EQUAL(asset::from_string( "100.0000 CUR"), get_balance(N(alice))); - BOOST_CHECK_EQUAL(1000000, get_balance(N(alice)).get_amount()); + BOOST_CHECK_EQUAL(asset::from_string( "100.0000 CUR"), get_balance("alice"_n)); + BOOST_CHECK_EQUAL(1000000, get_balance("alice"_n).get_amount()); } // transfer using different symbol name fails { - BOOST_REQUIRE_THROW(transfer(N(alice), N(carl), "20.50 USD"), eosio_assert_message_exception); + BOOST_REQUIRE_THROW(transfer("alice"_n, "carl"_n, "20.50 USD"), eosio_assert_message_exception); } // issue to alice using right precision { - auto trace = issue(N(alice), "25.0256 CUR"); + auto trace = issue("alice"_n, "25.0256 CUR"); BOOST_CHECK_EQUAL(true, chain_has_transaction(trace->id)); - BOOST_CHECK_EQUAL(asset::from_string("125.0256 CUR"), get_balance(N(alice))); + BOOST_CHECK_EQUAL(asset::from_string("125.0256 CUR"), get_balance("alice"_n)); } diff --git a/unittests/delay_tests.cpp b/unittests/delay_tests.cpp index b36f53c0e02..3349c2a069d 100644 --- a/unittests/delay_tests.cpp +++ b/unittests/delay_tests.cpp @@ -23,7 +23,7 @@ BOOST_FIXTURE_TEST_CASE( delay_create_account, validating_tester) { try { produce_blocks(2); signed_transaction trx; - account_name a = N(newco); + account_name a = "newco"_n; account_name creator = config::system_account_name; auto owner_auth = authority( get_public_key( a, "owner" ) ); @@ -50,13 +50,13 @@ BOOST_FIXTURE_TEST_CASE( delay_error_create_account, validating_tester) { try { produce_blocks(2); signed_transaction trx; - account_name a = N(newco); + account_name a = "newco"_n; account_name creator = config::system_account_name; auto owner_auth = authority( get_public_key( a, "owner" ) ); trx.actions.emplace_back( vector{{creator,config::active_name}}, newaccount{ - .creator = N(bad), /// a does not exist, this should error when execute + .creator = "bad"_n, /// a does not exist, this should error when execute .name = a, .owner = owner_auth, .active = authority( get_public_key( a, "active" ) ) @@ -83,27 +83,27 @@ BOOST_FIXTURE_TEST_CASE( delay_error_create_account, validating_tester) { try { asset get_currency_balance(const TESTER& chain, account_name account) { - return chain.get_currency_balance(N(eosio.token), symbol(SY(4,CUR)), account); + return chain.get_currency_balance("eosio.token"_n, symbol(SY(4,CUR)), account); } -const std::string eosio_token = name(N(eosio.token)).to_string(); +const std::string eosio_token = name("eosio.token"_n).to_string(); // test link to permission with delay directly on it BOOST_AUTO_TEST_CASE( link_delay_direct_test ) { try { TESTER chain; - const auto& tester_account = N(tester); + const auto& tester_account = "tester"_n; chain.produce_blocks(); - chain.create_account(N(eosio.token)); + chain.create_account("eosio.token"_n); chain.produce_blocks(10); - chain.set_code(N(eosio.token), contracts::eosio_token_wasm()); - chain.set_abi(N(eosio.token), contracts::eosio_token_abi().data()); + chain.set_code("eosio.token"_n, contracts::eosio_token_wasm()); + chain.set_abi("eosio.token"_n, contracts::eosio_token_abi().data()); chain.produce_blocks(); - chain.create_account(N(tester)); - chain.create_account(N(tester2)); + chain.create_account("tester"_n); + chain.create_account("tester2"_n); chain.produce_blocks(10); chain.push_action(config::system_account_name, updateauth::get_name(), tester_account, fc::mutable_variant_object() @@ -118,19 +118,19 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_test ) { try { ("type", "transfer") ("requirement", "first")); chain.produce_blocks(); - chain.push_action(N(eosio.token), N(create), N(eosio.token), mutable_variant_object() + chain.push_action("eosio.token"_n, "create"_n, "eosio.token"_n, mutable_variant_object() ("issuer", eosio_token) ("maximum_supply", "9000000.0000 CUR") ); - chain.push_action(N(eosio.token), name("issue"), N(eosio.token), fc::mutable_variant_object() + chain.push_action("eosio.token"_n, name("issue"), "eosio.token"_n, fc::mutable_variant_object() ("to", eosio_token) ("quantity", "1000000.0000 CUR") ("memo", "for stuff") ); - auto trace = chain.push_action(N(eosio.token), name("transfer"), N(eosio.token), fc::mutable_variant_object() + auto trace = chain.push_action("eosio.token"_n, name("transfer"), "eosio.token"_n, fc::mutable_variant_object() ("from", eosio_token) ("to", "tester") ("quantity", "100.0000 CUR") @@ -142,12 +142,12 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_test ) { try { chain.produce_blocks(); - auto liquid_balance = get_currency_balance(chain, N(eosio.token)); + auto liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "1.0000 CUR") @@ -160,11 +160,11 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(eosio.token)); + liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); trace = chain.push_action(config::system_account_name, updateauth::get_name(), tester_account, fc::mutable_variant_object() @@ -179,7 +179,7 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_test ) { try { chain.produce_blocks(); - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "3.0000 CUR") @@ -191,37 +191,37 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_test ) { try { BOOST_REQUIRE_EQUAL(1, gen_size); BOOST_REQUIRE_EQUAL(0, trace->action_traces.size()); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); chain.produce_blocks(18); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("96.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("4.0000 CUR"), liquid_balance); } FC_LOG_AND_RETHROW() }/// schedule_test @@ -230,18 +230,18 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_test ) { try { BOOST_AUTO_TEST_CASE(delete_auth_test) { try { TESTER chain; - const auto& tester_account = N(tester); + const auto& tester_account = "tester"_n; chain.produce_blocks(); - chain.create_account(N(eosio.token)); + chain.create_account("eosio.token"_n); chain.produce_blocks(10); - chain.set_code(N(eosio.token), contracts::eosio_token_wasm()); - chain.set_abi(N(eosio.token), contracts::eosio_token_abi().data()); + chain.set_code("eosio.token"_n, contracts::eosio_token_wasm()); + chain.set_abi("eosio.token"_n, contracts::eosio_token_abi().data()); chain.produce_blocks(); - chain.create_account(N(tester)); - chain.create_account(N(tester2)); + chain.create_account("tester"_n); + chain.create_account("tester2"_n); chain.produce_blocks(10); transaction_trace_ptr trace; @@ -274,20 +274,20 @@ BOOST_AUTO_TEST_CASE(delete_auth_test) { try { // create CUR token chain.produce_blocks(); - chain.push_action(N(eosio.token), N(create), N(eosio.token), mutable_variant_object() + chain.push_action("eosio.token"_n, "create"_n, "eosio.token"_n, mutable_variant_object() ("issuer", "eosio.token" ) ("maximum_supply", "9000000.0000 CUR" ) ); // issue to account "eosio.token" - chain.push_action(N(eosio.token), name("issue"), N(eosio.token), fc::mutable_variant_object() + chain.push_action("eosio.token"_n, name("issue"), "eosio.token"_n, fc::mutable_variant_object() ("to", "eosio.token") ("quantity", "1000000.0000 CUR") ("memo", "for stuff") ); // transfer from eosio.token to tester - trace = chain.push_action(N(eosio.token), name("transfer"), N(eosio.token), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "eosio.token"_n, fc::mutable_variant_object() ("from", "eosio.token") ("to", "tester") ("quantity", "100.0000 CUR") @@ -297,12 +297,12 @@ BOOST_AUTO_TEST_CASE(delete_auth_test) { try { chain.produce_blocks(); - auto liquid_balance = get_currency_balance(chain, N(eosio.token)); + auto liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "1.0000 CUR") @@ -311,11 +311,11 @@ BOOST_AUTO_TEST_CASE(delete_auth_test) { try { BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace->receipt->status); - liquid_balance = get_currency_balance(chain, N(eosio.token)); + liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); // can't delete auth because it's linked @@ -345,7 +345,7 @@ BOOST_AUTO_TEST_CASE(delete_auth_test) { try { chain.produce_blocks(1);; - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "3.0000 CUR") @@ -355,9 +355,9 @@ BOOST_AUTO_TEST_CASE(delete_auth_test) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("96.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("4.0000 CUR"), liquid_balance); } FC_LOG_AND_RETHROW() }/// delete_auth_test @@ -367,18 +367,18 @@ BOOST_AUTO_TEST_CASE(delete_auth_test) { try { BOOST_AUTO_TEST_CASE( link_delay_direct_parent_permission_test ) { try { TESTER chain; - const auto& tester_account = N(tester); + const auto& tester_account = "tester"_n; chain.produce_blocks(); - chain.create_account(N(eosio.token)); + chain.create_account("eosio.token"_n); chain.produce_blocks(10); - chain.set_code(N(eosio.token), contracts::eosio_token_wasm()); - chain.set_abi(N(eosio.token), contracts::eosio_token_abi().data()); + chain.set_code("eosio.token"_n, contracts::eosio_token_wasm()); + chain.set_abi("eosio.token"_n, contracts::eosio_token_abi().data()); chain.produce_blocks(); - chain.create_account(N(tester)); - chain.create_account(N(tester2)); + chain.create_account("tester"_n); + chain.create_account("tester2"_n); chain.produce_blocks(10); chain.push_action(config::system_account_name, updateauth::get_name(), tester_account, fc::mutable_variant_object() @@ -394,18 +394,18 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_parent_permission_test ) { try { ("requirement", "first")); chain.produce_blocks(); - chain.push_action(N(eosio.token), N(create), N(eosio.token), mutable_variant_object() + chain.push_action("eosio.token"_n, "create"_n, "eosio.token"_n, mutable_variant_object() ("issuer", eosio_token) ("maximum_supply", "9000000.0000 CUR") ); - chain.push_action(N(eosio.token), name("issue"), N(eosio.token), fc::mutable_variant_object() + chain.push_action("eosio.token"_n, name("issue"), "eosio.token"_n, fc::mutable_variant_object() ("to", eosio_token) ("quantity", "1000000.0000 CUR") ("memo", "for stuff") ); - auto trace = chain.push_action(N(eosio.token), name("transfer"), N(eosio.token), fc::mutable_variant_object() + auto trace = chain.push_action("eosio.token"_n, name("transfer"), "eosio.token"_n, fc::mutable_variant_object() ("from", eosio_token) ("to", "tester") ("quantity", "100.0000 CUR") @@ -417,12 +417,12 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_parent_permission_test ) { try { chain.produce_blocks(); - auto liquid_balance = get_currency_balance(chain, N(eosio.token)); + auto liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "1.0000 CUR") @@ -435,11 +435,11 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_parent_permission_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(eosio.token)); + liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); trace = chain.push_action(config::system_account_name, updateauth::get_name(), tester_account, fc::mutable_variant_object() @@ -454,7 +454,7 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_parent_permission_test ) { try { chain.produce_blocks(); - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "3.0000 CUR") @@ -466,37 +466,37 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_parent_permission_test ) { try { BOOST_REQUIRE_EQUAL(1, gen_size); BOOST_REQUIRE_EQUAL(0, trace->action_traces.size()); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); chain.produce_blocks(28); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("96.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("4.0000 CUR"), liquid_balance); } FC_LOG_AND_RETHROW() }/// schedule_test @@ -505,18 +505,18 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_parent_permission_test ) { try { BOOST_AUTO_TEST_CASE( link_delay_direct_walk_parent_permissions_test ) { try { TESTER chain; - const auto& tester_account = N(tester); + const auto& tester_account = "tester"_n; chain.produce_blocks(); - chain.create_account(N(eosio.token)); + chain.create_account("eosio.token"_n); chain.produce_blocks(10); - chain.set_code(N(eosio.token), contracts::eosio_token_wasm()); - chain.set_abi(N(eosio.token), contracts::eosio_token_abi().data()); + chain.set_code("eosio.token"_n, contracts::eosio_token_wasm()); + chain.set_abi("eosio.token"_n, contracts::eosio_token_abi().data()); chain.produce_blocks(); - chain.create_account(N(tester)); - chain.create_account(N(tester2)); + chain.create_account("tester"_n); + chain.create_account("tester2"_n); chain.produce_blocks(10); chain.push_action(config::system_account_name, updateauth::get_name(), tester_account, fc::mutable_variant_object() @@ -538,18 +538,18 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_walk_parent_permissions_test ) { try { ("requirement", "second")); chain.produce_blocks(); - chain.push_action(N(eosio.token), N(create), N(eosio.token), mutable_variant_object() + chain.push_action("eosio.token"_n, "create"_n, "eosio.token"_n, mutable_variant_object() ("issuer", eosio_token) ("maximum_supply", "9000000.0000 CUR") ); - chain.push_action(N(eosio.token), name("issue"), N(eosio.token), fc::mutable_variant_object() + chain.push_action("eosio.token"_n, name("issue"), "eosio.token"_n, fc::mutable_variant_object() ("to", eosio_token) ("quantity", "1000000.0000 CUR") ("memo", "for stuff") ); - auto trace = chain.push_action(N(eosio.token), name("transfer"), N(eosio.token), fc::mutable_variant_object() + auto trace = chain.push_action("eosio.token"_n, name("transfer"), "eosio.token"_n, fc::mutable_variant_object() ("from", eosio_token) ("to", "tester") ("quantity", "100.0000 CUR") @@ -561,12 +561,12 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_walk_parent_permissions_test ) { try { chain.produce_blocks(); - auto liquid_balance = get_currency_balance(chain, N(eosio.token)); + auto liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "1.0000 CUR") @@ -579,11 +579,11 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_walk_parent_permissions_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(eosio.token)); + liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); trace = chain.push_action(config::system_account_name, updateauth::get_name(), tester_account, fc::mutable_variant_object() @@ -598,7 +598,7 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_walk_parent_permissions_test ) { try { chain.produce_blocks(); - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "3.0000 CUR") @@ -610,37 +610,37 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_walk_parent_permissions_test ) { try { BOOST_REQUIRE_EQUAL(1, gen_size); BOOST_REQUIRE_EQUAL(0, trace->action_traces.size()); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); chain.produce_blocks(38); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("96.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("4.0000 CUR"), liquid_balance); } FC_LOG_AND_RETHROW() }/// schedule_test @@ -649,18 +649,18 @@ BOOST_AUTO_TEST_CASE( link_delay_direct_walk_parent_permissions_test ) { try { BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try { TESTER chain; - const auto& tester_account = N(tester); + const auto& tester_account = "tester"_n; chain.produce_blocks(); - chain.create_account(N(eosio.token)); + chain.create_account("eosio.token"_n); chain.produce_blocks(10); - chain.set_code(N(eosio.token), contracts::eosio_token_wasm()); - chain.set_abi(N(eosio.token), contracts::eosio_token_abi().data()); + chain.set_code("eosio.token"_n, contracts::eosio_token_wasm()); + chain.set_abi("eosio.token"_n, contracts::eosio_token_abi().data()); chain.produce_blocks(); - chain.create_account(N(tester)); - chain.create_account(N(tester2)); + chain.create_account("tester"_n); + chain.create_account("tester2"_n); chain.produce_blocks(10); chain.push_action(config::system_account_name, updateauth::get_name(), tester_account, fc::mutable_variant_object() @@ -676,18 +676,18 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try { ("requirement", "first")); chain.produce_blocks(); - chain.push_action(N(eosio.token), N(create), N(eosio.token), mutable_variant_object() + chain.push_action("eosio.token"_n, "create"_n, "eosio.token"_n, mutable_variant_object() ("issuer", eosio_token ) ("maximum_supply", "9000000.0000 CUR" ) ); - chain.push_action(N(eosio.token), name("issue"), N(eosio.token), fc::mutable_variant_object() + chain.push_action("eosio.token"_n, name("issue"), "eosio.token"_n, fc::mutable_variant_object() ("to", eosio_token) ("quantity", "1000000.0000 CUR") ("memo", "for stuff") ); - auto trace = chain.push_action(N(eosio.token), name("transfer"), N(eosio.token), fc::mutable_variant_object() + auto trace = chain.push_action("eosio.token"_n, name("transfer"), "eosio.token"_n, fc::mutable_variant_object() ("from", eosio_token) ("to", "tester") ("quantity", "100.0000 CUR") @@ -699,13 +699,13 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try { chain.produce_blocks(); - auto liquid_balance = get_currency_balance(chain, N(eosio.token)); + auto liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); // this transaction will be delayed 20 blocks - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "1.0000 CUR") @@ -720,11 +720,11 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(eosio.token)); + liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); // this transaction will be delayed 20 blocks @@ -741,20 +741,20 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); chain.produce_blocks(16); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); // this transaction will be delayed 20 blocks - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "5.0000 CUR") @@ -768,16 +768,16 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); // first transfer will finally be performed @@ -786,9 +786,9 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try { gen_size = chain.control->db().get_index().size(); BOOST_CHECK_EQUAL(2, gen_size); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); // delayed update auth removing the delay will finally execute @@ -798,7 +798,7 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try { BOOST_CHECK_EQUAL(1, gen_size); // this transfer is performed right away since delay is removed - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "10.0000 CUR") @@ -808,16 +808,16 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("89.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); chain.produce_blocks(15); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("89.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); gen_size = chain.control->db().get_index().size(); @@ -829,9 +829,9 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try { gen_size = chain.control->db().get_index().size(); BOOST_CHECK_EQUAL(0, gen_size); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("84.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("16.0000 CUR"), liquid_balance); } FC_LOG_AND_RETHROW() }/// schedule_test @@ -840,18 +840,18 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_test ) { try { BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) { try { TESTER chain; - const auto& tester_account = N(tester); + const auto& tester_account = "tester"_n; chain.produce_blocks(); - chain.create_account(N(eosio.token)); + chain.create_account("eosio.token"_n); chain.produce_blocks(10); - chain.set_code(N(eosio.token), contracts::eosio_token_wasm()); - chain.set_abi(N(eosio.token), contracts::eosio_token_abi().data()); + chain.set_code("eosio.token"_n, contracts::eosio_token_wasm()); + chain.set_abi("eosio.token"_n, contracts::eosio_token_abi().data()); chain.produce_blocks(); - chain.create_account(N(tester)); - chain.create_account(N(tester2)); + chain.create_account("tester"_n); + chain.create_account("tester2"_n); chain.produce_blocks(10); chain.push_action(config::system_account_name, updateauth::get_name(), tester_account, fc::mutable_variant_object() @@ -873,18 +873,18 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) { ("requirement", "second")); chain.produce_blocks(); - chain.push_action(N(eosio.token), N(create), N(eosio.token), mutable_variant_object() + chain.push_action("eosio.token"_n, "create"_n, "eosio.token"_n, mutable_variant_object() ("issuer", eosio_token) ("maximum_supply", "9000000.0000 CUR" ) ); - chain.push_action(N(eosio.token), name("issue"), N(eosio.token), fc::mutable_variant_object() + chain.push_action("eosio.token"_n, name("issue"), "eosio.token"_n, fc::mutable_variant_object() ("to", eosio_token) ("quantity", "1000000.0000 CUR") ("memo", "for stuff") ); - auto trace = chain.push_action(N(eosio.token), name("transfer"), N(eosio.token), fc::mutable_variant_object() + auto trace = chain.push_action("eosio.token"_n, name("transfer"), "eosio.token"_n, fc::mutable_variant_object() ("from", eosio_token) ("to", "tester") ("quantity", "100.0000 CUR") @@ -896,13 +896,13 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) { chain.produce_blocks(); - auto liquid_balance = get_currency_balance(chain, N(eosio.token)); + auto liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); // this transaction will be delayed 20 blocks - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "1.0000 CUR") @@ -917,11 +917,11 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(eosio.token)); + liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); // this transaction will be delayed 20 blocks @@ -940,20 +940,20 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); chain.produce_blocks(16); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); // this transaction will be delayed 20 blocks - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "5.0000 CUR") @@ -968,30 +968,30 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); // first transfer will finally be performed chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); chain.produce_blocks(); // this transfer is performed right away since delay is removed - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "10.0000 CUR") @@ -1004,31 +1004,31 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("89.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); chain.produce_blocks(14); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("89.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("89.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); // second transfer finally is performed chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("84.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("16.0000 CUR"), liquid_balance); } FC_LOG_AND_RETHROW() }/// schedule_test @@ -1037,18 +1037,18 @@ BOOST_AUTO_TEST_CASE( link_delay_permission_change_with_delay_heirarchy_test ) { BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try { TESTER chain; - const auto& tester_account = N(tester); + const auto& tester_account = "tester"_n; chain.produce_blocks(); - chain.create_account(N(eosio.token)); + chain.create_account("eosio.token"_n); chain.produce_blocks(10); - chain.set_code(N(eosio.token), contracts::eosio_token_wasm()); - chain.set_abi(N(eosio.token), contracts::eosio_token_abi().data()); + chain.set_code("eosio.token"_n, contracts::eosio_token_wasm()); + chain.set_abi("eosio.token"_n, contracts::eosio_token_abi().data()); chain.produce_blocks(); - chain.create_account(N(tester)); - chain.create_account(N(tester2)); + chain.create_account("tester"_n); + chain.create_account("tester2"_n); chain.produce_blocks(10); chain.push_action(config::system_account_name, updateauth::get_name(), tester_account, fc::mutable_variant_object() @@ -1070,18 +1070,18 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try { ); chain.produce_blocks(); - chain.push_action(N(eosio.token), N(create), N(eosio.token), mutable_variant_object() + chain.push_action("eosio.token"_n, "create"_n, "eosio.token"_n, mutable_variant_object() ("issuer", eosio_token) ("maximum_supply", "9000000.0000 CUR" ) ); - chain.push_action(N(eosio.token), name("issue"), N(eosio.token), fc::mutable_variant_object() + chain.push_action("eosio.token"_n, name("issue"), "eosio.token"_n, fc::mutable_variant_object() ("to", eosio_token) ("quantity", "1000000.0000 CUR") ("memo", "for stuff") ); - auto trace = chain.push_action(N(eosio.token), name("transfer"), N(eosio.token), fc::mutable_variant_object() + auto trace = chain.push_action("eosio.token"_n, name("transfer"), "eosio.token"_n, fc::mutable_variant_object() ("from", eosio_token) ("to", "tester") ("quantity", "100.0000 CUR") @@ -1093,13 +1093,13 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try { chain.produce_blocks(); - auto liquid_balance = get_currency_balance(chain, N(eosio.token)); + auto liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); // this transaction will be delayed 20 blocks - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "1.0000 CUR") @@ -1113,16 +1113,16 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(eosio.token)); + liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); BOOST_REQUIRE_EXCEPTION( chain.push_action( config::system_account_name, linkauth::get_name(), - vector{permission_level{tester_account, N(first)}}, + vector{permission_level{tester_account, "first"_n}}, fc::mutable_variant_object() ("account", "tester") ("code", eosio_token) @@ -1135,7 +1135,7 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try { // this transaction will be delayed 20 blocks chain.push_action( config::system_account_name, linkauth::get_name(), - vector{{tester_account, N(first)}}, + vector{{tester_account, "first"_n}}, fc::mutable_variant_object() ("account", "tester") ("code", eosio_token) @@ -1150,20 +1150,20 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); chain.produce_blocks(16); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); // this transaction will be delayed 20 blocks - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "5.0000 CUR") @@ -1177,31 +1177,31 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); // first transfer will finally be performed chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); // delay on minimum permission of transfer is finally removed chain.produce_blocks(); // this transfer is performed right away since delay is removed - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "10.0000 CUR") @@ -1212,24 +1212,24 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try { BOOST_CHECK_EQUAL(1, gen_size); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("89.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); chain.produce_blocks(16); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("89.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); // second transfer finally is performed chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("84.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("16.0000 CUR"), liquid_balance); } FC_LOG_AND_RETHROW() }/// schedule_test @@ -1239,18 +1239,18 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_test ) { try { BOOST_AUTO_TEST_CASE( link_delay_unlink_test ) { try { TESTER chain; - const auto& tester_account = N(tester); + const auto& tester_account = "tester"_n; chain.produce_blocks(); - chain.create_account(N(eosio.token)); + chain.create_account("eosio.token"_n); chain.produce_blocks(10); - chain.set_code(N(eosio.token), contracts::eosio_token_wasm()); - chain.set_abi(N(eosio.token), contracts::eosio_token_abi().data()); + chain.set_code("eosio.token"_n, contracts::eosio_token_wasm()); + chain.set_abi("eosio.token"_n, contracts::eosio_token_abi().data()); chain.produce_blocks(); - chain.create_account(N(tester)); - chain.create_account(N(tester2)); + chain.create_account("tester"_n); + chain.create_account("tester2"_n); chain.produce_blocks(10); chain.push_action(config::system_account_name, updateauth::get_name(), tester_account, fc::mutable_variant_object() @@ -1266,18 +1266,18 @@ BOOST_AUTO_TEST_CASE( link_delay_unlink_test ) { try { ("requirement", "first")); chain.produce_blocks(); - chain.push_action(N(eosio.token), N(create), N(eosio.token), mutable_variant_object() + chain.push_action("eosio.token"_n, "create"_n, "eosio.token"_n, mutable_variant_object() ("issuer", eosio_token ) ("maximum_supply", "9000000.0000 CUR" ) ); - chain.push_action(N(eosio.token), name("issue"), N(eosio.token), fc::mutable_variant_object() + chain.push_action("eosio.token"_n, name("issue"), "eosio.token"_n, fc::mutable_variant_object() ("to", eosio_token) ("quantity", "1000000.0000 CUR") ("memo", "for stuff") ); - auto trace = chain.push_action(N(eosio.token), name("transfer"), N(eosio.token), fc::mutable_variant_object() + auto trace = chain.push_action("eosio.token"_n, name("transfer"), "eosio.token"_n, fc::mutable_variant_object() ("from", eosio_token) ("to", "tester") ("quantity", "100.0000 CUR") @@ -1287,13 +1287,13 @@ BOOST_AUTO_TEST_CASE( link_delay_unlink_test ) { try { chain.produce_blocks(); - auto liquid_balance = get_currency_balance(chain, N(eosio.token)); + auto liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); // this transaction will be delayed 20 blocks - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "1.0000 CUR") @@ -1307,16 +1307,16 @@ BOOST_AUTO_TEST_CASE( link_delay_unlink_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(eosio.token)); + liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); BOOST_REQUIRE_EXCEPTION( chain.push_action( config::system_account_name, unlinkauth::get_name(), - vector{{tester_account, N(first)}}, + vector{{tester_account, "first"_n}}, fc::mutable_variant_object() ("account", "tester") ("code", eosio_token) @@ -1341,20 +1341,20 @@ BOOST_AUTO_TEST_CASE( link_delay_unlink_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); chain.produce_blocks(16); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); // this transaction will be delayed 20 blocks - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "5.0000 CUR") @@ -1368,31 +1368,31 @@ BOOST_AUTO_TEST_CASE( link_delay_unlink_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); // first transfer will finally be performed chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); // the delayed unlinkauth finally occurs chain.produce_blocks(); // this transfer is performed right away since delay is removed - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "10.0000 CUR") @@ -1402,24 +1402,24 @@ BOOST_AUTO_TEST_CASE( link_delay_unlink_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("89.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); chain.produce_blocks(15); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("89.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); // second transfer finally is performed chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("84.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("16.0000 CUR"), liquid_balance); } FC_LOG_AND_RETHROW() }/// link_delay_unlink_test @@ -1428,18 +1428,18 @@ BOOST_AUTO_TEST_CASE( link_delay_unlink_test ) { try { BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try { TESTER chain; - const auto& tester_account = N(tester); + const auto& tester_account = "tester"_n; chain.produce_blocks(); - chain.create_account(N(eosio.token)); + chain.create_account("eosio.token"_n); chain.produce_blocks(10); - chain.set_code(N(eosio.token), contracts::eosio_token_wasm()); - chain.set_abi(N(eosio.token), contracts::eosio_token_abi().data()); + chain.set_code("eosio.token"_n, contracts::eosio_token_wasm()); + chain.set_abi("eosio.token"_n, contracts::eosio_token_abi().data()); chain.produce_blocks(); - chain.create_account(N(tester)); - chain.create_account(N(tester2)); + chain.create_account("tester"_n); + chain.create_account("tester2"_n); chain.produce_blocks(10); chain.push_action(config::system_account_name, updateauth::get_name(), tester_account, fc::mutable_variant_object() @@ -1467,18 +1467,18 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try { ); chain.produce_blocks(); - chain.push_action(N(eosio.token), N(create), N(eosio.token), mutable_variant_object() + chain.push_action("eosio.token"_n, "create"_n, "eosio.token"_n, mutable_variant_object() ("issuer", eosio_token) ("maximum_supply", "9000000.0000 CUR" ) ); - chain.push_action(N(eosio.token), name("issue"), N(eosio.token), fc::mutable_variant_object() + chain.push_action("eosio.token"_n, name("issue"), "eosio.token"_n, fc::mutable_variant_object() ("to", eosio_token) ("quantity", "1000000.0000 CUR") ("memo", "for stuff") ); - auto trace = chain.push_action(N(eosio.token), name("transfer"), N(eosio.token), fc::mutable_variant_object() + auto trace = chain.push_action("eosio.token"_n, name("transfer"), "eosio.token"_n, fc::mutable_variant_object() ("from", eosio_token) ("to", "tester") ("quantity", "100.0000 CUR") @@ -1490,13 +1490,13 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try { chain.produce_blocks(); - auto liquid_balance = get_currency_balance(chain, N(eosio.token)); + auto liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); // this transaction will be delayed 20 blocks - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "1.0000 CUR") @@ -1510,11 +1510,11 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(eosio.token)); + liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); // this transaction will be delayed 20 blocks @@ -1532,20 +1532,20 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); chain.produce_blocks(16); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); // this transaction will be delayed 20 blocks - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "5.0000 CUR") @@ -1559,31 +1559,31 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); // first transfer will finally be performed chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); // delay on minimum permission of transfer is finally removed chain.produce_blocks(); // this transfer is performed right away since delay is removed - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "10.0000 CUR") @@ -1593,24 +1593,24 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try { gen_size = chain.control->db().get_index().size(); BOOST_CHECK_EQUAL(1, gen_size); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("89.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); chain.produce_blocks(16); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("89.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("11.0000 CUR"), liquid_balance); // second transfer finally is performed chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("84.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("16.0000 CUR"), liquid_balance); } FC_LOG_AND_RETHROW() } /// link_delay_link_change_heirarchy_test @@ -1619,32 +1619,32 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try { BOOST_AUTO_TEST_CASE( mindelay_test ) { try { TESTER chain; - const auto& tester_account = N(tester); + const auto& tester_account = "tester"_n; chain.produce_blocks(); - chain.create_account(N(eosio.token)); + chain.create_account("eosio.token"_n); chain.produce_blocks(10); - chain.set_code(N(eosio.token), contracts::eosio_token_wasm()); - chain.set_abi(N(eosio.token), contracts::eosio_token_abi().data()); + chain.set_code("eosio.token"_n, contracts::eosio_token_wasm()); + chain.set_abi("eosio.token"_n, contracts::eosio_token_abi().data()); chain.produce_blocks(); - chain.create_account(N(tester)); - chain.create_account(N(tester2)); + chain.create_account("tester"_n); + chain.create_account("tester2"_n); chain.produce_blocks(10); - chain.push_action(N(eosio.token), N(create), N(eosio.token), mutable_variant_object() + chain.push_action("eosio.token"_n, "create"_n, "eosio.token"_n, mutable_variant_object() ("issuer", eosio_token) ("maximum_supply", "9000000.0000 CUR") ); - chain.push_action(N(eosio.token), name("issue"), N(eosio.token), fc::mutable_variant_object() + chain.push_action("eosio.token"_n, name("issue"), "eosio.token"_n, fc::mutable_variant_object() ("to", eosio_token) ("quantity", "1000000.0000 CUR") ("memo", "for stuff") ); - auto trace = chain.push_action(N(eosio.token), name("transfer"), N(eosio.token), fc::mutable_variant_object() + auto trace = chain.push_action("eosio.token"_n, name("transfer"), "eosio.token"_n, fc::mutable_variant_object() ("from", eosio_token) ("to", "tester") ("quantity", "100.0000 CUR") @@ -1656,12 +1656,12 @@ BOOST_AUTO_TEST_CASE( mindelay_test ) { try { chain.produce_blocks(); - auto liquid_balance = get_currency_balance(chain, N(eosio.token)); + auto liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "1.0000 CUR") @@ -1674,25 +1674,25 @@ BOOST_AUTO_TEST_CASE( mindelay_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(eosio.token)); + liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); // send transfer with delay_sec set to 10 - const auto& acnt = chain.control->db().get(N(eosio.token)); + const auto& acnt = chain.control->db().get("eosio.token"_n); const auto abi = acnt.get_abi(); chain::abi_serializer abis(abi, abi_serializer::create_yield_function( chain.abi_serializer_max_time )); - const auto a = chain.control->db().get(N(eosio.token)).get_abi(); + const auto a = chain.control->db().get("eosio.token"_n).get_abi(); string action_type_name = abis.get_action_type(name("transfer")); action act; - act.account = N(eosio.token); + act.account = "eosio.token"_n; act.name = name("transfer"); - act.authorization.push_back(permission_level{N(tester), config::active_name}); + act.authorization.push_back(permission_level{"tester"_n, config::active_name}); act.data = abis.variant_to_binary(action_type_name, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") @@ -1705,44 +1705,44 @@ BOOST_AUTO_TEST_CASE( mindelay_test ) { try { trx.actions.push_back(act); chain.set_transaction_headers(trx, 30, 10); - trx.sign(chain.get_private_key(N(tester), "active"), chain.control->get_chain_id()); + trx.sign(chain.get_private_key("tester"_n, "active"), chain.control->get_chain_id()); trace = chain.push_transaction(trx); BOOST_REQUIRE_EQUAL(transaction_receipt::delayed, trace->receipt->status); gen_size = chain.control->db().get_index().size(); BOOST_REQUIRE_EQUAL(1, gen_size); BOOST_REQUIRE_EQUAL(0, trace->action_traces.size()); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); chain.produce_blocks(18); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("99.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("1.0000 CUR"), liquid_balance); chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("96.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("4.0000 CUR"), liquid_balance); } FC_LOG_AND_RETHROW() }/// schedule_test @@ -1750,19 +1750,19 @@ BOOST_AUTO_TEST_CASE( mindelay_test ) { try { // test canceldelay action cancelling a delayed transaction BOOST_AUTO_TEST_CASE( canceldelay_test ) { try { TESTER chain; - const auto& tester_account = N(tester); + const auto& tester_account = "tester"_n; std::vector ids; chain.produce_blocks(); - chain.create_account(N(eosio.token)); + chain.create_account("eosio.token"_n); chain.produce_blocks(10); - chain.set_code(N(eosio.token), contracts::eosio_token_wasm()); - chain.set_abi(N(eosio.token), contracts::eosio_token_abi().data()); + chain.set_code("eosio.token"_n, contracts::eosio_token_wasm()); + chain.set_abi("eosio.token"_n, contracts::eosio_token_abi().data()); chain.produce_blocks(); - chain.create_account(N(tester)); - chain.create_account(N(tester2)); + chain.create_account("tester"_n); + chain.create_account("tester2"_n); chain.produce_blocks(10); chain.push_action(config::system_account_name, updateauth::get_name(), tester_account, fc::mutable_variant_object() @@ -1778,18 +1778,18 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try { ("requirement", "first")); chain.produce_blocks(); - chain.push_action(N(eosio.token), N(create), N(eosio.token), mutable_variant_object() + chain.push_action("eosio.token"_n, "create"_n, "eosio.token"_n, mutable_variant_object() ("issuer", eosio_token) ("maximum_supply", "9000000.0000 CUR") ); - chain.push_action(N(eosio.token), name("issue"), N(eosio.token), fc::mutable_variant_object() + chain.push_action("eosio.token"_n, name("issue"), "eosio.token"_n, fc::mutable_variant_object() ("to", eosio_token) ("quantity", "1000000.0000 CUR") ("memo", "for stuff") ); - auto trace = chain.push_action(N(eosio.token), name("transfer"), N(eosio.token), fc::mutable_variant_object() + auto trace = chain.push_action("eosio.token"_n, name("transfer"), "eosio.token"_n, fc::mutable_variant_object() ("from", eosio_token) ("to", "tester") ("quantity", "100.0000 CUR") @@ -1800,13 +1800,13 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try { BOOST_REQUIRE_EQUAL(0, gen_size); chain.produce_blocks(); - auto liquid_balance = get_currency_balance(chain, N(eosio.token)); + auto liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); // this transaction will be delayed 20 blocks - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "1.0000 CUR") @@ -1826,17 +1826,17 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(eosio.token)); + liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); BOOST_REQUIRE_EXCEPTION( chain.push_action( config::system_account_name, updateauth::get_name(), - vector{{tester_account, N(first)}}, + vector{{tester_account, "first"_n}}, fc::mutable_variant_object() ("account", "tester") ("permission", "first") @@ -1865,20 +1865,20 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); chain.produce_blocks(16); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); // this transaction will be delayed 20 blocks - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "5.0000 CUR") @@ -1894,18 +1894,18 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); // send canceldelay for first delayed transaction signed_transaction trx; - trx.actions.emplace_back(vector{{N(tester), config::active_name}}, - chain::canceldelay{{N(tester), config::active_name}, ids[0]}); + trx.actions.emplace_back(vector{{"tester"_n, config::active_name}}, + chain::canceldelay{{"tester"_n, config::active_name}, ids[0]}); chain.set_transaction_headers(trx); - trx.sign(chain.get_private_key(N(tester), "active"), chain.control->get_chain_id()); + trx.sign(chain.get_private_key("tester"_n, "active"), chain.control->get_chain_id()); trace = chain.push_transaction(trx); //wdump((fc::json::to_pretty_string(trace))); BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace->receipt->status); @@ -1918,9 +1918,9 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); gen_size = chain.control->db().get_index().size(); @@ -1937,13 +1937,13 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try { gen_size = chain.control->db().get_index().size(); BOOST_CHECK_EQUAL(1, gen_size); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); // this transfer is performed right away since delay is removed - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "10.0000 CUR") @@ -1957,9 +1957,9 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("90.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("10.0000 CUR"), liquid_balance); chain.produce_blocks(15); @@ -1967,9 +1967,9 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try { gen_size = chain.control->db().get_index().size(); BOOST_CHECK_EQUAL(1, gen_size); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("90.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("10.0000 CUR"), liquid_balance); // second transfer finally is performed @@ -1978,9 +1978,9 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try { gen_size = chain.control->db().get_index().size(); BOOST_CHECK_EQUAL(0, gen_size); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("85.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("15.0000 CUR"), liquid_balance); } FC_LOG_AND_RETHROW() } @@ -1988,18 +1988,18 @@ BOOST_AUTO_TEST_CASE( canceldelay_test ) { try { BOOST_AUTO_TEST_CASE( canceldelay_test2 ) { try { TESTER chain; - const auto& tester_account = N(tester); + const auto& tester_account = "tester"_n; chain.produce_blocks(); - chain.create_account(N(eosio.token)); + chain.create_account("eosio.token"_n); chain.produce_blocks(); - chain.set_code(N(eosio.token), contracts::eosio_token_wasm()); - chain.set_abi(N(eosio.token), contracts::eosio_token_abi().data()); + chain.set_code("eosio.token"_n, contracts::eosio_token_wasm()); + chain.set_abi("eosio.token"_n, contracts::eosio_token_abi().data()); chain.produce_blocks(); - chain.create_account(N(tester)); - chain.create_account(N(tester2)); + chain.create_account("tester"_n); + chain.create_account("tester2"_n); chain.produce_blocks(); chain.push_action(config::system_account_name, updateauth::get_name(), tester_account, fc::mutable_variant_object() @@ -2021,18 +2021,18 @@ BOOST_AUTO_TEST_CASE( canceldelay_test2 ) { try { ("requirement", "first")); chain.produce_blocks(); - chain.push_action(N(eosio.token), N(create), N(eosio.token), mutable_variant_object() + chain.push_action("eosio.token"_n, "create"_n, "eosio.token"_n, mutable_variant_object() ("issuer", eosio_token) ("maximum_supply", "9000000.0000 CUR") ); - chain.push_action(N(eosio.token), name("issue"), N(eosio.token), fc::mutable_variant_object() + chain.push_action("eosio.token"_n, name("issue"), "eosio.token"_n, fc::mutable_variant_object() ("to", eosio_token) ("quantity", "1000000.0000 CUR") ("memo", "for stuff") ); - auto trace = chain.push_action(N(eosio.token), name("transfer"), N(eosio.token), fc::mutable_variant_object() + auto trace = chain.push_action("eosio.token"_n, name("transfer"), "eosio.token"_n, fc::mutable_variant_object() ("from", eosio_token) ("to", "tester") ("quantity", "100.0000 CUR") @@ -2043,16 +2043,16 @@ BOOST_AUTO_TEST_CASE( canceldelay_test2 ) { try { BOOST_REQUIRE_EQUAL(0, gen_size); chain.produce_blocks(); - auto liquid_balance = get_currency_balance(chain, N(eosio.token)); + auto liquid_balance = get_currency_balance(chain, "eosio.token"_n); BOOST_REQUIRE_EQUAL(asset::from_string("999900.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); ilog("attempting first delayed transfer"); { // this transaction will be delayed 10 blocks - trace = chain.push_action(N(eosio.token), name("transfer"), vector{{N(tester), N(first)}}, fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), vector{{"tester"_n, "first"_n}}, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "1.0000 CUR") @@ -2071,18 +2071,18 @@ BOOST_AUTO_TEST_CASE( canceldelay_test2 ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); // attempt canceldelay with wrong canceling_auth for delayed transfer of 1.0000 CUR { signed_transaction trx; - trx.actions.emplace_back(vector{{N(tester), config::active_name}}, - chain::canceldelay{{N(tester), config::active_name}, trx_id}); + trx.actions.emplace_back(vector{{"tester"_n, config::active_name}}, + chain::canceldelay{{"tester"_n, config::active_name}, trx_id}); chain.set_transaction_headers(trx); - trx.sign(chain.get_private_key(N(tester), "active"), chain.control->get_chain_id()); + trx.sign(chain.get_private_key("tester"_n, "active"), chain.control->get_chain_id()); BOOST_REQUIRE_EXCEPTION( chain.push_transaction(trx), action_validate_exception, fc_exception_message_is("canceling_auth in canceldelay action was not found as authorization in the original delayed transaction") ); } @@ -2090,10 +2090,10 @@ BOOST_AUTO_TEST_CASE( canceldelay_test2 ) { try { // attempt canceldelay with "second" permission for delayed transfer of 1.0000 CUR { signed_transaction trx; - trx.actions.emplace_back(vector{{N(tester), N(second)}}, - chain::canceldelay{{N(tester), N(first)}, trx_id}); + trx.actions.emplace_back(vector{{"tester"_n, "second"_n}}, + chain::canceldelay{{"tester"_n, "first"_n}, trx_id}); chain.set_transaction_headers(trx); - trx.sign(chain.get_private_key(N(tester), "second"), chain.control->get_chain_id()); + trx.sign(chain.get_private_key("tester"_n, "second"), chain.control->get_chain_id()); BOOST_REQUIRE_THROW( chain.push_transaction(trx), irrelevant_auth_exception ); BOOST_REQUIRE_EXCEPTION( chain.push_transaction(trx), irrelevant_auth_exception, fc_exception_message_starts_with("canceldelay action declares irrelevant authority") ); @@ -2101,10 +2101,10 @@ BOOST_AUTO_TEST_CASE( canceldelay_test2 ) { try { // canceldelay with "active" permission for delayed transfer of 1.0000 CUR signed_transaction trx; - trx.actions.emplace_back(vector{{N(tester), config::active_name}}, - chain::canceldelay{{N(tester), N(first)}, trx_id}); + trx.actions.emplace_back(vector{{"tester"_n, config::active_name}}, + chain::canceldelay{{"tester"_n, "first"_n}, trx_id}); chain.set_transaction_headers(trx); - trx.sign(chain.get_private_key(N(tester), "active"), chain.control->get_chain_id()); + trx.sign(chain.get_private_key("tester"_n, "active"), chain.control->get_chain_id()); trace = chain.push_transaction(trx); BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace->receipt->status); @@ -2117,9 +2117,9 @@ BOOST_AUTO_TEST_CASE( canceldelay_test2 ) { try { chain.produce_blocks(10); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); } @@ -2139,7 +2139,7 @@ BOOST_AUTO_TEST_CASE( canceldelay_test2 ) { try { ilog("attempting second delayed transfer"); { // this transaction will be delayed 10 blocks - trace = chain.push_action(N(eosio.token), name("transfer"), vector{{N(tester), N(second)}}, fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), vector{{"tester"_n, "second"_n}}, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "5.0000 CUR") @@ -2158,17 +2158,17 @@ BOOST_AUTO_TEST_CASE( canceldelay_test2 ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); // canceldelay with "first" permission for delayed transfer of 5.0000 CUR signed_transaction trx; - trx.actions.emplace_back(vector{{N(tester), N(first)}}, - chain::canceldelay{{N(tester), N(second)}, trx_id}); + trx.actions.emplace_back(vector{{"tester"_n, "first"_n}}, + chain::canceldelay{{"tester"_n, "second"_n}, trx_id}); chain.set_transaction_headers(trx); - trx.sign(chain.get_private_key(N(tester), "first"), chain.control->get_chain_id()); + trx.sign(chain.get_private_key("tester"_n, "first"), chain.control->get_chain_id()); trace = chain.push_transaction(trx); BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace->receipt->status); @@ -2181,9 +2181,9 @@ BOOST_AUTO_TEST_CASE( canceldelay_test2 ) { try { chain.produce_blocks(10); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); } @@ -2191,7 +2191,7 @@ BOOST_AUTO_TEST_CASE( canceldelay_test2 ) { try { { // this transaction will be delayed 10 blocks - trace = chain.push_action(N(eosio.token), name("transfer"), vector{{N(tester), config::owner_name}}, fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), vector{{"tester"_n, config::owner_name}}, fc::mutable_variant_object() ("from", "tester") ("to", "tester2") ("quantity", "10.0000 CUR") @@ -2210,27 +2210,27 @@ BOOST_AUTO_TEST_CASE( canceldelay_test2 ) { try { chain.produce_blocks(); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); // attempt canceldelay with "active" permission for delayed transfer of 10.0000 CUR { signed_transaction trx; - trx.actions.emplace_back(vector{{N(tester), N(active)}}, - chain::canceldelay{{N(tester), config::owner_name}, trx_id}); + trx.actions.emplace_back(vector{{"tester"_n, "active"_n}}, + chain::canceldelay{{"tester"_n, config::owner_name}, trx_id}); chain.set_transaction_headers(trx); - trx.sign(chain.get_private_key(N(tester), "active"), chain.control->get_chain_id()); + trx.sign(chain.get_private_key("tester"_n, "active"), chain.control->get_chain_id()); BOOST_REQUIRE_THROW( chain.push_transaction(trx), irrelevant_auth_exception ); } // canceldelay with "owner" permission for delayed transfer of 10.0000 CUR signed_transaction trx; - trx.actions.emplace_back(vector{{N(tester), config::owner_name}}, - chain::canceldelay{{N(tester), config::owner_name}, trx_id}); + trx.actions.emplace_back(vector{{"tester"_n, config::owner_name}}, + chain::canceldelay{{"tester"_n, config::owner_name}, trx_id}); chain.set_transaction_headers(trx); - trx.sign(chain.get_private_key(N(tester), "owner"), chain.control->get_chain_id()); + trx.sign(chain.get_private_key("tester"_n, "owner"), chain.control->get_chain_id()); trace = chain.push_transaction(trx); BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace->receipt->status); @@ -2243,9 +2243,9 @@ BOOST_AUTO_TEST_CASE( canceldelay_test2 ) { try { chain.produce_blocks(10); - liquid_balance = get_currency_balance(chain, N(tester)); + liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("100.0000 CUR"), liquid_balance); - liquid_balance = get_currency_balance(chain, N(tester2)); + liquid_balance = get_currency_balance(chain, "tester2"_n); BOOST_REQUIRE_EQUAL(asset::from_string("0.0000 CUR"), liquid_balance); } } FC_LOG_AND_RETHROW() } @@ -2255,10 +2255,10 @@ BOOST_AUTO_TEST_CASE( max_transaction_delay_create ) { try { //assuming max transaction delay is 45 days (default in config.hpp) TESTER chain; - const auto& tester_account = N(tester); + const auto& tester_account = "tester"_n; chain.produce_blocks(); - chain.create_account(N(tester)); + chain.create_account("tester"_n); chain.produce_blocks(10); BOOST_REQUIRE_EXCEPTION( @@ -2277,21 +2277,21 @@ BOOST_AUTO_TEST_CASE( max_transaction_delay_execute ) { try { //assuming max transaction delay is 45 days (default in config.hpp) TESTER chain; - const auto& tester_account = N(tester); + const auto& tester_account = "tester"_n; - chain.create_account(N(eosio.token)); - chain.set_code(N(eosio.token), contracts::eosio_token_wasm()); - chain.set_abi(N(eosio.token), contracts::eosio_token_abi().data()); + chain.create_account("eosio.token"_n); + chain.set_code("eosio.token"_n, contracts::eosio_token_wasm()); + chain.set_abi("eosio.token"_n, contracts::eosio_token_abi().data()); chain.produce_blocks(); - chain.create_account(N(tester)); + chain.create_account("tester"_n); chain.produce_blocks(); - chain.push_action(N(eosio.token), N(create), N(eosio.token), mutable_variant_object() + chain.push_action("eosio.token"_n, "create"_n, "eosio.token"_n, mutable_variant_object() ("issuer", "eosio.token" ) ("maximum_supply", "9000000.0000 CUR" ) ); - chain.push_action(N(eosio.token), name("issue"), N(eosio.token), fc::mutable_variant_object() + chain.push_action("eosio.token"_n, name("issue"), "eosio.token"_n, fc::mutable_variant_object() ("to", "tester") ("quantity", "100.0000 CUR") ("memo", "for stuff") @@ -2318,12 +2318,12 @@ BOOST_AUTO_TEST_CASE( max_transaction_delay_execute ) { try { //change max_transaction_delay to 60 sec auto params = chain.control->get_global_properties().configuration; params.max_transaction_delay = 60; - chain.push_action( config::system_account_name, N(setparams), config::system_account_name, mutable_variant_object() + chain.push_action( config::system_account_name, "setparams"_n, config::system_account_name, mutable_variant_object() ("params", params) ); chain.produce_blocks(); //should be able to create transaction with delay 60 sec, despite permission delay being 30 days, because max_transaction_delay is 60 sec - trace = chain.push_action(N(eosio.token), name("transfer"), N(tester), fc::mutable_variant_object() + trace = chain.push_action("eosio.token"_n, name("transfer"), "tester"_n, fc::mutable_variant_object() ("from", "tester") ("to", "eosio.token") ("quantity", "9.0000 CUR") @@ -2342,7 +2342,7 @@ BOOST_AUTO_TEST_CASE( max_transaction_delay_execute ) { try { BOOST_CHECK_EQUAL(0, gen_size); //check that the transfer really happened - auto liquid_balance = get_currency_balance(chain, N(tester)); + auto liquid_balance = get_currency_balance(chain, "tester"_n); BOOST_REQUIRE_EQUAL(asset::from_string("91.0000 CUR"), liquid_balance); } FC_LOG_AND_RETHROW() } @@ -2356,7 +2356,7 @@ BOOST_AUTO_TEST_CASE( test_blockchain_params_enabled ) { try { auto params = chain.control->get_global_properties().configuration; params.max_transaction_delay = 60; chain.push_action(config::system_account_name, - N(setparams), + "setparams"_n, config::system_account_name, mutable_variant_object()("params", params) ); @@ -2371,7 +2371,7 @@ BOOST_FIXTURE_TEST_CASE( delay_expired, validating_tester) { try { produce_blocks(2); signed_transaction trx; - account_name a = N(newco); + account_name a = "newco"_n; account_name creator = config::system_account_name; auto owner_auth = authority( get_public_key( a, "owner" ) ); diff --git a/unittests/eosio.token_tests.cpp b/unittests/eosio.token_tests.cpp index 4a3045e1efa..29526fe1734 100644 --- a/unittests/eosio.token_tests.cpp +++ b/unittests/eosio.token_tests.cpp @@ -24,15 +24,15 @@ class eosio_token_tester : public tester { eosio_token_tester() { produce_blocks( 2 ); - create_accounts( { N(alice), N(bob), N(carol), N(eosio.token) } ); + create_accounts( { "alice"_n, "bob"_n, "carol"_n, "eosio.token"_n } ); produce_blocks( 2 ); - set_code( N(eosio.token), contracts::eosio_token_wasm() ); - set_abi( N(eosio.token), contracts::eosio_token_abi().data() ); + set_code( "eosio.token"_n, contracts::eosio_token_wasm() ); + set_abi( "eosio.token"_n, contracts::eosio_token_abi().data() ); produce_blocks(); - const auto& accnt = control->db().get( N(eosio.token) ); + const auto& accnt = control->db().get( "eosio.token"_n ); abi_def abi; BOOST_REQUIRE_EQUAL(abi_serializer::to_abi(accnt.abi, abi), true); abi_ser.set_abi(abi, abi_serializer::create_yield_function( abi_serializer_max_time )); @@ -42,7 +42,7 @@ class eosio_token_tester : public tester { string action_type_name = abi_ser.get_action_type(name); action act; - act.account = N(eosio.token); + act.account = "eosio.token"_n; act.name = name; act.data = abi_ser.variant_to_binary( action_type_name, data, abi_serializer::create_yield_function( abi_serializer_max_time ) ); @@ -53,7 +53,7 @@ class eosio_token_tester : public tester { { auto symb = eosio::chain::symbol::from_string(symbolname); auto symbol_code = symb.to_symbol_code().value; - vector data = get_row_by_account( N(eosio.token), name(symbol_code), N(stat), name(symbol_code) ); + vector data = get_row_by_account( "eosio.token"_n, name(symbol_code), "stat"_n, name(symbol_code) ); return data.empty() ? fc::variant() : abi_ser.binary_to_variant( "currency_stats", data, abi_serializer::create_yield_function( abi_serializer_max_time ) ); } @@ -61,21 +61,21 @@ class eosio_token_tester : public tester { { auto symb = eosio::chain::symbol::from_string(symbolname); auto symbol_code = symb.to_symbol_code().value; - vector data = get_row_by_account( N(eosio.token), acc, N(accounts), name(symbol_code) ); + vector data = get_row_by_account( "eosio.token"_n, acc, "accounts"_n, name(symbol_code) ); return data.empty() ? fc::variant() : abi_ser.binary_to_variant( "account", data, abi_serializer::create_yield_function( abi_serializer_max_time ) ); } action_result create( account_name issuer, asset maximum_supply ) { - return push_action( N(eosio.token), N(create), mvo() + return push_action( "eosio.token"_n, "create"_n, mvo() ( "issuer", issuer) ( "maximum_supply", maximum_supply) ); } action_result issue( account_name issuer, account_name to, asset quantity, string memo ) { - return push_action( issuer, N(issue), mvo() + return push_action( issuer, "issue"_n, mvo() ( "to", to) ( "quantity", quantity) ( "memo", memo) @@ -86,7 +86,7 @@ class eosio_token_tester : public tester { account_name to, asset quantity, string memo ) { - return push_action( from, N(transfer), mvo() + return push_action( from, "transfer"_n, mvo() ( "from", from) ( "to", to) ( "quantity", quantity) @@ -101,7 +101,7 @@ BOOST_AUTO_TEST_SUITE(eosio_token_tests) BOOST_FIXTURE_TEST_CASE( create_tests, eosio_token_tester ) try { - auto token = create( N(alice), asset::from_string("1000.000 TKN")); + auto token = create( "alice"_n, asset::from_string("1000.000 TKN")); auto stats = get_stats("3,TKN"); REQUIRE_MATCHING_OBJECT( stats, mvo() ("supply", "0.000 TKN") @@ -115,14 +115,14 @@ BOOST_FIXTURE_TEST_CASE( create_tests, eosio_token_tester ) try { BOOST_FIXTURE_TEST_CASE( create_negative_max_supply, eosio_token_tester ) try { BOOST_REQUIRE_EQUAL( wasm_assert_msg( "max-supply must be positive" ), - create( N(alice), asset::from_string("-1000.000 TKN")) + create( "alice"_n, asset::from_string("-1000.000 TKN")) ); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( symbol_already_exists, eosio_token_tester ) try { - auto token = create( N(alice), asset::from_string("100 TKN")); + auto token = create( "alice"_n, asset::from_string("100 TKN")); auto stats = get_stats("0,TKN"); REQUIRE_MATCHING_OBJECT( stats, mvo() ("supply", "0 TKN") @@ -132,14 +132,14 @@ BOOST_FIXTURE_TEST_CASE( symbol_already_exists, eosio_token_tester ) try { produce_blocks(1); BOOST_REQUIRE_EQUAL( wasm_assert_msg( "token with symbol already exists" ), - create( N(alice), asset::from_string("100 TKN")) + create( "alice"_n, asset::from_string("100 TKN")) ); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( create_max_supply, eosio_token_tester ) try { - auto token = create( N(alice), asset::from_string("4611686018427387903 TKN")); + auto token = create( "alice"_n, asset::from_string("4611686018427387903 TKN")); auto stats = get_stats("0,TKN"); REQUIRE_MATCHING_OBJECT( stats, mvo() ("supply", "0 TKN") @@ -154,7 +154,7 @@ BOOST_FIXTURE_TEST_CASE( create_max_supply, eosio_token_tester ) try { static_assert(std::is_trivially_copyable::value, "asset is not trivially copyable"); memcpy(&max, &amount, sizeof(share_type)); // hack in an invalid amount - BOOST_CHECK_EXCEPTION( create( N(alice), max) , asset_type_exception, [](const asset_type_exception& e) { + BOOST_CHECK_EXCEPTION( create( "alice"_n, max) , asset_type_exception, [](const asset_type_exception& e) { return expect_assert_message(e, "magnitude of asset amount must be less than 2^62"); }); @@ -163,7 +163,7 @@ BOOST_FIXTURE_TEST_CASE( create_max_supply, eosio_token_tester ) try { BOOST_FIXTURE_TEST_CASE( create_max_decimals, eosio_token_tester ) try { - auto token = create( N(alice), asset::from_string("1.000000000000000000 TKN")); + auto token = create( "alice"_n, asset::from_string("1.000000000000000000 TKN")); auto stats = get_stats("18,TKN"); REQUIRE_MATCHING_OBJECT( stats, mvo() ("supply", "0.000000000000000000 TKN") @@ -179,7 +179,7 @@ BOOST_FIXTURE_TEST_CASE( create_max_decimals, eosio_token_tester ) try { static_assert(std::is_trivially_copyable::value, "asset is not trivially copyable"); memcpy(&max, &amount, sizeof(share_type)); // hack in an invalid amount - BOOST_CHECK_EXCEPTION( create( N(alice), max) , asset_type_exception, [](const asset_type_exception& e) { + BOOST_CHECK_EXCEPTION( create( "alice"_n, max) , asset_type_exception, [](const asset_type_exception& e) { return expect_assert_message(e, "magnitude of asset amount must be less than 2^62"); }); @@ -187,10 +187,10 @@ BOOST_FIXTURE_TEST_CASE( create_max_decimals, eosio_token_tester ) try { BOOST_FIXTURE_TEST_CASE( issue_tests, eosio_token_tester ) try { - auto token = create( N(alice), asset::from_string("1000.000 TKN")); + auto token = create( "alice"_n, asset::from_string("1000.000 TKN")); produce_blocks(1); - issue( N(alice), N(alice), asset::from_string("500.000 TKN"), "hola" ); + issue( "alice"_n, "alice"_n, asset::from_string("500.000 TKN"), "hola" ); auto stats = get_stats("3,TKN"); REQUIRE_MATCHING_OBJECT( stats, mvo() @@ -199,21 +199,21 @@ BOOST_FIXTURE_TEST_CASE( issue_tests, eosio_token_tester ) try { ("issuer", "alice") ); - auto alice_balance = get_account(N(alice), "3,TKN"); + auto alice_balance = get_account("alice"_n, "3,TKN"); REQUIRE_MATCHING_OBJECT( alice_balance, mvo() ("balance", "500.000 TKN") ); BOOST_REQUIRE_EQUAL( wasm_assert_msg( "quantity exceeds available supply" ), - issue( N(alice), N(alice), asset::from_string("500.001 TKN"), "hola" ) + issue( "alice"_n, "alice"_n, asset::from_string("500.001 TKN"), "hola" ) ); BOOST_REQUIRE_EQUAL( wasm_assert_msg( "must issue positive quantity" ), - issue( N(alice), N(alice), asset::from_string("-1.000 TKN"), "hola" ) + issue( "alice"_n, "alice"_n, asset::from_string("-1.000 TKN"), "hola" ) ); BOOST_REQUIRE_EQUAL( success(), - issue( N(alice), N(alice), asset::from_string("1.000 TKN"), "hola" ) + issue( "alice"_n, "alice"_n, asset::from_string("1.000 TKN"), "hola" ) ); @@ -221,10 +221,10 @@ BOOST_FIXTURE_TEST_CASE( issue_tests, eosio_token_tester ) try { BOOST_FIXTURE_TEST_CASE( transfer_tests, eosio_token_tester ) try { - auto token = create( N(alice), asset::from_string("1000 CERO")); + auto token = create( "alice"_n, asset::from_string("1000 CERO")); produce_blocks(1); - issue( N(alice), N(alice), asset::from_string("1000 CERO"), "hola" ); + issue( "alice"_n, "alice"_n, asset::from_string("1000 CERO"), "hola" ); auto stats = get_stats("0,CERO"); REQUIRE_MATCHING_OBJECT( stats, mvo() @@ -233,21 +233,21 @@ BOOST_FIXTURE_TEST_CASE( transfer_tests, eosio_token_tester ) try { ("issuer", "alice") ); - auto alice_balance = get_account(N(alice), "0,CERO"); + auto alice_balance = get_account("alice"_n, "0,CERO"); REQUIRE_MATCHING_OBJECT( alice_balance, mvo() ("balance", "1000 CERO") ); - transfer( N(alice), N(bob), asset::from_string("300 CERO"), "hola" ); + transfer( "alice"_n, "bob"_n, asset::from_string("300 CERO"), "hola" ); - alice_balance = get_account(N(alice), "0,CERO"); + alice_balance = get_account("alice"_n, "0,CERO"); REQUIRE_MATCHING_OBJECT( alice_balance, mvo() ("balance", "700 CERO") ("frozen", 0) ("whitelist", 1) ); - auto bob_balance = get_account(N(bob), "0,CERO"); + auto bob_balance = get_account("bob"_n, "0,CERO"); REQUIRE_MATCHING_OBJECT( bob_balance, mvo() ("balance", "300 CERO") ("frozen", 0) @@ -255,11 +255,11 @@ BOOST_FIXTURE_TEST_CASE( transfer_tests, eosio_token_tester ) try { ); BOOST_REQUIRE_EQUAL( wasm_assert_msg( "overdrawn balance" ), - transfer( N(alice), N(bob), asset::from_string("701 CERO"), "hola" ) + transfer( "alice"_n, "bob"_n, asset::from_string("701 CERO"), "hola" ) ); BOOST_REQUIRE_EQUAL( wasm_assert_msg( "must transfer positive quantity" ), - transfer( N(alice), N(bob), asset::from_string("-1000 CERO"), "hola" ) + transfer( "alice"_n, "bob"_n, asset::from_string("-1000 CERO"), "hola" ) ); diff --git a/unittests/eosio_system_tester.hpp b/unittests/eosio_system_tester.hpp index 019bbe88c65..17425fdb198 100644 --- a/unittests/eosio_system_tester.hpp +++ b/unittests/eosio_system_tester.hpp @@ -35,29 +35,29 @@ class eosio_system_tester : public TESTER { produce_blocks( 2 ); - create_accounts({ N(eosio.token), N(eosio.ram), N(eosio.ramfee), N(eosio.stake), - N(eosio.bpay), N(eosio.vpay), N(eosio.saving), N(eosio.names) }); + create_accounts({ "eosio.token"_n, "eosio.ram"_n, "eosio.ramfee"_n, "eosio.stake"_n, + "eosio.bpay"_n, "eosio.vpay"_n, "eosio.saving"_n, "eosio.names"_n }); produce_blocks( 100 ); - set_code( N(eosio.token), contracts::eosio_token_wasm() ); - set_abi( N(eosio.token), contracts::eosio_token_abi().data() ); + set_code( "eosio.token"_n, contracts::eosio_token_wasm() ); + set_abi( "eosio.token"_n, contracts::eosio_token_abi().data() ); { - const auto& accnt = control->db().get( N(eosio.token) ); + const auto& accnt = control->db().get( "eosio.token"_n ); abi_def abi; BOOST_REQUIRE_EQUAL(abi_serializer::to_abi(accnt.abi, abi), true); token_abi_ser.set_abi(abi, abi_serializer::create_yield_function( abi_serializer_max_time )); } - create_currency( N(eosio.token), config::system_account_name, core_from_string("10000000000.0000") ); + create_currency( "eosio.token"_n, config::system_account_name, core_from_string("10000000000.0000") ); issue(config::system_account_name, core_from_string("1000000000.0000")); BOOST_REQUIRE_EQUAL( core_from_string("1000000000.0000"), get_balance( name("eosio") ) ); set_code( config::system_account_name, contracts::eosio_system_wasm() ); set_abi( config::system_account_name, contracts::eosio_system_abi().data() ); - base_tester::push_action(config::system_account_name, N(init), + base_tester::push_action(config::system_account_name, "init"_n, config::system_account_name, mutable_variant_object() ("version", 0) ("core", CORE_SYM_STR)); @@ -71,9 +71,9 @@ class eosio_system_tester : public TESTER { produce_blocks(); - create_account_with_resources( N(alice1111111), config::system_account_name, core_from_string("1.0000"), false ); - create_account_with_resources( N(bob111111111), config::system_account_name, core_from_string("0.4500"), false ); - create_account_with_resources( N(carol1111111), config::system_account_name, core_from_string("1.0000"), false ); + create_account_with_resources( "alice1111111"_n, config::system_account_name, core_from_string("1.0000"), false ); + create_account_with_resources( "bob111111111"_n, config::system_account_name, core_from_string("0.4500"), false ); + create_account_with_resources( "carol1111111"_n, config::system_account_name, core_from_string("1.0000"), false ); BOOST_REQUIRE_EQUAL( core_from_string("1000000000.0000"), get_balance(name("eosio")) + get_balance(name("eosio.ramfee")) + get_balance(name("eosio.stake")) + get_balance(name("eosio.ram")) ); @@ -82,7 +82,7 @@ class eosio_system_tester : public TESTER { action_result open( account_name owner, const string& symbolname, account_name ram_payer ) { - return push_action( ram_payer, N(open), mvo() + return push_action( ram_payer, "open"_n, mvo() ( "owner", owner ) ( "symbol", symbolname ) ( "ram_payer", ram_payer ) @@ -110,13 +110,13 @@ class eosio_system_tester : public TESTER { .active = authority( get_public_key( a, "active" ) ) }); - trx.actions.emplace_back( get_action( config::system_account_name, N(buyrambytes), vector{{creator,config::active_name}}, + trx.actions.emplace_back( get_action( config::system_account_name, "buyrambytes"_n, vector{{creator,config::active_name}}, mvo() ("payer", creator) ("receiver", a) ("bytes", ram_bytes) ) ); - trx.actions.emplace_back( get_action( config::system_account_name, N(delegatebw), vector{{creator,config::active_name}}, + trx.actions.emplace_back( get_action( config::system_account_name, "delegatebw"_n, vector{{creator,config::active_name}}, mvo() ("from", creator) ("receiver", a) @@ -152,14 +152,14 @@ class eosio_system_tester : public TESTER { .active = authority( get_public_key( a, "active" ) ) }); - trx.actions.emplace_back( get_action( config::system_account_name, N(buyram), vector{{creator,config::active_name}}, + trx.actions.emplace_back( get_action( config::system_account_name, "buyram"_n, vector{{creator,config::active_name}}, mvo() ("payer", creator) ("receiver", a) ("quant", ramfunds) ) ); - trx.actions.emplace_back( get_action( config::system_account_name, N(delegatebw), vector{{creator,config::active_name}}, + trx.actions.emplace_back( get_action( config::system_account_name, "delegatebw"_n, vector{{creator,config::active_name}}, mvo() ("from", creator) ("receiver", a) @@ -192,14 +192,14 @@ class eosio_system_tester : public TESTER { .active = authority( get_public_key( a, "active" ) ) }); - trx.actions.emplace_back( get_action( config::system_account_name, N(buyram), vector{ {creator, config::active_name} }, + trx.actions.emplace_back( get_action( config::system_account_name, "buyram"_n, vector{ {creator, config::active_name} }, mvo() ("payer", creator) ("receiver", a) ("quant", ram) ) ); - trx.actions.emplace_back( get_action( config::system_account_name, N(delegatebw), vector{ {creator, config::active_name} }, + trx.actions.emplace_back( get_action( config::system_account_name, "delegatebw"_n, vector{ {creator, config::active_name} }, mvo() ("from", creator) ("receiver", a) @@ -216,14 +216,14 @@ class eosio_system_tester : public TESTER { } action_result buyram( const account_name& payer, account_name receiver, const asset& eosin ) { - return push_action( payer, N(buyram), mvo()( "payer",payer)("receiver",receiver)("quant",eosin) ); + return push_action( payer, "buyram"_n, mvo()( "payer",payer)("receiver",receiver)("quant",eosin) ); } action_result buyrambytes( const account_name& payer, account_name receiver, uint32_t numbytes ) { - return push_action( payer, N(buyrambytes), mvo()( "payer",payer)("receiver",receiver)("bytes",numbytes) ); + return push_action( payer, "buyrambytes"_n, mvo()( "payer",payer)("receiver",receiver)("bytes",numbytes) ); } action_result sellram( const account_name& account, uint64_t numbytes ) { - return push_action( account, N(sellram), mvo()( "account", account)("bytes",numbytes) ); + return push_action( account, "sellram"_n, mvo()( "account", account)("bytes",numbytes) ); } action_result push_action( const account_name& signer, const action_name &name, const variant_object &data, bool auth = true ) { @@ -235,11 +235,11 @@ class eosio_system_tester : public TESTER { act.data = abi_ser.variant_to_binary( action_type_name, data, abi_serializer::create_yield_function( abi_serializer_max_time ) ); return base_tester::push_action( std::move(act), auth ? signer.to_uint64_t() : - signer == N(bob111111111) ? N(alice1111111).to_uint64_t() : N(bob111111111).to_uint64_t() ); + signer == "bob111111111"_n ? "alice1111111"_n.to_uint64_t() : "bob111111111"_n.to_uint64_t() ); } action_result stake( const account_name& from, const account_name& to, const asset& net, const asset& cpu ) { - return push_action( name(from), N(delegatebw), mvo() + return push_action( name(from), "delegatebw"_n, mvo() ("from", from) ("receiver", to) ("stake_net_quantity", net) @@ -253,7 +253,7 @@ class eosio_system_tester : public TESTER { } action_result stake_with_transfer( const account_name& from, const account_name& to, const asset& net, const asset& cpu ) { - return push_action( name(from), N(delegatebw), mvo() + return push_action( name(from), "delegatebw"_n, mvo() ("from", from) ("receiver", to) ("stake_net_quantity", net) @@ -267,7 +267,7 @@ class eosio_system_tester : public TESTER { } action_result unstake( const account_name& from, const account_name& to, const asset& net, const asset& cpu ) { - return push_action( name(from), N(undelegatebw), mvo() + return push_action( name(from), "undelegatebw"_n, mvo() ("from", from) ("receiver", to) ("unstake_net_quantity", net) @@ -280,7 +280,7 @@ class eosio_system_tester : public TESTER { } action_result bidname( const account_name& bidder, const account_name& newname, const asset& bid ) { - return push_action( name(bidder), N(bidname), mvo() + return push_action( name(bidder), "bidname"_n, mvo() ("bidder", bidder) ("newname", newname) ("bid", bid) @@ -311,7 +311,7 @@ class eosio_system_tester : public TESTER { } action_result regproducer( const account_name& acnt, int params_fixture = 1 ) { - action_result r = push_action( acnt, N(regproducer), mvo() + action_result r = push_action( acnt, "regproducer"_n, mvo() ("producer", acnt ) ("producer_key", get_public_key( acnt, "active" ) ) ("url", "" ) @@ -322,7 +322,7 @@ class eosio_system_tester : public TESTER { } action_result vote( const account_name& voter, const std::vector& producers, const account_name& proxy = name(0) ) { - return push_action(voter, N(voteproducer), mvo() + return push_action(voter, "voteproducer"_n, mvo() ("voter", voter) ("proxy", proxy) ("producers", producers)); @@ -333,22 +333,22 @@ class eosio_system_tester : public TESTER { } asset get_balance( const account_name& act ) { - vector data = get_row_by_account( N(eosio.token), act, N(accounts), name(symbol(CORE_SYMBOL).to_symbol_code().value) ); + vector data = get_row_by_account( "eosio.token"_n, act, "accounts"_n, name(symbol(CORE_SYMBOL).to_symbol_code().value) ); return data.empty() ? asset(0, symbol(CORE_SYMBOL)) : token_abi_ser.binary_to_variant("account", data, abi_serializer::create_yield_function( abi_serializer_max_time ))["balance"].as(); } fc::variant get_total_stake( const account_name& act ) { - vector data = get_row_by_account( config::system_account_name, act, N(userres), act ); + vector data = get_row_by_account( config::system_account_name, act, "userres"_n, act ); return data.empty() ? fc::variant() : abi_ser.binary_to_variant( "user_resources", data, abi_serializer::create_yield_function( abi_serializer_max_time ) ); } fc::variant get_voter_info( const account_name& act ) { - vector data = get_row_by_account( config::system_account_name, config::system_account_name, N(voters), act ); + vector data = get_row_by_account( config::system_account_name, config::system_account_name, "voters"_n, act ); return data.empty() ? fc::variant() : abi_ser.binary_to_variant( "voter_info", data, abi_serializer::create_yield_function( abi_serializer_max_time ) ); } fc::variant get_producer_info( const account_name& act ) { - vector data = get_row_by_account( config::system_account_name, config::system_account_name, N(producers), act ); + vector data = get_row_by_account( config::system_account_name, config::system_account_name, "producers"_n, act ); return abi_ser.binary_to_variant( "producer_info", data, abi_serializer::create_yield_function( abi_serializer_max_time ) ); } @@ -357,18 +357,18 @@ class eosio_system_tester : public TESTER { ("issuer", manager ) ("maximum_supply", maxsupply ); - base_tester::push_action(contract, N(create), contract, act ); + base_tester::push_action(contract, "create"_n, contract, act ); } void issue( name to, const asset& amount, name manager = config::system_account_name ) { - base_tester::push_action( N(eosio.token), N(issue), manager, mutable_variant_object() + base_tester::push_action( "eosio.token"_n, "issue"_n, manager, mutable_variant_object() ("to", to ) ("quantity", amount ) ("memo", "") ); } void transfer( name from, name to, const asset& amount, name manager = config::system_account_name ) { - base_tester::push_action( N(eosio.token), N(transfer), manager, mutable_variant_object() + base_tester::push_action( "eosio.token"_n, "transfer"_n, manager, mutable_variant_object() ("from", from) ("to", to ) ("quantity", amount) @@ -388,7 +388,7 @@ class eosio_system_tester : public TESTER { fc::variant get_stats( const string& symbolname ) { auto symb = eosio::chain::symbol::from_string(symbolname); auto symbol_code = symb.to_symbol_code().value; - vector data = get_row_by_account( N(eosio.token), name(symbol_code), N(stat), name(symbol_code) ); + vector data = get_row_by_account( "eosio.token"_n, name(symbol_code), "stat"_n, name(symbol_code) ); return data.empty() ? fc::variant() : token_abi_ser.binary_to_variant( "currency_stats", data, abi_serializer::create_yield_function( abi_serializer_max_time ) ); } @@ -397,35 +397,35 @@ class eosio_system_tester : public TESTER { } fc::variant get_global_state() { - vector data = get_row_by_account( config::system_account_name, config::system_account_name, N(global), N(global) ); + vector data = get_row_by_account( config::system_account_name, config::system_account_name, "global"_n, "global"_n ); if (data.empty()) std::cout << "\nData is empty\n" << std::endl; return data.empty() ? fc::variant() : abi_ser.binary_to_variant( "eosio_global_state", data, abi_serializer::create_yield_function( abi_serializer_max_time ) ); } fc::variant get_refund_request( name account ) { - vector data = get_row_by_account( config::system_account_name, account, N(refunds), account ); + vector data = get_row_by_account( config::system_account_name, account, "refunds"_n, account ); return data.empty() ? fc::variant() : abi_ser.binary_to_variant( "refund_request", data, abi_serializer::create_yield_function( abi_serializer_max_time ) ); } abi_serializer initialize_multisig() { abi_serializer msig_abi_ser; { - create_account_with_resources( N(eosio.msig), config::system_account_name ); + create_account_with_resources( "eosio.msig"_n, config::system_account_name ); BOOST_REQUIRE_EQUAL( success(), buyram( name("eosio"), name("eosio.msig"), core_from_string("5000.0000") ) ); produce_block(); - auto trace = base_tester::push_action(config::system_account_name, N(setpriv), + auto trace = base_tester::push_action(config::system_account_name, "setpriv"_n, config::system_account_name, mutable_variant_object() ("account", "eosio.msig") ("is_priv", 1) ); - set_code( N(eosio.msig), contracts::eosio_msig_wasm() ); - set_abi( N(eosio.msig), contracts::eosio_msig_abi().data() ); + set_code( "eosio.msig"_n, contracts::eosio_msig_wasm() ); + set_abi( "eosio.msig"_n, contracts::eosio_msig_abi().data() ); produce_blocks(); - const auto& accnt = control->db().get( N(eosio.msig) ); + const auto& accnt = control->db().get( "eosio.msig"_n ); abi_def msig_abi; BOOST_REQUIRE_EQUAL(abi_serializer::to_abi(accnt.abi, msig_abi), true); msig_abi_ser.set_abi(msig_abi, abi_serializer::create_yield_function( abi_serializer_max_time )); @@ -471,7 +471,7 @@ class eosio_system_tester : public TESTER { transfer( config::system_account_name, name("alice1111111"), core_from_string("100000000.0000"), config::system_account_name ); BOOST_REQUIRE_EQUAL(success(), stake( name("alice1111111"), core_from_string("30000000.0000"), core_from_string("30000000.0000") ) ); BOOST_REQUIRE_EQUAL(success(), buyram( name("alice1111111"), name("alice1111111"), core_from_string("30000000.0000") ) ); - BOOST_REQUIRE_EQUAL(success(), push_action(N(alice1111111), N(voteproducer), mvo() + BOOST_REQUIRE_EQUAL(success(), push_action("alice1111111"_n, "voteproducer"_n, mvo() ("voter", "alice1111111") ("proxy", name(0).to_string()) ("producers", vector(producer_names.begin(), producer_names.begin()+21)) @@ -488,13 +488,13 @@ class eosio_system_tester : public TESTER { } void cross_15_percent_threshold() { - setup_producer_accounts({N(producer1111)}); - regproducer(N(producer1111)); + setup_producer_accounts({"producer1111"_n}); + regproducer("producer1111"_n); { signed_transaction trx; set_transaction_headers(trx); - trx.actions.emplace_back( get_action( config::system_account_name, N(delegatebw), + trx.actions.emplace_back( get_action( config::system_account_name, "delegatebw"_n, vector{{config::system_account_name, config::active_name}}, mvo() ("from", name{config::system_account_name}) @@ -504,16 +504,16 @@ class eosio_system_tester : public TESTER { ("transfer", 1 ) ) ); - trx.actions.emplace_back( get_action( config::system_account_name, N(voteproducer), - vector{{N(producer1111), config::active_name}}, + trx.actions.emplace_back( get_action( config::system_account_name, "voteproducer"_n, + vector{{"producer1111"_n, config::active_name}}, mvo() ("voter", "producer1111") ("proxy", name(0).to_string()) - ("producers", vector(1, N(producer1111))) + ("producers", vector(1, "producer1111"_n)) ) ); - trx.actions.emplace_back( get_action( config::system_account_name, N(undelegatebw), - vector{{N(producer1111), config::active_name}}, + trx.actions.emplace_back( get_action( config::system_account_name, "undelegatebw"_n, + vector{{"producer1111"_n, config::active_name}}, mvo() ("from", "producer1111") ("receiver", "producer1111") @@ -524,7 +524,7 @@ class eosio_system_tester : public TESTER { set_transaction_headers(trx); trx.sign( get_private_key( config::system_account_name, "active" ), control->get_chain_id() ); - trx.sign( get_private_key( N(producer1111), "active" ), control->get_chain_id() ); + trx.sign( get_private_key( "producer1111"_n, "active" ), control->get_chain_id() ); push_transaction( trx ); } } diff --git a/unittests/forked_tests.cpp b/unittests/forked_tests.cpp index dea998a5f90..6c178d08940 100644 --- a/unittests/forked_tests.cpp +++ b/unittests/forked_tests.cpp @@ -22,8 +22,8 @@ BOOST_AUTO_TEST_SUITE(forked_tests) BOOST_AUTO_TEST_CASE( irrblock ) try { tester c; c.produce_blocks(10); - auto r = c.create_accounts( {N(dan),N(sam),N(pam),N(scott)} ); - auto res = c.set_producers( {N(dan),N(sam),N(pam),N(scott)} ); + auto r = c.create_accounts( {"dan"_n,"sam"_n,"pam"_n,"scott"_n} ); + auto res = c.set_producers( {"dan"_n,"sam"_n,"pam"_n,"scott"_n} ); wlog("set producer schedule to [dan,sam,pam]"); c.produce_blocks(50); @@ -39,13 +39,13 @@ BOOST_AUTO_TEST_CASE( fork_with_bad_block ) try { tester bios; bios.produce_block(); bios.produce_block(); - bios.create_accounts( {N(a),N(b),N(c),N(d),N(e)} ); + bios.create_accounts( {"a"_n,"b"_n,"c"_n,"d"_n,"e"_n} ); bios.produce_block(); - auto res = bios.set_producers( {N(a),N(b),N(c),N(d),N(e)} ); + auto res = bios.set_producers( {"a"_n,"b"_n,"c"_n,"d"_n,"e"_n} ); // run until the producers are installed and its the start of "a's" round - BOOST_REQUIRE( produce_until_transition( bios, N(e), N(a) ) ); + BOOST_REQUIRE( produce_until_transition( bios, "e"_n, "a"_n ) ); // sync remote node tester remote(setup_policy::none); @@ -84,7 +84,7 @@ BOOST_AUTO_TEST_CASE( fork_with_bad_block ) try { // re-sign the block auto header_bmroot = digest_type::hash( std::make_pair( copy_b->digest(), fork.block_merkle.get_root() ) ); auto sig_digest = digest_type::hash( std::make_pair(header_bmroot, remote.control->head_block_state()->pending_schedule.schedule_hash) ); - copy_b->producer_signature = remote.get_private_key(N(b), "active").sign(sig_digest); + copy_b->producer_signature = remote.get_private_key("b"_n, "active").sign(sig_digest); // add this new block to our corrupted block merkle fork.block_merkle.append(copy_b->calculate_id()); @@ -131,34 +131,34 @@ BOOST_AUTO_TEST_CASE( forking ) try { while (c.control->head_block_num() < 3) { c.produce_block(); } - auto r = c.create_accounts( {N(dan),N(sam),N(pam)} ); + auto r = c.create_accounts( {"dan"_n,"sam"_n,"pam"_n} ); wdump((fc::json::to_pretty_string(r))); c.produce_block(); - auto res = c.set_producers( {N(dan),N(sam),N(pam)} ); + auto res = c.set_producers( {"dan"_n,"sam"_n,"pam"_n} ); wdump((fc::json::to_pretty_string(res))); wlog("set producer schedule to [dan,sam,pam]"); c.produce_blocks(30); - auto r2 = c.create_accounts( {N(eosio.token)} ); + auto r2 = c.create_accounts( {"eosio.token"_n} ); wdump((fc::json::to_pretty_string(r2))); - c.set_code( N(eosio.token), contracts::eosio_token_wasm() ); - c.set_abi( N(eosio.token), contracts::eosio_token_abi().data() ); + c.set_code( "eosio.token"_n, contracts::eosio_token_wasm() ); + c.set_abi( "eosio.token"_n, contracts::eosio_token_abi().data() ); c.produce_blocks(10); - auto cr = c.push_action( N(eosio.token), N(create), N(eosio.token), mutable_variant_object() + auto cr = c.push_action( "eosio.token"_n, "create"_n, "eosio.token"_n, mutable_variant_object() ("issuer", "eosio" ) ("maximum_supply", core_from_string("10000000.0000")) ); - cr = c.push_action( N(eosio.token), N(issue), config::system_account_name, mutable_variant_object() + cr = c.push_action( "eosio.token"_n, "issue"_n, config::system_account_name, mutable_variant_object() ("to", "eosio" ) ("quantity", core_from_string("100.0000")) ("memo", "") ); - cr = c.push_action( N(eosio.token), N(transfer), config::system_account_name, mutable_variant_object() + cr = c.push_action( "eosio.token"_n, "transfer"_n, config::system_account_name, mutable_variant_object() ("from", "eosio") ("to", "dan" ) ("quantity", core_from_string("100.0000")) @@ -175,15 +175,15 @@ BOOST_AUTO_TEST_CASE( forking ) try { c.produce_blocks(3); signed_block_ptr b; b = c.produce_block(); - account_name expected_producer = N(dan); + account_name expected_producer = "dan"_n; BOOST_REQUIRE_EQUAL( b->producer.to_string(), expected_producer.to_string() ); b = c.produce_block(); - expected_producer = N(sam); + expected_producer = "sam"_n; BOOST_REQUIRE_EQUAL( b->producer.to_string(), expected_producer.to_string() ); c.produce_blocks(10); - c.create_accounts( {N(cam)} ); - c.set_producers( {N(dan),N(sam),N(pam),N(cam)} ); + c.create_accounts( {"cam"_n} ); + c.set_producers( {"dan"_n,"sam"_n,"pam"_n,"cam"_n} ); wlog("set producer schedule to [dan,sam,pam,cam]"); c.produce_block(); // The next block should be produced by pam. @@ -201,14 +201,14 @@ BOOST_AUTO_TEST_CASE( forking ) try { wlog( "c2 blocks:" ); c2.produce_blocks(12); // pam produces 12 blocks b = c2.produce_block( fc::milliseconds(config::block_interval_ms * 13) ); // sam skips over dan's blocks - expected_producer = N(sam); + expected_producer = "sam"_n; BOOST_REQUIRE_EQUAL( b->producer.to_string(), expected_producer.to_string() ); c2.produce_blocks(11 + 12); wlog( "c1 blocks:" ); b = c.produce_block( fc::milliseconds(config::block_interval_ms * 13) ); // dan skips over pam's blocks - expected_producer = N(dan); + expected_producer = "dan"_n; BOOST_REQUIRE_EQUAL( b->producer.to_string(), expected_producer.to_string() ); c.produce_blocks(11); @@ -225,11 +225,11 @@ BOOST_AUTO_TEST_CASE( forking ) try { c.produce_blocks(24); b = c.produce_block(); // Switching active schedule to version 2 happens in this block. - expected_producer = N(pam); + expected_producer = "pam"_n; BOOST_REQUIRE_EQUAL( b->producer.to_string(), expected_producer.to_string() ); b = c.produce_block(); - expected_producer = N(cam); + expected_producer = "cam"_n; // BOOST_REQUIRE_EQUAL( b->producer.to_string(), expected_producer.to_string() ); c.produce_blocks(10); @@ -285,8 +285,8 @@ BOOST_AUTO_TEST_CASE( prune_remove_branch ) try { while (c.control->head_block_num() < 11) { c.produce_block(); } - auto r = c.create_accounts( {N(dan),N(sam),N(pam),N(scott)} ); - auto res = c.set_producers( {N(dan),N(sam),N(pam),N(scott)} ); + auto r = c.create_accounts( {"dan"_n,"sam"_n,"pam"_n,"scott"_n} ); + auto res = c.set_producers( {"dan"_n,"sam"_n,"pam"_n,"scott"_n} ); wlog("set producer schedule to [dan,sam,pam,scott]"); c.produce_blocks(50); @@ -311,12 +311,12 @@ BOOST_AUTO_TEST_CASE( prune_remove_branch ) try { int skip1 = 1, skip2 = 1; for (int i = 0; i < 50; ++i) { account_name next1 = nextproducer(c, skip1); - if (next1 == N(dan) || next1 == N(sam)) { + if (next1 == "dan"_n || next1 == "sam"_n) { c.produce_block(fc::milliseconds(config::block_interval_ms * skip1)); skip1 = 1; } else ++skip1; account_name next2 = nextproducer(c2, skip2); - if (next2 == N(scott)) { + if (next2 == "scott"_n) { c2.produce_block(fc::milliseconds(config::block_interval_ms * skip2)); skip2 = 1; } else ++skip2; @@ -379,9 +379,9 @@ BOOST_AUTO_TEST_CASE( read_modes ) try { tester c; c.produce_block(); c.produce_block(); - auto r = c.create_accounts( {N(dan),N(sam),N(pam)} ); + auto r = c.create_accounts( {"dan"_n,"sam"_n,"pam"_n} ); c.produce_block(); - auto res = c.set_producers( {N(dan),N(sam),N(pam)} ); + auto res = c.set_producers( {"dan"_n,"sam"_n,"pam"_n} ); c.produce_blocks(200); auto head_block_num = c.control->head_block_num(); auto last_irreversible_block_num = c.control->last_irreversible_block_num(); @@ -413,18 +413,18 @@ BOOST_AUTO_TEST_CASE( irreversible_mode ) try { tester main; - main.create_accounts( {N(producer1), N(producer2)} ); + main.create_accounts( {"producer1"_n, "producer2"_n} ); main.produce_block(); - main.set_producers( {N(producer1), N(producer2)} ); + main.set_producers( {"producer1"_n, "producer2"_n} ); main.produce_block(); - BOOST_REQUIRE( produce_until_transition( main, N(producer1), N(producer2), 26) ); + BOOST_REQUIRE( produce_until_transition( main, "producer1"_n, "producer2"_n, 26) ); - main.create_accounts( {N(alice)} ); + main.create_accounts( {"alice"_n} ); main.produce_block(); auto hbn1 = main.control->head_block_num(); auto lib1 = main.control->last_irreversible_block_num(); - BOOST_REQUIRE( produce_until_transition( main, N(producer2), N(producer1), 11) ); + BOOST_REQUIRE( produce_until_transition( main, "producer2"_n, "producer1"_n, 11) ); auto hbn2 = main.control->head_block_num(); auto lib2 = main.control->last_irreversible_block_num(); @@ -436,15 +436,15 @@ BOOST_AUTO_TEST_CASE( irreversible_mode ) try { push_blocks( main, other ); BOOST_CHECK_EQUAL( other.control->head_block_num(), hbn2 ); - BOOST_REQUIRE( produce_until_transition( main, N(producer1), N(producer2), 12) ); - BOOST_REQUIRE( produce_until_transition( main, N(producer2), N(producer1), 12) ); + BOOST_REQUIRE( produce_until_transition( main, "producer1"_n, "producer2"_n, 12) ); + BOOST_REQUIRE( produce_until_transition( main, "producer2"_n, "producer1"_n, 12) ); auto hbn3 = main.control->head_block_num(); auto lib3 = main.control->last_irreversible_block_num(); BOOST_REQUIRE( lib3 >= hbn1 ); - BOOST_CHECK_EQUAL( does_account_exist( main, N(alice) ), true ); + BOOST_CHECK_EQUAL( does_account_exist( main, "alice"_n ), true ); // other forks away from main after hbn2 BOOST_REQUIRE_EQUAL( other.control->head_block_producer().to_string(), "producer2" ); @@ -454,15 +454,15 @@ BOOST_AUTO_TEST_CASE( irreversible_mode ) try { auto fork_first_block_id = other.control->head_block_id(); wlog( "{w}", ("w", fork_first_block_id)); - BOOST_REQUIRE( produce_until_transition( other, N(producer2), N(producer1), 11) ); // finish producer2's round + BOOST_REQUIRE( produce_until_transition( other, "producer2"_n, "producer1"_n, 11) ); // finish producer2's round BOOST_REQUIRE_EQUAL( other.control->pending_block_producer().to_string(), "producer1" ); // Repeat two more times to ensure other has a longer chain than main other.produce_block( fc::milliseconds( 13 * config::block_interval_ms ) ); // skip over producer1's round - BOOST_REQUIRE( produce_until_transition( other, N(producer2), N(producer1), 11) ); // finish producer2's round + BOOST_REQUIRE( produce_until_transition( other, "producer2"_n, "producer1"_n, 11) ); // finish producer2's round other.produce_block( fc::milliseconds( 13 * config::block_interval_ms ) ); // skip over producer1's round - BOOST_REQUIRE( produce_until_transition( other, N(producer2), N(producer1), 11) ); // finish producer2's round + BOOST_REQUIRE( produce_until_transition( other, "producer2"_n, "producer1"_n, 11) ); // finish producer2's round auto hbn4 = other.control->head_block_num(); auto lib4 = other.control->last_irreversible_block_num(); @@ -476,13 +476,13 @@ BOOST_AUTO_TEST_CASE( irreversible_mode ) try { BOOST_CHECK_EQUAL( irreversible.control->fork_db_pending_head_block_num(), hbn1 ); BOOST_CHECK_EQUAL( irreversible.control->head_block_num(), lib1 ); - BOOST_CHECK_EQUAL( does_account_exist( irreversible, N(alice) ), false ); + BOOST_CHECK_EQUAL( does_account_exist( irreversible, "alice"_n ), false ); push_blocks( other, irreversible, hbn4 ); BOOST_CHECK_EQUAL( irreversible.control->fork_db_pending_head_block_num(), hbn4 ); BOOST_CHECK_EQUAL( irreversible.control->head_block_num(), lib4 ); - BOOST_CHECK_EQUAL( does_account_exist( irreversible, N(alice) ), false ); + BOOST_CHECK_EQUAL( does_account_exist( irreversible, "alice"_n ), false ); // force push blocks from main to irreversible creating a new branch in irreversible's fork database for( uint32_t n = hbn2 + 1; n <= hbn3; ++n ) { @@ -492,7 +492,7 @@ BOOST_AUTO_TEST_CASE( irreversible_mode ) try { BOOST_CHECK_EQUAL( irreversible.control->fork_db_pending_head_block_num(), hbn3 ); BOOST_CHECK_EQUAL( irreversible.control->head_block_num(), lib3 ); - BOOST_CHECK_EQUAL( does_account_exist( irreversible, N(alice) ), true ); + BOOST_CHECK_EQUAL( does_account_exist( irreversible, "alice"_n ), true ); { auto bs = irreversible.control->fetch_block_state_by_id( fork_first_block_id ); @@ -517,18 +517,18 @@ BOOST_AUTO_TEST_CASE( irreversible_mode ) try { BOOST_AUTO_TEST_CASE( reopen_forkdb ) try { tester c1; - c1.create_accounts( {N(alice),N(bob),N(carol)} ); + c1.create_accounts( {"alice"_n,"bob"_n,"carol"_n} ); c1.produce_block(); - auto res = c1.set_producers( {N(alice),N(bob),N(carol)} ); + auto res = c1.set_producers( {"alice"_n,"bob"_n,"carol"_n} ); c1.produce_blocks(2); BOOST_REQUIRE_EQUAL( c1.control->active_producers().version, 1u ); - produce_until_transition( c1, N(carol), N(alice) ); + produce_until_transition( c1, "carol"_n, "alice"_n ); c1.produce_block(); - produce_until_transition( c1, N(carol), N(alice) ); + produce_until_transition( c1, "carol"_n, "alice"_n ); tester c2(setup_policy::none); @@ -573,9 +573,9 @@ BOOST_AUTO_TEST_CASE( push_block_returns_forked_transactions ) try { while (c.control->head_block_num() < 3) { c.produce_block(); } - auto r = c.create_accounts( {N(dan),N(sam),N(pam)} ); + auto r = c.create_accounts( {"dan"_n,"sam"_n,"pam"_n} ); c.produce_block(); - auto res = c.set_producers( {N(dan),N(sam),N(pam)} ); + auto res = c.set_producers( {"dan"_n,"sam"_n,"pam"_n} ); wlog("set producer schedule to [dan,sam,pam]"); c.produce_blocks(40); @@ -588,15 +588,15 @@ BOOST_AUTO_TEST_CASE( push_block_returns_forked_transactions ) try { c.produce_blocks(3); signed_block_ptr b; cb = b = c.produce_block(); - account_name expected_producer = N(dan); + account_name expected_producer = "dan"_n; BOOST_REQUIRE_EQUAL( b->producer.to_string(), expected_producer.to_string() ); b = c.produce_block(); - expected_producer = N(sam); + expected_producer = "sam"_n; BOOST_REQUIRE_EQUAL( b->producer.to_string(), expected_producer.to_string() ); c.produce_blocks(10); - c.create_accounts( {N(cam)} ); - c.set_producers( {N(dan),N(sam),N(pam),N(cam)} ); + c.create_accounts( {"cam"_n} ); + c.set_producers( {"dan"_n,"sam"_n,"pam"_n,"cam"_n} ); wlog("set producer schedule to [dan,sam,pam,cam]"); c.produce_block(); // The next block should be produced by pam. @@ -615,7 +615,7 @@ BOOST_AUTO_TEST_CASE( push_block_returns_forked_transactions ) try { wlog( "c2 blocks:" ); c2.produce_blocks(12); // pam produces 12 blocks b = c2b = c2.produce_block( fc::milliseconds(config::block_interval_ms * 13) ); // sam skips over dan's blocks - expected_producer = N(sam); + expected_producer = "sam"_n; BOOST_REQUIRE_EQUAL( b->producer.to_string(), expected_producer.to_string() ); // save blocks for verification of forking later std::vector c2blocks; @@ -626,7 +626,7 @@ BOOST_AUTO_TEST_CASE( push_block_returns_forked_transactions ) try { wlog( "c1 blocks:" ); b = c.produce_block( fc::milliseconds(config::block_interval_ms * 13) ); // dan skips over pam's blocks - expected_producer = N(dan); + expected_producer = "dan"_n; BOOST_REQUIRE_EQUAL( b->producer.to_string(), expected_producer.to_string() ); // create accounts on c1 which will be forked out c.produce_block(); @@ -634,12 +634,12 @@ BOOST_AUTO_TEST_CASE( push_block_returns_forked_transactions ) try { transaction_trace_ptr trace1, trace2, trace3, trace4; { // create account the hard way so we can set reference block and expiration signed_transaction trx; - authority active_auth( get_public_key( N(test1), "active" ) ); - authority owner_auth( get_public_key( N(test1), "owner" ) ); + authority active_auth( get_public_key( "test1"_n, "active" ) ); + authority owner_auth( get_public_key( "test1"_n, "owner" ) ); trx.actions.emplace_back( vector{{config::system_account_name,config::active_name}}, newaccount{ .creator = config::system_account_name, - .name = N(test1), + .name = "test1"_n, .owner = owner_auth, .active = active_auth, }); @@ -651,12 +651,12 @@ BOOST_AUTO_TEST_CASE( push_block_returns_forked_transactions ) try { c.produce_block(); { signed_transaction trx; - authority active_auth( get_public_key( N(test2), "active" ) ); - authority owner_auth( get_public_key( N(test2), "owner" ) ); + authority active_auth( get_public_key( "test2"_n, "active" ) ); + authority owner_auth( get_public_key( "test2"_n, "owner" ) ); trx.actions.emplace_back( vector{{config::system_account_name,config::active_name}}, newaccount{ .creator = config::system_account_name, - .name = N(test2), + .name = "test2"_n, .owner = owner_auth, .active = active_auth, }); @@ -667,12 +667,12 @@ BOOST_AUTO_TEST_CASE( push_block_returns_forked_transactions ) try { } { signed_transaction trx; - authority active_auth( get_public_key( N(test3), "active" ) ); - authority owner_auth( get_public_key( N(test3), "owner" ) ); + authority active_auth( get_public_key( "test3"_n, "active" ) ); + authority owner_auth( get_public_key( "test3"_n, "owner" ) ); trx.actions.emplace_back( vector{{config::system_account_name,config::active_name}}, newaccount{ .creator = config::system_account_name, - .name = N(test3), + .name = "test3"_n, .owner = owner_auth, .active = active_auth, }); @@ -683,12 +683,12 @@ BOOST_AUTO_TEST_CASE( push_block_returns_forked_transactions ) try { } { signed_transaction trx; - authority active_auth( get_public_key( N(test4), "active" ) ); - authority owner_auth( get_public_key( N(test4), "owner" ) ); + authority active_auth( get_public_key( "test4"_n, "active" ) ); + authority owner_auth( get_public_key( "test4"_n, "owner" ) ); trx.actions.emplace_back( vector{{config::system_account_name,config::active_name}}, newaccount{ .creator = config::system_account_name, - .name = N(test4), + .name = "test4"_n, .owner = owner_auth, .active = active_auth, }); @@ -732,20 +732,20 @@ BOOST_AUTO_TEST_CASE( push_block_returns_forked_transactions ) try { BOOST_REQUIRE_EQUAL( trace3->id, (++(++c.get_unapplied_transaction_queue().begin()))->id() ); BOOST_REQUIRE_EQUAL( trace4->id, (++(++(++c.get_unapplied_transaction_queue().begin())))->id() ); - BOOST_REQUIRE_EXCEPTION(c.control->get_account( N(test1) ), fc::exception, - [a=N(test1)] (const fc::exception& e)->bool { + BOOST_REQUIRE_EXCEPTION(c.control->get_account( "test1"_n ), fc::exception, + [a="test1"_n] (const fc::exception& e)->bool { return std::string( e.what() ).find( a.to_string() ) != std::string::npos; }) ; - BOOST_REQUIRE_EXCEPTION(c.control->get_account( N(test2) ), fc::exception, - [a=N(test2)] (const fc::exception& e)->bool { + BOOST_REQUIRE_EXCEPTION(c.control->get_account( "test2"_n ), fc::exception, + [a="test2"_n] (const fc::exception& e)->bool { return std::string( e.what() ).find( a.to_string() ) != std::string::npos; }) ; - BOOST_REQUIRE_EXCEPTION(c.control->get_account( N(test3) ), fc::exception, - [a=N(test3)] (const fc::exception& e)->bool { + BOOST_REQUIRE_EXCEPTION(c.control->get_account( "test3"_n ), fc::exception, + [a="test3"_n] (const fc::exception& e)->bool { return std::string( e.what() ).find( a.to_string() ) != std::string::npos; }) ; - BOOST_REQUIRE_EXCEPTION(c.control->get_account( N(test4) ), fc::exception, - [a=N(test4)] (const fc::exception& e)->bool { + BOOST_REQUIRE_EXCEPTION(c.control->get_account( "test4"_n ), fc::exception, + [a="test4"_n] (const fc::exception& e)->bool { return std::string( e.what() ).find( a.to_string() ) != std::string::npos; }) ; @@ -766,13 +766,13 @@ BOOST_AUTO_TEST_CASE( push_block_returns_forked_transactions ) try { BOOST_CHECK( traces.at(3)->except ); // verify unapplied transactions ran - BOOST_REQUIRE_EQUAL( c.control->get_account( N(test1) ).name, N(test1) ); - BOOST_REQUIRE_EQUAL( c.control->get_account( N(test2) ).name, N(test2) ); - BOOST_REQUIRE_EQUAL( c.control->get_account( N(test3) ).name, N(test3) ); + BOOST_REQUIRE_EQUAL( c.control->get_account( "test1"_n ).name, "test1"_n ); + BOOST_REQUIRE_EQUAL( c.control->get_account( "test2"_n ).name, "test2"_n ); + BOOST_REQUIRE_EQUAL( c.control->get_account( "test3"_n ).name, "test3"_n ); // failed because of tapos to forked out block - BOOST_REQUIRE_EXCEPTION(c.control->get_account( N(test4) ), fc::exception, - [a=N(test4)] (const fc::exception& e)->bool { + BOOST_REQUIRE_EXCEPTION(c.control->get_account( "test4"_n ), fc::exception, + [a="test4"_n] (const fc::exception& e)->bool { return std::string( e.what() ).find( a.to_string() ) != std::string::npos; }) ; diff --git a/unittests/kv_tests.cpp b/unittests/kv_tests.cpp index 012534f9bae..eb632f68772 100644 --- a/unittests/kv_tests.cpp +++ b/unittests/kv_tests.cpp @@ -41,10 +41,10 @@ class kv_tester : public tester { kv_tester() { produce_blocks(2); - create_accounts({ N(kvtest), N(kvtest1), N(kvtest2), N(kvtest3), N(kvtest4) }); + create_accounts({ "kvtest"_n, "kvtest1"_n, "kvtest2"_n, "kvtest3"_n, "kvtest4"_n }); produce_blocks(2); - for(auto account : {N(kvtest), N(kvtest1), N(kvtest2), N(kvtest3), N(kvtest4)}) { + for(auto account : {"kvtest"_n, "kvtest1"_n, "kvtest2"_n, "kvtest3"_n, "kvtest4"_n}) { set_code(account, contracts::kv_test_wasm()); set_abi(account, contracts::kv_test_abi().data()); } @@ -55,7 +55,7 @@ class kv_tester : public tester { produce_blocks(); { - const auto& accnt = control->db().get(N(kvtest)); + const auto& accnt = control->db().get("kvtest"_n); abi_def abi; BOOST_REQUIRE_EQUAL(abi_serializer::to_abi(accnt.abi, abi), true); abi_ser.set_abi(abi, abi_serializer::create_yield_function(abi_serializer_max_time)); @@ -67,11 +67,11 @@ class kv_tester : public tester { sys_abi_ser.set_abi(abi, abi_serializer::create_yield_function(abi_serializer_max_time)); } - BOOST_TEST_REQUIRE(set_kv_limits(N(eosio.kvram), 1024, 1024*1024) == ""); + BOOST_TEST_REQUIRE(set_kv_limits("eosio.kvram"_n, 1024, 1024*1024) == ""); produce_block(); } - action_result push_action(const action_name& name, const variant_object& data, chain::name account = N(kvtest), chain::name authorizer = N(kvtest)) { + action_result push_action(const action_name& name, const variant_object& data, chain::name account = "kvtest"_n, chain::name authorizer = "kvtest"_n) { string action_type_name = abi_ser.get_action_type(name); action act; act.account = account; @@ -80,10 +80,10 @@ class kv_tester : public tester { return base_tester::push_action(std::move(act), authorizer.to_uint64_t()); } - action_result set_limit(name db, int64_t limit, name account = N(kvtest)) { + action_result set_limit(name db, int64_t limit, name account = "kvtest"_n) { action_name name; - if(db == N(eosio.kvram)) { - name = N(setramlimit); + if(db == "eosio.kvram"_n) { + name = "setramlimit"_n; } else { BOOST_FAIL("Wrong database id"); } @@ -97,8 +97,8 @@ class kv_tester : public tester { action_result set_kv_limits(name db, uint32_t klimit, uint32_t vlimit, uint32_t ilimit = 256) { action_name name; - if(db == N(eosio.kvram)) { - name = N(ramkvlimits); + if(db == "eosio.kvram"_n) { + name = "ramkvlimits"_n; } else { BOOST_FAIL("Wrong database id"); } @@ -111,46 +111,46 @@ class kv_tester : public tester { } void erase(const char* error, name db, name contract, const char* k) { - BOOST_REQUIRE_EQUAL(error, push_action(N(erase), mvo()("db", db)("contract", contract)("k", k))); + BOOST_REQUIRE_EQUAL(error, push_action("erase"_n, mvo()("db", db)("contract", contract)("k", k))); } template void get(const char* error, name db, name contract, const char* k, V v) { - BOOST_REQUIRE_EQUAL(error, push_action(N(get), mvo()("db", db)("contract", contract)("k", k)("v", v))); + BOOST_REQUIRE_EQUAL(error, push_action("get"_n, mvo()("db", db)("contract", contract)("k", k)("v", v))); } template action_result set(name db, name contract, const char* k, V v, name payer, name authorizer) { - return push_action(N(set), mvo()("db", db)("contract", contract)("k", k)("v", v)("payer", payer), contract, authorizer); + return push_action("set"_n, mvo()("db", db)("contract", contract)("k", k)("v", v)("payer", payer), contract, authorizer); } template action_result set(name db, name contract, const char* k, V v) { - return push_action(N(set), mvo()("db", db)("contract", contract)("k", k)("v", v)("payer", contract)); + return push_action("set"_n, mvo()("db", db)("contract", contract)("k", k)("v", v)("payer", contract)); } action_result iterlimit(const std::vector& params) { - return push_action(N(itlimit), mvo()("params", params)); + return push_action("itlimit"_n, mvo()("params", params)); } void setmany(const char* error, name db, name contract, const std::vector& kvs) { - BOOST_REQUIRE_EQUAL(error, push_action(N(setmany), mvo()("db", db)("contract", contract)("kvs", kvs), contract)); + BOOST_REQUIRE_EQUAL(error, push_action("setmany"_n, mvo()("db", db)("contract", contract)("kvs", kvs), contract)); } template void scan(const char* error, name db, name contract, const char* prefix, T lower, const std::vector& expected) { - BOOST_REQUIRE_EQUAL(error, push_action(N(scan), mvo()("db", db)("contract", contract)("prefix", prefix)( + BOOST_REQUIRE_EQUAL(error, push_action("scan"_n, mvo()("db", db)("contract", contract)("prefix", prefix)( "lower", lower)("expected", expected))); - BOOST_REQUIRE_EQUAL(error, push_action(N(scan), mvo()("db", db)("contract", contract)("prefix", prefix)( + BOOST_REQUIRE_EQUAL(error, push_action("scan"_n, mvo()("db", db)("contract", contract)("prefix", prefix)( "lower", lower)("expected", expected), contract)); } template action_result scanrev(name db, name contract, const char* prefix, T lower, const std::vector& expected) { - auto result1 = push_action(N(scanrev), mvo()("db", db)("contract", contract)("prefix", prefix)( + auto result1 = push_action("scanrev"_n, mvo()("db", db)("contract", contract)("prefix", prefix)( "lower", lower)("expected", expected)); - auto result2 = push_action(N(scanrev), mvo()("db", db)("contract", contract)("prefix", prefix)( + auto result2 = push_action("scanrev"_n, mvo()("db", db)("contract", contract)("prefix", prefix)( "lower", lower)("expected", expected), contract); BOOST_TEST(result1 == result2); return result1; @@ -158,12 +158,12 @@ class kv_tester : public tester { void itstaterased(const char* error, name db, name contract, const char* prefix, const char* k, const char* v, int test_id, bool insert, bool reinsert) { - BOOST_REQUIRE_EQUAL(error, push_action(N(itstaterased), mvo()("db", db)("contract", contract)("prefix", prefix)( + BOOST_REQUIRE_EQUAL(error, push_action("itstaterased"_n, mvo()("db", db)("contract", contract)("prefix", prefix)( "k", k)("v", v)("test_id", test_id)("insert", insert)("reinsert", reinsert))); } - uint64_t get_usage(name db, name account=N(kvtest)) { - if (db == N(eosio.kvram)) { + uint64_t get_usage(name db, name account="kvtest"_n) { + if (db == "eosio.kvram"_n) { return control->get_resource_limits_manager().get_account_ram_usage(account); } BOOST_FAIL("Wrong db"); @@ -171,44 +171,44 @@ class kv_tester : public tester { } void test_basic(name db) { - get("", db, N(kvtest), "", nullptr); - BOOST_TEST("" == set(db, N(kvtest), "", "")); - get("", db, N(kvtest), "", ""); - BOOST_TEST("" == set(db, N(kvtest), "", "1234")); - get("", db, N(kvtest), "", "1234"); - get("", db, N(kvtest), "00", nullptr); - BOOST_TEST("" == set(db, N(kvtest), "00", "aabbccdd")); - get("", db, N(kvtest), "00", "aabbccdd"); - get("", db, N(kvtest), "02", nullptr); - erase("", db, N(kvtest), "02"); - get("", db, N(kvtest), "02", nullptr); - BOOST_TEST("" == set(db, N(kvtest), "02", "42")); - get("", db, N(kvtest), "02", "42"); - get("", db, N(kvtest), "01020304", nullptr); - BOOST_TEST("" == set(db, N(kvtest), "01020304", "aabbccddee")); - erase("", db, N(kvtest), "02"); - - get("", db, N(kvtest), "01020304", "aabbccddee"); - get("", db, N(kvtest), "", "1234"); - get("", db, N(kvtest), "00", "aabbccdd"); - get("", db, N(kvtest), "02", nullptr); - get("", db, N(kvtest), "01020304", "aabbccddee"); + get("", db, "kvtest"_n, "", nullptr); + BOOST_TEST("" == set(db, "kvtest"_n, "", "")); + get("", db, "kvtest"_n, "", ""); + BOOST_TEST("" == set(db, "kvtest"_n, "", "1234")); + get("", db, "kvtest"_n, "", "1234"); + get("", db, "kvtest"_n, "00", nullptr); + BOOST_TEST("" == set(db, "kvtest"_n, "00", "aabbccdd")); + get("", db, "kvtest"_n, "00", "aabbccdd"); + get("", db, "kvtest"_n, "02", nullptr); + erase("", db, "kvtest"_n, "02"); + get("", db, "kvtest"_n, "02", nullptr); + BOOST_TEST("" == set(db, "kvtest"_n, "02", "42")); + get("", db, "kvtest"_n, "02", "42"); + get("", db, "kvtest"_n, "01020304", nullptr); + BOOST_TEST("" == set(db, "kvtest"_n, "01020304", "aabbccddee")); + erase("", db, "kvtest"_n, "02"); + + get("", db, "kvtest"_n, "01020304", "aabbccddee"); + get("", db, "kvtest"_n, "", "1234"); + get("", db, "kvtest"_n, "00", "aabbccdd"); + get("", db, "kvtest"_n, "02", nullptr); + get("", db, "kvtest"_n, "01020304", "aabbccddee"); } void test_other_contract(name db) { - get("", db, N(missing), "", nullptr); - get("", db, N(kvtest1), "", nullptr); - BOOST_TEST(set(db, N(missing), "", "") == "Can not write to this key"); - BOOST_TEST(set(db, N(kvtest1), "", "") == "Can not write to this key"); - erase("Can not write to this key", db, N(missing), ""); - erase("Can not write to this key", db, N(kvtest1), ""); + get("", db, "missing"_n, "", nullptr); + get("", db, "kvtest1"_n, "", nullptr); + BOOST_TEST(set(db, "missing"_n, "", "") == "Can not write to this key"); + BOOST_TEST(set(db, "kvtest1"_n, "", "") == "Can not write to this key"); + erase("Can not write to this key", db, "missing"_n, ""); + erase("Can not write to this key", db, "kvtest1"_n, ""); } void test_get_data(name db) { - BOOST_TEST(push_action(N(getdata), mvo()("db", db)) == ""); + BOOST_TEST(push_action("getdata"_n, mvo()("db", db)) == ""); } - void test_scan(name db, name account = N(kvtest)) { + void test_scan(name db, name account = "kvtest"_n) { setmany("", db, account, { kv{ {}, { 0x12 } }, @@ -383,7 +383,7 @@ class kv_tester : public tester { } // test_scanrev void test_scanrev2(name db) { - setmany("", db, N(kvtest), + setmany("", db, "kvtest"_n, { kv{ { 0x00, char(0xFF), char(0xFF) }, { 0x10 } }, kv{ { 0x01 }, { 0x20 } }, @@ -391,7 +391,7 @@ class kv_tester : public tester { }); // prefix = "00FFFF", no lower bound - BOOST_TEST("" == scanrev(db, N(kvtest), "00FFFF", nullptr, + BOOST_TEST("" == scanrev(db, "kvtest"_n, "00FFFF", nullptr, { kv{ { 0x00, char(0xFF), char(0xFF) }, { 0x10 } }, })); @@ -402,84 +402,84 @@ class kv_tester : public tester { // pre-inserted for(bool insert : {false, true}) { for(int i = 0; i < 8; ++i) { - setmany("", db, N(kvtest), { kv{ { 0x22 }, { 0x12 } } }); + setmany("", db, "kvtest"_n, { kv{ { 0x22 }, { 0x12 } } }); produce_block(); - itstaterased("Iterator to erased element", db, N(kvtest), "", "22", "12", i, insert, reinsert ); + itstaterased("Iterator to erased element", db, "kvtest"_n, "", "22", "12", i, insert, reinsert ); } - setmany("", db, N(kvtest), { kv{ { 0x22 }, { 0x12 } } }); + setmany("", db, "kvtest"_n, { kv{ { 0x22 }, { 0x12 } } }); produce_block(); - itstaterased("", db, N(kvtest), "", "22", "12", 8, insert, reinsert ); + itstaterased("", db, "kvtest"_n, "", "22", "12", 8, insert, reinsert ); if(!reinsert) { - setmany("", db, N(kvtest), { kv{ { 0x22 }, { 0x12 } } }); + setmany("", db, "kvtest"_n, { kv{ { 0x22 }, { 0x12 } } }); produce_block(); - itstaterased("", db, N(kvtest), "", "22", "12", 9, insert, reinsert ); + itstaterased("", db, "kvtest"_n, "", "22", "12", 9, insert, reinsert ); } - setmany("", db, N(kvtest), { kv{ { 0x22 }, { 0x12 } }, kv{ { 0x23 }, { 0x13 } } }); + setmany("", db, "kvtest"_n, { kv{ { 0x22 }, { 0x12 } }, kv{ { 0x23 }, { 0x13 } } }); produce_block(); - itstaterased("", db, N(kvtest), "", "22", "12", 10, insert, reinsert ); - erase("", db, N(kvtest), "23"); - setmany("", db, N(kvtest), { kv{ { 0x22 }, { 0x12 } } }); + itstaterased("", db, "kvtest"_n, "", "22", "12", 10, insert, reinsert ); + erase("", db, "kvtest"_n, "23"); + setmany("", db, "kvtest"_n, { kv{ { 0x22 }, { 0x12 } } }); produce_block(); - itstaterased("", db, N(kvtest), "", "22", "12", 11, insert, reinsert ); + itstaterased("", db, "kvtest"_n, "", "22", "12", 11, insert, reinsert ); } // inserted inside contract for(int i = 0; i < 8; ++i) { - erase("", db, N(kvtest), "22"); + erase("", db, "kvtest"_n, "22"); produce_block(); - itstaterased("Iterator to erased element", db, N(kvtest), "", "22", "12", i, true, reinsert ); + itstaterased("Iterator to erased element", db, "kvtest"_n, "", "22", "12", i, true, reinsert ); } - erase("", db, N(kvtest), "22"); + erase("", db, "kvtest"_n, "22"); produce_block(); - itstaterased("", db, N(kvtest), "", "22", "12", 8, true, reinsert ); + itstaterased("", db, "kvtest"_n, "", "22", "12", 8, true, reinsert ); if(!reinsert) { - erase("", db, N(kvtest), "22"); + erase("", db, "kvtest"_n, "22"); produce_block(); - itstaterased("", db, N(kvtest), "", "22", "12", 9, true, reinsert ); + itstaterased("", db, "kvtest"_n, "", "22", "12", 9, true, reinsert ); } - erase("", db, N(kvtest), "22"); - setmany("", db, N(kvtest), { kv{ { 0x23 }, { 0x13 } } }); + erase("", db, "kvtest"_n, "22"); + setmany("", db, "kvtest"_n, { kv{ { 0x23 }, { 0x13 } } }); produce_block(); - itstaterased("", db, N(kvtest), "", "22", "12", 10, true, reinsert ); - erase("", db, N(kvtest), "23"); - erase("", db, N(kvtest), "22"); + itstaterased("", db, "kvtest"_n, "", "22", "12", 10, true, reinsert ); + erase("", db, "kvtest"_n, "23"); + erase("", db, "kvtest"_n, "22"); produce_block(); - itstaterased("", db, N(kvtest), "", "22", "12", 11, true, reinsert ); + itstaterased("", db, "kvtest"_n, "", "22", "12", 11, true, reinsert ); } } void test_ram_usage(name db) { uint64_t base_usage = get_usage(db); - get("", db, N(kvtest), "11", nullptr); - BOOST_TEST(get_usage(db, N(kvtest)) == base_usage); + get("", db, "kvtest"_n, "11", nullptr); + BOOST_TEST(get_usage(db, "kvtest"_n) == base_usage); - BOOST_TEST("" == set(db, N(kvtest), "11", "", N(kvtest), N(kvtest))); + BOOST_TEST("" == set(db, "kvtest"_n, "11", "", "kvtest"_n, "kvtest"_n)); const int base_billable = config::billable_size_v; - BOOST_TEST(get_usage(db, N(kvtest)) == base_usage + base_billable + 1); - BOOST_TEST("" == set(db, N(kvtest), "11", "1234", N(kvtest), N(kvtest))); - BOOST_TEST(get_usage(db, N(kvtest)) == base_usage + base_billable + 1 + 2); - BOOST_TEST("" == set(db, N(kvtest), "11", "12", N(kvtest), N(kvtest))); - BOOST_TEST(get_usage(db, N(kvtest)) == base_usage + base_billable + 1 + 1); - erase("", db, N(kvtest), "11"); - BOOST_TEST(get_usage(db, N(kvtest)) == base_usage); + BOOST_TEST(get_usage(db, "kvtest"_n) == base_usage + base_billable + 1); + BOOST_TEST("" == set(db, "kvtest"_n, "11", "1234", "kvtest"_n, "kvtest"_n)); + BOOST_TEST(get_usage(db, "kvtest"_n) == base_usage + base_billable + 1 + 2); + BOOST_TEST("" == set(db, "kvtest"_n, "11", "12", "kvtest"_n, "kvtest"_n)); + BOOST_TEST(get_usage(db, "kvtest"_n) == base_usage + base_billable + 1 + 1); + erase("", db, "kvtest"_n, "11"); + BOOST_TEST(get_usage(db, "kvtest"_n) == base_usage); // test payer changes - BOOST_TEST("" == set(db, N(kvtest), "11", "", N(kvtest), N(kvtest))); - BOOST_TEST(get_usage(db, N(kvtest)) == base_usage + base_billable + 1); + BOOST_TEST("" == set(db, "kvtest"_n, "11", "", "kvtest"_n, "kvtest"_n)); + BOOST_TEST(get_usage(db, "kvtest"_n) == base_usage + base_billable + 1); - uint64_t base_usage1 = get_usage(db, N(kvtest1)); - BOOST_TEST("" == set(db, N(kvtest), "11", "", N(kvtest1), N(kvtest1))); + uint64_t base_usage1 = get_usage(db, "kvtest1"_n); + BOOST_TEST("" == set(db, "kvtest"_n, "11", "", "kvtest1"_n, "kvtest1"_n)); - BOOST_TEST(get_usage(db, N(kvtest)) == base_usage); - BOOST_TEST(get_usage(db, N(kvtest1)) == base_usage1 + base_billable + 1); + BOOST_TEST(get_usage(db, "kvtest"_n) == base_usage); + BOOST_TEST(get_usage(db, "kvtest1"_n) == base_usage1 + base_billable + 1); BOOST_TEST("unprivileged contract cannot increase RAM usage of another account that has not authorized the action: kvtest1" == - set(db, N(kvtest), "11", "12", N(kvtest1), N(kvtest2))); + set(db, "kvtest"_n, "11", "12", "kvtest1"_n, "kvtest2"_n)); BOOST_TEST("unprivileged contract cannot increase RAM usage of another account that has not authorized the action: kvtest2" == - set(db, N(kvtest), "11", "12", N(kvtest2), N(kvtest1))); + set(db, "kvtest"_n, "11", "12", "kvtest2"_n, "kvtest1"_n)); } void test_resource_limit(name db) { @@ -487,56 +487,56 @@ class kv_tester : public tester { // insert a new element const int base_billable = config::billable_size_v; BOOST_TEST_REQUIRE(set_limit(db, base_usage + base_billable) == ""); - BOOST_TEST(set(db, N(kvtest), "11", "").find("account kvtest has insufficient") == 0); + BOOST_TEST(set(db, "kvtest"_n, "11", "").find("account kvtest has insufficient") == 0); BOOST_TEST_REQUIRE(set_limit(db, base_usage + base_billable + 1) == ""); - BOOST_TEST("" == set(db, N(kvtest), "11", "")); + BOOST_TEST("" == set(db, "kvtest"_n, "11", "")); // increase the size of a value BOOST_TEST_REQUIRE(set_limit(db, base_usage + base_billable + 1 + 2 - 1) == ""); - BOOST_TEST(set(db, N(kvtest), "11", "1234").find("account kvtest has insufficient") == 0); + BOOST_TEST(set(db, "kvtest"_n, "11", "1234").find("account kvtest has insufficient") == 0); BOOST_TEST_REQUIRE(set_limit(db, base_usage + base_billable + 1 + 2) == ""); - BOOST_TEST("" == set(db, N(kvtest), "11", "1234")); + BOOST_TEST("" == set(db, "kvtest"_n, "11", "1234")); // decrease the size of a value - BOOST_TEST("" == set(db, N(kvtest), "11", "")); + BOOST_TEST("" == set(db, "kvtest"_n, "11", "")); // decrease limits BOOST_TEST(set_limit(db, base_usage + base_billable).find("account kvtest has insufficient") == 0); BOOST_TEST(set_limit(db, base_usage + base_billable + 1) == ""); // erase an element - erase("", db, N(kvtest), "11"); + erase("", db, "kvtest"_n, "11"); } void test_key_value_limit(name db) { BOOST_TEST_REQUIRE(set_kv_limits(db, 4, 4) == ""); - setmany("", db, N(kvtest), {{bytes(4, 'a'), bytes(4, 'a')}}); - setmany("Key too large", db, N(kvtest), {{bytes(4 + 1, 'a'), bytes()}}); - setmany("Value too large", db, N(kvtest), {{bytes(), bytes(4 + 1, 'a')}}); + setmany("", db, "kvtest"_n, {{bytes(4, 'a'), bytes(4, 'a')}}); + setmany("Key too large", db, "kvtest"_n, {{bytes(4 + 1, 'a'), bytes()}}); + setmany("Value too large", db, "kvtest"_n, {{bytes(), bytes(4 + 1, 'a')}}); // The check happens at the point of calling set. Changing the bad value later doesn't bypass errors. - setmany("Value too large", db, N(kvtest), {{bytes(4, 'b'), bytes(5, 'b')}, {bytes(4, 'b'), {}}}); + setmany("Value too large", db, "kvtest"_n, {{bytes(4, 'b'), bytes(5, 'b')}, {bytes(4, 'b'), {}}}); // The key is checked even if it already exists - setmany("Key too large", db, N(kvtest), {{bytes(1024, 'a'), {}}}); + setmany("Key too large", db, "kvtest"_n, {{bytes(1024, 'a'), {}}}); - scan("", db, N(kvtest), "00000000", "", {}); - scan("Prefix too large", db, N(kvtest), "0000000000", "", {}); + scan("", db, "kvtest"_n, "00000000", "", {}); + scan("Prefix too large", db, "kvtest"_n, "0000000000", "", {}); } action make_set_action(name db, std::size_t size) { std::vector k; std::vector v(size, 'a'); action act; - act.account = N(kvtest); - act.name = N(set); - act.data = abi_ser.variant_to_binary("set", mvo()("db", db)("contract", N(kvtest))("k", k)("v", v)("payer", N(kvtest)), abi_serializer::create_yield_function(abi_serializer_max_time)); - act.authorization = vector{{N(kvtest), config::active_name}}; + act.account = "kvtest"_n; + act.name = "set"_n; + act.data = abi_ser.variant_to_binary("set", mvo()("db", db)("contract", "kvtest"_n)("k", k)("v", v)("payer", "kvtest"_n), abi_serializer::create_yield_function(abi_serializer_max_time)); + act.authorization = vector{{"kvtest"_n, config::active_name}}; return act; } action make_set_limit_action(name db, int64_t limit) { action act; - act.account = N(eosio); - act.name = db == N(eosio.kvram)?N(setramlimit):N(setdisklimit); - act.data = sys_abi_ser.variant_to_binary(act.name.to_string(), mvo()("account", N(kvtest))("limit", limit), abi_serializer::create_yield_function(abi_serializer_max_time)); - act.authorization = vector{{N(kvtest), config::active_name}}; + act.account = "eosio"_n; + act.name = db == "eosio.kvram"_n?"setramlimit"_n:"setdisklimit"_n; + act.data = sys_abi_ser.variant_to_binary(act.name.to_string(), mvo()("account", "kvtest"_n)("limit", limit), abi_serializer::create_yield_function(abi_serializer_max_time)); + act.authorization = vector{{"kvtest"_n, config::active_name}}; return act; } @@ -548,7 +548,7 @@ class kv_tester : public tester { trx.actions.push_back(make_set_action(db, 512)); trx.actions.push_back(make_set_action(db, 0)); set_transaction_headers(trx); - trx.sign(get_private_key(N(kvtest), "active"), control->get_chain_id()); + trx.sign(get_private_key("kvtest"_n, "active"), control->get_chain_id()); push_transaction(trx); produce_block(); } @@ -564,7 +564,7 @@ class kv_tester : public tester { trx.actions.push_back(make_set_limit_action(db, base_usage + 640)); } set_transaction_headers(trx); - trx.sign(get_private_key(N(kvtest), "active"), control->get_chain_id()); + trx.sign(get_private_key("kvtest"_n, "active"), control->get_chain_id()); push_transaction(trx); produce_block(); } @@ -573,7 +573,7 @@ class kv_tester : public tester { void test_kv_dec_limit_and_usage(name db) { auto base_usage = get_usage(db); BOOST_TEST_REQUIRE(set_limit(db, base_usage + 1024) == ""); - BOOST_TEST_REQUIRE(set(db, N(kvtest), "", std::vector(512, 'a')) == ""); + BOOST_TEST_REQUIRE(set(db, "kvtest"_n, "", std::vector(512, 'a')) == ""); produce_block(); signed_transaction trx; { @@ -581,16 +581,16 @@ class kv_tester : public tester { trx.actions.push_back(make_set_action(db, 0)); } set_transaction_headers(trx); - trx.sign(get_private_key(N(kvtest), "active"), control->get_chain_id()); + trx.sign(get_private_key("kvtest"_n, "active"), control->get_chain_id()); push_transaction(trx); produce_block(); } void test_max_iterators() { - BOOST_TEST_REQUIRE(set_kv_limits(N(eosio.kvram), 1024, 1024, 5) == ""); + BOOST_TEST_REQUIRE(set_kv_limits("eosio.kvram"_n, 1024, 1024, 5) == ""); // individual limits - BOOST_TEST(iterlimit({{N(eosio.kvram), 5, false}}) == ""); - BOOST_TEST(iterlimit({{N(eosio.kvram), 6, false}}) == "Too many iterators"); + BOOST_TEST(iterlimit({{"eosio.kvram"_n, 5, false}}) == ""); + BOOST_TEST(iterlimit({{"eosio.kvram"_n, 6, false}}) == "Too many iterators"); } abi_serializer abi_ser; @@ -600,72 +600,72 @@ class kv_tester : public tester { BOOST_AUTO_TEST_SUITE(kv_tests) BOOST_FIXTURE_TEST_CASE(kv_basic, kv_tester) try { - BOOST_REQUIRE_EQUAL("Bad key-value database ID", push_action(N(itlifetime), mvo()("db", N(oops)))); - BOOST_REQUIRE_EQUAL("", push_action(N(itlifetime), mvo()("db", N(eosio.kvram)))); - test_basic(N(eosio.kvram)); + BOOST_REQUIRE_EQUAL("Bad key-value database ID", push_action("itlifetime"_n, mvo()("db", "oops"_n))); + BOOST_REQUIRE_EQUAL("", push_action("itlifetime"_n, mvo()("db", "eosio.kvram"_n))); + test_basic("eosio.kvram"_n); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE(kv_scan, kv_tester) try { // // four possibilities depending on whether the next or previous contract table has elements - test_scan(N(eosio.kvram), N(kvtest2)); - test_scan(N(eosio.kvram), N(kvtest4)); - test_scan(N(eosio.kvram), N(kvtest3)); - test_scan(N(eosio.kvram), N(kvtest1)); + test_scan("eosio.kvram"_n, "kvtest2"_n); + test_scan("eosio.kvram"_n, "kvtest4"_n); + test_scan("eosio.kvram"_n, "kvtest3"_n); + test_scan("eosio.kvram"_n, "kvtest1"_n); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE(kv_scan_ram_after_disk, kv_tester) try { // // Make sure that the behavior of one database is not affected by having the other database populated. - test_scan(N(eosio.kvram), N(kvtest2)); - test_scan(N(eosio.kvram), N(kvtest4)); - test_scan(N(eosio.kvram), N(kvtest3)); - test_scan(N(eosio.kvram), N(kvtest1)); + test_scan("eosio.kvram"_n, "kvtest2"_n); + test_scan("eosio.kvram"_n, "kvtest4"_n); + test_scan("eosio.kvram"_n, "kvtest3"_n); + test_scan("eosio.kvram"_n, "kvtest1"_n); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE(kv_scanrev, kv_tester) try { // - test_scanrev(N(eosio.kvram), N(kvtest2)); - test_scanrev(N(eosio.kvram), N(kvtest4)); - test_scanrev(N(eosio.kvram), N(kvtest3)); - test_scanrev(N(eosio.kvram), N(kvtest1)); + test_scanrev("eosio.kvram"_n, "kvtest2"_n); + test_scanrev("eosio.kvram"_n, "kvtest4"_n); + test_scanrev("eosio.kvram"_n, "kvtest3"_n); + test_scanrev("eosio.kvram"_n, "kvtest1"_n); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE(kv_scanrev_ram_after_disk, kv_tester) try { // - test_scanrev(N(eosio.kvram), N(kvtest2)); - test_scanrev(N(eosio.kvram), N(kvtest4)); - test_scanrev(N(eosio.kvram), N(kvtest3)); - test_scanrev(N(eosio.kvram), N(kvtest1)); + test_scanrev("eosio.kvram"_n, "kvtest2"_n); + test_scanrev("eosio.kvram"_n, "kvtest4"_n); + test_scanrev("eosio.kvram"_n, "kvtest3"_n); + test_scanrev("eosio.kvram"_n, "kvtest1"_n); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE(kv_scanrev2, kv_tester) try { // - test_scanrev2(N(eosio.kvram)); + test_scanrev2("eosio.kvram"_n); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE(kv_iterase, kv_tester) try { // - test_iterase(N(eosio.kvram)); + test_iterase("eosio.kvram"_n); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE(kv_ram_usage, kv_tester) try { // - test_ram_usage(N(eosio.kvram)); + test_ram_usage("eosio.kvram"_n); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE(kv_resource_limit, kv_tester) try { // - test_resource_limit(N(eosio.kvram)); + test_resource_limit("eosio.kvram"_n); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE(kv_key_value_limit, kv_tester) try { // - test_key_value_limit(N(eosio.kvram)); + test_key_value_limit("eosio.kvram"_n); } FC_LOG_AND_RETHROW() -constexpr name databases[] = { N(eosio.kvram) }; +constexpr name databases[] = { "eosio.kvram"_n }; BOOST_DATA_TEST_CASE_F(kv_tester, kv_inc_dec_usage, bdata::make(databases), db) try { // test_kv_inc_dec_usage(db); @@ -784,15 +784,15 @@ static const char kv_notified_wast[] = R"=====( )====="; BOOST_DATA_TEST_CASE_F(tester, notify, bdata::make(databases), db) { - create_accounts({ N(setup), N(notified), N(notify) }); - set_code( N(setup), kv_setup_wast ); - push_action( N(eosio), N(setpriv), N(eosio), mutable_variant_object()("account", N(setup))("is_priv", 1)); - BOOST_TEST_REQUIRE(push_action( action({}, N(setup), db, construct_names_payload({N(notified), N(notify)})), N(setup).to_uint64_t() ) == ""); + create_accounts({ "setup"_n, "notified"_n, "notify"_n }); + set_code( "setup"_n, kv_setup_wast ); + push_action( "eosio"_n, "setpriv"_n, "eosio"_n, mutable_variant_object()("account", "setup"_n)("is_priv", 1)); + BOOST_TEST_REQUIRE(push_action( action({}, "setup"_n, db, construct_names_payload({"notified"_n, "notify"_n})), "setup"_n.to_uint64_t() ) == ""); - set_code( N(notify), kv_notify_wast ); - set_code( N(notified), kv_notified_wast ); + set_code( "notify"_n, kv_notify_wast ); + set_code( "notified"_n, kv_notified_wast ); - BOOST_TEST_REQUIRE(push_action( action({}, N(notify), db, {}), N(notify).to_uint64_t() ) == ""); + BOOST_TEST_REQUIRE(push_action( action({}, "notify"_n, db, {}), "notify"_n.to_uint64_t() ) == ""); } // Check corner cases of alias checks for the kv_set and kv_get intrinsics @@ -837,13 +837,13 @@ static const char kv_alias_general_wast[] = R"=====( )====="; BOOST_DATA_TEST_CASE_F(tester, alias, bdata::make(databases), db) { - const name alias_pass_account{N(alias.pass)}; - const name alias_general_account{N(alias.gen)}; + const name alias_pass_account{"alias.pass"_n}; + const name alias_general_account{"alias.gen"_n}; - create_accounts({ N(setup), alias_pass_account, alias_general_account }); - set_code( N(setup), kv_setup_wast ); - push_action( N(eosio), N(setpriv), N(eosio), mutable_variant_object()("account", N(setup))("is_priv", 1)); - BOOST_TEST_REQUIRE(push_action( action({}, N(setup), db, construct_names_payload({alias_pass_account, alias_general_account})), N(setup).to_uint64_t() ) == ""); + create_accounts({ "setup"_n, alias_pass_account, alias_general_account }); + set_code( "setup"_n, kv_setup_wast ); + push_action( "eosio"_n, "setpriv"_n, "eosio"_n, mutable_variant_object()("account", "setup"_n)("is_priv", 1)); + BOOST_TEST_REQUIRE(push_action( action({}, "setup"_n, db, construct_names_payload({alias_pass_account, alias_general_account})), "setup"_n.to_uint64_t() ) == ""); set_code( alias_pass_account, kv_alias_pass_wast ); set_code( alias_general_account, kv_alias_general_wast ); diff --git a/unittests/misc_tests.cpp b/unittests/misc_tests.cpp index cc88a5ffa60..38b718fa698 100644 --- a/unittests/misc_tests.cpp +++ b/unittests/misc_tests.cpp @@ -127,20 +127,20 @@ BOOST_AUTO_TEST_CASE(reverse_endian_tests) BOOST_AUTO_TEST_CASE(name_suffix_tests) { BOOST_CHECK_EQUAL( name{name_suffix(name(0))}, name{0} ); - BOOST_CHECK_EQUAL( name{name_suffix(N(abcdehijklmn))}, name{N(abcdehijklmn)} ); - BOOST_CHECK_EQUAL( name{name_suffix(N(abcdehijklmn1))}, name{N(abcdehijklmn1)} ); - BOOST_CHECK_EQUAL( name{name_suffix(N(abc.def))}, name{N(def)} ); - BOOST_CHECK_EQUAL( name{name_suffix(N(.abc.def))}, name{N(def)} ); - BOOST_CHECK_EQUAL( name{name_suffix(N(..abc.def))}, name{N(def)} ); - BOOST_CHECK_EQUAL( name{name_suffix(N(abc..def))}, name{N(def)} ); - BOOST_CHECK_EQUAL( name{name_suffix(N(abc.def.ghi))}, name{N(ghi)} ); - BOOST_CHECK_EQUAL( name{name_suffix(N(.abcdefghij))}, name{N(abcdefghij)} ); - BOOST_CHECK_EQUAL( name{name_suffix(N(.abcdefghij.1))}, name{N(1)} ); - BOOST_CHECK_EQUAL( name{name_suffix(N(a.bcdefghij))}, name{N(bcdefghij)} ); - BOOST_CHECK_EQUAL( name{name_suffix(N(a.bcdefghij.1))}, name{N(1)} ); - BOOST_CHECK_EQUAL( name{name_suffix(N(......a.b.c))}, name{N(c)} ); - BOOST_CHECK_EQUAL( name{name_suffix(N(abcdefhi.123))}, name{N(123)} ); - BOOST_CHECK_EQUAL( name{name_suffix(N(abcdefhij.123))}, name{N(123)} ); + BOOST_CHECK_EQUAL( name{name_suffix("abcdehijklmn"_n)}, name{"abcdehijklmn"_n} ); + BOOST_CHECK_EQUAL( name{name_suffix("abcdehijklmn1"_n)}, name{"abcdehijklmn1"_n} ); + BOOST_CHECK_EQUAL( name{name_suffix("abc.def"_n)}, name{"def"_n} ); + BOOST_CHECK_EQUAL( name{name_suffix(".abc.def"_n)}, name{"def"_n} ); + BOOST_CHECK_EQUAL( name{name_suffix("..abc.def"_n)}, name{"def"_n} ); + BOOST_CHECK_EQUAL( name{name_suffix("abc..def"_n)}, name{"def"_n} ); + BOOST_CHECK_EQUAL( name{name_suffix("abc.def.ghi"_n)}, name{"ghi"_n} ); + BOOST_CHECK_EQUAL( name{name_suffix(".abcdefghij"_n)}, name{"abcdefghij"_n} ); + BOOST_CHECK_EQUAL( name{name_suffix(".abcdefghij.1"_n)}, name{"1"_n} ); + BOOST_CHECK_EQUAL( name{name_suffix("a.bcdefghij"_n)}, name{"bcdefghij"_n} ); + BOOST_CHECK_EQUAL( name{name_suffix("a.bcdefghij.1"_n)}, name{"1"_n} ); + BOOST_CHECK_EQUAL( name{name_suffix("......a.b.c"_n)}, name{"c"_n} ); + BOOST_CHECK_EQUAL( name{name_suffix("abcdefhi.123"_n)}, name{"123"_n} ); + BOOST_CHECK_EQUAL( name{name_suffix("abcdefhij.123"_n)}, name{"123"_n} ); } /// Test processing of unbalanced strings @@ -981,10 +981,10 @@ BOOST_AUTO_TEST_CASE(prunable_transaction_data_test) { BOOST_AUTO_TEST_CASE(pruned_transaction_test) { tester t; signed_transaction trx; - trx.context_free_actions.push_back({ {}, N(eosio), N(), bytes() }); + trx.context_free_actions.push_back({ {}, "eosio"_n, ""_n, bytes() }); trx.context_free_data.push_back(bytes()); t.set_transaction_headers(trx); - trx.sign( t.get_private_key( N(eosio), "active" ), t.control->get_chain_id() ); + trx.sign( t.get_private_key( "eosio"_n, "active" ), t.control->get_chain_id() ); packed_transaction_v0 packed(trx); packed_transaction pruned(std::move(trx), true); @@ -1024,11 +1024,11 @@ static checksum256_type calculate_trx_merkle( const deque& BOOST_AUTO_TEST_CASE(pruned_block_test) { tester t; signed_transaction trx; - trx.actions.push_back({ { permission_level{ N(eosio), N(active) } }, N(eosio), N(), bytes() } ); - trx.context_free_actions.push_back({ {}, N(eosio), N(), bytes() }); + trx.actions.push_back({ { permission_level{ "eosio"_n, "active"_n } }, "eosio"_n, ""_n, bytes() } ); + trx.context_free_actions.push_back({ {}, "eosio"_n, ""_n, bytes() }); trx.context_free_data.push_back(bytes()); t.set_transaction_headers(trx); - trx.sign( t.get_private_key( N(eosio), "active" ), t.control->get_chain_id() ); + trx.sign( t.get_private_key( "eosio"_n, "active" ), t.control->get_chain_id() ); t.push_transaction(trx); signed_block_ptr produced = t.produce_block(); diff --git a/unittests/name_tests.cpp b/unittests/name_tests.cpp index 9f48679d3f1..d31e5d0457c 100644 --- a/unittests/name_tests.cpp +++ b/unittests/name_tests.cpp @@ -349,38 +349,38 @@ try { } FC_LOG_AND_RETHROW() } -BOOST_AUTO_TEST_CASE(nmacro_test) { +BOOST_AUTO_TEST_CASE(n_operator_test) { try { - + // ------------------------------------ - // N() macro - BOOST_TEST( name{} == N() ); - - BOOST_TEST( name{"1"} == N(1) ); - BOOST_TEST( name{"5"} == N(5) ); - BOOST_TEST( name{"a"} == N(a) ); - BOOST_TEST( name{"z"} == N(z) ); - - BOOST_TEST( name{"abc"} == N(abc) ); - BOOST_TEST( name{"123"} == N(123) ); - - BOOST_TEST( name{".abc"} == N(.abc) ); - BOOST_TEST( name{".........abc"} == N(.........abc) ); - BOOST_TEST( name{"123."} == N(123.) ); - BOOST_TEST( name{"123........."} == N(123.........) ); - BOOST_TEST( name{".a.b.c.1.2.3."} == N(.a.b.c.1.2.3.) ); - - BOOST_TEST( name{"abc.123"} == N(abc.123) ); - BOOST_TEST( name{"123.abc"} == N(123.abc) ); - - BOOST_TEST( name{"12345abcdefgj"} == N(12345abcdefgj) ); - BOOST_TEST( name{"hijklmnopqrsj"} == N(hijklmnopqrsj) ); - BOOST_TEST( name{"tuvwxyz.1234j"} == N(tuvwxyz.1234j) ); - - BOOST_TEST( name{"111111111111j"} == N(111111111111j) ); - BOOST_TEST( name{"555555555555j"} == N(555555555555j) ); - BOOST_TEST( name{"aaaaaaaaaaaaj"} == N(aaaaaaaaaaaaj) ); - BOOST_TEST( name{"zzzzzzzzzzzzj"} == N(zzzzzzzzzzzzj) ); + // ""_n operator + BOOST_TEST( name{} == ""_n ); + + BOOST_TEST( name{"1"} == "1"_n ); + BOOST_TEST( name{"5"} == "5"_n ); + BOOST_TEST( name{"a"} == "a"_n ); + BOOST_TEST( name{"z"} == "z"_n ); + + BOOST_TEST( name{"abc"} == "abc"_n ); + BOOST_TEST( name{"123"} == "123"_n ); + + BOOST_TEST( name{".abc"} == ".abc"_n ); + BOOST_TEST( name{".........abc"} == ".........abc"_n ); + BOOST_TEST( name{"123."} == "123."_n ); + BOOST_TEST( name{"123........."} == "123........."_n ); + BOOST_TEST( name{".a.b.c.1.2.3."} == ".a.b.c.1.2.3."_n ); + + BOOST_TEST( name{"abc.123"} == "abc.123"_n ); + BOOST_TEST( name{"123.abc"} == "123.abc"_n ); + + BOOST_TEST( name{"12345abcdefgj"} == "12345abcdefgj"_n ); + BOOST_TEST( name{"hijklmnopqrsj"} == "hijklmnopqrsj"_n ); + BOOST_TEST( name{"tuvwxyz.1234j"} == "tuvwxyz.1234j"_n ); + + BOOST_TEST( name{"111111111111j"} == "111111111111j"_n ); + BOOST_TEST( name{"555555555555j"} == "555555555555j"_n ); + BOOST_TEST( name{"aaaaaaaaaaaaj"} == "aaaaaaaaaaaaj"_n ); + BOOST_TEST( name{"zzzzzzzzzzzzj"} == "zzzzzzzzzzzzj"_n ); } FC_LOG_AND_RETHROW() } diff --git a/unittests/params_tests.cpp b/unittests/params_tests.cpp index 17a6e271bce..70256daa193 100644 --- a/unittests/params_tests.cpp +++ b/unittests/params_tests.cpp @@ -53,24 +53,24 @@ BOOST_AUTO_TEST_SUITE(params_tests) BOOST_FIXTURE_TEST_CASE(main_test, params_tester){ //no throw = success - action(N(maintest), mvo()); + action("maintest"_n, mvo()); //doesn't throw as we have all protocol features activated - action(N(throwrvia1), mvo()); - action(N(throwrvia2), mvo()); + action("throwrvia1"_n, mvo()); + action("throwrvia2"_n, mvo()); } BOOST_FIXTURE_TEST_CASE(throw_test, params_tester){ - BOOST_CHECK_THROW( [&]{action(N(setthrow1), mvo());}(), chain::config_parse_error); - BOOST_CHECK_THROW( [&]{action(N(setthrow2), mvo());}(), fc::out_of_range_exception); - BOOST_CHECK_THROW( [&]{action(N(setthrow3), mvo());}(), chain::action_validate_exception); - BOOST_CHECK_THROW( [&]{action(N(getthrow1), mvo());}(), chain::config_parse_error); - BOOST_CHECK_THROW( [&]{action(N(getthrow2), mvo());}(), fc::out_of_range_exception); - BOOST_CHECK_THROW( [&]{action(N(getthrow3), mvo());}(), chain::config_parse_error); + BOOST_CHECK_THROW( [&]{action("setthrow1"_n, mvo());}(), chain::config_parse_error); + BOOST_CHECK_THROW( [&]{action("setthrow2"_n, mvo());}(), fc::out_of_range_exception); + BOOST_CHECK_THROW( [&]{action("setthrow3"_n, mvo());}(), chain::action_validate_exception); + BOOST_CHECK_THROW( [&]{action("getthrow1"_n, mvo());}(), chain::config_parse_error); + BOOST_CHECK_THROW( [&]{action("getthrow2"_n, mvo());}(), fc::out_of_range_exception); + BOOST_CHECK_THROW( [&]{action("getthrow3"_n, mvo());}(), chain::config_parse_error); } BOOST_FIXTURE_TEST_CASE(throw_test2, params_tester2){ - BOOST_CHECK_THROW( [&]{action(N(throwrvia1), mvo());}(), chain::unsupported_feature); - BOOST_CHECK_THROW( [&]{action(N(throwrvia2), mvo());}(), chain::unsupported_feature); + BOOST_CHECK_THROW( [&]{action("throwrvia1"_n, mvo());}(), chain::unsupported_feature); + BOOST_CHECK_THROW( [&]{action("throwrvia2"_n, mvo());}(), chain::unsupported_feature); } -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file +BOOST_AUTO_TEST_SUITE_END() diff --git a/unittests/payloadless_tests.cpp b/unittests/payloadless_tests.cpp index f56d03e122e..635e42a8a1c 100644 --- a/unittests/payloadless_tests.cpp +++ b/unittests/payloadless_tests.cpp @@ -34,11 +34,11 @@ BOOST_AUTO_TEST_SUITE(payloadless_tests) BOOST_FIXTURE_TEST_CASE( test_doit, payloadless_tester ) { - create_accounts( {N(payloadless)} ); - set_code( N(payloadless), contracts::payloadless_wasm() ); - set_abi( N(payloadless), contracts::payloadless_abi().data() ); + create_accounts( {"payloadless"_n} ); + set_code( "payloadless"_n, contracts::payloadless_wasm() ); + set_abi( "payloadless"_n, contracts::payloadless_abi().data() ); - auto trace = push_action(N(payloadless), N(doit), N(payloadless), mutable_variant_object()); + auto trace = push_action("payloadless"_n, "doit"_n, "payloadless"_n, mutable_variant_object()); auto msg = trace->action_traces.front().console; BOOST_CHECK_EQUAL(msg == "Im a payloadless action", true); } @@ -47,18 +47,18 @@ BOOST_FIXTURE_TEST_CASE( test_doit, payloadless_tester ) { // abi_serializer was failing when action data was empty. BOOST_FIXTURE_TEST_CASE( test_abi_serializer, payloadless_tester ) { - create_accounts( {N(payloadless)} ); - set_code( N(payloadless), contracts::payloadless_wasm() ); - set_abi( N(payloadless), contracts::payloadless_abi().data() ); + create_accounts( {"payloadless"_n} ); + set_code( "payloadless"_n, contracts::payloadless_wasm() ); + set_abi( "payloadless"_n, contracts::payloadless_abi().data() ); fc::variant pretty_trx = fc::mutable_variant_object() ("actions", fc::variants({ fc::mutable_variant_object() - ("account", name(N(payloadless))) + ("account", name("payloadless"_n)) ("name", "doit") ("authorization", fc::variants({ fc::mutable_variant_object() - ("actor", name(N(payloadless))) + ("actor", name("payloadless"_n)) ("permission", name(config::active_name)) })) ("data", fc::mutable_variant_object() @@ -71,7 +71,7 @@ BOOST_FIXTURE_TEST_CASE( test_abi_serializer, payloadless_tester ) { abi_serializer::from_variant(pretty_trx, trx, get_resolver(), abi_serializer::create_yield_function( abi_serializer_max_time )); set_transaction_headers(trx); - trx.sign( get_private_key( N(payloadless), "active" ), control->get_chain_id() ); + trx.sign( get_private_key( "payloadless"_n, "active" ), control->get_chain_id() ); auto trace = push_transaction( trx ); auto msg = trace->action_traces.front().console; BOOST_CHECK_EQUAL(msg == "Im a payloadless action", true); diff --git a/unittests/producer_schedule_tests.cpp b/unittests/producer_schedule_tests.cpp index 9e81b756668..47a15047dcd 100644 --- a/unittests/producer_schedule_tests.cpp +++ b/unittests/producer_schedule_tests.cpp @@ -200,7 +200,7 @@ BOOST_AUTO_TEST_SUITE(producer_schedule_tests) BOOST_FIXTURE_TEST_CASE( producer_schedule_promotion_test, TESTER ) try { - create_accounts( {N(alice),N(bob),N(carol)} ); + create_accounts( {"alice"_n,"bob"_n,"carol"_n} ); while (control->head_block_num() < 3) { produce_block(); } @@ -209,10 +209,10 @@ BOOST_FIXTURE_TEST_CASE( producer_schedule_promotion_test, TESTER ) try { return std::equal( a.begin(), a.end(), b.producers.begin(), b.producers.end() ); }; - auto res = set_producers( {N(alice),N(bob)} ); + auto res = set_producers( {"alice"_n,"bob"_n} ); vector sch1 = { - producer_authority{N(alice), block_signing_authority_v0{1, {{get_public_key(N(alice), "active"), 1}}}}, - producer_authority{N(bob), block_signing_authority_v0{1, {{get_public_key(N(bob), "active"), 1}}}} + producer_authority{"alice"_n, block_signing_authority_v0{1, {{get_public_key("alice"_n, "active"), 1}}}}, + producer_authority{"bob"_n, block_signing_authority_v0{1, {{get_public_key("bob"_n, "active"), 1}}}} }; //wdump((fc::json::to_pretty_string(res))); wlog("set producer schedule to [alice,bob]"); @@ -229,11 +229,11 @@ BOOST_FIXTURE_TEST_CASE( producer_schedule_promotion_test, TESTER ) try { BOOST_CHECK_EQUAL( true, compare_schedules( sch1, control->active_producers() ) ); produce_blocks(6); - res = set_producers( {N(alice),N(bob),N(carol)} ); + res = set_producers( {"alice"_n,"bob"_n,"carol"_n} ); vector sch2 = { - producer_authority{N(alice), block_signing_authority_v0{1, {{get_public_key(N(alice), "active"),1}}}}, - producer_authority{N(bob), block_signing_authority_v0{1, {{get_public_key(N(bob), "active"),1}}}}, - producer_authority{N(carol), block_signing_authority_v0{1, {{get_public_key(N(carol), "active"),1}}}} + producer_authority{"alice"_n, block_signing_authority_v0{1, {{get_public_key("alice"_n, "active"),1}}}}, + producer_authority{"bob"_n, block_signing_authority_v0{1, {{get_public_key("bob"_n, "active"),1}}}}, + producer_authority{"carol"_n, block_signing_authority_v0{1, {{get_public_key("carol"_n, "active"),1}}}} }; wlog("set producer schedule to [alice,bob,carol]"); BOOST_REQUIRE_EQUAL( true, control->proposed_producers().has_value() ); @@ -242,16 +242,16 @@ BOOST_FIXTURE_TEST_CASE( producer_schedule_promotion_test, TESTER ) try { produce_block(); produce_blocks(23); // Alice produces the last block of her first round. // Bob's first block (which advances LIB to Alice's last block) is started but not finalized. - BOOST_REQUIRE_EQUAL( control->head_block_producer(), N(alice) ); - BOOST_REQUIRE_EQUAL( control->pending_block_producer(), N(bob) ); + BOOST_REQUIRE_EQUAL( control->head_block_producer(), "alice"_n ); + BOOST_REQUIRE_EQUAL( control->pending_block_producer(), "bob"_n ); BOOST_CHECK_EQUAL( control->pending_producers().version, 2u ); produce_blocks(12); // Bob produces his first 11 blocks BOOST_CHECK_EQUAL( control->active_producers().version, 1u ); produce_blocks(12); // Bob produces his 12th block. // Alice's first block of the second round is started but not finalized (which advances LIB to Bob's last block). - BOOST_REQUIRE_EQUAL( control->head_block_producer(), N(alice) ); - BOOST_REQUIRE_EQUAL( control->pending_block_producer(), N(bob) ); + BOOST_REQUIRE_EQUAL( control->head_block_producer(), "alice"_n ); + BOOST_REQUIRE_EQUAL( control->pending_block_producer(), "bob"_n ); BOOST_CHECK_EQUAL( control->active_producers().version, 2u ); BOOST_CHECK_EQUAL( true, compare_schedules( sch2, control->active_producers() ) ); @@ -259,13 +259,13 @@ BOOST_FIXTURE_TEST_CASE( producer_schedule_promotion_test, TESTER ) try { // The next block will be produced according to the new schedule produce_block(); - BOOST_CHECK_EQUAL( control->head_block_producer(), N(carol) ); // And that next block happens to be produced by Carol. + BOOST_CHECK_EQUAL( control->head_block_producer(), "carol"_n ); // And that next block happens to be produced by Carol. BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( producer_schedule_reduction, tester ) try { - create_accounts( {N(alice),N(bob),N(carol)} ); + create_accounts( {"alice"_n,"bob"_n,"carol"_n} ); while (control->head_block_num() < 3) { produce_block(); } @@ -274,11 +274,11 @@ BOOST_FIXTURE_TEST_CASE( producer_schedule_reduction, tester ) try { return std::equal( a.begin(), a.end(), b.producers.begin(), b.producers.end() ); }; - auto res = set_producers( {N(alice),N(bob),N(carol)} ); + auto res = set_producers( {"alice"_n,"bob"_n,"carol"_n} ); vector sch1 = { - producer_authority{N(alice), block_signing_authority_v0{ 1, {{get_public_key(N(alice), "active"),1}}}}, - producer_authority{N(bob), block_signing_authority_v0{ 1, {{get_public_key(N(bob), "active"),1}}}}, - producer_authority{N(carol), block_signing_authority_v0{ 1, {{get_public_key(N(carol), "active"),1}}}} + producer_authority{"alice"_n, block_signing_authority_v0{ 1, {{get_public_key("alice"_n, "active"),1}}}}, + producer_authority{"bob"_n, block_signing_authority_v0{ 1, {{get_public_key("bob"_n, "active"),1}}}}, + producer_authority{"carol"_n, block_signing_authority_v0{ 1, {{get_public_key("carol"_n, "active"),1}}}} }; wlog("set producer schedule to [alice,bob,carol]"); BOOST_REQUIRE_EQUAL( true, control->proposed_producers().has_value() ); @@ -294,31 +294,31 @@ BOOST_FIXTURE_TEST_CASE( producer_schedule_reduction, tester ) try { BOOST_CHECK_EQUAL( true, compare_schedules( sch1, control->active_producers() ) ); produce_blocks(6); - res = set_producers( {N(alice),N(bob)} ); + res = set_producers( {"alice"_n,"bob"_n} ); vector sch2 = { - producer_authority{N(alice), block_signing_authority_v0{ 1, {{ get_public_key(N(alice), "active"),1}}}}, - producer_authority{N(bob), block_signing_authority_v0{ 1, {{ get_public_key(N(bob), "active"),1}}}} + producer_authority{"alice"_n, block_signing_authority_v0{ 1, {{ get_public_key("alice"_n, "active"),1}}}}, + producer_authority{"bob"_n, block_signing_authority_v0{ 1, {{ get_public_key("bob"_n, "active"),1}}}} }; wlog("set producer schedule to [alice,bob]"); BOOST_REQUIRE_EQUAL( true, control->proposed_producers().has_value() ); BOOST_CHECK_EQUAL( true, compare_schedules( sch2, *control->proposed_producers() ) ); produce_blocks(48); - BOOST_REQUIRE_EQUAL( control->head_block_producer(), N(bob) ); - BOOST_REQUIRE_EQUAL( control->pending_block_producer(), N(carol) ); + BOOST_REQUIRE_EQUAL( control->head_block_producer(), "bob"_n ); + BOOST_REQUIRE_EQUAL( control->pending_block_producer(), "carol"_n ); BOOST_CHECK_EQUAL( control->pending_producers().version, 2u ); produce_blocks(47); BOOST_CHECK_EQUAL( control->active_producers().version, 1u ); produce_blocks(1); - BOOST_REQUIRE_EQUAL( control->head_block_producer(), N(carol) ); - BOOST_REQUIRE_EQUAL( control->pending_block_producer(), N(alice) ); + BOOST_REQUIRE_EQUAL( control->head_block_producer(), "carol"_n ); + BOOST_REQUIRE_EQUAL( control->pending_block_producer(), "alice"_n ); BOOST_CHECK_EQUAL( control->active_producers().version, 2u ); BOOST_CHECK_EQUAL( true, compare_schedules( sch2, control->active_producers() ) ); produce_blocks(2); - BOOST_CHECK_EQUAL( control->head_block_producer(), N(bob) ); + BOOST_CHECK_EQUAL( control->head_block_producer(), "bob"_n ); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() @@ -328,7 +328,7 @@ BOOST_AUTO_TEST_CASE( empty_producer_schedule_has_no_effect ) try { validating_tester c( tempdir, true ); c.execute_setup_policy( setup_policy::preactivate_feature_and_new_bios ); - c.create_accounts( {N(alice),N(bob),N(carol)} ); + c.create_accounts( {"alice"_n,"bob"_n,"carol"_n} ); while (c.control->head_block_num() < 3) { c.produce_block(); } @@ -337,10 +337,10 @@ BOOST_AUTO_TEST_CASE( empty_producer_schedule_has_no_effect ) try { return std::equal( a.begin(), a.end(), b.producers.begin(), b.producers.end() ); }; - auto res = c.set_producers_legacy( {N(alice),N(bob)} ); + auto res = c.set_producers_legacy( {"alice"_n,"bob"_n} ); vector sch1 = { - producer_authority{N(alice), block_signing_authority_v0{ 1, {{ get_public_key(N(alice), "active"),1}}}}, - producer_authority{N(bob), block_signing_authority_v0{ 1, {{ get_public_key(N(bob), "active"),1}}}} + producer_authority{"alice"_n, block_signing_authority_v0{ 1, {{ get_public_key("alice"_n, "active"),1}}}}, + producer_authority{"bob"_n, block_signing_authority_v0{ 1, {{ get_public_key("bob"_n, "active"),1}}}} }; wlog("set producer schedule to [alice,bob]"); BOOST_REQUIRE_EQUAL( true, c.control->proposed_producers().has_value() ); @@ -379,11 +379,11 @@ BOOST_AUTO_TEST_CASE( empty_producer_schedule_has_no_effect ) try { BOOST_CHECK_EQUAL( c.control->pending_producers().version, 2u ); // Setting a new producer schedule should still use version 2 - res = c.set_producers_legacy( {N(alice),N(bob),N(carol)} ); + res = c.set_producers_legacy( {"alice"_n,"bob"_n,"carol"_n} ); vector sch2 = { - producer_authority{N(alice), block_signing_authority_v0{ 1, {{get_public_key(N(alice), "active"),1}}}}, - producer_authority{N(bob), block_signing_authority_v0{ 1, {{get_public_key(N(bob), "active"),1}}}}, - producer_authority{N(carol), block_signing_authority_v0{ 1, {{get_public_key(N(carol), "active"),1}}}} + producer_authority{"alice"_n, block_signing_authority_v0{ 1, {{get_public_key("alice"_n, "active"),1}}}}, + producer_authority{"bob"_n, block_signing_authority_v0{ 1, {{get_public_key("bob"_n, "active"),1}}}}, + producer_authority{"carol"_n, block_signing_authority_v0{ 1, {{get_public_key("carol"_n, "active"),1}}}} }; wlog("set producer schedule to [alice,bob,carol]"); BOOST_REQUIRE_EQUAL( true, c.control->proposed_producers().has_value() ); @@ -407,18 +407,18 @@ BOOST_AUTO_TEST_CASE( empty_producer_schedule_has_no_effect ) try { BOOST_AUTO_TEST_CASE( producer_watermark_test ) try { tester c; - c.create_accounts( {N(alice),N(bob),N(carol)} ); + c.create_accounts( {"alice"_n,"bob"_n,"carol"_n} ); c.produce_block(); auto compare_schedules = [&]( const vector& a, const producer_authority_schedule& b ) { return std::equal( a.begin(), a.end(), b.producers.begin(), b.producers.end() ); }; - auto res = c.set_producers( {N(alice),N(bob),N(carol)} ); + auto res = c.set_producers( {"alice"_n,"bob"_n,"carol"_n} ); vector sch1 = { - producer_authority{N(alice), block_signing_authority_v0{ 1, {{c.get_public_key(N(alice), "active"),1}}}}, - producer_authority{N(bob), block_signing_authority_v0{ 1, {{c.get_public_key(N(bob), "active"),1}}}}, - producer_authority{N(carol), block_signing_authority_v0{ 1, {{c.get_public_key(N(carol), "active"),1}}}} + producer_authority{"alice"_n, block_signing_authority_v0{ 1, {{c.get_public_key("alice"_n, "active"),1}}}}, + producer_authority{"bob"_n, block_signing_authority_v0{ 1, {{c.get_public_key("bob"_n, "active"),1}}}}, + producer_authority{"carol"_n, block_signing_authority_v0{ 1, {{c.get_public_key("carol"_n, "active"),1}}}} }; wlog("set producer schedule to [alice,bob,carol]"); BOOST_REQUIRE_EQUAL( true, c.control->proposed_producers().has_value() ); @@ -433,49 +433,49 @@ BOOST_AUTO_TEST_CASE( producer_watermark_test ) try { BOOST_REQUIRE_EQUAL( c.control->active_producers().version, 1u ); BOOST_CHECK_EQUAL( true, compare_schedules( sch1, c.control->active_producers() ) ); - produce_until_transition( c, N(carol), N(alice) ); + produce_until_transition( c, "carol"_n, "alice"_n ); c.produce_block(); - produce_until_transition( c, N(carol), N(alice) ); + produce_until_transition( c, "carol"_n, "alice"_n ); - res = c.set_producers( {N(alice),N(bob)} ); + res = c.set_producers( {"alice"_n,"bob"_n} ); vector sch2 = { - producer_authority{N(alice), block_signing_authority_v0{ 1, {{c.get_public_key(N(alice), "active"),1}}}}, - producer_authority{N(bob), block_signing_authority_v0{ 1, {{c.get_public_key(N(bob), "active"),1}}}} + producer_authority{"alice"_n, block_signing_authority_v0{ 1, {{c.get_public_key("alice"_n, "active"),1}}}}, + producer_authority{"bob"_n, block_signing_authority_v0{ 1, {{c.get_public_key("bob"_n, "active"),1}}}} }; wlog("set producer schedule to [alice,bob]"); BOOST_REQUIRE_EQUAL( true, c.control->proposed_producers().has_value() ); BOOST_CHECK_EQUAL( true, compare_schedules( sch2, *c.control->proposed_producers() ) ); - produce_until_transition( c, N(bob), N(carol) ); - produce_until_transition( c, N(alice), N(bob) ); + produce_until_transition( c, "bob"_n, "carol"_n ); + produce_until_transition( c, "alice"_n, "bob"_n ); BOOST_CHECK_EQUAL( c.control->pending_producers().version, 2u ); BOOST_CHECK_EQUAL( c.control->active_producers().version, 1u ); - produce_until_transition( c, N(carol), N(alice) ); + produce_until_transition( c, "carol"_n, "alice"_n ); BOOST_CHECK_EQUAL( c.control->pending_producers().version, 2u ); BOOST_CHECK_EQUAL( c.control->active_producers().version, 1u ); - produce_until_transition( c, N(bob), N(carol) ); - BOOST_CHECK_EQUAL( c.control->pending_block_producer(), N(carol) ); + produce_until_transition( c, "bob"_n, "carol"_n ); + BOOST_CHECK_EQUAL( c.control->pending_block_producer(), "carol"_n ); BOOST_REQUIRE_EQUAL( c.control->active_producers().version, 2u ); auto carol_last_produced_block_num = c.control->head_block_num() + 1; wdump((carol_last_produced_block_num)); c.produce_block(); - BOOST_CHECK( c.control->pending_block_producer() == N(alice) ); + BOOST_CHECK( c.control->pending_block_producer() == "alice"_n ); - res = c.set_producers( {N(alice),N(bob),N(carol)} ); + res = c.set_producers( {"alice"_n,"bob"_n,"carol"_n} ); wlog("set producer schedule to [alice,bob,carol]"); BOOST_REQUIRE_EQUAL( true, c.control->proposed_producers().has_value() ); BOOST_CHECK_EQUAL( true, compare_schedules( sch1, *c.control->proposed_producers() ) ); - produce_until_transition( c, N(bob), N(alice) ); + produce_until_transition( c, "bob"_n, "alice"_n ); auto bob_last_produced_block_num = c.control->head_block_num(); wdump((bob_last_produced_block_num)); - produce_until_transition( c, N(alice), N(bob) ); + produce_until_transition( c, "alice"_n, "bob"_n ); auto alice_last_produced_block_num = c.control->head_block_num(); wdump((alice_last_produced_block_num)); @@ -483,13 +483,13 @@ BOOST_AUTO_TEST_CASE( producer_watermark_test ) try { { wdump((c.control->head_block_state()->producer_to_last_produced)); const auto& last_produced = c.control->head_block_state()->producer_to_last_produced; - auto alice_itr = last_produced.find( N(alice) ); + auto alice_itr = last_produced.find( "alice"_n ); BOOST_REQUIRE( alice_itr != last_produced.end() ); BOOST_CHECK_EQUAL( alice_itr->second, alice_last_produced_block_num ); - auto bob_itr = last_produced.find( N(bob) ); + auto bob_itr = last_produced.find( "bob"_n ); BOOST_REQUIRE( bob_itr != last_produced.end() ); BOOST_CHECK_EQUAL( bob_itr->second, bob_last_produced_block_num ); - auto carol_itr = last_produced.find( N(carol) ); + auto carol_itr = last_produced.find( "carol"_n ); BOOST_REQUIRE( carol_itr != last_produced.end() ); BOOST_CHECK_EQUAL( carol_itr->second, carol_last_produced_block_num ); } @@ -497,12 +497,12 @@ BOOST_AUTO_TEST_CASE( producer_watermark_test ) try { BOOST_CHECK_EQUAL( c.control->pending_producers().version, 3u ); BOOST_REQUIRE_EQUAL( c.control->active_producers().version, 2u ); - produce_until_transition( c, N(bob), N(alice) ); + produce_until_transition( c, "bob"_n, "alice"_n ); BOOST_REQUIRE_EQUAL( c.control->active_producers().version, 3u ); - produce_until_transition( c, N(alice), N(bob) ); + produce_until_transition( c, "alice"_n, "bob"_n ); c.produce_blocks(11); - BOOST_CHECK_EQUAL( c.control->pending_block_producer(), N(bob) ); + BOOST_CHECK_EQUAL( c.control->pending_block_producer(), "bob"_n ); c.finish_block(); auto carol_block_num = c.control->head_block_num() + 1; @@ -510,62 +510,62 @@ BOOST_AUTO_TEST_CASE( producer_watermark_test ) try { auto confirmed = carol_block_num - carol_last_produced_block_num - 1; c.control->start_block( carol_block_time, confirmed ); - BOOST_CHECK_EQUAL( c.control->pending_block_producer(), N(carol) ); + BOOST_CHECK_EQUAL( c.control->pending_block_producer(), "carol"_n ); c.produce_block(); auto h = c.control->head_block_header(); - BOOST_CHECK_EQUAL( h.producer, N(carol) ); + BOOST_CHECK_EQUAL( h.producer, "carol"_n ); BOOST_CHECK_EQUAL( h.confirmed, confirmed ); - produce_until_transition( c, N(carol), N(alice) ); + produce_until_transition( c, "carol"_n, "alice"_n ); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( producer_one_of_n_test, TESTER ) try { - create_accounts( {N(alice),N(bob)} ); + create_accounts( {"alice"_n,"bob"_n} ); produce_block(); vector sch1 = { - producer_authority{N(alice), block_signing_authority_v0{1, {{get_public_key(N(alice), "bs1"), 1}, {get_public_key(N(alice), "bs2"), 1}}}}, - producer_authority{N(bob), block_signing_authority_v0{1, {{get_public_key(N(bob), "bs1"), 1}, {get_public_key(N(bob), "bs2"), 1}}}} + producer_authority{"alice"_n, block_signing_authority_v0{1, {{get_public_key("alice"_n, "bs1"), 1}, {get_public_key("alice"_n, "bs2"), 1}}}}, + producer_authority{"bob"_n, block_signing_authority_v0{1, {{get_public_key("bob"_n, "bs1"), 1}, {get_public_key("bob"_n, "bs2"), 1}}}} }; auto res = set_producer_schedule( sch1 ); - block_signing_private_keys.emplace(get_public_key(N(alice), "bs1"), get_private_key(N(alice), "bs1")); - block_signing_private_keys.emplace(get_public_key(N(bob), "bs1"), get_private_key(N(bob), "bs1")); + block_signing_private_keys.emplace(get_public_key("alice"_n, "bs1"), get_private_key("alice"_n, "bs1")); + block_signing_private_keys.emplace(get_public_key("bob"_n, "bs1"), get_private_key("bob"_n, "bs1")); - BOOST_REQUIRE(produce_until_blocks_from(*this, {N(alice), N(bob)}, 300)); + BOOST_REQUIRE(produce_until_blocks_from(*this, {"alice"_n, "bob"_n}, 300)); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( producer_m_of_n_test, TESTER ) try { - create_accounts( {N(alice),N(bob)} ); + create_accounts( {"alice"_n,"bob"_n} ); produce_block(); vector sch1 = { - producer_authority{N(alice), block_signing_authority_v0{2, {{get_public_key(N(alice), "bs1"), 1}, {get_public_key(N(alice), "bs2"), 1}}}}, - producer_authority{N(bob), block_signing_authority_v0{2, {{get_public_key(N(bob), "bs1"), 1}, {get_public_key(N(bob), "bs2"), 1}}}} + producer_authority{"alice"_n, block_signing_authority_v0{2, {{get_public_key("alice"_n, "bs1"), 1}, {get_public_key("alice"_n, "bs2"), 1}}}}, + producer_authority{"bob"_n, block_signing_authority_v0{2, {{get_public_key("bob"_n, "bs1"), 1}, {get_public_key("bob"_n, "bs2"), 1}}}} }; auto res = set_producer_schedule( sch1 ); - block_signing_private_keys.emplace(get_public_key(N(alice), "bs1"), get_private_key(N(alice), "bs1")); - block_signing_private_keys.emplace(get_public_key(N(alice), "bs2"), get_private_key(N(alice), "bs2")); - block_signing_private_keys.emplace(get_public_key(N(bob), "bs1"), get_private_key(N(bob), "bs1")); - block_signing_private_keys.emplace(get_public_key(N(bob), "bs2"), get_private_key(N(bob), "bs2")); + block_signing_private_keys.emplace(get_public_key("alice"_n, "bs1"), get_private_key("alice"_n, "bs1")); + block_signing_private_keys.emplace(get_public_key("alice"_n, "bs2"), get_private_key("alice"_n, "bs2")); + block_signing_private_keys.emplace(get_public_key("bob"_n, "bs1"), get_private_key("bob"_n, "bs1")); + block_signing_private_keys.emplace(get_public_key("bob"_n, "bs2"), get_private_key("bob"_n, "bs2")); - BOOST_REQUIRE(produce_until_blocks_from(*this, {N(alice), N(bob)}, 300)); + BOOST_REQUIRE(produce_until_blocks_from(*this, {"alice"_n, "bob"_n}, 300)); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( satisfiable_msig_test, TESTER ) try { - create_accounts( {N(alice),N(bob)} ); + create_accounts( {"alice"_n,"bob"_n} ); produce_block(); vector sch1 = { - producer_authority{N(alice), block_signing_authority_v0{2, {{get_public_key(N(alice), "bs1"), 1}}}} + producer_authority{"alice"_n, block_signing_authority_v0{2, {{get_public_key("alice"_n, "bs1"), 1}}}} }; // ensure that the entries in a wtmsig schedule are rejected if not satisfiable @@ -579,12 +579,12 @@ BOOST_FIXTURE_TEST_CASE( satisfiable_msig_test, TESTER ) try { } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( duplicate_producers_test, TESTER ) try { - create_accounts( {N(alice)} ); + create_accounts( {"alice"_n} ); produce_block(); vector sch1 = { - producer_authority{N(alice), block_signing_authority_v0{1, {{get_public_key(N(alice), "bs1"), 1}}}}, - producer_authority{N(alice), block_signing_authority_v0{1, {{get_public_key(N(alice), "bs2"), 1}}}} + producer_authority{"alice"_n, block_signing_authority_v0{1, {{get_public_key("alice"_n, "bs1"), 1}}}}, + producer_authority{"alice"_n, block_signing_authority_v0{1, {{get_public_key("alice"_n, "bs2"), 1}}}} }; // ensure that the schedule is rejected if it has duplicate producers in it @@ -598,11 +598,11 @@ BOOST_FIXTURE_TEST_CASE( duplicate_producers_test, TESTER ) try { } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( duplicate_keys_test, TESTER ) try { - create_accounts( {N(alice),N(bob)} ); + create_accounts( {"alice"_n,"bob"_n} ); produce_block(); vector sch1 = { - producer_authority{N(alice), block_signing_authority_v0{2, {{get_public_key(N(alice), "bs1"), 1}, {get_public_key(N(alice), "bs1"), 1}}}} + producer_authority{"alice"_n, block_signing_authority_v0{2, {{get_public_key("alice"_n, "bs1"), 1}, {get_public_key("alice"_n, "bs1"), 1}}}} }; // ensure that the schedule is rejected if it has duplicate keys for a single producer in it @@ -615,8 +615,8 @@ BOOST_FIXTURE_TEST_CASE( duplicate_keys_test, TESTER ) try { // ensure that multiple producers are allowed to share keys vector sch2 = { - producer_authority{N(alice), block_signing_authority_v0{1, {{get_public_key(N(alice), "bs1"), 1}}}}, - producer_authority{N(bob), block_signing_authority_v0{1, {{get_public_key(N(alice), "bs1"), 1}}}} + producer_authority{"alice"_n, block_signing_authority_v0{1, {{get_public_key("alice"_n, "bs1"), 1}}}}, + producer_authority{"bob"_n, block_signing_authority_v0{1, {{get_public_key("alice"_n, "bs1"), 1}}}} }; set_producer_schedule( sch2 ); @@ -632,14 +632,14 @@ BOOST_AUTO_TEST_CASE( large_authority_overflow_test ) try { for (int i = 0; i < pre_overflow_count; i++) { auto key_str = std::to_string(i) + "_bsk"; - auth.keys.emplace_back(key_weight{get_public_key(N(alice), key_str), 0xFFFFU}); + auth.keys.emplace_back(key_weight{get_public_key("alice"_n, key_str), 0xFFFFU}); } // reduce the last weight by 1 so that its unsatisfiable auth.keys.back().weight = 0xFFFEU; // add one last key with a weight of 2 so that its only satisfiable with values that sum to an overflow of 32bit uint - auth.keys.emplace_back(key_weight{get_public_key(N(alice), std::to_string(pre_overflow_count) + "_bsk"), 0x0002U}); + auth.keys.emplace_back(key_weight{get_public_key("alice"_n, std::to_string(pre_overflow_count) + "_bsk"), 0x0002U}); auth.threshold = 0xFFFFFFFFUL; } diff --git a/unittests/protocol_feature_tests.cpp b/unittests/protocol_feature_tests.cpp index 3176b27631b..360878e5828 100644 --- a/unittests/protocol_feature_tests.cpp +++ b/unittests/protocol_feature_tests.cpp @@ -53,13 +53,13 @@ BOOST_AUTO_TEST_CASE( activate_preactivate_feature ) try { c.produce_block(); - BOOST_CHECK_EXCEPTION( c.push_action( config::system_account_name, N(reqactivated), config::system_account_name, + BOOST_CHECK_EXCEPTION( c.push_action( config::system_account_name, "reqactivated"_n, config::system_account_name, mutable_variant_object()("feature_digest", digest_type()) ), eosio_assert_message_exception, eosio_assert_message_is( "protocol feature is not activated" ) ); - c.push_action( config::system_account_name, N(reqactivated), config::system_account_name, mutable_variant_object() + c.push_action( config::system_account_name, "reqactivated"_n, config::system_account_name, mutable_variant_object() ("feature_digest", *d ) ); @@ -107,7 +107,7 @@ BOOST_AUTO_TEST_CASE( double_preactivation ) try { auto d = pfm.get_builtin_digest( builtin_protocol_feature_t::only_link_to_existing_permission ); BOOST_REQUIRE( d ); - c.push_action( config::system_account_name, N(activate), config::system_account_name, + c.push_action( config::system_account_name, "activate"_n, config::system_account_name, fc::mutable_variant_object()("feature_digest", *d), 10 ); std::string expected_error_msg("protocol feature with digest '"); @@ -118,7 +118,7 @@ BOOST_AUTO_TEST_CASE( double_preactivation ) try { expected_error_msg += "' is already pre-activated"; } - BOOST_CHECK_EXCEPTION( c.push_action( config::system_account_name, N(activate), config::system_account_name, + BOOST_CHECK_EXCEPTION( c.push_action( config::system_account_name, "activate"_n, config::system_account_name, fc::mutable_variant_object()("feature_digest", *d), 20 ), protocol_feature_exception, fc_exception_message_is( expected_error_msg ) @@ -208,9 +208,9 @@ BOOST_AUTO_TEST_CASE( only_link_to_existing_permission_test ) try { auto d = pfm.get_builtin_digest( builtin_protocol_feature_t::only_link_to_existing_permission ); BOOST_REQUIRE( d ); - c.create_accounts( {N(alice), N(bob), N(charlie)} ); + c.create_accounts( {"alice"_n, "bob"_n, "charlie"_n} ); - BOOST_CHECK_EXCEPTION( c.push_action( config::system_account_name, N(linkauth), N(bob), fc::mutable_variant_object() + BOOST_CHECK_EXCEPTION( c.push_action( config::system_account_name, "linkauth"_n, "bob"_n, fc::mutable_variant_object() ("account", "bob") ("code", name(config::system_account_name)) ("type", "") @@ -219,7 +219,7 @@ BOOST_AUTO_TEST_CASE( only_link_to_existing_permission_test ) try { fc_exception_message_is( "Failed to retrieve permission: test" ) ); - BOOST_CHECK_EXCEPTION( c.push_action( config::system_account_name, N(linkauth), N(charlie), fc::mutable_variant_object() + BOOST_CHECK_EXCEPTION( c.push_action( config::system_account_name, "linkauth"_n, "charlie"_n, fc::mutable_variant_object() ("account", "charlie") ("code", name(config::system_account_name)) ("type", "") @@ -228,7 +228,7 @@ BOOST_AUTO_TEST_CASE( only_link_to_existing_permission_test ) try { fc_exception_message_is( "Failed to retrieve permission: test" ) ); - c.push_action( config::system_account_name, N(updateauth), N(alice), fc::mutable_variant_object() + c.push_action( config::system_account_name, "updateauth"_n, "alice"_n, fc::mutable_variant_object() ("account", "alice") ("permission", "test") ("parent", "active") @@ -238,7 +238,7 @@ BOOST_AUTO_TEST_CASE( only_link_to_existing_permission_test ) try { c.produce_block(); // Verify the incorrect behavior prior to ONLY_LINK_TO_EXISTING_PERMISSION activation. - c.push_action( config::system_account_name, N(linkauth), N(bob), fc::mutable_variant_object() + c.push_action( config::system_account_name, "linkauth"_n, "bob"_n, fc::mutable_variant_object() ("account", "bob") ("code", name(config::system_account_name)) ("type", "") @@ -249,7 +249,7 @@ BOOST_AUTO_TEST_CASE( only_link_to_existing_permission_test ) try { c.produce_block(); // Verify the correct behavior after ONLY_LINK_TO_EXISTING_PERMISSION activation. - BOOST_CHECK_EXCEPTION( c.push_action( config::system_account_name, N(linkauth), N(charlie), fc::mutable_variant_object() + BOOST_CHECK_EXCEPTION( c.push_action( config::system_account_name, "linkauth"_n, "charlie"_n, fc::mutable_variant_object() ("account", "charlie") ("code", name(config::system_account_name)) ("type", "") @@ -373,25 +373,25 @@ BOOST_AUTO_TEST_CASE( subjective_restrictions_test ) try { BOOST_AUTO_TEST_CASE( replace_deferred_test ) try { tester c( setup_policy::preactivate_feature_and_new_bios ); - c.create_accounts( {N(alice), N(bob), N(test)} ); - c.set_code( N(test), contracts::deferred_test_wasm() ); - c.set_abi( N(test), contracts::deferred_test_abi().data() ); + c.create_accounts( {"alice"_n, "bob"_n, "test"_n} ); + c.set_code( "test"_n, contracts::deferred_test_wasm() ); + c.set_abi( "test"_n, contracts::deferred_test_abi().data() ); c.produce_block(); - auto alice_ram_usage0 = c.control->get_resource_limits_manager().get_account_ram_usage( N(alice) ); + auto alice_ram_usage0 = c.control->get_resource_limits_manager().get_account_ram_usage( "alice"_n ); - c.push_action( N(test), N(defercall), N(alice), fc::mutable_variant_object() + c.push_action( "test"_n, "defercall"_n, "alice"_n, fc::mutable_variant_object() ("payer", "alice") ("sender_id", 42) ("contract", "test") ("payload", 100) ); - auto alice_ram_usage1 = c.control->get_resource_limits_manager().get_account_ram_usage( N(alice) ); + auto alice_ram_usage1 = c.control->get_resource_limits_manager().get_account_ram_usage( "alice"_n ); // Verify subjective mitigation is in place BOOST_CHECK_EXCEPTION( - c.push_action( N(test), N(defercall), N(alice), fc::mutable_variant_object() + c.push_action( "test"_n, "defercall"_n, "alice"_n, fc::mutable_variant_object() ("payer", "alice") ("sender_id", 42) ("contract", "test") @@ -401,7 +401,7 @@ BOOST_AUTO_TEST_CASE( replace_deferred_test ) try { fc_exception_message_is( "Replacing a deferred transaction is temporarily disabled." ) ); - BOOST_CHECK_EQUAL( c.control->get_resource_limits_manager().get_account_ram_usage( N(alice) ), alice_ram_usage1 ); + BOOST_CHECK_EQUAL( c.control->get_resource_limits_manager().get_account_ram_usage( "alice"_n ), alice_ram_usage1 ); c.control->abort_block(); @@ -410,29 +410,29 @@ BOOST_AUTO_TEST_CASE( replace_deferred_test ) try { cfg.disable_all_subjective_mitigations = true; c.init( cfg ); - BOOST_CHECK_EQUAL( c.control->get_resource_limits_manager().get_account_ram_usage( N(alice) ), alice_ram_usage0 ); + BOOST_CHECK_EQUAL( c.control->get_resource_limits_manager().get_account_ram_usage( "alice"_n ), alice_ram_usage0 ); - c.push_action( N(test), N(defercall), N(alice), fc::mutable_variant_object() + c.push_action( "test"_n, "defercall"_n, "alice"_n, fc::mutable_variant_object() ("payer", "alice") ("sender_id", 42) ("contract", "test") ("payload", 100) ); - BOOST_CHECK_EQUAL( c.control->get_resource_limits_manager().get_account_ram_usage( N(alice) ), alice_ram_usage1 ); + BOOST_CHECK_EQUAL( c.control->get_resource_limits_manager().get_account_ram_usage( "alice"_n ), alice_ram_usage1 ); auto dtrxs = c.get_scheduled_transactions(); BOOST_CHECK_EQUAL( dtrxs.size(), 1 ); auto first_dtrx_id = dtrxs[0]; // With the subjective mitigation disabled, replacing the deferred transaction is allowed. - c.push_action( N(test), N(defercall), N(alice), fc::mutable_variant_object() + c.push_action( "test"_n, "defercall"_n, "alice"_n, fc::mutable_variant_object() ("payer", "alice") ("sender_id", 42) ("contract", "test") ("payload", 101) ); - auto alice_ram_usage2 = c.control->get_resource_limits_manager().get_account_ram_usage( N(alice) ); + auto alice_ram_usage2 = c.control->get_resource_limits_manager().get_account_ram_usage( "alice"_n ); BOOST_CHECK_EQUAL( alice_ram_usage2, alice_ram_usage1 + (alice_ram_usage1 - alice_ram_usage0) ); dtrxs = c.get_scheduled_transactions(); @@ -441,7 +441,7 @@ BOOST_AUTO_TEST_CASE( replace_deferred_test ) try { c.produce_block(); - auto alice_ram_usage3 = c.control->get_resource_limits_manager().get_account_ram_usage( N(alice) ); + auto alice_ram_usage3 = c.control->get_resource_limits_manager().get_account_ram_usage( "alice"_n ); BOOST_CHECK_EQUAL( alice_ram_usage3, alice_ram_usage1 ); dtrxs = c.get_scheduled_transactions(); @@ -461,37 +461,37 @@ BOOST_AUTO_TEST_CASE( replace_deferred_test ) try { c.preactivate_protocol_features( {*d} ); c.produce_block(); - BOOST_CHECK_EQUAL( c.control->get_resource_limits_manager().get_account_ram_usage( N(alice) ), alice_ram_usage0 ); + BOOST_CHECK_EQUAL( c.control->get_resource_limits_manager().get_account_ram_usage( "alice"_n ), alice_ram_usage0 ); - c.push_action( N(test), N(defercall), N(alice), fc::mutable_variant_object() + c.push_action( "test"_n, "defercall"_n, "alice"_n, fc::mutable_variant_object() ("payer", "alice") ("sender_id", 42) ("contract", "test") ("payload", 100) ); - BOOST_CHECK_EQUAL( c.control->get_resource_limits_manager().get_account_ram_usage( N(alice) ), alice_ram_usage1 ); + BOOST_CHECK_EQUAL( c.control->get_resource_limits_manager().get_account_ram_usage( "alice"_n ), alice_ram_usage1 ); dtrxs = c.get_scheduled_transactions(); BOOST_CHECK_EQUAL( dtrxs.size(), 1 ); auto first_dtrx_id2 = dtrxs[0]; // With REPLACE_DEFERRED activated, replacing the deferred transaction is allowed and now should work properly. - c.push_action( N(test), N(defercall), N(alice), fc::mutable_variant_object() + c.push_action( "test"_n, "defercall"_n, "alice"_n, fc::mutable_variant_object() ("payer", "alice") ("sender_id", 42) ("contract", "test") ("payload", 101) ); - BOOST_CHECK_EQUAL( c.control->get_resource_limits_manager().get_account_ram_usage( N(alice) ), alice_ram_usage1 ); + BOOST_CHECK_EQUAL( c.control->get_resource_limits_manager().get_account_ram_usage( "alice"_n ), alice_ram_usage1 ); dtrxs = c.get_scheduled_transactions(); BOOST_CHECK_EQUAL( dtrxs.size(), 1 ); BOOST_CHECK( first_dtrx_id2 != dtrxs[0] ); // Replace again with a deferred transaction identical to the first one - c.push_action( N(test), N(defercall), N(alice), fc::mutable_variant_object() + c.push_action( "test"_n, "defercall"_n, "alice"_n, fc::mutable_variant_object() ("payer", "alice") ("sender_id", 42) ("contract", "test") @@ -499,7 +499,7 @@ BOOST_AUTO_TEST_CASE( replace_deferred_test ) try { 100 // Needed to make this input transaction unique ); - BOOST_CHECK_EQUAL( c.control->get_resource_limits_manager().get_account_ram_usage( N(alice) ), alice_ram_usage1 ); + BOOST_CHECK_EQUAL( c.control->get_resource_limits_manager().get_account_ram_usage( "alice"_n ), alice_ram_usage1 ); dtrxs = c.get_scheduled_transactions(); BOOST_CHECK_EQUAL( dtrxs.size(), 1 ); @@ -511,14 +511,14 @@ BOOST_AUTO_TEST_CASE( no_duplicate_deferred_id_test ) try { tester c( setup_policy::preactivate_feature_and_new_bios ); tester c2( setup_policy::none ); - c.create_accounts( {N(alice), N(test)} ); - c.set_code( N(test), contracts::deferred_test_wasm() ); - c.set_abi( N(test), contracts::deferred_test_abi().data() ); + c.create_accounts( {"alice"_n, "test"_n} ); + c.set_code( "test"_n, contracts::deferred_test_wasm() ); + c.set_abi( "test"_n, contracts::deferred_test_abi().data() ); c.produce_block(); push_blocks( c, c2 ); - c2.push_action( N(test), N(defercall), N(alice), fc::mutable_variant_object() + c2.push_action( "test"_n, "defercall"_n, "alice"_n, fc::mutable_variant_object() ("payer", "alice") ("sender_id", 1) ("contract", "test") @@ -563,7 +563,7 @@ BOOST_AUTO_TEST_CASE( no_duplicate_deferred_id_test ) try { BOOST_REQUIRE_EQUAL(0, index.size()); - c.push_action( config::system_account_name, N(reqauth), N(alice), fc::mutable_variant_object() + c.push_action( config::system_account_name, "reqauth"_n, "alice"_n, fc::mutable_variant_object() ("from", "alice"), 5, 2 ); @@ -581,7 +581,7 @@ BOOST_AUTO_TEST_CASE( no_duplicate_deferred_id_test ) try { auto d2 = pfm.get_builtin_digest( builtin_protocol_feature_t::no_duplicate_deferred_id ); BOOST_REQUIRE( d2 ); - c.push_action( N(test), N(defercall), N(alice), fc::mutable_variant_object() + c.push_action( "test"_n, "defercall"_n, "alice"_n, fc::mutable_variant_object() ("payer", "alice") ("sender_id", 1) ("contract", "test") @@ -633,7 +633,7 @@ BOOST_AUTO_TEST_CASE( no_duplicate_deferred_id_test ) try { }; BOOST_CHECK_EXCEPTION( - c.push_action( N(test), N(defercall), N(alice), fc::mutable_variant_object() + c.push_action( "test"_n, "defercall"_n, "alice"_n, fc::mutable_variant_object() ("payer", "alice") ("sender_id", 1) ("contract", "test") @@ -645,7 +645,7 @@ BOOST_AUTO_TEST_CASE( no_duplicate_deferred_id_test ) try { BOOST_REQUIRE_EQUAL(0, index.size()); - auto trace2 = c.push_action( N(test), N(defercall), N(alice), fc::mutable_variant_object() + auto trace2 = c.push_action( "test"_n, "defercall"_n, "alice"_n, fc::mutable_variant_object() ("payer", "alice") ("sender_id", 1) ("contract", "test") @@ -656,14 +656,14 @@ BOOST_AUTO_TEST_CASE( no_duplicate_deferred_id_test ) try { check_generation_context( index.begin()->packed_trx, trace2->id, - ((static_cast(N(alice).to_uint64_t()) << 64) | 1), - N(test) ); + ((static_cast("alice"_n.to_uint64_t()) << 64) | 1), + "test"_n ); c.produce_block(); BOOST_REQUIRE_EQUAL(0, index.size()); - auto trace3 = c.push_action( N(test), N(defercall), N(alice), fc::mutable_variant_object() + auto trace3 = c.push_action( "test"_n, "defercall"_n, "alice"_n, fc::mutable_variant_object() ("payer", "alice") ("sender_id", 1) ("contract", "test") @@ -674,8 +674,8 @@ BOOST_AUTO_TEST_CASE( no_duplicate_deferred_id_test ) try { check_generation_context( index.begin()->packed_trx, trace3->id, - ((static_cast(N(alice).to_uint64_t()) << 64) | 1), - N(test) ); + ((static_cast("alice"_n.to_uint64_t()) << 64) | 1), + "test"_n ); c.produce_block(); @@ -684,10 +684,10 @@ BOOST_AUTO_TEST_CASE( no_duplicate_deferred_id_test ) try { BOOST_AUTO_TEST_CASE( fix_linkauth_restriction ) { try { tester chain( setup_policy::preactivate_feature_and_new_bios ); - const auto& tester_account = N(tester); + const auto& tester_account = "tester"_n; chain.produce_blocks(); - chain.create_account(N(currency)); + chain.create_account("currency"_n); chain.create_account(tester_account); chain.produce_blocks(); @@ -769,7 +769,7 @@ BOOST_AUTO_TEST_CASE( disallow_empty_producer_schedule_test ) { try { fc_exception_message_is( "Producer schedule cannot be empty" ) ); // Setting non empty producer schedule should still be fine - vector producer_names = {N(alice),N(bob),N(carol)}; + vector producer_names = {"alice"_n,"bob"_n,"carol"_n}; c.create_accounts( producer_names ); c.set_producers_legacy( producer_names ); c.produce_blocks(2); @@ -785,30 +785,30 @@ BOOST_AUTO_TEST_CASE( restrict_action_to_self_test ) { try { const auto& d = pfm.get_builtin_digest( builtin_protocol_feature_t::restrict_action_to_self ); BOOST_REQUIRE( d ); - c.create_accounts( {N(testacc), N(acctonotify), N(alice)} ); - c.set_code( N(testacc), contracts::restrict_action_test_wasm() ); - c.set_abi( N(testacc), contracts::restrict_action_test_abi().data() ); + c.create_accounts( {"testacc"_n, "acctonotify"_n, "alice"_n} ); + c.set_code( "testacc"_n, contracts::restrict_action_test_wasm() ); + c.set_abi( "testacc"_n, contracts::restrict_action_test_abi().data() ); - c.set_code( N(acctonotify), contracts::restrict_action_test_wasm() ); - c.set_abi( N(acctonotify), contracts::restrict_action_test_abi().data() ); + c.set_code( "acctonotify"_n, contracts::restrict_action_test_wasm() ); + c.set_abi( "acctonotify"_n, contracts::restrict_action_test_abi().data() ); // Before the protocol feature is preactivated // - Sending inline action to self = no problem // - Sending deferred trx to self = throw subjective exception // - Sending inline action to self from notification = throw subjective exception // - Sending deferred trx to self from notification = throw subjective exception - BOOST_CHECK_NO_THROW( c.push_action( N(testacc), N(sendinline), N(alice), mutable_variant_object()("authorizer", "alice")) ); - BOOST_REQUIRE_EXCEPTION( c.push_action( N(testacc), N(senddefer), N(alice), + BOOST_CHECK_NO_THROW( c.push_action( "testacc"_n, "sendinline"_n, "alice"_n, mutable_variant_object()("authorizer", "alice")) ); + BOOST_REQUIRE_EXCEPTION( c.push_action( "testacc"_n, "senddefer"_n, "alice"_n, mutable_variant_object()("authorizer", "alice")("senderid", 0)), subjective_block_production_exception, fc_exception_message_starts_with( "Authorization failure with sent deferred transaction" ) ); - BOOST_REQUIRE_EXCEPTION( c.push_action( N(testacc), N(notifyinline), N(alice), + BOOST_REQUIRE_EXCEPTION( c.push_action( "testacc"_n, "notifyinline"_n, "alice"_n, mutable_variant_object()("acctonotify", "acctonotify")("authorizer", "alice")), subjective_block_production_exception, fc_exception_message_starts_with( "Authorization failure with inline action sent to self" ) ); - BOOST_REQUIRE_EXCEPTION( c.push_action( N(testacc), N(notifydefer), N(alice), + BOOST_REQUIRE_EXCEPTION( c.push_action( "testacc"_n, "notifydefer"_n, "alice"_n, mutable_variant_object()("acctonotify", "acctonotify")("authorizer", "alice")("senderid", 1)), subjective_block_production_exception, fc_exception_message_starts_with( "Authorization failure with sent deferred transaction" ) ); @@ -817,21 +817,21 @@ BOOST_AUTO_TEST_CASE( restrict_action_to_self_test ) { try { c.produce_block(); // After the protocol feature is preactivated, all the 4 cases will throw an objective unsatisfied_authorization exception - BOOST_REQUIRE_EXCEPTION( c.push_action( N(testacc), N(sendinline), N(alice), mutable_variant_object()("authorizer", "alice") ), + BOOST_REQUIRE_EXCEPTION( c.push_action( "testacc"_n, "sendinline"_n, "alice"_n, mutable_variant_object()("authorizer", "alice") ), unsatisfied_authorization, fc_exception_message_starts_with( "transaction declares authority" ) ); - BOOST_REQUIRE_EXCEPTION( c.push_action( N(testacc), N(senddefer), N(alice), + BOOST_REQUIRE_EXCEPTION( c.push_action( "testacc"_n, "senddefer"_n, "alice"_n, mutable_variant_object()("authorizer", "alice")("senderid", 3)), unsatisfied_authorization, fc_exception_message_starts_with( "transaction declares authority" ) ); - BOOST_REQUIRE_EXCEPTION( c.push_action( N(testacc), N(notifyinline), N(alice), + BOOST_REQUIRE_EXCEPTION( c.push_action( "testacc"_n, "notifyinline"_n, "alice"_n, mutable_variant_object()("acctonotify", "acctonotify")("authorizer", "alice") ), unsatisfied_authorization, fc_exception_message_starts_with( "transaction declares authority" ) ); - BOOST_REQUIRE_EXCEPTION( c.push_action( N(testacc), N(notifydefer), N(alice), + BOOST_REQUIRE_EXCEPTION( c.push_action( "testacc"_n, "notifydefer"_n, "alice"_n, mutable_variant_object()("acctonotify", "acctonotify")("authorizer", "alice")("senderid", 4)), unsatisfied_authorization, fc_exception_message_starts_with( "transaction declares authority" ) ); @@ -841,20 +841,20 @@ BOOST_AUTO_TEST_CASE( restrict_action_to_self_test ) { try { BOOST_AUTO_TEST_CASE( only_bill_to_first_authorizer ) { try { tester chain( setup_policy::preactivate_feature_and_new_bios ); - const auto& tester_account = N(tester); - const auto& tester_account2 = N(tester2); + const auto& tester_account = "tester"_n; + const auto& tester_account2 = "tester2"_n; chain.produce_blocks(); chain.create_account(tester_account); chain.create_account(tester_account2); - chain.push_action(config::system_account_name, N(setalimits), config::system_account_name, fc::mutable_variant_object() + chain.push_action(config::system_account_name, "setalimits"_n, config::system_account_name, fc::mutable_variant_object() ("account", name(tester_account).to_string()) ("ram_bytes", 10000) ("net_weight", 1000) ("cpu_weight", 1000)); - chain.push_action(config::system_account_name, N(setalimits), config::system_account_name, fc::mutable_variant_object() + chain.push_action(config::system_account_name, "setalimits"_n, config::system_account_name, fc::mutable_variant_object() ("account", name(tester_account2).to_string()) ("ram_bytes", 10000) ("net_weight", 1000) @@ -867,7 +867,7 @@ BOOST_AUTO_TEST_CASE( only_bill_to_first_authorizer ) { try { { action act; act.account = tester_account; - act.name = N(null); + act.name = "null"_n; act.authorization = vector{ {tester_account, config::active_name}, {tester_account2, config::active_name} @@ -912,7 +912,7 @@ BOOST_AUTO_TEST_CASE( only_bill_to_first_authorizer ) { try { { action act; act.account = tester_account; - act.name = N(null2); + act.name = "null2"_n; act.authorization = vector{ {tester_account, config::active_name}, {tester_account2, config::active_name} @@ -948,8 +948,8 @@ BOOST_AUTO_TEST_CASE( only_bill_to_first_authorizer ) { try { BOOST_AUTO_TEST_CASE( forward_setcode_test ) { try { tester c( setup_policy::preactivate_feature_only ); - const auto& tester1_account = N(tester1); - const auto& tester2_account = N(tester2); + const auto& tester1_account = "tester1"_n; + const auto& tester2_account = "tester2"_n; c.create_accounts( {tester1_account, tester2_account} ); // Deploy contract that rejects all actions dispatched to it with the following exceptions: @@ -982,7 +982,7 @@ BOOST_AUTO_TEST_CASE( forward_setcode_test ) { try { push_blocks( c, c2 ); // make a backup of the chain to enable testing further conditions. c.set_before_producer_authority_bios_contract(); // To allow pushing further actions for setting up the other part of the test. - c.create_account( N(rejectall) ); + c.create_account( "rejectall"_n ); c.produce_block(); // The existence of the rejectall account will make the reject_all contract reject all actions with no exception. @@ -995,7 +995,7 @@ BOOST_AUTO_TEST_CASE( forward_setcode_test ) { try { // Going back to the backup chain, we can create the rejectall account while the reject_all contract is // already deployed on eosio. - c2.create_account( N(rejectall) ); + c2.create_account( "rejectall"_n ); c2.produce_block(); // Now all actions dispatched to the eosio account should be rejected. @@ -1030,30 +1030,30 @@ BOOST_AUTO_TEST_CASE( get_sender_test ) { try { c.set_abi( tester2_account, contracts::get_sender_test_abi().data() ); c.produce_block(); - BOOST_CHECK_EXCEPTION( c.push_action( tester1_account, N(sendinline), tester1_account, mutable_variant_object() + BOOST_CHECK_EXCEPTION( c.push_action( tester1_account, "sendinline"_n, tester1_account, mutable_variant_object() ("to", tester2_account.to_string()) ("expected_sender", account_name{}) ), eosio_assert_message_exception, eosio_assert_message_is( "sender did not match" ) ); - c.push_action( tester1_account, N(sendinline), tester1_account, mutable_variant_object() + c.push_action( tester1_account, "sendinline"_n, tester1_account, mutable_variant_object() ("to", tester2_account.to_string()) ("expected_sender", tester1_account.to_string()) ); - c.push_action( tester1_account, N(notify), tester1_account, mutable_variant_object() + c.push_action( tester1_account, "notify"_n, tester1_account, mutable_variant_object() ("to", tester2_account.to_string()) ("expected_sender", tester1_account.to_string()) ("send_inline", false) ); - c.push_action( tester1_account, N(notify), tester1_account, mutable_variant_object() + c.push_action( tester1_account, "notify"_n, tester1_account, mutable_variant_object() ("to", tester2_account.to_string()) ("expected_sender", tester2_account.to_string()) ("send_inline", true) ); - c.push_action( tester1_account, N(assertsender), tester1_account, mutable_variant_object() + c.push_action( tester1_account, "assertsender"_n, tester1_account, mutable_variant_object() ("expected_sender", account_name{}) ); } FC_LOG_AND_RETHROW() } @@ -1075,7 +1075,7 @@ BOOST_AUTO_TEST_CASE( ram_restrictions_test ) { try { c.produce_block(); // Basic setup - c.push_action( tester1_account, N(setdata), alice_account, mutable_variant_object() + c.push_action( tester1_account, "setdata"_n, alice_account, mutable_variant_object() ("len1", 10) ("len2", 0) ("payer", alice_account) @@ -1083,7 +1083,7 @@ BOOST_AUTO_TEST_CASE( ram_restrictions_test ) { try { // Cannot bill more RAM to another account that has not authorized the action. BOOST_REQUIRE_EXCEPTION( - c.push_action( tester1_account, N(setdata), bob_account, mutable_variant_object() + c.push_action( tester1_account, "setdata"_n, bob_account, mutable_variant_object() ("len1", 20) ("len2", 0) ("payer", alice_account) @@ -1095,7 +1095,7 @@ BOOST_AUTO_TEST_CASE( ram_restrictions_test ) { try { // Cannot migrate data from table1 to table2 paid by another account // in a RAM usage neutral way without the authority of that account. BOOST_REQUIRE_EXCEPTION( - c.push_action( tester1_account, N(setdata), bob_account, mutable_variant_object() + c.push_action( tester1_account, "setdata"_n, bob_account, mutable_variant_object() ("len1", 0) ("len2", 10) ("payer", alice_account) @@ -1108,7 +1108,7 @@ BOOST_AUTO_TEST_CASE( ram_restrictions_test ) { try { // even if the account authorized the original action. // This is due to the subjective mitigation in place. BOOST_REQUIRE_EXCEPTION( - c.push_action( tester2_account, N(notifysetdat), alice_account, mutable_variant_object() + c.push_action( tester2_account, "notifysetdat"_n, alice_account, mutable_variant_object() ("acctonotify", tester1_account) ("len1", 20) ("len2", 0) @@ -1122,7 +1122,7 @@ BOOST_AUTO_TEST_CASE( ram_restrictions_test ) { try { // in a RAM usage neutral way within a notification. // This is due to the subjective mitigation in place. BOOST_REQUIRE_EXCEPTION( - c.push_action( tester2_account, N(notifysetdat), alice_account, mutable_variant_object() + c.push_action( tester2_account, "notifysetdat"_n, alice_account, mutable_variant_object() ("acctonotify", tester1_account) ("len1", 0) ("len2", 10) @@ -1134,7 +1134,7 @@ BOOST_AUTO_TEST_CASE( ram_restrictions_test ) { try { // Cannot send deferred transaction paid by another account that has not authorized the action. BOOST_REQUIRE_EXCEPTION( - c.push_action( tester1_account, N(senddefer), bob_account, mutable_variant_object() + c.push_action( tester1_account, "senddefer"_n, bob_account, mutable_variant_object() ("senderid", 123) ("payer", alice_account) ), @@ -1146,7 +1146,7 @@ BOOST_AUTO_TEST_CASE( ram_restrictions_test ) { try { // even if the account authorized the original action. // This is due to the subjective mitigation in place. BOOST_REQUIRE_EXCEPTION( - c.push_action( tester2_account, N(notifydefer), alice_account, mutable_variant_object() + c.push_action( tester2_account, "notifydefer"_n, alice_account, mutable_variant_object() ("acctonotify", tester1_account) ("senderid", 123) ("payer", alice_account) @@ -1156,7 +1156,7 @@ BOOST_AUTO_TEST_CASE( ram_restrictions_test ) { try { ); // Can send deferred transaction paid by another account if it has authorized the action. - c.push_action( tester1_account, N(senddefer), alice_account, mutable_variant_object() + c.push_action( tester1_account, "senddefer"_n, alice_account, mutable_variant_object() ("senderid", 123) ("payer", alice_account) ); @@ -1164,7 +1164,7 @@ BOOST_AUTO_TEST_CASE( ram_restrictions_test ) { try { // Can migrate data from table1 to table2 paid by another account // in a RAM usage neutral way with the authority of that account. - c.push_action( tester1_account, N(setdata), alice_account, mutable_variant_object() + c.push_action( tester1_account, "setdata"_n, alice_account, mutable_variant_object() ("len1", 0) ("len2", 10) ("payer", alice_account) @@ -1183,7 +1183,7 @@ BOOST_AUTO_TEST_CASE( ram_restrictions_test ) { try { // Without the subjective mitigation, it is now possible to bill more RAM to another account // within a notification if the account authorized the original action. // This is due to the subjective mitigation in place. - c.push_action( tester2_account, N(notifysetdat), alice_account, mutable_variant_object() + c.push_action( tester2_account, "notifysetdat"_n, alice_account, mutable_variant_object() ("acctonotify", tester1_account) ("len1", 10) ("len2", 10) @@ -1191,7 +1191,7 @@ BOOST_AUTO_TEST_CASE( ram_restrictions_test ) { try { ); // Reset back to the original state. - c.push_action( tester1_account, N(setdata), alice_account, mutable_variant_object() + c.push_action( tester1_account, "setdata"_n, alice_account, mutable_variant_object() ("len1", 10) ("len2", 0) ("payer", alice_account) @@ -1209,7 +1209,7 @@ BOOST_AUTO_TEST_CASE( ram_restrictions_test ) { try { // even if the account authorized the original action. // This is due to the subjective mitigation in place. BOOST_REQUIRE_EXCEPTION( - c.push_action( tester2_account, N(notifysetdat), alice_account, mutable_variant_object() + c.push_action( tester2_account, "notifysetdat"_n, alice_account, mutable_variant_object() ("acctonotify", tester1_account) ("len1", 10) ("len2", 10) @@ -1230,7 +1230,7 @@ BOOST_AUTO_TEST_CASE( ram_restrictions_test ) { try { // Cannot send deferred transaction paid by another account that has not authorized the action. // This still fails objectively, but now with another error message. BOOST_REQUIRE_EXCEPTION( - c.push_action( tester1_account, N(senddefer), bob_account, mutable_variant_object() + c.push_action( tester1_account, "senddefer"_n, bob_account, mutable_variant_object() ("senderid", 123) ("payer", alice_account) ), @@ -1242,7 +1242,7 @@ BOOST_AUTO_TEST_CASE( ram_restrictions_test ) { try { // even if the account authorized the original action. // This now fails with an objective error. BOOST_REQUIRE_EXCEPTION( - c.push_action( tester2_account, N(notifydefer), alice_account, mutable_variant_object() + c.push_action( tester2_account, "notifydefer"_n, alice_account, mutable_variant_object() ("acctonotify", tester1_account) ("senderid", 123) ("payer", alice_account) @@ -1255,7 +1255,7 @@ BOOST_AUTO_TEST_CASE( ram_restrictions_test ) { try { // even if the account authorized the original action. // This now fails with an objective error. BOOST_REQUIRE_EXCEPTION( - c.push_action( tester2_account, N(notifysetdat), alice_account, mutable_variant_object() + c.push_action( tester2_account, "notifysetdat"_n, alice_account, mutable_variant_object() ("acctonotify", tester1_account) ("len1", 20) ("len2", 0) @@ -1268,7 +1268,7 @@ BOOST_AUTO_TEST_CASE( ram_restrictions_test ) { try { // Cannot bill more RAM to another account that has not authorized the action. // This still fails objectively, but now with another error message. BOOST_REQUIRE_EXCEPTION( - c.push_action( tester1_account, N(setdata), bob_account, mutable_variant_object() + c.push_action( tester1_account, "setdata"_n, bob_account, mutable_variant_object() ("len1", 20) ("len2", 0) ("payer", alice_account) @@ -1278,7 +1278,7 @@ BOOST_AUTO_TEST_CASE( ram_restrictions_test ) { try { ); // Still can send deferred transaction paid by another account if it has authorized the action. - c.push_action( tester1_account, N(senddefer), alice_account, mutable_variant_object() + c.push_action( tester1_account, "senddefer"_n, alice_account, mutable_variant_object() ("senderid", 123) ("payer", alice_account) ); @@ -1286,7 +1286,7 @@ BOOST_AUTO_TEST_CASE( ram_restrictions_test ) { try { // Now can migrate data from table1 to table2 paid by another account // in a RAM usage neutral way without the authority of that account. - c.push_action( tester1_account, N(setdata), bob_account, mutable_variant_object() + c.push_action( tester1_account, "setdata"_n, bob_account, mutable_variant_object() ("len1", 0) ("len2", 10) ("payer", alice_account) @@ -1294,7 +1294,7 @@ BOOST_AUTO_TEST_CASE( ram_restrictions_test ) { try { // Now can also migrate data from table2 to table1 paid by another account // in a RAM usage neutral way even within a notification . - c.push_action( tester2_account, N(notifysetdat), bob_account, mutable_variant_object() + c.push_action( tester2_account, "notifysetdat"_n, bob_account, mutable_variant_object() ("acctonotify", "tester1") ("len1", 10) ("len2", 0) @@ -1303,7 +1303,7 @@ BOOST_AUTO_TEST_CASE( ram_restrictions_test ) { try { // Of course it should also be possible to migrate data from table1 to table2 paid by another account // in a way that reduces RAM usage as well, even within a notification. - c.push_action( tester2_account, N(notifysetdat), bob_account, mutable_variant_object() + c.push_action( tester2_account, "notifysetdat"_n, bob_account, mutable_variant_object() ("acctonotify", "tester1") ("len1", 0) ("len2", 5) @@ -1313,7 +1313,7 @@ BOOST_AUTO_TEST_CASE( ram_restrictions_test ) { try { // It should also still be possible for the receiver to take over payment of the RAM // if it is necessary to increase RAM usage without the authorization of the original payer. // This should all be possible to do even within a notification. - c.push_action( tester2_account, N(notifysetdat), bob_account, mutable_variant_object() + c.push_action( tester2_account, "notifysetdat"_n, bob_account, mutable_variant_object() ("acctonotify", "tester1") ("len1", 10) ("len2", 10) @@ -1331,20 +1331,20 @@ BOOST_AUTO_TEST_CASE( webauthn_producer ) { try { const auto& d = pfm.get_builtin_digest( builtin_protocol_feature_t::webauthn_key ); BOOST_REQUIRE( d ); - c.create_account(N(waprod)); + c.create_account("waprod"_n); c.produce_block(); - vector waprodsched = {{N(waprod), public_key_type("PUB_WA_WdCPfafVNxVMiW5ybdNs83oWjenQXvSt1F49fg9mv7qrCiRwHj5b38U3ponCFWxQTkDsMC"s)}}; + vector waprodsched = {{"waprod"_n, public_key_type("PUB_WA_WdCPfafVNxVMiW5ybdNs83oWjenQXvSt1F49fg9mv7qrCiRwHj5b38U3ponCFWxQTkDsMC"s)}}; BOOST_CHECK_THROW( - c.push_action(config::system_account_name, N(setprods), config::system_account_name, fc::mutable_variant_object()("schedule", waprodsched)), + c.push_action(config::system_account_name, "setprods"_n, config::system_account_name, fc::mutable_variant_object()("schedule", waprodsched)), eosio::chain::unactivated_key_type ); c.preactivate_protocol_features( {*d} ); c.produce_block(); - c.push_action(config::system_account_name, N(setprods), config::system_account_name, fc::mutable_variant_object()("schedule", waprodsched)); + c.push_action(config::system_account_name, "setprods"_n, config::system_account_name, fc::mutable_variant_object()("schedule", waprodsched)); } FC_LOG_AND_RETHROW() } BOOST_AUTO_TEST_CASE( webauthn_create_account ) { try { @@ -1361,7 +1361,7 @@ BOOST_AUTO_TEST_CASE( webauthn_create_account ) { try { trx.actions.emplace_back(vector{{config::system_account_name,config::active_name}}, newaccount{ .creator = config::system_account_name, - .name = N(waaccount), + .name = "waaccount"_n, .owner = auth, .active = auth, }); @@ -1382,17 +1382,17 @@ BOOST_AUTO_TEST_CASE( webauthn_update_account_auth ) { try { const auto& d = pfm.get_builtin_digest(builtin_protocol_feature_t::webauthn_key); BOOST_REQUIRE(d); - c.create_account(N(billy)); + c.create_account("billy"_n); c.produce_block(); - BOOST_CHECK_THROW(c.set_authority(N(billy), config::active_name, + BOOST_CHECK_THROW(c.set_authority("billy"_n, config::active_name, authority(public_key_type("PUB_WA_WdCPfafVNxVMiW5ybdNs83oWjenQXvSt1F49fg9mv7qrCiRwHj5b38U3ponCFWxQTkDsMC"s))), eosio::chain::unactivated_key_type); c.preactivate_protocol_features( {*d} ); c.produce_block(); - c.set_authority(N(billy), config::active_name, authority(public_key_type("PUB_WA_WdCPfafVNxVMiW5ybdNs83oWjenQXvSt1F49fg9mv7qrCiRwHj5b38U3ponCFWxQTkDsMC"s))); + c.set_authority("billy"_n, config::active_name, authority(public_key_type("PUB_WA_WdCPfafVNxVMiW5ybdNs83oWjenQXvSt1F49fg9mv7qrCiRwHj5b38U3ponCFWxQTkDsMC"s))); } FC_LOG_AND_RETHROW() } /* @@ -1433,19 +1433,19 @@ BOOST_AUTO_TEST_CASE( webauthn_recover_key ) { try { const auto& d = pfm.get_builtin_digest(builtin_protocol_feature_t::webauthn_key); BOOST_REQUIRE(d); - c.create_account(N(bob)); - c.set_code(N(bob), webauthn_recover_key_wast); + c.create_account("bob"_n); + c.set_code("bob"_n, webauthn_recover_key_wast); c.produce_block(); signed_transaction trx; action act; - act.account = N(bob); - act.name = N(); - act.authorization = vector{{N(bob),config::active_name}}; + act.account = "bob"_n; + act.name = ""_n; + act.authorization = vector{{"bob"_n,config::active_name}}; trx.actions.push_back(act); c.set_transaction_headers(trx); - trx.sign(c.get_private_key( N(bob), "active" ), c.control->get_chain_id()); + trx.sign(c.get_private_key( "bob"_n, "active" ), c.control->get_chain_id()); BOOST_CHECK_THROW(c.push_transaction(trx), eosio::chain::unactivated_signature_type); c.preactivate_protocol_features( {*d} ); @@ -1481,19 +1481,19 @@ BOOST_AUTO_TEST_CASE( webauthn_assert_recover_key ) { try { const auto& d = pfm.get_builtin_digest(builtin_protocol_feature_t::webauthn_key); BOOST_REQUIRE(d); - c.create_account(N(bob)); - c.set_code(N(bob), webauthn_assert_recover_key_wast); + c.create_account("bob"_n); + c.set_code("bob"_n, webauthn_assert_recover_key_wast); c.produce_block(); signed_transaction trx; action act; - act.account = N(bob); - act.name = N(); - act.authorization = vector{{N(bob),config::active_name}}; + act.account = "bob"_n; + act.name = ""_n; + act.authorization = vector{{"bob"_n,config::active_name}}; trx.actions.push_back(act); c.set_transaction_headers(trx); - trx.sign(c.get_private_key( N(bob), "active" ), c.control->get_chain_id()); + trx.sign(c.get_private_key( "bob"_n, "active" ), c.control->get_chain_id()); BOOST_CHECK_THROW(c.push_transaction(trx), eosio::chain::unactivated_signature_type); c.preactivate_protocol_features( {*d} ); @@ -1547,7 +1547,7 @@ BOOST_AUTO_TEST_CASE( set_proposed_producers_ex_test ) { try { "alice does not have permission to call this API" ); - c.push_action(config::system_account_name, N(setpriv), config::system_account_name, fc::mutable_variant_object()("account", alice_account)("is_priv", 1)); + c.push_action(config::system_account_name, "setpriv"_n, config::system_account_name, fc::mutable_variant_object()("account", alice_account)("is_priv", 1)); //ensure it can be called w/ privilege BOOST_REQUIRE_EQUAL(c.push_action(action({{ alice_account, permission_name("active") }}, alice_account, action_name(), {} ), alice_account.to_uint64_t()), c.success()); @@ -1593,7 +1593,7 @@ BOOST_AUTO_TEST_CASE( producer_schedule_change_extension_test ) { try { // re-sign the bad block auto header_bmroot = digest_type::hash( std::make_pair( bad_block->digest(), remote.control->head_block_state()->blockroot_merkle ) ); auto sig_digest = digest_type::hash( std::make_pair(header_bmroot, remote.control->head_block_state()->pending_schedule.schedule_hash) ); - bad_block->producer_signature = remote.get_private_key(N(eosio), "active").sign(sig_digest); + bad_block->producer_signature = remote.get_private_key("eosio"_n, "active").sign(sig_digest); // ensure it is rejected as an unknown extension BOOST_REQUIRE_EXCEPTION( @@ -1612,7 +1612,7 @@ BOOST_AUTO_TEST_CASE( producer_schedule_change_extension_test ) { try { // re-sign the bad block auto header_bmroot = digest_type::hash( std::make_pair( bad_block->digest(), remote.control->head_block_state()->blockroot_merkle ) ); auto sig_digest = digest_type::hash( std::make_pair(header_bmroot, remote.control->head_block_state()->pending_schedule.schedule_hash) ); - bad_block->producer_signature = remote.get_private_key(N(eosio), "active").sign(sig_digest); + bad_block->producer_signature = remote.get_private_key("eosio"_n, "active").sign(sig_digest); // ensure it is accepted (but rejected because it doesn't match expected state) BOOST_REQUIRE_EXCEPTION( @@ -1640,7 +1640,7 @@ BOOST_AUTO_TEST_CASE( producer_schedule_change_extension_test ) { try { // re-sign the bad block auto header_bmroot = digest_type::hash( std::make_pair( bad_block->digest(), remote.control->head_block_state()->blockroot_merkle ) ); auto sig_digest = digest_type::hash( std::make_pair(header_bmroot, remote.control->head_block_state()->pending_schedule.schedule_hash) ); - bad_block->producer_signature = remote.get_private_key(N(eosio), "active").sign(sig_digest); + bad_block->producer_signature = remote.get_private_key("eosio"_n, "active").sign(sig_digest); // ensure it is rejected because it doesn't match expected state (but the extention was accepted) BOOST_REQUIRE_EXCEPTION( @@ -1659,7 +1659,7 @@ BOOST_AUTO_TEST_CASE( producer_schedule_change_extension_test ) { try { // re-sign the bad block auto header_bmroot = digest_type::hash( std::make_pair( bad_block->digest(), remote.control->head_block_state()->blockroot_merkle ) ); auto sig_digest = digest_type::hash( std::make_pair(header_bmroot, remote.control->head_block_state()->pending_schedule.schedule_hash) ); - bad_block->producer_signature = remote.get_private_key(N(eosio), "active").sign(sig_digest); + bad_block->producer_signature = remote.get_private_key("eosio"_n, "active").sign(sig_digest); // ensure it is rejected because the new_producers field is not null BOOST_REQUIRE_EXCEPTION( @@ -1683,8 +1683,8 @@ BOOST_AUTO_TEST_CASE( wtmsig_block_signing_inflight_legacy_test ) { try { // activate the feature, and start an in-flight producer schedule change with the legacy format c.preactivate_protocol_features( {*d} ); - vector sched = {{N(eosio), c.get_public_key(N(eosio), "bsk")}}; - c.push_action(config::system_account_name, N(setprods), config::system_account_name, fc::mutable_variant_object()("schedule", sched)); + vector sched = {{"eosio"_n, c.get_public_key("eosio"_n, "bsk")}}; + c.push_action(config::system_account_name, "setprods"_n, config::system_account_name, fc::mutable_variant_object()("schedule", sched)); c.produce_block(); // ensure the last legacy block contains a new_producers @@ -1698,7 +1698,7 @@ BOOST_AUTO_TEST_CASE( wtmsig_block_signing_inflight_legacy_test ) { try { BOOST_REQUIRE_EXCEPTION( c.produce_block(), no_block_signatures, fc_exception_message_is( "Signer returned no signatures" )); c.control->abort_block(); - c.block_signing_private_keys.emplace(get_public_key(N(eosio), "bsk"), get_private_key(N(eosio), "bsk")); + c.block_signing_private_keys.emplace(get_public_key("eosio"_n, "bsk"), get_private_key("eosio"_n, "bsk")); c.produce_block(); } FC_LOG_AND_RETHROW() } @@ -1717,8 +1717,8 @@ BOOST_AUTO_TEST_CASE( wtmsig_block_signing_inflight_extension_test ) { try { c.produce_block(); // start an in-flight producer schedule change before the activation is availble to header only validators - vector sched = {{N(eosio), c.get_public_key(N(eosio), "bsk")}}; - c.push_action(config::system_account_name, N(setprods), config::system_account_name, fc::mutable_variant_object()("schedule", sched)); + vector sched = {{"eosio"_n, c.get_public_key("eosio"_n, "bsk")}}; + c.push_action(config::system_account_name, "setprods"_n, config::system_account_name, fc::mutable_variant_object()("schedule", sched)); c.produce_block(); // ensure the first possible new block contains a producer_schedule_change_extension @@ -1734,7 +1734,7 @@ BOOST_AUTO_TEST_CASE( wtmsig_block_signing_inflight_extension_test ) { try { BOOST_REQUIRE_EXCEPTION( c.produce_block(), no_block_signatures, fc_exception_message_is( "Signer returned no signatures" )); c.control->abort_block(); - c.block_signing_private_keys.emplace(get_public_key(N(eosio), "bsk"), get_private_key(N(eosio), "bsk")); + c.block_signing_private_keys.emplace(get_public_key("eosio"_n, "bsk"), get_private_key("eosio"_n, "bsk")); c.produce_block(); } FC_LOG_AND_RETHROW() } diff --git a/unittests/ram_tests.cpp b/unittests/ram_tests.cpp index bacf4c656bd..5deb8d89ffc 100644 --- a/unittests/ram_tests.cpp +++ b/unittests/ram_tests.cpp @@ -29,70 +29,70 @@ BOOST_FIXTURE_TEST_CASE(ram_tests, eosio_system::eosio_system_tester) { try { BOOST_REQUIRE_MESSAGE(table_allocation_bytes > increment_contract_bytes, "increment_contract_bytes must be less than table_allocation_bytes for this test setup to work"); buyrambytes(config::system_account_name, config::system_account_name, 70000); produce_blocks(10); - create_account_with_resources(N(testram11111),config::system_account_name, init_request_bytes + 40); - create_account_with_resources(N(testram22222),config::system_account_name, init_request_bytes + 1190); + create_account_with_resources("testram11111"_n,config::system_account_name, init_request_bytes + 40); + create_account_with_resources("testram22222"_n,config::system_account_name, init_request_bytes + 1190); produce_blocks(10); BOOST_REQUIRE_EQUAL( success(), stake( name("eosio.stake"), name("testram11111"), core_from_string("10.0000"), core_from_string("5.0000") ) ); produce_blocks(10); for (auto i = 0; i < 10; ++i) { try { - set_code( N(testram11111), contracts::test_ram_limit_wasm() ); + set_code( "testram11111"_n, contracts::test_ram_limit_wasm() ); break; } catch (const ram_usage_exceeded&) { init_request_bytes += increment_contract_bytes; - buyrambytes(config::system_account_name, N(testram11111), increment_contract_bytes); - buyrambytes(config::system_account_name, N(testram22222), increment_contract_bytes); + buyrambytes(config::system_account_name, "testram11111"_n, increment_contract_bytes); + buyrambytes(config::system_account_name, "testram22222"_n, increment_contract_bytes); } } produce_blocks(10); for (auto i = 0; i < 10; ++i) { try { - set_abi( N(testram11111), contracts::test_ram_limit_abi().data() ); + set_abi( "testram11111"_n, contracts::test_ram_limit_abi().data() ); break; } catch (const ram_usage_exceeded&) { init_request_bytes += increment_contract_bytes; - buyrambytes(config::system_account_name, N(testram11111), increment_contract_bytes); - buyrambytes(config::system_account_name, N(testram22222), increment_contract_bytes); + buyrambytes(config::system_account_name, "testram11111"_n, increment_contract_bytes); + buyrambytes(config::system_account_name, "testram22222"_n, increment_contract_bytes); } } produce_blocks(10); - set_code( N(testram22222), contracts::test_ram_limit_wasm() ); - set_abi( N(testram22222), contracts::test_ram_limit_abi().data() ); + set_code( "testram22222"_n, contracts::test_ram_limit_wasm() ); + set_abi( "testram22222"_n, contracts::test_ram_limit_abi().data() ); produce_blocks(10); - auto total = get_total_stake( N(testram11111) ); + auto total = get_total_stake( "testram11111"_n ); const auto init_bytes = total["ram_bytes"].as_uint64(); auto rlm = control->get_resource_limits_manager(); - auto initial_ram_usage = rlm.get_account_ram_usage(N(testram11111)); + auto initial_ram_usage = rlm.get_account_ram_usage("testram11111"_n); // calculate how many more bytes we need to have table_allocation_bytes for database stores auto more_ram = table_allocation_bytes + init_bytes - init_request_bytes; BOOST_REQUIRE_MESSAGE(more_ram >= 0, "Underlying understanding changed, need to reduce size of init_request_bytes"); wdump((init_bytes)(initial_ram_usage)(init_request_bytes)(more_ram) ); - buyrambytes(config::system_account_name, N(testram11111), more_ram); - buyrambytes(config::system_account_name, N(testram22222), more_ram); + buyrambytes(config::system_account_name, "testram11111"_n, more_ram); + buyrambytes(config::system_account_name, "testram22222"_n, more_ram); TESTER* tester = this; // allocate just under the allocated bytes - tester->push_action( N(testram11111), N(setentry), N(testram11111), mvo() + tester->push_action( "testram11111"_n, "setentry"_n, "testram11111"_n, mvo() ("payer", "testram11111") ("from", 1) ("to", 10) ("size", 1780 /*1910*/)); produce_blocks(1); - auto ram_usage = rlm.get_account_ram_usage(N(testram11111)); + auto ram_usage = rlm.get_account_ram_usage("testram11111"_n); - total = get_total_stake( N(testram11111) ); + total = get_total_stake( "testram11111"_n ); const auto ram_bytes = total["ram_bytes"].as_uint64(); wdump((ram_bytes)(ram_usage)(initial_ram_usage)(init_bytes)(ram_usage - initial_ram_usage)(init_bytes - ram_usage) ); wlog("ram_tests 1 %%%%%%"); // allocate just beyond the allocated bytes BOOST_REQUIRE_EXCEPTION( - tester->push_action( N(testram11111), N(setentry), N(testram11111), mvo() + tester->push_action( "testram11111"_n, "setentry"_n, "testram11111"_n, mvo() ("payer", "testram11111") ("from", 1) ("to", 10) @@ -101,20 +101,20 @@ BOOST_FIXTURE_TEST_CASE(ram_tests, eosio_system::eosio_system_tester) { try { fc_exception_message_starts_with("account testram11111 has insufficient ram")); wlog("ram_tests 2 %%%%%%"); produce_blocks(1); - BOOST_REQUIRE_EQUAL(ram_usage, rlm.get_account_ram_usage(N(testram11111))); + BOOST_REQUIRE_EQUAL(ram_usage, rlm.get_account_ram_usage("testram11111"_n)); // update the entries with smaller allocations so that we can verify space is freed and new allocations can be made - tester->push_action( N(testram11111), N(setentry), N(testram11111), mvo() + tester->push_action( "testram11111"_n, "setentry"_n, "testram11111"_n, mvo() ("payer", "testram11111") ("from", 1) ("to", 10) ("size", 1680/*1810*/)); produce_blocks(1); - BOOST_REQUIRE_EQUAL(ram_usage - 1000, rlm.get_account_ram_usage(N(testram11111))); + BOOST_REQUIRE_EQUAL(ram_usage - 1000, rlm.get_account_ram_usage("testram11111"_n)); // verify the added entry is beyond the allocation bytes limit BOOST_REQUIRE_EXCEPTION( - tester->push_action( N(testram11111), N(setentry), N(testram11111), mvo() + tester->push_action( "testram11111"_n, "setentry"_n, "testram11111"_n, mvo() ("payer", "testram11111") ("from", 1) ("to", 11) @@ -122,11 +122,11 @@ BOOST_FIXTURE_TEST_CASE(ram_tests, eosio_system::eosio_system_tester) { try { ram_usage_exceeded, fc_exception_message_starts_with("account testram11111 has insufficient ram")); produce_blocks(1); - BOOST_REQUIRE_EQUAL(ram_usage - 1000, rlm.get_account_ram_usage(N(testram11111))); + BOOST_REQUIRE_EQUAL(ram_usage - 1000, rlm.get_account_ram_usage("testram11111"_n)); // verify the new entry's bytes minus the freed up bytes for existing entries still exceeds the allocation bytes limit BOOST_REQUIRE_EXCEPTION( - tester->push_action( N(testram11111), N(setentry), N(testram11111), mvo() + tester->push_action( "testram11111"_n, "setentry"_n, "testram11111"_n, mvo() ("payer", "testram11111") ("from", 1) ("to", 11) @@ -134,24 +134,24 @@ BOOST_FIXTURE_TEST_CASE(ram_tests, eosio_system::eosio_system_tester) { try { ram_usage_exceeded, fc_exception_message_starts_with("account testram11111 has insufficient ram")); produce_blocks(1); - BOOST_REQUIRE_EQUAL(ram_usage - 1000, rlm.get_account_ram_usage(N(testram11111))); + BOOST_REQUIRE_EQUAL(ram_usage - 1000, rlm.get_account_ram_usage("testram11111"_n)); // verify the new entry's bytes minus the freed up bytes for existing entries are under the allocation bytes limit - tester->push_action( N(testram11111), N(setentry), N(testram11111), mvo() + tester->push_action( "testram11111"_n, "setentry"_n, "testram11111"_n, mvo() ("payer", "testram11111") ("from", 1) ("to", 11) ("size", 1600/*1720*/)); produce_blocks(1); - tester->push_action( N(testram11111), N(rmentry), N(testram11111), mvo() + tester->push_action( "testram11111"_n, "rmentry"_n, "testram11111"_n, mvo() ("from", 3) ("to", 3)); produce_blocks(1); // verify that the new entry will exceed the allocation bytes limit BOOST_REQUIRE_EXCEPTION( - tester->push_action( N(testram11111), N(setentry), N(testram11111), mvo() + tester->push_action( "testram11111"_n, "setentry"_n, "testram11111"_n, mvo() ("payer", "testram11111") ("from", 12) ("to", 12) @@ -161,7 +161,7 @@ BOOST_FIXTURE_TEST_CASE(ram_tests, eosio_system::eosio_system_tester) { try { produce_blocks(1); // verify that the new entry is under the allocation bytes limit - tester->push_action( N(testram11111), N(setentry), N(testram11111), mvo() + tester->push_action( "testram11111"_n, "setentry"_n, "testram11111"_n, mvo() ("payer", "testram11111") ("from", 12) ("to", 12) @@ -170,7 +170,7 @@ BOOST_FIXTURE_TEST_CASE(ram_tests, eosio_system::eosio_system_tester) { try { // verify that anoth new entry will exceed the allocation bytes limit, to setup testing of new payer BOOST_REQUIRE_EXCEPTION( - tester->push_action( N(testram11111), N(setentry), N(testram11111), mvo() + tester->push_action( "testram11111"_n, "setentry"_n, "testram11111"_n, mvo() ("payer", "testram11111") ("from", 13) ("to", 13) @@ -180,7 +180,7 @@ BOOST_FIXTURE_TEST_CASE(ram_tests, eosio_system::eosio_system_tester) { try { produce_blocks(1); // verify that the new entry is under the allocation bytes limit - tester->push_action( N(testram11111), N(setentry), {N(testram11111),N(testram22222)}, mvo() + tester->push_action( "testram11111"_n, "setentry"_n, {"testram11111"_n,"testram22222"_n}, mvo() ("payer", "testram22222") ("from", 12) ("to", 12) @@ -189,7 +189,7 @@ BOOST_FIXTURE_TEST_CASE(ram_tests, eosio_system::eosio_system_tester) { try { // verify that another new entry that is too big will exceed the allocation bytes limit, to setup testing of new payer BOOST_REQUIRE_EXCEPTION( - tester->push_action( N(testram11111), N(setentry), N(testram11111), mvo() + tester->push_action( "testram11111"_n, "setentry"_n, "testram11111"_n, mvo() ("payer", "testram11111") ("from", 13) ("to", 13) @@ -200,7 +200,7 @@ BOOST_FIXTURE_TEST_CASE(ram_tests, eosio_system::eosio_system_tester) { try { wlog("ram_tests 18 %%%%%%"); // verify that the new entry is under the allocation bytes limit, because entry 12 is now charged to testram22222 - tester->push_action( N(testram11111), N(setentry), N(testram11111), mvo() + tester->push_action( "testram11111"_n, "setentry"_n, "testram11111"_n, mvo() ("payer", "testram11111") ("from", 13) ("to", 13) @@ -209,7 +209,7 @@ BOOST_FIXTURE_TEST_CASE(ram_tests, eosio_system::eosio_system_tester) { try { // verify that new entries for testram22222 exceed the allocation bytes limit BOOST_REQUIRE_EXCEPTION( - tester->push_action( N(testram11111), N(setentry), {N(testram11111),N(testram22222)}, mvo() + tester->push_action( "testram11111"_n, "setentry"_n, {"testram11111"_n,"testram22222"_n}, mvo() ("payer", "testram22222") ("from", 12) ("to", 21) @@ -219,7 +219,7 @@ BOOST_FIXTURE_TEST_CASE(ram_tests, eosio_system::eosio_system_tester) { try { produce_blocks(1); // verify that new entries for testram22222 are under the allocation bytes limit - tester->push_action( N(testram11111), N(setentry), {N(testram11111),N(testram22222)}, mvo() + tester->push_action( "testram11111"_n, "setentry"_n, {"testram11111"_n,"testram22222"_n}, mvo() ("payer", "testram22222") ("from", 12) ("to", 21) @@ -228,7 +228,7 @@ BOOST_FIXTURE_TEST_CASE(ram_tests, eosio_system::eosio_system_tester) { try { // verify that new entry for testram22222 exceed the allocation bytes limit BOOST_REQUIRE_EXCEPTION( - tester->push_action( N(testram11111), N(setentry), {N(testram11111),N(testram22222)}, mvo() + tester->push_action( "testram11111"_n, "setentry"_n, {"testram11111"_n,"testram22222"_n}, mvo() ("payer", "testram22222") ("from", 22) ("to", 22) @@ -237,13 +237,13 @@ BOOST_FIXTURE_TEST_CASE(ram_tests, eosio_system::eosio_system_tester) { try { fc_exception_message_starts_with("account testram22222 has insufficient ram")); produce_blocks(1); - tester->push_action( N(testram11111), N(rmentry), N(testram11111), mvo() + tester->push_action( "testram11111"_n, "rmentry"_n, "testram11111"_n, mvo() ("from", 20) ("to", 20)); produce_blocks(1); // verify that new entry for testram22222 are under the allocation bytes limit - tester->push_action( N(testram11111), N(setentry), {N(testram11111),N(testram22222)}, mvo() + tester->push_action( "testram11111"_n, "setentry"_n, {"testram11111"_n,"testram22222"_n}, mvo() ("payer", "testram22222") ("from", 22) ("to", 22) diff --git a/unittests/resource_limits_test.cpp b/unittests/resource_limits_test.cpp index 256b716fd17..2d99fa7920f 100644 --- a/unittests/resource_limits_test.cpp +++ b/unittests/resource_limits_test.cpp @@ -321,20 +321,20 @@ BOOST_AUTO_TEST_SUITE(resource_limits_test) double uncongested_cpu_time_per_period = congested_cpu_time_per_period * config::maximum_elastic_resource_multiplier; wdump((uncongested_cpu_time_per_period)); - initialize_account( N(dan) ); - initialize_account( N(everyone) ); - set_account_limits( N(dan), 0, 0, user_stake ); - set_account_limits( N(everyone), 0, 0, (total_staked_tokens - user_stake) ); + initialize_account( "dan"_n ); + initialize_account( "everyone"_n ); + set_account_limits( "dan"_n, 0, 0, user_stake ); + set_account_limits( "everyone"_n, 0, 0, (total_staked_tokens - user_stake) ); process_account_limit_updates(); // dan cannot consume more than 34 us per day - BOOST_REQUIRE_THROW( add_transaction_usage( {N(dan)}, 35, 0, 1 ), tx_cpu_usage_exceeded ); + BOOST_REQUIRE_THROW( add_transaction_usage( {"dan"_n}, 35, 0, 1 ), tx_cpu_usage_exceeded ); // Ensure CPU usage is 0 by "waiting" for one day's worth of blocks to pass. - add_transaction_usage( {N(dan)}, 0, 0, 1 + blocks_per_day ); + add_transaction_usage( {"dan"_n}, 0, 0, 1 + blocks_per_day ); // But dan should be able to consume up to 34 us per day. - add_transaction_usage( {N(dan)}, 34, 0, 2 + blocks_per_day ); + add_transaction_usage( {"dan"_n}, 34, 0, 2 + blocks_per_day ); } FC_LOG_AND_RETHROW() /** @@ -434,13 +434,13 @@ BOOST_AUTO_TEST_SUITE(resource_limits_test) // Create test account with limited NET quota main.create_accounts( {test_account, test_account2} ); - main.push_action( config::system_account_name, N(setalimits), config::system_account_name, fc::mutable_variant_object() + main.push_action( config::system_account_name, "setalimits"_n, config::system_account_name, fc::mutable_variant_object() ("account", test_account) ("ram_bytes", -1) ("net_weight", net_weight) ("cpu_weight", -1) ); - main.push_action( config::system_account_name, N(setalimits), config::system_account_name, fc::mutable_variant_object() + main.push_action( config::system_account_name, "setalimits"_n, config::system_account_name, fc::mutable_variant_object() ("account", test_account2) ("ram_bytes", -1) ("net_weight", other_net_weight) @@ -464,11 +464,11 @@ BOOST_AUTO_TEST_SUITE(resource_limits_test) // NET quota of test account should be enough to support one but not two reqauth transactions. int64_t before_net_usage = rlm.get_account_net_limit_ex( test_account ).first.used; - main.push_action( config::system_account_name, N(reqauth), test_account, fc::mutable_variant_object()("from", "alice"), 6 ); + main.push_action( config::system_account_name, "reqauth"_n, test_account, fc::mutable_variant_object()("from", "alice"), 6 ); int64_t after_net_usage = rlm.get_account_net_limit_ex( test_account ).first.used; int64_t reqauth_net_usage_delta = after_net_usage - before_net_usage; BOOST_REQUIRE_EXCEPTION( - main.push_action( config::system_account_name, N(reqauth), test_account, fc::mutable_variant_object()("from", "alice"), 7 ), + main.push_action( config::system_account_name, "reqauth"_n, test_account, fc::mutable_variant_object()("from", "alice"), 7 ), fc::exception, fc_exception_code_is( tx_net_usage_exceeded::code_value ) ); trigger_block = main.produce_block(); diff --git a/unittests/restart_chain_tests.cpp b/unittests/restart_chain_tests.cpp index 2f6f3abd69e..ded8805545f 100644 --- a/unittests/restart_chain_tests.cpp +++ b/unittests/restart_chain_tests.cpp @@ -63,19 +63,19 @@ struct restart_from_block_log_test_fixture { uint32_t cutoff_block_num; bool fix_irreversible_blocks = false; restart_from_block_log_test_fixture() { - chain.create_account(N(replay1)); + chain.create_account("replay1"_n); chain.produce_blocks(1); - chain.create_account(N(replay2)); + chain.create_account("replay2"_n); chain.produce_blocks(1); - chain.create_account(N(replay3)); + chain.create_account("replay3"_n); chain.produce_blocks(1); auto cutoff_block = chain.produce_block(); cutoff_block_num = cutoff_block->block_num(); chain.produce_blocks(10); - BOOST_REQUIRE_NO_THROW(chain.control->get_account(N(replay1))); - BOOST_REQUIRE_NO_THROW(chain.control->get_account(N(replay2))); - BOOST_REQUIRE_NO_THROW(chain.control->get_account(N(replay3))); + BOOST_REQUIRE_NO_THROW(chain.control->get_account("replay1"_n)); + BOOST_REQUIRE_NO_THROW(chain.control->get_account("replay2"_n)); + BOOST_REQUIRE_NO_THROW(chain.control->get_account("replay3"_n)); chain.close(); } @@ -88,9 +88,9 @@ struct restart_from_block_log_test_fixture { // remove the state files to make sure we are starting from block log remove_existing_states(copied_config); tester from_block_log_chain(copied_config, *genesis); - BOOST_REQUIRE_NO_THROW(from_block_log_chain.control->get_account(N(replay1))); - BOOST_REQUIRE_NO_THROW(from_block_log_chain.control->get_account(N(replay2))); - BOOST_REQUIRE_NO_THROW(from_block_log_chain.control->get_account(N(replay3))); + BOOST_REQUIRE_NO_THROW(from_block_log_chain.control->get_account("replay1"_n)); + BOOST_REQUIRE_NO_THROW(from_block_log_chain.control->get_account("replay2"_n)); + BOOST_REQUIRE_NO_THROW(from_block_log_chain.control->get_account("replay3"_n)); } }; diff --git a/unittests/snapshot_tests.cpp b/unittests/snapshot_tests.cpp index bfc3d32e5a8..22c107c8416 100644 --- a/unittests/snapshot_tests.cpp +++ b/unittests/snapshot_tests.cpp @@ -282,10 +282,10 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(test_exhaustive_snapshot, SNAPSHOT_SUITE, snapshot { tester chain; - chain.create_account(N(snapshot)); + chain.create_account("snapshot"_n); chain.produce_blocks(1); - chain.set_code(N(snapshot), contracts::snapshot_test_wasm()); - chain.set_abi(N(snapshot), contracts::snapshot_test_abi().data()); + chain.set_code("snapshot"_n, contracts::snapshot_test_wasm()); + chain.set_abi("snapshot"_n, contracts::snapshot_test_abi().data()); chain.produce_blocks(1); chain.control->abort_block(); @@ -302,7 +302,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(test_exhaustive_snapshot, SNAPSHOT_SUITE, snapshot sub_testers.emplace_back(chain.get_config(), SNAPSHOT_SUITE::get_reader(snapshot), generation); // increment the test contract - chain.push_action(N(snapshot), N(increment), N(snapshot), mutable_variant_object() + chain.push_action("snapshot"_n, "increment"_n, "snapshot"_n, mutable_variant_object() ( "value", 1 ) ); @@ -327,10 +327,10 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(test_replay_over_snapshot, SNAPSHOT_SUITE, snapsho tester chain; const chainbase::bfs::path parent_path = chain.get_config().blog.log_dir.parent_path(); - chain.create_account(N(snapshot)); + chain.create_account("snapshot"_n); chain.produce_blocks(1); - chain.set_code(N(snapshot), contracts::snapshot_test_wasm()); - chain.set_abi(N(snapshot), contracts::snapshot_test_abi().data()); + chain.set_code("snapshot"_n, contracts::snapshot_test_wasm()); + chain.set_abi("snapshot"_n, contracts::snapshot_test_abi().data()); chain.produce_blocks(1); chain.control->abort_block(); @@ -339,7 +339,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(test_replay_over_snapshot, SNAPSHOT_SUITE, snapsho for (int itr = 0; itr < pre_snapshot_block_count; itr++) { // increment the contract - chain.push_action(N(snapshot), N(increment), N(snapshot), mutable_variant_object() + chain.push_action("snapshot"_n, "increment"_n, "snapshot"_n, mutable_variant_object() ( "value", 1 ) ); @@ -362,7 +362,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(test_replay_over_snapshot, SNAPSHOT_SUITE, snapsho // push more blocks to build up a block log for (int itr = 0; itr < post_snapshot_block_count; itr++) { // increment the contract - chain.push_action(N(snapshot), N(increment), N(snapshot), mutable_variant_object() + chain.push_action("snapshot"_n, "increment"_n, "snapshot"_n, mutable_variant_object() ( "value", 1 ) ); @@ -422,10 +422,10 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(test_chain_id_in_snapshot, SNAPSHOT_SUITE, snapsho tester chain; const chainbase::bfs::path parent_path = chain.get_config().blog.log_dir.parent_path(); - chain.create_account(N(snapshot)); + chain.create_account("snapshot"_n); chain.produce_blocks(1); - chain.set_code(N(snapshot), contracts::snapshot_test_wasm()); - chain.set_abi(N(snapshot), contracts::snapshot_test_abi().data()); + chain.set_code("snapshot"_n, contracts::snapshot_test_wasm()); + chain.set_abi("snapshot"_n, contracts::snapshot_test_abi().data()); chain.produce_blocks(1); chain.control->abort_block(); @@ -468,10 +468,10 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(test_compatible_versions, SNAPSHOT_SUITE, snapshot ///< Begin deterministic code to generate blockchain for comparison tester chain(setup_policy::none, db_read_mode::SPECULATIVE, {legacy_default_max_inline_action_size}); - chain.create_account(N(snapshot)); + chain.create_account("snapshot"_n); chain.produce_blocks(1); - chain.set_code(N(snapshot), contracts::snapshot_test_wasm()); - chain.set_abi(N(snapshot), contracts::snapshot_test_abi().data()); + chain.set_code("snapshot"_n, contracts::snapshot_test_wasm()); + chain.set_abi("snapshot"_n, contracts::snapshot_test_abi().data()); chain.produce_blocks(1); chain.control->abort_block(); @@ -541,14 +541,14 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(test_pending_schedule_snapshot, SNAPSHOT_SUITE, sn BOOST_REQUIRE_EQUAL(gpo.chain_id, chain.control->get_chain_id()); auto block = chain.produce_block(); BOOST_REQUIRE_EQUAL(block->block_num(), 3); // ensure that test setup stays consistent with original snapshot setup - chain.create_account(N(snapshot)); + chain.create_account("snapshot"_n); block = chain.produce_block(); BOOST_REQUIRE_EQUAL(block->block_num(), 4); BOOST_REQUIRE_EQUAL(gpo.proposed_schedule.version, 0); BOOST_REQUIRE_EQUAL(gpo.proposed_schedule.producers.size(), 0); - auto res = chain.set_producers_legacy( {N(snapshot)} ); + auto res = chain.set_producers_legacy( {"snapshot"_n} ); block = chain.produce_block(); BOOST_REQUIRE_EQUAL(block->block_num(), 5); chain.control->abort_block(); @@ -606,10 +606,10 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(test_restart_with_existing_state_and_truncated_blo tester chain; const chainbase::bfs::path parent_path = chain.get_config().blog.log_dir.parent_path(); - chain.create_account(N(snapshot)); + chain.create_account("snapshot"_n); chain.produce_blocks(1); - chain.set_code(N(snapshot), contracts::snapshot_test_wasm()); - chain.set_abi(N(snapshot), contracts::snapshot_test_abi().data()); + chain.set_code("snapshot"_n, contracts::snapshot_test_wasm()); + chain.set_abi("snapshot"_n, contracts::snapshot_test_abi().data()); chain.produce_blocks(1); chain.control->abort_block(); @@ -617,7 +617,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(test_restart_with_existing_state_and_truncated_blo for (int itr = 0; itr < pre_snapshot_block_count; itr++) { // increment the contract - chain.push_action(N(snapshot), N(increment), N(snapshot), mutable_variant_object() + chain.push_action("snapshot"_n, "increment"_n, "snapshot"_n, mutable_variant_object() ( "value", 1 ) ); diff --git a/unittests/state_history_tests.cpp b/unittests/state_history_tests.cpp index 3f0af4ebaf3..a69093ba08e 100644 --- a/unittests/state_history_tests.cpp +++ b/unittests/state_history_tests.cpp @@ -16,35 +16,34 @@ #include #pragma pop_macro("N") -using namespace eosio; -using namespace testing; -using namespace chain; +using namespace eosio::chain; +using namespace eosio::testing; using namespace std::literals; using prunable_data_type = eosio::chain::packed_transaction::prunable_data_type; namespace bio = boost::iostreams; extern const char* const state_history_plugin_abi; -prunable_data_type::prunable_data_t get_prunable_data_from_traces(std::vector& traces, +prunable_data_type::prunable_data_t get_prunable_data_from_traces(std::vector& traces, const transaction_id_type& id) { - auto cfd_trace_itr = std::find_if(traces.begin(), traces.end(), [id](const state_history::transaction_trace& v) { - return std::get(v).id == id; + auto cfd_trace_itr = std::find_if(traces.begin(), traces.end(), [id](const eosio::state_history::transaction_trace& v) { + return std::get(v).id == id; }); // make sure the trace with cfd can be found BOOST_REQUIRE(cfd_trace_itr != traces.end()); - BOOST_REQUIRE(std::holds_alternative(*cfd_trace_itr)); - auto trace_v0 = std::get(*cfd_trace_itr); + BOOST_REQUIRE(std::holds_alternative(*cfd_trace_itr)); + auto trace_v0 = std::get(*cfd_trace_itr); BOOST_REQUIRE(trace_v0.partial); - BOOST_REQUIRE(std::holds_alternative(*trace_v0.partial)); - return std::get(*trace_v0.partial).prunable_data->prunable_data; + BOOST_REQUIRE(std::holds_alternative(*trace_v0.partial)); + return std::get(*trace_v0.partial).prunable_data->prunable_data; } prunable_data_type::prunable_data_t get_prunable_data_from_traces_bin(const std::vector& entry, const transaction_id_type& id) { fc::datastream strm(entry.data(), entry.size()); - std::vector traces; - state_history::trace_converter::unpack(strm, traces); + std::vector traces; + eosio::state_history::trace_converter::unpack(strm, traces); return get_prunable_data_from_traces(traces, id); } @@ -57,7 +56,7 @@ struct state_history_abi_serializer { , sr(fc::json::from_string(state_history_plugin_abi).as(), abi_serializer::create_yield_function(chain.abi_serializer_max_time)) {} - fc::variant deserialize(const chain::bytes& data, const char* type) { + fc::variant deserialize(const eosio::chain::bytes& data, const char* type) { fc::datastream strm(data.data(), data.size()); auto result = sr.binary_to_variant(type, strm, abi_serializer::create_yield_function(chain.abi_serializer_max_time)); @@ -73,8 +72,8 @@ BOOST_AUTO_TEST_CASE(test_trace_converter) { tester chain; using namespace eosio::state_history; - state_history::transaction_trace_cache cache; - std::map on_disk_log_entries; + transaction_trace_cache cache; + std::map on_disk_log_entries; chain.control->applied_transaction.connect( [&](std::tuple t) { @@ -84,8 +83,8 @@ BOOST_AUTO_TEST_CASE(test_trace_converter) { chain.control->accepted_block.connect([&](const block_state_ptr& bs) { auto traces = cache.prepare_traces(bs); fc::datastream> strm; - state_history::trace_converter::pack(strm, chain.control->db(), true, traces, - state_history::compression_type::zlib); + trace_converter::pack(strm, chain.control->db(), true, traces, + compression_type::zlib); on_disk_log_entries[bs->block_num] = strm.storage(); }); @@ -106,7 +105,7 @@ BOOST_AUTO_TEST_CASE(test_trace_converter) { // prune the cfd for the block std::vector ids{cfd_trace->id}; fc::datastream rw_strm(cfd_entry.data(), cfd_entry.size()); - state_history::trace_converter::prune_traces(rw_strm, cfd_entry.size(), ids); + trace_converter::prune_traces(rw_strm, cfd_entry.size(), ids); BOOST_CHECK(ids.size() == 0); // read the pruned trace and make sure it's pruned @@ -119,7 +118,7 @@ BOOST_AUTO_TEST_CASE(test_trace_log) { scoped_temp_path state_history_dir; fc::create_directories(state_history_dir.path); - state_history_traces_log log({ .log_dir = state_history_dir.path }); + eosio::state_history_traces_log log({ .log_dir = state_history_dir.path }); chain.control->applied_transaction.connect( [&](std::tuple t) { @@ -144,8 +143,8 @@ BOOST_AUTO_TEST_CASE(test_trace_log) { // we assume the nodeos has to be stopped while running, it can only be read // correctly with restart - state_history_traces_log new_log({ .log_dir = state_history_dir.path }); - auto pruned_traces = new_log.get_traces(cfd_trace->block_num); + eosio::state_history_traces_log new_log({ .log_dir = state_history_dir.path }); + auto pruned_traces = new_log.get_traces(cfd_trace->block_num); BOOST_REQUIRE(pruned_traces.size()); BOOST_CHECK(std::holds_alternative(get_prunable_data_from_traces(pruned_traces, cfd_trace->id))); @@ -158,7 +157,7 @@ BOOST_AUTO_TEST_CASE(test_chain_state_log) { scoped_temp_path state_history_dir; fc::create_directories(state_history_dir.path); - state_history_chain_state_log log({ .log_dir = state_history_dir.path }); + eosio::state_history_chain_state_log log({ .log_dir = state_history_dir.path }); uint32_t last_accepted_block_num = 0; @@ -169,23 +168,23 @@ BOOST_AUTO_TEST_CASE(test_chain_state_log) { chain.produce_blocks(10); - chain::bytes entry = log.get_log_entry(last_accepted_block_num); - std::vector deltas; - eosio::input_stream deltas_bin{entry.data(), entry.data() + entry.size()}; + eosio::chain::bytes entry = log.get_log_entry(last_accepted_block_num); + std::vector deltas; + eosio::input_stream deltas_bin{entry.data(), entry.data() + entry.size()}; BOOST_CHECK_NO_THROW(from_bin(deltas, deltas_bin)); } struct state_history_tester_logs { - state_history_tester_logs(const state_history_config& config) + state_history_tester_logs(const eosio::state_history_config& config) : traces_log(config) , chain_state_log(config) {} - state_history_traces_log traces_log; - state_history_chain_state_log chain_state_log; + eosio::state_history_traces_log traces_log; + eosio::state_history_chain_state_log chain_state_log; }; struct state_history_tester : state_history_tester_logs, tester { - state_history_tester(const state_history_config& config) + state_history_tester(const eosio::state_history_config& config) : state_history_tester_logs(config), tester ([&](eosio::chain::controller& control) { control.applied_transaction.connect( [&](std::tuple t) { @@ -206,7 +205,7 @@ BOOST_AUTO_TEST_CASE(test_splitted_log) { scoped_temp_path state_history_dir; fc::create_directories(state_history_dir.path); - state_history_config config{ + eosio::state_history_config config{ .log_dir = state_history_dir.path, .retained_dir = "retained", .archive_dir = "archive", @@ -282,8 +281,8 @@ BOOST_AUTO_TEST_CASE(test_splitted_log) { // we assume the nodeos has to be stopped while running, it can only be read // correctly with restart - state_history_traces_log new_log(config); - auto pruned_traces = new_log.get_traces(cfd_trace->block_num); + eosio::state_history_traces_log new_log(config); + auto pruned_traces = new_log.get_traces(cfd_trace->block_num); BOOST_REQUIRE(pruned_traces.size()); BOOST_CHECK(std::holds_alternative(get_prunable_data_from_traces(pruned_traces, cfd_trace->id))); @@ -295,7 +294,7 @@ BOOST_AUTO_TEST_CASE(test_corrupted_log_recovery) { scoped_temp_path state_history_dir; fc::create_directories(state_history_dir.path); - state_history_config config{ + eosio::state_history_config config{ .log_dir = state_history_dir.path, .archive_dir = "archive", .stride = 100, @@ -324,12 +323,12 @@ BOOST_AUTO_TEST_CASE(test_corrupted_log_recovery) { BOOST_AUTO_TEST_CASE(test_state_result_abi) { - using namespace state_history; + using namespace eosio::state_history; tester chain; transaction_trace_cache trace_cache; - std::map history; + std::map history; std::optional prev_block; chain.control->applied_transaction.connect( @@ -348,17 +347,17 @@ BOOST_AUTO_TEST_CASE(test_state_result_abi) { get_blocks_result_v1 message; message.head = block_position{control->head_block_num(), control->head_block_id()}; message.last_irreversible = - state_history::block_position{control->last_irreversible_block_num(), control->last_irreversible_block_id()}; - message.this_block = state_history::block_position{block_state->block->block_num(), block_state->id}; + block_position{control->last_irreversible_block_num(), control->last_irreversible_block_id()}; + message.this_block = block_position{block_state->block->block_num(), block_state->id}; message.prev_block = prev_block; message.block = block_state->block; - std::vector traces; - state_history::trace_converter::unpack(strm, traces); + std::vector traces; + trace_converter::unpack(strm, traces); message.traces = traces; - message.deltas = fc::raw::pack(state_history::create_deltas(control->db(), !prev_block)); + message.deltas = fc::raw::pack(create_deltas(control->db(), !prev_block)); prev_block = message.this_block; - history[control->head_block_num()] = fc::raw::pack(state_history::state_result{message}); + history[control->head_block_num()] = fc::raw::pack(state_result{message}); }); deploy_test_api(chain); @@ -376,11 +375,11 @@ BOOST_AUTO_TEST_CASE(test_state_result_abi) { BOOST_CHECK(result_variant[0].as_string() == "get_blocks_result_v1"); auto& get_blocks_result_v1 = result_variant[1].get_object(); - chain::bytes traces_bin; + eosio::chain::bytes traces_bin; fc::from_variant(get_blocks_result_v1["traces"], traces_bin); BOOST_CHECK_NO_THROW( serializer.deserialize(traces_bin, "transaction_trace[]") ); - chain::bytes deltas_bin; + eosio::chain::bytes deltas_bin; fc::from_variant(get_blocks_result_v1["deltas"], deltas_bin); BOOST_CHECK_NO_THROW( serializer.deserialize(deltas_bin, "table_delta[]")); } @@ -410,29 +409,29 @@ BOOST_AUTO_TEST_CASE(test_traces_present) scoped_temp_path state_history_dir; fc::create_directories(state_history_dir.path); - state_history_config config; + eosio::state_history_config config; config.log_dir = state_history_dir.path; - state_history_traces_log log(config); + eosio::state_history_traces_log log(config); bool onblock_test_executed = false; chain.control->applied_transaction.connect( [&](std::tuple t) { const transaction_trace_ptr &trace_ptr = std::get<0>(t); - const chain::packed_transaction_ptr &transaction = std::get<1>(t); + const eosio::chain::packed_transaction_ptr &transaction = std::get<1>(t); log.add_transaction(trace_ptr, transaction); // see issue #9159 - if (!trace_ptr->action_traces.empty() && trace_ptr->action_traces[0].act.name == N(onblock)) { - BOOST_CHECK(chain::is_onblock(*trace_ptr)); + if (!trace_ptr->action_traces.empty() && trace_ptr->action_traces[0].act.name == "onblock"_n) { + BOOST_CHECK(eosio::chain::is_onblock(*trace_ptr)); trace_ptr->action_traces.clear(); - BOOST_CHECK(!chain::is_onblock(*trace_ptr)); + BOOST_CHECK(!eosio::chain::is_onblock(*trace_ptr)); onblock_test_executed = true; } }); chain.control->accepted_block.connect([&](const block_state_ptr& bs) { log.store(chain.control->db(), bs); }); - auto tr_ptr = chain.create_account(N(newacc)); + auto tr_ptr = chain.create_account("newacc"_n); chain.produce_block(); @@ -441,16 +440,16 @@ BOOST_AUTO_TEST_CASE(test_traces_present) auto traces = log.get_traces(tr_ptr->block_num); BOOST_REQUIRE_EQUAL(traces.size(), 1); - auto trace_itr = std::find_if(traces.begin(), traces.end(), [tr_ptr](const state_history::transaction_trace& v) { - return std::get(v).id == tr_ptr->id; + auto trace_itr = std::find_if(traces.begin(), traces.end(), [tr_ptr](const eosio::state_history::transaction_trace& v) { + return std::get(v).id == tr_ptr->id; }); BOOST_REQUIRE(trace_itr != traces.end()); - auto &action_traces = std::get(*trace_itr).action_traces; + auto &action_traces = std::get(*trace_itr).action_traces; - auto new_account_action_itr = std::find_if(action_traces.begin(), action_traces.end(), [](const state_history::action_trace& v) { - return std::get(v).act.name == N(newaccount).to_uint64_t(); + auto new_account_action_itr = std::find_if(action_traces.begin(), action_traces.end(), [](const eosio::state_history::action_trace& v) { + return std::get(v).act.name == "newaccount"_n.to_uint64_t(); }); BOOST_REQUIRE(new_account_action_itr != action_traces.end()); @@ -496,7 +495,7 @@ BOOST_AUTO_TEST_CASE(test_deltas_account_creation) { BOOST_REQUIRE_EQUAL(chain.find_table_delta("account").first, false); // Create new account - chain.create_account(N(newacc)); + chain.create_account("newacc"_n); // Verify that a new record for the new account in the state delta of the block auto result = chain.find_table_delta("account"); @@ -511,7 +510,7 @@ BOOST_AUTO_TEST_CASE(test_deltas_account_metadata) { table_deltas_tester chain; chain.produce_block(); - chain.create_account(N(newacc)); + chain.create_account("newacc"_n); // Spot onto account metadata auto result = chain.find_table_delta("account_metadata"); @@ -528,7 +527,7 @@ BOOST_AUTO_TEST_CASE(test_deltas_account_permission) { table_deltas_tester chain; chain.produce_block(); - chain.create_account(N(newacc)); + chain.create_account("newacc"_n); // Check that the permissions of this new account are in the delta vector expected_permission_names{ "owner", "active" }; @@ -549,16 +548,16 @@ BOOST_AUTO_TEST_CASE(test_deltas_account_permission_creation_and_deletion) { table_deltas_tester chain; chain.produce_block(); - chain.create_account(N(newacc)); + chain.create_account("newacc"_n); auto& authorization_manager = chain.control->get_authorization_manager(); - const permission_object* ptr = authorization_manager.find_permission( {N(newacc), N(active)} ); + const permission_object* ptr = authorization_manager.find_permission( {"newacc"_n, "active"_n} ); BOOST_REQUIRE(ptr != nullptr); // Create new permission - chain.set_authority(N(newacc), N(mypermission), ptr->auth, N(active)); + chain.set_authority("newacc"_n, "mypermission"_n, ptr->auth, "active"_n); - const permission_object* ptr_sub = authorization_manager.find_permission( {N(newacc), N(mypermission)} ); + const permission_object* ptr_sub = authorization_manager.find_permission( {"newacc"_n, "mypermission"_n} ); BOOST_REQUIRE(ptr_sub != nullptr); // Verify that the new permission is present in the state delta @@ -576,7 +575,7 @@ BOOST_AUTO_TEST_CASE(test_deltas_account_permission_creation_and_deletion) { chain.produce_block(); // Delete the permission - chain.delete_authority(N(newacc), N(mypermission)); + chain.delete_authority("newacc"_n, "mypermission"_n); result = chain.find_table_delta("permission"); BOOST_REQUIRE(result.first); @@ -593,7 +592,7 @@ BOOST_AUTO_TEST_CASE(test_deltas_account_permission_modification) { table_deltas_tester chain; chain.produce_block(); - chain.create_account(N(newacc)); + chain.create_account("newacc"_n); chain.produce_block(); public_key_type keys[] = { public_key_type("PUB_WA_WdCPfafVNxVMiW5ybdNs83oWjenQXvSt1F49fg9mv7qrCiRwHj5b38U3ponCFWxQTkDsMC"s), // Test for correct serialization of WA key, see issue #9087 @@ -604,7 +603,7 @@ BOOST_AUTO_TEST_CASE(test_deltas_account_permission_modification) { for(auto &key: keys) { // Modify the permission authority auto wa_authority = authority(1, {key_weight{key, 1}}, {}); - chain.set_authority(N(newacc), N(active), wa_authority, N(owner)); + chain.set_authority("newacc"_n, "active"_n, wa_authority, "owner"_n); auto result = chain.find_table_delta("permission"); BOOST_REQUIRE(result.first); @@ -630,15 +629,15 @@ BOOST_AUTO_TEST_CASE(test_deltas_permission_link) { table_deltas_tester chain; chain.produce_block(); - chain.create_account(N(newacc)); + chain.create_account("newacc"_n); // Spot onto permission_link - const auto spending_priv_key = chain.get_private_key(N(newacc), "spending"); + const auto spending_priv_key = chain.get_private_key("newacc"_n, "spending"); const auto spending_pub_key = spending_priv_key.get_public_key(); - chain.set_authority(N(newacc), N(spending), spending_pub_key, N(active)); - chain.link_authority(N(newacc), N(eosio), N(spending), N(reqauth)); - chain.push_reqauth(N(newacc), { permission_level{N(newacc), N(spending)} }, { spending_priv_key }); + chain.set_authority("newacc"_n, "spending"_n, spending_pub_key, "active"_n); + chain.link_authority("newacc"_n, "eosio"_n, "spending"_n, "reqauth"_n); + chain.push_reqauth("newacc"_n, { permission_level{"newacc"_n, "spending"_n} }, { spending_priv_key }); auto result = chain.find_table_delta("permission_link"); BOOST_REQUIRE(result.first); @@ -657,7 +656,7 @@ BOOST_AUTO_TEST_CASE(test_deltas_global_property_history) { // Change max_transaction_delay to 60 sec auto params = chain.control->get_global_properties().configuration; params.max_transaction_delay = 60; - chain.push_action( config::system_account_name, N(setparams), config::system_account_name, + chain.push_action( config::system_account_name, "setparams"_n, config::system_account_name, mutable_variant_object() ("params", params) ); @@ -708,18 +707,18 @@ BOOST_AUTO_TEST_CASE(test_deltas_contract) { table_deltas_tester chain; chain.produce_block(); - chain.create_account(N(tester)); + chain.create_account("tester"_n); - chain.set_code(N(tester), contracts::get_table_test_wasm()); - chain.set_abi(N(tester), contracts::get_table_test_abi().data()); + chain.set_code("tester"_n, contracts::get_table_test_wasm()); + chain.set_abi("tester"_n, contracts::get_table_test_abi().data()); chain.produce_block(); - auto trace = chain.push_action(N(tester), N(addhashobj), N(tester), mutable_variant_object()("hashinput", "hello" )); + auto trace = chain.push_action("tester"_n, "addhashobj"_n, "tester"_n, mutable_variant_object()("hashinput", "hello" )); BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace->receipt->status); - trace = chain.push_action(N(tester), N(addnumobj), N(tester), mutable_variant_object()("input", 2)); + trace = chain.push_action("tester"_n, "addnumobj"_n, "tester"_n, mutable_variant_object()("input", 2)); BOOST_REQUIRE_EQUAL(transaction_receipt::executed, trace->receipt->status); @@ -759,21 +758,21 @@ BOOST_AUTO_TEST_CASE(test_deltas_resources_history) { table_deltas_tester chain; chain.produce_block(); - chain.create_accounts({ N(eosio.token), N(eosio.ram), N(eosio.ramfee), N(eosio.stake)}); + chain.create_accounts({ "eosio.token"_n, "eosio.ram"_n, "eosio.ramfee"_n, "eosio.stake"_n}); chain.produce_blocks( 100 ); - chain.set_code( N(eosio.token), contracts::eosio_token_wasm() ); - chain.set_abi( N(eosio.token), contracts::eosio_token_abi().data() ); + chain.set_code( "eosio.token"_n, contracts::eosio_token_wasm() ); + chain.set_abi( "eosio.token"_n, contracts::eosio_token_abi().data() ); chain.produce_block(); - chain.push_action(N(eosio.token), N(create), N(eosio.token), mutable_variant_object() + chain.push_action("eosio.token"_n, "create"_n, "eosio.token"_n, mutable_variant_object() ("issuer", "eosio.token" ) ("maximum_supply", core_from_string("1000000000.0000") ) ); - chain.push_action(N(eosio.token), N(issue), N(eosio.token), fc::mutable_variant_object() + chain.push_action("eosio.token"_n, "issue"_n, "eosio.token"_n, fc::mutable_variant_object() ("to", "eosio") ("quantity", core_from_string("90.0000")) ("memo", "for stuff") @@ -784,7 +783,7 @@ BOOST_AUTO_TEST_CASE(test_deltas_resources_history) { chain.set_code( config::system_account_name, contracts::eosio_system_wasm() ); chain.set_abi( config::system_account_name, contracts::eosio_system_abi().data() ); - chain.push_action(config::system_account_name, N(init), config::system_account_name, + chain.push_action(config::system_account_name, "init"_n, config::system_account_name, mutable_variant_object() ("version", 0) ("core", CORE_SYM_STR)); @@ -793,25 +792,25 @@ BOOST_AUTO_TEST_CASE(test_deltas_resources_history) { chain.set_transaction_headers(trx); authority owner_auth; - owner_auth = authority( chain.get_public_key( N(alice), "owner" ) ); + owner_auth = authority( chain.get_public_key( "alice"_n, "owner" ) ); trx.actions.emplace_back( vector{{config::system_account_name,config::active_name}}, newaccount{ .creator = config::system_account_name, - .name = N(alice), + .name = "alice"_n, .owner = owner_auth, - .active = authority( chain.get_public_key( N(alice), "active" ) )}); + .active = authority( chain.get_public_key( "alice"_n, "active" ) )}); - trx.actions.emplace_back( chain.get_action( config::system_account_name, N(buyram), vector{{config::system_account_name,config::active_name}}, + trx.actions.emplace_back( chain.get_action( config::system_account_name, "buyram"_n, vector{{config::system_account_name,config::active_name}}, mutable_variant_object() ("payer", config::system_account_name) - ("receiver", N(alice)) + ("receiver", "alice"_n) ("quant", core_from_string("1.0000")))); - trx.actions.emplace_back( chain.get_action( config::system_account_name, N(delegatebw), vector{{config::system_account_name,config::active_name}}, + trx.actions.emplace_back( chain.get_action( config::system_account_name, "delegatebw"_n, vector{{config::system_account_name,config::active_name}}, mutable_variant_object() ("from", config::system_account_name) - ("receiver", N(alice)) + ("receiver", "alice"_n) ("stake_net_quantity", core_from_string("10.0000") ) ("stake_cpu_quantity", core_from_string("10.0000") ) ("transfer", 0 ))); @@ -839,4 +838,4 @@ BOOST_AUTO_TEST_CASE(test_deltas_resources_history) { */ } -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file +BOOST_AUTO_TEST_SUITE_END() diff --git a/unittests/test_cfd_transaction.cpp b/unittests/test_cfd_transaction.cpp index 15f7a5b119a..bef4748641c 100644 --- a/unittests/test_cfd_transaction.cpp +++ b/unittests/test_cfd_transaction.cpp @@ -1,14 +1,14 @@ #include "test_cfd_transaction.hpp" #include - +using namespace eosio::chain::literals; std::vector deploy_test_api(eosio::testing::tester& chain) { std::vector result; - chain.create_account(N(testapi)); - chain.create_account(N(dummy)); + chain.create_account("testapi"_n); + chain.create_account("dummy"_n); result.push_back(chain.produce_block()); - chain.set_code(N(testapi), eosio::testing::contracts::test_api_wasm()); + chain.set_code("testapi"_n, eosio::testing::contracts::test_api_wasm()); result.push_back(chain.produce_block()); return result; } @@ -23,10 +23,10 @@ eosio::chain::transaction_trace_ptr push_test_cfd_transaction(eosio::testing::te // add a normal action along with cfa dummy_action da = {DUMMY_ACTION_DEFAULT_A, DUMMY_ACTION_DEFAULT_B, DUMMY_ACTION_DEFAULT_C}; eosio::chain::action act1( - std::vector{{N(testapi), eosio::chain::config::active_name}}, da); + std::vector{{"testapi"_n, eosio::chain::config::active_name}}, da); trx.actions.push_back(act1); chain.set_transaction_headers(trx); // run normal passing case - auto sigs = trx.sign(chain.get_private_key(N(testapi), "active"), chain.control->get_chain_id()); + auto sigs = trx.sign(chain.get_private_key("testapi"_n, "active"), chain.control->get_chain_id()); return chain.push_transaction(trx); -} \ No newline at end of file +} diff --git a/unittests/test_cfd_transaction.hpp b/unittests/test_cfd_transaction.hpp index 6b9bfc8deb2..b9ebf6cbdc0 100644 --- a/unittests/test_cfd_transaction.hpp +++ b/unittests/test_cfd_transaction.hpp @@ -2,8 +2,14 @@ #include struct dummy_action { - static eosio::chain::name get_name() { return N(dummyaction); } - static eosio::chain::name get_account() { return N(testapi); } + static eosio::chain::name get_name() { + using namespace eosio::chain::literals; + return "dummyaction"_n; + } + static eosio::chain::name get_account() { + using namespace eosio::chain::literals; + return "testapi"_n; + } char a; // 1 uint64_t b; // 8 @@ -11,8 +17,14 @@ struct dummy_action { }; struct cf_action { - static eosio::chain::name get_name() { return N(cfaction); } - static eosio::chain::name get_account() { return N(testapi); } + static eosio::chain::name get_name() { + using namespace eosio::chain::literals; + return "cfaction"_n; + } + static eosio::chain::name get_account() { + using namespace eosio::chain::literals; + return "testapi"_n; + } uint32_t payload = 100; uint32_t cfd_idx = 0; // context free data index @@ -39,4 +51,4 @@ struct scoped_temp_path { ~scoped_temp_path() { boost::filesystem::remove_all(path); } -}; \ No newline at end of file +}; diff --git a/unittests/wasm_config_tests.cpp b/unittests/wasm_config_tests.cpp index 09124fdc4ce..7df9414bdd9 100644 --- a/unittests/wasm_config_tests.cpp +++ b/unittests/wasm_config_tests.cpp @@ -34,12 +34,12 @@ struct wasm_config_tester : TESTER { } void set_wasm_params(const wasm_config& params) { signed_transaction trx; - trx.actions.emplace_back(vector{{N(eosio),config::active_name}}, N(eosio), N(setwparams), + trx.actions.emplace_back(vector{{"eosio"_n,config::active_name}}, "eosio"_n, "setwparams"_n, bios_abi_ser.variant_to_binary("setwparams", fc::mutable_variant_object()("cfg", params), abi_serializer::create_yield_function( abi_serializer_max_time ))); - trx.actions[0].authorization = vector{{N(eosio),config::active_name}}; + trx.actions[0].authorization = vector{{"eosio"_n,config::active_name}}; set_transaction_headers(trx); - trx.sign(get_private_key(N(eosio), "active"), control->get_chain_id()); + trx.sign(get_private_key("eosio"_n, "active"), control->get_chain_id()); push_transaction(trx); } // Pushes an empty action @@ -83,7 +83,7 @@ struct old_wasm_tester : tester { BOOST_DATA_TEST_CASE_F(wasm_config_tester, max_mutable_global_bytes, data::make({ 4096, 8192 , 16384 }) * data::make({0, 1}), n_globals, oversize) { produce_block(); - create_accounts({N(globals)}); + create_accounts({"globals"_n}); produce_block(); auto params = genesis_state::default_initial_wasm_configuration; @@ -106,15 +106,15 @@ BOOST_DATA_TEST_CASE_F(wasm_config_tester, max_mutable_global_bytes, data::make( }(); if(oversize) { - BOOST_CHECK_THROW(set_code(N(globals), code.c_str()), wasm_exception); + BOOST_CHECK_THROW(set_code("globals"_n, code.c_str()), wasm_exception); produce_block(); } else { - set_code(N(globals), code.c_str()); - push_action(N(globals)); + set_code("globals"_n, code.c_str()); + push_action("globals"_n); produce_block(); --params.max_mutable_global_bytes; set_wasm_params(params); - push_action(N(globals)); + push_action("globals"_n); } } @@ -184,7 +184,7 @@ BOOST_DATA_TEST_CASE_F(wasm_config_tester, max_section_elements, data::make({one_func , one_type , one_import, one_global , one_elem , one_data})), n_elements, oversize, wast, one_element) { produce_blocks(2); - create_accounts({N(section)}); + create_accounts({"section"_n}); produce_block(); std::string buf; @@ -198,17 +198,17 @@ BOOST_DATA_TEST_CASE_F(wasm_config_tester, max_section_elements, set_wasm_params(params); if(oversize) { - BOOST_CHECK_THROW(set_code(N(section), code.c_str()), wasm_exception); + BOOST_CHECK_THROW(set_code("section"_n, code.c_str()), wasm_exception); } else { - set_code(N(section), code.c_str()); - push_action(N(section)); + set_code("section"_n, code.c_str()); + push_action("section"_n); --params.max_section_elements; set_wasm_params(params); produce_block(); - push_action(N(section)); + push_action("section"_n); produce_block(); - set_code(N(section), vector{}); // clear existing code - BOOST_CHECK_THROW(set_code(N(section), code.c_str()), wasm_exception); + set_code("section"_n, vector{}); // clear existing code + BOOST_CHECK_THROW(set_code("section"_n, code.c_str()), wasm_exception); } } @@ -218,7 +218,7 @@ BOOST_DATA_TEST_CASE_F(wasm_config_tester, max_section_elements_export, data::make({1024, 8192, 16384}) * data::make({0, 1}), n_elements, oversize) { produce_blocks(2); - create_accounts({N(section)}); + create_accounts({"section"_n}); produce_block(); std::string buf; @@ -234,17 +234,17 @@ BOOST_DATA_TEST_CASE_F(wasm_config_tester, max_section_elements_export, set_wasm_params(params); if(oversize) { - BOOST_CHECK_THROW(set_code(N(section), code.c_str()), wasm_exception); + BOOST_CHECK_THROW(set_code("section"_n, code.c_str()), wasm_exception); } else { - set_code(N(section), code.c_str()); - push_action(N(section)); + set_code("section"_n, code.c_str()); + push_action("section"_n); --params.max_section_elements; set_wasm_params(params); produce_block(); - push_action(N(section)); + push_action("section"_n); produce_block(); - set_code(N(section), vector{}); // clear existing code - BOOST_CHECK_THROW(set_code(N(section), code.c_str()), wasm_exception); + set_code("section"_n, vector{}); // clear existing code + BOOST_CHECK_THROW(set_code("section"_n, code.c_str()), wasm_exception); } } @@ -263,7 +263,7 @@ BOOST_DATA_TEST_CASE_F(wasm_config_tester, max_linear_memory_init, data::make({32768, 65536, 86513, 131072}) * data::make({0, 1}), n_init, oversize) { produce_blocks(2); - create_accounts({N(initdata)}); + create_accounts({"initdata"_n}); produce_block(); std::string code = fc::format_string(max_linear_memory_wast, fc::mutable_variant_object("OFFSET", n_init + oversize - 4)); @@ -273,17 +273,17 @@ BOOST_DATA_TEST_CASE_F(wasm_config_tester, max_linear_memory_init, set_wasm_params(params); if(oversize) { - BOOST_CHECK_THROW(set_code(N(initdata), code.c_str()), wasm_exception); + BOOST_CHECK_THROW(set_code("initdata"_n, code.c_str()), wasm_exception); } else { - set_code(N(initdata), code.c_str()); - push_action(N(initdata)); + set_code("initdata"_n, code.c_str()); + push_action("initdata"_n); --params.max_linear_memory_init; set_wasm_params(params); produce_block(); - push_action(N(initdata)); + push_action("initdata"_n); produce_block(); - set_code(N(initdata), vector{}); // clear existing code - BOOST_CHECK_THROW(set_code(N(initdata), code.c_str()), wasm_exception); + set_code("initdata"_n, vector{}); // clear existing code + BOOST_CHECK_THROW(set_code("initdata"_n, code.c_str()), wasm_exception); } } @@ -298,7 +298,7 @@ static const std::vector> func_local_params = { BOOST_DATA_TEST_CASE_F(wasm_config_tester, max_func_local_bytes, data::make({0, 8192, 16384}) * data::make(func_local_params), n_params, n_locals, n_stack, set_high, expect_success) { produce_blocks(2); - create_accounts({N(stackz)}); + create_accounts({"stackz"_n}); produce_block(); auto def_params = genesis_state::default_initial_wasm_configuration; @@ -314,38 +314,38 @@ BOOST_DATA_TEST_CASE_F(wasm_config_tester, max_func_local_bytes, data::make({0, auto pushit = [&]() { action act; - act.account = N(stackz); + act.account = "stackz"_n; act.name = name(); - act.authorization = vector{{N(stackz),config::active_name}}; + act.authorization = vector{{"stackz"_n,config::active_name}}; signed_transaction trx; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(stackz), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "stackz"_n, "active" ), control->get_chain_id()); push_transaction(trx); }; std::string code = make_locals_wasm(n_params, n_locals, n_stack); if(expect_success) { - set_code(N(stackz), code.c_str()); + set_code("stackz"_n, code.c_str()); produce_block(); pushit(); set_wasm_params(low_params); produce_block(); pushit(); // Only checked at set_code. - set_code(N(stackz), vector{}); // clear existing code - BOOST_CHECK_THROW(set_code(N(stackz), code.c_str()), wasm_exception); + set_code("stackz"_n, vector{}); // clear existing code + BOOST_CHECK_THROW(set_code("stackz"_n, code.c_str()), wasm_exception); produce_block(); } else { - BOOST_CHECK_THROW(set_code(N(stackz), code.c_str()), wasm_exception); + BOOST_CHECK_THROW(set_code("stackz"_n, code.c_str()), wasm_exception); produce_block(); } } BOOST_FIXTURE_TEST_CASE(max_func_local_bytes_mixed, wasm_config_tester) { produce_blocks(2); - create_accounts({N(stackz)}); + create_accounts({"stackz"_n}); produce_block(); std::string code; @@ -374,12 +374,12 @@ BOOST_FIXTURE_TEST_CASE(max_func_local_bytes_mixed, wasm_config_tester) { } auto params = genesis_state::default_initial_wasm_configuration; params.max_func_local_bytes = 4 + 16 + 16 + 64 + 64 + 256 + 256 + 1024; - set_code(N(stackz), code.c_str()); - set_code(N(stackz), std::vector{}); + set_code("stackz"_n, code.c_str()); + set_code("stackz"_n, std::vector{}); produce_block(); --params.max_func_local_bytes; set_wasm_params(params); - BOOST_CHECK_THROW(set_code(N(stackz), code.c_str()), wasm_exception); + BOOST_CHECK_THROW(set_code("stackz"_n, code.c_str()), wasm_exception); } static const std::vector> old_func_local_params = { @@ -389,38 +389,38 @@ static const std::vector> old_func_local_params = { BOOST_DATA_TEST_CASE_F(old_wasm_tester, max_func_local_bytes_old, data::make({0, 8192, 16384}) * data::make(old_func_local_params), n_stack, n_params, n_locals, expect_success) { produce_blocks(2); - create_accounts({N(stackz)}); + create_accounts({"stackz"_n}); produce_block(); auto pushit = [&]() { action act; - act.account = N(stackz); + act.account = "stackz"_n; act.name = name(); - act.authorization = vector{{N(stackz),config::active_name}}; + act.authorization = vector{{"stackz"_n,config::active_name}}; signed_transaction trx; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(stackz), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "stackz"_n, "active" ), control->get_chain_id()); push_transaction(trx); }; std::string code = make_locals_wasm(n_params, n_locals, n_stack); if(expect_success) { - set_code(N(stackz), code.c_str()); + set_code("stackz"_n, code.c_str()); produce_block(); pushit(); produce_block(); } else { - BOOST_CHECK_THROW(set_code(N(stackz), code.c_str()), wasm_exception); + BOOST_CHECK_THROW(set_code("stackz"_n, code.c_str()), wasm_exception); produce_block(); } } BOOST_FIXTURE_TEST_CASE(max_func_local_bytes_mixed_old, old_wasm_tester) { produce_blocks(2); - create_accounts({N(stackz)}); + create_accounts({"stackz"_n}); produce_block(); std::string code; @@ -445,23 +445,23 @@ BOOST_FIXTURE_TEST_CASE(max_func_local_bytes_mixed_old, old_wasm_tester) { ss << ")"; code = ss.str(); } - set_code(N(stackz), code.c_str()); + set_code("stackz"_n, code.c_str()); produce_block(); // add one more parameter code.replace(code.find("param i32"), 5, "param f32"); - BOOST_CHECK_THROW(set_code(N(stackz), code.c_str()), wasm_exception); + BOOST_CHECK_THROW(set_code("stackz"_n, code.c_str()), wasm_exception); } BOOST_DATA_TEST_CASE_F(wasm_config_tester, max_table_elements, data::make({512, 2048}) * data::make({0, 1}), max_table_elements, oversize) { produce_block(); - create_accounts( { N(table) } ); + create_accounts( { "table"_n } ); produce_block(); auto pushit = [&]{ signed_transaction trx; - trx.actions.push_back({{{N(table),config::active_name}}, N(table), name(), {}}); + trx.actions.push_back({{{"table"_n,config::active_name}}, "table"_n, name(), {}}); set_transaction_headers(trx); - trx.sign(get_private_key( N(table), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "table"_n, "active" ), control->get_chain_id()); push_transaction(trx); }; @@ -471,7 +471,7 @@ BOOST_DATA_TEST_CASE_F(wasm_config_tester, max_table_elements, data::make({512, std::string code = fc::format_string(variable_table, fc::mutable_variant_object()("TABLE_SIZE", max_table_elements + oversize)("TABLE_OFFSET", max_table_elements - 2)); if(!oversize) { - set_code(N(table), code.c_str()); + set_code("table"_n, code.c_str()); pushit(); produce_block(); @@ -479,7 +479,7 @@ BOOST_DATA_TEST_CASE_F(wasm_config_tester, max_table_elements, data::make({512, set_wasm_params(params); pushit(); } else { - BOOST_CHECK_THROW(set_code(N(table), code.c_str()), wasm_exception); + BOOST_CHECK_THROW(set_code("table"_n, code.c_str()), wasm_exception); } } @@ -487,7 +487,7 @@ BOOST_DATA_TEST_CASE_F(wasm_config_tester, max_nested_structures, data::make({512, 1024, 2048}) * data::make({0, 1}), n_nesting, oversize) { produce_block(); - create_accounts( { N(nested) } ); + create_accounts( { "nested"_n } ); produce_block(); std::string code = [&]{ @@ -508,17 +508,17 @@ BOOST_DATA_TEST_CASE_F(wasm_config_tester, max_nested_structures, set_wasm_params(params); if(oversize) { - BOOST_CHECK_THROW(set_code(N(nested), code.c_str()), wasm_exception); + BOOST_CHECK_THROW(set_code("nested"_n, code.c_str()), wasm_exception); } else { - set_code(N(nested), code.c_str()); - push_action(N(nested)); + set_code("nested"_n, code.c_str()); + push_action("nested"_n); --params.max_nested_structures; set_wasm_params(params); produce_block(); - push_action(N(nested)); + push_action("nested"_n); produce_block(); - set_code(N(nested), vector{}); // clear existing code - BOOST_CHECK_THROW(set_code(N(nested), code.c_str()), wasm_exception); + set_code("nested"_n, vector{}); // clear existing code + BOOST_CHECK_THROW(set_code("nested"_n, code.c_str()), wasm_exception); } } @@ -555,7 +555,7 @@ BOOST_DATA_TEST_CASE_F( wasm_config_tester, max_symbol_bytes_export, data::make( n_symbol, oversize, wast ) { produce_blocks(2); - create_accounts({N(bigname)}); + create_accounts({"bigname"_n}); std::string name(n_symbol + oversize, 'x'); std::string code = fc::format_string(wast, fc::mutable_variant_object("NAME", name)); @@ -565,17 +565,17 @@ BOOST_DATA_TEST_CASE_F( wasm_config_tester, max_symbol_bytes_export, data::make( set_wasm_params(params); if(oversize) { - BOOST_CHECK_THROW(set_code(N(bigname), code.c_str()), wasm_exception); + BOOST_CHECK_THROW(set_code("bigname"_n, code.c_str()), wasm_exception); } else { - set_code(N(bigname), code.c_str()); - push_action(N(bigname)); + set_code("bigname"_n, code.c_str()); + push_action("bigname"_n); --params.max_symbol_bytes; set_wasm_params(params); produce_block(); - push_action(N(bigname)); + push_action("bigname"_n); produce_block(); - set_code(N(bigname), vector{}); // clear existing code - BOOST_CHECK_THROW(set_code(N(bigname), code.c_str()), wasm_exception); + set_code("bigname"_n, vector{}); // clear existing code + BOOST_CHECK_THROW(set_code("bigname"_n, code.c_str()), wasm_exception); } } @@ -588,7 +588,7 @@ static const char max_symbol_import_wast[] = R"=====( BOOST_FIXTURE_TEST_CASE( max_symbol_bytes_import, wasm_config_tester ) { produce_blocks(2); - create_accounts({N(bigname)}); + create_accounts({"bigname"_n}); constexpr int n_symbol = 33; @@ -596,15 +596,15 @@ BOOST_FIXTURE_TEST_CASE( max_symbol_bytes_import, wasm_config_tester ) { params.max_symbol_bytes = n_symbol; set_wasm_params(params); - set_code(N(bigname), max_symbol_import_wast); - push_action(N(bigname)); + set_code("bigname"_n, max_symbol_import_wast); + push_action("bigname"_n); --params.max_symbol_bytes; set_wasm_params(params); produce_block(); - push_action(N(bigname)); + push_action("bigname"_n); produce_block(); - set_code(N(bigname), vector{}); // clear existing code - BOOST_CHECK_THROW(set_code(N(bigname), max_symbol_import_wast), wasm_exception); + set_code("bigname"_n, vector{}); // clear existing code + BOOST_CHECK_THROW(set_code("bigname"_n, max_symbol_import_wast), wasm_exception); } static const std::vector small_contract_wasm{ @@ -631,7 +631,7 @@ static const std::vector small_contract_wasm{ BOOST_FIXTURE_TEST_CASE( max_module_bytes, wasm_config_tester ) { produce_blocks(2); - create_accounts({N(bigmodule)}); + create_accounts({"bigmodule"_n}); const int n_module = small_contract_wasm.size(); @@ -639,20 +639,20 @@ BOOST_FIXTURE_TEST_CASE( max_module_bytes, wasm_config_tester ) { params.max_module_bytes = n_module; set_wasm_params(params); - set_code(N(bigmodule), small_contract_wasm); - push_action(N(bigmodule)); + set_code("bigmodule"_n, small_contract_wasm); + push_action("bigmodule"_n); --params.max_module_bytes; set_wasm_params(params); produce_block(); - push_action(N(bigmodule)); + push_action("bigmodule"_n); produce_block(); - set_code(N(bigmodule), vector{}); // clear existing code - BOOST_CHECK_THROW(set_code(N(bigmodule), small_contract_wasm), wasm_exception); + set_code("bigmodule"_n, vector{}); // clear existing code + BOOST_CHECK_THROW(set_code("bigmodule"_n, small_contract_wasm), wasm_exception); } BOOST_FIXTURE_TEST_CASE( max_code_bytes, wasm_config_tester ) { produce_blocks(2); - create_accounts({N(bigcode)}); + create_accounts({"bigcode"_n}); constexpr int n_code = 224; @@ -660,15 +660,15 @@ BOOST_FIXTURE_TEST_CASE( max_code_bytes, wasm_config_tester ) { params.max_code_bytes = n_code; set_wasm_params(params); - set_code(N(bigcode), small_contract_wasm); - push_action(N(bigcode)); + set_code("bigcode"_n, small_contract_wasm); + push_action("bigcode"_n); --params.max_code_bytes; set_wasm_params(params); produce_block(); - push_action(N(bigcode)); + push_action("bigcode"_n); produce_block(); - set_code(N(bigcode), vector{}); // clear existing code - BOOST_CHECK_THROW(set_code(N(bigcode), small_contract_wasm), wasm_exception); + set_code("bigcode"_n, vector{}); // clear existing code + BOOST_CHECK_THROW(set_code("bigcode"_n, small_contract_wasm), wasm_exception); } static const char access_biggest_memory_wast[] = R"=====( @@ -695,9 +695,9 @@ static const char intrinsic_biggest_memory_wast[] = R"=====( BOOST_FIXTURE_TEST_CASE( max_pages, wasm_config_tester ) try { produce_blocks(2); - create_accounts( { N(bigmem), N(accessmem), N(intrinsicmem) } ); - set_code(N(accessmem), access_biggest_memory_wast); - set_code(N(intrinsicmem), intrinsic_biggest_memory_wast); + create_accounts( { "bigmem"_n, "accessmem"_n, "intrinsicmem"_n } ); + set_code("accessmem"_n, access_biggest_memory_wast); + set_code("intrinsicmem"_n, intrinsic_biggest_memory_wast); produce_block(); auto params = genesis_state::default_initial_wasm_configuration; for(uint64_t max_pages : {600, 400}) { // above and below the default limit @@ -708,19 +708,19 @@ BOOST_FIXTURE_TEST_CASE( max_pages, wasm_config_tester ) try { string biggest_memory_wast_f = fc::format_string(biggest_memory_variable_wast, fc::mutable_variant_object( "MAX_WASM_PAGES", params.max_pages - 1)); - set_code(N(bigmem), biggest_memory_wast_f.c_str()); + set_code("bigmem"_n, biggest_memory_wast_f.c_str()); produce_blocks(1); auto pushit = [&](uint64_t extra_pages) { action act; - act.account = N(bigmem); + act.account = "bigmem"_n; act.name = name(extra_pages); - act.authorization = vector{{N(bigmem),config::active_name}}; + act.authorization = vector{{"bigmem"_n,config::active_name}}; signed_transaction trx; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(bigmem), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "bigmem"_n, "active" ), control->get_chain_id()); //but should not be able to grow beyond largest page push_transaction(trx); }; @@ -728,14 +728,14 @@ BOOST_FIXTURE_TEST_CASE( max_pages, wasm_config_tester ) try { // verify that page accessibility cannot leak across wasm executions auto checkaccess = [&](uint64_t pagenum) { action act; - act.account = N(accessmem); + act.account = "accessmem"_n; act.name = name(pagenum); - act.authorization = vector{{N(accessmem),config::active_name}}; + act.authorization = vector{{"accessmem"_n,config::active_name}}; signed_transaction trx; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(accessmem), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "accessmem"_n, "active" ), control->get_chain_id()); BOOST_CHECK_THROW(push_transaction(trx), eosio::chain::wasm_exception); }; @@ -743,14 +743,14 @@ BOOST_FIXTURE_TEST_CASE( max_pages, wasm_config_tester ) try { // verify checking of intrinsic arguments auto pushintrinsic = [&](uint64_t pages) { action act; - act.account = N(intrinsicmem); + act.account = "intrinsicmem"_n; act.name = name(pages); - act.authorization = vector{{N(intrinsicmem),config::active_name}}; + act.authorization = vector{{"intrinsicmem"_n,config::active_name}}; signed_transaction trx; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(intrinsicmem), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "intrinsicmem"_n, "active" ), control->get_chain_id()); BOOST_CHECK_THROW(push_transaction(trx), eosio::chain::wasm_exception); }; @@ -782,13 +782,13 @@ BOOST_FIXTURE_TEST_CASE( max_pages, wasm_config_tester ) try { set_wasm_params(params); string too_big_memory_wast_f = fc::format_string(too_big_memory_wast, fc::mutable_variant_object( "MAX_WASM_PAGES_PLUS_ONE", params.max_pages+1)); - BOOST_CHECK_THROW(set_code(N(bigmem), too_big_memory_wast_f.c_str()), eosio::chain::wasm_exception); + BOOST_CHECK_THROW(set_code("bigmem"_n, too_big_memory_wast_f.c_str()), eosio::chain::wasm_exception); // Check that the max memory defined by the contract is respected string memory_over_max_wast = fc::format_string(max_memory_wast, fc::mutable_variant_object() ("INIT_WASM_PAGES", params.max_pages - 3) ("MAX_WASM_PAGES", params.max_pages - 1)); - set_code(N(bigmem), memory_over_max_wast.c_str()); + set_code("bigmem"_n, memory_over_max_wast.c_str()); produce_block(); pushit(2); @@ -808,7 +808,7 @@ BOOST_FIXTURE_TEST_CASE( max_pages, wasm_config_tester ) try { BOOST_FIXTURE_TEST_CASE( call_depth, wasm_config_tester ) try { produce_block(); - create_accounts( {N(depth)} ); + create_accounts( {"depth"_n} ); produce_block(); uint32_t max_call_depth = 150; @@ -820,21 +820,21 @@ BOOST_FIXTURE_TEST_CASE( call_depth, wasm_config_tester ) try { produce_block(); signed_transaction trx; - trx.actions.emplace_back(vector{{N(depth),config::active_name}}, N(depth), N(), bytes{}); - trx.actions[0].authorization = vector{{N(depth),config::active_name}}; + trx.actions.emplace_back(vector{{"depth"_n,config::active_name}}, "depth"_n, ""_n, bytes{}); + trx.actions[0].authorization = vector{{"depth"_n,config::active_name}}; auto pushit = [&]() { produce_block(); trx.signatures.clear(); set_transaction_headers(trx); - trx.sign(get_private_key(N(depth), "active"), control->get_chain_id()); + trx.sign(get_private_key("depth"_n, "active"), control->get_chain_id()); push_transaction(trx); }; //strictly wasm recursion to maximum_call_depth & maximum_call_depth+1 string wasm_depth_okay = fc::format_string(depth_assert_wasm, fc::mutable_variant_object() ("MAX_DEPTH", max_call_depth)); - set_code(N(depth), wasm_depth_okay.c_str()); + set_code("depth"_n, wasm_depth_okay.c_str()); pushit(); // The depth should not be cached. @@ -847,29 +847,29 @@ BOOST_FIXTURE_TEST_CASE( call_depth, wasm_config_tester ) try { string wasm_depth_one_over = fc::format_string(depth_assert_wasm, fc::mutable_variant_object() ("MAX_DEPTH", max_call_depth+1)); - set_code(N(depth), wasm_depth_one_over.c_str()); + set_code("depth"_n, wasm_depth_one_over.c_str()); BOOST_CHECK_THROW(pushit(), wasm_execution_error); //wasm recursion but call an intrinsic as the last function instead string intrinsic_depth_okay = fc::format_string(depth_assert_intrinsic, fc::mutable_variant_object() ("MAX_DEPTH", max_call_depth)); - set_code(N(depth), intrinsic_depth_okay.c_str()); + set_code("depth"_n, intrinsic_depth_okay.c_str()); pushit(); string intrinsic_depth_one_over = fc::format_string(depth_assert_intrinsic, fc::mutable_variant_object() ("MAX_DEPTH", max_call_depth+1)); - set_code(N(depth), intrinsic_depth_one_over.c_str()); + set_code("depth"_n, intrinsic_depth_one_over.c_str()); BOOST_CHECK_THROW(pushit(), wasm_execution_error); //add a float operation in the mix to ensure any injected softfloat call doesn't count against limit string wasm_float_depth_okay = fc::format_string(depth_assert_wasm_float, fc::mutable_variant_object() ("MAX_DEPTH", max_call_depth)); - set_code(N(depth), wasm_float_depth_okay.c_str()); + set_code("depth"_n, wasm_float_depth_okay.c_str()); pushit(); string wasm_float_depth_one_over = fc::format_string(depth_assert_wasm_float, fc::mutable_variant_object() ("MAX_DEPTH", max_call_depth+1)); - set_code(N(depth), wasm_float_depth_one_over.c_str()); + set_code("depth"_n, wasm_float_depth_one_over.c_str()); BOOST_CHECK_THROW(pushit(), wasm_execution_error); } FC_LOG_AND_RETHROW() @@ -933,13 +933,13 @@ BOOST_FIXTURE_TEST_CASE(reset_chain_tests, wasm_config_tester) { { signed_transaction trx; auto make_setcode = [](const std::vector& code) { - return setcode{ N(eosio), 0, 0, bytes(code.begin(), code.end()) }; + return setcode{ "eosio"_n, 0, 0, bytes(code.begin(), code.end()) }; }; - trx.actions.push_back({ { { N(eosio), config::active_name} }, make_setcode(wast_to_wasm(min_set_parameters_wast)) }); - trx.actions.push_back({ { { N(eosio), config::active_name} }, N(eosio), N(), fc::raw::pack(genesis_state::default_initial_wasm_configuration) }); - trx.actions.push_back({ { { N(eosio), config::active_name} }, make_setcode(contracts::eosio_bios_wasm()) }); + trx.actions.push_back({ { { "eosio"_n, config::active_name} }, make_setcode(wast_to_wasm(min_set_parameters_wast)) }); + trx.actions.push_back({ { { "eosio"_n, config::active_name} }, "eosio"_n, ""_n, fc::raw::pack(genesis_state::default_initial_wasm_configuration) }); + trx.actions.push_back({ { { "eosio"_n, config::active_name} }, make_setcode(contracts::eosio_bios_wasm()) }); set_transaction_headers(trx); - trx.sign(get_private_key(N(eosio), "active"), control->get_chain_id()); + trx.sign(get_private_key("eosio"_n, "active"), control->get_chain_id()); push_transaction(trx); } produce_block(); diff --git a/unittests/wasm_tests.cpp b/unittests/wasm_tests.cpp index 39c4d441075..c04a63c06ef 100644 --- a/unittests/wasm_tests.cpp +++ b/unittests/wasm_tests.cpp @@ -47,11 +47,11 @@ struct assertdef { string message; static account_name get_account() { - return N(asserter); + return "asserter"_n; } static action_name get_name() { - return N(procassert); + return "procassert"_n; } }; @@ -59,11 +59,11 @@ FC_REFLECT(assertdef, (condition)(message)); struct provereset { static account_name get_account() { - return N(asserter); + return "asserter"_n; } static action_name get_name() { - return N(provereset); + return "provereset"_n; } }; @@ -82,29 +82,29 @@ struct old_wasm_tester : tester { BOOST_FIXTURE_TEST_CASE( basic_test, TESTER ) try { produce_blocks(2); - create_accounts( {N(asserter)} ); + create_accounts( {"asserter"_n} ); produce_block(); - set_code(N(asserter), contracts::asserter_wasm()); + set_code("asserter"_n, contracts::asserter_wasm()); produce_blocks(1); transaction_id_type no_assert_id; { signed_transaction trx; - trx.actions.emplace_back( vector{{N(asserter),config::active_name}}, + trx.actions.emplace_back( vector{{"asserter"_n,config::active_name}}, assertdef {1, "Should Not Assert!"} ); - trx.actions[0].authorization = {{N(asserter),config::active_name}}; + trx.actions[0].authorization = {{"asserter"_n,config::active_name}}; set_transaction_headers(trx); - trx.sign( get_private_key( N(asserter), "active" ), control->get_chain_id() ); + trx.sign( get_private_key( "asserter"_n, "active" ), control->get_chain_id() ); auto result = push_transaction( trx ); BOOST_CHECK_EQUAL(result->receipt->status, transaction_receipt::executed); BOOST_CHECK_EQUAL(result->action_traces.size(), 1u); - BOOST_CHECK_EQUAL(result->action_traces.at(0).receiver.to_string(), name(N(asserter)).to_string() ); - BOOST_CHECK_EQUAL(result->action_traces.at(0).act.account.to_string(), name(N(asserter)).to_string() ); - BOOST_CHECK_EQUAL(result->action_traces.at(0).act.name.to_string(), name(N(procassert)).to_string() ); + BOOST_CHECK_EQUAL(result->action_traces.at(0).receiver.to_string(), name("asserter"_n).to_string() ); + BOOST_CHECK_EQUAL(result->action_traces.at(0).act.account.to_string(), name("asserter"_n).to_string() ); + BOOST_CHECK_EQUAL(result->action_traces.at(0).act.name.to_string(), name("procassert"_n).to_string() ); BOOST_CHECK_EQUAL(result->action_traces.at(0).act.authorization.size(), 1u ); - BOOST_CHECK_EQUAL(result->action_traces.at(0).act.authorization.at(0).actor.to_string(), name(N(asserter)).to_string() ); + BOOST_CHECK_EQUAL(result->action_traces.at(0).act.authorization.at(0).actor.to_string(), name("asserter"_n).to_string() ); BOOST_CHECK_EQUAL(result->action_traces.at(0).act.authorization.at(0).permission.to_string(), name(config::active_name).to_string() ); no_assert_id = trx.id(); } @@ -118,11 +118,11 @@ BOOST_FIXTURE_TEST_CASE( basic_test, TESTER ) try { transaction_id_type yes_assert_id; { signed_transaction trx; - trx.actions.emplace_back( vector{{N(asserter),config::active_name}}, + trx.actions.emplace_back( vector{{"asserter"_n,config::active_name}}, assertdef {0, "Should Assert!"} ); set_transaction_headers(trx); - trx.sign( get_private_key( N(asserter), "active" ), control->get_chain_id() ); + trx.sign( get_private_key( "asserter"_n, "active" ), control->get_chain_id() ); yes_assert_id = trx.id(); BOOST_CHECK_THROW(push_transaction( trx ), eosio_assert_message_exception); @@ -141,21 +141,21 @@ BOOST_FIXTURE_TEST_CASE( basic_test, TESTER ) try { BOOST_FIXTURE_TEST_CASE( prove_mem_reset, TESTER ) try { produce_blocks(2); - create_accounts( {N(asserter)} ); + create_accounts( {"asserter"_n} ); produce_block(); - set_code(N(asserter), contracts::asserter_wasm()); + set_code("asserter"_n, contracts::asserter_wasm()); produce_blocks(1); // repeat the action multiple times, each time the action handler checks for the expected // default value then modifies the value which should not survive until the next invoction for (int i = 0; i < 5; i++) { signed_transaction trx; - trx.actions.emplace_back( vector{{N(asserter),config::active_name}}, + trx.actions.emplace_back( vector{{"asserter"_n,config::active_name}}, provereset {} ); set_transaction_headers(trx); - trx.sign( get_private_key( N(asserter), "active" ), control->get_chain_id() ); + trx.sign( get_private_key( "asserter"_n, "active" ), control->get_chain_id() ); push_transaction( trx ); produce_blocks(1); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); @@ -171,11 +171,11 @@ BOOST_FIXTURE_TEST_CASE( prove_mem_reset, TESTER ) try { BOOST_FIXTURE_TEST_CASE( abi_from_variant, TESTER ) try { produce_blocks(2); - create_accounts( {N(asserter)} ); + create_accounts( {"asserter"_n} ); produce_block(); - set_code(N(asserter), contracts::asserter_wasm()); - set_abi(N(asserter), contracts::asserter_abi().data()); + set_code("asserter"_n, contracts::asserter_wasm()); + set_abi("asserter"_n, contracts::asserter_abi().data()); produce_blocks(1); auto resolver = [&,this]( const account_name& name ) -> std::optional { @@ -209,7 +209,7 @@ BOOST_FIXTURE_TEST_CASE( abi_from_variant, TESTER ) try { signed_transaction trx; abi_serializer::from_variant(pretty_trx, trx, resolver, abi_serializer::create_yield_function( abi_serializer_max_time )); set_transaction_headers(trx); - trx.sign( get_private_key( N(asserter), "active" ), control->get_chain_id() ); + trx.sign( get_private_key( "asserter"_n, "active" ), control->get_chain_id() ); push_transaction( trx ); produce_blocks(1); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); @@ -222,20 +222,20 @@ BOOST_FIXTURE_TEST_CASE( abi_from_variant, TESTER ) try { BOOST_FIXTURE_TEST_CASE( f32_tests, TESTER ) try { produce_blocks(2); produce_block(); - create_accounts( {N(f32.tests)} ); + create_accounts( {"f32.tests"_n} ); { - set_code(N(f32.tests), f32_test_wast); + set_code("f32.tests"_n, f32_test_wast); produce_blocks(10); signed_transaction trx; action act; - act.account = N(f32.tests); - act.name = N(); - act.authorization = vector{{N(f32.tests),config::active_name}}; + act.account = "f32.tests"_n; + act.name = ""_n; + act.authorization = vector{{"f32.tests"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(f32.tests), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "f32.tests"_n, "active" ), control->get_chain_id()); push_transaction(trx); produce_blocks(1); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); @@ -244,21 +244,21 @@ BOOST_FIXTURE_TEST_CASE( f32_tests, TESTER ) try { } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( f32_test_bitwise, TESTER ) try { produce_blocks(2); - create_accounts( {N(f32.tests)} ); + create_accounts( {"f32.tests"_n} ); produce_block(); { - set_code(N(f32.tests), f32_bitwise_test_wast); + set_code("f32.tests"_n, f32_bitwise_test_wast); produce_blocks(10); signed_transaction trx; action act; - act.account = N(f32.tests); - act.name = N(); - act.authorization = vector{{N(f32.tests),config::active_name}}; + act.account = "f32.tests"_n; + act.name = ""_n; + act.authorization = vector{{"f32.tests"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(f32.tests), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "f32.tests"_n, "active" ), control->get_chain_id()); push_transaction(trx); produce_blocks(1); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); @@ -267,21 +267,21 @@ BOOST_FIXTURE_TEST_CASE( f32_test_bitwise, TESTER ) try { } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( f32_test_cmp, TESTER ) try { produce_blocks(2); - create_accounts( {N(f32.tests)} ); + create_accounts( {"f32.tests"_n} ); produce_block(); { - set_code(N(f32.tests), f32_cmp_test_wast); + set_code("f32.tests"_n, f32_cmp_test_wast); produce_blocks(10); signed_transaction trx; action act; - act.account = N(f32.tests); - act.name = N(); - act.authorization = vector{{N(f32.tests),config::active_name}}; + act.account = "f32.tests"_n; + act.name = ""_n; + act.authorization = vector{{"f32.tests"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(f32.tests), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "f32.tests"_n, "active" ), control->get_chain_id()); push_transaction(trx); produce_blocks(1); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); @@ -292,21 +292,21 @@ BOOST_FIXTURE_TEST_CASE( f32_test_cmp, TESTER ) try { // test softfloat 64 bit operations BOOST_FIXTURE_TEST_CASE( f64_tests, TESTER ) try { produce_blocks(2); - create_accounts( {N(f.tests)} ); + create_accounts( {"f.tests"_n} ); produce_block(); { - set_code(N(f.tests), f64_test_wast); + set_code("f.tests"_n, f64_test_wast); produce_blocks(10); signed_transaction trx; action act; - act.account = N(f.tests); - act.name = N(); - act.authorization = vector{{N(f.tests),config::active_name}}; + act.account = "f.tests"_n; + act.name = ""_n; + act.authorization = vector{{"f.tests"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(f.tests), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "f.tests"_n, "active" ), control->get_chain_id()); push_transaction(trx); produce_blocks(1); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); @@ -315,21 +315,21 @@ BOOST_FIXTURE_TEST_CASE( f64_tests, TESTER ) try { } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( f64_test_bitwise, TESTER ) try { produce_blocks(2); - create_accounts( {N(f.tests)} ); + create_accounts( {"f.tests"_n} ); produce_block(); { - set_code(N(f.tests), f64_bitwise_test_wast); + set_code("f.tests"_n, f64_bitwise_test_wast); produce_blocks(10); signed_transaction trx; action act; - act.account = N(f.tests); - act.name = N(); - act.authorization = vector{{N(f.tests),config::active_name}}; + act.account = "f.tests"_n; + act.name = ""_n; + act.authorization = vector{{"f.tests"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(f.tests), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "f.tests"_n, "active" ), control->get_chain_id()); push_transaction(trx); produce_blocks(1); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); @@ -338,21 +338,21 @@ BOOST_FIXTURE_TEST_CASE( f64_test_bitwise, TESTER ) try { } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( f64_test_cmp, TESTER ) try { produce_blocks(2); - create_accounts( {N(f.tests)} ); + create_accounts( {"f.tests"_n} ); produce_block(); { - set_code(N(f.tests), f64_cmp_test_wast); + set_code("f.tests"_n, f64_cmp_test_wast); produce_blocks(10); signed_transaction trx; action act; - act.account = N(f.tests); - act.name = N(); - act.authorization = vector{{N(f.tests),config::active_name}}; + act.account = "f.tests"_n; + act.name = ""_n; + act.authorization = vector{{"f.tests"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(f.tests), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "f.tests"_n, "active" ), control->get_chain_id()); push_transaction(trx); produce_blocks(1); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); @@ -364,21 +364,21 @@ BOOST_FIXTURE_TEST_CASE( f64_test_cmp, TESTER ) try { BOOST_FIXTURE_TEST_CASE( f32_f64_conversion_tests, tester ) try { produce_blocks(2); - create_accounts( {N(ftests)} ); + create_accounts( {"ftests"_n} ); produce_block(); { - set_code(N(ftests), f32_f64_conv_wast); + set_code("ftests"_n, f32_f64_conv_wast); produce_blocks(10); signed_transaction trx; action act; - act.account = N(ftests); - act.name = N(); - act.authorization = vector{{N(ftests),config::active_name}}; + act.account = "ftests"_n; + act.name = ""_n; + act.authorization = vector{{"ftests"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(ftests), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "ftests"_n, "active" ), control->get_chain_id()); push_transaction(trx); produce_blocks(1); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); @@ -391,23 +391,23 @@ BOOST_FIXTURE_TEST_CASE( f32_f64_overflow_tests, tester ) try { int count = 0; auto check = [&](const char *wast_template, const char *op, const char *param) -> bool { count+=16; - create_accounts( {name(N(ftests).to_uint64_t()+count)} ); + create_accounts( {name("ftests"_n.to_uint64_t()+count)} ); produce_blocks(1); std::vector wast; wast.resize(strlen(wast_template) + 128); sprintf(&(wast[0]), wast_template, op, param); - set_code(name(N(ftests).to_uint64_t()+count), &(wast[0])); + set_code(name("ftests"_n.to_uint64_t()+count), &(wast[0])); produce_blocks(10); signed_transaction trx; action act; - act.account = name(N(ftests).to_uint64_t()+count); - act.name = N(); - act.authorization = vector{{name(N(ftests).to_uint64_t()+count),config::active_name}}; + act.account = name("ftests"_n.to_uint64_t()+count); + act.name = ""_n; + act.authorization = vector{{name("ftests"_n.to_uint64_t()+count),config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( name(N(ftests).to_uint64_t()+count), "active" ), control->get_chain_id()); + trx.sign(get_private_key( name("ftests"_n.to_uint64_t()+count), "active" ), control->get_chain_id()); try { push_transaction(trx); @@ -490,22 +490,22 @@ BOOST_FIXTURE_TEST_CASE( f32_f64_overflow_tests, tester ) try { BOOST_FIXTURE_TEST_CASE(misaligned_tests, tester ) try { produce_blocks(2); - create_accounts( {N(aligncheck)} ); + create_accounts( {"aligncheck"_n} ); produce_block(); auto check_aligned = [&]( auto wast ) { - set_code(N(aligncheck), wast); + set_code("aligncheck"_n, wast); produce_blocks(10); signed_transaction trx; action act; - act.account = N(aligncheck); - act.name = N(); - act.authorization = vector{{N(aligncheck),config::active_name}}; + act.account = "aligncheck"_n; + act.name = ""_n; + act.authorization = vector{{"aligncheck"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(aligncheck), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "aligncheck"_n, "active" ), control->get_chain_id()); push_transaction(trx); produce_block(); @@ -523,21 +523,21 @@ BOOST_FIXTURE_TEST_CASE(misaligned_tests, tester ) try { */ BOOST_FIXTURE_TEST_CASE( check_entry_behavior, TESTER ) try { produce_blocks(2); - create_accounts( {N(entrycheck)} ); + create_accounts( {"entrycheck"_n} ); produce_block(); - set_code(N(entrycheck), entry_wast); + set_code("entrycheck"_n, entry_wast); produce_blocks(10); signed_transaction trx; action act; - act.account = N(entrycheck); - act.name = N(); - act.authorization = vector{{N(entrycheck),config::active_name}}; + act.account = "entrycheck"_n; + act.name = ""_n; + act.authorization = vector{{"entrycheck"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(entrycheck), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "entrycheck"_n, "active" ), control->get_chain_id()); push_transaction(trx); produce_blocks(1); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); @@ -547,21 +547,21 @@ BOOST_FIXTURE_TEST_CASE( check_entry_behavior, TESTER ) try { BOOST_FIXTURE_TEST_CASE( check_entry_behavior_2, TESTER ) try { produce_blocks(2); - create_accounts( {N(entrycheck)} ); + create_accounts( {"entrycheck"_n} ); produce_block(); - set_code(N(entrycheck), entry_wast_2); + set_code("entrycheck"_n, entry_wast_2); produce_blocks(10); signed_transaction trx; action act; - act.account = N(entrycheck); - act.name = N(); - act.authorization = vector{{N(entrycheck),config::active_name}}; + act.account = "entrycheck"_n; + act.name = ""_n; + act.authorization = vector{{"entrycheck"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(entrycheck), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "entrycheck"_n, "active" ), control->get_chain_id()); push_transaction(trx); produce_blocks(1); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); @@ -570,20 +570,20 @@ BOOST_FIXTURE_TEST_CASE( check_entry_behavior_2, TESTER ) try { } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( entry_import, TESTER ) try { - create_accounts( {N(enterimport)} ); + create_accounts( {"enterimport"_n} ); produce_block(); - set_code(N(enterimport), entry_import_wast); + set_code("enterimport"_n, entry_import_wast); signed_transaction trx; action act; - act.account = N(enterimport); - act.name = N(); - act.authorization = vector{{N(enterimport),config::active_name}}; + act.account = "enterimport"_n; + act.name = ""_n; + act.authorization = vector{{"enterimport"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(enterimport), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "enterimport"_n, "active" ), control->get_chain_id()); BOOST_CHECK_THROW(push_transaction(trx), abort_called); } FC_LOG_AND_RETHROW() @@ -593,22 +593,22 @@ BOOST_FIXTURE_TEST_CASE( entry_import, TESTER ) try { BOOST_FIXTURE_TEST_CASE( simple_no_memory_check, TESTER ) try { produce_blocks(2); - create_accounts( {N(nomem)} ); + create_accounts( {"nomem"_n} ); produce_block(); - set_code(N(nomem), simple_no_memory_wast); + set_code("nomem"_n, simple_no_memory_wast); produce_blocks(1); //the apply func of simple_no_memory_wast tries to call a native func with linear memory pointer signed_transaction trx; action act; - act.account = N(nomem); - act.name = N(); - act.authorization = vector{{N(nomem),config::active_name}}; + act.account = "nomem"_n; + act.name = ""_n; + act.authorization = vector{{"nomem"_n,config::active_name}}; trx.actions.push_back(act); trx.expiration = control->head_block_time(); set_transaction_headers(trx); - trx.sign(get_private_key( N(nomem), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "nomem"_n, "active" ), control->get_chain_id()); BOOST_CHECK_THROW(push_transaction( trx ), wasm_execution_error); } FC_LOG_AND_RETHROW() @@ -616,30 +616,30 @@ BOOST_FIXTURE_TEST_CASE( simple_no_memory_check, TESTER ) try { BOOST_FIXTURE_TEST_CASE( check_global_reset, TESTER ) try { produce_blocks(2); - create_accounts( {N(globalreset)} ); + create_accounts( {"globalreset"_n} ); produce_block(); - set_code(N(globalreset), mutable_global_wast); + set_code("globalreset"_n, mutable_global_wast); produce_blocks(1); signed_transaction trx; { action act; - act.account = N(globalreset); + act.account = "globalreset"_n; act.name = name(0ULL); - act.authorization = vector{{N(globalreset),config::active_name}}; + act.authorization = vector{{"globalreset"_n,config::active_name}}; trx.actions.push_back(act); } { action act; - act.account = N(globalreset); + act.account = "globalreset"_n; act.name = name(1ULL); - act.authorization = vector{{N(globalreset),config::active_name}}; + act.authorization = vector{{"globalreset"_n,config::active_name}}; trx.actions.push_back(act); } set_transaction_headers(trx); - trx.sign(get_private_key( N(globalreset), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "globalreset"_n, "active" ), control->get_chain_id()); push_transaction(trx); produce_blocks(1); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); @@ -655,24 +655,24 @@ BOOST_DATA_TEST_CASE_F( old_wasm_tester, big_memory, bdata::make({false, true}), produce_blocks(2); - create_accounts( {N(bigmem)} ); + create_accounts( {"bigmem"_n} ); produce_block(); string biggest_memory_wast_f = fc::format_string(biggest_memory_wast, fc::mutable_variant_object( "MAX_WASM_PAGES", eosio::chain::wasm_constraints::maximum_linear_memory/(64*1024))); - set_code(N(bigmem), biggest_memory_wast_f.c_str()); + set_code("bigmem"_n, biggest_memory_wast_f.c_str()); produce_blocks(1); signed_transaction trx; action act; - act.account = N(bigmem); - act.name = N(); - act.authorization = vector{{N(bigmem),config::active_name}}; + act.account = "bigmem"_n; + act.name = ""_n; + act.authorization = vector{{"bigmem"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(bigmem), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "bigmem"_n, "active" ), control->get_chain_id()); //but should not be able to grow beyond largest page push_transaction(trx); @@ -680,7 +680,7 @@ BOOST_DATA_TEST_CASE_F( old_wasm_tester, big_memory, bdata::make({false, true}), string too_big_memory_wast_f = fc::format_string(too_big_memory_wast, fc::mutable_variant_object( "MAX_WASM_PAGES_PLUS_ONE", eosio::chain::wasm_constraints::maximum_linear_memory/(64*1024)+1)); - BOOST_CHECK_THROW(set_code(N(bigmem), too_big_memory_wast_f.c_str()), eosio::chain::wasm_exception); + BOOST_CHECK_THROW(set_code("bigmem"_n, too_big_memory_wast_f.c_str()), eosio::chain::wasm_exception); } FC_LOG_AND_RETHROW() @@ -689,63 +689,63 @@ BOOST_DATA_TEST_CASE_F( old_wasm_tester, table_init_tests, bdata::make({false, t preactivate_builtin_protocol_features({builtin_protocol_feature_t::configurable_wasm_limits}); produce_blocks(2); - create_accounts( {N(tableinit)} ); + create_accounts( {"tableinit"_n} ); produce_block(); - set_code(N(tableinit), valid_sparse_table); + set_code("tableinit"_n, valid_sparse_table); produce_blocks(1); - BOOST_CHECK_THROW(set_code(N(tableinit), too_big_table), eosio::chain::wasm_exception); + BOOST_CHECK_THROW(set_code("tableinit"_n, too_big_table), eosio::chain::wasm_exception); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( table_init_oob, TESTER ) try { - create_accounts( {N(tableinitoob)} ); + create_accounts( {"tableinitoob"_n} ); produce_block(); signed_transaction trx; - trx.actions.emplace_back(vector{{N(tableinitoob),config::active_name}}, N(tableinitoob), N(), bytes{}); - trx.actions[0].authorization = vector{{N(tableinitoob),config::active_name}}; + trx.actions.emplace_back(vector{{"tableinitoob"_n,config::active_name}}, "tableinitoob"_n, ""_n, bytes{}); + trx.actions[0].authorization = vector{{"tableinitoob"_n,config::active_name}}; auto pushit_and_expect_fail = [&]() { produce_block(); trx.signatures.clear(); set_transaction_headers(trx); - trx.sign(get_private_key(N(tableinitoob), "active"), control->get_chain_id()); - + trx.sign(get_private_key("tableinitoob"_n, "active"), control->get_chain_id()); + //the unspecified_exception_code comes from WAVM, which manages to throw a WAVM specific exception // up to where exec_one captures it and doesn't understand it BOOST_CHECK_THROW(push_transaction(trx), eosio::chain::wasm_exception); }; - set_code(N(tableinitoob), table_init_oob_wast); + set_code("tableinitoob"_n, table_init_oob_wast); produce_block(); pushit_and_expect_fail(); //make sure doing it again didn't lodge something funky in to a cache pushit_and_expect_fail(); - set_code(N(tableinitoob), table_init_oob_smaller_wast); + set_code("tableinitoob"_n, table_init_oob_smaller_wast); produce_block(); pushit_and_expect_fail(); pushit_and_expect_fail(); //an elem w/o a table is a setcode fail though - BOOST_CHECK_THROW(set_code(N(tableinitoob), table_init_oob_no_table_wast), eosio::chain::wasm_exception); + BOOST_CHECK_THROW(set_code("tableinitoob"_n, table_init_oob_no_table_wast), eosio::chain::wasm_exception); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( memory_init_border, TESTER ) try { produce_blocks(2); - create_accounts( {N(memoryborder)} ); + create_accounts( {"memoryborder"_n} ); produce_block(); - set_code(N(memoryborder), memory_init_borderline); + set_code("memoryborder"_n, memory_init_borderline); produce_blocks(1); - BOOST_CHECK_THROW(set_code(N(memoryborder), memory_init_toolong), eosio::chain::wasm_exception); - BOOST_CHECK_THROW(set_code(N(memoryborder), memory_init_negative), eosio::chain::wasm_exception); + BOOST_CHECK_THROW(set_code("memoryborder"_n, memory_init_toolong), eosio::chain::wasm_exception); + BOOST_CHECK_THROW(set_code("memoryborder"_n, memory_init_negative), eosio::chain::wasm_exception); } FC_LOG_AND_RETHROW() @@ -753,12 +753,12 @@ BOOST_FIXTURE_TEST_CASE( imports, TESTER ) try { try { produce_blocks(2); - create_accounts( {N(imports)} ); + create_accounts( {"imports"_n} ); produce_block(); //this will fail to link but that's okay; mainly looking to make sure that the constraint // system doesn't choke when memories and tables exist only as imports - BOOST_CHECK_THROW(set_code(N(imports), memory_table_import), fc::exception); + BOOST_CHECK_THROW(set_code("imports"_n, memory_table_import), fc::exception); } catch ( const fc::exception& e ) { edump((e.to_detail_string())); @@ -770,7 +770,7 @@ BOOST_FIXTURE_TEST_CASE( imports, TESTER ) try { BOOST_FIXTURE_TEST_CASE( nested_limit_test, TESTER ) try { produce_blocks(2); - create_accounts( {N(nested)} ); + create_accounts( {"nested"_n} ); produce_block(); // nested loops @@ -782,7 +782,7 @@ BOOST_FIXTURE_TEST_CASE( nested_limit_test, TESTER ) try { for(unsigned int i = 0; i < 1023; ++i) ss << ")"; ss << "))"; - set_code(N(nested), ss.str().c_str()); + set_code("nested"_n, ss.str().c_str()); } { std::stringstream ss; @@ -792,7 +792,7 @@ BOOST_FIXTURE_TEST_CASE( nested_limit_test, TESTER ) try { for(unsigned int i = 0; i < 1024; ++i) ss << ")"; ss << "))"; - BOOST_CHECK_THROW(set_code(N(nested), ss.str().c_str()), eosio::chain::wasm_exception); + BOOST_CHECK_THROW(set_code("nested"_n, ss.str().c_str()), eosio::chain::wasm_exception); } // nested blocks @@ -804,7 +804,7 @@ BOOST_FIXTURE_TEST_CASE( nested_limit_test, TESTER ) try { for(unsigned int i = 0; i < 1023; ++i) ss << ")"; ss << "))"; - set_code(N(nested), ss.str().c_str()); + set_code("nested"_n, ss.str().c_str()); } { std::stringstream ss; @@ -814,7 +814,7 @@ BOOST_FIXTURE_TEST_CASE( nested_limit_test, TESTER ) try { for(unsigned int i = 0; i < 1024; ++i) ss << ")"; ss << "))"; - BOOST_CHECK_THROW(set_code(N(nested), ss.str().c_str()), eosio::chain::wasm_exception); + BOOST_CHECK_THROW(set_code("nested"_n, ss.str().c_str()), eosio::chain::wasm_exception); } // nested ifs { @@ -825,7 +825,7 @@ BOOST_FIXTURE_TEST_CASE( nested_limit_test, TESTER ) try { for(unsigned int i = 0; i < 1023; ++i) ss << "))"; ss << "))"; - set_code(N(nested), ss.str().c_str()); + set_code("nested"_n, ss.str().c_str()); } { std::stringstream ss; @@ -835,7 +835,7 @@ BOOST_FIXTURE_TEST_CASE( nested_limit_test, TESTER ) try { for(unsigned int i = 0; i < 1024; ++i) ss << "))"; ss << "))"; - BOOST_CHECK_THROW(set_code(N(nested), ss.str().c_str()), eosio::chain::wasm_exception); + BOOST_CHECK_THROW(set_code("nested"_n, ss.str().c_str()), eosio::chain::wasm_exception); } // mixed nested { @@ -852,7 +852,7 @@ BOOST_FIXTURE_TEST_CASE( nested_limit_test, TESTER ) try { for(unsigned int i = 0; i < 223; ++i) ss << "))"; ss << "))"; - set_code(N(nested), ss.str().c_str()); + set_code("nested"_n, ss.str().c_str()); } { std::stringstream ss; @@ -868,7 +868,7 @@ BOOST_FIXTURE_TEST_CASE( nested_limit_test, TESTER ) try { for(unsigned int i = 0; i < 224; ++i) ss << "))"; ss << "))"; - BOOST_CHECK_THROW(set_code(N(nested), ss.str().c_str()), eosio::chain::wasm_exception); + BOOST_CHECK_THROW(set_code("nested"_n, ss.str().c_str()), eosio::chain::wasm_exception); } } FC_LOG_AND_RETHROW() @@ -880,7 +880,7 @@ BOOST_DATA_TEST_CASE_F( old_wasm_tester, lotso_globals, bdata::make({false, true produce_blocks(2); - create_accounts( {N(globals)} ); + create_accounts( {"globals"_n} ); produce_block(); std::stringstream ss; @@ -892,15 +892,15 @@ BOOST_DATA_TEST_CASE_F( old_wasm_tester, lotso_globals, bdata::make({false, true for(unsigned int i = 0; i < 10; ++i) ss << "(global $g" << i+200 << " i32 (i32.const 0))"; - set_code(N(globals), + set_code("globals"_n, string(ss.str() + ")") .c_str()); //1024 should pass - set_code(N(globals), + set_code("globals"_n, string(ss.str() + "(global $z (mut i32) (i32.const -12)))") .c_str()); //1028 should fail - BOOST_CHECK_THROW(set_code(N(globals), + BOOST_CHECK_THROW(set_code("globals"_n, string(ss.str() + "(global $z (mut i64) (i64.const -12)))") .c_str()), eosio::chain::wasm_exception); } FC_LOG_AND_RETHROW() @@ -908,7 +908,7 @@ BOOST_DATA_TEST_CASE_F( old_wasm_tester, lotso_globals, bdata::make({false, true BOOST_FIXTURE_TEST_CASE( offset_check_old, old_wasm_tester ) try { produce_blocks(2); - create_accounts( {N(offsets)} ); + create_accounts( {"offsets"_n} ); produce_block(); vector loadops = { @@ -934,7 +934,7 @@ BOOST_FIXTURE_TEST_CASE( offset_check_old, old_wasm_tester ) try { ss << "(drop (" << s << " offset=" << eosio::chain::wasm_constraints::maximum_linear_memory-2 << " (i32.const 0)))"; ss << ") (export \"apply\" (func $apply)) )"; - set_code(N(offsets), ss.str().c_str()); + set_code("offsets"_n, ss.str().c_str()); produce_block(); } for(const vector& o : storeops) { @@ -943,7 +943,7 @@ BOOST_FIXTURE_TEST_CASE( offset_check_old, old_wasm_tester ) try { ss << "(" << o[0] << " offset=" << eosio::chain::wasm_constraints::maximum_linear_memory-2 << " (i32.const 0) (" << o[1] << ".const 0))"; ss << ") (export \"apply\" (func $apply)) )"; - set_code(N(offsets), ss.str().c_str()); + set_code("offsets"_n, ss.str().c_str()); produce_block(); } @@ -953,7 +953,7 @@ BOOST_FIXTURE_TEST_CASE( offset_check_old, old_wasm_tester ) try { ss << "(drop (" << s << " offset=" << eosio::chain::wasm_constraints::maximum_linear_memory+4 << " (i32.const 0)))"; ss << ") (export \"apply\" (func $apply)) )"; - BOOST_CHECK_THROW(set_code(N(offsets), ss.str().c_str()), eosio::chain::wasm_exception); + BOOST_CHECK_THROW(set_code("offsets"_n, ss.str().c_str()), eosio::chain::wasm_exception); produce_block(); } for(const vector& o : storeops) { @@ -962,7 +962,7 @@ BOOST_FIXTURE_TEST_CASE( offset_check_old, old_wasm_tester ) try { ss << "(" << o[0] << " offset=" << eosio::chain::wasm_constraints::maximum_linear_memory+4 << " (i32.const 0) (" << o[1] << ".const 0))"; ss << ") (export \"apply\" (func $apply)) )"; - BOOST_CHECK_THROW(set_code(N(offsets), ss.str().c_str()), eosio::chain::wasm_exception); + BOOST_CHECK_THROW(set_code("offsets"_n, ss.str().c_str()), eosio::chain::wasm_exception); produce_block(); } @@ -971,7 +971,7 @@ BOOST_FIXTURE_TEST_CASE( offset_check_old, old_wasm_tester ) try { BOOST_FIXTURE_TEST_CASE( offset_check, TESTER ) try { produce_blocks(2); - create_accounts( {N(offsets)} ); + create_accounts( {"offsets"_n} ); produce_block(); vector loadops = { @@ -997,7 +997,7 @@ BOOST_FIXTURE_TEST_CASE( offset_check, TESTER ) try { ss << "(drop (" << s << " offset=" << 0xFFFFFFFFu << " (i32.const 0)))"; ss << ") (export \"apply\" (func $apply)) )"; - set_code(N(offsets), ss.str().c_str()); + set_code("offsets"_n, ss.str().c_str()); produce_block(); } for(const vector& o : storeops) { @@ -1006,7 +1006,7 @@ BOOST_FIXTURE_TEST_CASE( offset_check, TESTER ) try { ss << "(" << o[0] << " offset=" << 0xFFFFFFFFu << " (i32.const 0) (" << o[1] << ".const 0))"; ss << ") (export \"apply\" (func $apply)) )"; - set_code(N(offsets), ss.str().c_str()); + set_code("offsets"_n, ss.str().c_str()); produce_block(); } @@ -1015,13 +1015,13 @@ BOOST_FIXTURE_TEST_CASE( offset_check, TESTER ) try { BOOST_FIXTURE_TEST_CASE(noop, TESTER) try { produce_blocks(2); - create_accounts( {N(noop), N(alice)} ); + create_accounts( {"noop"_n, "alice"_n} ); produce_block(); - set_code(N(noop), contracts::noop_wasm()); + set_code("noop"_n, contracts::noop_wasm()); - set_abi(N(noop), contracts::noop_abi().data()); - const auto& accnt = control->db().get(N(noop)); + set_abi("noop"_n, contracts::noop_abi().data()); + const auto& accnt = control->db().get("noop"_n); abi_def abi; BOOST_REQUIRE_EQUAL(abi_serializer::to_abi(accnt.abi, abi), true); abi_serializer abi_ser(abi, abi_serializer::create_yield_function( abi_serializer_max_time )); @@ -1030,9 +1030,9 @@ BOOST_FIXTURE_TEST_CASE(noop, TESTER) try { produce_blocks(5); signed_transaction trx; action act; - act.account = N(noop); - act.name = N(anyaction); - act.authorization = vector{{N(noop), config::active_name}}; + act.account = "noop"_n; + act.name = "anyaction"_n; + act.authorization = vector{{"noop"_n, config::active_name}}; act.data = abi_ser.variant_to_binary("anyaction", mutable_variant_object() ("from", "noop") @@ -1044,7 +1044,7 @@ BOOST_FIXTURE_TEST_CASE(noop, TESTER) try { trx.actions.emplace_back(std::move(act)); set_transaction_headers(trx); - trx.sign(get_private_key(N(noop), "active"), control->get_chain_id()); + trx.sign(get_private_key("noop"_n, "active"), control->get_chain_id()); push_transaction(trx); produce_block(); @@ -1055,9 +1055,9 @@ BOOST_FIXTURE_TEST_CASE(noop, TESTER) try { produce_blocks(5); signed_transaction trx; action act; - act.account = N(noop); - act.name = N(anyaction); - act.authorization = vector{{N(alice), config::active_name}}; + act.account = "noop"_n; + act.name = "anyaction"_n; + act.authorization = vector{{"alice"_n, config::active_name}}; act.data = abi_ser.variant_to_binary("anyaction", mutable_variant_object() ("from", "alice") @@ -1069,7 +1069,7 @@ BOOST_FIXTURE_TEST_CASE(noop, TESTER) try { trx.actions.emplace_back(std::move(act)); set_transaction_headers(trx); - trx.sign(get_private_key(N(alice), "active"), control->get_chain_id()); + trx.sign(get_private_key("alice"_n, "active"), control->get_chain_id()); push_transaction(trx); produce_block(); @@ -1090,7 +1090,7 @@ BOOST_FIXTURE_TEST_CASE(eosio_abi, TESTER) try { abi_serializer abi_ser(abi, abi_serializer::create_yield_function( abi_serializer_max_time )); signed_transaction trx; - name a = N(alice); + name a = "alice"_n; authority owner_auth = authority( get_public_key( a, "owner" ) ); trx.actions.emplace_back( vector{{config::system_account_name,config::active_name}}, newaccount{ @@ -1115,7 +1115,7 @@ BOOST_FIXTURE_TEST_CASE(eosio_abi, TESTER) try { BOOST_FIXTURE_TEST_CASE( check_big_deserialization, old_wasm_tester ) try { produce_blocks(2); - create_accounts( {N(cbd)} ); + create_accounts( {"cbd"_n} ); produce_block(); std::stringstream ss; @@ -1126,7 +1126,7 @@ BOOST_FIXTURE_TEST_CASE( check_big_deserialization, old_wasm_tester ) try { ss << " (func " << "$AA_" << i << ")"; ss << ")"; - set_code(N(cbd), ss.str().c_str()); + set_code("cbd"_n, ss.str().c_str()); produce_blocks(1); produce_blocks(1); @@ -1139,7 +1139,7 @@ BOOST_FIXTURE_TEST_CASE( check_big_deserialization, old_wasm_tester ) try { ss << " (func " << "$AA_" << i << ")"; ss << ")"; - BOOST_CHECK_THROW(set_code(N(cbd), ss.str().c_str()), wasm_serialization_error); + BOOST_CHECK_THROW(set_code("cbd"_n, ss.str().c_str()), wasm_serialization_error); produce_blocks(1); ss.str(""); @@ -1151,7 +1151,7 @@ BOOST_FIXTURE_TEST_CASE( check_big_deserialization, old_wasm_tester ) try { ss << " (drop (i32.const 3))"; ss << "))"; - BOOST_CHECK_THROW(set_code(N(cbd), ss.str().c_str()), fc::assert_exception); // this is caught first by MAX_SIZE_OF_ARRAYS check + BOOST_CHECK_THROW(set_code("cbd"_n, ss.str().c_str()), fc::assert_exception); // this is caught first by MAX_SIZE_OF_ARRAYS check produce_blocks(1); ss.str(""); @@ -1167,7 +1167,7 @@ BOOST_FIXTURE_TEST_CASE( check_big_deserialization, old_wasm_tester ) try { ss << " (drop (i32.const 3))"; ss << "))"; - set_code(N(cbd), ss.str().c_str()); + set_code("cbd"_n, ss.str().c_str()); produce_blocks(1); ss.str(""); @@ -1183,7 +1183,7 @@ BOOST_FIXTURE_TEST_CASE( check_big_deserialization, old_wasm_tester ) try { ss << " (drop (i32.const 3))"; ss << "))"; - BOOST_CHECK_THROW(set_code(N(cbd), ss.str().c_str()), wasm_serialization_error); + BOOST_CHECK_THROW(set_code("cbd"_n, ss.str().c_str()), wasm_serialization_error); produce_blocks(1); } FC_LOG_AND_RETHROW() @@ -1191,20 +1191,20 @@ BOOST_FIXTURE_TEST_CASE( check_big_deserialization, old_wasm_tester ) try { BOOST_FIXTURE_TEST_CASE( check_table_maximum, TESTER ) try { produce_blocks(2); - create_accounts( {N(tbl)} ); + create_accounts( {"tbl"_n} ); produce_block(); - set_code(N(tbl), table_checker_wast); + set_code("tbl"_n, table_checker_wast); produce_blocks(1); { signed_transaction trx; action act; act.name = name(555ULL<<32 | 0ULL); //top 32 is what we assert against, bottom 32 is indirect call index - act.account = N(tbl); - act.authorization = vector{{N(tbl),config::active_name}}; + act.account = "tbl"_n; + act.authorization = vector{{"tbl"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(tbl), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "tbl"_n, "active" ), control->get_chain_id()); push_transaction(trx); } @@ -1214,11 +1214,11 @@ BOOST_FIXTURE_TEST_CASE( check_table_maximum, TESTER ) try { signed_transaction trx; action act; act.name = name(555ULL<<32 | 1022ULL); //top 32 is what we assert against, bottom 32 is indirect call index - act.account = N(tbl); - act.authorization = vector{{N(tbl),config::active_name}}; + act.account = "tbl"_n; + act.authorization = vector{{"tbl"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(tbl), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "tbl"_n, "active" ), control->get_chain_id()); push_transaction(trx); } @@ -1228,11 +1228,11 @@ BOOST_FIXTURE_TEST_CASE( check_table_maximum, TESTER ) try { signed_transaction trx; action act; act.name = name(7777ULL<<32 | 1023ULL); //top 32 is what we assert against, bottom 32 is indirect call index - act.account = N(tbl); - act.authorization = vector{{N(tbl),config::active_name}}; + act.account = "tbl"_n; + act.authorization = vector{{"tbl"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(tbl), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "tbl"_n, "active" ), control->get_chain_id()); push_transaction(trx); } @@ -1242,11 +1242,11 @@ BOOST_FIXTURE_TEST_CASE( check_table_maximum, TESTER ) try { signed_transaction trx; action act; act.name = name(7778ULL<<32 | 1023ULL); //top 32 is what we assert against, bottom 32 is indirect call index - act.account = N(tbl); - act.authorization = vector{{N(tbl),config::active_name}}; + act.account = "tbl"_n; + act.authorization = vector{{"tbl"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(tbl), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "tbl"_n, "active" ), control->get_chain_id()); //should fail, a check to make sure assert() in wasm is being evaluated correctly BOOST_CHECK_THROW(push_transaction(trx), eosio_assert_message_exception); @@ -1258,11 +1258,11 @@ BOOST_FIXTURE_TEST_CASE( check_table_maximum, TESTER ) try { signed_transaction trx; action act; act.name = name(133ULL<<32 | 5ULL); //top 32 is what we assert against, bottom 32 is indirect call index - act.account = N(tbl); - act.authorization = vector{{N(tbl),config::active_name}}; + act.account = "tbl"_n; + act.authorization = vector{{"tbl"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(tbl), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "tbl"_n, "active" ), control->get_chain_id()); //should fail, this element index (5) does not exist BOOST_CHECK_THROW(push_transaction(trx), eosio::chain::wasm_execution_error); @@ -1274,11 +1274,11 @@ BOOST_FIXTURE_TEST_CASE( check_table_maximum, TESTER ) try { signed_transaction trx; action act; act.name = name(eosio::chain::wasm_constraints::maximum_table_elements+54334); - act.account = N(tbl); - act.authorization = vector{{N(tbl),config::active_name}}; + act.account = "tbl"_n; + act.authorization = vector{{"tbl"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(tbl), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "tbl"_n, "active" ), control->get_chain_id()); //should fail, this element index is out of range BOOST_CHECK_THROW(push_transaction(trx), eosio::chain::wasm_execution_error); @@ -1287,18 +1287,18 @@ BOOST_FIXTURE_TEST_CASE( check_table_maximum, TESTER ) try { produce_blocks(1); //run a few tests with new, proper syntax, call_indirect - set_code(N(tbl), table_checker_proper_syntax_wast); + set_code("tbl"_n, table_checker_proper_syntax_wast); produce_blocks(1); { signed_transaction trx; action act; act.name = name(555ULL<<32 | 1022ULL); //top 32 is what we assert against, bottom 32 is indirect call index - act.account = N(tbl); - act.authorization = vector{{N(tbl),config::active_name}}; + act.account = "tbl"_n; + act.authorization = vector{{"tbl"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(tbl), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "tbl"_n, "active" ), control->get_chain_id()); push_transaction(trx); } @@ -1307,25 +1307,25 @@ BOOST_FIXTURE_TEST_CASE( check_table_maximum, TESTER ) try { signed_transaction trx; action act; act.name = name(7777ULL<<32 | 1023ULL); //top 32 is what we assert against, bottom 32 is indirect call index - act.account = N(tbl); - act.authorization = vector{{N(tbl),config::active_name}}; + act.account = "tbl"_n; + act.authorization = vector{{"tbl"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(tbl), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "tbl"_n, "active" ), control->get_chain_id()); push_transaction(trx); } - set_code(N(tbl), table_checker_small_wast); + set_code("tbl"_n, table_checker_small_wast); produce_blocks(1); { signed_transaction trx; action act; act.name = name(888ULL); - act.account = N(tbl); - act.authorization = vector{{N(tbl),config::active_name}}; + act.account = "tbl"_n; + act.authorization = vector{{"tbl"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(tbl), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "tbl"_n, "active" ), control->get_chain_id()); //an element that is out of range and has no mmap access permission either (should be a trapped segv) BOOST_CHECK_EXCEPTION(push_transaction(trx), eosio::chain::wasm_execution_error, [](const eosio::chain::wasm_execution_error &e) {return true;}); @@ -1335,53 +1335,53 @@ BOOST_FIXTURE_TEST_CASE( check_table_maximum, TESTER ) try { BOOST_FIXTURE_TEST_CASE( protected_globals, TESTER ) try { produce_blocks(2); - create_accounts( {N(gob)} ); + create_accounts( {"gob"_n} ); produce_block(); - BOOST_CHECK_THROW(set_code(N(gob), global_protection_none_get_wast), fc::exception); + BOOST_CHECK_THROW(set_code("gob"_n, global_protection_none_get_wast), fc::exception); produce_blocks(1); - BOOST_CHECK_THROW(set_code(N(gob), global_protection_some_get_wast), fc::exception); + BOOST_CHECK_THROW(set_code("gob"_n, global_protection_some_get_wast), fc::exception); produce_blocks(1); - BOOST_CHECK_THROW(set_code(N(gob), global_protection_none_set_wast), fc::exception); + BOOST_CHECK_THROW(set_code("gob"_n, global_protection_none_set_wast), fc::exception); produce_blocks(1); - BOOST_CHECK_THROW(set_code(N(gob), global_protection_some_set_wast), fc::exception); + BOOST_CHECK_THROW(set_code("gob"_n, global_protection_some_set_wast), fc::exception); produce_blocks(1); //sanity to make sure I got general binary construction okay - set_code(N(gob), global_protection_okay_get_wasm); + set_code("gob"_n, global_protection_okay_get_wasm); produce_blocks(1); - BOOST_CHECK_THROW(set_code(N(gob), global_protection_none_get_wasm), fc::exception); + BOOST_CHECK_THROW(set_code("gob"_n, global_protection_none_get_wasm), fc::exception); produce_blocks(1); - BOOST_CHECK_THROW(set_code(N(gob), global_protection_some_get_wasm), fc::exception); + BOOST_CHECK_THROW(set_code("gob"_n, global_protection_some_get_wasm), fc::exception); produce_blocks(1); - set_code(N(gob), global_protection_okay_set_wasm); + set_code("gob"_n, global_protection_okay_set_wasm); produce_blocks(1); - BOOST_CHECK_THROW(set_code(N(gob), global_protection_some_set_wasm), fc::exception); + BOOST_CHECK_THROW(set_code("gob"_n, global_protection_some_set_wasm), fc::exception); produce_blocks(1); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( apply_export_and_signature, TESTER ) try { produce_blocks(2); - create_accounts( {N(bbb)} ); + create_accounts( {"bbb"_n} ); produce_block(); - BOOST_CHECK_THROW(set_code(N(bbb), no_apply_wast), fc::exception); + BOOST_CHECK_THROW(set_code("bbb"_n, no_apply_wast), fc::exception); produce_blocks(1); - BOOST_CHECK_THROW(set_code(N(bbb), no_apply_2_wast), fc::exception); + BOOST_CHECK_THROW(set_code("bbb"_n, no_apply_2_wast), fc::exception); produce_blocks(1); - BOOST_CHECK_THROW(set_code(N(bbb), no_apply_3_wast), fc::exception); + BOOST_CHECK_THROW(set_code("bbb"_n, no_apply_3_wast), fc::exception); produce_blocks(1); - BOOST_CHECK_THROW(set_code(N(bbb), apply_wrong_signature_wast), fc::exception); + BOOST_CHECK_THROW(set_code("bbb"_n, apply_wrong_signature_wast), fc::exception); produce_blocks(1); } FC_LOG_AND_RETHROW() @@ -1401,61 +1401,61 @@ BOOST_FIXTURE_TEST_CASE( trigger_serialization_errors, TESTER) try { 0x01, 0x0a, 0x0c, 0x01, 0x0a, 0x00, 0x41, 0x04, 0x41, 0x05, 0x41, 0x10, 0x10, 0x00, 0x0b, 0x0b, 0x0b, 0x01, 0x00, 0x41, 0x04, 0x0b, 0x05, 0x68, 0x65, 0x6c, 0x6c, 0x6f }; - create_accounts( {N(bbb)} ); + create_accounts( {"bbb"_n} ); produce_block(); - set_code(N(bbb), proper_wasm); - BOOST_CHECK_THROW(set_code(N(bbb), malformed_wasm), wasm_serialization_error); + set_code("bbb"_n, proper_wasm); + BOOST_CHECK_THROW(set_code("bbb"_n, malformed_wasm), wasm_serialization_error); produce_blocks(1); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( protect_injected, TESTER ) try { produce_blocks(2); - create_accounts( {N(inj)} ); + create_accounts( {"inj"_n} ); produce_block(); - BOOST_CHECK_THROW(set_code(N(inj), import_injected_wast), fc::exception); + BOOST_CHECK_THROW(set_code("inj"_n, import_injected_wast), fc::exception); produce_blocks(1); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( import_signature, TESTER ) try { produce_blocks(2); - create_accounts( {N(imp)} ); + create_accounts( {"imp"_n} ); produce_block(); - BOOST_CHECK_THROW(set_code(N(imp), import_wrong_signature_wast), wasm_exception); + BOOST_CHECK_THROW(set_code("imp"_n, import_wrong_signature_wast), wasm_exception); produce_blocks(1); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( mem_growth_memset, TESTER ) try { produce_blocks(2); - create_accounts( {N(grower)} ); + create_accounts( {"grower"_n} ); produce_block(); action act; - act.account = N(grower); - act.name = N(); - act.authorization = vector{{N(grower),config::active_name}}; + act.account = "grower"_n; + act.name = ""_n; + act.authorization = vector{{"grower"_n,config::active_name}}; - set_code(N(grower), memory_growth_memset_store); + set_code("grower"_n, memory_growth_memset_store); { signed_transaction trx; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(grower), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "grower"_n, "active" ), control->get_chain_id()); push_transaction(trx); } produce_blocks(1); - set_code(N(grower), memory_growth_memset_test); + set_code("grower"_n, memory_growth_memset_test); { signed_transaction trx; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(grower), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "grower"_n, "active" ), control->get_chain_id()); push_transaction(trx); } } FC_LOG_AND_RETHROW() @@ -1499,76 +1499,76 @@ INCBIN(80k_deep_loop_with_void, "80k_deep_loop_with_void.wasm"); BOOST_FIXTURE_TEST_CASE( fuzz, TESTER ) try { produce_blocks(2); - create_accounts( {N(fuzzy)} ); + create_accounts( {"fuzzy"_n} ); produce_block(); { vector wasm(gfuzz1Data, gfuzz1Data + gfuzz1Size); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), fc::exception); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), fc::exception); } { vector wasm(gfuzz2Data, gfuzz2Data + gfuzz2Size); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), fc::exception); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), fc::exception); } { vector wasm(gfuzz3Data, gfuzz3Data + gfuzz3Size); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), fc::exception); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), fc::exception); } { vector wasm(gfuzz4Data, gfuzz4Data + gfuzz4Size); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), fc::exception); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), fc::exception); } { vector wasm(gfuzz5Data, gfuzz5Data + gfuzz5Size); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), fc::exception); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), fc::exception); } { vector wasm(gfuzz6Data, gfuzz6Data + gfuzz6Size); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), fc::exception); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), fc::exception); } { vector wasm(gfuzz7Data, gfuzz7Data + gfuzz7Size); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), fc::exception); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), fc::exception); } { vector wasm(gfuzz8Data, gfuzz8Data + gfuzz8Size); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), fc::exception); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), fc::exception); } { vector wasm(gfuzz9Data, gfuzz9Data + gfuzz9Size); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), fc::exception); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), fc::exception); } { vector wasm(gfuzz10Data, gfuzz10Data + gfuzz10Size); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), fc::exception); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), fc::exception); } { vector wasm(gfuzz11Data, gfuzz11Data + gfuzz11Size); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), fc::exception); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), fc::exception); } { vector wasm(gfuzz12Data, gfuzz12Data + gfuzz12Size); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), fc::exception); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), fc::exception); } { vector wasm(gfuzz13Data, gfuzz13Data + gfuzz13Size); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), fc::exception); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), fc::exception); } { vector wasm(gfuzz14Data, gfuzz14Data + gfuzz14Size); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), fc::exception); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), fc::exception); } { vector wasm(gfuzz15Data, gfuzz15Data + gfuzz15Size); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), fc::exception); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), fc::exception); } /* TODO: update wasm to have apply(...) then call, claim is that this * takes 1.6 seconds under wavm... { auto start = fc::time_point::now(); vector wasm(gfuzz13Data, gfuzz13Data + gfuzz13Size); - set_code(N(fuzzy), wasm); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), fc::exception); + set_code("fuzzy"_n, wasm); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), fc::exception); auto end = fc::time_point::now(); edump((end-start)); } @@ -1576,71 +1576,71 @@ BOOST_FIXTURE_TEST_CASE( fuzz, TESTER ) try { { vector wasm(gbig_allocationData, gbig_allocationData + gbig_allocationSize); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), wasm_serialization_error); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), wasm_serialization_error); } { vector wasm(gcrash_section_size_too_bigData, gcrash_section_size_too_bigData + gcrash_section_size_too_bigSize); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), wasm_serialization_error); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), wasm_serialization_error); } { vector wasm(gleak_no_destructorData, gleak_no_destructorData + gleak_no_destructorSize); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), wasm_serialization_error); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), wasm_serialization_error); } { vector wasm(gleak_readExportsData, gleak_readExportsData + gleak_readExportsSize); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), wasm_serialization_error); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), wasm_serialization_error); } { vector wasm(gleak_readFunctionsData, gleak_readFunctionsData + gleak_readFunctionsSize); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), wasm_serialization_error); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), wasm_serialization_error); } { vector wasm(gleak_readFunctions_2Data, gleak_readFunctions_2Data + gleak_readFunctions_2Size); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), wasm_serialization_error); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), wasm_serialization_error); } { vector wasm(gleak_readFunctions_3Data, gleak_readFunctions_3Data + gleak_readFunctions_3Size); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), wasm_serialization_error); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), wasm_serialization_error); } { vector wasm(gleak_readGlobalsData, gleak_readGlobalsData + gleak_readGlobalsSize); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), wasm_serialization_error); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), wasm_serialization_error); } { vector wasm(gleak_readImportsData, gleak_readImportsData + gleak_readImportsSize); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), wasm_serialization_error); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), wasm_serialization_error); } { vector wasm(gleak_wasm_binary_cpp_L1249Data, gleak_wasm_binary_cpp_L1249Data + gleak_wasm_binary_cpp_L1249Size); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), wasm_serialization_error); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), wasm_serialization_error); } { vector wasm(greadFunctions_slowness_out_of_memoryData, greadFunctions_slowness_out_of_memoryData + greadFunctions_slowness_out_of_memorySize); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), wasm_serialization_error); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), wasm_serialization_error); } { vector wasm(glocals_ycData, glocals_ycData + glocals_ycSize); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), wasm_serialization_error); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), wasm_serialization_error); } { vector wasm(glocals_sData, glocals_sData + glocals_sSize); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), wasm_serialization_error); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), wasm_serialization_error); } { vector wasm(gslowwasm_localsetsData, gslowwasm_localsetsData + gslowwasm_localsetsSize); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), wasm_serialization_error); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), wasm_serialization_error); } { vector wasm(gdeep_loops_ext_reportData, gdeep_loops_ext_reportData + gdeep_loops_ext_reportSize); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), wasm_exception); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), wasm_exception); } { vector wasm(g80k_deep_loop_with_retData, g80k_deep_loop_with_retData + g80k_deep_loop_with_retSize); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), wasm_exception); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), wasm_exception); } { vector wasm(g80k_deep_loop_with_voidData, g80k_deep_loop_with_voidData + g80k_deep_loop_with_voidSize); - BOOST_CHECK_THROW(set_code(N(fuzzy), wasm), wasm_exception); + BOOST_CHECK_THROW(set_code("fuzzy"_n, wasm), wasm_exception); } produce_blocks(1); @@ -1655,24 +1655,24 @@ BOOST_FIXTURE_TEST_CASE( getcode_checks, TESTER ) try { BOOST_FIXTURE_TEST_CASE( big_maligned_host_ptr, TESTER ) try { produce_blocks(2); - create_accounts( {N(bigmaligned)} ); + create_accounts( {"bigmaligned"_n} ); produce_block(); string large_maligned_host_ptr_wast_f = fc::format_string(large_maligned_host_ptr, fc::mutable_variant_object() ("MAX_WASM_PAGES", eosio::chain::wasm_constraints::maximum_linear_memory/(64*1024)) ("MAX_NAME_ARRAY", (eosio::chain::wasm_constraints::maximum_linear_memory-1)/sizeof(chain::account_name))); - set_code(N(bigmaligned), large_maligned_host_ptr_wast_f.c_str()); + set_code("bigmaligned"_n, large_maligned_host_ptr_wast_f.c_str()); produce_blocks(1); signed_transaction trx; action act; - act.account = N(bigmaligned); - act.name = N(); - act.authorization = vector{{N(bigmaligned),config::active_name}}; + act.account = "bigmaligned"_n; + act.name = ""_n; + act.authorization = vector{{"bigmaligned"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(bigmaligned), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "bigmaligned"_n, "active" ), control->get_chain_id()); push_transaction(trx); produce_blocks(1); } FC_LOG_AND_RETHROW() @@ -1682,52 +1682,52 @@ BOOST_DATA_TEST_CASE_F( old_wasm_tester, depth_tests, bdata::make({false, true}) preactivate_builtin_protocol_features({builtin_protocol_feature_t::configurable_wasm_limits}); produce_block(); - create_accounts( {N(depth)} ); + create_accounts( {"depth"_n} ); produce_block(); signed_transaction trx; - trx.actions.emplace_back(vector{{N(depth),config::active_name}}, N(depth), N(), bytes{}); - trx.actions[0].authorization = vector{{N(depth),config::active_name}}; + trx.actions.emplace_back(vector{{"depth"_n,config::active_name}}, "depth"_n, ""_n, bytes{}); + trx.actions[0].authorization = vector{{"depth"_n,config::active_name}}; auto pushit = [&]() { produce_block(); trx.signatures.clear(); set_transaction_headers(trx); - trx.sign(get_private_key(N(depth), "active"), control->get_chain_id()); + trx.sign(get_private_key("depth"_n, "active"), control->get_chain_id()); push_transaction(trx); }; //strictly wasm recursion to maximum_call_depth & maximum_call_depth+1 string wasm_depth_okay = fc::format_string(depth_assert_wasm, fc::mutable_variant_object() ("MAX_DEPTH", eosio::chain::wasm_constraints::maximum_call_depth)); - set_code(N(depth), wasm_depth_okay.c_str()); + set_code("depth"_n, wasm_depth_okay.c_str()); pushit(); string wasm_depth_one_over = fc::format_string(depth_assert_wasm, fc::mutable_variant_object() ("MAX_DEPTH", eosio::chain::wasm_constraints::maximum_call_depth+1)); - set_code(N(depth), wasm_depth_one_over.c_str()); + set_code("depth"_n, wasm_depth_one_over.c_str()); BOOST_CHECK_THROW(pushit(), wasm_execution_error); //wasm recursion but call an intrinsic as the last function instead string intrinsic_depth_okay = fc::format_string(depth_assert_intrinsic, fc::mutable_variant_object() ("MAX_DEPTH", eosio::chain::wasm_constraints::maximum_call_depth)); - set_code(N(depth), intrinsic_depth_okay.c_str()); + set_code("depth"_n, intrinsic_depth_okay.c_str()); pushit(); string intrinsic_depth_one_over = fc::format_string(depth_assert_intrinsic, fc::mutable_variant_object() ("MAX_DEPTH", eosio::chain::wasm_constraints::maximum_call_depth+1)); - set_code(N(depth), intrinsic_depth_one_over.c_str()); + set_code("depth"_n, intrinsic_depth_one_over.c_str()); BOOST_CHECK_THROW(pushit(), wasm_execution_error); //add a float operation in the mix to ensure any injected softfloat call doesn't count against limit string wasm_float_depth_okay = fc::format_string(depth_assert_wasm_float, fc::mutable_variant_object() ("MAX_DEPTH", eosio::chain::wasm_constraints::maximum_call_depth)); - set_code(N(depth), wasm_float_depth_okay.c_str()); + set_code("depth"_n, wasm_float_depth_okay.c_str()); pushit(); string wasm_float_depth_one_over = fc::format_string(depth_assert_wasm_float, fc::mutable_variant_object() ("MAX_DEPTH", eosio::chain::wasm_constraints::maximum_call_depth+1)); - set_code(N(depth), wasm_float_depth_one_over.c_str()); + set_code("depth"_n, wasm_float_depth_one_over.c_str()); BOOST_CHECK_THROW(pushit(), wasm_execution_error); } FC_LOG_AND_RETHROW() @@ -1735,21 +1735,21 @@ BOOST_DATA_TEST_CASE_F( old_wasm_tester, depth_tests, bdata::make({false, true}) BOOST_FIXTURE_TEST_CASE( varuint_memory_flags_tests, old_wasm_tester ) try { produce_block(); - create_accounts( {N(memflags)} ); + create_accounts( {"memflags"_n} ); produce_block(); - set_code(N(memflags), varuint_memory_flags); + set_code("memflags"_n, varuint_memory_flags); produce_block(); { signed_transaction trx; action act; - act.account = N(memflags); - act.name = N(); - act.authorization = vector{{N(memflags),config::active_name}}; + act.account = "memflags"_n; + act.name = ""_n; + act.authorization = vector{{"memflags"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(memflags), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "memflags"_n, "active" ), control->get_chain_id()); push_transaction(trx); produce_block(); } @@ -1762,18 +1762,18 @@ BOOST_FIXTURE_TEST_CASE( varuint_memory_flags_tests, old_wasm_tester ) try { { signed_transaction trx; action act; - act.account = N(memflags); - act.name = N(); - act.authorization = vector{{N(memflags),config::active_name}}; + act.account = "memflags"_n; + act.name = ""_n; + act.authorization = vector{{"memflags"_n,config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); - trx.sign(get_private_key( N(memflags), "active" ), control->get_chain_id()); + trx.sign(get_private_key( "memflags"_n, "active" ), control->get_chain_id()); push_transaction(trx); produce_block(); } - set_code(N(memflags), std::vector{}); - BOOST_REQUIRE_THROW(set_code(N(memflags), varuint_memory_flags), wasm_exception); + set_code("memflags"_n, std::vector{}); + BOOST_REQUIRE_THROW(set_code("memflags"_n, varuint_memory_flags), wasm_exception); } FC_LOG_AND_RETHROW() // TODO: Update to use eos-vm once merged @@ -1789,7 +1789,7 @@ BOOST_AUTO_TEST_CASE( code_size ) try { }; std::vector code_end = { 0x0b }; - + std::vector code_function_body; code_function_body.insert(code_function_body.end(), wasm_constraints::maximum_code_size + 4, 0x01); @@ -1812,8 +1812,8 @@ BOOST_AUTO_TEST_CASE( billed_cpu_test ) try { const resource_limits_manager& mgr = chain.control->get_resource_limits_manager(); - account_name acc = N( asserter ); - account_name user = N( user ); + account_name acc = "asserter"_n; + account_name user = "user"_n; chain.create_accounts( {acc, user} ); chain.produce_block(); @@ -1843,13 +1843,13 @@ BOOST_AUTO_TEST_CASE( billed_cpu_test ) try { push_trx( ptrx, fc::time_point::maximum(), 0, false ); // non-explicit billing // setup account acc with large limits - chain.push_action( config::system_account_name, N(setalimits), config::system_account_name, fc::mutable_variant_object() + chain.push_action( config::system_account_name, "setalimits"_n, config::system_account_name, fc::mutable_variant_object() ("account", user) ("ram_bytes", -1) ("net_weight", 19'999'999) ("cpu_weight", 19'999'999) ); - chain.push_action( config::system_account_name, N(setalimits), config::system_account_name, fc::mutable_variant_object() + chain.push_action( config::system_account_name, "setalimits"_n, config::system_account_name, fc::mutable_variant_object() ("account", acc) ("ram_bytes", -1) ("net_weight", 9'999) @@ -1906,7 +1906,7 @@ BOOST_AUTO_TEST_CASE( billed_cpu_test ) try { BOOST_CHECK_EXCEPTION( push_trx( ptrx, fc::time_point::maximum(), min_cpu_time_us - 1, true ), transaction_exception, fc_exception_message_starts_with("cannot bill CPU time less than the minimum") ); - chain.push_action( config::system_account_name, N(setalimits), config::system_account_name, fc::mutable_variant_object() + chain.push_action( config::system_account_name, "setalimits"_n, config::system_account_name, fc::mutable_variant_object() ("account", acc) ("ram_bytes", -1) ("net_weight", 75) @@ -1949,7 +1949,7 @@ BOOST_AUTO_TEST_CASE( billed_cpu_test ) try { BOOST_FIXTURE_TEST_CASE(net_usage_tests, tester ) try { int count = 0; auto check = [&](int coderepeat, int max_net_usage)-> bool { - account_name account = N(f_tests) + (count++) * 16; + account_name account = "f_tests"_n + (count++) * 16; create_accounts({account}); std::string code = R"=====( @@ -1998,8 +1998,8 @@ BOOST_FIXTURE_TEST_CASE(net_usage_tests, tester ) try { } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE(weighted_net_usage_tests, tester ) try { - account_name account = N(f_tests); - account_name acc2 = N(acc2); + account_name account = "f_tests"_n; + account_name acc2 = "acc2"_n; create_accounts({account, acc2}); int ver = 0; auto check = [&](int coderepeat)-> bool { diff --git a/unittests/whitelist_blacklist_tests.cpp b/unittests/whitelist_blacklist_tests.cpp index 3392fd22dfc..b79c92c9016 100644 --- a/unittests/whitelist_blacklist_tests.cpp +++ b/unittests/whitelist_blacklist_tests.cpp @@ -41,14 +41,14 @@ class whitelist_blacklist_tester { if( !bootstrap ) return; - chain->create_accounts({N(eosio.token), N(alice), N(bob), N(charlie)}); - chain->set_code(N(eosio.token), contracts::eosio_token_wasm() ); - chain->set_abi(N(eosio.token), contracts::eosio_token_abi().data() ); - chain->push_action( N(eosio.token), N(create), N(eosio.token), mvo() + chain->create_accounts({"eosio.token"_n, "alice"_n, "bob"_n, "charlie"_n}); + chain->set_code("eosio.token"_n, contracts::eosio_token_wasm() ); + chain->set_abi("eosio.token"_n, contracts::eosio_token_abi().data() ); + chain->push_action( "eosio.token"_n, "create"_n, "eosio.token"_n, mvo() ( "issuer", "eosio.token" ) ( "maximum_supply", "1000000.00 TOK" ) ); - chain->push_action( N(eosio.token), N(issue), N(eosio.token), mvo() + chain->push_action( "eosio.token"_n, "issue"_n, "eosio.token"_n, mvo() ( "to", "eosio.token" ) ( "quantity", "1000000.00 TOK" ) ( "memo", "issue" ) @@ -65,7 +65,7 @@ class whitelist_blacklist_tester { } transaction_trace_ptr transfer( account_name from, account_name to, string quantity = "1.00 TOK" ) { - return chain->push_action( N(eosio.token), N(transfer), from, mvo() + return chain->push_action( "eosio.token"_n, "transfer"_n, from, mvo() ( "from", from ) ( "to", to ) ( "quantity", quantity ) @@ -101,30 +101,30 @@ BOOST_AUTO_TEST_SUITE(whitelist_blacklist_tests) BOOST_AUTO_TEST_CASE( actor_whitelist ) { try { whitelist_blacklist_tester<> test; - test.actor_whitelist = {config::system_account_name, N(eosio.token), N(alice)}; + test.actor_whitelist = {config::system_account_name, "eosio.token"_n, "alice"_n}; test.init(); - test.transfer( N(eosio.token), N(alice), "1000.00 TOK" ); + test.transfer( "eosio.token"_n, "alice"_n, "1000.00 TOK" ); - test.transfer( N(alice), N(bob), "100.00 TOK" ); + test.transfer( "alice"_n, "bob"_n, "100.00 TOK" ); - BOOST_CHECK_EXCEPTION( test.transfer( N(bob), N(alice) ), + BOOST_CHECK_EXCEPTION( test.transfer( "bob"_n, "alice"_n ), actor_whitelist_exception, fc_exception_message_is("authorizing actor(s) in transaction are not on the actor whitelist: [\"bob\"]") ); signed_transaction trx; - trx.actions.emplace_back( vector{{N(alice),config::active_name}, {N(bob),config::active_name}}, - N(eosio.token), N(transfer), + trx.actions.emplace_back( vector{{"alice"_n,config::active_name}, {"bob"_n,config::active_name}}, + "eosio.token"_n, "transfer"_n, fc::raw::pack(transfer_args{ - .from = N(alice), - .to = N(bob), + .from = "alice"_n, + .to = "bob"_n, .quantity = asset::from_string("10.00 TOK"), .memo = "" }) ); test.chain->set_transaction_headers(trx); - trx.sign( test.chain->get_private_key( N(alice), "active" ), test.chain->control->get_chain_id() ); - trx.sign( test.chain->get_private_key( N(bob), "active" ), test.chain->control->get_chain_id() ); + trx.sign( test.chain->get_private_key( "alice"_n, "active" ), test.chain->control->get_chain_id() ); + trx.sign( test.chain->get_private_key( "bob"_n, "active" ), test.chain->control->get_chain_id() ); BOOST_CHECK_EXCEPTION( test.chain->push_transaction( trx ), actor_whitelist_exception, fc_exception_message_starts_with("authorizing actor(s) in transaction are not on the actor whitelist: [\"bob\"]") @@ -134,31 +134,31 @@ BOOST_AUTO_TEST_CASE( actor_whitelist ) { try { BOOST_AUTO_TEST_CASE( actor_blacklist ) { try { whitelist_blacklist_tester<> test; - test.actor_blacklist = {N(bob)}; + test.actor_blacklist = {"bob"_n}; test.init(); - test.transfer( N(eosio.token), N(alice), "1000.00 TOK" ); + test.transfer( "eosio.token"_n, "alice"_n, "1000.00 TOK" ); - test.transfer( N(alice), N(bob), "100.00 TOK" ); + test.transfer( "alice"_n, "bob"_n, "100.00 TOK" ); - BOOST_CHECK_EXCEPTION( test.transfer( N(bob), N(alice) ), + BOOST_CHECK_EXCEPTION( test.transfer( "bob"_n, "alice"_n ), actor_blacklist_exception, fc_exception_message_starts_with("authorizing actor(s) in transaction are on the actor blacklist: [\"bob\"]") ); signed_transaction trx; - trx.actions.emplace_back( vector{{N(alice),config::active_name}, {N(bob),config::active_name}}, - N(eosio.token), N(transfer), + trx.actions.emplace_back( vector{{"alice"_n,config::active_name}, {"bob"_n,config::active_name}}, + "eosio.token"_n, "transfer"_n, fc::raw::pack(transfer_args{ - .from = N(alice), - .to = N(bob), + .from = "alice"_n, + .to = "bob"_n, .quantity = asset::from_string("10.00 TOK"), .memo = "" }) ); test.chain->set_transaction_headers(trx); - trx.sign( test.chain->get_private_key( N(alice), "active" ), test.chain->control->get_chain_id() ); - trx.sign( test.chain->get_private_key( N(bob), "active" ), test.chain->control->get_chain_id() ); + trx.sign( test.chain->get_private_key( "alice"_n, "active" ), test.chain->control->get_chain_id() ); + trx.sign( test.chain->get_private_key( "bob"_n, "active" ), test.chain->control->get_chain_id() ); BOOST_CHECK_EXCEPTION( test.chain->push_transaction( trx ), actor_blacklist_exception, fc_exception_message_starts_with("authorizing actor(s) in transaction are on the actor blacklist: [\"bob\"]") @@ -168,44 +168,44 @@ BOOST_AUTO_TEST_CASE( actor_blacklist ) { try { BOOST_AUTO_TEST_CASE( contract_whitelist ) { try { whitelist_blacklist_tester<> test; - test.contract_whitelist = {config::system_account_name, N(eosio.token), N(bob)}; + test.contract_whitelist = {config::system_account_name, "eosio.token"_n, "bob"_n}; test.init(); - test.transfer( N(eosio.token), N(alice), "1000.00 TOK" ); + test.transfer( "eosio.token"_n, "alice"_n, "1000.00 TOK" ); - test.transfer( N(alice), N(eosio.token) ); + test.transfer( "alice"_n, "eosio.token"_n ); - test.transfer( N(alice), N(bob) ); - test.transfer( N(alice), N(charlie), "100.00 TOK" ); + test.transfer( "alice"_n, "bob"_n ); + test.transfer( "alice"_n, "charlie"_n, "100.00 TOK" ); - test.transfer( N(charlie), N(alice) ); + test.transfer( "charlie"_n, "alice"_n ); test.chain->produce_blocks(); - test.chain->set_code(N(bob), contracts::eosio_token_wasm() ); - test.chain->set_abi(N(bob), contracts::eosio_token_abi().data() ); + test.chain->set_code("bob"_n, contracts::eosio_token_wasm() ); + test.chain->set_abi("bob"_n, contracts::eosio_token_abi().data() ); test.chain->produce_blocks(); - test.chain->set_code(N(charlie), contracts::eosio_token_wasm() ); - test.chain->set_abi(N(charlie), contracts::eosio_token_abi().data() ); + test.chain->set_code("charlie"_n, contracts::eosio_token_wasm() ); + test.chain->set_abi("charlie"_n, contracts::eosio_token_abi().data() ); test.chain->produce_blocks(); - test.transfer( N(alice), N(bob) ); + test.transfer( "alice"_n, "bob"_n ); - BOOST_CHECK_EXCEPTION( test.transfer( N(alice), N(charlie) ), + BOOST_CHECK_EXCEPTION( test.transfer( "alice"_n, "charlie"_n ), contract_whitelist_exception, fc_exception_message_is("account 'charlie' is not on the contract whitelist") ); - test.chain->push_action( N(bob), N(create), N(bob), mvo() + test.chain->push_action( "bob"_n, "create"_n, "bob"_n, mvo() ( "issuer", "bob" ) ( "maximum_supply", "1000000.00 CUR" ) ); - BOOST_CHECK_EXCEPTION( test.chain->push_action( N(charlie), N(create), N(charlie), mvo() + BOOST_CHECK_EXCEPTION( test.chain->push_action( "charlie"_n, "create"_n, "charlie"_n, mvo() ( "issuer", "charlie" ) ( "maximum_supply", "1000000.00 CUR" ) ), @@ -217,44 +217,44 @@ BOOST_AUTO_TEST_CASE( contract_whitelist ) { try { BOOST_AUTO_TEST_CASE( contract_blacklist ) { try { whitelist_blacklist_tester<> test; - test.contract_blacklist = {N(charlie)}; + test.contract_blacklist = {"charlie"_n}; test.init(); - test.transfer( N(eosio.token), N(alice), "1000.00 TOK" ); + test.transfer( "eosio.token"_n, "alice"_n, "1000.00 TOK" ); - test.transfer( N(alice), N(eosio.token) ); + test.transfer( "alice"_n, "eosio.token"_n ); - test.transfer( N(alice), N(bob) ); - test.transfer( N(alice), N(charlie), "100.00 TOK" ); + test.transfer( "alice"_n, "bob"_n ); + test.transfer( "alice"_n, "charlie"_n, "100.00 TOK" ); - test.transfer( N(charlie), N(alice) ); + test.transfer( "charlie"_n, "alice"_n ); test.chain->produce_blocks(); - test.chain->set_code(N(bob), contracts::eosio_token_wasm() ); - test.chain->set_abi(N(bob), contracts::eosio_token_abi().data() ); + test.chain->set_code("bob"_n, contracts::eosio_token_wasm() ); + test.chain->set_abi("bob"_n, contracts::eosio_token_abi().data() ); test.chain->produce_blocks(); - test.chain->set_code(N(charlie), contracts::eosio_token_wasm() ); - test.chain->set_abi(N(charlie), contracts::eosio_token_abi().data() ); + test.chain->set_code("charlie"_n, contracts::eosio_token_wasm() ); + test.chain->set_abi("charlie"_n, contracts::eosio_token_abi().data() ); test.chain->produce_blocks(); - test.transfer( N(alice), N(bob) ); + test.transfer( "alice"_n, "bob"_n ); - BOOST_CHECK_EXCEPTION( test.transfer( N(alice), N(charlie) ), + BOOST_CHECK_EXCEPTION( test.transfer( "alice"_n, "charlie"_n ), contract_blacklist_exception, fc_exception_message_is("account 'charlie' is on the contract blacklist") ); - test.chain->push_action( N(bob), N(create), N(bob), mvo() + test.chain->push_action( "bob"_n, "create"_n, "bob"_n, mvo() ( "issuer", "bob" ) ( "maximum_supply", "1000000.00 CUR" ) ); - BOOST_CHECK_EXCEPTION( test.chain->push_action( N(charlie), N(create), N(charlie), mvo() + BOOST_CHECK_EXCEPTION( test.chain->push_action( "charlie"_n, "create"_n, "charlie"_n, mvo() ( "issuer", "charlie" ) ( "maximum_supply", "1000000.00 CUR" ) ), @@ -266,34 +266,34 @@ BOOST_AUTO_TEST_CASE( contract_blacklist ) { try { BOOST_AUTO_TEST_CASE( action_blacklist ) { try { whitelist_blacklist_tester<> test; - test.contract_whitelist = {config::system_account_name, N(eosio.token), N(bob), N(charlie)}; - test.action_blacklist = {{N(charlie), N(create)}}; + test.contract_whitelist = {config::system_account_name, "eosio.token"_n, "bob"_n, "charlie"_n}; + test.action_blacklist = {{"charlie"_n, "create"_n}}; test.init(); - test.transfer( N(eosio.token), N(alice), "1000.00 TOK" ); + test.transfer( "eosio.token"_n, "alice"_n, "1000.00 TOK" ); test.chain->produce_blocks(); - test.chain->set_code(N(bob), contracts::eosio_token_wasm() ); - test.chain->set_abi(N(bob), contracts::eosio_token_abi().data() ); + test.chain->set_code("bob"_n, contracts::eosio_token_wasm() ); + test.chain->set_abi("bob"_n, contracts::eosio_token_abi().data() ); test.chain->produce_blocks(); - test.chain->set_code(N(charlie), contracts::eosio_token_wasm() ); - test.chain->set_abi(N(charlie), contracts::eosio_token_abi().data() ); + test.chain->set_code("charlie"_n, contracts::eosio_token_wasm() ); + test.chain->set_abi("charlie"_n, contracts::eosio_token_abi().data() ); test.chain->produce_blocks(); - test.transfer( N(alice), N(bob) ); + test.transfer( "alice"_n, "bob"_n ); - test.transfer( N(alice), N(charlie) ), + test.transfer( "alice"_n, "charlie"_n ), - test.chain->push_action( N(bob), N(create), N(bob), mvo() + test.chain->push_action( "bob"_n, "create"_n, "bob"_n, mvo() ( "issuer", "bob" ) ( "maximum_supply", "1000000.00 CUR" ) ); - BOOST_CHECK_EXCEPTION( test.chain->push_action( N(charlie), N(create), N(charlie), mvo() + BOOST_CHECK_EXCEPTION( test.chain->push_action( "charlie"_n, "create"_n, "charlie"_n, mvo() ( "issuer", "charlie" ) ( "maximum_supply", "1000000.00 CUR" ) ), @@ -333,13 +333,13 @@ BOOST_AUTO_TEST_CASE( deferred_blacklist_failure ) { try { whitelist_blacklist_tester tester1; tester1.init(); tester1.chain->produce_blocks(); - tester1.chain->set_code( N(bob), contracts::deferred_test_wasm() ); - tester1.chain->set_abi( N(bob), contracts::deferred_test_abi().data() ); - tester1.chain->set_code( N(charlie), contracts::deferred_test_wasm() ); - tester1.chain->set_abi( N(charlie), contracts::deferred_test_abi().data() ); + tester1.chain->set_code( "bob"_n, contracts::deferred_test_wasm() ); + tester1.chain->set_abi( "bob"_n, contracts::deferred_test_abi().data() ); + tester1.chain->set_code( "charlie"_n, contracts::deferred_test_wasm() ); + tester1.chain->set_abi( "charlie"_n, contracts::deferred_test_abi().data() ); tester1.chain->produce_blocks(); - tester1.chain->push_action( N(bob), N(defercall), N(alice), mvo() + tester1.chain->push_action( "bob"_n, "defercall"_n, "alice"_n, mvo() ( "payer", "alice" ) ( "sender_id", 0 ) ( "contract", "charlie" ) @@ -350,7 +350,7 @@ BOOST_AUTO_TEST_CASE( deferred_blacklist_failure ) { try { tester1.shutdown(); - tester1.contract_blacklist = {N(charlie)}; + tester1.contract_blacklist = {"charlie"_n}; tester1.init(false); whitelist_blacklist_tester tester2; @@ -361,7 +361,7 @@ BOOST_AUTO_TEST_CASE( deferred_blacklist_failure ) { try { tester2.chain->push_block( b ); } - tester1.chain->push_action( N(bob), N(defercall), N(alice), mvo() + tester1.chain->push_action( "bob"_n, "defercall"_n, "alice"_n, mvo() ( "payer", "alice" ) ( "sender_id", 1 ) ( "contract", "charlie" ) @@ -384,13 +384,13 @@ BOOST_AUTO_TEST_CASE( blacklist_onerror ) { try { whitelist_blacklist_tester tester1; tester1.init(); tester1.chain->produce_blocks(); - tester1.chain->set_code( N(bob), contracts::deferred_test_wasm() ); - tester1.chain->set_abi( N(bob), contracts::deferred_test_abi().data() ); - tester1.chain->set_code( N(charlie), contracts::deferred_test_wasm() ); - tester1.chain->set_abi( N(charlie), contracts::deferred_test_abi().data() ); + tester1.chain->set_code( "bob"_n, contracts::deferred_test_wasm() ); + tester1.chain->set_abi( "bob"_n, contracts::deferred_test_abi().data() ); + tester1.chain->set_code( "charlie"_n, contracts::deferred_test_wasm() ); + tester1.chain->set_abi( "charlie"_n, contracts::deferred_test_abi().data() ); tester1.chain->produce_blocks(); - tester1.chain->push_action( N(bob), N(defercall), N(alice), mvo() + tester1.chain->push_action( "bob"_n, "defercall"_n, "alice"_n, mvo() ( "payer", "alice" ) ( "sender_id", 0 ) ( "contract", "charlie" ) @@ -400,10 +400,10 @@ BOOST_AUTO_TEST_CASE( blacklist_onerror ) { try { tester1.chain->produce_blocks(); tester1.shutdown(); - tester1.action_blacklist = {{config::system_account_name, N(onerror)}}; + tester1.action_blacklist = {{config::system_account_name, "onerror"_n}}; tester1.init(false); - tester1.chain->push_action( N(bob), N(defercall), N(alice), mvo() + tester1.chain->push_action( "bob"_n, "defercall"_n, "alice"_n, mvo() ( "payer", "alice" ) ( "sender_id", 0 ) ( "contract", "charlie" ) @@ -420,18 +420,18 @@ BOOST_AUTO_TEST_CASE( actor_blacklist_inline_deferred ) { try { whitelist_blacklist_tester tester1; tester1.init(); tester1.chain->produce_blocks(); - tester1.chain->set_code( N(alice), contracts::deferred_test_wasm() ); - tester1.chain->set_abi( N(alice), contracts::deferred_test_abi().data() ); - tester1.chain->set_code( N(bob), contracts::deferred_test_wasm() ); - tester1.chain->set_abi( N(bob), contracts::deferred_test_abi().data() ); - tester1.chain->set_code( N(charlie), contracts::deferred_test_wasm() ); - tester1.chain->set_abi( N(charlie), contracts::deferred_test_abi().data() ); + tester1.chain->set_code( "alice"_n, contracts::deferred_test_wasm() ); + tester1.chain->set_abi( "alice"_n, contracts::deferred_test_abi().data() ); + tester1.chain->set_code( "bob"_n, contracts::deferred_test_wasm() ); + tester1.chain->set_abi( "bob"_n, contracts::deferred_test_abi().data() ); + tester1.chain->set_code( "charlie"_n, contracts::deferred_test_wasm() ); + tester1.chain->set_abi( "charlie"_n, contracts::deferred_test_abi().data() ); tester1.chain->produce_blocks(); auto auth = authority(eosio::testing::base_tester::get_public_key(name("alice"), "active")); - auth.accounts.push_back( permission_level_weight{{N(alice), config::eosio_code_name}, 1} ); + auth.accounts.push_back( permission_level_weight{{"alice"_n, config::eosio_code_name}, 1} ); - tester1.chain->push_action( N(eosio), N(updateauth), N(alice), mvo() + tester1.chain->push_action( "eosio"_n, "updateauth"_n, "alice"_n, mvo() ( "account", "alice" ) ( "permission", "active" ) ( "parent", "owner" ) @@ -439,10 +439,10 @@ BOOST_AUTO_TEST_CASE( actor_blacklist_inline_deferred ) { try { ); auth = authority(eosio::testing::base_tester::get_public_key(name("bob"), "active")); - auth.accounts.push_back( permission_level_weight{{N(alice), config::eosio_code_name}, 1} ); - auth.accounts.push_back( permission_level_weight{{N(bob), config::eosio_code_name}, 1} ); + auth.accounts.push_back( permission_level_weight{{"alice"_n, config::eosio_code_name}, 1} ); + auth.accounts.push_back( permission_level_weight{{"bob"_n, config::eosio_code_name}, 1} ); - tester1.chain->push_action( N(eosio), N(updateauth), N(bob), mvo() + tester1.chain->push_action( "eosio"_n, "updateauth"_n, "bob"_n, mvo() ( "account", "bob" ) ( "permission", "active" ) ( "parent", "owner" ) @@ -450,9 +450,9 @@ BOOST_AUTO_TEST_CASE( actor_blacklist_inline_deferred ) { try { ); auth = authority(eosio::testing::base_tester::get_public_key(name("charlie"), "active")); - auth.accounts.push_back( permission_level_weight{{N(charlie), config::eosio_code_name}, 1} ); + auth.accounts.push_back( permission_level_weight{{"charlie"_n, config::eosio_code_name}, 1} ); - tester1.chain->push_action( N(eosio), N(updateauth), N(charlie), mvo() + tester1.chain->push_action( "eosio"_n, "updateauth"_n, "charlie"_n, mvo() ( "account", "charlie" ) ( "permission", "active" ) ( "parent", "owner" ) @@ -463,7 +463,7 @@ BOOST_AUTO_TEST_CASE( actor_blacklist_inline_deferred ) { try { tester1.shutdown(); - tester1.actor_blacklist = {N(bob)}; + tester1.actor_blacklist = {"bob"_n}; tester1.init(false); whitelist_blacklist_tester tester2; @@ -479,7 +479,7 @@ BOOST_AUTO_TEST_CASE( actor_blacklist_inline_deferred ) { try { if( !t || t->action_traces.size() == 0 ) return; const auto& act = t->action_traces[0].act; - if( act.account == N(eosio) && act.name == N(onblock) ) return; + if( act.account == "eosio"_n && act.name == "onblock"_n ) return; if( t->receipt && t->receipt->status == transaction_receipt::executed ) { wlog( "${trx_type} ${id} executed (first action is ${code}::${action})", @@ -493,7 +493,7 @@ BOOST_AUTO_TEST_CASE( actor_blacklist_inline_deferred ) { try { auto c1 = tester1.chain->control->applied_transaction.connect( log_trxs ); // Disallow inline actions authorized by actor in blacklist - BOOST_CHECK_EXCEPTION( tester1.chain->push_action( N(alice), N(inlinecall), N(alice), mvo() + BOOST_CHECK_EXCEPTION( tester1.chain->push_action( "alice"_n, "inlinecall"_n, "alice"_n, mvo() ( "contract", "alice" ) ( "authorizer", "bob" ) ( "payload", 10 ) ), @@ -506,7 +506,7 @@ BOOST_AUTO_TEST_CASE( actor_blacklist_inline_deferred ) { try { BOOST_REQUIRE_EQUAL(0u, num_deferred); // Schedule a deferred transaction authorized by charlie@active - tester1.chain->push_action( N(charlie), N(defercall), N(alice), mvo() + tester1.chain->push_action( "charlie"_n, "defercall"_n, "alice"_n, mvo() ( "payer", "alice" ) ( "sender_id", 0 ) ( "contract", "charlie" ) @@ -532,7 +532,7 @@ BOOST_AUTO_TEST_CASE( actor_blacklist_inline_deferred ) { try { tester1.shutdown(); - tester1.actor_blacklist = {N(bob), N(charlie)}; + tester1.actor_blacklist = {"bob"_n, "charlie"_n}; tester1.init(false); auto c2 = tester1.chain->control->applied_transaction.connect( log_trxs ); @@ -547,7 +547,7 @@ BOOST_AUTO_TEST_CASE( actor_blacklist_inline_deferred ) { try { // With charlie now in the actor blacklist, it is now not possible to schedule a deferred transaction authorized by charlie@active - BOOST_CHECK_EXCEPTION( tester1.chain->push_action( N(charlie), N(defercall), N(alice), mvo() + BOOST_CHECK_EXCEPTION( tester1.chain->push_action( "charlie"_n, "defercall"_n, "alice"_n, mvo() ( "payer", "alice" ) ( "sender_id", 1 ) ( "contract", "charlie" ) @@ -564,18 +564,18 @@ BOOST_AUTO_TEST_CASE( blacklist_sender_bypass ) { try { whitelist_blacklist_tester tester1; tester1.init(); tester1.chain->produce_blocks(); - tester1.chain->set_code( N(alice), contracts::deferred_test_wasm() ); - tester1.chain->set_abi( N(alice), contracts::deferred_test_abi().data() ); - tester1.chain->set_code( N(bob), contracts::deferred_test_wasm() ); - tester1.chain->set_abi( N(bob), contracts::deferred_test_abi().data() ); - tester1.chain->set_code( N(charlie), contracts::deferred_test_wasm() ); - tester1.chain->set_abi( N(charlie), contracts::deferred_test_abi().data() ); + tester1.chain->set_code( "alice"_n, contracts::deferred_test_wasm() ); + tester1.chain->set_abi( "alice"_n, contracts::deferred_test_abi().data() ); + tester1.chain->set_code( "bob"_n, contracts::deferred_test_wasm() ); + tester1.chain->set_abi( "bob"_n, contracts::deferred_test_abi().data() ); + tester1.chain->set_code( "charlie"_n, contracts::deferred_test_wasm() ); + tester1.chain->set_abi( "charlie"_n, contracts::deferred_test_abi().data() ); tester1.chain->produce_blocks(); auto auth = authority(eosio::testing::base_tester::get_public_key(name("alice"), "active")); - auth.accounts.push_back( permission_level_weight{{N(alice), config::eosio_code_name}, 1} ); + auth.accounts.push_back( permission_level_weight{{"alice"_n, config::eosio_code_name}, 1} ); - tester1.chain->push_action( N(eosio), N(updateauth), N(alice), mvo() + tester1.chain->push_action( "eosio"_n, "updateauth"_n, "alice"_n, mvo() ( "account", "alice" ) ( "permission", "active" ) ( "parent", "owner" ) @@ -583,9 +583,9 @@ BOOST_AUTO_TEST_CASE( blacklist_sender_bypass ) { try { ); auth = authority(eosio::testing::base_tester::get_public_key(name("bob"), "active")); - auth.accounts.push_back( permission_level_weight{{N(bob), config::eosio_code_name}, 1} ); + auth.accounts.push_back( permission_level_weight{{"bob"_n, config::eosio_code_name}, 1} ); - tester1.chain->push_action( N(eosio), N(updateauth), N(bob), mvo() + tester1.chain->push_action( "eosio"_n, "updateauth"_n, "bob"_n, mvo() ( "account", "bob" ) ( "permission", "active" ) ( "parent", "owner" ) @@ -593,9 +593,9 @@ BOOST_AUTO_TEST_CASE( blacklist_sender_bypass ) { try { ); auth = authority(eosio::testing::base_tester::get_public_key(name("charlie"), "active")); - auth.accounts.push_back( permission_level_weight{{N(charlie), config::eosio_code_name}, 1} ); + auth.accounts.push_back( permission_level_weight{{"charlie"_n, config::eosio_code_name}, 1} ); - tester1.chain->push_action( N(eosio), N(updateauth), N(charlie), mvo() + tester1.chain->push_action( "eosio"_n, "updateauth"_n, "charlie"_n, mvo() ( "account", "charlie" ) ( "permission", "active" ) ( "parent", "owner" ) @@ -606,18 +606,18 @@ BOOST_AUTO_TEST_CASE( blacklist_sender_bypass ) { try { tester1.shutdown(); - tester1.sender_bypass_whiteblacklist = {N(charlie)}; - tester1.actor_blacklist = {N(bob), N(charlie)}; + tester1.sender_bypass_whiteblacklist = {"charlie"_n}; + tester1.actor_blacklist = {"bob"_n, "charlie"_n}; tester1.init(false); - BOOST_CHECK_EXCEPTION( tester1.chain->push_action( N(bob), N(deferfunc), N(bob), mvo() + BOOST_CHECK_EXCEPTION( tester1.chain->push_action( "bob"_n, "deferfunc"_n, "bob"_n, mvo() ( "payload", 10 ) ), fc::exception, fc_exception_message_is("authorizing actor(s) in transaction are on the actor blacklist: [\"bob\"]") ); - BOOST_CHECK_EXCEPTION( tester1.chain->push_action( N(charlie), N(deferfunc), N(charlie), mvo() + BOOST_CHECK_EXCEPTION( tester1.chain->push_action( "charlie"_n, "deferfunc"_n, "charlie"_n, mvo() ( "payload", 10 ) ), fc::exception, fc_exception_message_is("authorizing actor(s) in transaction are on the actor blacklist: [\"charlie\"]") @@ -627,7 +627,7 @@ BOOST_AUTO_TEST_CASE( blacklist_sender_bypass ) { try { auto num_deferred = tester1.chain->control->db().get_index().size(); BOOST_REQUIRE_EQUAL(0, num_deferred); - BOOST_CHECK_EXCEPTION( tester1.chain->push_action( N(bob), N(defercall), N(alice), mvo() + BOOST_CHECK_EXCEPTION( tester1.chain->push_action( "bob"_n, "defercall"_n, "alice"_n, mvo() ( "payer", "alice" ) ( "sender_id", 0 ) ( "contract", "bob" ) @@ -640,7 +640,7 @@ BOOST_AUTO_TEST_CASE( blacklist_sender_bypass ) { try { BOOST_REQUIRE_EQUAL(0, num_deferred); // Schedule a deferred transaction authorized by charlie@active - tester1.chain->push_action( N(charlie), N(defercall), N(alice), mvo() + tester1.chain->push_action( "charlie"_n, "defercall"_n, "alice"_n, mvo() ( "payer", "alice" ) ( "sender_id", 0 ) ( "contract", "charlie" ) @@ -658,7 +658,7 @@ BOOST_AUTO_TEST_CASE( blacklist_sender_bypass ) { try { BOOST_REQUIRE_EQUAL(0, num_deferred); // Schedule another deferred transaction authorized by charlie@active - tester1.chain->push_action( N(charlie), N(defercall), N(alice), mvo() + tester1.chain->push_action( "charlie"_n, "defercall"_n, "alice"_n, mvo() ( "payer", "alice" ) ( "sender_id", 1 ) ( "contract", "bob" ) @@ -673,9 +673,9 @@ BOOST_AUTO_TEST_CASE( blacklist_sender_bypass ) { try { tester1.shutdown(); - tester1.sender_bypass_whiteblacklist = {N(charlie)}; - tester1.actor_blacklist = {N(bob), N(charlie)}; - tester1.contract_blacklist = {N(bob)}; // Add bob to the contract blacklist as well + tester1.sender_bypass_whiteblacklist = {"charlie"_n}; + tester1.actor_blacklist = {"bob"_n, "charlie"_n}; + tester1.contract_blacklist = {"bob"_n}; // Add bob to the contract blacklist as well tester1.init(false); num_deferred = tester1.chain->control->db().get_index().size(); @@ -688,7 +688,7 @@ BOOST_AUTO_TEST_CASE( blacklist_sender_bypass ) { try { num_deferred = tester1.chain->control->db().get_index().size(); BOOST_REQUIRE_EQUAL(0, num_deferred); - tester1.chain->push_action( N(alice), N(defercall), N(alice), mvo() + tester1.chain->push_action( "alice"_n, "defercall"_n, "alice"_n, mvo() ( "payer", "alice" ) ( "sender_id", 0 ) ( "contract", "bob" ) @@ -734,19 +734,19 @@ BOOST_AUTO_TEST_CASE( greylist_limit_tests ) { try { const resource_limits_manager& rm = c.control->get_resource_limits_manager(); - const auto& user_account = N(user); - const auto& other_account = N(other); + const auto& user_account = "user"_n; + const auto& other_account = "other"_n; c.create_accounts( {user_account, other_account} ); - c.push_action( config::system_account_name, N(setalimits), config::system_account_name, fc::mutable_variant_object() + c.push_action( config::system_account_name, "setalimits"_n, config::system_account_name, fc::mutable_variant_object() ("account", user_account) ("ram_bytes", -1) ("net_weight", 1) ("cpu_weight", 1) ); - c.push_action( config::system_account_name, N(setalimits), config::system_account_name, fc::mutable_variant_object() + c.push_action( config::system_account_name, "setalimits"_n, config::system_account_name, fc::mutable_variant_object() ("account", other_account) ("ram_bytes", -1) ("net_weight", 249'999'999) @@ -756,7 +756,7 @@ BOOST_AUTO_TEST_CASE( greylist_limit_tests ) { try { const uint64_t reqauth_net_charge = 104; auto push_reqauth = [&]( name acnt, name perm, uint32_t billed_cpu_time_us ) { signed_transaction trx; - trx.actions.emplace_back( c.get_action( config::system_account_name, N(reqauth), + trx.actions.emplace_back( c.get_action( config::system_account_name, "reqauth"_n, std::vector{{acnt, perm}}, fc::mutable_variant_object()("from", acnt) ) ); c.set_transaction_headers( trx, 6, 0 );