From b9f6fb43335b520c29398a19f7329939a602b8e4 Mon Sep 17 00:00:00 2001 From: canepat <16927169+canepat@users.noreply.github.com> Date: Thu, 21 Mar 2024 08:58:04 +0100 Subject: [PATCH] sync: remove old flag to force PoW consensus --- cmd/common/settings.hpp | 1 - cmd/silkworm.cpp | 11 ++--------- silkworm/sync/sync.cpp | 7 +------ silkworm/sync/sync.hpp | 4 ---- 4 files changed, 3 insertions(+), 20 deletions(-) diff --git a/cmd/common/settings.hpp b/cmd/common/settings.hpp index 9798c4e9c2..802423d2df 100644 --- a/cmd/common/settings.hpp +++ b/cmd/common/settings.hpp @@ -30,7 +30,6 @@ struct SilkwormSettings { node::Settings node_settings; sentry::Settings sentry_settings; rpc::DaemonSettings rpcdaemon_settings; - bool force_pow{false}; // TODO(canepat) remove when PoS sync works }; } // namespace silkworm::cmd::common diff --git a/cmd/silkworm.cpp b/cmd/silkworm.cpp index 17ef54f957..b53d53c1ea 100644 --- a/cmd/silkworm.cpp +++ b/cmd/silkworm.cpp @@ -107,9 +107,6 @@ void parse_silkworm_command_line(CLI::App& cli, int argc, char* argv[], Silkworm // Sentry settings add_sentry_options(cli, settings.sentry_settings); - // TODO(canepat) remove when PoS sync works - cli.add_flag("--sync.force_pow", settings.force_pow, "Force usage of proof-of-work bypassing chain config"); - // Prune options std::string prune_mode; auto& prune_opts = *cli.add_option_group("Prune", "Prune options to delete ancient data from DB"); @@ -289,7 +286,7 @@ int main(int argc, char* argv[]) { context_pool.as_executor_pool(), context_pool, eth_status_data_provider.to_factory_function()); - auto embedded_sentry_run_if_needed = [server = sentry_server]() -> Task { + auto embedded_sentry_run_if_needed = [](auto server) -> Task { if (server) { co_await server->run(); } @@ -319,14 +316,10 @@ int main(int argc, char* argv[]) { sentry_client, *node_settings.chain_config, rpc_settings}; - // TODO(canepat) remove when PoS sync works - if (settings.force_pow) { - chain_sync_process.force_pow(execution_client); - } auto tasks = execution_node.run() && - embedded_sentry_run_if_needed() && + embedded_sentry_run_if_needed(sentry_server) && chain_sync_process.async_run(); // Trap OS signals diff --git a/silkworm/sync/sync.cpp b/silkworm/sync/sync.cpp index 68d97eb11c..45dc6c9a32 100644 --- a/silkworm/sync/sync.cpp +++ b/silkworm/sync/sync.cpp @@ -33,7 +33,7 @@ Sync::Sync(const boost::asio::any_io_executor& executor, : sync_sentry_client_{executor, sentry_client}, block_exchange_{sync_sentry_client_, db::ROAccess{chaindata_env}, config} { // If terminal total difficulty is present in chain config, the network will use Proof-of-Stake sooner or later - if (config.terminal_total_difficulty) { + if (config.terminal_total_difficulty.has_value()) { // Configure and activate the Execution Layer Engine API RPC server rpc::DaemonSettings engine_rpc_settings{ .log_settings = { @@ -65,11 +65,6 @@ Sync::Sync(const boost::asio::any_io_executor& executor, } } -void Sync::force_pow(execution::Client& execution) { - chain_sync_ = std::make_unique(block_exchange_, execution); - engine_rpc_server_.reset(); -} - Task Sync::async_run() { using namespace concurrency::awaitable_wait_for_all; return (run_tasks() && start_engine_rpc_server()); diff --git a/silkworm/sync/sync.hpp b/silkworm/sync/sync.hpp index 90c1d32143..5cc576f61b 100644 --- a/silkworm/sync/sync.hpp +++ b/silkworm/sync/sync.hpp @@ -59,10 +59,6 @@ class Sync { Sync(const Sync&) = delete; Sync& operator=(const Sync&) = delete; - //! Force PoW sync independently from chain config - // TODO(canepat) remove when PoS sync works - void force_pow(execution::Client& execution); - Task async_run(); private: