Skip to content

Commit

Permalink
Merge branch 'GH-617-fsi-serialization' into GH-621-liveness
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner authored Aug 26, 2024
2 parents 03777c6 + 609b8ca commit f65b5db
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 18 deletions.
1 change: 1 addition & 0 deletions CMakeModules/EosioTester.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ else ( APPLE )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} -Wall")
endif ( APPLE )

add_compile_definitions(BOOST_TEST_DEFAULTS_TO_CORE_DUMP)
add_compile_definitions(BOOST_UNORDERED_DISABLE_NEON)

set( Boost_USE_MULTITHREADED ON )
Expand Down
1 change: 1 addition & 0 deletions CMakeModules/EosioTesterBuild.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ else ( APPLE )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} -Wall")
endif ( APPLE )

add_compile_definitions(BOOST_TEST_DEFAULTS_TO_CORE_DUMP)
add_compile_definitions(BOOST_UNORDERED_DISABLE_NEON)

set( Boost_USE_MULTITHREADED ON )
Expand Down
2 changes: 1 addition & 1 deletion libraries/chainbase
24 changes: 14 additions & 10 deletions plugins/net_plugin/net_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2001,18 +2001,22 @@ namespace eosio {
}

uint32_t sync_manager::active_sync_fetch_span() const {
int32_t reversible_remaining = my_impl->chain_plug->chain().max_reversible_blocks_allowed();
if (reversible_remaining <= 0) {
auto fork_db_size = my_impl->chain_plug->chain().fork_db_size();
fc_wlog(logger, "max-reversible-blocks exceeded by ${ex}, fork_db_size ${fs}",
("ex", -reversible_remaining)("fs", fork_db_size));
reversible_remaining = 0;
}
if (reversible_remaining < sync_fetch_span) {
const uint32_t constrained_reversible_remaining = [&]() -> uint32_t {
const int32_t reversible_remaining = my_impl->chain_plug->chain().max_reversible_blocks_allowed();
if (reversible_remaining <= 0) {
auto fork_db_size = my_impl->chain_plug->chain().fork_db_size();
fc_wlog(logger, "max-reversible-blocks exceeded by ${ex}, fork_db_size ${fs}",
("ex", -reversible_remaining)("fs", fork_db_size));
return 0;
}
return reversible_remaining;
}();

if (constrained_reversible_remaining < sync_fetch_span) {
auto fork_db_size = my_impl->chain_plug->chain().fork_db_size();
fc_wlog(logger, "sync-fetch-span ${sfs} restricted to ${r} by max-reversible-blocks, fork_db_size ${fs}",
("sfs", sync_fetch_span)("r", reversible_remaining)("fs", fork_db_size));
return reversible_remaining;
("sfs", sync_fetch_span)("r", constrained_reversible_remaining)("fs", fork_db_size));
return constrained_reversible_remaining;
}
return sync_fetch_span;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_snapshot_scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ BOOST_AUTO_TEST_CASE(snapshot_scheduler_old_json) {
unsigned found = 0;
for(const std::filesystem::directory_entry& dir_entry : std::filesystem::directory_iterator(temp / "snapshots"))
found += std::regex_search(dir_entry.path().filename().string(), snapshotfile_regex);
BOOST_REQUIRE_GE(found, 3);
BOOST_REQUIRE_EQUAL(found, 3u);
}

BOOST_AUTO_TEST_SUITE_END()
12 changes: 6 additions & 6 deletions unittests/savanna_proposer_policy_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ BOOST_FIXTURE_TEST_CASE(policy_change_first_block_delay_check, savanna_cluster::
auto sb = A.produce_block(); // produce a block that will include the policy change transaction
auto orig_producer = sb->producer; // save producer before transition
auto start_slot = sb->timestamp.slot;
BOOST_REQUIRE_EQUAL(start_slot % prod_rep, 0); // validate that the policy change occurs on the first block of prod_rep
BOOST_REQUIRE_EQUAL(start_slot % prod_rep, 0u); // validate that the policy change occurs on the first block of prod_rep

A.wait_for_producer(producers); // produce blocks until the new schedule will be active on next block produced
BOOST_REQUIRE_EQUAL(A.head().block()->producer, // head block should still have been produced using
Expand All @@ -33,7 +33,7 @@ BOOST_FIXTURE_TEST_CASE(policy_change_first_block_delay_check, savanna_cluster::
BOOST_REQUIRE(using_new_sched); // verify that we have just switched to new schedule
BOOST_REQUIRE_NE(sb->producer, orig_producer); // and that the producer has changed
auto end_slot = sb->timestamp.slot;
BOOST_REQUIRE_EQUAL(end_slot % prod_rep, 0); // validate that the policy change occurs on the first block of prod_rep
BOOST_REQUIRE_EQUAL(end_slot % prod_rep, 0u); // validate that the policy change occurs on the first block of prod_rep

// under Savanna, a new policy becomes active on the first block of a prod_rep block round after:
// 1. finishing the current round
Expand Down Expand Up @@ -73,7 +73,7 @@ BOOST_FIXTURE_TEST_CASE(policy_change_sixth_block_delay_check, savanna_cluster::
BOOST_REQUIRE(using_new_sched); // verify that we have just switched to new schedule
BOOST_REQUIRE_NE(sb->producer, orig_producer); // and that the producer has changed
auto end_slot = sb->timestamp.slot;
BOOST_REQUIRE_EQUAL(end_slot % prod_rep, 0); // validate that the policy change occurs on the first block of prod_rep
BOOST_REQUIRE_EQUAL(end_slot % prod_rep, 0u); // validate that the policy change occurs on the first block of prod_rep

// under Savanna, a new policy becomes active on the first block of a prod_rep block round after:
// 1. finishing the current round
Expand Down Expand Up @@ -113,7 +113,7 @@ BOOST_FIXTURE_TEST_CASE(policy_change_last_block_delay_check, savanna_cluster::c
BOOST_REQUIRE(using_new_sched); // verify that we have just switched to new schedule
BOOST_REQUIRE_NE(sb->producer, orig_producer); // and that the producer has changed
auto end_slot = sb->timestamp.slot;
BOOST_REQUIRE_EQUAL(end_slot % prod_rep, 0); // validate that the policy change occurs on the first block of prod_rep
BOOST_REQUIRE_EQUAL(end_slot % prod_rep, 0u); // validate that the policy change occurs on the first block of prod_rep

// under Savanna, a new policy becomes active on the first block of a prod_rep block round after:
// 1. finishing the current round
Expand Down Expand Up @@ -168,7 +168,7 @@ BOOST_FIXTURE_TEST_CASE(no_proposer_policy_change_without_finality, savanna_clus
for (uint32_t i=0; i<prod_rep; ++i) {
sb = A.produce_block();
if (sb->producer != orig_producer) {
BOOST_REQUIRE_EQUAL(sb->timestamp.slot % prod_rep, 0);
BOOST_REQUIRE_EQUAL(sb->timestamp.slot % prod_rep, 0u);
break;
}
}
Expand Down Expand Up @@ -226,7 +226,7 @@ BOOST_FIXTURE_TEST_CASE(no_proposer_policy_change_without_finality_2, savanna_cl
// -------------------------------------------------------------------------------
sb = A.produce_block();
BOOST_REQUIRE_NE(sb->producer, orig_producer); // verify switch has happened
BOOST_REQUIRE_EQUAL(sb->timestamp.slot % prod_rep, 0); // verify first block of a round
BOOST_REQUIRE_EQUAL(sb->timestamp.slot % prod_rep, 0u); // verify first block of a round
} FC_LOG_AND_RETHROW()

// ---------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit f65b5db

Please sign in to comment.