diff --git a/contracts/eosio.system/delegate_bandwidth.cpp b/contracts/eosio.system/delegate_bandwidth.cpp index 8648d3402e1..c235d5c8e9d 100644 --- a/contracts/eosio.system/delegate_bandwidth.cpp +++ b/contracts/eosio.system/delegate_bandwidth.cpp @@ -371,7 +371,8 @@ namespace eosiosystem { eosio_assert( asset() <= unstake_cpu_quantity, "must unstake a positive amount" ); eosio_assert( asset() <= unstake_net_quantity, "must unstake a positive amount" ); eosio_assert( asset() < unstake_cpu_quantity + unstake_net_quantity, "must unstake a positive amount" ); - eosio_assert( _gstate.total_activated_stake >= min_activated_stake, "the chain has not been activated yet (less than 15% of all tokens have participated in voting)" ); + eosio_assert( _gstate.total_activated_stake >= min_activated_stake, + "cannot undelegate bandwidth until the chain is activated (at least 15% of all tokens participate in voting)" ); changebw( from, receiver, -unstake_net_quantity, -unstake_cpu_quantity, false); } // undelegatebw diff --git a/contracts/eosio.system/producer_pay.cpp b/contracts/eosio.system/producer_pay.cpp index 1c118f83f2a..1d0af68d432 100644 --- a/contracts/eosio.system/producer_pay.cpp +++ b/contracts/eosio.system/producer_pay.cpp @@ -41,11 +41,11 @@ namespace eosiosystem { p.unpaid_blocks++; }); } - + /// only update block producers once every minute, block_timestamp is in half seconds if( timestamp.slot - _gstate.last_producer_schedule_update.slot > 120 ) { update_elected_producers( timestamp ); - + if( (timestamp.slot - _gstate.last_name_close.slot) > blocks_per_day ) { name_bid_table bids(_self,_self); auto idx = bids.get_index(); @@ -70,8 +70,9 @@ namespace eosiosystem { const auto& prod = _producers.get( owner ); eosio_assert( prod.active(), "producer does not have an active key" ); - - eosio_assert( _gstate.total_activated_stake >= min_activated_stake, "the chain has not been activated yet (less than 15% of all tokens have participated in voting)" ); + + eosio_assert( _gstate.total_activated_stake >= min_activated_stake, + "cannot claim rewards until the chain is activated (at least 15% of all tokens participate in voting)" ); auto ct = current_time(); @@ -111,7 +112,7 @@ namespace eosiosystem { producer_per_block_pay = (_gstate.perblock_bucket * prod.unpaid_blocks) / _gstate.total_unpaid_blocks; } int64_t producer_per_vote_pay = 0; - if( _gstate.total_producer_vote_weight > 0 ) { + if( _gstate.total_producer_vote_weight > 0 ) { producer_per_vote_pay = int64_t((_gstate.pervote_bucket * prod.total_votes ) / _gstate.total_producer_vote_weight); } if( producer_per_vote_pay < min_pervote_daily_pay ) { @@ -125,7 +126,7 @@ namespace eosiosystem { p.last_claim_time = ct; p.unpaid_blocks = 0; }); - + if( producer_per_block_pay > 0 ) { INLINE_ACTION_SENDER(eosio::token, transfer)( N(eosio.token), {N(eosio.bpay),N(active)}, { N(eosio.bpay), owner, asset(producer_per_block_pay), std::string("producer block pay") } ); diff --git a/unittests/eosio.system_tests.cpp b/unittests/eosio.system_tests.cpp index 9b38b564dea..b823eb5a550 100644 --- a/unittests/eosio.system_tests.cpp +++ b/unittests/eosio.system_tests.cpp @@ -1558,7 +1558,7 @@ BOOST_FIXTURE_TEST_CASE(multiple_producer_pay, eosio_system_tester, * boost::uni BOOST_REQUIRE(prod_was_replaced); } } - + { BOOST_REQUIRE_EQUAL( wasm_assert_msg("producer not found"), push_action( config::system_account_name, N(rmvproducer), mvo()("producer", "nonexistingp") ) ); @@ -1699,7 +1699,8 @@ BOOST_FIXTURE_TEST_CASE(producer_onblock_check, eosio_system_tester) try { transfer(config::system_account_name, "producvotera", core_from_string("200000000.0000"), config::system_account_name); BOOST_REQUIRE_EQUAL(success(), stake("producvotera", core_from_string("70000000.0000"), core_from_string("70000000.0000") )); BOOST_REQUIRE_EQUAL(success(), vote( N(producvotera), vector(producer_names.begin(), producer_names.begin()+10))); - BOOST_CHECK_EQUAL( wasm_assert_msg("not enough has been staked for users to unstake"), unstake( "producvotera", core_from_string("50.0000"), core_from_string("50.0000") ) ); + BOOST_CHECK_EQUAL( wasm_assert_msg( "cannot undelegate bandwidth until the chain is activated (at least 15% of all tokens participate in voting)" ), + unstake( "producvotera", core_from_string("50.0000"), core_from_string("50.0000") ) ); // give a chance for everyone to produce blocks { @@ -1721,11 +1722,12 @@ BOOST_FIXTURE_TEST_CASE(producer_onblock_check, eosio_system_tester) try { } { + const char* claimrewards_activation_error_message = "cannot claim rewards until the chain is activated (at least 15% of all tokens participate in voting)"; BOOST_CHECK_EQUAL(0, get_global_state()["total_unpaid_blocks"].as()); - BOOST_REQUIRE_EQUAL(wasm_assert_msg("not enough has been staked for producers to claim rewards"), + BOOST_REQUIRE_EQUAL(wasm_assert_msg( claimrewards_activation_error_message ), push_action(producer_names.front(), N(claimrewards), mvo()("owner", producer_names.front()))); BOOST_REQUIRE_EQUAL(0, get_balance(producer_names.front()).get_amount()); - BOOST_REQUIRE_EQUAL(wasm_assert_msg("not enough has been staked for producers to claim rewards"), + BOOST_REQUIRE_EQUAL(wasm_assert_msg( claimrewards_activation_error_message ), push_action(producer_names.back(), N(claimrewards), mvo()("owner", producer_names.back()))); BOOST_REQUIRE_EQUAL(0, get_balance(producer_names.back()).get_amount()); }