Skip to content

Commit

Permalink
node: fix clang-tidy after PR 1772 (#1776)
Browse files Browse the repository at this point in the history
  • Loading branch information
canepat authored Jan 24, 2024
1 parent f34e532 commit 65b0d27
Show file tree
Hide file tree
Showing 21 changed files with 124 additions and 152 deletions.
20 changes: 10 additions & 10 deletions cmd/dev/backend_kv_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <filesystem>
#include <stdexcept>
#include <string>
#include <utility>

#include <CLI/CLI.hpp>
#include <boost/asio/co_spawn.hpp>
Expand Down Expand Up @@ -114,7 +115,7 @@ std::shared_ptr<silkworm::sentry::api::SentryClient> make_sentry_client(
db::ROAccess db_access) {
std::shared_ptr<silkworm::sentry::api::SentryClient> sentry_client;

db::EthStatusDataProvider eth_status_data_provider{db_access, node_settings.chain_config.value()};
db::EthStatusDataProvider eth_status_data_provider{std::move(db_access), node_settings.chain_config.value()};

if (node_settings.remote_sentry_addresses.empty()) {
assert(false);
Expand Down Expand Up @@ -213,23 +214,22 @@ int main(int argc, char* argv[]) {
rpc::BackEndKvServer server{server_settings, backend};

// Standalone BackEndKV server has no staged loop, so this simulates periodic state changes
boost::asio::steady_timer state_changes_timer{context_pool.next_io_context()};
constexpr auto kStateChangeInterval{std::chrono::seconds(10)};
constexpr silkworm::BlockNum kStartBlock{100'000'000};
constexpr uint64_t kGasLimit{30'000'000};

Task<void> tasks;
if (settings.simulate_state_changes) {
using namespace boost::asio::experimental::awaitable_operators;
auto state_changes_simulator = [&]() -> Task<void> {
auto state_changes_simulator = [](auto& ctx_pool, auto& be) -> Task<void> {
boost::asio::steady_timer state_changes_timer{ctx_pool.next_io_context()};
constexpr auto kStateChangeInterval{std::chrono::seconds(10)};
constexpr silkworm::BlockNum kStartBlock{100'000'000};
constexpr uint64_t kGasLimit{30'000'000};
auto run = [&]() {
boost::system::error_code ec;
while (ec != boost::asio::error::operation_aborted) {
state_changes_timer.expires_at(std::chrono::steady_clock::now() + kStateChangeInterval);
state_changes_timer.wait(ec);
static auto block_number = kStartBlock;
backend.state_change_source()->start_new_batch(block_number, evmc::bytes32{}, {}, false);
backend.state_change_source()->notify_batch(0, kGasLimit);
be.state_change_source()->start_new_batch(block_number, evmc::bytes32{}, {}, false);
be.state_change_source()->notify_batch(0, kGasLimit);
SILK_INFO << "New batch notified for block: " << block_number;
++block_number;
}
Expand All @@ -239,7 +239,7 @@ int main(int argc, char* argv[]) {
};
co_await concurrency::async_thread(std::move(run), std::move(stop), "state-c-sim");
};
tasks = state_changes_simulator() && server.async_run("bekv-server");
tasks = state_changes_simulator(context_pool, backend) && server.async_run("bekv-server");
} else {
tasks = server.async_run("bekv-server");
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/dev/check_changes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ int main(int argc, char* argv[]) {
auto calculated_it{calculated_storage_changes.cbegin()};
auto db_it{db_storage_changes.cbegin()};
for (; calculated_it != calculated_storage_changes.cend() && db_it != db_storage_changes.cend(); ++calculated_it, ++db_it) {
auto calculated_change{*calculated_it};
auto stored_change{*db_it};
const auto& calculated_change{*calculated_it};
const auto& stored_change{*db_it};
if (calculated_change != stored_change) {
std::cout << "Mismatch number " << mismatch_count + 1 << ") is:\n- calculated change:\n";
print_storage_changes(calculated_change.first, calculated_change.second);
Expand Down
4 changes: 2 additions & 2 deletions cmd/dev/check_pow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int main(int argc, char* argv[]) {

app.add_flag("--debug", options.debug, "May print some debug/trace info.");

CLI11_PARSE(app, argc, argv);
CLI11_PARSE(app, argc, argv)

if (options.debug) {
log::set_verbosity(log::Level::kDebug);
Expand Down Expand Up @@ -142,7 +142,7 @@ int main(int argc, char* argv[]) {
std::cout << "\n Pow Verification error on block " << block_num << " : \n"
<< "Error: " << ec << "\n"
<< "Final hash " << to_hex(f) << " expected below " << to_hex(b) << "\n"
<< "Mix hash " << to_hex(m) << " expected mix " << to_hex(m) << std::endl;
<< "Mix hash " << to_hex(m) << " expected mix " << to_hex(m) << "\n";
break;
}

Expand Down
3 changes: 1 addition & 2 deletions cmd/dev/check_tx_lookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <silkworm/infra/common/directories.hpp>
#include <silkworm/infra/common/log.hpp>
#include <silkworm/infra/concurrency/signal_handler.hpp>
#include <silkworm/node/db/access_layer.hpp>
#include <silkworm/node/db/etl/collector.hpp>
#include <silkworm/node/db/stages.hpp>

Expand All @@ -41,7 +40,7 @@ int main(int argc, char* argv[]) {
->capture_default_str()
->check(CLI::Range(1u, UINT32_MAX));

CLI11_PARSE(app, argc, argv);
CLI11_PARSE(app, argc, argv)

auto data_dir{DataDirectory::from_chaindata(chaindata)};
data_dir.deploy();
Expand Down
Loading

0 comments on commit 65b0d27

Please sign in to comment.