From fbec73696010a553d37cd4e5255b3790756d40d5 Mon Sep 17 00:00:00 2001 From: arhag Date: Tue, 24 Sep 2019 13:07:42 -0400 Subject: [PATCH 1/2] Consolidated Security Fixes ported from 1.8.4 - WebAssembly checktime fixes Co-Authored-By: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> --- libraries/chain/include/eosio/chain/wasm_eosio_injection.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/chain/include/eosio/chain/wasm_eosio_injection.hpp b/libraries/chain/include/eosio/chain/wasm_eosio_injection.hpp index 4a94c2be9aa..71ab4ab677f 100644 --- a/libraries/chain/include/eosio/chain/wasm_eosio_injection.hpp +++ b/libraries/chain/include/eosio/chain/wasm_eosio_injection.hpp @@ -759,7 +759,8 @@ namespace eosio { namespace chain { namespace wasm_injections { }; struct post_op_full_injectors : post_op_injectors { - using loop_t = wasm_ops::loop ; + using loop_t = wasm_ops::loop ; + using grow_memory_t = wasm_ops::grow_memory ; }; template From 0dab8dad4c71f88357cb20dd5dfb2a347c6788e4 Mon Sep 17 00:00:00 2001 From: arhag Date: Mon, 8 Jul 2019 13:59:54 -0400 Subject: [PATCH 2/2] augment producer_schedule_tests/producer_watermark_test to check last produced block numbers in block_header_state --- unittests/producer_schedule_tests.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/unittests/producer_schedule_tests.cpp b/unittests/producer_schedule_tests.cpp index acb3f3f5312..32655b3fbc8 100644 --- a/unittests/producer_schedule_tests.cpp +++ b/unittests/producer_schedule_tests.cpp @@ -471,7 +471,29 @@ BOOST_AUTO_TEST_CASE( producer_watermark_test ) try { BOOST_CHECK_EQUAL( true, compare_schedules( sch1, *c.control->proposed_producers() ) ); produce_until_transition( c, N(bob), N(alice) ); + + auto bob_last_produced_block_num = c.control->head_block_num(); + wdump((bob_last_produced_block_num)); + produce_until_transition( c, N(alice), N(bob) ); + + auto alice_last_produced_block_num = c.control->head_block_num(); + wdump((alice_last_produced_block_num)); + + { + wdump((c.control->head_block_state()->producer_to_last_produced)); + const auto& last_produced = c.control->head_block_state()->producer_to_last_produced; + auto alice_itr = last_produced.find( N(alice) ); + BOOST_REQUIRE( alice_itr != last_produced.end() ); + BOOST_CHECK_EQUAL( alice_itr->second, alice_last_produced_block_num ); + auto bob_itr = last_produced.find( N(bob) ); + BOOST_REQUIRE( bob_itr != last_produced.end() ); + BOOST_CHECK_EQUAL( bob_itr->second, bob_last_produced_block_num ); + auto carol_itr = last_produced.find( N(carol) ); + BOOST_REQUIRE( carol_itr != last_produced.end() ); + BOOST_CHECK_EQUAL( carol_itr->second, carol_last_produced_block_num ); + } + BOOST_CHECK_EQUAL( c.control->pending_producers().version, 3u ); BOOST_REQUIRE_EQUAL( c.control->active_producers().version, 2u );