Rename config to bootstrap_config

This commit is contained in:
Piotr Wójcik 2024-10-29 17:38:42 +01:00
commit 5d2c690fc0
12 changed files with 54 additions and 58 deletions

View file

@ -1442,10 +1442,10 @@ TEST (active_elections, broadcast_block_on_activation)
nano::node_config config1 = system.default_config ();
// Deactivates elections on both nodes.
config1.active_elections.size = 0;
config1.bootstrap_ascending.enable = false;
config1.bootstrap.enable = false;
nano::node_config config2 = system.default_config ();
config2.active_elections.size = 0;
config2.bootstrap_ascending.enable = false;
config2.bootstrap.enable = false;
nano::node_flags flags;
// Disables bootstrap listener to make sure the block won't be shared by this channel.
flags.disable_bootstrap_listener = true;

View file

@ -280,8 +280,8 @@ TEST (bootstrap, frontier_scan)
flags.disable_legacy_bootstrap = true;
nano::node_config config;
// Disable other bootstrap strategies
config.bootstrap_ascending.enable_scan = false;
config.bootstrap_ascending.enable_dependency_walker = false;
config.bootstrap.enable_scan = false;
config.bootstrap.enable_dependency_walker = false;
// Disable election activation
config.backlog_population.enable = false;
config.priority_scheduler.enable = false;
@ -376,8 +376,8 @@ TEST (bootstrap, frontier_scan_pending)
flags.disable_legacy_bootstrap = true;
nano::node_config config;
// Disable other bootstrap strategies
config.bootstrap_ascending.enable_scan = false;
config.bootstrap_ascending.enable_dependency_walker = false;
config.bootstrap.enable_scan = false;
config.bootstrap.enable_dependency_walker = false;
// Disable election activation
config.backlog_population.enable = false;
config.priority_scheduler.enable = false;
@ -458,8 +458,8 @@ TEST (bootstrap, frontier_scan_cannot_prioritize)
flags.disable_legacy_bootstrap = true;
nano::node_config config;
// Disable other bootstrap strategies
config.bootstrap_ascending.enable_scan = false;
config.bootstrap_ascending.enable_dependency_walker = false;
config.bootstrap.enable_scan = false;
config.bootstrap.enable_dependency_walker = false;
// Disable election activation
config.backlog_population.enable = false;
config.priority_scheduler.enable = false;

View file

