From 46dd57e6690ea39cc20d999b54f6a1e2ff188d8f Mon Sep 17 00:00:00 2001 From: abitmore Date: Tue, 16 May 2023 20:51:39 +0000 Subject: [PATCH] Add GCOVR_EXCL_LINE for FC_CAPTURE_AND_RETHROW --- libraries/chain/credit_offer_evaluator.cpp | 28 +++++----- libraries/chain/db_block.cpp | 59 ++++++++++++++-------- libraries/chain/db_maint.cpp | 6 +-- libraries/chain/db_market.cpp | 17 ++++--- libraries/chain/db_notify.cpp | 2 +- libraries/chain/db_update.cpp | 6 +-- libraries/chain/market_evaluator.cpp | 24 ++++----- libraries/chain/proposal_evaluator.cpp | 15 +++--- libraries/net/node.cpp | 8 +-- libraries/protocol/market.cpp | 8 +-- 10 files changed, 95 insertions(+), 78 deletions(-) diff --git a/libraries/chain/credit_offer_evaluator.cpp b/libraries/chain/credit_offer_evaluator.cpp index 7c1ef6edc..b24de46ce 100644 --- a/libraries/chain/credit_offer_evaluator.cpp +++ b/libraries/chain/credit_offer_evaluator.cpp @@ -66,7 +66,7 @@ void_result credit_offer_create_evaluator::do_evaluate(const credit_offer_create "The account is unauthorized by the asset" ); return void_result(); -} FC_CAPTURE_AND_RETHROW( (op) ) } +} FC_CAPTURE_AND_RETHROW( (op) ) } // GCOVR_EXCL_LINE object_id_type credit_offer_create_evaluator::do_apply(const credit_offer_create_operation& op) const { try { @@ -88,7 +88,7 @@ object_id_type credit_offer_create_evaluator::do_apply(const credit_offer_create obj.acceptable_borrowers = op.acceptable_borrowers; }); return new_credit_offer_object.id; -} FC_CAPTURE_AND_RETHROW( (op) ) } +} FC_CAPTURE_AND_RETHROW( (op) ) } // GCOVR_EXCL_LINE void_result credit_offer_delete_evaluator::do_evaluate(const credit_offer_delete_operation& op) { try { @@ -104,7 +104,7 @@ void_result credit_offer_delete_evaluator::do_evaluate(const credit_offer_delete // Note: no asset authorization check here, allow funds to be moved to account balance return void_result(); -} FC_CAPTURE_AND_RETHROW( (op) ) } +} FC_CAPTURE_AND_RETHROW( (op) ) } // GCOVR_EXCL_LINE asset credit_offer_delete_evaluator::do_apply(const credit_offer_delete_operation& op) const { try { @@ -120,7 +120,7 @@ asset credit_offer_delete_evaluator::do_apply(const credit_offer_delete_operatio d.remove( *_offer ); return released; -} FC_CAPTURE_AND_RETHROW( (op) ) } +} FC_CAPTURE_AND_RETHROW( (op) ) } // GCOVR_EXCL_LINE void_result credit_offer_update_evaluator::do_evaluate(const credit_offer_update_operation& op) { try { @@ -180,7 +180,7 @@ void_result credit_offer_update_evaluator::do_evaluate(const credit_offer_update } return void_result(); -} FC_CAPTURE_AND_RETHROW( (op) ) } +} FC_CAPTURE_AND_RETHROW( (op) ) } // GCOVR_EXCL_LINE void_result credit_offer_update_evaluator::do_apply( const credit_offer_update_operation& op) const { try { @@ -224,7 +224,7 @@ void_result credit_offer_update_evaluator::do_apply( const credit_offer_update_o } return void_result(); -} FC_CAPTURE_AND_RETHROW( (op) ) } +} FC_CAPTURE_AND_RETHROW( (op) ) } // GCOVR_EXCL_LINE void_result credit_offer_accept_evaluator::do_evaluate(const credit_offer_accept_operation& op) { try { @@ -304,7 +304,7 @@ void_result credit_offer_accept_evaluator::do_evaluate(const credit_offer_accept } return void_result(); -} FC_CAPTURE_AND_RETHROW( (op) ) } +} FC_CAPTURE_AND_RETHROW( (op) ) } // GCOVR_EXCL_LINE extendable_operation_result credit_offer_accept_evaluator::do_apply( const credit_offer_accept_operation& op) const { try { @@ -368,7 +368,7 @@ extendable_operation_result credit_offer_accept_evaluator::do_apply( const credi result.value.impacted_accounts = flat_set({ _offer->owner_account }); return result; -} FC_CAPTURE_AND_RETHROW( (op) ) } +} FC_CAPTURE_AND_RETHROW( (op) ) } // GCOVR_EXCL_LINE void_result credit_deal_repay_evaluator::do_evaluate(const credit_deal_repay_operation& op) { try { @@ -400,7 +400,7 @@ void_result credit_deal_repay_evaluator::do_evaluate(const credit_deal_repay_ope "The owner of the credit offer is unauthorized by the repaying asset" ); return void_result(); -} FC_CAPTURE_AND_RETHROW( (op) ) } +} FC_CAPTURE_AND_RETHROW( (op) ) } // GCOVR_EXCL_LINE extendable_operation_result credit_deal_repay_evaluator::do_apply( const credit_deal_repay_operation& op) const { try { @@ -470,10 +470,10 @@ extendable_operation_result credit_deal_repay_evaluator::do_apply( const credit_ result.value.received = vector({ collateral_released }); return result; -} FC_CAPTURE_AND_RETHROW( (op) ) } +} FC_CAPTURE_AND_RETHROW( (op) ) } // GCOVR_EXCL_LINE void_result credit_deal_update_evaluator::do_evaluate(const credit_deal_update_operation& op) -{ +{ try { const database& d = db(); const auto block_time = d.head_block_time(); @@ -486,10 +486,10 @@ void_result credit_deal_update_evaluator::do_evaluate(const credit_deal_update_o FC_ASSERT( _deal->auto_repay != op.auto_repay, "The automatic repayment type does not change" ); return void_result(); -} +} FC_CAPTURE_AND_RETHROW( (op) ) } // GCOVR_EXCL_LINE void_result credit_deal_update_evaluator::do_apply( const credit_deal_update_operation& op) const -{ +{ try { database& d = db(); d.modify( *_deal, [&op]( credit_deal_object& obj ){ @@ -497,6 +497,6 @@ void_result credit_deal_update_evaluator::do_apply( const credit_deal_update_ope }); return void_result(); -} +} FC_CAPTURE_AND_RETHROW( (op) ) } // GCOVR_EXCL_LINE } } // graphene::chain diff --git a/libraries/chain/db_block.cpp b/libraries/chain/db_block.cpp index 2e2cbf849..039589a6e 100644 --- a/libraries/chain/db_block.cpp +++ b/libraries/chain/db_block.cpp @@ -63,7 +63,7 @@ bool database::is_known_transaction( const transaction_id_type& id )const block_id_type database::get_block_id_for_num( uint32_t block_num )const { try { return _block_id_to_block.fetch_block_id( block_num ); -} FC_CAPTURE_AND_RETHROW( (block_num) ) } +} FC_CAPTURE_AND_RETHROW( (block_num) ) } // GCOVR_EXCL_LINE optional database::fetch_block_by_id( const block_id_type& id )const { @@ -92,7 +92,8 @@ const signed_transaction& database::get_recent_transaction(const transaction_id_ std::vector database::get_block_ids_on_fork(block_id_type head_of_fork) const { - pair branches = _fork_db.fetch_branch_from(head_block_id(), head_of_fork); + pair branches + = _fork_db.fetch_branch_from(head_block_id(), head_of_fork); if( !((branches.first.back()->previous_id() == branches.second.back()->previous_id())) ) { edump( (head_of_fork) @@ -180,7 +181,8 @@ bool database::_push_block(const signed_block& new_block) // remove the rest of branches.first from the fork_db, those blocks are invalid while( ritr != branches.first.rend() ) { - ilog( "removing block from fork_db #${n} ${id}", ("n",(*ritr)->data.block_num())("id",(*ritr)->id) ); + ilog( "removing block from fork_db #${n} ${id}", + ("n",(*ritr)->data.block_num())("id",(*ritr)->id) ); _fork_db.remove( (*ritr)->id ); ++ritr; } @@ -225,7 +227,7 @@ bool database::_push_block(const signed_block& new_block) } return false; -} FC_CAPTURE_AND_RETHROW( (new_block) ) } +} FC_CAPTURE_AND_RETHROW( (new_block) ) } // GCOVR_EXCL_LINE void database::verify_signing_witness( const signed_block& new_block, const fork_item& fork_entry )const { @@ -275,7 +277,7 @@ processed_transaction database::push_transaction( const precomputable_transactio result = _push_transaction( trx ); } ); return result; -} FC_CAPTURE_AND_RETHROW( (trx) ) } +} FC_CAPTURE_AND_RETHROW( (trx) ) } // GCOVR_EXCL_LINE processed_transaction database::_push_transaction( const precomputable_transaction& trx ) { @@ -313,7 +315,8 @@ class push_proposal_nesting_guard { push_proposal_nesting_guard( uint32_t& nesting_counter, const database& db ) : orig_value(nesting_counter), counter(nesting_counter) { - FC_ASSERT( counter < db.get_global_properties().active_witnesses.size() * 2, "Max proposal nesting depth exceeded!" ); + FC_ASSERT( counter < db.get_global_properties().active_witnesses.size() * 2, + "Max proposal nesting depth exceeded!" ); counter++; } ~push_proposal_nesting_guard() @@ -370,7 +373,7 @@ processed_transaction database::push_proposal(const proposal_object& proposal) ptrx.operation_results = std::move(eval_state.operation_results); return ptrx; -} FC_CAPTURE_AND_RETHROW( (proposal) ) } +} FC_CAPTURE_AND_RETHROW( (proposal) ) } // GCOVR_EXCL_LINE signed_block database::generate_block( fc::time_point_sec when, @@ -385,7 +388,7 @@ signed_block database::generate_block( result = _generate_block( when, witness_id, block_signing_private_key ); } ); return result; -} FC_CAPTURE_AND_RETHROW() } +} FC_CAPTURE_AND_RETHROW() } // GCOVR_EXCL_LINE signed_block database::_generate_block( fc::time_point_sec when, @@ -428,7 +431,8 @@ signed_block database::_generate_block( static const size_t max_partial_block_header_size = fc::raw::pack_size( signed_block_header() ) - fc::raw::pack_size( witness_id_type() ) // witness_id - + 3; // max space to store size of transactions (out of block header), + + 3; // max space to store size of transactions + // (out of block header), // +3 means 3*7=21 bits so it's practically safe const size_t max_block_header_size = max_partial_block_header_size + fc::raw::pack_size( witness_id ); auto maximum_block_size = get_global_properties().parameters.maximum_block_size; @@ -502,10 +506,11 @@ signed_block database::_generate_block( if( 0 == (skip & skip_witness_signature) ) pending_block.sign( block_signing_private_key ); - push_block( pending_block, skip | skip_transaction_signatures ); // skip authority check when pushing self-generated blocks + push_block( pending_block, skip | skip_transaction_signatures ); // skip authority check when pushing + // self-generated blocks return pending_block; -} FC_CAPTURE_AND_RETHROW( (witness_id) ) } +} FC_CAPTURE_AND_RETHROW( (witness_id) ) } // GCOVR_EXCL_LINE /** * Removes the most recent block from the database and @@ -524,15 +529,17 @@ void database::pop_block() FC_ASSERT( fork_db_head, "Trying to pop() block that's not in fork database!?" ); } pop_undo(); - _popped_tx.insert( _popped_tx.begin(), fork_db_head->data.transactions.begin(), fork_db_head->data.transactions.end() ); -} FC_CAPTURE_AND_RETHROW() } + _popped_tx.insert( _popped_tx.begin(), + fork_db_head->data.transactions.begin(), + fork_db_head->data.transactions.end() ); +} FC_CAPTURE_AND_RETHROW() } // GCOVR_EXCL_LINE void database::clear_pending() { try { assert( (_pending_tx.size() == 0) || _pending_tx_session.valid() ); _pending_tx.clear(); _pending_tx_session.reset(); -} FC_CAPTURE_AND_RETHROW() } +} FC_CAPTURE_AND_RETHROW() } // GCOVR_EXCL_LINE uint32_t database::push_applied_operation( const operation& op, bool is_virtual /* = true */ ) { @@ -566,7 +573,9 @@ void database::apply_block( const signed_block& next_block, uint32_t skip ) { auto itr = _checkpoints.find( block_num ); if( itr != _checkpoints.end() ) - FC_ASSERT( next_block.id() == itr->second, "Block did not match checkpoint", ("checkpoint",*itr)("block_id",next_block.id()) ); + FC_ASSERT( next_block.id() == itr->second, + "Block did not match checkpoint", + ("checkpoint",*itr)("block_id",next_block.id()) ); if( _checkpoints.rbegin()->first >= block_num ) skip = ~0;// WE CAN SKIP ALMOST EVERYTHING @@ -667,7 +676,7 @@ void database::_apply_block( const signed_block& next_block ) _applied_ops.clear(); notify_changed_objects(); -} FC_CAPTURE_AND_RETHROW( (next_block.block_num()) ) } +} FC_CAPTURE_AND_RETHROW( (next_block.block_num()) ) } // GCOVR_EXCL_LINE /** * @note if a @c processed_transaction is passed in, it is cast into @c signed_transaction here. @@ -732,7 +741,8 @@ processed_transaction database::_apply_transaction(const signed_transaction& trx fc::time_point_sec now = head_block_time(); FC_ASSERT( trx.expiration <= now + chain_parameters.maximum_time_until_expiration, "", - ("trx.expiration",trx.expiration)("now",now)("max_til_exp",chain_parameters.maximum_time_until_expiration)); + ("trx.expiration",trx.expiration)("now",now) + ("max_til_exp",chain_parameters.maximum_time_until_expiration) ); FC_ASSERT( now <= trx.expiration, "", ("now",now)("trx.exp",trx.expiration) ); if ( 0 == (skip & skip_block_size_check ) ) // don't waste time on replay FC_ASSERT( head_block_time() <= HARDFORK_CORE_1573_TIME @@ -768,7 +778,7 @@ processed_transaction database::_apply_transaction(const signed_transaction& trx "Unpaid SameT Fund debt detected" ); return ptrx; -} FC_CAPTURE_AND_RETHROW( (trx) ) } +} FC_CAPTURE_AND_RETHROW( (trx) ) } // GCOVR_EXCL_LINE operation_result database::apply_operation( transaction_evaluation_state& eval_state, const operation& op, bool is_virtual /* = true */ ) @@ -783,7 +793,7 @@ operation_result database::apply_operation( transaction_evaluation_state& eval_s auto result = eval->evaluate( eval_state, op, true ); set_applied_operation_result( op_id, result ); return result; -} FC_CAPTURE_AND_RETHROW( (op) ) } +} FC_CAPTURE_AND_RETHROW( (op) ) } // GCOVR_EXCL_LINE operation_result database::try_push_virtual_operation( transaction_evaluation_state& eval_state, const operation& op ) { @@ -812,8 +822,12 @@ operation_result database::try_push_virtual_operation( transaction_evaluation_st const witness_object& database::validate_block_header( uint32_t skip, const signed_block& next_block )const { - FC_ASSERT( head_block_id() == next_block.previous, "", ("head_block_id",head_block_id())("next.prev",next_block.previous) ); - FC_ASSERT( head_block_time() < next_block.timestamp, "", ("head_block_time",head_block_time())("next",next_block.timestamp)("blocknum",next_block.block_num()) ); + FC_ASSERT( head_block_id() == next_block.previous, + "Unlinkable block", + ("head_block_id",head_block_id())("next.prev",next_block.previous) ); + FC_ASSERT( head_block_time() < next_block.timestamp, + "Invalid block timestamp", + ("head_block_time",head_block_time())("next",next_block.timestamp)("blocknum",next_block.block_num()) ); const witness_object& witness = next_block.witness(*this); if( 0 == (skip&skip_witness_signature) ) @@ -886,7 +900,8 @@ fc::future database::precompute_parallel( const signed_block& block, const for( size_t base = 0; base < block.transactions.size(); base += chunk_size ) workers.push_back( fc::do_parallel( [this,&block,base,chunk_size,skip] () { _precompute_parallel( &block.transactions[base], - base + chunk_size < block.transactions.size() ? chunk_size : block.transactions.size() - base, + base + chunk_size < block.transactions.size() ? chunk_size + : block.transactions.size() - base, skip ); }) ); } diff --git a/libraries/chain/db_maint.cpp b/libraries/chain/db_maint.cpp index 91d4edc88..d019a4362 100644 --- a/libraries/chain/db_maint.cpp +++ b/libraries/chain/db_maint.cpp @@ -305,7 +305,7 @@ void database::update_active_witnesses() }); }); -} FC_CAPTURE_AND_RETHROW() } +} FC_CAPTURE_AND_RETHROW() } // GCOVR_EXCL_LINE void database::update_active_committee_members() { try { @@ -412,7 +412,7 @@ void database::update_active_committee_members() std::inserter(gp.active_committee_members, gp.active_committee_members.begin()), [](const committee_member_object& d) { return d.get_id(); }); }); -} FC_CAPTURE_AND_RETHROW() } +} FC_CAPTURE_AND_RETHROW() } // GCOVR_EXCL_LINE void database::initialize_budget_record( fc::time_point_sec now, budget_record& rec )const { @@ -564,7 +564,7 @@ void database::process_budget() // available_funds is money we could spend, but don't want to. // we simply let it evaporate back into the reserve. } - FC_CAPTURE_AND_RETHROW() + FC_CAPTURE_AND_RETHROW() // GCOVR_EXCL_LINE } template< typename Visitor > diff --git a/libraries/chain/db_market.cpp b/libraries/chain/db_market.cpp index a31851cec..780992128 100644 --- a/libraries/chain/db_market.cpp +++ b/libraries/chain/db_market.cpp @@ -335,7 +335,7 @@ void database::globally_settle_asset_impl( const asset_object& mia, obj.settlement_fund = collateral_gathered.amount; }); -} FC_CAPTURE_AND_RETHROW( (mia)(settlement_price) ) } +} FC_CAPTURE_AND_RETHROW( (mia)(settlement_price) ) } // GCOVR_EXCL_LINE void database::individually_settle( const asset_bitasset_data_object& bitasset, const call_order_object& order ) { @@ -448,7 +448,7 @@ void database::revive_bitasset( const asset_object& bitasset, const asset_bitass FC_ASSERT( bad.settlement_fund == 0 ); _cancel_bids_and_revive_mpa( bitasset, bad ); -} FC_CAPTURE_AND_RETHROW( (bitasset) ) } +} FC_CAPTURE_AND_RETHROW( (bitasset) ) } // GCOVR_EXCL_LINE void database::_cancel_bids_and_revive_mpa( const asset_object& bitasset, const asset_bitasset_data_object& bad ) { try { @@ -472,7 +472,7 @@ void database::_cancel_bids_and_revive_mpa( const asset_object& bitasset, const obj.settlement_price = price(); obj.settlement_fund = 0; }); -} FC_CAPTURE_AND_RETHROW( (bitasset) ) } +} FC_CAPTURE_AND_RETHROW( (bitasset) ) } // GCOVR_EXCL_LINE void database::cancel_bid(const collateral_bid_object& bid, bool create_virtual_op) { @@ -1619,7 +1619,8 @@ asset database::match_impl( const force_settlement_object& settle, cancel_settle_order( settle ); return call_receives; -} FC_CAPTURE_AND_RETHROW( (p_match_price)(max_settlement)(p_fill_price)(is_margin_call)(settle_is_taker) ) } +} FC_CAPTURE_AND_RETHROW( (p_match_price)(max_settlement)(p_fill_price) // GCOVR_EXCL_LINE + (is_margin_call)(settle_is_taker) ) } // GCOVR_EXCL_LINE bool database::fill_limit_order( const limit_order_object& order, const asset& pays, const asset& receives, bool cull_if_small, const price& fill_price, const bool is_maker) @@ -1725,7 +1726,7 @@ bool database::fill_limit_order( const limit_order_object& order, const asset& p return maybe_cull_small_order( *this, order ); return false; } -} FC_CAPTURE_AND_RETHROW( (pays)(receives) ) } +} FC_CAPTURE_AND_RETHROW( (pays)(receives) ) } // GCOVR_EXCL_LINE /*** * @brief fill a call order in the specified amounts @@ -1808,7 +1809,7 @@ bool database::fill_call_order( const call_order_object& order, const asset& pay remove( order ); return collateral_freed.valid(); -} FC_CAPTURE_AND_RETHROW( (pays)(receives) ) } +} FC_CAPTURE_AND_RETHROW( (pays)(receives) ) } // GCOVR_EXCL_LINE /*** * @brief fullfill a settle order in the specified amounts @@ -1881,7 +1882,7 @@ bool database::fill_settle_order( const force_settlement_object& settle, const a return filled; -} FC_CAPTURE_AND_RETHROW( (pays)(receives) ) } +} FC_CAPTURE_AND_RETHROW( (pays)(receives) ) } // GCOVR_EXCL_LINE /** * Starting with the least collateralized orders, fill them if their @@ -2254,7 +2255,7 @@ bool database::check_call_orders( const asset_object& mia, bool enable_black_swa } // while there exists a call order check_settled_debt_order( bitasset ); return margin_called; -} FC_CAPTURE_AND_RETHROW() } +} FC_CAPTURE_AND_RETHROW() } // GCOVR_EXCL_LINE bool database::match_force_settlements( const asset_bitasset_data_object& bitasset ) { diff --git a/libraries/chain/db_notify.cpp b/libraries/chain/db_notify.cpp index e1a354ad3..c2dce4d49 100644 --- a/libraries/chain/db_notify.cpp +++ b/libraries/chain/db_notify.cpp @@ -656,6 +656,6 @@ void database::notify_changed_objects() } catch( const graphene::chain::plugin_exception& e ) { elog( "Caught plugin exception: ${e}", ("e", e.to_detail_string() ) ); throw; -} FC_CAPTURE_AND_LOG( (0) ) } +} FC_CAPTURE_AND_LOG( (0) ) } // GCOVR_EXCL_LINE } } // namespace graphene::chain diff --git a/libraries/chain/db_update.cpp b/libraries/chain/db_update.cpp index f3cfe14f3..59f52e27c 100644 --- a/libraries/chain/db_update.cpp +++ b/libraries/chain/db_update.cpp @@ -150,7 +150,7 @@ void database::clear_expired_transactions() const auto& dedupe_index = transaction_idx.indices().get(); while( (!dedupe_index.empty()) && (head_block_time() > dedupe_index.begin()->trx.expiration) ) transaction_idx.remove(*dedupe_index.begin()); -} FC_CAPTURE_AND_RETHROW() } +} FC_CAPTURE_AND_RETHROW() } // GCOVR_EXCL_LINE void database::clear_expired_proposals() { @@ -344,7 +344,7 @@ void database::clear_expired_orders() check_call_orders( quote_asset( *this ) ); } } -} FC_CAPTURE_AND_RETHROW() } +} FC_CAPTURE_AND_RETHROW() } // GCOVR_EXCL_LINE void database::clear_expired_force_settlements() { try { @@ -526,7 +526,7 @@ void database::clear_expired_force_settlements() }); } } -} FC_CAPTURE_AND_RETHROW() } +} FC_CAPTURE_AND_RETHROW() } // GCOVR_EXCL_LINE void database::update_expired_feeds() { diff --git a/libraries/chain/market_evaluator.cpp b/libraries/chain/market_evaluator.cpp index 886d5bc26..431744a34 100644 --- a/libraries/chain/market_evaluator.cpp +++ b/libraries/chain/market_evaluator.cpp @@ -75,7 +75,7 @@ void_result limit_order_create_evaluator::do_evaluate(const limit_order_create_o ("balance",d.get_balance(*_seller,*_sell_asset))("amount_to_sell",op.amount_to_sell) ); return void_result(); -} FC_CAPTURE_AND_RETHROW( (op) ) } +} FC_CAPTURE_AND_RETHROW( (op) ) } // GCOVR_EXCL_LINE void limit_order_create_evaluator::convert_fee() { @@ -133,7 +133,7 @@ object_id_type limit_order_create_evaluator::do_apply(const limit_order_create_o ("op",op) ); return order_id; -} FC_CAPTURE_AND_RETHROW( (op) ) } +} FC_CAPTURE_AND_RETHROW( (op) ) } // GCOVR_EXCL_LINE void limit_order_update_evaluator::convert_fee() { @@ -153,7 +153,7 @@ void limit_order_update_evaluator::pay_fee() } void_result limit_order_update_evaluator::do_evaluate(const limit_order_update_operation& o) -{ +{ try { const database& d = db(); FC_ASSERT( HARDFORK_CORE_1604_PASSED( d.head_block_time() ) , "Operation has not activated yet"); @@ -241,7 +241,7 @@ void_result limit_order_update_evaluator::do_evaluate(const limit_order_update_o "The account is not allowed to transact the receiving asset" ); return {}; -} +} FC_CAPTURE_AND_RETHROW( (o) ) } // GCOVR_EXCL_LINE void limit_order_update_evaluator::process_deferred_fee() { @@ -328,7 +328,7 @@ void limit_order_update_evaluator::process_deferred_fee() } void_result limit_order_update_evaluator::do_apply(const limit_order_update_operation& o) -{ +{ try { database& d = db(); // Adjust account balance @@ -363,7 +363,7 @@ void_result limit_order_update_evaluator::do_apply(const limit_order_update_oper d.apply_order(*_order); return {}; -} +} FC_CAPTURE_AND_RETHROW( (o) ) } // GCOVR_EXCL_LINE void_result limit_order_cancel_evaluator::do_evaluate(const limit_order_cancel_operation& o) { try { @@ -382,7 +382,7 @@ void_result limit_order_cancel_evaluator::do_evaluate(const limit_order_cancel_o ("oid", o.order) ); return void_result(); -} FC_CAPTURE_AND_RETHROW( (o) ) } +} FC_CAPTURE_AND_RETHROW( (o) ) } // GCOVR_EXCL_LINE asset limit_order_cancel_evaluator::do_apply(const limit_order_cancel_operation& o) const { try { @@ -404,7 +404,7 @@ asset limit_order_cancel_evaluator::do_apply(const limit_order_cancel_operation& } return refunded; -} FC_CAPTURE_AND_RETHROW( (o) ) } +} FC_CAPTURE_AND_RETHROW( (o) ) } // GCOVR_EXCL_LINE void_result call_order_update_evaluator::do_evaluate(const call_order_update_operation& o) { try { @@ -488,7 +488,7 @@ void_result call_order_update_evaluator::do_evaluate(const call_order_update_ope // which is now removed since the check is implicitly done later by `adjust_balance()` in `do_apply()`. return void_result(); -} FC_CAPTURE_AND_RETHROW( (o) ) } +} FC_CAPTURE_AND_RETHROW( (o) ) } // GCOVR_EXCL_LINE object_id_type call_order_update_evaluator::do_apply(const call_order_update_operation& o) @@ -696,7 +696,7 @@ object_id_type call_order_update_evaluator::do_apply(const call_order_update_ope } return call_order_id; -} FC_CAPTURE_AND_RETHROW( (o) ) } +} FC_CAPTURE_AND_RETHROW( (o) ) } // GCOVR_EXCL_LINE void_result bid_collateral_evaluator::do_evaluate(const bid_collateral_operation& o) { try { @@ -758,7 +758,7 @@ void_result bid_collateral_evaluator::do_evaluate(const bid_collateral_operation } return void_result(); -} FC_CAPTURE_AND_RETHROW( (o) ) } +} FC_CAPTURE_AND_RETHROW( (o) ) } // GCOVR_EXCL_LINE void_result bid_collateral_evaluator::do_apply(const bid_collateral_operation& o) const @@ -780,6 +780,6 @@ void_result bid_collateral_evaluator::do_apply(const bid_collateral_operation& o // Note: CORE asset in collateral_bid_object is not counted in account_stats.total_core_in_orders return void_result(); -} FC_CAPTURE_AND_RETHROW( (o) ) } +} FC_CAPTURE_AND_RETHROW( (o) ) } // GCOVR_EXCL_LINE } } // graphene::chain diff --git a/libraries/chain/proposal_evaluator.cpp b/libraries/chain/proposal_evaluator.cpp index 164cb1252..aad9ccb5b 100644 --- a/libraries/chain/proposal_evaluator.cpp +++ b/libraries/chain/proposal_evaluator.cpp @@ -431,7 +431,7 @@ void_result proposal_create_evaluator::do_evaluate( const proposal_create_operat _proposed_trx.validate(); return void_result(); -} FC_CAPTURE_AND_RETHROW( (o) ) } +} FC_CAPTURE_AND_RETHROW( (o) ) } // GCOVR_EXCL_LINE object_id_type proposal_create_evaluator::do_apply( const proposal_create_operation& o ) { try { @@ -466,7 +466,7 @@ object_id_type proposal_create_evaluator::do_apply( const proposal_create_operat }); return proposal.id; -} FC_CAPTURE_AND_RETHROW( (o) ) } +} FC_CAPTURE_AND_RETHROW( (o) ) } // GCOVR_EXCL_LINE void_result proposal_update_evaluator::do_evaluate( const proposal_update_operation& o ) { try { @@ -490,7 +490,7 @@ void_result proposal_update_evaluator::do_evaluate( const proposal_update_operat } return void_result(); -} FC_CAPTURE_AND_RETHROW( (o) ) } +} FC_CAPTURE_AND_RETHROW( (o) ) } // GCOVR_EXCL_LINE void_result proposal_update_evaluator::do_apply(const proposal_update_operation& o) { try { @@ -527,14 +527,15 @@ void_result proposal_update_evaluator::do_apply(const proposal_update_operation& d.modify(*_proposal, [&e](proposal_object& p) { p.fail_reason = e.to_string(fc::log_level(fc::log_level::all)); }); - wlog("Proposed transaction ${id} failed to apply once approved with exception:\n----\n${reason}\n----\nWill try again when it expires.", + wlog("Proposed transaction ${id} failed to apply once approved with exception:\n" + "----\n${reason}\n----\nWill try again when it expires.", ("id", o.proposal)("reason", e.to_detail_string())); _proposal_failed = true; } } return void_result(); -} FC_CAPTURE_AND_RETHROW( (o) ) } +} FC_CAPTURE_AND_RETHROW( (o) ) } // GCOVR_EXCL_LINE void_result proposal_delete_evaluator::do_evaluate(const proposal_delete_operation& o) { try { @@ -549,14 +550,14 @@ void_result proposal_delete_evaluator::do_evaluate(const proposal_delete_operati ("provided", o.fee_paying_account)("required", *required_approvals)); return void_result(); -} FC_CAPTURE_AND_RETHROW( (o) ) } +} FC_CAPTURE_AND_RETHROW( (o) ) } // GCOVR_EXCL_LINE void_result proposal_delete_evaluator::do_apply(const proposal_delete_operation& o) { try { db().remove(*_proposal); return void_result(); -} FC_CAPTURE_AND_RETHROW( (o) ) } +} FC_CAPTURE_AND_RETHROW( (o) ) } // GCOVR_EXCL_LINE } } // graphene::chain diff --git a/libraries/net/node.cpp b/libraries/net/node.cpp index 759d46515..eebc21a74 100644 --- a/libraries/net/node.cpp +++ b/libraries/net/node.cpp @@ -451,7 +451,7 @@ namespace graphene { namespace net { namespace detail { ilog( "p2p_network_connect_loop canceled" ); throw; } - FC_CAPTURE_AND_LOG( (0) ) + FC_CAPTURE_AND_LOG( (0) ) // GCOVR_EXCL_LINE }// while !canceled } @@ -482,7 +482,7 @@ namespace graphene { namespace net { namespace detail { ilog( "update_seed_nodes_task canceled" ); throw; } - FC_CAPTURE_AND_LOG( (_seed_nodes) ) + FC_CAPTURE_AND_LOG( (_seed_nodes) ) // GCOVR_EXCL_LINE schedule_next_update_seed_nodes_task(); } @@ -4047,7 +4047,7 @@ namespace graphene { namespace net { namespace detail { // limit the rate at which we accept connections to mitigate DOS attacks fc::usleep( fc::milliseconds(10) ); - } FC_CAPTURE_AND_LOG( (0) ) + } FC_CAPTURE_AND_LOG( (0) ) // GCOVR_EXCL_LINE } } // accept_loop() @@ -4476,7 +4476,7 @@ namespace graphene { namespace net { namespace detail { FC_THROW("Bad port: ${port}", ("port", port_string)); } } - FC_CAPTURE_AND_RETHROW((in)) + FC_CAPTURE_AND_RETHROW((in)) // GCOVR_EXCL_LINE } void node_impl::resolve_seed_node_and_add(const std::string& endpoint_string) diff --git a/libraries/protocol/market.cpp b/libraries/protocol/market.cpp index 7f8472cdb..e930db046 100644 --- a/libraries/protocol/market.cpp +++ b/libraries/protocol/market.cpp @@ -36,7 +36,7 @@ void limit_order_create_operation::validate()const } void limit_order_update_operation::validate() const -{ +{ try { FC_ASSERT(fee.amount >= 0, "Fee must not be negative"); FC_ASSERT(new_price || delta_amount_to_sell || new_expiration, "Cannot update limit order if nothing is specified to update"); @@ -44,7 +44,7 @@ void limit_order_update_operation::validate() const new_price->validate(); if (delta_amount_to_sell) FC_ASSERT(delta_amount_to_sell->amount != 0, "Cannot change limit order amount by zero"); -} +} FC_CAPTURE_AND_RETHROW((*this)) } // GCOVR_EXCL_LINE void limit_order_cancel_operation::validate()const { @@ -59,13 +59,13 @@ void call_order_update_operation::validate()const // note: no validation is needed for extensions so far: the only attribute inside is target_collateral_ratio -} FC_CAPTURE_AND_RETHROW((*this)) } +} FC_CAPTURE_AND_RETHROW((*this)) } // GCOVR_EXCL_LINE void bid_collateral_operation::validate()const { try { FC_ASSERT( fee.amount >= 0 ); FC_ASSERT( debt_covered.amount == 0 || (debt_covered.amount > 0 && additional_collateral.amount > 0) ); -} FC_CAPTURE_AND_RETHROW((*this)) } +} FC_CAPTURE_AND_RETHROW((*this)) } // GCOVR_EXCL_LINE } } // graphene::protocol