Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework configs for backlog, telemetry and bandwidth limiter #4728

Merged
merged 14 commits into from
Sep 17, 2024
Merged
1 change: 0 additions & 1 deletion nano/core_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ add_executable(
enums.cpp
epochs.cpp
fair_queue.cpp
frontiers_confirmation.cpp
ipc.cpp
ledger.cpp
ledger_confirm.cpp
Expand Down
24 changes: 12 additions & 12 deletions nano/core_test/active_elections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ TEST (active_elections, DISABLED_keep_local)
// Bound to 2, won't drop wallet created transactions, but good to test dropping remote
node_config.active_elections.size = 2;
// Disable frontier confirmation to allow the test to finish before
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
node_config.backlog_population.enable = false;

auto & node = *system.add_node (node_config);
auto & wallet (*system.wallet (0));
Expand Down Expand Up @@ -326,7 +326,7 @@ TEST (inactive_votes_cache, existing_vote)
{
nano::test::system system;
nano::node_config node_config = system.default_config ();
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
node_config.backlog_population.enable = false;
auto & node = *system.add_node (node_config);
nano::block_hash latest (node.latest (nano::dev::genesis_key.pub));
nano::keypair key;
Expand Down Expand Up @@ -380,7 +380,7 @@ TEST (inactive_votes_cache, multiple_votes)
{
nano::test::system system;
nano::node_config node_config = system.default_config ();
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
node_config.backlog_population.enable = false;
auto & node = *system.add_node (node_config);
nano::keypair key1;
nano::block_builder builder;
Expand Down Expand Up @@ -433,7 +433,7 @@ TEST (inactive_votes_cache, election_start)
{
nano::test::system system;
nano::node_config node_config = system.default_config ();
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
node_config.backlog_population.enable = false;
node_config.priority_scheduler.enabled = false;
node_config.optimistic_scheduler.enabled = false;
auto & node = *system.add_node (node_config);
Expand Down Expand Up @@ -539,7 +539,7 @@ TEST (active_elections, vote_replays)
nano::test::system system;
nano::node_config node_config = system.default_config ();
node_config.enable_voting = false;
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
node_config.backlog_population.enable = false;
auto & node = *system.add_node (node_config);
nano::keypair key;
nano::state_block_builder builder;
Expand Down Expand Up @@ -695,7 +695,7 @@ TEST (active_elections, republish_winner)
{
nano::test::system system;
nano::node_config node_config = system.default_config ();
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
node_config.backlog_population.enable = false;
auto & node1 = *system.add_node (node_config);
node_config.peering_port = system.get_available_port ();
auto & node2 = *system.add_node (node_config);
Expand Down Expand Up @@ -761,7 +761,7 @@ TEST (active_elections, fork_filter_cleanup)
nano::test::system system{};

nano::node_config node_config = system.default_config ();
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
node_config.backlog_population.enable = false;

auto & node1 = *system.add_node (node_config);
nano::keypair key{};
Expand Down Expand Up @@ -842,7 +842,7 @@ TEST (active_elections, fork_replacement_tally)
{
nano::test::system system;
nano::node_config node_config = system.default_config ();
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
node_config.backlog_population.enable = false;
auto & node1 (*system.add_node (node_config));

size_t const reps_count = 20;
Expand Down Expand Up @@ -999,7 +999,7 @@ TEST (active_elections, confirmation_consistency)
{
nano::test::system system;
nano::node_config node_config = system.default_config ();
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
node_config.backlog_population.enable = false;
auto & node = *system.add_node (node_config);
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
for (unsigned i = 0; i < 10; ++i)
Expand Down Expand Up @@ -1091,7 +1091,7 @@ TEST (active_elections, activate_account_chain)
nano::test::system system;
nano::node_flags flags;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
auto & node = *system.add_node (config, flags);

nano::keypair key;
Expand Down Expand Up @@ -1183,7 +1183,7 @@ TEST (active_elections, activate_inactive)
nano::test::system system;
nano::node_flags flags;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
auto & node = *system.add_node (config, flags);

nano::keypair key;
Expand Down Expand Up @@ -1331,7 +1331,7 @@ TEST (active_elections, limit_vote_hinted_elections)
nano::test::system system;
nano::node_config config = system.default_config ();
const int aec_limit = 10;
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
config.optimistic_scheduler.enabled = false;
config.active_elections.size = aec_limit;
config.active_elections.hinted_limit_percentage = 10; // Should give us a limit of 1 hinted election
Expand Down
28 changes: 28 additions & 0 deletions nano/core_test/backlog.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/active_elections.hpp>
#include <nano/secure/ledger.hpp>
#include <nano/test_common/chains.hpp>
#include <nano/test_common/system.hpp>
#include <nano/test_common/testutil.hpp>
Expand Down Expand Up @@ -46,3 +47,30 @@ TEST (backlog, population)

ASSERT_TIMELY (5s, all_activated ());
}

/*
* Ensures that elections are activated without live traffic
*/
TEST (backlog, election_activation)
{
nano::test::system system;
nano::node_config node_config = system.default_config ();
auto & node = *system.add_node (node_config);
nano::keypair key;
nano::block_builder builder;
auto send = builder
.state ()
.account (nano::dev::genesis_key.pub)
.previous (nano::dev::genesis->hash ())
.representative (nano::dev::genesis_key.pub)
.balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio)
.link (key.pub)
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
.work (*node.work_generate_blocking (nano::dev::genesis->hash ()))
.build ();
{
auto transaction = node.ledger.tx_begin_write ();
ASSERT_EQ (nano::block_status::progress, node.ledger.process (transaction, send));
}
ASSERT_TIMELY_EQ (5s, node.active.size (), 1);
}
48 changes: 24 additions & 24 deletions nano/core_test/bootstrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ TEST (bootstrap_processor, process_one)
{
nano::test::system system;
nano::node_config node_config = system.default_config ();
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
node_config.backlog_population.enable = false;
node_config.enable_voting = false;
nano::node_flags node_flags;
node_flags.disable_bootstrap_bulk_push_client = true;
Expand All @@ -327,7 +327,7 @@ TEST (bootstrap_processor, process_two)
{
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
nano::node_flags node_flags;
node_flags.disable_bootstrap_bulk_push_client = true;
auto node0 (system.add_node (config, node_flags));
Expand All @@ -348,7 +348,7 @@ TEST (bootstrap_processor, process_state)
{
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
nano::node_flags node_flags;
node_flags.disable_bootstrap_bulk_push_client = true;
auto node0 (system.add_node (config, node_flags));
Expand Down Expand Up @@ -392,7 +392,7 @@ TEST (bootstrap_processor, process_new)
{
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
nano::node_flags node_flags;
node_flags.disable_bootstrap_bulk_push_client = true;
nano::keypair key2;
Expand Down Expand Up @@ -430,7 +430,7 @@ TEST (bootstrap_processor, pull_diamond)
{
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
nano::node_flags node_flags;
node_flags.disable_bootstrap_bulk_push_client = true;
auto node0 (system.add_node (config, node_flags));
Expand Down Expand Up @@ -482,7 +482,7 @@ TEST (bootstrap_processor, DISABLED_pull_requeue_network_error)
// Bootstrap attempt stopped before requeue & then cannot be found in attempts list
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
nano::node_flags node_flags;
node_flags.disable_bootstrap_bulk_push_client = true;
auto node1 (system.add_node (config, node_flags));
Expand Down Expand Up @@ -574,7 +574,7 @@ TEST (bootstrap_processor, push_diamond)
ASSERT_EQ (nano::block_status::progress, node1->process (receive));

nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
nano::node_flags flags;
flags.disable_ongoing_bootstrap = true;
flags.disable_ascending_bootstrap = true;
Expand All @@ -587,7 +587,7 @@ TEST (bootstrap_processor, push_diamond_pruning)
{
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
nano::node_flags node_flags0;
node_flags0.disable_ascending_bootstrap = true;
node_flags0.disable_ongoing_bootstrap = true;
Expand Down Expand Up @@ -678,7 +678,7 @@ TEST (bootstrap_processor, push_one)
{
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
auto node0 (system.add_node (config));
nano::keypair key1;
auto node1 = system.make_disconnected_node ();
Expand All @@ -700,7 +700,7 @@ TEST (bootstrap_processor, lazy_hash)
{
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
nano::node_flags node_flags;
node_flags.disable_bootstrap_bulk_push_client = true;
auto node0 (system.add_node (config, node_flags));
Expand Down Expand Up @@ -774,7 +774,7 @@ TEST (bootstrap_processor, lazy_hash_bootstrap_id)
{
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
nano::node_flags node_flags;
node_flags.disable_bootstrap_bulk_push_client = true;
auto node0 (system.add_node (config, node_flags));
Expand Down Expand Up @@ -848,7 +848,7 @@ TEST (bootstrap_processor, lazy_hash_pruning)
{
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
config.enable_voting = false; // Remove after allowing pruned voting
nano::node_flags node_flags;
node_flags.disable_bootstrap_bulk_push_client = true;
Expand Down Expand Up @@ -994,7 +994,7 @@ TEST (bootstrap_processor, lazy_max_pull_count)
{
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
nano::node_flags node_flags;
node_flags.disable_bootstrap_bulk_push_client = true;
auto node0 (system.add_node (config, node_flags));
Expand Down Expand Up @@ -1095,7 +1095,7 @@ TEST (bootstrap_processor, lazy_unclear_state_link)
{
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
nano::node_flags node_flags;
node_flags.disable_bootstrap_bulk_push_client = true;
node_flags.disable_legacy_bootstrap = true;
Expand Down Expand Up @@ -1163,7 +1163,7 @@ TEST (bootstrap_processor, lazy_unclear_state_link_not_existing)
{
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
nano::node_flags node_flags;
node_flags.disable_bootstrap_bulk_push_client = true;
node_flags.disable_legacy_bootstrap = true;
Expand Down Expand Up @@ -1221,7 +1221,7 @@ TEST (bootstrap_processor, lazy_destinations)
{
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
nano::node_flags node_flags;
node_flags.disable_bootstrap_bulk_push_client = true;
node_flags.disable_legacy_bootstrap = true;
Expand Down Expand Up @@ -1299,7 +1299,7 @@ TEST (bootstrap_processor, lazy_pruning_missing_block)
{
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
config.enable_voting = false; // Remove after allowing pruned voting
nano::node_flags node_flags;
node_flags.disable_bootstrap_bulk_push_client = true;
Expand Down Expand Up @@ -1406,7 +1406,7 @@ TEST (bootstrap_processor, lazy_cancel)
{
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
nano::node_flags node_flags;
node_flags.disable_bootstrap_bulk_push_client = true;
auto node0 (system.add_node (config, node_flags));
Expand Down Expand Up @@ -1440,7 +1440,7 @@ TEST (bootstrap_processor, wallet_lazy_frontier)
{
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
nano::node_flags node_flags;
node_flags.disable_bootstrap_bulk_push_client = true;
node_flags.disable_legacy_bootstrap = true;
Expand Down Expand Up @@ -1520,7 +1520,7 @@ TEST (bootstrap_processor, wallet_lazy_pending)
{
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
nano::node_flags node_flags;
node_flags.disable_bootstrap_bulk_push_client = true;
node_flags.disable_legacy_bootstrap = true;
Expand Down Expand Up @@ -1584,7 +1584,7 @@ TEST (bootstrap_processor, multiple_attempts)
{
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
nano::node_flags node_flags;
node_flags.disable_bootstrap_bulk_push_client = true;
auto node1 = system.add_node (config, node_flags);
Expand Down Expand Up @@ -1945,7 +1945,7 @@ TEST (bulk, genesis)
{
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
nano::node_flags node_flags;
node_flags.disable_bootstrap_bulk_push_client = true;
node_flags.disable_lazy_bootstrap = true;
Expand All @@ -1971,7 +1971,7 @@ TEST (bulk, offline_send)
{
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
nano::node_flags node_flags;
node_flags.disable_bootstrap_bulk_push_client = true;
node_flags.disable_lazy_bootstrap = true;
Expand Down Expand Up @@ -2010,7 +2010,7 @@ TEST (bulk, genesis_pruning)
{
nano::test::system system;
nano::node_config config = system.default_config ();
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
config.backlog_population.enable = false;
config.enable_voting = false; // Remove after allowing pruned voting
nano::node_flags node_flags;
node_flags.disable_bootstrap_bulk_push_client = true;
Expand Down
6 changes: 3 additions & 3 deletions nano/core_test/confirming_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ TEST (confirmation_callback, observer_callbacks)
nano::test::system system;
nano::node_flags node_flags;
nano::node_config node_config = system.default_config ();
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
node_config.backlog_population.enable = false;
auto node = system.add_node (node_config, node_flags);

system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
Expand Down Expand Up @@ -122,7 +122,7 @@ TEST (confirmation_callback, confirmed_history)
node_flags.force_use_write_queue = true;
node_flags.disable_ascending_bootstrap = true;
nano::node_config node_config = system.default_config ();
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
node_config.backlog_population.enable = false;
auto node = system.add_node (node_config, node_flags);

nano::block_hash latest (node->latest (nano::dev::genesis_key.pub));
Expand Down Expand Up @@ -196,7 +196,7 @@ TEST (confirmation_callback, dependent_election)
nano::node_flags node_flags;
node_flags.force_use_write_queue = true;
nano::node_config node_config = system.default_config ();
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
node_config.backlog_population.enable = false;
auto node = system.add_node (node_config, node_flags);

nano::block_hash latest (node->latest (nano::dev::genesis_key.pub));
Expand Down
Loading
Loading