Skip to content

Commit ce7e857

Browse files
committed
Linting fixes
Signed-off-by: Michael Maurer <[email protected]>
1 parent 77a5338 commit ce7e857

File tree

10 files changed

+59
-50
lines changed

10 files changed

+59
-50
lines changed

src/3pc/agent/client.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ namespace cbdc::threepc::agent::rpc {
2222
bool is_readonly_run,
2323
const interface::exec_callback_type& result_callback)
2424
-> bool {
25-
auto req = request{std::move(function), std::move(param), is_readonly_run};
25+
auto req
26+
= request{std::move(function), std::move(param), is_readonly_run};
2627
return m_client->call(std::move(req),
2728
[result_callback](std::optional<response> resp) {
2829
assert(resp.has_value());

src/3pc/agent/impl.cpp

+11-9
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace cbdc::threepc::agent {
3030
m_runner_factory(std::move(runner_factory)),
3131
m_broker(std::move(broker)),
3232
m_initial_lock_type(is_readonly_run ? broker::lock_type::read
33-
: initial_lock_type),
33+
: initial_lock_type),
3434
m_is_readonly_run(is_readonly_run),
3535
m_secp(std::move(secp)),
3636
m_threads(std::move(t_pool)) {}
@@ -140,7 +140,7 @@ namespace cbdc::threepc::agent {
140140
m_state = state::function_get_sent;
141141

142142
if(m_is_readonly_run && get_function().size() == 0) {
143-
// If this is a dry-run and the function key is empty, the
143+
// If this is a read-only run and the function key is empty, the
144144
// runner will handle retrieving any keys directly.
145145
handle_function(broker::value_type());
146146
} else if(get_function().size() == 1) {
@@ -191,10 +191,11 @@ namespace cbdc::threepc::agent {
191191
res_cb(std::move(res));
192192
}
193193

194-
auto impl::do_try_lock_request(
195-
broker::key_type key,
196-
broker::lock_type locktype,
197-
broker::interface::try_lock_callback_type res_cb) -> bool {
194+
auto
195+
impl::do_try_lock_request(broker::key_type key,
196+
broker::lock_type locktype,
197+
broker::interface::try_lock_callback_type res_cb)
198+
-> bool {
198199
// TODO: permissions for keys
199200
std::unique_lock l(m_mut);
200201
assert(m_ticket_number.has_value());
@@ -227,7 +228,8 @@ namespace cbdc::threepc::agent {
227228
return true;
228229
}
229230

230-
auto actual_lock_type = m_is_readonly_run ? broker::lock_type::read : locktype;
231+
auto actual_lock_type
232+
= m_is_readonly_run ? broker::lock_type::read : locktype;
231233
return m_broker->try_lock(
232234
m_ticket_number.value(),
233235
std::move(key),
@@ -336,8 +338,8 @@ namespace cbdc::threepc::agent {
336338
broker::lock_type locktype,
337339
broker::interface::try_lock_callback_type res_cb) -> bool {
338340
return do_try_lock_request(std::move(key),
339-
locktype,
340-
std::move(res_cb));
341+
locktype,
342+
std::move(res_cb));
341343
},
342344
m_secp,
343345
m_restarted ? nullptr : m_threads,

src/3pc/agent/impl.hpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,11 @@ namespace cbdc::threepc::agent {
145145

146146
void do_commit();
147147

148-
[[nodiscard]] auto do_try_lock_request(
149-
broker::key_type key,
150-
broker::lock_type locktype,
151-
broker::interface::try_lock_callback_type res_cb) -> bool;
148+
[[nodiscard]] auto
149+
do_try_lock_request(broker::key_type key,
150+
broker::lock_type locktype,
151+
broker::interface::try_lock_callback_type res_cb)
152+
-> bool;
152153

153154
void
154155
handle_rollback(broker::interface::rollback_return_type rollback_res);

src/3pc/agent/runners/evm/host.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ namespace cbdc::threepc::agent::runner {
122122
}
123123
auto& acc = maybe_acc.value();
124124

125-
auto maybe_storage = get_account_storage(addr, key, !m_is_readonly_run);
125+
auto maybe_storage
126+
= get_account_storage(addr, key, !m_is_readonly_run);
126127
auto prev_value = maybe_storage.value_or(evmc::bytes32{});
127128

128129
auto modified = acc.m_modified.find(key) != acc.m_modified.end();

src/3pc/agent/runners/evm/host.hpp

+25-25
Original file line numberDiff line numberDiff line change
@@ -36,58 +36,58 @@ namespace cbdc::threepc::agent::runner {
3636
bool is_readonly_run,
3737
interface::ticket_number_type ticket_number);
3838

39-
[[nodiscard]] bool
40-
account_exists(const evmc::address& addr) const noexcept override;
39+
[[nodiscard]] auto
40+
account_exists(const evmc::address& addr) const noexcept -> bool override;
4141

42-
[[nodiscard]] evmc::bytes32
42+
[[nodiscard]] auto
4343
get_storage(const evmc::address& addr,
44-
const evmc::bytes32& key) const noexcept override final;
44+
const evmc::bytes32& key) const noexcept -> evmc::bytes32 final;
4545

46-
evmc_storage_status
46+
auto
4747
set_storage(const evmc::address& addr,
4848
const evmc::bytes32& key,
49-
const evmc::bytes32& value) noexcept override final;
49+
const evmc::bytes32& value) noexcept -> evmc_storage_status final;
5050

51-
[[nodiscard]] evmc::uint256be
52-
get_balance(const evmc::address& addr) const noexcept override final;
51+
[[nodiscard]] auto
52+
get_balance(const evmc::address& addr) const noexcept -> evmc::uint256be final;
5353

54-
[[nodiscard]] size_t
55-
get_code_size(const evmc::address& addr) const noexcept override final;
54+
[[nodiscard]] auto
55+
get_code_size(const evmc::address& addr) const noexcept -> size_t final;
5656

57-
[[nodiscard]] evmc::bytes32
58-
get_code_hash(const evmc::address& addr) const noexcept override final;
57+
[[nodiscard]] auto
58+
get_code_hash(const evmc::address& addr) const noexcept -> evmc::bytes32 final;
5959

60-
size_t copy_code(const evmc::address& addr,
60+
auto copy_code(const evmc::address& addr,
6161
size_t code_offset,
6262
uint8_t* buffer_data,
63-
size_t buffer_size) const noexcept override final;
63+
size_t buffer_size) const noexcept -> size_t final;
6464

6565
void
6666
selfdestruct(const evmc::address& addr,
67-
const evmc::address& beneficiary) noexcept override final;
67+
const evmc::address& beneficiary) noexcept final;
6868

69-
evmc::result call(const evmc_message& msg) noexcept override final;
69+
auto call(const evmc_message& msg) noexcept -> evmc::result final;
7070

71-
[[nodiscard]] evmc_tx_context
72-
get_tx_context() const noexcept override final;
71+
[[nodiscard]] auto
72+
get_tx_context() const noexcept -> evmc_tx_context final;
7373

74-
[[nodiscard]] evmc::bytes32
75-
get_block_hash(int64_t number) const noexcept override final;
74+
[[nodiscard]] auto
75+
get_block_hash(int64_t number) const noexcept -> evmc::bytes32 final;
7676

7777
void emit_log(
7878
const evmc::address& addr,
7979
const uint8_t* data,
8080
size_t data_size,
8181
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)
8282
const evmc::bytes32 topics[],
83-
size_t topics_count) noexcept override final;
83+
size_t topics_count) noexcept final;
8484

85-
evmc_access_status
86-
access_account(const evmc::address& addr) noexcept override final;
85+
auto
86+
access_account(const evmc::address& addr) noexcept -> evmc_access_status final;
8787

88-
evmc_access_status
88+
auto
8989
access_storage(const evmc::address& addr,
90-
const evmc::bytes32& key) noexcept override final;
90+
const evmc::bytes32& key) noexcept -> evmc_access_status final;
9191

9292
using indexed_logs_type
9393
= std::unordered_map<evmc::address, std::vector<evm_log>>;

src/3pc/agent/runners/evm/http_server.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ namespace cbdc::threepc::agent::rpc {
4848
const std::string& method,
4949
const Json::Value& params,
5050
const server_type::result_callback_type& callback) -> bool {
51-
m_log->trace("http_server::request_handler() received request", method);
51+
m_log->trace("http_server::request_handler() received request",
52+
method);
5253

5354
auto maybe_handled = handle_supported(method, params, callback);
5455
if(maybe_handled.has_value()) {

src/3pc/agent/runners/evm/impl.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,9 @@ namespace cbdc::threepc::agent::runner {
453453
min_gas = min_gas + creation_gas;
454454
}
455455

456-
return std::make_pair(min_gas,
457-
!(evmtx.m_gas_limit < min_gas && !is_readonly_run));
456+
return std::make_pair(
457+
min_gas,
458+
!(evmtx.m_gas_limit < min_gas && !is_readonly_run));
458459
}
459460

460461
auto evm_runner::make_message(const evmc::address& from,

src/3pc/agent/runners/evm/impl.hpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ namespace cbdc::threepc::agent::runner {
8888
auto run_get_account_code() -> bool;
8989
auto run_get_transaction() -> bool;
9090
auto run_get_transaction_receipt() -> bool;
91-
auto run_execute_transaction(const evmc::address& from, bool is_readonly_run)
92-
-> bool;
91+
auto run_execute_transaction(const evmc::address& from,
92+
bool is_readonly_run) -> bool;
9393
auto run_get_account() -> bool;
9494
auto run_get_block() -> bool;
9595
auto run_get_logs() -> bool;
@@ -101,8 +101,9 @@ namespace cbdc::threepc::agent::runner {
101101
const evm_tx& tx,
102102
bool is_readonly_run)
103103
-> evmc_tx_context;
104-
static auto
105-
make_message(const evmc::address& from, const evm_tx& tx, bool is_readonly_run)
104+
static auto make_message(const evmc::address& from,
105+
const evm_tx& tx,
106+
bool is_readonly_run)
106107
-> std::pair<evmc_message, bool>;
107108

108109
void handle_lock_from_account(

src/3pc/agent/runners/interface.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ namespace cbdc::threepc::agent::runner {
1919
// type alias for function bytecode
2020
using bytecode_type = cbdc::buffer;
2121

22-
2322
/// Interface for a contract runner. Subclasses should implement
2423
/// application logic to enforce specific transaction semantics.
2524
class interface {

src/3pc/broker/interface.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ namespace cbdc::threepc::broker {
8181

8282
/// Return type from a begin operation. Either a new ticket number or
8383
/// an error code.
84-
using ticketnum_or_errcode_type = std::variant<ticket_number_type, error_code>;
84+
using ticketnum_or_errcode_type
85+
= std::variant<ticket_number_type, error_code>;
8586
/// Callback function type for a begin operation.
86-
using begin_callback_type = std::function<void(ticketnum_or_errcode_type)>;
87+
using begin_callback_type
88+
= std::function<void(ticketnum_or_errcode_type)>;
8789

8890
/// Acquires a new ticket number to begin a transaction.
8991
/// \param result_callback function to call with begin result.

0 commit comments

Comments
 (0)