@ -117,7 +117,7 @@ TEST (toml, daemon_config_deserialize_defaults)
ss << R"toml(
[node]
[node.backlog_population]
[node.bootstrap_ascending]
[node.bootstrap]
[node.bootstrap_server]
[node.block_processor]
[node.diagnostics.txn_tracking]
@ -269,18 +269,18 @@ TEST (toml, daemon_config_deserialize_defaults)
ASSERT_EQ (conf.node.vote_processor.threads, defaults.node.vote_processor.threads);
ASSERT_EQ (conf.node.vote_processor.batch_size, defaults.node.vote_processor.batch_size);
ASSERT_EQ (conf.node.bootstrap_ascending.enable, defaults.node.bootstrap_ascending.enable);
ASSERT_EQ (conf.node.bootstrap_ascending.enable_database_scan, defaults.node.bootstrap_ascending.enable_database_scan);
ASSERT_EQ (conf.node.bootstrap_ascending.enable_dependency_walker, defaults.node.bootstrap_ascending.enable_dependency_walker);
ASSERT_EQ (conf.node.bootstrap_ascending.channel_limit, defaults.node.bootstrap_ascending.channel_limit);
ASSERT_EQ (conf.node.bootstrap_ascending.database_rate_limit, defaults.node.bootstrap_ascending.database_rate_limit);
ASSERT_EQ (conf.node.bootstrap_ascending.database_warmup_ratio, defaults.node.bootstrap_ascending.database_warmup_ratio);
ASSERT_EQ (conf.node.bootstrap_ascending.max_pull_count, defaults.node.bootstrap_ascending.max_pull_count);
ASSERT_EQ (conf.node.bootstrap_ascending.request_timeout, defaults.node.bootstrap_ascending.request_timeout);
ASSERT_EQ (conf.node.bootstrap_ascending.throttle_coefficient, defaults.node.bootstrap_ascending.throttle_coefficient);
ASSERT_EQ (conf.node.bootstrap_ascending.throttle_wait, defaults.node.bootstrap_ascending.throttle_wait);
ASSERT_EQ (conf.node.bootstrap_ascending.block_processor_threshold, defaults.node.bootstrap_ascending.block_processor_threshold);
ASSERT_EQ (conf.node.bootstrap_ascending.max_requests, defaults.node.bootstrap_ascending.max_requests);
ASSERT_EQ (conf.node.bootstrap.enable, defaults.node.bootstrap.enable);
ASSERT_EQ (conf.node.bootstrap.enable_database_scan, defaults.node.bootstrap.enable_database_scan);
ASSERT_EQ (conf.node.bootstrap.enable_dependency_walker, defaults.node.bootstrap.enable_dependency_walker);
ASSERT_EQ (conf.node.bootstrap.channel_limit, defaults.node.bootstrap.channel_limit);
ASSERT_EQ (conf.node.bootstrap.database_rate_limit, defaults.node.bootstrap.database_rate_limit);
ASSERT_EQ (conf.node.bootstrap.database_warmup_ratio, defaults.node.bootstrap.database_warmup_ratio);
ASSERT_EQ (conf.node.bootstrap.max_pull_count, defaults.node.bootstrap.max_pull_count);
ASSERT_EQ (conf.node.bootstrap.request_timeout, defaults.node.bootstrap.request_timeout);
ASSERT_EQ (conf.node.bootstrap.throttle_coefficient, defaults.node.bootstrap.throttle_coefficient);
ASSERT_EQ (conf.node.bootstrap.throttle_wait, defaults.node.bootstrap.throttle_wait);
ASSERT_EQ (conf.node.bootstrap.block_processor_threshold, defaults.node.bootstrap.block_processor_threshold);
ASSERT_EQ (conf.node.bootstrap.max_requests, defaults.node.bootstrap.max_requests);
ASSERT_EQ (conf.node.bootstrap_server.max_queue, defaults.node.bootstrap_server.max_queue);
ASSERT_EQ (conf.node.bootstrap_server.threads, defaults.node.bootstrap_server.threads);
@ -597,7 +597,7 @@ TEST (toml, daemon_config_deserialize_no_defaults)
threads = 999
batch_size = 999
[node.bootstrap_ascending]
[node.bootstrap]
enable = false
enable_frontier_scan = false
enable_database_scan = true
@ -777,19 +777,19 @@ TEST (toml, daemon_config_deserialize_no_defaults)
ASSERT_NE (conf.node.vote_processor.threads, defaults.node.vote_processor.threads);
ASSERT_NE (conf.node.vote_processor.batch_size, defaults.node.vote_processor.batch_size);
ASSERT_NE (conf.node.bootstrap_ascending.enable, defaults.node.bootstrap_ascending.enable);
ASSERT_NE (conf.node.bootstrap_ascending.enable_frontier_scan, defaults.node.bootstrap_ascending.enable_frontier_scan);
ASSERT_NE (conf.node.bootstrap_ascending.enable_database_scan, defaults.node.bootstrap_ascending.enable_database_scan);
ASSERT_NE (conf.node.bootstrap_ascending.enable_dependency_walker, defaults.node.bootstrap_ascending.enable_dependency_walker);
ASSERT_NE (conf.node.bootstrap_ascending.channel_limit, defaults.node.bootstrap_ascending.channel_limit);
ASSERT_NE (conf.node.bootstrap_ascending.database_rate_limit, defaults.node.bootstrap_ascending.database_rate_limit);
ASSERT_NE (conf.node.bootstrap_ascending.database_warmup_ratio, defaults.node.bootstrap_ascending.database_warmup_ratio);
ASSERT_NE (conf.node.bootstrap_ascending.max_pull_count, defaults.node.bootstrap_ascending.max_pull_count);
ASSERT_NE (conf.node.bootstrap_ascending.request_timeout, defaults.node.bootstrap_ascending.request_timeout);
ASSERT_NE (conf.node.bootstrap_ascending.throttle_coefficient, defaults.node.bootstrap_ascending.throttle_coefficient);
ASSERT_NE (conf.node.bootstrap_ascending.throttle_wait, defaults.node.bootstrap_ascending.throttle_wait);
ASSERT_NE (conf.node.bootstrap_ascending.block_processor_threshold, defaults.node.bootstrap_ascending.block_processor_threshold);
ASSERT_NE (conf.node.bootstrap_ascending.max_requests, defaults.node.bootstrap_ascending.max_requests);
ASSERT_NE (conf.node.bootstrap.enable, defaults.node.bootstrap.enable);
ASSERT_NE (conf.node.bootstrap.enable_database_scan, defaults.node.bootstrap.enable_database_scan);
ASSERT_NE (conf.node.bootstrap.enable_frontier_scan, defaults.node.bootstrap.enable_frontier_scan);
ASSERT_NE (conf.node.bootstrap.enable_dependency_walker, defaults.node.bootstrap.enable_dependency_walker);
ASSERT_NE (conf.node.bootstrap.channel_limit, defaults.node.bootstrap.channel_limit);
ASSERT_NE (conf.node.bootstrap.database_rate_limit, defaults.node.bootstrap.database_rate_limit);
ASSERT_NE (conf.node.bootstrap.database_warmup_ratio, defaults.node.bootstrap.database_warmup_ratio);
ASSERT_NE (conf.node.bootstrap.max_pull_count, defaults.node.bootstrap.max_pull_count);
ASSERT_NE (conf.node.bootstrap.request_timeout, defaults.node.bootstrap.request_timeout);
ASSERT_NE (conf.node.bootstrap.throttle_coefficient, defaults.node.bootstrap.throttle_coefficient);
ASSERT_NE (conf.node.bootstrap.throttle_wait, defaults.node.bootstrap.throttle_wait);
ASSERT_NE (conf.node.bootstrap.block_processor_threshold, defaults.node.bootstrap.block_processor_threshold);
ASSERT_NE (conf.node.bootstrap.max_requests, defaults.node.bootstrap.max_requests);
ASSERT_NE (conf.node.bootstrap_server.max_queue, defaults.node.bootstrap_server.max_queue);
ASSERT_NE (conf.node.bootstrap_server.threads, defaults.node.bootstrap_server.threads);
@ -1081,7 +1081,7 @@ TEST (toml, merge_config_files)
[node]
active_elections.size = 999
# background_threads = 7777
[node.bootstrap_ascending]
[node.bootstrap]
block_processor_threshold = 33333
old_entry = 34
)toml";
@ -1105,6 +1105,6 @@ TEST (toml, merge_config_files)
ASSERT_NE (merged_config.node.active_elections.size, default_config.node.active_elections.size);
ASSERT_EQ (merged_config.node.active_elections.size, 999);
ASSERT_NE (merged_config.node.background_threads, 7777);
ASSERT_EQ (merged_config.node.bootstrap_ascending.block_processor_threshold, 33333);
ASSERT_EQ (merged_config.node.bootstrap.block_processor_threshold, 33333);
ASSERT_TRUE (merged_config_string.find ("old_entry") == std::string::npos);
}

