Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress p2p logs #1875

Merged
merged 9 commits into from
Aug 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion libraries/app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,9 @@ bool application_impl::handle_block(const graphene::net::block_message& blk_msg,
("w",witness_account.name)
("i",last_irr)("d",blk_msg.block.block_num()-last_irr) );
}
FC_ASSERT( (latency.count()/1000) > -5000, "Rejecting block with timestamp in the future" );
GRAPHENE_ASSERT( latency.count()/1000 > -5000,
graphene::net::block_timestamp_in_future_exception,
"Rejecting block with timestamp in the future", );

try {
const uint32_t skip = (_is_block_producer | _force_validate) ?
Expand Down
7 changes: 6 additions & 1 deletion libraries/chain/db_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,12 @@ processed_transaction database::_apply_transaction(const signed_transaction& trx
auto& trx_idx = get_mutable_index_type<transaction_index>();
const chain_id_type& chain_id = get_chain_id();
if( !(skip & skip_transaction_dupe_check) )
FC_ASSERT( trx_idx.indices().get<by_trx_id>().find(trx.id()) == trx_idx.indices().get<by_trx_id>().end() );
{
GRAPHENE_ASSERT( trx_idx.indices().get<by_trx_id>().find(trx.id()) == trx_idx.indices().get<by_trx_id>().end(),
duplicate_transaction,
"Transaction '${txid}' is already in the database",
("txid",trx.id()) );
}
transaction_evaluation_state eval_state(this);
const chain_parameters& chain_parameters = get_global_properties().parameters;
eval_state._trx = &trx;
Expand Down
63 changes: 48 additions & 15 deletions libraries/chain/exceptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace graphene { namespace chain {

// Internal exceptions

FC_IMPLEMENT_DERIVED_EXCEPTION( internal_exception, graphene::chain::chain_exception, 3990000, "internal exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( internal_exception, chain_exception, 3990000, "internal exception" )

GRAPHENE_IMPLEMENT_INTERNAL_EXCEPTION( verify_auth_max_auth_exceeded, 1, "Exceeds max authority fan-out" )
GRAPHENE_IMPLEMENT_INTERNAL_EXCEPTION( verify_auth_account_not_found, 2, "Auth account not found" )
Expand All @@ -39,35 +39,66 @@ namespace graphene { namespace chain {

FC_IMPLEMENT_EXCEPTION( chain_exception, 3000000, "blockchain exception" )

FC_IMPLEMENT_DERIVED_EXCEPTION( database_query_exception, chain_exception, 3010000, "database query exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( block_validate_exception, chain_exception, 3020000, "block validation exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( operation_validate_exception, chain_exception, 3040000, "operation validation exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( operation_evaluate_exception, chain_exception, 3050000, "operation evaluation exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( utility_exception, chain_exception, 3060000, "utility method exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( undo_database_exception, chain_exception, 3070000, "undo database exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( database_query_exception, chain_exception, 3010000,
"database query exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( block_validate_exception, chain_exception, 3020000,
"block validation exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( transaction_process_exception,chain_exception, 3030000,
"transaction processing exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( operation_validate_exception, chain_exception, 3040000,
"operation validation exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( operation_evaluate_exception, chain_exception, 3050000,
"operation evaluation exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( utility_exception, chain_exception, 3060000,
"utility method exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( undo_database_exception, chain_exception, 3070000,
"undo database exception" )
FC_IMPLEMENT_DERIVED_EXCEPTION( unlinkable_block_exception, chain_exception, 3080000, "unlinkable block" )
FC_IMPLEMENT_DERIVED_EXCEPTION( black_swan_exception, chain_exception, 3090000, "black swan" )
FC_IMPLEMENT_DERIVED_EXCEPTION( plugin_exception, chain_exception, 3100000, "plugin exception" )

FC_IMPLEMENT_DERIVED_EXCEPTION( insufficient_feeds, chain_exception, 37006, "insufficient feeds" )

FC_IMPLEMENT_DERIVED_EXCEPTION( pop_empty_chain, undo_database_exception, 3070001, "there are no blocks to pop" )
FC_IMPLEMENT_DERIVED_EXCEPTION( duplicate_transaction, transaction_process_exception, 3030001,
"duplicate transaction" )

FC_IMPLEMENT_DERIVED_EXCEPTION( pop_empty_chain, undo_database_exception, 3070001,
"there are no blocks to pop" )

GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( transfer );
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( from_account_not_whitelisted, transfer, 1, "owner mismatch" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( to_account_not_whitelisted, transfer, 2, "owner mismatch" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( restricted_transfer_asset, transfer, 3, "restricted transfer asset" )

//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( limit_order_create );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( limit_order_cancel );
GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( limit_order_create );
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( kill_unfilled, limit_order_create, 1,
"Killing limit order due to unable to fill" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( market_not_whitelisted, limit_order_create, 2,
"The market has not been whitelisted by the selling asset" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( market_blacklisted, limit_order_create, 3,
"The market has been blacklisted by the selling asset" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( selling_asset_unauthorized, limit_order_create, 4,
"The account is not allowed to transact the selling asset" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( receiving_asset_unauthorized, limit_order_create, 5,
"The account is not allowed to transact the receiving asset" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( insufficient_balance, limit_order_create, 6,
"Insufficient balance" )

GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( limit_order_cancel );
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( nonexist_order, limit_order_cancel, 1, "Order does not exist" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( owner_mismatch, limit_order_cancel, 2, "Order owned by someone else" )

GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( call_order_update );
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( unfilled_margin_call, call_order_update, 1, "Updating call order would trigger a margin call that cannot be fully filled" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( unfilled_margin_call, call_order_update, 1,
"Updating call order would trigger a margin call that cannot be fully filled" )

GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( account_create );
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( max_auth_exceeded, account_create, 1, "Exceeds max authority fan-out" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( auth_account_not_found, account_create, 2, "Auth account not found" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( buyback_incorrect_issuer, account_create, 3, "Incorrect issuer specified for account" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( buyback_already_exists, account_create, 4, "Cannot create buyback for asset which already has buyback" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( buyback_incorrect_issuer, account_create, 3,
"Incorrect issuer specified for account" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( buyback_already_exists, account_create, 4,
"Cannot create buyback for asset which already has buyback" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( buyback_too_many_markets, account_create, 5, "Too many buyback markets" )

GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( account_update );
Expand Down Expand Up @@ -95,7 +126,8 @@ namespace graphene { namespace chain {

GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( proposal_create );
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( review_period_required, proposal_create, 1, "review_period required" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( review_period_insufficient, proposal_create, 2, "review_period insufficient" )
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( review_period_insufficient, proposal_create, 2,
"review_period insufficient" )

//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( proposal_update );
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( proposal_delete );
Expand All @@ -120,7 +152,8 @@ namespace graphene { namespace chain {
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( not_permitted, override_transfer, 1, "not permitted" )

GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( blind_transfer );
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( unknown_commitment, blind_transfer, 1, "Attempting to claim an unknown prior commitment" );
GRAPHENE_IMPLEMENT_OP_EVALUATE_EXCEPTION( unknown_commitment, blind_transfer, 1,
"Attempting to claim an unknown prior commitment" );

//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( transfer_from_blind_operation )
//GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_claim_fees_operation )
Expand Down
59 changes: 36 additions & 23 deletions libraries/chain/include/graphene/chain/exceptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
#op_name "_operation evaluation exception" \
)

#define GRAPHENE_DECLARE_OP_VALIDATE_EXCEPTION( exc_name, op_name, seqnum, msg ) \
#define GRAPHENE_DECLARE_OP_VALIDATE_EXCEPTION( exc_name, op_name, seqnum ) \
FC_DECLARE_DERIVED_EXCEPTION( \
op_name ## _ ## exc_name, \
graphene::chain::op_name ## _validate_exception, \
Expand All @@ -72,7 +72,7 @@
msg \
)

#define GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( exc_name, op_name, seqnum, msg ) \
#define GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( exc_name, op_name, seqnum ) \
FC_DECLARE_DERIVED_EXCEPTION( \
op_name ## _ ## exc_name, \
graphene::chain::op_name ## _evaluate_exception, \
Expand Down Expand Up @@ -110,6 +110,7 @@ namespace graphene { namespace chain {

FC_DECLARE_DERIVED_EXCEPTION( database_query_exception, chain_exception, 3010000 )
FC_DECLARE_DERIVED_EXCEPTION( block_validate_exception, chain_exception, 3020000 )
FC_DECLARE_DERIVED_EXCEPTION( transaction_process_exception,chain_exception, 3030000 )
FC_DECLARE_DERIVED_EXCEPTION( operation_validate_exception, chain_exception, 3040000 )
FC_DECLARE_DERIVED_EXCEPTION( operation_evaluate_exception, chain_exception, 3050000 )
FC_DECLARE_DERIVED_EXCEPTION( utility_exception, chain_exception, 3060000 )
Expand All @@ -120,28 +121,40 @@ namespace graphene { namespace chain {

FC_DECLARE_DERIVED_EXCEPTION( insufficient_feeds, chain_exception, 37006 )

FC_DECLARE_DERIVED_EXCEPTION( duplicate_transaction, transaction_process_exception, 3030001 )

FC_DECLARE_DERIVED_EXCEPTION( pop_empty_chain, undo_database_exception, 3070001 )

GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( transfer );
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( from_account_not_whitelisted, transfer, 1, "owner mismatch" )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( to_account_not_whitelisted, transfer, 2, "owner mismatch" )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( restricted_transfer_asset, transfer, 3, "restricted transfer asset" )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( from_account_not_whitelisted, transfer, 1 )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( to_account_not_whitelisted, transfer, 2 )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( restricted_transfer_asset, transfer, 3 )

GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( limit_order_create );
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( kill_unfilled, limit_order_create, 1 )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( market_not_whitelisted, limit_order_create, 2 )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( market_blacklisted, limit_order_create, 3 )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( selling_asset_unauthorized, limit_order_create, 4 )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( receiving_asset_unauthorized, limit_order_create, 5 )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( insufficient_balance, limit_order_create, 6 )

GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( limit_order_cancel );
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( nonexist_order, limit_order_cancel, 1 )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( owner_mismatch, limit_order_cancel, 2 )

//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( limit_order_create );
//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( limit_order_cancel );
GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( call_order_update );
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( unfilled_margin_call, call_order_update, 1, "Updating call order would trigger a margin call that cannot be fully filled" )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( unfilled_margin_call, call_order_update, 1 )

GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( account_create );
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( max_auth_exceeded, account_create, 1, "Exceeds max authority fan-out" )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( auth_account_not_found, account_create, 2, "Auth account not found" )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( buyback_incorrect_issuer, account_create, 3, "Incorrect issuer specified for account" )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( buyback_already_exists, account_create, 4, "Cannot create buyback for asset which already has buyback" )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( buyback_too_many_markets, account_create, 5, "Too many buyback markets" )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( max_auth_exceeded, account_create, 1 )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( auth_account_not_found, account_create, 2 )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( buyback_incorrect_issuer, account_create, 3 )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( buyback_already_exists, account_create, 4 )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( buyback_too_many_markets, account_create, 5 )

GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( account_update );
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( max_auth_exceeded, account_update, 1, "Exceeds max authority fan-out" )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( auth_account_not_found, account_update, 2, "Auth account not found" )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( max_auth_exceeded, account_update, 1 )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( auth_account_not_found, account_update, 2 )

//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( account_whitelist );
//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( account_upgrade );
Expand All @@ -153,7 +166,7 @@ namespace graphene { namespace chain {
//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( asset_issue );

GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( asset_reserve );
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( invalid_on_mia, asset_reserve, 1, "invalid on mia" )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( invalid_on_mia, asset_reserve, 1 )

//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( asset_fund_fee_pool );
//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( asset_settle );
Expand All @@ -163,8 +176,8 @@ namespace graphene { namespace chain {
//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( witness_create );

GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( proposal_create );
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( review_period_required, proposal_create, 1, "review_period required" )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( review_period_insufficient, proposal_create, 2, "review_period insufficient" )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( review_period_required, proposal_create, 1 )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( review_period_insufficient, proposal_create, 2 )

//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( proposal_update );
//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( proposal_delete );
Expand All @@ -181,15 +194,15 @@ namespace graphene { namespace chain {
//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( assert );

GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( balance_claim );
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( claimed_too_often, balance_claim, 1, "balance claimed too often" )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( invalid_claim_amount, balance_claim, 2, "invalid claim amount" )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( owner_mismatch, balance_claim, 3, "owner mismatch" )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( claimed_too_often, balance_claim, 1 )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( invalid_claim_amount, balance_claim, 2 )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( owner_mismatch, balance_claim, 3 )

GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( override_transfer );
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( not_permitted, override_transfer, 1, "not permitted" )
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( not_permitted, override_transfer, 1 )

GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( blind_transfer );
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( unknown_commitment, blind_transfer, 1, "Attempting to claim an unknown prior commitment" );
GRAPHENE_DECLARE_OP_EVALUATE_EXCEPTION( unknown_commitment, blind_transfer, 1 )

//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( transfer_from_blind_operation )
//GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( asset_claim_fees_operation )
Expand Down
Loading