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

sync: remove old flag to force PoW consensus #1927

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cmd/common/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 2 additions & 9 deletions cmd/silkworm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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<void> {
auto embedded_sentry_run_if_needed = [](auto server) -> Task<void> {
if (server) {
co_await server->run();
}
Expand Down Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions silkworm/sync/sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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<PoWSync>(block_exchange_, execution);
engine_rpc_server_.reset();
}

Task<void> Sync::async_run() {
using namespace concurrency::awaitable_wait_for_all;
return (run_tasks() && start_engine_rpc_server());
Expand Down
4 changes: 0 additions & 4 deletions silkworm/sync/sync.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> async_run();

private:
Expand Down
Loading