Skip to content

Commit

Permalink
chore: fixing lint issues in support of C++ 20
Browse files Browse the repository at this point in the history
Signed-off-by: Morgan Rockett <[email protected]>
  • Loading branch information
rockett-m committed Jun 27, 2024
1 parent aa151ed commit bd26cb0
Show file tree
Hide file tree
Showing 55 changed files with 162 additions and 168 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ CMakeFiles/
plots/
.deps/
.libs/
.cache/

# Database
blocks.dat
test_db


# System files
.DS_Store
.dirstamp
Expand Down
2 changes: 1 addition & 1 deletion src/parsec/agent/impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ namespace cbdc::parsec::agent {
std::shared_ptr<thread_pool> m_threads;
std::optional<hash_t> 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);
Expand Down
48 changes: 24 additions & 24 deletions src/parsec/agent/runners/evm/messages.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<evmc::bytes32> m_modified{};
std::set<evmc::bytes32> m_modified;
/// Flag set if the account is being destructed.
bool m_destruct{false};
};
Expand All @@ -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<evmc::bytes32> m_storage_keys{};
evmc::address m_address;
std::vector<evmc::bytes32> 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;
Expand All @@ -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<evmc::address> m_to{};
std::optional<evmc::address> 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<uint8_t> m_input{};
std::vector<uint8_t> 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;
Expand All @@ -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<uint8_t> m_data{};
std::vector<uint8_t> m_data;
/// List of log topics.
std::vector<evmc::bytes32> m_topics{};
std::vector<evmc::bytes32> m_topics;
};

/// EVM transaction receipt type.
Expand All @@ -113,11 +113,11 @@ namespace cbdc::parsec::agent::runner {
/// Created contract address, if applicable.
std::optional<evmc::address> 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<evm_log> m_logs{};
std::vector<evm_log> m_logs;
/// EVM output data.
std::vector<uint8_t> m_output_data{};
std::vector<uint8_t> m_output_data;
/// Ticket number that ran this TX - needed to map
/// to pretend blocks
cbdc::parsec::agent::runner::interface::ticket_number_type
Expand All @@ -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<evm_tx_receipt> m_transactions{};
std::vector<evm_tx_receipt> 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<evmc::address> m_addresses{};
std::vector<evmc::address> m_addresses;
/// The topics for which logs are queried
std::vector<evmc::bytes32> m_topics{};
std::vector<evmc::bytes32> m_topics;
/// The start of the block range to query logs for
cbdc::parsec::agent::runner::interface::ticket_number_type
m_from_block{};
Expand Down
4 changes: 2 additions & 2 deletions src/parsec/agent/runners/evm/rlp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<rlp_value> m_values{};
buffer m_buffer;
std::vector<rlp_value> m_values;
rlp_value_type m_type{};
};

Expand Down
2 changes: 1 addition & 1 deletion src/parsec/agent/server_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace cbdc::parsec::agent::rpc {
const cbdc::parsec::config& m_cfg;

mutable std::mutex m_agents_mut;
std::atomic<size_t> m_next_id{};
std::atomic<size_t> m_next_id;
std::unordered_map<size_t, std::shared_ptr<agent::impl>> m_agents;

blocking_queue<size_t> m_cleanup_queue;
Expand Down
2 changes: 1 addition & 1 deletion src/parsec/runtime_locking_shard/impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<wounded_details> m_wounded_details{};
std::optional<wounded_details> m_wounded_details;
};

