6#ifndef OPENCBDC_TX_SRC_PARSEC_AGENT_EVM_RUNNER_H_
7#define OPENCBDC_TX_SRC_PARSEC_AGENT_EVM_RUNNER_H_
50 evm_runner(std::shared_ptr<logging::log> logger,
57 std::shared_ptr<secp256k1_context> secp,
58 std::shared_ptr<thread_pool> t_pool,
73 [[nodiscard]]
auto run() ->
bool override;
80 std::vector<std::thread> m_evm_threads;
82 std::unique_ptr<evm_host> m_host;
87 auto run_execute_real_transaction() -> bool;
88 auto run_execute_dryrun_transaction() -> bool;
89 auto run_get_account_code() -> bool;
90 auto run_get_transaction() -> bool;
91 auto run_get_transaction_receipt() -> bool;
92 auto run_execute_transaction(
const evmc::address& from,
93 bool is_readonly_run) -> bool;
94 auto run_get_account() -> bool;
95 auto run_get_block() -> bool;
96 auto run_get_logs() -> bool;
97 auto run_get_block_number() -> bool;
98 [[nodiscard]]
static auto check_base_gas(
const evm_tx& tx,
100 -> std::pair<evmc::uint256be, bool>;
101 [[nodiscard]]
static auto make_tx_context(
const evmc::address& from,
103 bool is_readonly_run)
105 static auto make_message(
const evmc::address& from,
107 bool is_readonly_run)
108 -> std::pair<evmc_message, bool>;
110 void handle_lock_from_account(
113 void lock_ticket_number_key();
114 void lock_index_keys(
const std::function<
void()>& callback);
115 void schedule_exec();
117 void schedule(
const std::function<
void()>& fn);
124 void handle_get_logs_try_lock_response(
126 const std::shared_ptr<std::vector<evm_log_index>>& log_indexes,
127 const std::shared_ptr<std::atomic<size_t>>& acquired,
128 const std::shared_ptr<std::mutex>& log_indexes_mut,
132 void handle_complete_get_logs(
134 const std::shared_ptr<std::mutex>& log_indexes_mut,
135 const std::shared_ptr<std::vector<evm_log_index>>& log_indexes);
Buffer to store and retrieve byte data.
Executes EVM transactions, implementing the runner interface.
evm_runner(const evm_runner &)=delete
evm_runner(evm_runner &&)=delete
auto operator=(const evm_runner &) -> evm_runner &=delete
auto run() -> bool override
Begin executing the transaction asynchronously.
static constexpr auto initial_lock_type
Initial lock type for the agent to request when retrieving the function key.
~evm_runner() override
Blocks until the transaction has completed and all processing threads have ended.
auto operator=(evm_runner &&) -> evm_runner &=delete
Interface for a contract runner.
std::function< void(run_return_type)> run_callback_type
Callback type for function execution.
std::function< bool(broker::key_type, broker::lock_type, broker::interface::try_lock_callback_type)> try_lock_callback_type
Callback function type for acquiring locks during function execution.
parsec::ticket_machine::ticket_number_type ticket_number_type
Type alias for a ticket number.
std::variant< value_type, error_code, runtime_locking_shard::shard_error > try_lock_return_type
Return type from a try lock operation.
evm_runner_function
Commands accepted by the EVM contract runner.
@ get_transaction_receipt
Return the receipt for a transaction.
@ get_block_number
Return just the ticket number to simulate getting the latest block.
@ read_account_code
Read the contract code of an account.
@ get_transaction
Return a previously completed transaction.
@ get_logs
Query the logs for a particular address, block range and topic filter.
@ get_block
Return a pretend block that is based on the ticket number, and the transaction (potentially) correspo...
@ execute_transaction
Execute a normal transaction.
@ read_account_storage
Read a specific key of an account's storage.
@ read_account
Read the metadata of an account.
@ dryrun_transaction
Execute a transaction without applying any changes.
Describes the parameters of a query on EVM logs - used to transfer these parameters from the getLogs ...
EVM pretend block is a pairing of the blocknumber (equal to the ticket number) and the transactions (...
Configuration parameters for a phase two system.