From 0c3127462136c7d4bd53d89ab0284cb14ca75fec Mon Sep 17 00:00:00 2001 From: Morgan Rockett Date: Thu, 27 Jun 2024 00:39:59 -0400 Subject: [PATCH] chore: fixing lint issues in support of C++ 20 Signed-off-by: Morgan Rockett --- .gitignore | 2 +- src/parsec/agent/impl.hpp | 2 +- src/parsec/agent/runners/evm/messages.hpp | 48 +++++++++--------- src/parsec/agent/runners/evm/rlp.hpp | 4 +- src/parsec/agent/server_interface.hpp | 2 +- src/parsec/runtime_locking_shard/impl.hpp | 2 +- src/parsec/ticket_machine/impl.hpp | 2 +- src/parsec/ticket_machine/state_machine.hpp | 2 +- src/uhs/atomizer/archiver/controller.cpp | 2 +- src/uhs/atomizer/atomizer/atomizer-raftd.cpp | 6 +-- src/uhs/atomizer/atomizer/controller.cpp | 2 +- src/uhs/atomizer/atomizer/state_machine.hpp | 4 +- src/uhs/atomizer/sentinel/controller.hpp | 9 ++-- src/uhs/atomizer/sentinel/sentineld.cpp | 6 +-- src/uhs/atomizer/shard/shardd.cpp | 6 +-- src/uhs/atomizer/watchtower/watchtowerd.cpp | 4 +- src/uhs/client/client-cli.cpp | 50 +++++++++---------- src/uhs/client/client.cpp | 4 +- src/uhs/client/client.hpp | 2 +- src/uhs/transaction/transaction.hpp | 6 +-- src/uhs/twophase/coordinator/controller.cpp | 8 +-- src/uhs/twophase/coordinator/controller.hpp | 12 ++--- src/uhs/twophase/coordinator/coordinatord.cpp | 8 +-- .../twophase/coordinator/state_machine.hpp | 6 +-- src/uhs/twophase/locking_shard/controller.cpp | 2 +- .../twophase/locking_shard/locking_shardd.cpp | 8 +-- src/uhs/twophase/locking_shard/messages.hpp | 2 +- .../twophase/locking_shard/state_machine.hpp | 16 +++--- src/uhs/twophase/sentinel_2pc/controller.hpp | 7 ++- .../twophase/sentinel_2pc/sentineld_2pc.cpp | 6 +-- src/util/common/buffer.hpp | 2 +- src/util/common/logging.hpp | 2 +- src/util/network/socket_selector.cpp | 2 +- src/util/network/tcp_socket.hpp | 2 +- src/util/raft/log_store.hpp | 4 +- src/util/rpc/client.hpp | 2 +- src/util/rpc/http/json_rpc_http_server.hpp | 2 +- .../integration/gtest_evm_jsonrpc_client.cpp | 2 +- .../replicated_atomizer_integration_tests.cpp | 2 +- tests/unit/archiver_test.cpp | 4 +- tests/unit/atomizer/messages_test.cpp | 2 +- tests/unit/atomizer_test.cpp | 2 +- tests/unit/coordinator/messages_test.cpp | 2 +- tests/unit/locking_shard/format_test.cpp | 2 +- tests/unit/raft_test.cpp | 6 +-- tests/unit/sentinel_2pc/controller_test.cpp | 2 +- .../serialization/stream_serializer_test.cpp | 4 +- tests/unit/validation_test.cpp | 4 +- tests/unit/wallet_test.cpp | 8 +-- tools/bench/atomizer-cli-watchtower.cpp | 4 +- tools/bench/twophase_gen.cpp | 5 +- tools/shard-seeder/shard-seeder.cpp | 2 +- 52 files changed, 150 insertions(+), 157 deletions(-) diff --git a/.gitignore b/.gitignore index e76ac3e60..8f0a266ff 100644 --- a/.gitignore +++ b/.gitignore @@ -49,12 +49,12 @@ CMakeFiles/ plots/ .deps/ .libs/ +.cache/ # Database blocks.dat test_db - # System files .DS_Store .dirstamp diff --git a/src/parsec/agent/impl.hpp b/src/parsec/agent/impl.hpp index 00c9a9c02..6b625c3bd 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/messages.hpp b/src/parsec/agent/runners/evm/messages.hpp index 508c1ac54..f7c80c74a 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,30 +67,30 @@ 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; }; /// Dry-run EVM transaction type. struct evm_dryrun_tx { - /// From address. + /// From address.k evmc::address m_from; /// EVM transaction to dry-run. evm_tx m_tx; @@ -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/rlp.hpp b/src/parsec/agent/runners/evm/rlp.hpp index 67bbe5ffb..cbb22dd77 100644 --- a/src/parsec/agent/runners/evm/rlp.hpp +++ b/src/parsec/agent/runners/evm/rlp.hpp @@ -111,8 +111,8 @@ namespace cbdc { void read_buffer_from(serializer& ser, size_t size); void read_array_from(serializer& ser, size_t size); - buffer m_buffer{}; - std::vector m_values{}; + buffer m_buffer; + std::vector m_values; rlp_value_type m_type{}; }; 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/runtime_locking_shard/impl.hpp b/src/parsec/runtime_locking_shard/impl.hpp index f865b23a8..f1037812f 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/controller.cpp b/src/uhs/atomizer/archiver/controller.cpp index 7fc850cbd..6bc082258 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++; } 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 95a53c982..a0d616c08 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.hpp b/src/uhs/atomizer/sentinel/controller.hpp index 483433cfa..97d617e11 100644 --- a/src/uhs/atomizer/sentinel/controller.hpp +++ b/src/uhs/atomizer/sentinel/controller.hpp @@ -72,13 +72,12 @@ namespace cbdc::sentinel { m_secp{secp256k1_context_create(SECP256K1_CONTEXT_SIGN), &secp256k1_context_destroy}; - std::vector> - m_sentinel_clients{}; + std::vector> 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 be6839dc5..1b24b7749 100644 --- a/src/uhs/client/client-cli.cpp +++ b/src/uhs/client/client-cli.cpp @@ -20,8 +20,7 @@ auto mint_command(cbdc::client& client, const std::vector& args) -> bool { static constexpr auto min_mint_arg_count = 7; if(args.size() < min_mint_arg_count) { - std::cerr << "Mint requires args " - << std::endl; + std::cerr << "Mint requires args " << '\n'; return false; } @@ -30,8 +29,7 @@ auto mint_command(cbdc::client& client, 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; + std::cout << cbdc::to_string(cbdc::transaction::tx_id(mint_tx)) << '\n'; return true; } @@ -39,25 +37,24 @@ void print_tx_result( const std::optional& tx, const std::optional& resp, const cbdc::hash_t& pubkey) { - std::cout << "tx_id:" << std::endl - << cbdc::to_string(cbdc::transaction::tx_id(tx.value())) - << std::endl; + std::cout << "tx_id:" << '\n' + << cbdc::to_string(cbdc::transaction::tx_id(tx.value())) << '\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 +63,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 +71,14 @@ auto send_command(cbdc::client& client, 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 +90,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 +100,7 @@ auto fan_command(cbdc::client& client, 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 +108,7 @@ auto fan_command(cbdc::client& client, 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 +135,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 +143,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 +161,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 +177,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; } @@ -240,8 +237,7 @@ auto main(int argc, char** argv) -> int { const auto n_txos = client->utxo_count(); std::cout << "Balance: " << cbdc::client::print_amount(balance) << ", UTXOs: " << n_txos - << ", pending TXs: " << client->pending_tx_count() - << std::endl; + << ", pending TXs: " << client->pending_tx_count() << '\n'; } else if(command == "importinput") { if(!importinput_command(*client, args)) { return -1; @@ -251,7 +247,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 868e0b321..005bd5eee 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 a4982911d..3179bc9f7 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 7c96fbced..abbcb319f 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 3e976c0f7..a6096eb91 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; } @@ -167,13 +167,13 @@ namespace cbdc::coordinator { auto controller::discard_cb(const hash_t& dtx_id) -> bool { // Send the discard status for this dtx ID and check if it replicated. - auto comm = sm_command{{state_machine::command::discard, dtx_id}}; + auto comm = sm_command{{state_machine::command::discard, dtx_id}, {}}; return replicate_sm_command(comm).has_value(); } auto controller::done_cb(const hash_t& dtx_id) -> bool { // Send the done status for this dtx ID and check if it replicated. - auto comm = sm_command{{state_machine::command::done, dtx_id}}; + auto comm = sm_command{{state_machine::command::done, dtx_id}, {}}; return replicate_sm_command(comm).has_value(); } @@ -217,7 +217,7 @@ namespace cbdc::coordinator { auto controller::recovery_func() -> bool { // Grab any non-completed dtxs from the state machine that were not // done when the previous leader failed. - auto comm = sm_command{{state_machine::command::get}}; + auto comm = sm_command{{state_machine::command::get, hash_t()}, {}}; m_logger->info("Waiting for get SM command response"); auto r = replicate_sm_command(comm); if(!r) { diff --git a/src/uhs/twophase/coordinator/controller.hpp b/src/uhs/twophase/coordinator/controller.hpp index 77e5d196a..1622637b5 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 dabe18daf..5edf88c57 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.hpp b/src/uhs/twophase/sentinel_2pc/controller.hpp index ecd3e99a8..14901d947 100644 --- a/src/uhs/twophase/sentinel_2pc/controller.hpp +++ b/src/uhs/twophase/sentinel_2pc/controller.hpp @@ -97,12 +97,11 @@ namespace cbdc::sentinel_2pc { coordinator::rpc::client m_coordinator_client; - std::vector> - m_sentinel_clients{}; + std::vector> 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.hpp b/src/util/common/buffer.hpp index b9d8cae5c..5a3ccfc8c 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/raft/log_store.hpp b/src/util/raft/log_store.hpp index da0569981..e1931549a 100644 --- a/src/util/raft/log_store.hpp +++ b/src/util/raft/log_store.hpp @@ -104,8 +104,8 @@ namespace cbdc::raft { auto flush() -> bool override; private: - std::unique_ptr m_db{}; - mutable std::mutex m_db_mut{}; + std::unique_ptr m_db; + mutable std::mutex m_db_mut; uint64_t m_next_idx{}; uint64_t m_start_idx{}; diff --git a/src/util/rpc/client.hpp b/src/util/rpc/client.hpp index fb2c8249e..d4acdc377 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 7812e15a5..30d3e7fd4 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/tests/integration/gtest_evm_jsonrpc_client.cpp b/tests/integration/gtest_evm_jsonrpc_client.cpp index 9e5a01d60..e8ace614f 100644 --- a/tests/integration/gtest_evm_jsonrpc_client.cpp +++ b/tests/integration/gtest_evm_jsonrpc_client.cpp @@ -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.length()); 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/atomizer_test.cpp b/tests/unit/atomizer_test.cpp index 5eaf95976..2df7e2b72 100644 --- a/tests/unit/atomizer_test.cpp +++ b/tests/unit/atomizer_test.cpp @@ -27,7 +27,7 @@ class atomizer_test : public ::testing::Test { ASSERT_EQ(*m_atomizer, *new_atomizer); } - std::unique_ptr m_atomizer{}; + std::unique_ptr m_atomizer; }; TEST_F(atomizer_test, test_empty) { 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..19d021e7d 100644 --- a/tools/bench/twophase_gen.cpp +++ b/tools/bench/twophase_gen.cpp @@ -20,15 +20,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; + std::cerr << "Usage: " << args[0] << " \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; }