Skip to content

Commit

Permalink
ci: update ubuntu version from 20.04 to 22.04+ in gh workflows; fixes #…
Browse files Browse the repository at this point in the history
…266

Signed-off-by: Morgan Rockett <[email protected]>
  • Loading branch information
rockett-m committed Jul 24, 2024
1 parent a055e7f commit b1396e7
Show file tree
Hide file tree
Showing 59 changed files with 164 additions and 163 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ CMakeFiles/
plots/
.deps/
.libs/
.cache/

# Database
blocks.dat
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
2 changes: 1 addition & 1 deletion src/parsec/agent/runners/evm/impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
46 changes: 23 additions & 23 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,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<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;
};
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/serialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ namespace cbdc::parsec::agent::runner {
auto maybe_addr = cbdc::from_buffer<evmc::address>(
maybe_addr_buf.value());
if(maybe_addr) {
return maybe_addr.value();
return maybe_addr;
}
}
}
Expand All @@ -249,7 +249,7 @@ namespace cbdc::parsec::agent::runner {
auto maybe_val
= cbdc::from_buffer<evmc::uint256be>(maybe_val_buf.value());
if(maybe_val) {
return maybe_val.value();
return maybe_val;
}
}
return std::nullopt;
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
18 changes: 9 additions & 9 deletions src/parsec/broker/impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ namespace cbdc::parsec::broker {

if(!m_directory->key_location(
key,
[=, this](std::optional<parsec::directory::interface::
[ticket_number, key, locktype, result_callback, this](std::optional<parsec::directory::interface::
key_location_return_type> res) {
handle_find_key(ticket_number,
key,
Expand Down Expand Up @@ -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);
})) {
Expand Down Expand Up @@ -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,
Expand All @@ -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);
}
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand All @@ -972,7 +972,7 @@ namespace cbdc::parsec::broker {

auto impl::do_recovery(const recover_callback_type& result_callback)
-> std::optional<error_code> {
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) {
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
6 changes: 3 additions & 3 deletions src/uhs/atomizer/archiver/archiverd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ auto main(int argc, char** argv) -> int {
if(args.size() < 3) {
std::cerr << "Usage: " << args[0]
<< " <config file> <archiver id> [<max samples>]"
<< std::endl;
<< '\n';
return 0;
}

Expand All @@ -28,15 +28,15 @@ 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);

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;
}

Expand Down
4 changes: 2 additions & 2 deletions 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 Expand Up @@ -280,7 +280,7 @@ namespace cbdc::archiver {
auto blk = from_buffer<atomizer::block>(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) {
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
2 changes: 1 addition & 1 deletion src/uhs/atomizer/sentinel/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit b1396e7

Please sign in to comment.