View file

@ -26,10 +26,10 @@ nano::error nano::account_sets_config::serialize (nano::tomlconfig & toml) const
}
/*
* bootstrap_ascending_config
* bootstrap_config
*/
nano::error nano::bootstrap_ascending_config::deserialize (nano::tomlconfig & toml)
nano::error nano::bootstrap_config::deserialize (nano::tomlconfig & toml)
{
toml.get ("enable", enable);
toml.get ("enable_database_scan", enable_database_scan);
@ -56,7 +56,7 @@ nano::error nano::bootstrap_ascending_config::deserialize (nano::tomlconfig & to
return toml.get_error ();
}
nano::error nano::bootstrap_ascending_config::serialize (nano::tomlconfig & toml) const
nano::error nano::bootstrap_config::serialize (nano::tomlconfig & toml) const
{
toml.put ("enable", enable, "Enable or disable the ascending bootstrap. Disabling it is not recommended and will prevent the node from syncing.\ntype:bool");
toml.put ("enable_database_scan", enable_database_scan, "Enable or disable the 'database scan` strategy for the ascending bootstrap.\ntype:bool");

View file

@ -8,7 +8,6 @@ namespace nano
{
class tomlconfig;
// TODO: This should be moved next to `account_sets` class
class account_sets_config final
{
public:
@ -22,7 +21,6 @@ public:
std::chrono::milliseconds cooldown{ 1000 * 3 };
};
// TODO: This should be moved next to `frontier_scan` class
class frontier_scan_config final
{
public:
@ -35,8 +33,7 @@ public:
std::size_t max_pending{ 16 };
};
// TODO: This should be moved next to `bootstrap_ascending` class
class bootstrap_ascending_config final
class bootstrap_config final
{
public:
nano::error deserialize (nano::tomlconfig & toml);

View file

@ -18,7 +18,7 @@
using namespace std::chrono_literals;
nano::bootstrap_service::bootstrap_service (nano::node_config const & node_config_a, nano::block_processor & block_processor_a, nano::ledger & ledger_a, nano::network & network_a, nano::stats & stat_a, nano::logger & logger_a) :
config{ node_config_a.bootstrap_ascending },
config{ node_config_a.bootstrap },
network_constants{ node_config_a.network_params.network },
block_processor{ block_processor_a },
ledger{ ledger_a },

View file

@ -53,7 +53,7 @@ public:
nano::bootstrap::account_sets::info_t info () const;
private: // Dependencies
bootstrap_ascending_config const & config;
bootstrap_config const & config;
nano::network_constants const & network_constants;
nano::block_processor & block_processor;
nano::ledger & ledger;

View file

@ -6,7 +6,7 @@
* peer_scoring
*/
nano::bootstrap::peer_scoring::peer_scoring (bootstrap_ascending_config const & config_a, nano::network_constants const & network_constants_a) :
nano::bootstrap::peer_scoring::peer_scoring (bootstrap_config const & config_a, nano::network_constants const & network_constants_a) :
config{ config_a },
network_constants{ network_constants_a }
{

View file

@ -14,15 +14,13 @@ namespace mi = boost::multi_index;
namespace nano
{
class bootstrap_ascending_config;
namespace bootstrap
{
// Container for tracking and scoring peers with respect to bootstrapping
class peer_scoring
{
public:
peer_scoring (bootstrap_ascending_config const &, nano::network_constants const &);
peer_scoring (bootstrap_config const &, nano::network_constants const &);
// Returns true if channel limit has been exceeded
bool try_send_message (std::shared_ptr<nano::transport::channel> channel);
@ -35,7 +33,7 @@ namespace bootstrap
void sync (std::deque<std::shared_ptr<nano::transport::channel>> const & list);
private:
bootstrap_ascending_config const & config;
bootstrap_config const & config;
nano::network_constants const & network_constants;
private:

View file

@ -16,6 +16,7 @@ namespace nano
{
class active_elections;
class block_processor;
class bootstrap_config;
class bootstrap_server;
class bootstrap_service;
class confirming_set;

View file

@ -214,9 +214,9 @@ nano::error nano::node_config::serialize_toml (nano::tomlconfig & toml) const
priority_bucket.serialize (priority_bucket_l);
toml.put_child ("priority_bucket", priority_bucket_l);
nano::tomlconfig bootstrap_ascending_l;
bootstrap_ascending.serialize (bootstrap_ascending_l);
toml.put_child ("bootstrap_ascending", bootstrap_ascending_l);
nano::tomlconfig bootstrap_l;
bootstrap.serialize (bootstrap_l);
toml.put_child ("bootstrap", bootstrap_l);
nano::tomlconfig bootstrap_server_l;
bootstrap_server.serialize (bootstrap_server_l);
@ -329,10 +329,10 @@ nano::error nano::node_config::deserialize_toml (nano::tomlconfig & toml)
priority_bucket.deserialize (config_l);
}
if (toml.has_key ("bootstrap_ascending"))
if (toml.has_key ("bootstrap"))
{
auto config_l = toml.get_required_child ("bootstrap_ascending");
bootstrap_ascending.deserialize (config_l);
auto config_l = toml.get_required_child ("bootstrap");
bootstrap.deserialize (config_l);
}
if (toml.has_key ("bootstrap_server"))

View file

@ -120,7 +120,7 @@ public:
std::size_t bootstrap_bandwidth_limit{ 5 * 1024 * 1024 };
/** Bootstrap traffic does not need bursts */
double bootstrap_bandwidth_burst_ratio{ 1. };
nano::bootstrap_ascending_config bootstrap_ascending;
nano::bootstrap_config bootstrap;
nano::bootstrap_server_config bootstrap_server;
std::chrono::milliseconds confirming_set_batch_time{ 250 };
bool backup_before_upgrade{ false };