diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ec1392a1..2d4d4f024 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: run: ./scripts/build.sh lint: name: Lint - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 with: diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 07dcc5d37..3c54c02ff 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -12,7 +12,7 @@ defaults: jobs: gh-pages-deploy: name: Github Pages Deploy - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Checkout code uses: actions/checkout@v2 diff --git a/.gitignore b/.gitignore index ebb163ae7..fddc84dfe 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,7 @@ CMakeFiles/ plots/ .deps/ .libs/ +.cache/ # Database blocks.dat diff --git a/src/parsec/agent/impl.hpp b/src/parsec/agent/impl.hpp index 8ee71ec8c..83e2bcfc7 100644 --- a/src/parsec/agent/impl.hpp +++ b/src/parsec/agent/impl.hpp @@ -121,7 +121,7 @@ namespace cbdc::parsec::agent { std::shared_ptr m_threads; std::optional m_tx_id; bool m_wounded{false}; - broker::held_locks_set_type m_requested_locks{}; + broker::held_locks_set_type m_requested_locks; bool m_restarted{false}; void handle_begin(broker::interface::ticketnum_or_errcode_type res); diff --git a/src/parsec/agent/runners/evm/impl.cpp b/src/parsec/agent/runners/evm/impl.cpp index aa4c6827a..9406f0942 100644 --- a/src/parsec/agent/runners/evm/impl.cpp +++ b/src/parsec/agent/runners/evm/impl.cpp @@ -456,7 +456,7 @@ namespace cbdc::parsec::agent::runner { return std::make_pair( min_gas, - !(evmtx.m_gas_limit < min_gas && !is_readonly_run)); + !evmtx.m_gas_limit < min_gas || is_readonly_run); } auto evm_runner::make_message(const evmc::address& from, diff --git a/src/parsec/agent/runners/evm/messages.hpp b/src/parsec/agent/runners/evm/messages.hpp index 0798c7459..05ec3e703 100644 --- a/src/parsec/agent/runners/evm/messages.hpp +++ b/src/parsec/agent/runners/evm/messages.hpp @@ -22,12 +22,12 @@ namespace cbdc::parsec::agent::runner { /// EVM account type struct evm_account { /// Balance in the account. - evmc::uint256be m_balance{}; + evmc::uint256be m_balance; /// Signature nonce. - evmc::uint256be m_nonce{}; + evmc::uint256be m_nonce; /// Set of keys modified during contract execution. - std::set m_modified{}; + std::set m_modified; /// Flag set if the account is being destructed. bool m_destruct{false}; }; @@ -44,8 +44,8 @@ namespace cbdc::parsec::agent::runner { /// Type for tracking storage key accesses between accounts. struct evm_access_tuple { - evmc::address m_address{}; - std::vector m_storage_keys{}; + evmc::address m_address; + std::vector m_storage_keys; auto operator==(const evm_access_tuple& rhs) const -> bool { return m_address == rhs.m_address && m_storage_keys == rhs.m_storage_keys; @@ -67,23 +67,23 @@ namespace cbdc::parsec::agent::runner { /// Type of transaction. evm_tx_type m_type{}; /// To address or std::nullopt if contract creation. - std::optional m_to{}; + std::optional m_to; /// Value to transfer. - evmc::uint256be m_value{}; + evmc::uint256be m_value; /// Nonce for from account. - evmc::uint256be m_nonce{}; + evmc::uint256be m_nonce; /// Gas price. - evmc::uint256be m_gas_price{}; + evmc::uint256be m_gas_price; /// Maximum gas for this transaction. - evmc::uint256be m_gas_limit{}; + evmc::uint256be m_gas_limit; /// Maximum tip fee. - evmc::uint256be m_gas_tip_cap{}; + evmc::uint256be m_gas_tip_cap; /// Maximum base fee. - evmc::uint256be m_gas_fee_cap{}; + evmc::uint256be m_gas_fee_cap; /// Contract input data. - std::vector m_input{}; + std::vector m_input; /// List of storage key accesses. - evm_access_list m_access_list{}; + evm_access_list m_access_list; /// Transaction signature. evm_sig m_sig; }; @@ -99,11 +99,11 @@ namespace cbdc::parsec::agent::runner { /// EVM log output type. struct evm_log { /// Address for the log. - evmc::address m_addr{}; + evmc::address m_addr; /// Log data. - std::vector m_data{}; + std::vector m_data; /// List of log topics. - std::vector m_topics{}; + std::vector m_topics; }; /// EVM transaction receipt type. @@ -113,11 +113,11 @@ namespace cbdc::parsec::agent::runner { /// Created contract address, if applicable. std::optional m_create_address; /// Gas used in transaction. - evmc::uint256be m_gas_used{}; + evmc::uint256be m_gas_used; /// List of logs emitted during transaction. - std::vector m_logs{}; + std::vector m_logs; /// EVM output data. - std::vector m_output_data{}; + std::vector m_output_data; /// Ticket number that ran this TX - needed to map /// to pretend blocks cbdc::parsec::agent::runner::interface::ticket_number_type @@ -136,16 +136,16 @@ namespace cbdc::parsec::agent::runner { /// Ticket number interface::ticket_number_type m_ticket_number {}; /// Transactions executed by the ticket - std::vector m_transactions{}; + std::vector m_transactions; }; /// Describes the parameters of a query on EVM logs - used to transfer /// these parameters from the getLogs API method to the runner struct evm_log_query { /// The addresses for which logs are queried - std::vector m_addresses{}; + std::vector m_addresses; /// The topics for which logs are queried - std::vector m_topics{}; + std::vector m_topics; /// The start of the block range to query logs for cbdc::parsec::agent::runner::interface::ticket_number_type m_from_block {}; diff --git a/src/parsec/agent/runners/evm/serialization.cpp b/src/parsec/agent/runners/evm/serialization.cpp index 5529dc32d..a9cb7c666 100644 --- a/src/parsec/agent/runners/evm/serialization.cpp +++ b/src/parsec/agent/runners/evm/serialization.cpp @@ -234,7 +234,7 @@ namespace cbdc::parsec::agent::runner { auto maybe_addr = cbdc::from_buffer( maybe_addr_buf.value()); if(maybe_addr) { - return maybe_addr.value(); + return maybe_addr; } } } @@ -249,7 +249,7 @@ namespace cbdc::parsec::agent::runner { auto maybe_val = cbdc::from_buffer(maybe_val_buf.value()); if(maybe_val) { - return maybe_val.value(); + return maybe_val; } } return std::nullopt; diff --git a/src/parsec/agent/server_interface.hpp b/src/parsec/agent/server_interface.hpp index da3fe9729..21b0c9488 100644 --- a/src/parsec/agent/server_interface.hpp +++ b/src/parsec/agent/server_interface.hpp @@ -53,7 +53,7 @@ namespace cbdc::parsec::agent::rpc { const cbdc::parsec::config& m_cfg; mutable std::mutex m_agents_mut; - std::atomic m_next_id{}; + std::atomic m_next_id; std::unordered_map> m_agents; blocking_queue m_cleanup_queue; diff --git a/src/parsec/broker/impl.cpp b/src/parsec/broker/impl.cpp index 1776796e8..7a1226b4c 100644 --- a/src/parsec/broker/impl.cpp +++ b/src/parsec/broker/impl.cpp @@ -157,7 +157,7 @@ namespace cbdc::parsec::broker { if(!m_directory->key_location( key, - [=, this](std::optional res) { handle_find_key(ticket_number, key, @@ -295,7 +295,7 @@ namespace cbdc::parsec::broker { auto sidx = shard.first; if(!m_shards[sidx]->commit( ticket_number, - [=, this](const parsec::runtime_locking_shard::interface:: + [commit_cb, ticket_number, sidx, this](const parsec::runtime_locking_shard::interface:: commit_return_type& comm_res) { handle_commit(commit_cb, ticket_number, sidx, comm_res); })) { @@ -544,7 +544,7 @@ namespace cbdc::parsec::broker { shard.second.m_state = shard_state_type::finishing; if(!m_shards[sidx]->finish( ticket_number, - [=, this](const parsec::runtime_locking_shard:: + [result_callback, ticket_number, sidx, this](const parsec::runtime_locking_shard:: interface::finish_return_type& res) { handle_finish(result_callback, ticket_number, @@ -560,7 +560,7 @@ namespace cbdc::parsec::broker { }(); if(maybe_error.has_value()) { - result_callback(maybe_error.value()); + result_callback(maybe_error); } else if(done) { result_callback(std::nullopt); } @@ -617,7 +617,7 @@ namespace cbdc::parsec::broker { shard.second.m_state = shard_state_type::rolling_back; if(!m_shards[sidx]->rollback( ticket_number, - [=, this](const parsec::runtime_locking_shard:: + [result_callback, ticket_number, sidx, this](const parsec::runtime_locking_shard:: interface::rollback_return_type& res) { handle_rollback(result_callback, ticket_number, @@ -782,7 +782,7 @@ namespace cbdc::parsec::broker { key, locktype, first_lock, - [=, this](const parsec::runtime_locking_shard::interface:: + [ticket_number, key, shard_idx, result_callback, this](const parsec::runtime_locking_shard::interface:: try_lock_return_type& lock_res) { handle_lock(ticket_number, key, @@ -873,7 +873,7 @@ namespace cbdc::parsec::broker { }(); if(maybe_error.has_value()) { - result_callback(maybe_error.value()); + result_callback(maybe_error); } else if(callback) { result_callback(std::nullopt); } @@ -962,7 +962,7 @@ namespace cbdc::parsec::broker { }}, res); if(maybe_error.has_value()) { - result_callback(maybe_error.value()); + result_callback(maybe_error); } else if(done) { result_callback(std::nullopt); } @@ -972,7 +972,7 @@ namespace cbdc::parsec::broker { auto impl::do_recovery(const recover_callback_type& result_callback) -> std::optional { - for(auto [ticket_number, ticket] : m_tickets) { + for(const auto& [ticket_number, ticket] : m_tickets) { size_t committed{}; for(auto& [sidx, t_state] : ticket->m_shard_states) { switch(t_state.m_state) { diff --git a/src/parsec/runtime_locking_shard/impl.hpp b/src/parsec/runtime_locking_shard/impl.hpp index ae3bc87f1..e3f65fa1a 100644 --- a/src/parsec/runtime_locking_shard/impl.hpp +++ b/src/parsec/runtime_locking_shard/impl.hpp @@ -121,7 +121,7 @@ namespace cbdc::parsec::runtime_locking_shard { key_set_type m_queued_locks; state_update_type m_state_update; broker_id_type m_broker_id{}; - std::optional m_wounded_details{}; + std::optional m_wounded_details; }; struct pending_callback_element_type { diff --git a/src/parsec/ticket_machine/impl.hpp b/src/parsec/ticket_machine/impl.hpp index ca6e7c3da..54016ad4a 100644 --- a/src/parsec/ticket_machine/impl.hpp +++ b/src/parsec/ticket_machine/impl.hpp @@ -31,7 +31,7 @@ namespace cbdc::parsec::ticket_machine { private: std::shared_ptr m_log; - std::atomic m_next_ticket_number{}; + std::atomic m_next_ticket_number; ticket_number_type m_range; }; } diff --git a/src/parsec/ticket_machine/state_machine.hpp b/src/parsec/ticket_machine/state_machine.hpp index 739d609d3..cea387c22 100644 --- a/src/parsec/ticket_machine/state_machine.hpp +++ b/src/parsec/ticket_machine/state_machine.hpp @@ -60,7 +60,7 @@ namespace cbdc::parsec::ticket_machine { std::atomic m_last_committed_idx{0}; - std::unique_ptr m_ticket_machine{}; + std::unique_ptr m_ticket_machine; std::shared_ptr m_logger; }; diff --git a/src/uhs/atomizer/archiver/archiverd.cpp b/src/uhs/atomizer/archiver/archiverd.cpp index 859eb98b8..cc38d7c48 100644 --- a/src/uhs/atomizer/archiver/archiverd.cpp +++ b/src/uhs/atomizer/archiver/archiverd.cpp @@ -16,7 +16,7 @@ auto main(int argc, char** argv) -> int { if(args.size() < 3) { std::cerr << "Usage: " << args[0] << " []" - << std::endl; + << '\n'; return 0; } @@ -28,7 +28,7 @@ auto main(int argc, char** argv) -> int { auto cfg_or_err = cbdc::config::load_options(args[1]); if(std::holds_alternative(cfg_or_err)) { std::cerr << "Error loading config file: " - << std::get(cfg_or_err) << std::endl; + << std::get(cfg_or_err) << '\n'; return -1; } auto opts = std::get(cfg_or_err); @@ -36,7 +36,7 @@ auto main(int argc, char** argv) -> int { const auto archiver_id = std::stoull(args[2]); if(opts.m_archiver_endpoints.size() <= archiver_id) { - std::cerr << "Archiver ID not in config file" << std::endl; + std::cerr << "Archiver ID not in config file" << '\n'; return -1; } diff --git a/src/uhs/atomizer/archiver/controller.cpp b/src/uhs/atomizer/archiver/controller.cpp index 7fc850cbd..fa14b2af8 100644 --- a/src/uhs/atomizer/archiver/controller.cpp +++ b/src/uhs/atomizer/archiver/controller.cpp @@ -233,7 +233,7 @@ namespace cbdc::archiver { = static_cast(blk.m_transactions.size()) / s_since_last_block.count(); - m_tp_sample_file << tx_throughput << std::endl; + m_tp_sample_file << tx_throughput << '\n'; m_samples++; } @@ -280,7 +280,7 @@ namespace cbdc::archiver { auto blk = from_buffer(buf); assert(blk.has_value()); m_logger->trace("found block", height, "-", blk.value().m_height); - return blk.value(); + return blk; } void controller::request_block(uint64_t height) { diff --git a/src/uhs/atomizer/atomizer/atomizer-raftd.cpp b/src/uhs/atomizer/atomizer/atomizer-raftd.cpp index a2e10cde0..06425906e 100644 --- a/src/uhs/atomizer/atomizer/atomizer-raftd.cpp +++ b/src/uhs/atomizer/atomizer/atomizer-raftd.cpp @@ -14,7 +14,7 @@ auto main(int argc, char** argv) -> int { auto args = cbdc::config::get_args(argc, argv); if(args.size() < 3) { std::cerr << "Usage: " << args[0] << " " - << std::endl; + << '\n'; return 0; } @@ -23,13 +23,13 @@ auto main(int argc, char** argv) -> int { auto cfg_or_err = cbdc::config::load_options(args[1]); if(std::holds_alternative(cfg_or_err)) { std::cerr << "Error loading config file: " - << std::get(cfg_or_err) << std::endl; + << std::get(cfg_or_err) << '\n'; return -1; } auto opts = std::get(cfg_or_err); if(opts.m_atomizer_endpoints.size() <= atomizer_id) { - std::cerr << "Atomizer ID not in config file" << std::endl; + std::cerr << "Atomizer ID not in config file" << '\n'; return -1; } diff --git a/src/uhs/atomizer/atomizer/controller.cpp b/src/uhs/atomizer/atomizer/controller.cpp index 9ab9ddd7d..d56e05bad 100644 --- a/src/uhs/atomizer/atomizer/controller.cpp +++ b/src/uhs/atomizer/atomizer/controller.cpp @@ -20,7 +20,7 @@ namespace cbdc::atomizer { : m_atomizer_id(atomizer_id), m_opts(opts), m_logger(std::move(log)), - m_raft_node(static_cast(atomizer_id), + m_raft_node(atomizer_id, opts.m_atomizer_raft_endpoints, m_opts.m_stxo_cache_depth, m_logger, diff --git a/src/uhs/atomizer/atomizer/state_machine.hpp b/src/uhs/atomizer/atomizer/state_machine.hpp index 16445bcd8..44bc9a46c 100644 --- a/src/uhs/atomizer/atomizer/state_machine.hpp +++ b/src/uhs/atomizer/atomizer/state_machine.hpp @@ -124,9 +124,9 @@ namespace cbdc::atomizer { /// Pointer to the atomizer instance. std::shared_ptr m_atomizer; /// Pointer to the nuraft snapshot metadata. - nuraft::ptr m_snp{}; + nuraft::ptr m_snp; /// Pointer to the state of the block cache. - std::shared_ptr m_blocks{}; + std::shared_ptr m_blocks; }; private: diff --git a/src/uhs/atomizer/sentinel/controller.cpp b/src/uhs/atomizer/sentinel/controller.cpp index ac2af005e..59c574220 100644 --- a/src/uhs/atomizer/sentinel/controller.cpp +++ b/src/uhs/atomizer/sentinel/controller.cpp @@ -157,7 +157,7 @@ namespace cbdc::sentinel { success = m_sentinel_clients[sentinel_id]->validate_transaction( tx, - [=, this](async_interface::validate_result v_res) { + [requested, sentinel_id, tx, ctx, this](async_interface::validate_result v_res) { auto r = requested; r.insert(sentinel_id); validate_result_handler(v_res, tx, ctx, r); diff --git a/src/uhs/atomizer/sentinel/controller.hpp b/src/uhs/atomizer/sentinel/controller.hpp index 483433cfa..dc9ccf574 100644 --- a/src/uhs/atomizer/sentinel/controller.hpp +++ b/src/uhs/atomizer/sentinel/controller.hpp @@ -73,12 +73,12 @@ namespace cbdc::sentinel { &secp256k1_context_destroy}; std::vector> - m_sentinel_clients{}; + m_sentinel_clients; - std::random_device m_r{}; + std::random_device m_r; std::default_random_engine m_rand{m_r()}; - std::uniform_int_distribution m_dist{}; - std::uniform_int_distribution m_shard_dist{}; + std::uniform_int_distribution m_dist; + std::uniform_int_distribution m_shard_dist; std::mutex m_rand_mut; privkey_t m_privkey{}; diff --git a/src/uhs/atomizer/sentinel/sentineld.cpp b/src/uhs/atomizer/sentinel/sentineld.cpp index 57f7aaa3a..5c29fd5f5 100644 --- a/src/uhs/atomizer/sentinel/sentineld.cpp +++ b/src/uhs/atomizer/sentinel/sentineld.cpp @@ -17,7 +17,7 @@ auto main(int argc, char** argv) -> int { auto args = cbdc::config::get_args(argc, argv); if(args.size() < 3) { std::cerr << "Usage: " << args[0] << " " - << std::endl; + << '\n'; return -1; } @@ -26,13 +26,13 @@ auto main(int argc, char** argv) -> int { auto cfg_or_err = cbdc::config::load_options(args[1]); if(std::holds_alternative(cfg_or_err)) { std::cerr << "Error loading config file: " - << std::get(cfg_or_err) << std::endl; + << std::get(cfg_or_err) << '\n'; return -1; } auto opts = std::get(cfg_or_err); if(opts.m_sentinel_endpoints.size() <= sentinel_id) { - std::cerr << "Sentinel ID not in config file" << std::endl; + std::cerr << "Sentinel ID not in config file" << '\n'; return -1; } diff --git a/src/uhs/atomizer/shard/shardd.cpp b/src/uhs/atomizer/shard/shardd.cpp index 0808fab94..003adaa22 100644 --- a/src/uhs/atomizer/shard/shardd.cpp +++ b/src/uhs/atomizer/shard/shardd.cpp @@ -17,7 +17,7 @@ auto main(int argc, char** argv) -> int { auto args = cbdc::config::get_args(argc, argv); if(args.size() < 3) { std::cerr << "Usage: " << args[0] << " " - << std::endl; + << '\n'; return 0; } @@ -26,13 +26,13 @@ auto main(int argc, char** argv) -> int { auto cfg_or_err = cbdc::config::load_options(args[1]); if(std::holds_alternative(cfg_or_err)) { std::cerr << "Error loading config file: " - << std::get(cfg_or_err) << std::endl; + << std::get(cfg_or_err) << '\n'; return -1; } auto opts = std::get(cfg_or_err); if(opts.m_shard_endpoints.size() <= shard_id) { - std::cerr << "Shard ID not in config file" << std::endl; + std::cerr << "Shard ID not in config file" << '\n'; return -1; } diff --git a/src/uhs/atomizer/watchtower/watchtowerd.cpp b/src/uhs/atomizer/watchtower/watchtowerd.cpp index cfdbec14a..f224d02a9 100644 --- a/src/uhs/atomizer/watchtower/watchtowerd.cpp +++ b/src/uhs/atomizer/watchtower/watchtowerd.cpp @@ -16,7 +16,7 @@ auto main(int argc, char** argv) -> int { auto args = cbdc::config::get_args(argc, argv); if(args.size() < 3) { std::cerr << "Usage: " << args[0] << " " - << std::endl; + << '\n'; return 0; } @@ -25,7 +25,7 @@ auto main(int argc, char** argv) -> int { auto cfg_or_err = cbdc::config::load_options(args[1]); if(std::holds_alternative(cfg_or_err)) { std::cerr << "Error loading config file: " - << std::get(cfg_or_err) << std::endl; + << std::get(cfg_or_err) << '\n'; return -1; } auto opts = std::get(cfg_or_err); diff --git a/src/uhs/client/client-cli.cpp b/src/uhs/client/client-cli.cpp index 439354d5a..34b656aed 100644 --- a/src/uhs/client/client-cli.cpp +++ b/src/uhs/client/client-cli.cpp @@ -21,7 +21,7 @@ auto mint_command(cbdc::client& client, const std::vector& args) static constexpr auto min_mint_arg_count = 7; if(args.size() < min_mint_arg_count) { std::cerr << "Mint requires args " - << std::endl; + << '\n'; return false; } @@ -31,7 +31,7 @@ auto mint_command(cbdc::client& client, const std::vector& args) const auto mint_tx = client.mint(n_outputs, static_cast(output_val)); std::cout << cbdc::to_string(cbdc::transaction::tx_id(mint_tx)) - << std::endl; + << '\n'; return true; } @@ -39,25 +39,25 @@ void print_tx_result( const std::optional& tx, const std::optional& resp, const cbdc::hash_t& pubkey) { - std::cout << "tx_id:" << std::endl + std::cout << "tx_id:" << '\n' << cbdc::to_string(cbdc::transaction::tx_id(tx.value())) - << std::endl; + << '\n'; const auto inputs = cbdc::client::export_send_inputs(tx.value(), pubkey); for(const auto& inp : inputs) { auto buf = cbdc::make_buffer(inp); - std::cout << "Data for recipient importinput:" << std::endl - << buf.to_hex() << std::endl; + std::cout << "Data for recipient importinput:" << '\n' + << buf.to_hex() << '\n'; } if(resp.has_value()) { std::cout << "Sentinel responded: " << cbdc::sentinel::to_string(resp.value().m_tx_status) - << std::endl; + << '\n'; if(resp.value().m_tx_error.has_value()) { std::cout << "Validation error: " << cbdc::transaction::validation::to_string( resp.value().m_tx_error.value()) - << std::endl; + << '\n'; } } } @@ -66,7 +66,7 @@ auto send_command(cbdc::client& client, const std::vector& args) -> bool { static constexpr auto min_send_arg_count = 7; if(args.size() < min_send_arg_count) { - std::cerr << "Send requires args " << std::endl; + std::cerr << "Send requires args " << '\n'; return false; } @@ -74,14 +74,14 @@ auto send_command(cbdc::client& client, const std::vector& args) static constexpr auto address_arg_idx = 6; auto pubkey = cbdc::address::decode(args[address_arg_idx]); if(!pubkey.has_value()) { - std::cout << "Could not decode address" << std::endl; + std::cout << "Could not decode address" << '\n'; return false; } const auto [tx, resp] = client.send(static_cast(value), pubkey.value()); if(!tx.has_value()) { - std::cout << "Could not generate valid send tx." << std::endl; + std::cout << "Could not generate valid send tx." << '\n'; return false; } @@ -93,7 +93,7 @@ auto fan_command(cbdc::client& client, const std::vector& args) -> bool { static constexpr auto min_fan_arg_count = 8; if(args.size() < min_fan_arg_count) { - std::cerr << "Fan requires args " << std::endl; + std::cerr << "Fan requires args " << '\n'; return false; } @@ -103,7 +103,7 @@ auto fan_command(cbdc::client& client, const std::vector& args) static constexpr auto address_arg_idx = 7; auto pubkey = cbdc::address::decode(args[address_arg_idx]); if(!pubkey.has_value()) { - std::cout << "Could not decode address" << std::endl; + std::cout << "Could not decode address" << '\n'; return false; } @@ -111,7 +111,7 @@ auto fan_command(cbdc::client& client, const std::vector& args) static_cast(value), pubkey.value()); if(!tx.has_value()) { - std::cout << "Could not generate valid send tx." << std::endl; + std::cout << "Could not generate valid send tx." << '\n'; return false; } @@ -138,7 +138,7 @@ void newaddress_command(cbdc::client& client) { }, addr_vec.begin(), addr_vec.end()); - std::cout << bech32::Encode(cbdc::config::bech32_hrp, data) << std::endl; + std::cout << bech32::Encode(cbdc::config::bech32_hrp, data) << '\n'; } auto importinput_command(cbdc::client& client, @@ -146,13 +146,13 @@ auto importinput_command(cbdc::client& client, static constexpr auto input_arg_idx = 5; auto buffer = cbdc::buffer::from_hex(args[input_arg_idx]); if(!buffer.has_value()) { - std::cout << "Invalid input encoding." << std::endl; + std::cout << "Invalid input encoding." << '\n'; return false; } auto in = cbdc::from_buffer(buffer.value()); if(!in.has_value()) { - std::cout << "Invalid input" << std::endl; + std::cout << "Invalid input" << '\n'; return false; } client.import_send_input(in.value()); @@ -164,12 +164,12 @@ auto confirmtx_command(cbdc::client& client, const auto tx_id = cbdc::hash_from_hex(args[5]); auto success = client.confirm_transaction(tx_id); if(!success) { - std::cout << "Unknown TXID" << std::endl; + std::cout << "Unknown TXID" << '\n'; return false; } std::cout << "Confirmed. Balance: " << cbdc::client::print_amount(client.balance()) - << " UTXOs: " << client.utxo_count() << std::endl; + << " UTXOs: " << client.utxo_count() << '\n'; return true; } @@ -180,14 +180,14 @@ auto main(int argc, char** argv) -> int { if(args.size() < min_arg_count) { std::cerr << "Usage: " << args[0] << " " - << " " << std::endl; + << " " << '\n'; return 0; } auto cfg_or_err = cbdc::config::load_options(args[1]); if(std::holds_alternative(cfg_or_err)) { std::cerr << "Error loading config file: " - << std::get(cfg_or_err) << std::endl; + << std::get(cfg_or_err) << '\n'; return -1; } @@ -241,7 +241,7 @@ auto main(int argc, char** argv) -> int { std::cout << "Balance: " << cbdc::client::print_amount(balance) << ", UTXOs: " << n_txos << ", pending TXs: " << client->pending_tx_count() - << std::endl; + << '\n'; } else if(command == "importinput") { if(!importinput_command(*client, args)) { return -1; @@ -251,7 +251,7 @@ auto main(int argc, char** argv) -> int { return -1; } } else { - std::cerr << "Unknown command" << std::endl; + std::cerr << "Unknown command" << '\n'; } // TODO: check that the send queue has drained before closing diff --git a/src/uhs/client/client.cpp b/src/uhs/client/client.cpp index 4b3bc60d6..a47132796 100644 --- a/src/uhs/client/client.cpp +++ b/src/uhs/client/client.cpp @@ -31,7 +31,7 @@ namespace cbdc { // see: https://github.com/bitcoin/bitcoin/pull/20861 const auto [hrp, enc_data] = bech32::Decode(addr_str); if(hrp != cbdc::config::bech32_hrp) { - std::cout << "Invalid address encoding" << std::endl; + std::cout << "Invalid address encoding" << '\n'; return std::nullopt; } auto data = std::vector(); @@ -47,7 +47,7 @@ namespace cbdc { != static_cast( cbdc::client::address_type::public_key) || data.size() != pubkey.size() + 1) { - std::cout << "Address is not a supported type" << std::endl; + std::cout << "Address is not a supported type" << '\n'; return std::nullopt; } diff --git a/src/uhs/client/client.hpp b/src/uhs/client/client.hpp index ae3cb6d2a..0f11d024c 100644 --- a/src/uhs/client/client.hpp +++ b/src/uhs/client/client.hpp @@ -292,7 +292,7 @@ namespace cbdc { std::unordered_map m_pending_inputs; - transaction::wallet m_wallet{}; + transaction::wallet m_wallet; std::string m_client_file; std::string m_wallet_file; diff --git a/src/uhs/transaction/transaction.hpp b/src/uhs/transaction/transaction.hpp index 0d39b6aed..3e1ed8b03 100644 --- a/src/uhs/transaction/transaction.hpp +++ b/src/uhs/transaction/transaction.hpp @@ -93,13 +93,13 @@ namespace cbdc::transaction { /// \see \ref cbdc::operator<<(serializer&, const transaction::full_tx&) struct full_tx { /// The set of inputs for the transaction - std::vector m_inputs{}; + std::vector m_inputs; /// The set of new outputs created by the transaction - std::vector m_outputs{}; + std::vector m_outputs; /// The set of witnesses - std::vector m_witness{}; + std::vector m_witness; auto operator==(const full_tx& rhs) const -> bool; diff --git a/src/uhs/twophase/coordinator/controller.cpp b/src/uhs/twophase/coordinator/controller.cpp index 5ddfc5d51..be7bbf3d1 100644 --- a/src/uhs/twophase/coordinator/controller.cpp +++ b/src/uhs/twophase/coordinator/controller.cpp @@ -47,7 +47,7 @@ namespace cbdc::coordinator { if(!m_logger) { std::cerr << "[ERROR] The logger pointer in coordinator::controller " - << "is null." << std::endl; + << "is null." << '\n'; return false; } diff --git a/src/uhs/twophase/coordinator/controller.hpp b/src/uhs/twophase/coordinator/controller.hpp index b9ca62009..7994a09bd 100644 --- a/src/uhs/twophase/coordinator/controller.hpp +++ b/src/uhs/twophase/coordinator/controller.hpp @@ -88,7 +88,7 @@ namespace cbdc::coordinator { /// The ID of the distributed transaction the command applies to, /// if applicable. - std::optional m_dtx_id{}; + std::optional m_dtx_id; auto operator==(const sm_command_header& rhs) const -> bool; }; @@ -99,7 +99,7 @@ namespace cbdc::coordinator { sm_command_header m_header{}; /// Associated transactions to prepare or commit, if applicable. - std::optional> m_data{}; + std::optional> m_data; }; /// \brief Current state of distributed transactions managed by a @@ -109,13 +109,13 @@ namespace cbdc::coordinator { /// operating. struct coordinator_state { /// Transactions in the prepare phase. - prepare_txs m_prepare_txs{}; + prepare_txs m_prepare_txs; /// Transactions in the commit phase. - commit_txs m_commit_txs{}; + commit_txs m_commit_txs; /// Transactions in the discard phase. - discard_txs m_discard_txs{}; + discard_txs m_discard_txs; auto operator==(const coordinator_state& rhs) const -> bool; }; @@ -143,7 +143,7 @@ namespace cbdc::coordinator { nuraft::ptr m_state_machine; std::shared_ptr m_raft_serv; - nuraft::raft_params m_raft_params{}; + nuraft::raft_params m_raft_params; std::atomic_bool m_running{false}; std::vector> m_shards; std::vector> m_shard_endpoints; diff --git a/src/uhs/twophase/coordinator/coordinatord.cpp b/src/uhs/twophase/coordinator/coordinatord.cpp index 967aea7f0..3495997a2 100644 --- a/src/uhs/twophase/coordinator/coordinatord.cpp +++ b/src/uhs/twophase/coordinator/coordinatord.cpp @@ -14,14 +14,14 @@ auto main(int argc, char** argv) -> int { auto args = cbdc::config::get_args(argc, argv); if(args.size() < 4) { std::cout << "Usage: " << args[0] - << " " << std::endl; + << " " << '\n'; return 0; } auto cfg_or_err = cbdc::config::load_options(args[1]); if(std::holds_alternative(cfg_or_err)) { std::cerr << "Error loading config file: " - << std::get(cfg_or_err) << std::endl; + << std::get(cfg_or_err) << '\n'; return -1; } auto opts = std::get(cfg_or_err); @@ -30,12 +30,12 @@ auto main(int argc, char** argv) -> int { auto node_id = std::stoull(args[3]); if(opts.m_coordinator_endpoints.size() <= coordinator_id) { - std::cerr << "Coordinator ID not configured" << std::endl; + std::cerr << "Coordinator ID not configured" << '\n'; return -1; } if(opts.m_coordinator_endpoints[coordinator_id].size() <= node_id) { - std::cerr << "Coordinator node ID not configured" << std::endl; + std::cerr << "Coordinator node ID not configured" << '\n'; return -1; } diff --git a/src/uhs/twophase/coordinator/state_machine.hpp b/src/uhs/twophase/coordinator/state_machine.hpp index 571e36389..ea60905c6 100644 --- a/src/uhs/twophase/coordinator/state_machine.hpp +++ b/src/uhs/twophase/coordinator/state_machine.hpp @@ -44,16 +44,16 @@ namespace cbdc::coordinator { std::unordered_map, cbdc::hashing::const_sip_hash> - m_prepare_txs{}; + m_prepare_txs; /// Maps dtx IDs in the commit phase to a byte array containing /// relevant data for recovery. std::unordered_map, cbdc::hashing::const_sip_hash> - m_commit_txs{}; + m_commit_txs; /// Set of dtx IDs in the discard phase. std::unordered_set> - m_discard_txs{}; + m_discard_txs; }; /// Commits a state machine command. diff --git a/src/uhs/twophase/locking_shard/controller.cpp b/src/uhs/twophase/locking_shard/controller.cpp index 8b961f78d..4a4980e50 100644 --- a/src/uhs/twophase/locking_shard/controller.cpp +++ b/src/uhs/twophase/locking_shard/controller.cpp @@ -33,7 +33,7 @@ namespace cbdc::locking_shard { if(!m_logger) { std::cerr << "[ERROR] The logger pointer in locking_shard::controller" - << " is null." << std::endl; + << " is null." << '\n'; return false; } diff --git a/src/uhs/twophase/locking_shard/locking_shardd.cpp b/src/uhs/twophase/locking_shard/locking_shardd.cpp index 92e738c77..40aad15ec 100644 --- a/src/uhs/twophase/locking_shard/locking_shardd.cpp +++ b/src/uhs/twophase/locking_shard/locking_shardd.cpp @@ -15,14 +15,14 @@ auto main(int argc, char** argv) -> int { auto args = cbdc::config::get_args(argc, argv); if(args.size() < 4) { std::cout << "Usage: " << args[0] - << " " << std::endl; + << " " << '\n'; return 0; } auto cfg_or_err = cbdc::config::load_options(args[1]); if(std::holds_alternative(cfg_or_err)) { std::cerr << "Error loading config file: " - << std::get(cfg_or_err) << std::endl; + << std::get(cfg_or_err) << '\n'; return -1; } auto cfg = std::get(cfg_or_err); @@ -30,12 +30,12 @@ auto main(int argc, char** argv) -> int { auto node_id = std::stoull(args[3]); if(cfg.m_locking_shard_endpoints.size() <= shard_id) { - std::cerr << "Shard ID not in config file" << std::endl; + std::cerr << "Shard ID not in config file" << '\n'; return -1; } if(cfg.m_locking_shard_endpoints[shard_id].size() <= node_id) { - std::cerr << "Shard node ID not in config file" << std::endl; + std::cerr << "Shard node ID not in config file" << '\n'; return -1; } diff --git a/src/uhs/twophase/locking_shard/messages.hpp b/src/uhs/twophase/locking_shard/messages.hpp index 80669f535..7ea9143b2 100644 --- a/src/uhs/twophase/locking_shard/messages.hpp +++ b/src/uhs/twophase/locking_shard/messages.hpp @@ -29,7 +29,7 @@ namespace cbdc::locking_shard::rpc { hash_t m_dtx_id{}; /// If the command is lock or apply, the parameters for these /// commands - std::variant m_params{}; + std::variant m_params; auto operator==(const request& rhs) const -> bool; }; diff --git a/src/uhs/twophase/locking_shard/state_machine.hpp b/src/uhs/twophase/locking_shard/state_machine.hpp index 5c911bd87..d81c9a866 100644 --- a/src/uhs/twophase/locking_shard/state_machine.hpp +++ b/src/uhs/twophase/locking_shard/state_machine.hpp @@ -81,16 +81,16 @@ namespace cbdc::locking_shard { -> cbdc::locking_shard::rpc::response; std::atomic m_last_committed_idx{0}; - nuraft::ptr m_snapshot{}; - std::shared_mutex m_snapshots_mut{}; + nuraft::ptr m_snapshot; + std::shared_mutex m_snapshots_mut; - nuraft::ptr m_tmp_snapshot{}; - std::mutex m_tmp_mut{}; + nuraft::ptr m_tmp_snapshot; + std::mutex m_tmp_mut; - std::shared_ptr m_shard{}; - std::pair m_output_range{}; - std::string m_snapshot_dir{}; - std::string m_db_dir{}; + std::shared_ptr m_shard; + std::pair m_output_range; + std::string m_snapshot_dir; + std::string m_db_dir; std::shared_ptr m_logger; }; diff --git a/src/uhs/twophase/sentinel_2pc/controller.cpp b/src/uhs/twophase/sentinel_2pc/controller.cpp index 4c6fc797f..f00134176 100644 --- a/src/uhs/twophase/sentinel_2pc/controller.cpp +++ b/src/uhs/twophase/sentinel_2pc/controller.cpp @@ -188,7 +188,7 @@ namespace cbdc::sentinel_2pc { success = m_sentinel_clients[sentinel_id]->validate_transaction( tx, - [=, this](validate_result v_res) { + [requested, sentinel_id, tx, result_callback, ctx, this](validate_result v_res) { auto r = requested; r.insert(sentinel_id); validate_result_handler(v_res, diff --git a/src/uhs/twophase/sentinel_2pc/controller.hpp b/src/uhs/twophase/sentinel_2pc/controller.hpp index b5485ebf2..7bade3fb9 100644 --- a/src/uhs/twophase/sentinel_2pc/controller.hpp +++ b/src/uhs/twophase/sentinel_2pc/controller.hpp @@ -99,11 +99,11 @@ namespace cbdc::sentinel_2pc { coordinator::rpc::client m_coordinator_client; std::vector> - m_sentinel_clients{}; + m_sentinel_clients; - std::random_device m_r{}; + std::random_device m_r; std::default_random_engine m_rand{m_r()}; - std::uniform_int_distribution m_dist{}; + std::uniform_int_distribution m_dist; privkey_t m_privkey{}; }; diff --git a/src/uhs/twophase/sentinel_2pc/sentineld_2pc.cpp b/src/uhs/twophase/sentinel_2pc/sentineld_2pc.cpp index d562d9326..03c9fa074 100644 --- a/src/uhs/twophase/sentinel_2pc/sentineld_2pc.cpp +++ b/src/uhs/twophase/sentinel_2pc/sentineld_2pc.cpp @@ -13,7 +13,7 @@ auto main(int argc, char** argv) -> int { auto args = cbdc::config::get_args(argc, argv); if(args.size() < 3) { std::cerr << "Usage: " << args[0] << " " - << std::endl; + << '\n'; return -1; } @@ -22,13 +22,13 @@ auto main(int argc, char** argv) -> int { auto cfg_or_err = cbdc::config::load_options(args[1]); if(std::holds_alternative(cfg_or_err)) { std::cerr << "Error loading config file: " - << std::get(cfg_or_err) << std::endl; + << std::get(cfg_or_err) << '\n'; return -1; } auto opts = std::get(cfg_or_err); if(opts.m_sentinel_endpoints.size() <= sentinel_id) { - std::cerr << "Sentinel ID not in config file" << std::endl; + std::cerr << "Sentinel ID not in config file" << '\n'; return -1; } diff --git a/src/util/common/buffer.cpp b/src/util/common/buffer.cpp index b85491d04..614409cc3 100644 --- a/src/util/common/buffer.cpp +++ b/src/util/common/buffer.cpp @@ -109,7 +109,7 @@ namespace cbdc { const std::string& prefix) -> std::optional { size_t offset = 0; - if(hex.rfind(prefix, 0) == 0) { + if(hex.starts_with(prefix)) { offset = prefix.size(); } auto hex_str = hex.substr(offset); diff --git a/src/util/common/buffer.hpp b/src/util/common/buffer.hpp index c35523dd6..7dc07d41f 100644 --- a/src/util/common/buffer.hpp +++ b/src/util/common/buffer.hpp @@ -87,7 +87,7 @@ namespace cbdc { = "0x") const -> std::string; private: - std::vector m_data{}; + std::vector m_data; }; } diff --git a/src/util/common/logging.hpp b/src/util/common/logging.hpp index 821ada900..cfcf9dc98 100644 --- a/src/util/common/logging.hpp +++ b/src/util/common/logging.hpp @@ -126,7 +126,7 @@ namespace cbdc::logging { private: bool m_stdout{true}; log_level m_loglevel{}; - std::mutex m_stream_mut{}; + std::mutex m_stream_mut; std::unique_ptr m_logfile; auto static to_string(log_level level) -> std::string; diff --git a/src/util/network/socket_selector.cpp b/src/util/network/socket_selector.cpp index 58affffda..639194a53 100644 --- a/src/util/network/socket_selector.cpp +++ b/src/util/network/socket_selector.cpp @@ -23,7 +23,7 @@ namespace cbdc::network { // should still be safe. // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-constant-array-index) auto unblock = FD_ISSET(m_unblock_fds[0], &m_ready_fds); - if(static_cast(unblock) != 0) { + if(unblock != 0) { auto dummy = char(); [[maybe_unused]] auto res = read(m_unblock_fds[0], &dummy, sizeof(dummy)); diff --git a/src/util/network/tcp_socket.hpp b/src/util/network/tcp_socket.hpp index c9969ce9c..821ec61dd 100644 --- a/src/util/network/tcp_socket.hpp +++ b/src/util/network/tcp_socket.hpp @@ -85,7 +85,7 @@ namespace cbdc::network { [[nodiscard]] auto connected() const -> bool; private: - std::optional m_addr{}; + std::optional m_addr; port_number_t m_port{}; std::atomic_bool m_connected{false}; }; diff --git a/src/util/rpc/client.hpp b/src/util/rpc/client.hpp index 2072bca6f..50878610f 100644 --- a/src/util/rpc/client.hpp +++ b/src/util/rpc/client.hpp @@ -101,7 +101,7 @@ namespace cbdc::rpc { = std::function)>; private: - std::atomic m_current_request_id{}; + std::atomic m_current_request_id; /// Subclasses must override this function to define the logic for /// call() to transmit a serialized RPC request and wait for a diff --git a/src/util/rpc/http/json_rpc_http_server.hpp b/src/util/rpc/http/json_rpc_http_server.hpp index afcd52402..95e231349 100644 --- a/src/util/rpc/http/json_rpc_http_server.hpp +++ b/src/util/rpc/http/json_rpc_http_server.hpp @@ -62,7 +62,7 @@ namespace cbdc::rpc { unsigned int m_code{}; }; - network::ip_address m_host{}; + network::ip_address m_host; uint16_t m_port{}; MHD_Daemon* m_daemon{}; handler_callback_type m_cb; diff --git a/src/util/rpc/tcp_client.hpp b/src/util/rpc/tcp_client.hpp index 61cc3d398..04eec82ef 100644 --- a/src/util/rpc/tcp_client.hpp +++ b/src/util/rpc/tcp_client.hpp @@ -155,7 +155,7 @@ namespace cbdc::rpc { = client::deserialize_response(*msg.m_pkt); if(resp.has_value()) { set_response(resp.value().m_header.m_request_id, - std::move(resp.value())); + std::move(resp)); } return std::nullopt; } diff --git a/tests/integration/gtest_evm_jsonrpc_client.cpp b/tests/integration/gtest_evm_jsonrpc_client.cpp index 9e5a01d60..b58798f16 100644 --- a/tests/integration/gtest_evm_jsonrpc_client.cpp +++ b/tests/integration/gtest_evm_jsonrpc_client.cpp @@ -59,7 +59,7 @@ namespace cbdc::test { ASSERT_FALSE(v.isMember(m_json_error_key)); ASSERT_TRUE(v.isMember(m_json_result_key)); out_txcount_str = v[m_json_result_key].asString(); - ASSERT_TRUE(out_txcount_str.length() > 0); + ASSERT_TRUE(!out_txcount_str.empty()); tx_done = true; }); @@ -98,7 +98,7 @@ namespace cbdc::test { ASSERT_TRUE(v[m_json_result_key].isString()); out_txid = v[m_json_result_key].asString(); - ASSERT_TRUE(out_txid.length() > 0); + ASSERT_TRUE(!out_txid.empty()); tx_done = true; }); diff --git a/tests/integration/replicated_atomizer_integration_tests.cpp b/tests/integration/replicated_atomizer_integration_tests.cpp index c66b09ac1..c68b23e5c 100644 --- a/tests/integration/replicated_atomizer_integration_tests.cpp +++ b/tests/integration/replicated_atomizer_integration_tests.cpp @@ -161,7 +161,7 @@ TEST_F(replicated_atomizer_integration_tests, raftnode_crash_recover) { for(; !m_cluster.connected_to_one(); ++intv) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); } - std::cout << std::endl; + std::cout << '\n'; m_logger->info("DONE: atomizer raft cluster has reconnected with new" " leader (after ~", 100 * intv, diff --git a/tests/unit/archiver_test.cpp b/tests/unit/archiver_test.cpp index 86c10eae5..eb06a3383 100644 --- a/tests/unit/archiver_test.cpp +++ b/tests/unit/archiver_test.cpp @@ -70,8 +70,8 @@ class ArchiverTest : public ::testing::Test { std::vector m_dummy_blocks; cbdc::config::options m_config_opts{}; - std::shared_ptr m_log{}; - std::unique_ptr m_archiver{}; + std::shared_ptr m_log; + std::unique_ptr m_archiver; }; TEST_F(ArchiverTest, archiver_running) { diff --git a/tests/unit/atomizer/messages_test.cpp b/tests/unit/atomizer/messages_test.cpp index cce69ccbc..826f62db7 100644 --- a/tests/unit/atomizer/messages_test.cpp +++ b/tests/unit/atomizer/messages_test.cpp @@ -9,7 +9,7 @@ class atomizer_messages_test : public ::testing::Test { protected: - cbdc::buffer m_target_packet{}; + cbdc::buffer m_target_packet; cbdc::buffer_serializer m_ser{m_target_packet}; cbdc::buffer_serializer m_deser{m_target_packet}; }; diff --git a/tests/unit/coordinator/messages_test.cpp b/tests/unit/coordinator/messages_test.cpp index de7897f6a..2481a6654 100644 --- a/tests/unit/coordinator/messages_test.cpp +++ b/tests/unit/coordinator/messages_test.cpp @@ -13,7 +13,7 @@ class coordinator_messages_test : public ::testing::Test { protected: - cbdc::buffer m_target_packet{}; + cbdc::buffer m_target_packet; cbdc::buffer_serializer m_ser{m_target_packet}; cbdc::buffer_serializer m_deser{m_target_packet}; diff --git a/tests/unit/locking_shard/format_test.cpp b/tests/unit/locking_shard/format_test.cpp index b24fb5425..1680328f2 100644 --- a/tests/unit/locking_shard/format_test.cpp +++ b/tests/unit/locking_shard/format_test.cpp @@ -10,7 +10,7 @@ class locking_shard_format_test : public ::testing::Test { protected: - cbdc::buffer m_target_packet{}; + cbdc::buffer m_target_packet; cbdc::buffer_serializer m_ser{m_target_packet}; cbdc::buffer_serializer m_deser{m_target_packet}; diff --git a/tests/unit/raft_test.cpp b/tests/unit/raft_test.cpp index 0ffa52574..28cb24f4e 100644 --- a/tests/unit/raft_test.cpp +++ b/tests/unit/raft_test.cpp @@ -70,7 +70,7 @@ class dummy_sm : public nuraft::state_machine { private: uint64_t m_last_commit_index = 0; - nuraft::ptr m_snapshot{}; + nuraft::ptr m_snapshot; }; class raft_test : public ::testing::Test { @@ -322,8 +322,8 @@ class raft_test : public ::testing::Test { static constexpr const auto m_endpoint = "endpoint"; std::vector> m_dummy_log_entries; static constexpr const auto m_log_file = "log_file"; - nuraft::raft_params m_raft_params{}; - std::vector m_raft_endpoints{}; + nuraft::raft_params m_raft_params; + std::vector m_raft_endpoints; }; TEST_F(raft_test, test_init) { diff --git a/tests/unit/sentinel_2pc/controller_test.cpp b/tests/unit/sentinel_2pc/controller_test.cpp index 4a35b6bf5..8d97356fe 100644 --- a/tests/unit/sentinel_2pc/controller_test.cpp +++ b/tests/unit/sentinel_2pc/controller_test.cpp @@ -97,7 +97,7 @@ class sentinel_2pc_test : public ::testing::Test { std::optional m_dummy_coordinator_thread; cbdc::config::options m_opts{}; std::unique_ptr m_ctl; - cbdc::transaction::full_tx m_valid_tx{}; + cbdc::transaction::full_tx m_valid_tx; std::shared_ptr m_logger; }; diff --git a/tests/unit/serialization/stream_serializer_test.cpp b/tests/unit/serialization/stream_serializer_test.cpp index 25bedbeba..758880184 100644 --- a/tests/unit/serialization/stream_serializer_test.cpp +++ b/tests/unit/serialization/stream_serializer_test.cpp @@ -23,8 +23,8 @@ class stream_serializer_test : public ::testing::Test { std::filesystem::remove_all(m_test_file); } - std::ifstream m_if{}; - std::ofstream m_of{}; + std::ifstream m_if; + std::ofstream m_of; cbdc::istream_serializer m_is{m_if}; cbdc::ostream_serializer m_os{m_of}; diff --git a/tests/unit/validation_test.cpp b/tests/unit/validation_test.cpp index df5655726..7c681a9f7 100644 --- a/tests/unit/validation_test.cpp +++ b/tests/unit/validation_test.cpp @@ -26,8 +26,8 @@ class WalletTxValidationTest : public ::testing::Test { = wallet1.send_to(200, wallet2.generate_key(), true).value(); } - cbdc::transaction::full_tx m_valid_tx{}; - cbdc::transaction::full_tx m_valid_tx_multi_inp{}; + cbdc::transaction::full_tx m_valid_tx; + cbdc::transaction::full_tx m_valid_tx_multi_inp; std::unique_ptr m_secp{secp256k1_context_create(SECP256K1_CONTEXT_SIGN diff --git a/tests/unit/wallet_test.cpp b/tests/unit/wallet_test.cpp index a1ff2c7b6..0334c9430 100644 --- a/tests/unit/wallet_test.cpp +++ b/tests/unit/wallet_test.cpp @@ -20,7 +20,7 @@ class WalletTest : public ::testing::Test { std::filesystem::remove(m_wallet_file); } - cbdc::transaction::wallet m_wallet{}; + cbdc::transaction::wallet m_wallet; static constexpr auto m_wallet_file = "test_wallet.dat"; }; @@ -104,8 +104,8 @@ class WalletTxTest : public ::testing::Test { m_sender.confirm_transaction(mint_tx); } - cbdc::transaction::wallet m_sender{}; - cbdc::transaction::wallet m_receiver{}; + cbdc::transaction::wallet m_sender; + cbdc::transaction::wallet m_receiver; }; TEST_F(WalletTxTest, basic) { @@ -126,7 +126,7 @@ class WalletMultiTxTest : public ::testing::Test { m_sender.confirm_transaction(mint_tx); } - cbdc::transaction::wallet m_sender{}; + cbdc::transaction::wallet m_sender; }; TEST_F(WalletMultiTxTest, inp_out_count) { diff --git a/tools/bench/atomizer-cli-watchtower.cpp b/tools/bench/atomizer-cli-watchtower.cpp index 38bdc6536..2e9e30970 100644 --- a/tools/bench/atomizer-cli-watchtower.cpp +++ b/tools/bench/atomizer-cli-watchtower.cpp @@ -41,14 +41,14 @@ auto main(int argc, char** argv) -> int { std::cerr << "Usage: " << args[0] << " " "[]" - << std::endl; + << '\n'; return 0; } auto cfg_or_err = cbdc::config::load_options(args[1]); if(std::holds_alternative(cfg_or_err)) { std::cerr << "Error loading config file: " - << std::get(cfg_or_err) << std::endl; + << std::get(cfg_or_err) << '\n'; return -1; } auto cfg = std::get(cfg_or_err); diff --git a/tools/bench/twophase_gen.cpp b/tools/bench/twophase_gen.cpp index 0b86eb518..8e8668fe5 100644 --- a/tools/bench/twophase_gen.cpp +++ b/tools/bench/twophase_gen.cpp @@ -21,14 +21,14 @@ auto main(int argc, char** argv) -> int { auto args = cbdc::config::get_args(argc, argv); if(args.size() < 3) { std::cerr << "Usage: " << args[0] << " " - << std::endl; + << '\n'; return -1; } auto cfg_or_err = cbdc::config::load_options(args[1]); if(std::holds_alternative(cfg_or_err)) { std::cerr << "Error loading config file: " - << std::get(cfg_or_err) << std::endl; + << std::get(cfg_or_err) << '\n'; return -1; } auto cfg = std::get(cfg_or_err); diff --git a/tools/shard-seeder/shard-seeder.cpp b/tools/shard-seeder/shard-seeder.cpp index c2fba0c26..89c5bbb40 100644 --- a/tools/shard-seeder/shard-seeder.cpp +++ b/tools/shard-seeder/shard-seeder.cpp @@ -36,7 +36,7 @@ auto main(int argc, char** argv) -> int { auto logger = cbdc::logging::log(cbdc::logging::log_level::info); static constexpr auto min_arg_count = 2; if(args.size() < min_arg_count) { - std::cout << "Usage: shard-seeder [config file]" << std::endl; + std::cout << "Usage: shard-seeder [config file]" << '\n'; return -1; }