diff --git a/libraries/chain/hive_evaluator.cpp b/libraries/chain/hive_evaluator.cpp index 0fc371bcb3..b76894ffc8 100644 --- a/libraries/chain/hive_evaluator.cpp +++ b/libraries/chain/hive_evaluator.cpp @@ -153,6 +153,11 @@ void witness_set_properties_evaluator::do_apply( const witness_set_properties_op if( flags.max_block_changed ) { fc::raw::unpack_from_vector( itr->second, props.maximum_block_size ); + FC_TODO( "Check and move this to validate after HF 28" ); + if( _db.is_in_control() || _db.has_hardfork( HIVE_HARDFORK_1_28_MAX_BLOCK_SIZE ) ) + { + FC_ASSERT( props.maximum_block_size <= HIVE_MAX_BLOCK_SIZE, "Max block size cannot be more than 2MiB" ); + } } itr = o.props.find( "sbd_interest_rate" ); diff --git a/libraries/protocol/hardfork.d/1_28.hf b/libraries/protocol/hardfork.d/1_28.hf index 700936f4cf..c0c82a3dee 100644 --- a/libraries/protocol/hardfork.d/1_28.hf +++ b/libraries/protocol/hardfork.d/1_28.hf @@ -19,5 +19,7 @@ long next_hf_time(); #define HIVE_HARDFORK_1_28_FIX_CANCEL_POWER_DOWN (HIVE_HARDFORK_1_28) // use max mana instead of current when determining strength of vote (issue #609) #define HIVE_HARDFORK_1_28_STABLE_VOTE (HIVE_HARDFORK_1_28) +// block setting of maximum_block_size above limit +#define HIVE_HARDFORK_1_28_MAX_BLOCK_SIZE (HIVE_HARDFORK_1_28) #endif diff --git a/tests/unit/tests/operation_tests.cpp b/tests/unit/tests/operation_tests.cpp index 21ca4ca087..e2fd2816ef 100644 --- a/tests/unit/tests/operation_tests.cpp +++ b/tests/unit/tests/operation_tests.cpp @@ -8372,6 +8372,12 @@ BOOST_AUTO_TEST_CASE( witness_set_properties_validate ) BOOST_TEST_MESSAGE( "--- success when account subsidy decay is one hour" ); prop_op.props[ "account_subsidy_decay" ] = fc::raw::pack_to_vector( uint32_t( unit / ((60*60)/HIVE_BLOCK_INTERVAL) ) ); prop_op.validate(); + + BOOST_TEST_MESSAGE( "--- failure when setting maximum_block_size above HIVE_MAX_BLOCK_SIZE" ); + prop_op.props.clear(); + prop_op.props[ "key" ] = fc::raw::pack_to_vector( signing_key.get_public_key() ); + prop_op.props[ "maximum_block_size" ] = fc::raw::pack_to_vector( HIVE_MAX_BLOCK_SIZE + 1 ); + HIVE_REQUIRE_ASSERT( push_transaction( prop_op, signing_key ), "props.maximum_block_size <= HIVE_MAX_BLOCK_SIZE" ); } FC_LOG_AND_RETHROW() }