struct pending_callback_element_type {
Expand Down
2 changes: 1 addition & 1 deletion src/parsec/ticket_machine/impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace cbdc::parsec::ticket_machine {

private:
std::shared_ptr<logging::log> m_log;
std::atomic<ticket_number_type> m_next_ticket_number{};
std::atomic<ticket_number_type> m_next_ticket_number;
ticket_number_type m_range;
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/parsec/ticket_machine/state_machine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace cbdc::parsec::ticket_machine {

std::atomic<uint64_t> m_last_committed_idx{0};

std::unique_ptr<impl> m_ticket_machine{};
std::unique_ptr<impl> m_ticket_machine;

std::shared_ptr<logging::log> m_logger;
};
Expand Down
2 changes: 1 addition & 1 deletion src/uhs/atomizer/archiver/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ namespace cbdc::archiver {
= static_cast<double>(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++;
}

Expand Down
6 changes: 3 additions & 3 deletions src/uhs/atomizer/atomizer/atomizer-raftd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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] << " <config file> <atomizer id>"
<< std::endl;
<< '\n';
return 0;
}

Expand All @@ -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<std::string>(cfg_or_err)) {
std::cerr << "Error loading config file: "
<< std::get<std::string>(cfg_or_err) << std::endl;
<< std::get<std::string>(cfg_or_err) << '\n';
return -1;
}
auto opts = std::get<cbdc::config::options>(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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/uhs/atomizer/atomizer/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t>(atomizer_id),
m_raft_node(atomizer_id,
opts.m_atomizer_raft_endpoints,
m_opts.m_stxo_cache_depth,
m_logger,
Expand Down
4 changes: 2 additions & 2 deletions src/uhs/atomizer/atomizer/state_machine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ namespace cbdc::atomizer {
/// Pointer to the atomizer instance.
std::shared_ptr<cbdc::atomizer::atomizer> m_atomizer;
/// Pointer to the nuraft snapshot metadata.
nuraft::ptr<nuraft::snapshot> m_snp{};
nuraft::ptr<nuraft::snapshot> m_snp;
/// Pointer to the state of the block cache.
std::shared_ptr<blockstore_t> m_blocks{};
std::shared_ptr<blockstore_t> m_blocks;
};

private:
Expand Down
9 changes: 4 additions & 5 deletions src/uhs/atomizer/sentinel/controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,12 @@ namespace cbdc::sentinel {
m_secp{secp256k1_context_create(SECP256K1_CONTEXT_SIGN),
&secp256k1_context_destroy};

std::vector<std::unique_ptr<sentinel::rpc::client>>
m_sentinel_clients{};
std::vector<std::unique_ptr<sentinel::rpc::client>> 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<size_t> m_dist{};
std::uniform_int_distribution<size_t> m_shard_dist{};
std::uniform_int_distribution<size_t> m_dist;
std::uniform_int_distribution<size_t> m_shard_dist;
std::mutex m_rand_mut;

privkey_t m_privkey{};
Expand Down
6 changes: 3 additions & 3 deletions src/uhs/atomizer/sentinel/sentineld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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] << " <config file> <sentinel id>"
<< std::endl;
<< '\n';
return -1;
}

Expand All @@ -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<std::string>(cfg_or_err)) {
std::cerr << "Error loading config file: "
<< std::get<std::string>(cfg_or_err) << std::endl;
<< std::get<std::string>(cfg_or_err) << '\n';
return -1;
}
auto opts = std::get<cbdc::config::options>(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;
}

Expand Down
6 changes: 3 additions & 3 deletions src/uhs/atomizer/shard/shardd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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] << " <config file> <shard id>"
<< std::endl;
<< '\n';
return 0;
}

Expand All @@ -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<std::string>(cfg_or_err)) {
std::cerr << "Error loading config file: "
<< std::get<std::string>(cfg_or_err) << std::endl;
<< std::get<std::string>(cfg_or_err) << '\n';
return -1;
}
auto opts = std::get<cbdc::config::options>(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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/uhs/atomizer/watchtower/watchtowerd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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] << " <config file> <watchtower ID>"
<< std::endl;
<< '\n';
return 0;
}

Expand All @@ -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<std::string>(cfg_or_err)) {
std::cerr << "Error loading config file: "
<< std::get<std::string>(cfg_or_err) << std::endl;
<< std::get<std::string>(cfg_or_err) << '\n';
return -1;
}
auto opts = std::get<cbdc::config::options>(cfg_or_err);
Expand Down
Loading

0 comments on commit bd26cb0

Please sign in to comment.