From 314d6cd39f0ab7e5b7b17a624a51b16c21eb89fb Mon Sep 17 00:00:00 2001 From: Alex-GR Date: Wed, 9 Nov 2016 03:09:12 +0200 Subject: [PATCH 1/2] Improve some comments One of the most weird comments I've seen is the "Changing your vote requires actually changing you vote."... this usually happens, when I've already voted through the feed but I also have a tab open to read the article. If I've already clicked from the feed, and then re-click from inside the tab, I get that one. But it's a weird message and that's why I think it should change. Going over the messages I saw a few that could be improved in syntax/grammar or first capital letter (makes things look more professional compared to all-lower capital letters). --- libraries/chain/steem_evaluator.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libraries/chain/steem_evaluator.cpp b/libraries/chain/steem_evaluator.cpp index 6c8c70d5b8..53325e4e2e 100644 --- a/libraries/chain/steem_evaluator.cpp +++ b/libraries/chain/steem_evaluator.cpp @@ -64,7 +64,7 @@ void witness_update_evaluator::do_apply( const witness_update_operation& o ) if ( db().has_hardfork( STEEMIT_HARDFORK_0_1 ) ) { - FC_ASSERT( o.url.size() <= STEEMIT_MAX_WITNESS_URL_LENGTH, "url is too long" ); + FC_ASSERT( o.url.size() <= STEEMIT_MAX_WITNESS_URL_LENGTH, "URL is too long" ); } else if( o.url.size() > STEEMIT_MAX_WITNESS_URL_LENGTH ) { @@ -362,7 +362,7 @@ void comment_evaluator::do_apply( const comment_operation& o ) { FC_ASSERT( parent->root_comment( db() ).allow_replies, "Comment has disabled replies." ); if( db().has_hardfork( STEEMIT_HARDFORK_0_12__177) ) - FC_ASSERT( db().calculate_discussion_payout_time( *parent ) != fc::time_point_sec::maximum(), "discussion is frozen" ); + FC_ASSERT( db().calculate_discussion_payout_time( *parent ) != fc::time_point_sec::maximum(), "Discussion is frozen" ); } if( db().has_hardfork( STEEMIT_HARDFORK_0_12__176 ) ) @@ -490,7 +490,7 @@ void comment_evaluator::do_apply( const comment_operation& o ) const auto& comment = *itr; if( db().has_hardfork( STEEMIT_HARDFORK_0_14__306 ) ) - FC_ASSERT( comment.mode != archived, "comment is archived" ); + FC_ASSERT( comment.mode != archived, "The comment is archived" ); else if( db().has_hardfork( STEEMIT_HARDFORK_0_10 ) ) FC_ASSERT( comment.last_payout == fc::time_point_sec::min(), "Can only edit during the first 24 hours" ); @@ -771,7 +771,7 @@ void withdraw_vesting_evaluator::do_apply( const withdraw_vesting_operation& o ) min_vests.amount.value *= 10; FC_ASSERT( account.vesting_shares > min_vests, - "Account registered by another account requires 10x account creation fee worth of Steem Power before it can power down" ); + "Account registered by another account requires 10x account creation fee worth of Steem Power before it can powered down" ); } if( o.vesting_shares.amount == 0 ) @@ -928,7 +928,7 @@ void account_witness_vote_evaluator::do_apply( const account_witness_vote_operat auto itr = by_account_witness_idx.find( boost::make_tuple( voter.id, witness.id ) ); if( itr == by_account_witness_idx.end() ) { - FC_ASSERT( o.approve, "vote doesn't exist, user must be indicate a desire to approve witness" ); + FC_ASSERT( o.approve, "vote doesn't exist, user must indicate a desire to approve witness" ); if ( db().has_hardfork( STEEMIT_HARDFORK_0_2 ) ) { @@ -962,7 +962,7 @@ void account_witness_vote_evaluator::do_apply( const account_witness_vote_operat }); } else { - FC_ASSERT( !o.approve, "vote currently exists, user must be indicate a desire to reject witness" ); + FC_ASSERT( !o.approve, "vote currently exists, user must indicate a desire to reject witness" ); if ( db().has_hardfork( STEEMIT_HARDFORK_0_2 ) ) { if( db().has_hardfork( STEEMIT_HARDFORK_0_3 ) ) @@ -1049,18 +1049,18 @@ void vote_evaluator::do_apply( const vote_operation& o ) { used_power = (used_power + max_vote_denom - 1) / max_vote_denom; } - FC_ASSERT( used_power <= current_power, "Account does not have enough power for vote" ); + FC_ASSERT( used_power <= current_power, "Account does not have enough power to vote" ); int64_t abs_rshares = ((uint128_t(voter.vesting_shares.amount.value) * used_power) / (STEEMIT_100_PERCENT)).to_uint64(); if( !db().has_hardfork( STEEMIT_HARDFORK_0_14__259 ) && abs_rshares == 0 ) abs_rshares = 1; if( db().has_hardfork( STEEMIT_HARDFORK_0_14__259 ) ) { - FC_ASSERT( abs_rshares > 50000000 || o.weight == 0, "voting weight is too small, please accumulate more voting power or steem power" ); + FC_ASSERT( abs_rshares > 50000000 || o.weight == 0, "Voting weight is too small, please accumulate more voting power or steem power" ); } else if( db().has_hardfork( STEEMIT_HARDFORK_0_13__248 ) ) { - FC_ASSERT( abs_rshares > 50000000 || abs_rshares == 1, "voting weight is too small, please accumulate more voting power or steem power" ); + FC_ASSERT( abs_rshares > 50000000 || abs_rshares == 1, "Voting weight is too small, please accumulate more voting power or steem power" ); } @@ -1241,13 +1241,13 @@ void vote_evaluator::do_apply( const vote_operation& o ) FC_ASSERT( itr->num_changes < STEEMIT_MAX_VOTE_CHANGES, "Cannot change vote again" ); if( db().is_producing() || db().has_hardfork( STEEMIT_HARDFORK_0_6__112 ) ) - FC_ASSERT( itr->vote_percent != o.weight, "Changing your vote requires actually changing you vote." ); + FC_ASSERT( itr->vote_percent != o.weight, "You have already voted in a similar way." ); /// this is the rshares voting for or against the post int64_t rshares = o.weight < 0 ? -abs_rshares : abs_rshares; if( itr->rshares < rshares && db().has_hardfork( STEEMIT_HARDFORK_0_7 ) ) - FC_ASSERT( db().head_block_time() < db().calculate_discussion_payout_time( comment ) - STEEMIT_UPVOTE_LOCKOUT, "Cannot increase payout withing last minute before payout" ); + FC_ASSERT( db().head_block_time() < db().calculate_discussion_payout_time( comment ) - STEEMIT_UPVOTE_LOCKOUT, "Cannot increase payout within last minute before payout" ); db().modify( voter, [&]( account_object& a ){ a.voting_power = current_power - used_power; @@ -1562,7 +1562,7 @@ void feed_publish_evaluator::do_apply( const feed_publish_operation& o ) void convert_evaluator::do_apply( const convert_operation& o ) { const auto& owner = db().get_account( o.owner ); - FC_ASSERT( db().get_balance( owner, o.amount.symbol ) >= o.amount, "account does not sufficient balance" ); + FC_ASSERT( db().get_balance( owner, o.amount.symbol ) >= o.amount, "account does not have sufficient balance" ); db().adjust_balance( owner, -o.amount ); From ffd4af2916a704be1ff9d47f3f2e263ffbd522e8 Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Wed, 9 Nov 2016 10:55:12 -0500 Subject: [PATCH 2/2] Update more error messages #564 --- libraries/chain/steem_evaluator.cpp | 267 +++++++++++++--------------- 1 file changed, 128 insertions(+), 139 deletions(-) diff --git a/libraries/chain/steem_evaluator.cpp b/libraries/chain/steem_evaluator.cpp index 53325e4e2e..d28ed14fcc 100644 --- a/libraries/chain/steem_evaluator.cpp +++ b/libraries/chain/steem_evaluator.cpp @@ -32,7 +32,7 @@ namespace steemit { namespace chain { inline void validate_permlink_0_1( const string& permlink ) { - FC_ASSERT( permlink.size() > STEEMIT_MIN_PERMLINK_LENGTH && permlink.size() < STEEMIT_MAX_PERMLINK_LENGTH, "permlink is not a valid size" ); + FC_ASSERT( permlink.size() > STEEMIT_MIN_PERMLINK_LENGTH && permlink.size() < STEEMIT_MAX_PERMLINK_LENGTH, "Permlink is not a valid size." ); for( auto c : permlink ) { @@ -110,11 +110,11 @@ void account_create_evaluator::do_apply( const account_create_operation& o ) const auto& props = db().get_dynamic_global_properties(); - FC_ASSERT( creator.balance >= o.fee, "Insufficient balance to create account", ( "creator.balance", creator.balance )( "required", o.fee ) ); + FC_ASSERT( creator.balance >= o.fee, "Insufficient balance to create account.", ( "creator.balance", creator.balance )( "required", o.fee ) ); if( db().has_hardfork( STEEMIT_HARDFORK_0_1 ) ) { const witness_schedule_object& wso = db().get_witness_schedule_object(); - FC_ASSERT( o.fee >= wso.median_props.account_creation_fee, "Insufficient Fee: ${f} required, ${p} provided", + FC_ASSERT( o.fee >= wso.median_props.account_creation_fee, "Insufficient Fee: ${f} required, ${p} provided.", ("f", wso.median_props.account_creation_fee) ("p", o.fee) ); } @@ -176,7 +176,7 @@ void account_create_evaluator::do_apply( const account_create_operation& o ) void account_update_evaluator::do_apply( const account_update_operation& o ) { - if( db().has_hardfork( STEEMIT_HARDFORK_0_1 ) ) FC_ASSERT( o.account != STEEMIT_TEMP_ACCOUNT, "cannot update temp account" ); + if( db().has_hardfork( STEEMIT_HARDFORK_0_1 ) ) FC_ASSERT( o.account != STEEMIT_TEMP_ACCOUNT, "Cannot update temp account." ); if( ( db().has_hardfork( STEEMIT_HARDFORK_0_15__465 ) || db().is_producing() ) && o.posting ) // TODO: Add HF 15 o.posting->validate(); @@ -188,7 +188,7 @@ void account_update_evaluator::do_apply( const account_update_operation& o ) { #ifndef IS_TEST_NET if( db().has_hardfork( STEEMIT_HARDFORK_0_11 ) ) - FC_ASSERT( db().head_block_time() - account_auth.last_owner_update > STEEMIT_OWNER_UPDATE_LIMIT, "can only update owner authority once a minute" ); + FC_ASSERT( db().head_block_time() - account_auth.last_owner_update > STEEMIT_OWNER_UPDATE_LIMIT, "Owner authority can only be updated once a minute." ); #endif if( ( db().has_hardfork( STEEMIT_HARDFORK_0_15__465 ) || db().is_producing() ) ) // TODO: Add HF 15 @@ -257,14 +257,14 @@ void delete_comment_evaluator::do_apply( const delete_comment_operation& o ) { if( db().has_hardfork( STEEMIT_HARDFORK_0_10 ) ) { const auto& auth = db().get_account( o.author ); - FC_ASSERT( !(auth.owner_challenged || auth.active_challenged ), "cannot process operation because account is currently challenged" ); + FC_ASSERT( !(auth.owner_challenged || auth.active_challenged ), "Operation cannot be processed because account is currently challenged." ); } const auto& comment = db().get_comment( o.author, o.permlink ); - FC_ASSERT( comment.children == 0, "comment cannot have any replies" ); + FC_ASSERT( comment.children == 0, "Cannot delete a comment with replies." ); if( db().is_producing() ) { - FC_ASSERT( comment.net_rshares <= 0, "comment cannot have any net positive votes" ); + FC_ASSERT( comment.net_rshares <= 0, "Cannot delete a comment with net positive votes." ); } if( comment.net_rshares > 0 ) return; @@ -313,19 +313,19 @@ void comment_options_evaluator::do_apply( const comment_options_operation& o ) if( db().has_hardfork( STEEMIT_HARDFORK_0_10 ) ) { const auto& auth = db().get_account( o.author ); - FC_ASSERT( !(auth.owner_challenged || auth.active_challenged ), "cannot process operation because account is currently challenged" ); + FC_ASSERT( !(auth.owner_challenged || auth.active_challenged ), "Operation cannot be processed because account is currently challenged." ); } const auto& comment = db().get_comment( o.author, o.permlink ); if( !o.allow_curation_rewards || !o.allow_votes || o.max_accepted_payout < comment.max_accepted_payout ) - FC_ASSERT( comment.abs_rshares == 0, "operations contains options that are only updatedable on an account with no rshares" ); + FC_ASSERT( comment.abs_rshares == 0, "One of the included comment options requires the comment to have no rshares allocated to it." ); - FC_ASSERT( o.extensions.size() == 0, "extensions are not currently supported" ); - FC_ASSERT( comment.allow_curation_rewards >= o.allow_curation_rewards, "cannot re-enable curation rewards" ); - FC_ASSERT( comment.allow_votes >= o.allow_votes, "cannot re-enable votes" ); - FC_ASSERT( comment.max_accepted_payout >= o.max_accepted_payout, "cannot accept a greater payout" ); - FC_ASSERT( comment.percent_steem_dollars >= o.percent_steem_dollars, "cannot accept a greater percent Steem Dollars" ); + FC_ASSERT( o.extensions.size() == 0, "Operation extensions for the comment_options_operation are not currently supported." ); + FC_ASSERT( comment.allow_curation_rewards >= o.allow_curation_rewards, "Curation rewards cannot be re-enabled." ); + FC_ASSERT( comment.allow_votes >= o.allow_votes, "Voting cannot be re-enabled." ); + FC_ASSERT( comment.max_accepted_payout >= o.max_accepted_payout, "A comment cannot accept a greater payout." ); + FC_ASSERT( comment.percent_steem_dollars >= o.percent_steem_dollars, "A comment cannot accept a greater percent SBD." ); db().modify( comment, [&]( comment_object& c ) { c.max_accepted_payout = o.max_accepted_payout; @@ -337,7 +337,7 @@ void comment_options_evaluator::do_apply( const comment_options_operation& o ) void comment_evaluator::do_apply( const comment_operation& o ) { try { if( db().is_producing() || db().has_hardfork( STEEMIT_HARDFORK_0_5__55 ) ) - FC_ASSERT( o.title.size() + o.body.size() + o.json_metadata.size(), "something should change" ); + FC_ASSERT( o.title.size() + o.body.size() + o.json_metadata.size(), "Cannot update comment because nothing appears to be changing." ); const auto& by_permlink_idx = db().get_index< comment_index >().indices().get< by_permlink >(); auto itr = by_permlink_idx.find( boost::make_tuple( o.author, o.permlink ) ); @@ -345,14 +345,14 @@ void comment_evaluator::do_apply( const comment_operation& o ) const auto& auth = db().get_account( o.author ); /// prove it exists if( db().has_hardfork( STEEMIT_HARDFORK_0_10 ) ) - FC_ASSERT( !(auth.owner_challenged || auth.active_challenged ), "cannot process operation because account is currently challenged" ); + FC_ASSERT( !(auth.owner_challenged || auth.active_challenged ), "Operation cannot be processed because account is currently challenged." ); comment_id_type id; const comment_object* parent = nullptr; if( o.parent_author != STEEMIT_ROOT_POST_PARENT ) { parent = &db().get_comment( o.parent_author, o.parent_permlink ); - FC_ASSERT( parent->depth < STEEMIT_MAX_COMMENT_DEPTH, "Comment is nested ${x} posts deep, maximum depth is ${y}", ("x",parent->depth)("y",STEEMIT_MAX_COMMENT_DEPTH) ); + FC_ASSERT( parent->depth < STEEMIT_MAX_COMMENT_DEPTH, "Comment is nested ${x} posts deep, maximum depth is ${y}.", ("x",parent->depth)("y",STEEMIT_MAX_COMMENT_DEPTH) ); } auto now = db().head_block_time(); @@ -360,28 +360,28 @@ void comment_evaluator::do_apply( const comment_operation& o ) { if( o.parent_author != STEEMIT_ROOT_POST_PARENT ) { - FC_ASSERT( parent->root_comment( db() ).allow_replies, "Comment has disabled replies." ); + FC_ASSERT( parent->root_comment( db() ).allow_replies, "The parent comment has disabled replies." ); if( db().has_hardfork( STEEMIT_HARDFORK_0_12__177) ) - FC_ASSERT( db().calculate_discussion_payout_time( *parent ) != fc::time_point_sec::maximum(), "Discussion is frozen" ); + FC_ASSERT( db().calculate_discussion_payout_time( *parent ) != fc::time_point_sec::maximum(), "Discussion is frozen." ); } if( db().has_hardfork( STEEMIT_HARDFORK_0_12__176 ) ) { if( o.parent_author == STEEMIT_ROOT_POST_PARENT ) - FC_ASSERT( (now - auth.last_root_post) > STEEMIT_MIN_ROOT_COMMENT_INTERVAL, "You may only post once every 5 minutes", ("now",now)("auth.last_root_post",auth.last_root_post) ); + FC_ASSERT( (now - auth.last_root_post) > STEEMIT_MIN_ROOT_COMMENT_INTERVAL, "You may only post once every 5 minutes.", ("now",now)("auth.last_root_post",auth.last_root_post) ); else - FC_ASSERT( (now - auth.last_post) > STEEMIT_MIN_REPLY_INTERVAL, "You may only comment once every 20 seconds", ("now",now)("auth.last_post",auth.last_post) ); + FC_ASSERT( (now - auth.last_post) > STEEMIT_MIN_REPLY_INTERVAL, "You may only comment once every 20 seconds.", ("now",now)("auth.last_post",auth.last_post) ); } else if( db().has_hardfork( STEEMIT_HARDFORK_0_6__113 ) ) { if( o.parent_author == STEEMIT_ROOT_POST_PARENT ) - FC_ASSERT( (now - auth.last_post) > STEEMIT_MIN_ROOT_COMMENT_INTERVAL, "You may only post once every 5 minutes", ("now",now)("auth.last_post",auth.last_post) ); + FC_ASSERT( (now - auth.last_post) > STEEMIT_MIN_ROOT_COMMENT_INTERVAL, "You may only post once every 5 minutes.", ("now",now)("auth.last_post",auth.last_post) ); else - FC_ASSERT( (now - auth.last_post) > STEEMIT_MIN_REPLY_INTERVAL, "You may only comment once every 20 seconds", ("now",now)("auth.last_post",auth.last_post) ); + FC_ASSERT( (now - auth.last_post) > STEEMIT_MIN_REPLY_INTERVAL, "You may only comment once every 20 seconds.", ("now",now)("auth.last_post",auth.last_post) ); } else { - FC_ASSERT( (now - auth.last_post) > fc::seconds(60), "You may only post once per minute", ("now",now)("auth.last_post",auth.last_post) ); + FC_ASSERT( (now - auth.last_post) > fc::seconds(60), "You may only post once per minute.", ("now",now)("auth.last_post",auth.last_post) ); } uint16_t reward_weight = STEEMIT_100_PERCENT; @@ -490,9 +490,9 @@ void comment_evaluator::do_apply( const comment_operation& o ) const auto& comment = *itr; if( db().has_hardfork( STEEMIT_HARDFORK_0_14__306 ) ) - FC_ASSERT( comment.mode != archived, "The comment is archived" ); + FC_ASSERT( comment.mode != archived, "The comment is archived." ); else if( db().has_hardfork( STEEMIT_HARDFORK_0_10 ) ) - FC_ASSERT( comment.last_payout == fc::time_point_sec::min(), "Can only edit during the first 24 hours" ); + FC_ASSERT( comment.last_payout == fc::time_point_sec::min(), "Can only edit during the first 24 hours." ); db().modify( comment, [&]( comment_object& com ) { @@ -502,13 +502,13 @@ void comment_evaluator::do_apply( const comment_operation& o ) if( !parent ) { - FC_ASSERT( com.parent_author == account_name_type(), "The parent of a comment cannot change" ); - FC_ASSERT( equal( com.parent_permlink, o.parent_permlink ), "The permlink of a comment cannot change" ); + FC_ASSERT( com.parent_author == account_name_type(), "The parent of a comment cannot change." ); + FC_ASSERT( equal( com.parent_permlink, o.parent_permlink ), "The permlink of a comment cannot change." ); } else { - FC_ASSERT( com.parent_author == o.parent_author, "The parent of a comment cannot change" ); - FC_ASSERT( equal( com.parent_permlink, o.parent_permlink ), "The permlink of a comment cannot change" ); + FC_ASSERT( com.parent_author == o.parent_author, "The parent of a comment cannot change." ); + FC_ASSERT( equal( com.parent_permlink, o.parent_permlink ), "The permlink of a comment cannot change." ); } #ifndef IS_LOW_MEM @@ -546,14 +546,12 @@ void escrow_transfer_evaluator::do_apply( const escrow_transfer_operation& o ) { try { - FC_ASSERT( db().has_hardfork( STEEMIT_HARDFORK_0_14__143 ), "op is not valid until next hardfork" ); /// TODO: remove this after HF14 - const auto& from_account = db().get_account(o.from); db().get_account(o.to); db().get_account(o.agent); - FC_ASSERT( o.ratification_deadline > db().head_block_time(), "ratification deadline must be after head block time" ); - FC_ASSERT( o.escrow_expiration > db().head_block_time(), "escrow expiration must be after head block time" ); + FC_ASSERT( o.ratification_deadline > db().head_block_time(), "The escorw ratification deadline must be after head block time." ); + FC_ASSERT( o.escrow_expiration > db().head_block_time(), "The escrow expiration must be after head block time." ); asset steem_spent = o.steem_amount; asset sbd_spent = o.sbd_amount; @@ -562,8 +560,8 @@ void escrow_transfer_evaluator::do_apply( const escrow_transfer_operation& o ) else sbd_spent += o.fee; - FC_ASSERT( from_account.balance >= steem_spent, "account cannot cover steem costs of escrow" ); - FC_ASSERT( from_account.sbd_balance >= sbd_spent, "account cannot cover sbd costs of escrow" ); + FC_ASSERT( from_account.balance >= steem_spent, "Account cannot cover STEEM costs of escrow. Required: ${r} Available: ${a}", ("r",steem_spent)("a",from_account.balance) ); + FC_ASSERT( from_account.sbd_balance >= sbd_spent, "Account cannot cover SBD costs of escrow. Required: ${r} Available: ${a}", ("r",sbd_spent)("a",from_account.sbd_balance) ); db().adjust_balance( from_account, -steem_spent ); db().adjust_balance( from_account, -sbd_spent ); @@ -588,19 +586,17 @@ void escrow_approve_evaluator::do_apply( const escrow_approve_operation& o ) { try { - FC_ASSERT( db().has_hardfork( STEEMIT_HARDFORK_0_14__143 ), "op is not valid until next hardfork" ); /// TODO: remove this after HF14 - const auto& escrow = db().get_escrow( o.from, o.escrow_id ); - FC_ASSERT( escrow.to == o.to, "op 'to' does not match escrow 'to'" ); - FC_ASSERT( escrow.agent == o.agent, "op 'agent' does not match escrow 'agent'" ); - FC_ASSERT( escrow.ratification_deadline >= db().head_block_time(), "escrow ratification deadline is before head block time" ); + FC_ASSERT( escrow.to == o.to, "Operation 'to' (${o}) does not match escrow 'to' (${e}).", ("o", o.to)("e", escrow.to) ); + FC_ASSERT( escrow.agent == o.agent, "Operation 'agent' (${a}) does not match escrow 'agent' (${e}).", ("o", o.agent)("e", escrow.agent) ); + FC_ASSERT( escrow.ratification_deadline >= db().head_block_time(), "The escrow ratification deadline has passed. Escrow can no longer be ratified." ); bool reject_escrow = !o.approve; if( o.who == o.to ) { - FC_ASSERT( !escrow.to_approved, "'to' has already approved the escrow" ); + FC_ASSERT( !escrow.to_approved, "Account 'to' (${t}) has already approved the escrow.", ("t", o.to) ); if( !reject_escrow ) { @@ -612,7 +608,7 @@ void escrow_approve_evaluator::do_apply( const escrow_approve_operation& o ) } if( o.who == o.agent ) { - FC_ASSERT( !escrow.agent_approved, "'agent' has already approved the escrow" ); + FC_ASSERT( !escrow.agent_approved, "Account 'agent' (${a}) has already approved the escrow.", ("a", o.agent) ); if( !reject_escrow ) { @@ -650,15 +646,14 @@ void escrow_dispute_evaluator::do_apply( const escrow_dispute_operation& o ) { try { - FC_ASSERT( db().has_hardfork( STEEMIT_HARDFORK_0_14__143 ), "op is not valid until next hardfork" ); /// TODO: remove this after HF14 db().get_account( o.from ); // Verify from account exists const auto& e = db().get_escrow( o.from, o.escrow_id ); - FC_ASSERT( db().head_block_time() < e.escrow_expiration, "disputes must be raised before expiration" ); - FC_ASSERT( e.to_approved && e.agent_approved, "escrow must be approved by all parties before a dispute can be raised" ); - FC_ASSERT( !e.disputed, "escrow is already under dispute" ); - FC_ASSERT( e.to == o.to, "op 'to' does not match escrow 'to'"); - FC_ASSERT( e.agent == o.agent, "op 'agent' does not match escrow 'agent'" ); + FC_ASSERT( db().head_block_time() < e.escrow_expiration, "Disputing the escrow must happen before expiration." ); + FC_ASSERT( e.to_approved && e.agent_approved, "The escrow must be approved by all parties before a dispute can be raised." ); + FC_ASSERT( !e.disputed, "The escrow is already under dispute." ); + FC_ASSERT( e.to == o.to, "Operation 'to' (${o}) does not match escrow 'to' (${e}).", ("o", o.to)("e", e.to) ); + FC_ASSERT( e.agent == o.agent, "Operation 'agent' (${a}) does not match escrow 'agent' (${e}).", ("o", o.agent)("e", e.agent) ); db().modify( e, [&]( escrow_object& esc ) { @@ -672,38 +667,36 @@ void escrow_release_evaluator::do_apply( const escrow_release_operation& o ) { try { - FC_ASSERT( db().has_hardfork( STEEMIT_HARDFORK_0_14__143 ), "op is not valid until next hardfork" ); /// TODO: remove this after HF14 - db().get_account(o.from); // Verify from account exists const auto& receiver_account = db().get_account(o.receiver); const auto& e = db().get_escrow( o.from, o.escrow_id ); - FC_ASSERT( e.steem_balance >= o.steem_amount, "Release amount exceeds escrow balance" ); - FC_ASSERT( e.sbd_balance >= o.sbd_amount, "Release amount exceeds escrow balance" ); - FC_ASSERT( e.to == o.to, "op 'to' does not match escrow 'to'"); - FC_ASSERT( e.agent == o.agent, "op 'agent' does not match escrow 'agent'" ); - FC_ASSERT( o.receiver == e.from || o.receiver == e.to, "Funds must be released to 'from' or 'to'" ); - FC_ASSERT( e.to_approved && e.agent_approved, "Funds cannot be released prior to escrow approval" ); + FC_ASSERT( e.steem_balance >= o.steem_amount, "Release amount exceeds escrow balance. Amount: ${a}, Balance: ${b}", ("a", o.steem_amount)("b", e.steem_balance) ); + FC_ASSERT( e.sbd_balance >= o.sbd_amount, "Release amount exceeds escrow balance. Amount: ${a}, Balance: ${b}", ("a", o.sbd_amount)("b", e.sbd_balance) ); + FC_ASSERT( e.to == o.to, "Operation 'to' (${o}) does not match escrow 'to' (${e}).", ("o", o.to)("e", e.to) ); + FC_ASSERT( e.agent == o.agent, "Operation 'agent' (${a}) does not match escrow 'agent' (${e}).", ("o", o.agent)("e", e.agent) ); + FC_ASSERT( o.receiver == e.from || o.receiver == e.to, "Funds must be released to 'from' (${f}) or 'to' (${t})", ("f", e.from)("t", e.to) ); + FC_ASSERT( e.to_approved && e.agent_approved, "Funds cannot be released prior to escrow approval." ); // If there is a dispute regardless of expiration, the agent can release funds to either party if( e.disputed ) { - FC_ASSERT( o.who == e.agent, "'agent' must release funds for a disputed escrow" ); + FC_ASSERT( o.who == e.agent, "Only 'agent' (${a}) can release funds in a disputed escrow.", ("a", e.agent) ); } else { - FC_ASSERT( o.who == e.from || o.who == e.to, "Only 'from' and 'to' can release from a non-disputed escrow" ); + FC_ASSERT( o.who == e.from || o.who == e.to, "Only 'from' (${f}) and 'to' (${t}) can release funds from a non-disputed escrow", ("f", e.from)("t", e.to) ); if( e.escrow_expiration > db().head_block_time() ) { // If there is no dispute and escrow has not expired, either party can release funds to the other. if( o.who == e.from ) { - FC_ASSERT( o.receiver == e.to, "'from' must release funds to 'to'" ); + FC_ASSERT( o.receiver == e.to, "Only 'from' (${f}) can release funds to 'to' (${t}).", ("f", e.from)("t", e.to) ); } else if( o.who == e.to ) { - FC_ASSERT( o.receiver == e.from, "'to' must release funds to 'from'" ); + FC_ASSERT( o.receiver == e.from, "Only 'to' (${t}) can release funds to 'from' (${t}).", ("f", e.from)("t", e.to) ); } } } @@ -740,7 +733,7 @@ void transfer_evaluator::do_apply( const transfer_operation& o ) }); } - FC_ASSERT( db().get_balance( from_account, o.amount.symbol ) >= o.amount, "account does not have sufficient funds for transfer" ); + FC_ASSERT( db().get_balance( from_account, o.amount.symbol ) >= o.amount, "Account does not have sufficient funds for transfer." ); db().adjust_balance( from_account, -o.amount ); db().adjust_balance( to_account, o.amount ); } @@ -750,7 +743,7 @@ void transfer_to_vesting_evaluator::do_apply( const transfer_to_vesting_operatio const auto& from_account = db().get_account(o.from); const auto& to_account = o.to.size() ? db().get_account(o.to) : from_account; - FC_ASSERT( db().get_balance( from_account, STEEM_SYMBOL) >= o.amount, "account does not have sufficient STEEM for the transfer" ); + FC_ASSERT( db().get_balance( from_account, STEEM_SYMBOL) >= o.amount, "Account does not have sufficient STEEM for transfer." ); db().adjust_balance( from_account, -o.amount ); db().create_vesting( to_account, o.amount ); } @@ -759,8 +752,8 @@ void withdraw_vesting_evaluator::do_apply( const withdraw_vesting_operation& o ) { const auto& account = db().get_account( o.account ); - FC_ASSERT( account.vesting_shares >= asset( 0, VESTS_SYMBOL ), "account does not have sufficient Steem Power for withdraw" ); - FC_ASSERT( account.vesting_shares >= o.vesting_shares, "account does not have sufficient Steem Power for withdraw" ); + FC_ASSERT( account.vesting_shares >= asset( 0, VESTS_SYMBOL ), "Account does not have sufficient Steem Power for withdraw." ); + FC_ASSERT( account.vesting_shares >= o.vesting_shares, "Account does not have sufficient Steem Power for withdraw." ); if( !account.mined && db().has_hardfork( STEEMIT_HARDFORK_0_1 ) ) { @@ -771,13 +764,13 @@ void withdraw_vesting_evaluator::do_apply( const withdraw_vesting_operation& o ) min_vests.amount.value *= 10; FC_ASSERT( account.vesting_shares > min_vests, - "Account registered by another account requires 10x account creation fee worth of Steem Power before it can powered down" ); + "Account registered by another account requires 10x account creation fee worth of Steem Power before it can be powered down." ); } if( o.vesting_shares.amount == 0 ) { if( db().is_producing() || db().has_hardfork( STEEMIT_HARDFORK_0_5__57 ) ) - FC_ASSERT( account.vesting_withdraw_rate.amount != 0, "this operation would not change the vesting withdraw rate" ); + FC_ASSERT( account.vesting_withdraw_rate.amount != 0, "This operation would not change the vesting withdraw rate." ); db().modify( account, [&]( account_object& a ) { a.vesting_withdraw_rate = asset( 0, VESTS_SYMBOL ); @@ -796,7 +789,7 @@ void withdraw_vesting_evaluator::do_apply( const withdraw_vesting_operation& o ) new_vesting_withdraw_rate.amount = 1; if( db().is_producing() || db().has_hardfork( STEEMIT_HARDFORK_0_5__57 ) ) - FC_ASSERT( account.vesting_withdraw_rate != new_vesting_withdraw_rate, "this operation would not change the vesting withdraw rate" ); + FC_ASSERT( account.vesting_withdraw_rate != new_vesting_withdraw_rate, "This operation would not change the vesting withdraw rate." ); a.vesting_withdraw_rate = new_vesting_withdraw_rate; a.next_vesting_withdrawal = db().head_block_time() + fc::seconds(STEEMIT_VESTING_WITHDRAW_INTERVAL_SECONDS); @@ -818,7 +811,7 @@ void set_withdraw_vesting_route_evaluator::do_apply( const set_withdraw_vesting_ if( itr == wd_idx.end() ) { FC_ASSERT( o.percent != 0, "Cannot create a 0% destination." ); - FC_ASSERT( from_account.withdraw_routes < STEEMIT_MAX_WITHDRAW_ROUTES, "account already has the maximum number of routes" ); + FC_ASSERT( from_account.withdraw_routes < STEEMIT_MAX_WITHDRAW_ROUTES, "Account already has the maximum number of routes." ); db().create< withdraw_vesting_route_object >( [&]( withdraw_vesting_route_object& wvdo ) { @@ -862,7 +855,7 @@ void set_withdraw_vesting_route_evaluator::do_apply( const set_withdraw_vesting_ ++itr; } - FC_ASSERT( total_percent <= STEEMIT_100_PERCENT, "More than 100% of vesting allocated to destinations" ); + FC_ASSERT( total_percent <= STEEMIT_100_PERCENT, "More than 100% of vesting withdrawals allocated to destinations." ); } FC_CAPTURE_AND_RETHROW() } @@ -870,9 +863,9 @@ void set_withdraw_vesting_route_evaluator::do_apply( const set_withdraw_vesting_ void account_witness_proxy_evaluator::do_apply( const account_witness_proxy_operation& o ) { const auto& account = db().get_account( o.account ); - FC_ASSERT( account.proxy != o.proxy, "something must change" ); + FC_ASSERT( account.proxy != o.proxy, "Proxy must change." ); - FC_ASSERT( account.can_vote, "Account has declined the ability to vote and cannot proxy votes" ); + FC_ASSERT( account.can_vote, "Account has declined the ability to vote and cannot proxy votes." ); /// remove all current votes std::array delta; @@ -890,9 +883,9 @@ void account_witness_proxy_evaluator::do_apply( const account_witness_proxy_oper auto cprox = &new_proxy; while( cprox->proxy.size() != 0 ) { const auto next_proxy = db().get_account( cprox->proxy ); - FC_ASSERT( proxy_chain.insert( next_proxy.id ).second, "Attempt to create a proxy loop" ); + FC_ASSERT( proxy_chain.insert( next_proxy.id ).second, "This proxy would create a proxy loop." ); cprox = &next_proxy; - FC_ASSERT( proxy_chain.size() <= STEEMIT_MAX_PROXY_RECURSION_DEPTH, "Proxy chain is too long" ); + FC_ASSERT( proxy_chain.size() <= STEEMIT_MAX_PROXY_RECURSION_DEPTH, "Proxy chain is too long." ); } /// clear all individual vote records @@ -917,10 +910,10 @@ void account_witness_proxy_evaluator::do_apply( const account_witness_proxy_oper void account_witness_vote_evaluator::do_apply( const account_witness_vote_operation& o ) { const auto& voter = db().get_account( o.account ); - FC_ASSERT( voter.proxy.size() == 0, "A proxy is currently set, please clear the proxy before voting for a witness" ); + FC_ASSERT( voter.proxy.size() == 0, "A proxy is currently set, please clear the proxy before voting for a witness." ); if( o.approve ) - FC_ASSERT( voter.can_vote, "Account has declined its voting rights" ); + FC_ASSERT( voter.can_vote, "Account has declined its voting rights." ); const auto& witness = db().get_witness( o.witness ); @@ -928,11 +921,11 @@ void account_witness_vote_evaluator::do_apply( const account_witness_vote_operat auto itr = by_account_witness_idx.find( boost::make_tuple( voter.id, witness.id ) ); if( itr == by_account_witness_idx.end() ) { - FC_ASSERT( o.approve, "vote doesn't exist, user must indicate a desire to approve witness" ); + FC_ASSERT( o.approve, "Vote doesn't exist, user must indicate a desire to approve witness." ); if ( db().has_hardfork( STEEMIT_HARDFORK_0_2 ) ) { - FC_ASSERT( voter.witnesses_voted_for < STEEMIT_MAX_ACCOUNT_WITNESS_VOTES, "account has voted for too many witnesses" ); // TODO: Remove after hardfork 2 + FC_ASSERT( voter.witnesses_voted_for < STEEMIT_MAX_ACCOUNT_WITNESS_VOTES, "Account has voted for too many witnesses." ); // TODO: Remove after hardfork 2 db().create( [&]( witness_vote_object& v ) { v.witness = witness.id; @@ -962,7 +955,7 @@ void account_witness_vote_evaluator::do_apply( const account_witness_vote_operat }); } else { - FC_ASSERT( !o.approve, "vote currently exists, user must indicate a desire to reject witness" ); + FC_ASSERT( !o.approve, "Vote currently exists, user must indicate a desire to reject witness." ); if ( db().has_hardfork( STEEMIT_HARDFORK_0_2 ) ) { if( db().has_hardfork( STEEMIT_HARDFORK_0_3 ) ) @@ -988,11 +981,11 @@ void vote_evaluator::do_apply( const vote_operation& o ) const auto& voter = db().get_account( o.voter ); if( db().has_hardfork( STEEMIT_HARDFORK_0_10 ) ) - FC_ASSERT( !(voter.owner_challenged || voter.active_challenged ), "Account is currently challenged" ); + FC_ASSERT( !(voter.owner_challenged || voter.active_challenged ), "Operation cannot be processed because the account is currently challenged." ); - FC_ASSERT( voter.can_vote, "Voter has declined their voting rights" ); + FC_ASSERT( voter.can_vote, "Voter has declined their voting rights." ); - if( o.weight > 0 ) FC_ASSERT( comment.allow_votes, "Votes are not allowed on the comment" ); + if( o.weight > 0 ) FC_ASSERT( comment.allow_votes, "Votes are not allowed on the comment." ); if( db().has_hardfork( STEEMIT_HARDFORK_0_12__177 ) && db().calculate_discussion_payout_time( comment ) == fc::time_point_sec::maximum() ) { @@ -1024,11 +1017,11 @@ void vote_evaluator::do_apply( const vote_operation& o ) int64_t elapsed_seconds = (db().head_block_time() - voter.last_vote_time).to_seconds(); if( db().has_hardfork( STEEMIT_HARDFORK_0_11 ) ) - FC_ASSERT( elapsed_seconds >= STEEMIT_MIN_VOTE_INTERVAL_SEC, "Can only vote once every 3 seconds" ); + FC_ASSERT( elapsed_seconds >= STEEMIT_MIN_VOTE_INTERVAL_SEC, "Can only vote once every 3 seconds." ); int64_t regenerated_power = (STEEMIT_100_PERCENT * elapsed_seconds) / STEEMIT_VOTE_REGENERATION_SECONDS; int64_t current_power = std::min( int64_t(voter.voting_power + regenerated_power), int64_t(STEEMIT_100_PERCENT) ); - FC_ASSERT( current_power > 0, "Account currently does not have voting power" ); + FC_ASSERT( current_power > 0, "Account currently does not have voting power." ); int64_t abs_weight = abs(o.weight); int64_t used_power = (current_power * abs_weight) / STEEMIT_100_PERCENT; @@ -1049,18 +1042,18 @@ void vote_evaluator::do_apply( const vote_operation& o ) { used_power = (used_power + max_vote_denom - 1) / max_vote_denom; } - FC_ASSERT( used_power <= current_power, "Account does not have enough power to vote" ); + FC_ASSERT( used_power <= current_power, "Account does not have enough power to vote." ); int64_t abs_rshares = ((uint128_t(voter.vesting_shares.amount.value) * used_power) / (STEEMIT_100_PERCENT)).to_uint64(); if( !db().has_hardfork( STEEMIT_HARDFORK_0_14__259 ) && abs_rshares == 0 ) abs_rshares = 1; if( db().has_hardfork( STEEMIT_HARDFORK_0_14__259 ) ) { - FC_ASSERT( abs_rshares > 50000000 || o.weight == 0, "Voting weight is too small, please accumulate more voting power or steem power" ); + FC_ASSERT( abs_rshares > 50000000 || o.weight == 0, "Voting weight is too small, please accumulate more voting power or steem power." ); } else if( db().has_hardfork( STEEMIT_HARDFORK_0_13__248 ) ) { - FC_ASSERT( abs_rshares > 50000000 || abs_rshares == 1, "Voting weight is too small, please accumulate more voting power or steem power" ); + FC_ASSERT( abs_rshares > 50000000 || abs_rshares == 1, "Voting weight is too small, please accumulate more voting power or steem power." ); } @@ -1069,7 +1062,7 @@ void vote_evaluator::do_apply( const vote_operation& o ) if( itr != comment_vote_idx.end() && itr->num_changes == -1 ) { if( db().is_producing() || db().has_hardfork( STEEMIT_HARDFORK_0_12__177 ) ) - FC_ASSERT( false, "Cannot vote again on a comment after payout" ); + FC_ASSERT( false, "Cannot vote again on a comment after payout." ); db().remove( *itr ); itr = comment_vote_idx.end(); @@ -1077,13 +1070,13 @@ void vote_evaluator::do_apply( const vote_operation& o ) if( itr == comment_vote_idx.end() ) { - FC_ASSERT( o.weight != 0, "Vote weight cannot be 0" ); + FC_ASSERT( o.weight != 0, "Vote weight cannot be 0." ); /// this is the rshares voting for or against the post int64_t rshares = o.weight < 0 ? -abs_rshares : abs_rshares; if( rshares > 0 && db().has_hardfork( STEEMIT_HARDFORK_0_7 ) ) { - FC_ASSERT( db().head_block_time() < db().calculate_discussion_payout_time( comment ) - STEEMIT_UPVOTE_LOCKOUT, "Cannot increase reward of post within the last minute before payout" ); + FC_ASSERT( db().head_block_time() < db().calculate_discussion_payout_time( comment ) - STEEMIT_UPVOTE_LOCKOUT, "Cannot increase reward of post within the last minute before payout." ); } //used_power /= (50*7); /// a 100% vote means use .28% of voting power which should force users to spread their votes around over 50+ posts day for a week @@ -1109,7 +1102,7 @@ void vote_evaluator::do_apply( const vote_operation& o ) auto avg_cashout_sec = ( cur_cashout_time_sec * old_root_abs_rshares + new_cashout_time_sec * abs_rshares ) / ( old_root_abs_rshares + abs_rshares ); - FC_ASSERT( abs_rshares > 0, "Cannot vote with no rshares" ); + FC_ASSERT( abs_rshares > 0, "Cannot vote with 0 rshares." ); auto old_vote_rshares = comment.vote_rshares; @@ -1238,7 +1231,7 @@ void vote_evaluator::do_apply( const vote_operation& o ) } else { - FC_ASSERT( itr->num_changes < STEEMIT_MAX_VOTE_CHANGES, "Cannot change vote again" ); + FC_ASSERT( itr->num_changes < STEEMIT_MAX_VOTE_CHANGES, "Voter has used the maximum number of vote changes on this comment." ); if( db().is_producing() || db().has_hardfork( STEEMIT_HARDFORK_0_6__112 ) ) FC_ASSERT( itr->vote_percent != o.weight, "You have already voted in a similar way." ); @@ -1247,7 +1240,7 @@ void vote_evaluator::do_apply( const vote_operation& o ) int64_t rshares = o.weight < 0 ? -abs_rshares : abs_rshares; if( itr->rshares < rshares && db().has_hardfork( STEEMIT_HARDFORK_0_7 ) ) - FC_ASSERT( db().head_block_time() < db().calculate_discussion_payout_time( comment ) - STEEMIT_UPVOTE_LOCKOUT, "Cannot increase payout within last minute before payout" ); + FC_ASSERT( db().head_block_time() < db().calculate_discussion_payout_time( comment ) - STEEMIT_UPVOTE_LOCKOUT, "Cannot increase payout within last minute before payout." ); db().modify( voter, [&]( account_object& a ){ a.voting_power = current_power - used_power; @@ -1351,7 +1344,7 @@ void custom_json_evaluator::do_apply( const custom_json_operation& o ) } catch(...) { - elog( "unexpected exception applying custom json evaluator" ); + elog( "Unexpected exception applying custom json evaluator." ); } } @@ -1376,7 +1369,7 @@ void custom_binary_evaluator::do_apply( const custom_binary_operation& o ) } catch(...) { - elog( "unexpected exception applying custom json evaluator" ); + elog( "Unexpected exception applying custom json evaluator." ); } } @@ -1425,16 +1418,16 @@ void pow_apply( database& db, Operation o ) const auto& worker_account = db.get_account( o.get_worker_account() ); // verify it exists const auto& worker_auth = db.get< account_authority_object, by_account >( o.get_worker_account() ); - FC_ASSERT( worker_auth.active.num_auths() == 1, "miners can only have one key auth ${a}", ("a",worker_auth.active) ); - FC_ASSERT( worker_auth.active.key_auths.size() == 1, "miners may only have one key auth" ); - FC_ASSERT( worker_auth.active.key_auths.begin()->first == o.work.worker, "work must be performed by key that signed the work" ); + FC_ASSERT( worker_auth.active.num_auths() == 1, "Miners can only have one key authority. ${a}", ("a",worker_auth.active) ); + FC_ASSERT( worker_auth.active.key_auths.size() == 1, "Miners may only have one key authority." ); + FC_ASSERT( worker_auth.active.key_auths.begin()->first == o.work.worker, "Work must be performed by key that signed the work." ); FC_ASSERT( o.block_id == db.head_block_id(), "pow not for last block" ); if( db.has_hardfork( STEEMIT_HARDFORK_0_13__256 ) ) - FC_ASSERT( worker_account.last_account_update < db.head_block_time(), "worker account must not have updated their account this block" ); + FC_ASSERT( worker_account.last_account_update < db.head_block_time(), "Worker account must not have updated their account this block." ); fc::sha256 target = db.get_pow_target(); - FC_ASSERT( o.work.work < target, "work lacks sufficient difficulty" ); + FC_ASSERT( o.work.work < target, "Work lacks sufficient difficulty." ); db.modify( dgp, [&]( dynamic_global_property_object& p ) { @@ -1445,7 +1438,7 @@ void pow_apply( database& db, Operation o ) const witness_object* cur_witness = db.find_witness( worker_account.name ); if( cur_witness ) { - FC_ASSERT( cur_witness->pow_worker == 0, "this account is already scheduled for pow block production" ); + FC_ASSERT( cur_witness->pow_worker == 0, "This account is already scheduled for pow block production." ); db.modify(*cur_witness, [&]( witness_object& w ){ w.props = o.props; w.pow_worker = dgp.total_pow; @@ -1487,10 +1480,10 @@ void pow2_evaluator::do_apply( const pow2_operation& o ) { database& db = this->db(); uint32_t target_pow = db.get_pow_summary_target(); - FC_ASSERT( work.input.prev_block == db.head_block_id(), "pow not for last block" ); - FC_ASSERT( work.pow_summary < target_pow, "insufficient work difficulty" ); + FC_ASSERT( work.input.prev_block == db.head_block_id(), "Work not for last block" ); + FC_ASSERT( work.pow_summary < target_pow, "Insufficient work difficulty. Work: ${w}, Target: ${t}", ("w",work.pow_summary)("t", target_pow) ); - FC_ASSERT( o.props.maximum_block_size >= STEEMIT_MIN_BLOCK_SIZE_LIMIT * 2, "maximum block size is too small" ); + FC_ASSERT( o.props.maximum_block_size >= STEEMIT_MIN_BLOCK_SIZE_LIMIT * 2, "Voted maximum block size is too small." ); const auto& dgp = db.get_dynamic_global_properties(); db.modify( dgp, [&]( dynamic_global_property_object& p ) @@ -1503,7 +1496,7 @@ void pow2_evaluator::do_apply( const pow2_operation& o ) { auto itr = accounts_by_name.find( work.input.worker_account ); if(itr == accounts_by_name.end()) { - FC_ASSERT( o.new_owner_key.valid(), "new owner key is not valid" ); + FC_ASSERT( o.new_owner_key.valid(), "New owner key is not valid." ); db.create< account_object >( [&]( account_object& acc ) { acc.name = work.input.worker_account; @@ -1531,10 +1524,10 @@ void pow2_evaluator::do_apply( const pow2_operation& o ) { } else { - FC_ASSERT( !o.new_owner_key.valid(), "cannot specify an owner key unless creating account" ); + FC_ASSERT( !o.new_owner_key.valid(), "Cannot specify an owner key unless creating account." ); const witness_object* cur_witness = db.find_witness( work.input.worker_account ); - FC_ASSERT( cur_witness, "Witness must be created for existing account before mining" ); - FC_ASSERT( cur_witness->pow_worker == 0, "this account is already scheduled for pow block production" ); + FC_ASSERT( cur_witness, "Witness must be created for existing account before mining." ); + FC_ASSERT( cur_witness->pow_worker == 0, "This account is already scheduled for pow block production." ); db.modify(*cur_witness, [&]( witness_object& w ) { w.props = o.props; @@ -1562,12 +1555,12 @@ void feed_publish_evaluator::do_apply( const feed_publish_operation& o ) void convert_evaluator::do_apply( const convert_operation& o ) { const auto& owner = db().get_account( o.owner ); - FC_ASSERT( db().get_balance( owner, o.amount.symbol ) >= o.amount, "account does not have sufficient balance" ); + FC_ASSERT( db().get_balance( owner, o.amount.symbol ) >= o.amount, "Account does not have sufficient balance for conversion." ); db().adjust_balance( owner, -o.amount ); const auto& fhistory = db().get_feed_history(); - FC_ASSERT( !fhistory.current_median_history.is_null(), "Cannot convert SBD because there is no price feed" ); + FC_ASSERT( !fhistory.current_median_history.is_null(), "Cannot convert SBD because there is no price feed." ); db().create( [&]( convert_request_object& obj ) { @@ -1581,11 +1574,11 @@ void convert_evaluator::do_apply( const convert_operation& o ) void limit_order_create_evaluator::do_apply( const limit_order_create_operation& o ) { - FC_ASSERT( o.expiration > db().head_block_time(), "limit order has to expire after head block time" ); + FC_ASSERT( o.expiration > db().head_block_time(), "Limit order has to expire after head block time." ); const auto& owner = db().get_account( o.owner ); - FC_ASSERT( db().get_balance( owner, o.amount_to_sell.symbol ) >= o.amount_to_sell, "account does not have sufficient funds for limit order" ); + FC_ASSERT( db().get_balance( owner, o.amount_to_sell.symbol ) >= o.amount_to_sell, "Account does not have sufficient funds for limit order." ); db().adjust_balance( owner, -o.amount_to_sell ); @@ -1601,16 +1594,16 @@ void limit_order_create_evaluator::do_apply( const limit_order_create_operation& bool filled = db().apply_order( order ); - if( o.fill_or_kill ) FC_ASSERT( filled, "cancelling order because it was not filled" ); + if( o.fill_or_kill ) FC_ASSERT( filled, "Cancelling order because it was not filled." ); } void limit_order_create2_evaluator::do_apply( const limit_order_create2_operation& o ) { - FC_ASSERT( o.expiration > db().head_block_time(), "limit order has to expire after head block time" ); + FC_ASSERT( o.expiration > db().head_block_time(), "Limit order has to expire after head block time." ); const auto& owner = db().get_account( o.owner ); - FC_ASSERT( db().get_balance( owner, o.amount_to_sell.symbol ) >= o.amount_to_sell, "account does not have sufficient funds for limit order" ); + FC_ASSERT( db().get_balance( owner, o.amount_to_sell.symbol ) >= o.amount_to_sell, "Account does not have sufficient funds for limit order." ); db().adjust_balance( owner, -o.amount_to_sell ); @@ -1626,7 +1619,7 @@ void limit_order_create2_evaluator::do_apply( const limit_order_create2_operatio bool filled = db().apply_order( order ); - if( o.fill_or_kill ) FC_ASSERT( filled, "cancelling order because it was not filled" ); + if( o.fill_or_kill ) FC_ASSERT( filled, "Cancelling order because it was not filled." ); } void limit_order_cancel_evaluator::do_apply( const limit_order_cancel_operation& o ) @@ -1636,18 +1629,18 @@ void limit_order_cancel_evaluator::do_apply( const limit_order_cancel_operation& void report_over_production_evaluator::do_apply( const report_over_production_operation& o ) { - FC_ASSERT( !db().has_hardfork( STEEMIT_HARDFORK_0_4 ), "this operation is disabled" ); + FC_ASSERT( !db().has_hardfork( STEEMIT_HARDFORK_0_4 ), "report_over_production_operation is disabled." ); } void challenge_authority_evaluator::do_apply( const challenge_authority_operation& o ) { - if( db().has_hardfork( STEEMIT_HARDFORK_0_14__307 ) ) FC_ASSERT( false, "Challenge authority operation is currently disabled" ); + if( db().has_hardfork( STEEMIT_HARDFORK_0_14__307 ) ) FC_ASSERT( false, "Challenge authority operation is currently disabled." ); const auto& challenged = db().get_account( o.challenged ); const auto& challenger = db().get_account( o.challenger ); if( o.require_owner ) { - FC_ASSERT( challenged.reset_account == o.challenger, "Owner authority can only be challenged by the reset account" ); + FC_ASSERT( challenged.reset_account == o.challenger, "Owner authority can only be challenged by its reset account." ); FC_ASSERT( challenger.balance >= STEEMIT_OWNER_CHALLENGE_FEE ); FC_ASSERT( !challenged.owner_challenged ); FC_ASSERT( db().head_block_time() - challenged.last_owner_proved > STEEMIT_OWNER_CHALLENGE_COOLDOWN ); @@ -1662,9 +1655,9 @@ void challenge_authority_evaluator::do_apply( const challenge_authority_operatio } else { - FC_ASSERT( challenger.balance >= STEEMIT_ACTIVE_CHALLENGE_FEE, "account does not have sufficient funds to pay challenge fee" ); - FC_ASSERT( !( challenged.owner_challenged || challenged.active_challenged ), "account is already challenged" ); - FC_ASSERT( db().head_block_time() - challenged.last_active_proved > STEEMIT_ACTIVE_CHALLENGE_COOLDOWN, "account cannot be challenged because it was recently challenged" ); + FC_ASSERT( challenger.balance >= STEEMIT_ACTIVE_CHALLENGE_FEE, "Account does not have sufficient funds to pay challenge fee." ); + FC_ASSERT( !( challenged.owner_challenged || challenged.active_challenged ), "Account is already challenged." ); + FC_ASSERT( db().head_block_time() - challenged.last_active_proved > STEEMIT_ACTIVE_CHALLENGE_COOLDOWN, "Account cannot be challenged because it was recently challenged." ); db().adjust_balance( challenger, - STEEMIT_ACTIVE_CHALLENGE_FEE ); db().create_vesting( db().get_account( o.challenged ), STEEMIT_ACTIVE_CHALLENGE_FEE ); @@ -1698,17 +1691,17 @@ void request_account_recovery_evaluator::do_apply( const request_account_recover const auto& account_to_recover = db().get_account( o.account_to_recover ); if ( account_to_recover.recovery_account.length() ) // Make sure recovery matches expected recovery account - FC_ASSERT( account_to_recover.recovery_account == o.recovery_account, "cannot recover an account that does not have you as there recovery partner" ); + FC_ASSERT( account_to_recover.recovery_account == o.recovery_account, "Cannot recover an account that does not have you as there recovery partner." ); else // Empty string recovery account defaults to top witness - FC_ASSERT( db().get_index< witness_index >().indices().get< by_vote_name >().begin()->owner == o.recovery_account, "top witness must recover an account with no recovery partner" ); + FC_ASSERT( db().get_index< witness_index >().indices().get< by_vote_name >().begin()->owner == o.recovery_account, "Top witness must recover an account with no recovery partner." ); const auto& recovery_request_idx = db().get_index< account_recovery_request_index >().indices().get< by_account >(); auto request = recovery_request_idx.find( o.account_to_recover ); if( request == recovery_request_idx.end() ) // New Request { - FC_ASSERT( !o.new_owner_authority.is_impossible(), "Cannot recover with an impossible authority" ); - FC_ASSERT( o.new_owner_authority.weight_threshold, "Cannot recover with an open authority" ); + FC_ASSERT( !o.new_owner_authority.is_impossible(), "Cannot recover using an impossible authority." ); + FC_ASSERT( o.new_owner_authority.weight_threshold, "Cannot recover using an open authority." ); // Check accounts in the new authority exist if( ( db().has_hardfork( STEEMIT_HARDFORK_0_15__465 ) || db().is_producing() ) ) @@ -1732,7 +1725,7 @@ void request_account_recovery_evaluator::do_apply( const request_account_recover } else // Change Request { - FC_ASSERT( !o.new_owner_authority.is_impossible(), "Cannot recover with an impossible authority" ); + FC_ASSERT( !o.new_owner_authority.is_impossible(), "Cannot recover using an impossible authority." ); // Check accounts in the new authority exist if( ( db().has_hardfork( STEEMIT_HARDFORK_0_15__465 ) || db().is_producing() ) ) @@ -1756,13 +1749,13 @@ void recover_account_evaluator::do_apply( const recover_account_operation& o ) const auto& account = db().get_account( o.account_to_recover ); if( db().has_hardfork( STEEMIT_HARDFORK_0_12 ) ) - FC_ASSERT( db().head_block_time() - account.last_account_recovery > STEEMIT_OWNER_UPDATE_LIMIT, "owner authority can only be updated once an hour" ); + FC_ASSERT( db().head_block_time() - account.last_account_recovery > STEEMIT_OWNER_UPDATE_LIMIT, "Owner authority can only be updated once an hour." ); const auto& recovery_request_idx = db().get_index< account_recovery_request_index >().indices().get< by_account >(); auto request = recovery_request_idx.find( o.account_to_recover ); - FC_ASSERT( request != recovery_request_idx.end(), "there are no active recovery requests for this account" ); - FC_ASSERT( request->new_owner_authority == o.new_owner_authority, "new owner authority does not match recovery request" ); + FC_ASSERT( request != recovery_request_idx.end(), "There are no active recovery requests for this account." ); + FC_ASSERT( request->new_owner_authority == o.new_owner_authority, "New owner authority does not match recovery request." ); const auto& recent_auth_idx = db().get_index< owner_authority_history_index >().indices().get< by_account >(); auto hist = recent_auth_idx.lower_bound( o.account_to_recover ); @@ -1775,7 +1768,7 @@ void recover_account_evaluator::do_apply( const recover_account_operation& o ) ++hist; } - FC_ASSERT( found, "Recent authority not found in authority history" ); + FC_ASSERT( found, "Recent authority not found in authority history." ); db().remove( *request ); // Remove first, update_owner_authority may invalidate iterator db().update_owner_authority( account, o.new_owner_authority ); @@ -1818,10 +1811,9 @@ void change_recovery_account_evaluator::do_apply( const change_recovery_account_ void transfer_to_savings_evaluator::do_apply( const transfer_to_savings_operation& op ) { - FC_ASSERT( db().has_hardfork( STEEMIT_HARDFORK_0_14__239 ), "operation not active until next hardfork" ); // TODO: Remove after hf14 const auto& from = db().get_account( op.from ); const auto& to = db().get_account(op.to); - FC_ASSERT( db().get_balance( from, op.amount.symbol ) >= op.amount, "Account does not have sufficient funds for transfer." ); + FC_ASSERT( db().get_balance( from, op.amount.symbol ) >= op.amount, "Account does not have sufficient funds to transfer to savings." ); db().adjust_balance( from, -op.amount ); db().adjust_savings_balance( to, op.amount ); @@ -1829,7 +1821,6 @@ void transfer_to_savings_evaluator::do_apply( const transfer_to_savings_operatio void transfer_from_savings_evaluator::do_apply( const transfer_from_savings_operation& op ) { - FC_ASSERT( db().has_hardfork( STEEMIT_HARDFORK_0_14__239 ), "operation not active until next hardfork" ); // TODO: Remove after hf14 const auto& from = db().get_account( op.from ); db().get_account(op.to); // Verify to account exists @@ -1856,8 +1847,6 @@ void transfer_from_savings_evaluator::do_apply( const transfer_from_savings_oper void cancel_transfer_from_savings_evaluator::do_apply( const cancel_transfer_from_savings_operation& op ) { - FC_ASSERT( db().has_hardfork( STEEMIT_HARDFORK_0_14__239 ), "operation not active until next hardfork" ); // TODO: Remove after hf14 - const auto& swo = db().get_savings_withdraw( op.from, op.request_id ); db().adjust_savings_balance( db().get_account( swo.from ), swo.amount ); db().remove( swo ); @@ -1879,7 +1868,7 @@ void decline_voting_rights_evaluator::do_apply( const decline_voting_rights_oper if( o.decline ) { - FC_ASSERT( itr == request_idx.end(), "Cannot create new request because one already exists" ); + FC_ASSERT( itr == request_idx.end(), "Cannot create new request because one already exists." ); db().create< decline_voting_rights_request_object >( [&]( decline_voting_rights_request_object& req ) { @@ -1889,7 +1878,7 @@ void decline_voting_rights_evaluator::do_apply( const decline_voting_rights_oper } else { - FC_ASSERT( itr != request_idx.end(), "Cannot cancel the request because it does not exist" ); + FC_ASSERT( itr != request_idx.end(), "Cannot cancel the request because it does not exist." ); db().remove( *itr ); } }