From bf84fc69fa9f24733a30d8b021489edcbb112f93 Mon Sep 17 00:00:00 2001 From: abitmore Date: Sat, 6 Mar 2021 00:21:59 +0000 Subject: [PATCH 01/14] Avoid potential object slicing at trx_message init --- libraries/app/application.cpp | 4 ++-- libraries/net/include/graphene/net/core_messages.hpp | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libraries/app/application.cpp b/libraries/app/application.cpp index 3a388befcd..b28fc7bb30 100644 --- a/libraries/app/application.cpp +++ b/libraries/app/application.cpp @@ -598,9 +598,9 @@ bool application_impl::handle_block(const graphene::net::block_message& blk_msg, // during sync, it is unlikely that we'll see any old contained_transaction_message_ids.reserve( contained_transaction_message_ids.size() + blk_msg.block.transactions.size() ); - for (const processed_transaction& transaction : blk_msg.block.transactions) + for (const processed_transaction& ptrx : blk_msg.block.transactions) { - graphene::net::trx_message transaction_message(transaction); + graphene::net::trx_message transaction_message(ptrx); contained_transaction_message_ids.emplace_back(graphene::net::message(transaction_message).id()); } } diff --git a/libraries/net/include/graphene/net/core_messages.hpp b/libraries/net/include/graphene/net/core_messages.hpp index 88d563e683..27607832de 100644 --- a/libraries/net/include/graphene/net/core_messages.hpp +++ b/libraries/net/include/graphene/net/core_messages.hpp @@ -96,8 +96,11 @@ namespace graphene { namespace net { graphene::protocol::precomputable_transaction trx; trx_message() {} - trx_message(graphene::protocol::signed_transaction transaction) : - trx(std::move(transaction)) + trx_message(const graphene::protocol::signed_transaction& signed_trx) : + trx(signed_trx) + {} + trx_message(graphene::protocol::signed_transaction&& signed_trx) : + trx(std::move(signed_trx)) {} }; From 8f013a16c59520b5904f98036f72abba8fa58936 Mon Sep 17 00:00:00 2001 From: abitmore Date: Sat, 6 Mar 2021 00:36:37 +0000 Subject: [PATCH 02/14] Change get_transaction_hex_without_sig param type Fixes an object slicing warning. --- libraries/app/database_api.cpp | 6 +++--- libraries/app/database_api_impl.hxx | 2 +- libraries/app/include/graphene/app/database_api.hpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index 45b9445fd2..16e0ae97c4 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -2409,15 +2409,15 @@ std::string database_api_impl::get_transaction_hex(const signed_transaction& trx } std::string database_api::get_transaction_hex_without_sig( - const signed_transaction &trx) const + const transaction &trx) const { return my->get_transaction_hex_without_sig(trx); } std::string database_api_impl::get_transaction_hex_without_sig( - const signed_transaction &trx) const + const transaction &trx) const { - return fc::to_hex(fc::raw::pack(static_cast(trx))); + return fc::to_hex(fc::raw::pack(trx)); } set database_api::get_required_signatures( const signed_transaction& trx, diff --git a/libraries/app/database_api_impl.hxx b/libraries/app/database_api_impl.hxx index 36379ae8de..4aff5ccb33 100644 --- a/libraries/app/database_api_impl.hxx +++ b/libraries/app/database_api_impl.hxx @@ -203,7 +203,7 @@ class database_api_impl : public std::enable_shared_from_this // Authority / validation std::string get_transaction_hex(const signed_transaction& trx)const; - std::string get_transaction_hex_without_sig(const signed_transaction& trx)const; + std::string get_transaction_hex_without_sig(const transaction& trx)const; set get_required_signatures( const signed_transaction& trx, const flat_set& available_keys )const; diff --git a/libraries/app/include/graphene/app/database_api.hpp b/libraries/app/include/graphene/app/database_api.hpp index 86b44e3cb9..dff253c99b 100644 --- a/libraries/app/include/graphene/app/database_api.hpp +++ b/libraries/app/include/graphene/app/database_api.hpp @@ -915,7 +915,7 @@ class database_api * @param trx a transaction to get hexdump from * @return the hexdump of the transaction without the signatures */ - std::string get_transaction_hex_without_sig( const signed_transaction &trx ) const; + std::string get_transaction_hex_without_sig( const transaction &trx ) const; /** * This API will take a partially signed transaction and a set of public keys that the owner From 921bf82273e40319f58e0126bd2d04bb7ae38cab Mon Sep 17 00:00:00 2001 From: abitmore Date: Sat, 6 Mar 2021 00:54:23 +0000 Subject: [PATCH 03/14] Fix object slicing warnings in wallet*.cpp --- libraries/wallet/wallet_asset.cpp | 4 ++-- libraries/wallet/wallet_results.cpp | 8 ++++---- libraries/wallet/wallet_transfer.cpp | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libraries/wallet/wallet_asset.cpp b/libraries/wallet/wallet_asset.cpp index 36bef268da..a73755750c 100644 --- a/libraries/wallet/wallet_asset.cpp +++ b/libraries/wallet/wallet_asset.cpp @@ -225,7 +225,7 @@ namespace graphene { namespace wallet { namespace detail { optional asset_to_fund = find_asset(symbol); if (!asset_to_fund) FC_THROW("No asset with that symbol exists!"); - asset_object core_asset = get_asset(asset_id_type()); + auto core_asset = get_asset(asset_id_type()); asset_fund_fee_pool_operation fund_op; fund_op.from_account = from_account.id; @@ -246,7 +246,7 @@ namespace graphene { namespace wallet { namespace detail { optional asset_pool_to_claim = find_asset(symbol); if (!asset_pool_to_claim) FC_THROW("No asset with that symbol exists!"); - asset_object core_asset = get_asset(asset_id_type()); + auto core_asset = get_asset(asset_id_type()); asset_claim_pool_operation claim_op; claim_op.issuer = asset_pool_to_claim->issuer; diff --git a/libraries/wallet/wallet_results.cpp b/libraries/wallet/wallet_results.cpp index 6dd31a3dcb..f3f4df221a 100644 --- a/libraries/wallet/wallet_results.cpp +++ b/libraries/wallet/wallet_results.cpp @@ -138,7 +138,7 @@ std::map> wallet_a ss << "\n"; for( const auto& out : r.outputs ) { - asset_object a = get_asset( out.decrypted_memo.amount.asset_id ); + auto a = get_asset( out.decrypted_memo.amount.asset_id ); ss << a.amount_to_pretty_string( out.decrypted_memo.amount ) << " to " << out.label << "\n\t receipt: " << out.confirmation_receipt << "\n\n"; } @@ -152,7 +152,7 @@ std::map> wallet_a ss << "\n"; for( const auto& out : r.outputs ) { - asset_object a = get_asset( out.decrypted_memo.amount.asset_id ); + auto a = get_asset( out.decrypted_memo.amount.asset_id ); ss << a.amount_to_pretty_string( out.decrypted_memo.amount ) << " to " << out.label << "\n\t receipt: " << out.confirmation_receipt << "\n\n"; } @@ -162,7 +162,7 @@ std::map> wallet_a { auto r = result.as( GRAPHENE_MAX_NESTED_OBJECTS ); std::stringstream ss; - asset_object as = get_asset( r.amount.asset_id ); + auto as = get_asset( r.amount.asset_id ); ss << as.amount_to_pretty_string( r.amount ) << " " << r.from_label << " => " << r.to_label << " " << r.memo <<"\n"; return ss.str(); @@ -176,7 +176,7 @@ std::map> wallet_a ss << "====================================================================================\n"; for( auto& r : records ) { - asset_object as = get_asset( r.amount.asset_id ); + auto as = get_asset( r.amount.asset_id ); ss << fc::get_approximate_relative_time_string( r.date ) << " " << as.amount_to_pretty_string( r.amount ) << " " << r.from_label << " => " << r.to_label << " " << r.memo <<"\n"; diff --git a/libraries/wallet/wallet_transfer.cpp b/libraries/wallet/wallet_transfer.cpp index 57a8ae4960..56cd7c75c9 100644 --- a/libraries/wallet/wallet_transfer.cpp +++ b/libraries/wallet/wallet_transfer.cpp @@ -210,9 +210,9 @@ namespace graphene { namespace wallet { namespace detail { string asset_symbol, string amount_of_collateral, bool broadcast ) { account_object seller = get_account(seller_name); - asset_object mia = get_asset(asset_symbol); + auto mia = get_asset(asset_symbol); FC_ASSERT(mia.is_market_issued()); - asset_object collateral = get_asset(get_object(*mia.bitasset_data_id).options.short_backing_asset); + auto collateral = get_asset(get_object(*mia.bitasset_data_id).options.short_backing_asset); call_order_update_operation op; op.funding_account = seller.id; @@ -232,9 +232,9 @@ namespace graphene { namespace wallet { namespace detail { call_order_update_operation::extensions_type extensions, bool broadcast ) { account_object seller = get_account(seller_name); - asset_object mia = get_asset(asset_symbol); + auto mia = get_asset(asset_symbol); FC_ASSERT(mia.is_market_issued()); - asset_object collateral = get_asset(get_object(*mia.bitasset_data_id).options.short_backing_asset); + auto collateral = get_asset(get_object(*mia.bitasset_data_id).options.short_backing_asset); call_order_update_operation op; op.funding_account = seller.id; @@ -268,7 +268,7 @@ namespace graphene { namespace wallet { namespace detail { signed_transaction wallet_api_impl::withdraw_vesting( string witness_name, string amount, string asset_symbol, bool broadcast ) { try { - asset_object asset_obj = get_asset( asset_symbol ); + auto asset_obj = get_asset( asset_symbol ); fc::optional vbid = maybe_id(witness_name); if( !vbid ) { From bd0d891f8fa2f39bb0306532bc8181772b3ff53d Mon Sep 17 00:00:00 2001 From: Abit Date: Sat, 6 Mar 2021 05:43:33 +0100 Subject: [PATCH 04/14] Fix duplicate code in CLI borrow_asset command by calling borrow_asset_ext(...) directly. --- libraries/wallet/wallet_transfer.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/libraries/wallet/wallet_transfer.cpp b/libraries/wallet/wallet_transfer.cpp index 56cd7c75c9..524764500e 100644 --- a/libraries/wallet/wallet_transfer.cpp +++ b/libraries/wallet/wallet_transfer.cpp @@ -209,22 +209,8 @@ namespace graphene { namespace wallet { namespace detail { signed_transaction wallet_api_impl::borrow_asset(string seller_name, string amount_to_borrow, string asset_symbol, string amount_of_collateral, bool broadcast ) { - account_object seller = get_account(seller_name); - auto mia = get_asset(asset_symbol); - FC_ASSERT(mia.is_market_issued()); - auto collateral = get_asset(get_object(*mia.bitasset_data_id).options.short_backing_asset); - - call_order_update_operation op; - op.funding_account = seller.id; - op.delta_debt = mia.amount_from_string(amount_to_borrow); - op.delta_collateral = collateral.amount_from_string(amount_of_collateral); - - signed_transaction trx; - trx.operations = {op}; - set_operation_fees( trx, _remote_db->get_global_properties().parameters.get_current_fees()); - trx.validate(); - - return sign_transaction(trx, broadcast); + return borrow_asset_ext( seller_name, amount_to_borrow, asset_symbol, amount_of_collateral, + {}, broadcast ); } signed_transaction wallet_api_impl::borrow_asset_ext( string seller_name, string amount_to_borrow, From fbb4893c4ecc9dfed911d0df803cb4638e590ef3 Mon Sep 17 00:00:00 2001 From: abitmore Date: Sat, 6 Mar 2021 13:09:03 -0500 Subject: [PATCH 05/14] Fix code smells in net/core_messages.hpp --- libraries/net/include/graphene/net/core_messages.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/net/include/graphene/net/core_messages.hpp b/libraries/net/include/graphene/net/core_messages.hpp index 27607832de..4e686e4513 100644 --- a/libraries/net/include/graphene/net/core_messages.hpp +++ b/libraries/net/include/graphene/net/core_messages.hpp @@ -95,12 +95,12 @@ namespace graphene { namespace net { static const core_message_type_enum type; graphene::protocol::precomputable_transaction trx; - trx_message() {} - trx_message(const graphene::protocol::signed_transaction& signed_trx) : + trx_message() = default; + explicit trx_message(const graphene::protocol::signed_transaction& signed_trx) : trx(signed_trx) {} - trx_message(graphene::protocol::signed_transaction&& signed_trx) : - trx(std::move(signed_trx)) + explicit trx_message(graphene::protocol::signed_transaction&& signed_trx) : + trx(signed_trx) {} }; From 988c19f8efb76816d0268c4568b317ab9ba39a5d Mon Sep 17 00:00:00 2001 From: abitmore Date: Sat, 6 Mar 2021 13:23:10 -0500 Subject: [PATCH 06/14] Fix duplicate code in wallet_results.cpp --- libraries/wallet/wallet_results.cpp | 61 +++++++---------------------- 1 file changed, 14 insertions(+), 47 deletions(-) diff --git a/libraries/wallet/wallet_results.cpp b/libraries/wallet/wallet_results.cpp index f3f4df221a..8912d0354c 100644 --- a/libraries/wallet/wallet_results.cpp +++ b/libraries/wallet/wallet_results.cpp @@ -30,6 +30,7 @@ namespace graphene { namespace wallet { namespace detail { std::map> wallet_api_impl::get_result_formatters() const { std::map > m; + m["help"] = [](variant result, const fc::variants& a) { return result.get_string(); @@ -40,7 +41,7 @@ std::map> wallet_a return result.get_string(); }; - m["get_account_history"] = [this](variant result, const fc::variants& a) + auto format_account_history = [this](variant result, const fc::variants& a) { auto r = result.as>( GRAPHENE_MAX_NESTED_OBJECTS ); std::stringstream ss; @@ -58,24 +59,9 @@ std::map> wallet_a return ss.str(); }; - m["get_relative_account_history"] = [this](variant result, const fc::variants& a) - { - auto r = result.as>( GRAPHENE_MAX_NESTED_OBJECTS ); - std::stringstream ss; - for( operation_detail& d : r ) - { - operation_history_object& i = d.op; - auto b = _remote_db->get_block_header(i.block_num); - FC_ASSERT(b); - ss << i.block_num << " "; - ss << b->timestamp.to_iso_string() << " "; - i.op.visit(operation_printer(ss, *this, i)); - ss << " \n"; - } - - return ss.str(); - }; + m["get_account_history"] = format_account_history; + m["get_relative_account_history"] = format_account_history; m["get_account_history_by_operations"] = [this](variant result, const fc::variants& a) { auto r = result.as( GRAPHENE_MAX_NESTED_OBJECTS ); @@ -101,7 +87,7 @@ std::map> wallet_a return ss.str(); }; - m["list_account_balances"] = [this](variant result, const fc::variants& a) + auto format_balances = [this](variant result, const fc::variants& a) { auto r = result.as>( GRAPHENE_MAX_NESTED_OBJECTS ); vector asset_recs; @@ -116,35 +102,10 @@ std::map> wallet_a return ss.str(); }; - m["get_blind_balances"] = [this](variant result, const fc::variants& a) - { - auto r = result.as>( GRAPHENE_MAX_NESTED_OBJECTS ); - vector asset_recs; - std::transform(r.begin(), r.end(), std::back_inserter(asset_recs), [this](const asset& a) { - return get_asset(a.asset_id); - }); - - std::stringstream ss; - for( unsigned i = 0; i < asset_recs.size(); ++i ) - ss << asset_recs[i].amount_to_pretty_string(r[i]) << "\n"; + m["list_account_balances"] = format_balances; + m["get_blind_balances"] = format_balances; - return ss.str(); - }; - m["transfer_to_blind"] = [this](variant result, const fc::variants& a) - { - auto r = result.as( GRAPHENE_MAX_NESTED_OBJECTS ); - std::stringstream ss; - r.trx.operations[0].visit( operation_printer( ss, *this, operation_history_object() ) ); - ss << "\n"; - for( const auto& out : r.outputs ) - { - auto a = get_asset( out.decrypted_memo.amount.asset_id ); - ss << a.amount_to_pretty_string( out.decrypted_memo.amount ) << " to " << out.label - << "\n\t receipt: " << out.confirmation_receipt << "\n\n"; - } - return ss.str(); - }; - m["blind_transfer"] = [this](variant result, const fc::variants& a) + auto format_blind_transfers = [this](variant result, const fc::variants& a) { auto r = result.as( GRAPHENE_MAX_NESTED_OBJECTS ); std::stringstream ss; @@ -158,6 +119,10 @@ std::map> wallet_a } return ss.str(); }; + + m["transfer_to_blind"] = format_blind_transfers; + m["blind_transfer"] = format_blind_transfers; + m["receive_blind_transfer"] = [this](variant result, const fc::variants& a) { auto r = result.as( GRAPHENE_MAX_NESTED_OBJECTS ); @@ -167,6 +132,7 @@ std::map> wallet_a << r.to_label << " " << r.memo <<"\n"; return ss.str(); }; + m["blind_history"] = [this](variant result, const fc::variants& a) { auto records = result.as>( GRAPHENE_MAX_NESTED_OBJECTS ); @@ -183,6 +149,7 @@ std::map> wallet_a } return ss.str(); }; + m["get_order_book"] = [](variant result, const fc::variants& a) { auto orders = result.as( GRAPHENE_MAX_NESTED_OBJECTS ); From 519350d848b6395206e570fa5a10769fb63fb8e3 Mon Sep 17 00:00:00 2001 From: abitmore Date: Sat, 6 Mar 2021 16:22:59 -0500 Subject: [PATCH 07/14] Remove an unnecessary constructor from trx_message --- libraries/net/include/graphene/net/core_messages.hpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/libraries/net/include/graphene/net/core_messages.hpp b/libraries/net/include/graphene/net/core_messages.hpp index 4e686e4513..e270dbb249 100644 --- a/libraries/net/include/graphene/net/core_messages.hpp +++ b/libraries/net/include/graphene/net/core_messages.hpp @@ -99,9 +99,6 @@ namespace graphene { namespace net { explicit trx_message(const graphene::protocol::signed_transaction& signed_trx) : trx(signed_trx) {} - explicit trx_message(graphene::protocol::signed_transaction&& signed_trx) : - trx(signed_trx) - {} }; struct block_message From f6bacde0279b9d1d633f452ee76cf5f8d62b2ab9 Mon Sep 17 00:00:00 2001 From: abitmore Date: Sat, 6 Mar 2021 16:37:09 -0500 Subject: [PATCH 08/14] Make unused parameters unnamed, fix code smells --- libraries/wallet/wallet_results.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libraries/wallet/wallet_results.cpp b/libraries/wallet/wallet_results.cpp index 8912d0354c..b8116195d0 100644 --- a/libraries/wallet/wallet_results.cpp +++ b/libraries/wallet/wallet_results.cpp @@ -31,17 +31,17 @@ std::map> wallet_a { std::map > m; - m["help"] = [](variant result, const fc::variants& a) + m["help"] = [](variant result, const fc::variants&) { return result.get_string(); }; - m["gethelp"] = [](variant result, const fc::variants& a) + m["gethelp"] = [](variant result, const fc::variants&) { return result.get_string(); }; - auto format_account_history = [this](variant result, const fc::variants& a) + auto format_account_history = [this](variant result, const fc::variants&) { auto r = result.as>( GRAPHENE_MAX_NESTED_OBJECTS ); std::stringstream ss; @@ -63,7 +63,7 @@ std::map> wallet_a m["get_account_history"] = format_account_history; m["get_relative_account_history"] = format_account_history; - m["get_account_history_by_operations"] = [this](variant result, const fc::variants& a) { + m["get_account_history_by_operations"] = [this](variant result, const fc::variants&) { auto r = result.as( GRAPHENE_MAX_NESTED_OBJECTS ); std::stringstream ss; ss << "total_count : "; @@ -87,7 +87,7 @@ std::map> wallet_a return ss.str(); }; - auto format_balances = [this](variant result, const fc::variants& a) + auto format_balances = [this](variant result, const fc::variants&) { auto r = result.as>( GRAPHENE_MAX_NESTED_OBJECTS ); vector asset_recs; @@ -105,7 +105,7 @@ std::map> wallet_a m["list_account_balances"] = format_balances; m["get_blind_balances"] = format_balances; - auto format_blind_transfers = [this](variant result, const fc::variants& a) + auto format_blind_transfers = [this](variant result, const fc::variants&) { auto r = result.as( GRAPHENE_MAX_NESTED_OBJECTS ); std::stringstream ss; @@ -123,7 +123,7 @@ std::map> wallet_a m["transfer_to_blind"] = format_blind_transfers; m["blind_transfer"] = format_blind_transfers; - m["receive_blind_transfer"] = [this](variant result, const fc::variants& a) + m["receive_blind_transfer"] = [this](variant result, const fc::variants&) { auto r = result.as( GRAPHENE_MAX_NESTED_OBJECTS ); std::stringstream ss; @@ -133,7 +133,7 @@ std::map> wallet_a return ss.str(); }; - m["blind_history"] = [this](variant result, const fc::variants& a) + m["blind_history"] = [this](variant result, const fc::variants&) { auto records = result.as>( GRAPHENE_MAX_NESTED_OBJECTS ); std::stringstream ss; @@ -150,7 +150,7 @@ std::map> wallet_a return ss.str(); }; - m["get_order_book"] = [](variant result, const fc::variants& a) + m["get_order_book"] = [](variant result, const fc::variants&) { auto orders = result.as( GRAPHENE_MAX_NESTED_OBJECTS ); auto bids = orders.bids; @@ -238,7 +238,7 @@ std::map> wallet_a return ss.str(); }; - m["sign_message"] = [](variant result, const fc::variants& a) + m["sign_message"] = [](variant result, const fc::variants&) { auto r = result.as( GRAPHENE_MAX_NESTED_OBJECTS ); From 6ebdbfa489d3f9a295cd248bbdcd5df6d32d8ca0 Mon Sep 17 00:00:00 2001 From: abitmore Date: Sat, 6 Mar 2021 19:29:50 -0500 Subject: [PATCH 09/14] Fix SonarScanner coverage report by checking more directories with gcov --- .github/workflows/sonar-scan.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sonar-scan.yml b/.github/workflows/sonar-scan.yml index f9e07e8c0c..3236d95a55 100644 --- a/.github/workflows/sonar-scan.yml +++ b/.github/workflows/sonar-scan.yml @@ -129,7 +129,10 @@ jobs: - name: Prepare for scanning with SonarScanner run: | mkdir -p sonar_cache - find _build/libraries/[acdenptuw]*/CMakeFiles/*.dir _build/programs/[cdgjsw]*/CMakeFiles/*.dir -type d -print \ + find _build/libraries/[acdenptuw]*/CMakeFiles/*.dir \ + _build/libraries/plugins/*/CMakeFiles/*.dir \ + _build/programs/[cdgjsw]*/CMakeFiles/*.dir \ + -type d -print \ | while read d; do srcd="${d:7}"; gcov -o "$d" "${srcd/CMakeFiles*.dir/.}"/*.cpp; done >/dev/null programs/build_helpers/set_sonar_branch_for_github_actions sonar-project.properties - name: Scan with SonarScanner From 4b169408f7ef797d991429c70e87bea91e33fd0d Mon Sep 17 00:00:00 2001 From: abitmore Date: Sat, 6 Mar 2021 21:59:40 -0500 Subject: [PATCH 10/14] Add CLI tests for some MPA commands --- tests/cli/main.cpp | 122 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 121 insertions(+), 1 deletion(-) diff --git a/tests/cli/main.cpp b/tests/cli/main.cpp index 91c0af7cc6..8c1cb2731c 100644 --- a/tests/cli/main.cpp +++ b/tests/cli/main.cpp @@ -431,6 +431,126 @@ BOOST_FIXTURE_TEST_CASE( create_new_account, cli_fixture ) } } +BOOST_FIXTURE_TEST_CASE( mpa_tests, cli_fixture ) +{ + try + { + BOOST_TEST_MESSAGE("Cli MPA Tests"); + + INVOKE(upgrade_nathan_account); + + account_object nathan_acct = con.wallet_api_ptr->get_account("nathan"); + + // Create new asset called BOBCOIN backed by CORE + try + { + BOOST_TEST_MESSAGE("Create MPA 'BOBCOIN'"); + graphene::chain::asset_options asset_ops; + asset_ops.issuer_permissions = ASSET_ISSUER_PERMISSION_ENABLE_BITS_MASK; + asset_ops.flags = charge_market_fee; + asset_ops.max_supply = 1000000; + asset_ops.core_exchange_rate = price(asset(2),asset(1,asset_id_type(1))); + graphene::chain::bitasset_options bit_opts; + con.wallet_api_ptr->create_asset("nathan", "BOBCOIN", 4, asset_ops, bit_opts, true); + } + catch(exception& e) + { + BOOST_FAIL(e.what()); + } + catch(...) + { + BOOST_FAIL("Unknown exception creating BOBCOIN"); + } + + auto bobcoin = con.wallet_api_ptr->get_asset("BOBCOIN"); + { + // Play with asset fee pool + auto objs = con.wallet_api_ptr->get_object( bobcoin.dynamic_asset_data_id ) + .as>( FC_PACK_MAX_DEPTH ); + idump( (objs) ); + BOOST_REQUIRE_EQUAL( objs.size(), 1u ); + asset_dynamic_data_object bobcoin_dyn = objs[0]; + idump( (bobcoin_dyn) ); + share_type old_pool = bobcoin_dyn.fee_pool; + + BOOST_TEST_MESSAGE("Fund fee pool"); + con.wallet_api_ptr->fund_asset_fee_pool("nathan", "BOBCOIN", "2", true); + objs = con.wallet_api_ptr->get_object( bobcoin.dynamic_asset_data_id ) + .as>( FC_PACK_MAX_DEPTH ); + BOOST_REQUIRE_EQUAL( objs.size(), 1u ); + bobcoin_dyn = objs[0]; + share_type funded_pool = bobcoin_dyn.fee_pool; + BOOST_CHECK_EQUAL( funded_pool.value, old_pool.value + GRAPHENE_BLOCKCHAIN_PRECISION * 2 ); + + BOOST_TEST_MESSAGE("Claim fee pool"); + con.wallet_api_ptr->claim_asset_fee_pool("BOBCOIN", "1", true); + objs = con.wallet_api_ptr->get_object( bobcoin.dynamic_asset_data_id ) + .as>( FC_PACK_MAX_DEPTH ); + BOOST_REQUIRE_EQUAL( objs.size(), 1u ); + bobcoin_dyn = objs[0]; + share_type claimed_pool = bobcoin_dyn.fee_pool; + BOOST_CHECK_EQUAL( claimed_pool.value, old_pool.value + GRAPHENE_BLOCKCHAIN_PRECISION ); + } + + { + // Set price feed producer + BOOST_TEST_MESSAGE("Set price feed producer"); + asset_bitasset_data_object bob_bitasset = con.wallet_api_ptr->get_bitasset_data( "BOBCOIN" ); + BOOST_CHECK_EQUAL( bob_bitasset.feeds.size(), 0u ); + + auto handle = con.wallet_api_ptr->begin_builder_transaction(); + asset_update_feed_producers_operation aufp_op; + aufp_op.issuer = nathan_acct.id; + aufp_op.asset_to_update = bobcoin.id; + aufp_op.new_feed_producers = { nathan_acct.id }; + con.wallet_api_ptr->add_operation_to_builder_transaction( handle, aufp_op ); + con.wallet_api_ptr->set_fees_on_builder_transaction( handle, "1.3.0" ); + con.wallet_api_ptr->sign_builder_transaction( handle, true ); + + bob_bitasset = con.wallet_api_ptr->get_bitasset_data( "BOBCOIN" ); + BOOST_CHECK_EQUAL( bob_bitasset.feeds.size(), 1u ); + BOOST_CHECK( bob_bitasset.current_feed.settlement_price.is_null() ); + } + + { + // Publish price feed + BOOST_TEST_MESSAGE("Publish price feed"); + price_feed feed; + feed.settlement_price = price( asset(1,bobcoin.id), asset(2) ); + feed.core_exchange_rate = price( asset(1,bobcoin.id), asset(1) ); + con.wallet_api_ptr->publish_asset_feed( "nathan", "BOBCOIN", feed, true ); + asset_bitasset_data_object bob_bitasset = con.wallet_api_ptr->get_bitasset_data( "BOBCOIN" ); + BOOST_CHECK( bob_bitasset.current_feed.settlement_price == feed.settlement_price ); + } + + { + // Borrow + BOOST_TEST_MESSAGE("Borrow BOBCOIN"); + auto calls = con.wallet_api_ptr->get_call_orders( "BOBCOIN", 10 ); + BOOST_CHECK_EQUAL( calls.size(), 0u ); + con.wallet_api_ptr->borrow_asset( "nathan", "1", "BOBCOIN", "10", true ); + calls = con.wallet_api_ptr->get_call_orders( "BOBCOIN", 10 ); + BOOST_CHECK_EQUAL( calls.size(), 1u ); + + auto nathan_balances = con.wallet_api_ptr->list_account_balances( "nathan" ); + size_t count = 0; + for( auto& bal : nathan_balances ) + { + if( bal.asset_id == bobcoin.id ) + { + ++count; + BOOST_CHECK_EQUAL( bal.amount.value, 10000 ); + } + } + BOOST_CHECK_EQUAL(count, 1u); + } + + } catch( fc::exception& e ) { + edump((e.to_detail_string())); + throw; + } +} + /////////////////////// // Start a server and connect using the same calls as the CLI // Vote for two witnesses, and make sure they both stay there @@ -800,7 +920,7 @@ BOOST_FIXTURE_TEST_CASE( cli_confidential_tx_test, cli_fixture ) std::map to_list = {{"alice",100000000000}, {"bob", 1000000000}}; vector bconfs; - asset_object core_asset = W.get_asset("1.3.0"); + auto core_asset = W.get_asset("1.3.0"); BOOST_TEST_MESSAGE("Sending blind transactions to alice and bob"); for (auto to : to_list) { string amount = core_asset.amount_to_string(to.second); From a298068def967956ed64fb858282bad145376e7e Mon Sep 17 00:00:00 2001 From: abitmore Date: Sat, 6 Mar 2021 22:01:04 -0500 Subject: [PATCH 11/14] Remove trailing whitespaces --- tests/cli/main.cpp | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/cli/main.cpp b/tests/cli/main.cpp index 8c1cb2731c..d5e44b3ebb 100644 --- a/tests/cli/main.cpp +++ b/tests/cli/main.cpp @@ -159,7 +159,7 @@ std::shared_ptr start_application(fc::temp_directory /// @param returned_block the signed block /// @returns true on success /////////// -bool generate_block(std::shared_ptr app, graphene::chain::signed_block& returned_block) +bool generate_block(std::shared_ptr app, graphene::chain::signed_block& returned_block) { try { fc::ecc::private_key committee_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("nathan"))); @@ -787,8 +787,8 @@ BOOST_FIXTURE_TEST_CASE( cli_get_available_transaction_signers, cli_fixture ) trx.sign( privkey_2, con.wallet_data.chain_id ); // verify expected result - flat_set expected_signers = {test_bki.pub_key, - privkey_1.get_public_key(), + flat_set expected_signers = {test_bki.pub_key, + privkey_1.get_public_key(), privkey_2.get_public_key()}; auto signers = con.wallet_api_ptr->get_transaction_signers(trx); @@ -836,7 +836,7 @@ BOOST_FIXTURE_TEST_CASE( cli_cant_get_signers_from_modified_transaction, cli_fix // modify transaction (MITM-attack) trx.operations.clear(); - // verify if transaction has no valid signature of test account + // verify if transaction has no valid signature of test account flat_set expected_signers_of_valid_transaction = {test_bki.pub_key}; auto signers = con.wallet_api_ptr->get_transaction_signers(trx); BOOST_CHECK(signers != expected_signers_of_valid_transaction); @@ -879,10 +879,10 @@ BOOST_FIXTURE_TEST_CASE( cli_confidential_tx_test, cli_fixture ) try { // we need to increase the default max transaction size to run this test. this->app1->chain_database()->modify( - this->app1->chain_database()->get_global_properties(), + this->app1->chain_database()->get_global_properties(), []( global_property_object& p) { p.parameters.maximum_transaction_size = 8192; - }); + }); std::vector import_txs; BOOST_TEST_MESSAGE("Importing nathan's balance"); @@ -1219,7 +1219,7 @@ BOOST_AUTO_TEST_CASE( cli_create_htlc ) BOOST_CHECK(nathan_acct_after_upgrade.is_lifetime_member()); // Create new asset called BOBCOIN - try + try { graphene::chain::asset_options asset_ops; asset_ops.max_supply = 1000000; @@ -1240,12 +1240,12 @@ BOOST_AUTO_TEST_CASE( cli_create_htlc ) { graphene::wallet::brain_key_info bki = con.wallet_api_ptr->suggest_brain_key(); BOOST_CHECK(!bki.brain_priv_key.empty()); - signed_transaction create_acct_tx = con.wallet_api_ptr->create_account_with_brain_key(bki.brain_priv_key, "alice", + signed_transaction create_acct_tx = con.wallet_api_ptr->create_account_with_brain_key(bki.brain_priv_key, "alice", "nathan", "nathan", true); con.wallet_api_ptr->save_wallet_file(con.wallet_filename); // attempt to give alice some bitshares BOOST_TEST_MESSAGE("Transferring bitshares from Nathan to alice"); - signed_transaction transfer_tx = con.wallet_api_ptr->transfer("nathan", "alice", "10000", "1.3.0", + signed_transaction transfer_tx = con.wallet_api_ptr->transfer("nathan", "alice", "10000", "1.3.0", "Here are some CORE token for your new account", true); } @@ -1253,13 +1253,13 @@ BOOST_AUTO_TEST_CASE( cli_create_htlc ) { graphene::wallet::brain_key_info bki = con.wallet_api_ptr->suggest_brain_key(); BOOST_CHECK(!bki.brain_priv_key.empty()); - signed_transaction create_acct_tx = con.wallet_api_ptr->create_account_with_brain_key(bki.brain_priv_key, "bob", + signed_transaction create_acct_tx = con.wallet_api_ptr->create_account_with_brain_key(bki.brain_priv_key, "bob", "nathan", "nathan", true); // this should cause resync which will import the keys of alice and bob generate_block(app1); // attempt to give bob some bitshares BOOST_TEST_MESSAGE("Transferring bitshares from Nathan to Bob"); - signed_transaction transfer_tx = con.wallet_api_ptr->transfer("nathan", "bob", "10000", "1.3.0", + signed_transaction transfer_tx = con.wallet_api_ptr->transfer("nathan", "bob", "10000", "1.3.0", "Here are some CORE token for your new account", true); con.wallet_api_ptr->issue_asset("bob", "5", "BOBCOIN", "Here are your BOBCOINs", true); } @@ -1278,8 +1278,8 @@ BOOST_AUTO_TEST_CASE( cli_create_htlc ) std::string hash_str = ss.str(); BOOST_TEST_MESSAGE("Secret is " + preimage_string + " and hash is " + hash_str); uint32_t timelock = fc::days(1).to_seconds(); - graphene::chain::signed_transaction result_tx - = con.wallet_api_ptr->htlc_create("alice", "bob", + graphene::chain::signed_transaction result_tx + = con.wallet_api_ptr->htlc_create("alice", "bob", "3", "1.3.0", "SHA256", hash_str, preimage_string.size(), timelock, "", true); // normally, a wallet would watch block production, and find the transaction. Here, we can cheat: @@ -1746,13 +1746,13 @@ BOOST_AUTO_TEST_CASE( cli_create_htlc_bsip64 ) account_object nathan_acct_after_upgrade = con.wallet_api_ptr->get_account("nathan"); // verify that the upgrade was successful - BOOST_CHECK_PREDICATE( std::not_equal_to(), + BOOST_CHECK_PREDICATE( std::not_equal_to(), (nathan_acct_before_upgrade.membership_expiration_date.sec_since_epoch()) (nathan_acct_after_upgrade.membership_expiration_date.sec_since_epoch()) ); BOOST_CHECK(nathan_acct_after_upgrade.is_lifetime_member()); // Create new asset called BOBCOIN - try + try { graphene::chain::asset_options asset_ops; asset_ops.max_supply = 1000000; @@ -1778,7 +1778,7 @@ BOOST_AUTO_TEST_CASE( cli_create_htlc_bsip64 ) con.wallet_api_ptr->save_wallet_file(con.wallet_filename); // attempt to give alice some bitshares BOOST_TEST_MESSAGE("Transferring bitshares from Nathan to alice"); - signed_transaction transfer_tx = con.wallet_api_ptr->transfer("nathan", "alice", "10000", "1.3.0", + signed_transaction transfer_tx = con.wallet_api_ptr->transfer("nathan", "alice", "10000", "1.3.0", "Here are some CORE token for your new account", true); } @@ -1792,7 +1792,7 @@ BOOST_AUTO_TEST_CASE( cli_create_htlc_bsip64 ) generate_block(app1); // attempt to give bob some bitshares BOOST_TEST_MESSAGE("Transferring bitshares from Nathan to Bob"); - signed_transaction transfer_tx = con.wallet_api_ptr->transfer("nathan", "bob", "10000", "1.3.0", + signed_transaction transfer_tx = con.wallet_api_ptr->transfer("nathan", "bob", "10000", "1.3.0", "Here are some CORE token for your new account", true); con.wallet_api_ptr->issue_asset("bob", "5", "BOBCOIN", "Here are your BOBCOINs", true); } @@ -1811,8 +1811,8 @@ BOOST_AUTO_TEST_CASE( cli_create_htlc_bsip64 ) std::string hash_str = ss.str(); BOOST_TEST_MESSAGE("Secret is " + preimage_string + " and hash is " + hash_str); uint32_t timelock = fc::days(1).to_seconds(); - graphene::chain::signed_transaction result_tx - = con.wallet_api_ptr->htlc_create("alice", "bob", + graphene::chain::signed_transaction result_tx + = con.wallet_api_ptr->htlc_create("alice", "bob", "3", "1.3.0", "HASH160", hash_str, preimage_string.size(), timelock, "Alice to Bob", true); // normally, a wallet would watch block production, and find the transaction. Here, we can cheat: @@ -1872,7 +1872,7 @@ BOOST_AUTO_TEST_CASE( cli_create_htlc_bsip64 ) std::vector hist = con.wallet_api_ptr->get_account_history("alice", 1); BOOST_CHECK( hist[0].description.find("with preimage \"4d792") != hist[0].description.npos); } - + // Bob can also look at his own history to see Alice's preimage { BOOST_TEST_MESSAGE("Bob can look at his own history to see the preimage"); @@ -1915,8 +1915,8 @@ BOOST_AUTO_TEST_CASE( cli_create_htlc_bsip64 ) { BOOST_CHECK( str.find("HASH160 620e4d5ba") != std::string::npos ); } - } - con.wallet_api_ptr->unlock("supersecret"); + } + con.wallet_api_ptr->unlock("supersecret"); } catch( fc::exception& e ) { edump((e.to_detail_string())); From 330c37e1704dca877efbb096a7e000ea9ff72c86 Mon Sep 17 00:00:00 2001 From: abitmore Date: Sat, 6 Mar 2021 22:05:12 -0500 Subject: [PATCH 12/14] Wrap long lines --- tests/cli/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/cli/main.cpp b/tests/cli/main.cpp index d5e44b3ebb..665c43c27b 100644 --- a/tests/cli/main.cpp +++ b/tests/cli/main.cpp @@ -1240,8 +1240,8 @@ BOOST_AUTO_TEST_CASE( cli_create_htlc ) { graphene::wallet::brain_key_info bki = con.wallet_api_ptr->suggest_brain_key(); BOOST_CHECK(!bki.brain_priv_key.empty()); - signed_transaction create_acct_tx = con.wallet_api_ptr->create_account_with_brain_key(bki.brain_priv_key, "alice", - "nathan", "nathan", true); + signed_transaction create_acct_tx = con.wallet_api_ptr->create_account_with_brain_key(bki.brain_priv_key, + "alice", "nathan", "nathan", true); con.wallet_api_ptr->save_wallet_file(con.wallet_filename); // attempt to give alice some bitshares BOOST_TEST_MESSAGE("Transferring bitshares from Nathan to alice"); @@ -1253,8 +1253,8 @@ BOOST_AUTO_TEST_CASE( cli_create_htlc ) { graphene::wallet::brain_key_info bki = con.wallet_api_ptr->suggest_brain_key(); BOOST_CHECK(!bki.brain_priv_key.empty()); - signed_transaction create_acct_tx = con.wallet_api_ptr->create_account_with_brain_key(bki.brain_priv_key, "bob", - "nathan", "nathan", true); + signed_transaction create_acct_tx = con.wallet_api_ptr->create_account_with_brain_key(bki.brain_priv_key, + "bob", "nathan", "nathan", true); // this should cause resync which will import the keys of alice and bob generate_block(app1); // attempt to give bob some bitshares From 7032a8ec5234b78cc677377010c8d47ad01cf79b Mon Sep 17 00:00:00 2001 From: abitmore Date: Sat, 6 Mar 2021 23:34:34 -0500 Subject: [PATCH 13/14] Add tests for CLI result formatters --- tests/cli/main.cpp | 97 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 95 insertions(+), 2 deletions(-) diff --git a/tests/cli/main.cpp b/tests/cli/main.cpp index 665c43c27b..6a96ddb389 100644 --- a/tests/cli/main.cpp +++ b/tests/cli/main.cpp @@ -372,6 +372,30 @@ BOOST_FIXTURE_TEST_CASE( cli_quit, cli_fixture ) BOOST_CHECK_THROW( con.wallet_api_ptr->quit(), fc::canceled_exception ); } +BOOST_FIXTURE_TEST_CASE( cli_help_gethelp, cli_fixture ) +{ + BOOST_TEST_MESSAGE("Testing help and gethelp commands."); + auto formatters = con.wallet_api_ptr->get_result_formatters(); + + string result = con.wallet_api_ptr->help(); + BOOST_CHECK( result.find("gethelp") != string::npos ); + if( formatters.find("help") != formatters.end() ) + { + BOOST_TEST_MESSAGE("Testing formatter of help"); + string output = formatters["help"](fc::variant(result), fc::variants()); + BOOST_CHECK( output.find("gethelp") != string::npos ); + } + + result = con.wallet_api_ptr->gethelp( "transfer" ); + BOOST_CHECK( result.find("usage") != string::npos ); + if( formatters.find("gethelp") != formatters.end() ) + { + BOOST_TEST_MESSAGE("Testing formatter of gethelp"); + string output = formatters["gethelp"](fc::variant(result), fc::variants()); + BOOST_CHECK( output.find("usage") != string::npos ); + } +} + BOOST_FIXTURE_TEST_CASE( upgrade_nathan_account, cli_fixture ) { try @@ -441,6 +465,8 @@ BOOST_FIXTURE_TEST_CASE( mpa_tests, cli_fixture ) account_object nathan_acct = con.wallet_api_ptr->get_account("nathan"); + auto formatters = con.wallet_api_ptr->get_result_formatters(); + // Create new asset called BOBCOIN backed by CORE try { @@ -451,7 +477,14 @@ BOOST_FIXTURE_TEST_CASE( mpa_tests, cli_fixture ) asset_ops.max_supply = 1000000; asset_ops.core_exchange_rate = price(asset(2),asset(1,asset_id_type(1))); graphene::chain::bitasset_options bit_opts; - con.wallet_api_ptr->create_asset("nathan", "BOBCOIN", 4, asset_ops, bit_opts, true); + auto result = con.wallet_api_ptr->create_asset("nathan", "BOBCOIN", 4, asset_ops, bit_opts, true); + if( formatters.find("create_asset") != formatters.end() ) + { + BOOST_TEST_MESSAGE("Testing formatter of create_asset"); + string output = formatters["create_asset"]( + fc::variant(result, FC_PACK_MAX_DEPTH), fc::variants()); + BOOST_CHECK( output.find("BOBCOIN") != string::npos ); + } } catch(exception& e) { @@ -543,6 +576,15 @@ BOOST_FIXTURE_TEST_CASE( mpa_tests, cli_fixture ) } } BOOST_CHECK_EQUAL(count, 1u); + + // Testing result formatter + if( formatters.find("list_account_balances") != formatters.end() ) + { + BOOST_TEST_MESSAGE("Testing formatter of list_account_balances"); + string output = formatters["list_account_balances"]( + fc::variant(nathan_balances, FC_PACK_MAX_DEPTH ), fc::variants()); + BOOST_CHECK( output.find("BOBCOIN") != string::npos ); + } } } catch( fc::exception& e ) { @@ -891,6 +933,8 @@ BOOST_FIXTURE_TEST_CASE( cli_confidential_tx_test, cli_fixture ) unsigned int head_block = 0; auto & W = *con.wallet_api_ptr; // Wallet alias + auto formatters = con.wallet_api_ptr->get_result_formatters(); + BOOST_TEST_MESSAGE("Creating blind accounts"); graphene::wallet::brain_key_info bki_nathan = W.suggest_brain_key(); graphene::wallet::brain_key_info bki_alice = W.suggest_brain_key(); @@ -909,7 +953,17 @@ BOOST_FIXTURE_TEST_CASE( cli_confidential_tx_test, cli_fixture ) // ** Block 2: Nathan will blind 100M CORE token: BOOST_TEST_MESSAGE("Blinding a large balance"); - W.transfer_to_blind("nathan", GRAPHENE_SYMBOL, {{"nathan","100000000"}}, true); + { + auto result = W.transfer_to_blind("nathan", GRAPHENE_SYMBOL, {{"nathan","100000000"}}, true); + // Testing result formatter + if( formatters.find("transfer_to_blind") != formatters.end() ) + { + BOOST_TEST_MESSAGE("Testing formatter of transfer_to_blind"); + string output = formatters["transfer_to_blind"]( + fc::variant(result, FC_PACK_MAX_DEPTH), fc::variants()); + BOOST_CHECK( output.find("receipt") != string::npos ); + } + } BOOST_CHECK( W.get_blind_balances("nathan")[0].amount == 10000000000000 ); generate_block(app1); head_block++; @@ -953,6 +1007,35 @@ BOOST_FIXTURE_TEST_CASE( cli_confidential_tx_test, cli_fixture ) BOOST_TEST_MESSAGE("Check that all expected blocks have processed"); dynamic_global_property_object dgp = W.get_dynamic_global_properties(); BOOST_CHECK(dgp.head_block_number == head_block); + + // Receive blind transfer + { + auto result = W.receive_blind_transfer(bconfs[1].outputs[1].confirmation_receipt, "", "bob_receive"); + BOOST_CHECK_EQUAL( result.amount.amount.value, 1000000000 ); + // Testing result formatter + if( formatters.find("receive_blind_transfer") != formatters.end() ) + { + BOOST_TEST_MESSAGE("Testing formatter of receive_blind_transfer"); + string output = formatters["receive_blind_transfer"]( + fc::variant(result, FC_PACK_MAX_DEPTH), fc::variants()); + BOOST_CHECK( output.find("bob_receive") != string::npos ); + } + } + + // Check blind history + { + auto result = W.blind_history("nathan"); + BOOST_CHECK_EQUAL( result.size(), 5u ); // 1 transfer_to_blind + 2 outputs * 2 blind_transfers + // Testing result formatter + if( formatters.find("blind_history") != formatters.end() ) + { + BOOST_TEST_MESSAGE("Testing formatter of blind_history"); + string output = formatters["blind_history"]( + fc::variant(result, FC_PACK_MAX_DEPTH), fc::variants()); + BOOST_CHECK( output.find("WHEN") != string::npos ); + BOOST_TEST_MESSAGE( output ); + } + } } catch( fc::exception& e ) { edump((e.to_detail_string())); throw; @@ -992,6 +1075,16 @@ BOOST_FIXTURE_TEST_CASE( account_history_pagination, cli_fixture ) } operation_ids.insert(op.op.id); } + + // Testing result formatter + auto formatters = con.wallet_api_ptr->get_result_formatters(); + if( formatters.find("get_account_history") != formatters.end() ) + { + BOOST_TEST_MESSAGE("Testing formatter of get_account_history"); + string output = formatters["get_account_history"]( + fc::variant(history, FC_PACK_MAX_DEPTH), fc::variants()); + BOOST_CHECK( output.find("Here are some") != string::npos ); + } } catch( fc::exception& e ) { edump((e.to_detail_string())); throw; From 3573bb5cd856dcf26f397c832306c42882c10a02 Mon Sep 17 00:00:00 2001 From: abitmore Date: Sun, 7 Mar 2021 10:34:37 -0500 Subject: [PATCH 14/14] Fix OOM when building in Github Actions debug mode --- .github/workflows/build-and-test.ubuntu-debug.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-and-test.ubuntu-debug.yml b/.github/workflows/build-and-test.ubuntu-debug.yml index 3ca8a0d347..ddec5bdec3 100644 --- a/.github/workflows/build-and-test.ubuntu-debug.yml +++ b/.github/workflows/build-and-test.ubuntu-debug.yml @@ -84,7 +84,9 @@ jobs: mkdir -p "$CCACHE_DIR" df -h make -j 2 -C _build chain_test + make -j 2 -C _build cli_test make -j 2 -C _build cli_wallet + make -j 2 -C _build witness_node make -j 2 -C _build df -h du -hs _build/libraries/* _build/programs/* _build/tests/*