Skip to content

Commit

Permalink
Add doc comments for public methods
Browse files Browse the repository at this point in the history
Adds doc comments to evm_bench and tools/bench/3pc/evm/rpc_client.
Also addresses lack of doc comments in host.hpp by pointing upstream.

Signed-off-by: Michael Maurer <[email protected]>
  • Loading branch information
maurermi committed Jun 8, 2023
1 parent 708c78c commit 9a123e4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/3pc/agent/runners/evm/host.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ namespace cbdc::threepc::agent::runner {
/// database. Manages the cached state during contract execution to support
/// committing the final state updates or reverting while still charging
/// gas.
/// Undocumented functions below are inhereted from evmc::Host and are
/// documented upstream.
class evm_host : public evmc::Host {
public:
/// Constructs a new host instance.
Expand Down
14 changes: 14 additions & 0 deletions tools/bench/3pc/evm/evm_bench.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,37 @@
#include <secp256k1.h>

class evm_bench {
/// This class is used for bench testing the evm runner.
public:
evm_bench(size_t loadgen_id,
size_t mint_tree_depth,
cbdc::threepc::config cfg,
std::shared_ptr<cbdc::logging::log> log,
std::shared_ptr<geth_client> client);

/// Mint accounts in the tree to the given depth
/// \param depth depth of accounts into the tree to mint
void mint_tree(size_t depth);

/// Send transaction bytecode with callback corresponding
/// to a native transfer or ERC-20 deployment and transfer.
void deploy();

/// Schedule a value 1 transacton to be sent
/// from `from` to `to`.
/// \param from ID to send transaction from
/// \param to ID to send transaction to
void schedule_tx(size_t from, size_t to);

/// Set m_running to false.
void stop();

/// Return false if error encountered, not running or done without
/// success. Return true if done successfully or no tx in flight
/// without error. Otherwise call m_client->pump().
auto pump() -> std::optional<bool>;

/// Return the number of accounts.
auto account_count() const -> size_t;

private:
Expand Down
8 changes: 8 additions & 0 deletions tools/bench/3pc/evm/rpc_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,17 @@ class geth_client : public cbdc::rpc::json_rpc_http_client {
static constexpr auto error_key = "error";
static constexpr auto result_key = "result";

/// Calls eth_sendRawTransaction with the given transaction and
/// callback function.
/// \param tx transaction bytecode
/// \param cb callback function passed to call()
void send_transaction(const std::string& tx,
std::function<void(std::optional<std::string>)> cb);

/// Calls eth_getTransactionCount for the given address, with
/// the given callback function.
/// \param addr the address to find the count of transactions from
/// \param cb callback function passed to call()
void get_transaction_count(
const std::string& addr,
std::function<void(std::optional<evmc::uint256be>)> cb);
Expand Down

0 comments on commit 9a123e4

Please sign in to comment.