diff --git a/annotated.html b/annotated.html new file mode 100644 index 000000000..6c7bf50ae --- /dev/null +++ b/annotated.html @@ -0,0 +1,104 @@ + + +
+ + + + +
+ EVMC
+
+ |
+
▼Nevmc | EVMC C++ API - wrappers and bindings for C++ |
Caddress | The big-endian 160-bit hash suitable for keeping an Ethereum address |
Cbyte_traits | The char traits for byte-like types |
Cbytes32 | The fixed size array of 32 bytes for storing 256-bit EVM values |
Cfilter_iterator | The filter iterator adaptor creates a view of an iterator range in which some elements of the range are skipped |
CHost | Abstract class to be used by Host implementations |
CHostContext | Wrapper around EVMC host context / host interface |
CHostInterface | The EVMC Host interface |
CMockedAccount | Mocked account |
▼CMockedHost | Mocked EVMC Host implementation |
Clog_record | LOG record |
CResult | The EVM code execution result. |
Cskip_space_iterator | The input filter iterator which skips whitespace characters from the base input iterator |
CStorageValue | Extended value (with original value and access flag) for account storage |
CVM | The VM instance. |
Cevmc_address | Big-endian 160-bit hash suitable for keeping an Ethereum address |
Cevmc_bytes32 | The fixed size array of 32 bytes |
Cevmc_host_context | The opaque data type representing the Host execution context |
Cevmc_host_interface | The Host interface |
Cevmc_instruction_metrics | Metrics for an EVM 1 instruction |
Cevmc_message | The message describing an EVM call, including a zero-depth calls from a transaction origin |
Cevmc_result | The EVM code execution result |
Cevmc_result_optional_storage | The union representing evmc_result "optional storage" |
Cevmc_tx_context | The transaction and block data for execution |
Cevmc_tx_initcode | The hashed initcode used for TXCREATE instruction |
Cevmc_vm | The VM instance |
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
This is the complete list of members for evmc::Host, including all inherited members.
+access_account(const address &addr) noexcept=0 | evmc::HostInterface | pure virtual |
access_storage(const address &addr, const bytes32 &key) noexcept=0 | evmc::HostInterface | pure virtual |
account_exists(const address &addr) const noexcept=0 | evmc::HostInterface | pure virtual |
call(const evmc_message &msg) noexcept=0 | evmc::HostInterface | pure virtual |
copy_code(const address &addr, size_t code_offset, uint8_t *buffer_data, size_t buffer_size) const noexcept=0 | evmc::HostInterface | pure virtual |
emit_log(const address &addr, const uint8_t *data, size_t data_size, const bytes32 topics[], size_t num_topics) noexcept=0 | evmc::HostInterface | pure virtual |
from_context(evmc_host_context *context) noexcept | evmc::Host | inlinestatic |
get_balance(const address &addr) const noexcept=0 | evmc::HostInterface | pure virtual |
get_block_hash(int64_t block_number) const noexcept=0 | evmc::HostInterface | pure virtual |
get_code_hash(const address &addr) const noexcept=0 | evmc::HostInterface | pure virtual |
get_code_size(const address &addr) const noexcept=0 | evmc::HostInterface | pure virtual |
get_interface() noexcept | evmc::Host | inlinestatic |
get_storage(const address &addr, const bytes32 &key) const noexcept=0 | evmc::HostInterface | pure virtual |
get_transient_storage(const address &addr, const bytes32 &key) const noexcept=0 | evmc::HostInterface | pure virtual |
get_tx_context() const noexcept=0 | evmc::HostInterface | pure virtual |
selfdestruct(const address &addr, const address &beneficiary) noexcept=0 | evmc::HostInterface | pure virtual |
set_storage(const address &addr, const bytes32 &key, const bytes32 &value) noexcept=0 | evmc::HostInterface | pure virtual |
set_transient_storage(const address &addr, const bytes32 &key, const bytes32 &value) noexcept=0 | evmc::HostInterface | pure virtual |
to_context() noexcept | evmc::Host | inline |
~HostInterface() noexcept=default (defined in evmc::HostInterface) | evmc::HostInterface | virtual |
+ EVMC
+
+ |
+
Abstract class to be used by Host implementations. + More...
+ +#include <evmc.hpp>
+Public Member Functions | |
evmc_host_context * | to_context () noexcept |
Converts the Host object to the opaque host context pointer. | |
Public Member Functions inherited from evmc::HostInterface | |
virtual bool | account_exists (const address &addr) const noexcept=0 |
Check account existence callback function. | |
virtual bytes32 | get_storage (const address &addr, const bytes32 &key) const noexcept=0 |
Get storage callback function. | |
virtual evmc_storage_status | set_storage (const address &addr, const bytes32 &key, const bytes32 &value) noexcept=0 |
Set storage callback function. | |
virtual uint256be | get_balance (const address &addr) const noexcept=0 |
Get balance callback function. | |
virtual size_t | get_code_size (const address &addr) const noexcept=0 |
Get code size callback function. | |
virtual bytes32 | get_code_hash (const address &addr) const noexcept=0 |
Get code hash callback function. | |
virtual size_t | copy_code (const address &addr, size_t code_offset, uint8_t *buffer_data, size_t buffer_size) const noexcept=0 |
Copy code callback function. | |
virtual bool | selfdestruct (const address &addr, const address &beneficiary) noexcept=0 |
Selfdestruct callback function. | |
virtual Result | call (const evmc_message &msg) noexcept=0 |
Call callback function. | |
virtual evmc_tx_context | get_tx_context () const noexcept=0 |
Get transaction context callback function. | |
virtual bytes32 | get_block_hash (int64_t block_number) const noexcept=0 |
Get block hash callback function. | |
virtual void | emit_log (const address &addr, const uint8_t *data, size_t data_size, const bytes32 topics[], size_t num_topics) noexcept=0 |
Emit log callback function. | |
virtual evmc_access_status | access_account (const address &addr) noexcept=0 |
Access account callback function. | |
virtual evmc_access_status | access_storage (const address &addr, const bytes32 &key) noexcept=0 |
Access storage callback function. | |
virtual bytes32 | get_transient_storage (const address &addr, const bytes32 &key) const noexcept=0 |
Get transient storage callback function. | |
virtual void | set_transient_storage (const address &addr, const bytes32 &key, const bytes32 &value) noexcept=0 |
Set transient storage callback function. | |
+Static Public Member Functions | |
static const evmc_host_interface & | get_interface () noexcept |
Provides access to the global host interface. | |
template<typename DerivedClass = Host> | |
static DerivedClass * | from_context (evmc_host_context *context) noexcept |
Converts the opaque host context pointer back to the original Host object. | |
Abstract class to be used by Host implementations.
+When implementing EVMC Host, you can directly inherit from the evmc::Host class. This way your implementation will be simpler by avoiding manual handling of the evmc_host_context and the evmc_host_interface.
+ + +
+
|
+ +inlinestaticnoexcept | +
Converts the opaque host context pointer back to the original Host object.
+DerivedClass | The class derived from the Host class. |
context | The opaque host context pointer. |
Definition at line 636 of file evmc.hpp.
+
+
|
+ +inlinestaticnoexcept | +
Provides access to the global host interface.
+Definition at line 882 of file evmc.hpp.
+
+
|
+ +inlinenoexcept | +
Converts the Host object to the opaque host context pointer.
+Definition at line 629 of file evmc.hpp.
+
+ EVMC
+
+ |
+
This is the complete list of members for evmc::HostContext, including all inherited members.
+access_account(const address &address) noexcept final | evmc::HostContext | inlinevirtual |
access_storage(const address &address, const bytes32 &key) noexcept final | evmc::HostContext | inlinevirtual |
account_exists(const address &address) const noexcept final | evmc::HostContext | inlinevirtual |
call(const evmc_message &message) noexcept final | evmc::HostContext | inlinevirtual |
copy_code(const address &address, size_t code_offset, uint8_t *buffer_data, size_t buffer_size) const noexcept final | evmc::HostContext | inlinevirtual |
emit_log(const address &addr, const uint8_t *data, size_t data_size, const bytes32 topics[], size_t topics_count) noexcept final | evmc::HostContext | inlinevirtual |
get_balance(const address &address) const noexcept final | evmc::HostContext | inlinevirtual |
get_block_hash(int64_t number) const noexcept final | evmc::HostContext | inlinevirtual |
get_code_hash(const address &address) const noexcept final | evmc::HostContext | inlinevirtual |
get_code_size(const address &address) const noexcept final | evmc::HostContext | inlinevirtual |
get_storage(const address &address, const bytes32 &key) const noexcept final | evmc::HostContext | inlinevirtual |
get_transient_storage(const address &address, const bytes32 &key) const noexcept final | evmc::HostContext | inlinevirtual |
get_tx_context() const noexcept final | evmc::HostContext | inlinevirtual |
HostContext()=default | evmc::HostContext | |
HostContext(const evmc_host_interface &interface, evmc_host_context *ctx) noexcept | evmc::HostContext | inline |
selfdestruct(const address &addr, const address &beneficiary) noexcept final | evmc::HostContext | inlinevirtual |
set_storage(const address &address, const bytes32 &key, const bytes32 &value) noexcept final | evmc::HostContext | inlinevirtual |
set_transient_storage(const address &address, const bytes32 &key, const bytes32 &value) noexcept final | evmc::HostContext | inlinevirtual |
~HostInterface() noexcept=default (defined in evmc::HostInterface) | evmc::HostInterface | virtual |
+ EVMC
+
+ |
+
Wrapper around EVMC host context / host interface. + More...
+ +#include <evmc.hpp>
+Public Member Functions | |
+ | HostContext ()=default |
Default constructor for null Host context. | |
HostContext (const evmc_host_interface &interface, evmc_host_context *ctx) noexcept | |
Constructor from the EVMC Host primitives. | |
bool | account_exists (const address &address) const noexcept final |
Check account existence callback function. | |
bytes32 | get_storage (const address &address, const bytes32 &key) const noexcept final |
Get storage callback function. | |
evmc_storage_status | set_storage (const address &address, const bytes32 &key, const bytes32 &value) noexcept final |
Set storage callback function. | |
uint256be | get_balance (const address &address) const noexcept final |
Get balance callback function. | |
size_t | get_code_size (const address &address) const noexcept final |
Get code size callback function. | |
bytes32 | get_code_hash (const address &address) const noexcept final |
Get code hash callback function. | |
size_t | copy_code (const address &address, size_t code_offset, uint8_t *buffer_data, size_t buffer_size) const noexcept final |
Copy code callback function. | |
bool | selfdestruct (const address &addr, const address &beneficiary) noexcept final |
Selfdestruct callback function. | |
Result | call (const evmc_message &message) noexcept final |
Call callback function. | |
evmc_tx_context | get_tx_context () const noexcept final |
Get transaction context callback function. | |
bytes32 | get_block_hash (int64_t number) const noexcept final |
Get block hash callback function. | |
void | emit_log (const address &addr, const uint8_t *data, size_t data_size, const bytes32 topics[], size_t topics_count) noexcept final |
Emit log callback function. | |
evmc_access_status | access_account (const address &address) noexcept final |
Access account callback function. | |
evmc_access_status | access_storage (const address &address, const bytes32 &key) noexcept final |
Access storage callback function. | |
bytes32 | get_transient_storage (const address &address, const bytes32 &key) const noexcept final |
Get transient storage callback function. | |
void | set_transient_storage (const address &address, const bytes32 &key, const bytes32 &value) noexcept final |
Set transient storage callback function. | |
virtual bool | account_exists (const address &addr) const noexcept=0 |
Check account existence callback function. | |
virtual bytes32 | get_storage (const address &addr, const bytes32 &key) const noexcept=0 |
Get storage callback function. | |
virtual evmc_storage_status | set_storage (const address &addr, const bytes32 &key, const bytes32 &value) noexcept=0 |
Set storage callback function. | |
virtual uint256be | get_balance (const address &addr) const noexcept=0 |
Get balance callback function. | |
virtual size_t | get_code_size (const address &addr) const noexcept=0 |
Get code size callback function. | |
virtual bytes32 | get_code_hash (const address &addr) const noexcept=0 |
Get code hash callback function. | |
virtual size_t | copy_code (const address &addr, size_t code_offset, uint8_t *buffer_data, size_t buffer_size) const noexcept=0 |
Copy code callback function. | |
virtual bool | selfdestruct (const address &addr, const address &beneficiary) noexcept=0 |
Selfdestruct callback function. | |
virtual Result | call (const evmc_message &msg) noexcept=0 |
Call callback function. | |
virtual evmc_tx_context | get_tx_context () const noexcept=0 |
Get transaction context callback function. | |
virtual bytes32 | get_block_hash (int64_t block_number) const noexcept=0 |
Get block hash callback function. | |
virtual void | emit_log (const address &addr, const uint8_t *data, size_t data_size, const bytes32 topics[], size_t num_topics) noexcept=0 |
Emit log callback function. | |
virtual evmc_access_status | access_account (const address &addr) noexcept=0 |
Access account callback function. | |
virtual evmc_access_status | access_storage (const address &addr, const bytes32 &key) noexcept=0 |
Access storage callback function. | |
virtual bytes32 | get_transient_storage (const address &addr, const bytes32 &key) const noexcept=0 |
Get transient storage callback function. | |
virtual void | set_transient_storage (const address &addr, const bytes32 &key, const bytes32 &value) noexcept=0 |
Set transient storage callback function. | |
Wrapper around EVMC host context / host interface.
+To be used by VM implementations as better alternative to using evmc_host_context directly.
+ + +
+
|
+ +inlinenoexcept | +
+
|
+ +inlinefinalvirtualnoexcept | +
Access account callback function.
+ +Implements evmc::HostInterface.
+ +Definition at line 591 of file evmc.hpp.
+
+
|
+ +inlinefinalvirtualnoexcept | +
Access storage callback function.
+ +Implements evmc::HostInterface.
+ +Definition at line 596 of file evmc.hpp.
+
+
|
+ +inlinefinalvirtualnoexcept | +
Check account existence callback function.
+ +Implements evmc::HostInterface.
+ +Definition at line 524 of file evmc.hpp.
+
+
|
+ +inlinefinalvirtualnoexcept | +
Call callback function.
+ +Implements evmc::HostInterface.
+ +Definition at line 569 of file evmc.hpp.
+
+
|
+ +inlinefinalvirtualnoexcept | +
Copy code callback function.
+ +Implements evmc::HostInterface.
+ + + +
+
|
+ +inlinefinalvirtualnoexcept | +
Emit log callback function.
+ +Implements evmc::HostInterface.
+ +Definition at line 582 of file evmc.hpp.
+
+
|
+ +inlinefinalvirtualnoexcept | +
Get balance callback function.
+ +Implements evmc::HostInterface.
+ +Definition at line 541 of file evmc.hpp.
+
+
|
+ +inlinefinalvirtualnoexcept | +
Get block hash callback function.
+ +Implements evmc::HostInterface.
+ +Definition at line 577 of file evmc.hpp.
+
+
|
+ +inlinefinalvirtualnoexcept | +
Get code hash callback function.
+ +Implements evmc::HostInterface.
+ +Definition at line 551 of file evmc.hpp.
+
+
|
+ +inlinefinalvirtualnoexcept | +
Get code size callback function.
+ +Implements evmc::HostInterface.
+ +Definition at line 546 of file evmc.hpp.
+
+
|
+ +inlinefinalvirtualnoexcept | +
Get storage callback function.
+ +Implements evmc::HostInterface.
+ +Definition at line 529 of file evmc.hpp.
+
+
|
+ +inlinefinalvirtualnoexcept | +
Get transient storage callback function.
+ +Implements evmc::HostInterface.
+ +Definition at line 601 of file evmc.hpp.
+
+
|
+ +inlinefinalvirtualnoexcept | +
Get transaction context callback function.
+ +Implements evmc::HostInterface.
+ +Definition at line 575 of file evmc.hpp.
+
+
|
+ +inlinefinalvirtualnoexcept | +
Selfdestruct callback function.
+ +Implements evmc::HostInterface.
+ +Definition at line 564 of file evmc.hpp.
+
+
|
+ +inlinefinalvirtualnoexcept | +
Set storage callback function.
+ +Implements evmc::HostInterface.
+ +Definition at line 534 of file evmc.hpp.
+
+
|
+ +inlinefinalvirtualnoexcept | +
Set transient storage callback function.
+ +Implements evmc::HostInterface.
+ +Definition at line 606 of file evmc.hpp.
+
+ EVMC
+
+ |
+
This is the complete list of members for evmc::HostInterface, including all inherited members.
+access_account(const address &addr) noexcept=0 | evmc::HostInterface | pure virtual |
access_storage(const address &addr, const bytes32 &key) noexcept=0 | evmc::HostInterface | pure virtual |
account_exists(const address &addr) const noexcept=0 | evmc::HostInterface | pure virtual |
call(const evmc_message &msg) noexcept=0 | evmc::HostInterface | pure virtual |
copy_code(const address &addr, size_t code_offset, uint8_t *buffer_data, size_t buffer_size) const noexcept=0 | evmc::HostInterface | pure virtual |
emit_log(const address &addr, const uint8_t *data, size_t data_size, const bytes32 topics[], size_t num_topics) noexcept=0 | evmc::HostInterface | pure virtual |
get_balance(const address &addr) const noexcept=0 | evmc::HostInterface | pure virtual |
get_block_hash(int64_t block_number) const noexcept=0 | evmc::HostInterface | pure virtual |
get_code_hash(const address &addr) const noexcept=0 | evmc::HostInterface | pure virtual |
get_code_size(const address &addr) const noexcept=0 | evmc::HostInterface | pure virtual |
get_storage(const address &addr, const bytes32 &key) const noexcept=0 | evmc::HostInterface | pure virtual |
get_transient_storage(const address &addr, const bytes32 &key) const noexcept=0 | evmc::HostInterface | pure virtual |
get_tx_context() const noexcept=0 | evmc::HostInterface | pure virtual |
selfdestruct(const address &addr, const address &beneficiary) noexcept=0 | evmc::HostInterface | pure virtual |
set_storage(const address &addr, const bytes32 &key, const bytes32 &value) noexcept=0 | evmc::HostInterface | pure virtual |
set_transient_storage(const address &addr, const bytes32 &key, const bytes32 &value) noexcept=0 | evmc::HostInterface | pure virtual |
~HostInterface() noexcept=default (defined in evmc::HostInterface) | evmc::HostInterface | virtual |
+ EVMC
+
+ |
+
The EVMC Host interface. + More...
+ +#include <evmc.hpp>
+Public Member Functions | |
virtual bool | account_exists (const address &addr) const noexcept=0 |
Check account existence callback function. | |
virtual bytes32 | get_storage (const address &addr, const bytes32 &key) const noexcept=0 |
Get storage callback function. | |
virtual evmc_storage_status | set_storage (const address &addr, const bytes32 &key, const bytes32 &value) noexcept=0 |
Set storage callback function. | |
virtual uint256be | get_balance (const address &addr) const noexcept=0 |
Get balance callback function. | |
virtual size_t | get_code_size (const address &addr) const noexcept=0 |
Get code size callback function. | |
virtual bytes32 | get_code_hash (const address &addr) const noexcept=0 |
Get code hash callback function. | |
virtual size_t | copy_code (const address &addr, size_t code_offset, uint8_t *buffer_data, size_t buffer_size) const noexcept=0 |
Copy code callback function. | |
virtual bool | selfdestruct (const address &addr, const address &beneficiary) noexcept=0 |
Selfdestruct callback function. | |
virtual Result | call (const evmc_message &msg) noexcept=0 |
Call callback function. | |
virtual evmc_tx_context | get_tx_context () const noexcept=0 |
Get transaction context callback function. | |
virtual bytes32 | get_block_hash (int64_t block_number) const noexcept=0 |
Get block hash callback function. | |
virtual void | emit_log (const address &addr, const uint8_t *data, size_t data_size, const bytes32 topics[], size_t num_topics) noexcept=0 |
Emit log callback function. | |
virtual evmc_access_status | access_account (const address &addr) noexcept=0 |
Access account callback function. | |
virtual evmc_access_status | access_storage (const address &addr, const bytes32 &key) noexcept=0 |
Access storage callback function. | |
virtual bytes32 | get_transient_storage (const address &addr, const bytes32 &key) const noexcept=0 |
Get transient storage callback function. | |
virtual void | set_transient_storage (const address &addr, const bytes32 &key, const bytes32 &value) noexcept=0 |
Set transient storage callback function. | |
+
|
+ +pure virtualnoexcept | +
Access account callback function.
+ +Implemented in evmc::MockedHost, and evmc::HostContext.
+ +
+
|
+ +pure virtualnoexcept | +
Access storage callback function.
+ +Implemented in evmc::MockedHost, and evmc::HostContext.
+ +
+
|
+ +pure virtualnoexcept | +
Check account existence callback function.
+ +Implemented in evmc::MockedHost, and evmc::HostContext.
+ +
+
|
+ +pure virtualnoexcept | +
Call callback function.
+ +Implemented in evmc::HostContext, and evmc::MockedHost.
+ +
+
|
+ +pure virtualnoexcept | +
Copy code callback function.
+ +Implemented in evmc::MockedHost, and evmc::HostContext.
+ +
+
|
+ +pure virtualnoexcept | +
Emit log callback function.
+ +Implemented in evmc::HostContext, and evmc::MockedHost.
+ +
+
|
+ +pure virtualnoexcept | +
Get balance callback function.
+ +Implemented in evmc::MockedHost, and evmc::HostContext.
+ +
+
|
+ +pure virtualnoexcept | +
Get block hash callback function.
+ +Implemented in evmc::MockedHost, and evmc::HostContext.
+ +
+
|
+ +pure virtualnoexcept | +
Get code hash callback function.
+ +Implemented in evmc::MockedHost, and evmc::HostContext.
+ +
+
|
+ +pure virtualnoexcept | +
Get code size callback function.
+ +Implemented in evmc::MockedHost, and evmc::HostContext.
+ +
+
|
+ +pure virtualnoexcept | +
Get storage callback function.
+ +Implemented in evmc::MockedHost, and evmc::HostContext.
+ +
+
|
+ +pure virtualnoexcept | +
Get transient storage callback function.
+ +Implemented in evmc::MockedHost, and evmc::HostContext.
+ +
+
|
+ +pure virtualnoexcept | +
Get transaction context callback function.
+ +Implemented in evmc::HostContext, and evmc::MockedHost.
+ +
+
|
+ +pure virtualnoexcept | +
Selfdestruct callback function.
+ +Implemented in evmc::HostContext, and evmc::MockedHost.
+ +
+
|
+ +pure virtualnoexcept | +
Set storage callback function.
+ +Implemented in evmc::MockedHost, and evmc::HostContext.
+ +
+
|
+ +pure virtualnoexcept | +
Set transient storage callback function.
+ +Implemented in evmc::MockedHost, and evmc::HostContext.
+ +
+ EVMC
+
+ |
+
This is the complete list of members for evmc::MockedHost, including all inherited members.
+access_account(const address &addr) noexcept override | evmc::MockedHost | inlinevirtual |
access_storage(const address &addr, const bytes32 &key) noexcept override | evmc::MockedHost | inlinevirtual |
account_exists(const address &addr) const noexcept override | evmc::MockedHost | inlinevirtual |
accounts | evmc::MockedHost | |
block_hash | evmc::MockedHost | |
call(const evmc_message &msg) noexcept override | evmc::MockedHost | inlinevirtual |
call_result | evmc::MockedHost | |
copy_code(const address &addr, size_t code_offset, uint8_t *buffer_data, size_t buffer_size) const noexcept override | evmc::MockedHost | inlinevirtual |
emit_log(const address &addr, const uint8_t *data, size_t data_size, const bytes32 topics[], size_t topics_count) noexcept override | evmc::MockedHost | inlinevirtual |
from_context(evmc_host_context *context) noexcept | evmc::Host | inlinestatic |
get_balance(const address &addr) const noexcept override | evmc::MockedHost | inlinevirtual |
get_block_hash(int64_t block_number) const noexcept override | evmc::MockedHost | inlinevirtual |
get_code_hash(const address &addr) const noexcept override | evmc::MockedHost | inlinevirtual |
get_code_size(const address &addr) const noexcept override | evmc::MockedHost | inlinevirtual |
get_interface() noexcept | evmc::Host | inlinestatic |
get_storage(const address &addr, const bytes32 &key) const noexcept override | evmc::MockedHost | inlinevirtual |
get_transient_storage(const address &addr, const bytes32 &key) const noexcept override | evmc::MockedHost | inlinevirtual |
get_tx_context() const noexcept override | evmc::MockedHost | inlinevirtual |
max_recorded_account_accesses | evmc::MockedHost | static |
max_recorded_calls | evmc::MockedHost | static |
recorded_account_accesses | evmc::MockedHost | mutable |
recorded_blockhashes | evmc::MockedHost | mutable |
recorded_calls | evmc::MockedHost | |
recorded_logs | evmc::MockedHost | |
recorded_selfdestructs | evmc::MockedHost | |
selfdestruct(const address &addr, const address &beneficiary) noexcept override | evmc::MockedHost | inlinevirtual |
set_storage(const address &addr, const bytes32 &key, const bytes32 &value) noexcept override | evmc::MockedHost | inlinevirtual |
set_transient_storage(const address &addr, const bytes32 &key, const bytes32 &value) noexcept override | evmc::MockedHost | inlinevirtual |
to_context() noexcept | evmc::Host | inline |
tx_context | evmc::MockedHost | |
~HostInterface() noexcept=default (defined in evmc::HostInterface) | evmc::HostInterface | virtual |
+ EVMC
+
+ |
+
Mocked EVMC Host implementation. + More...
+ +#include <mocked_host.hpp>
+Classes | |
struct | log_record |
LOG record. More... | |
+Public Member Functions | |
bool | account_exists (const address &addr) const noexcept override |
Returns true if an account exists (EVMC Host method). | |
bytes32 | get_storage (const address &addr, const bytes32 &key) const noexcept override |
Get the account's storage value at the given key (EVMC Host method). | |
evmc_storage_status | set_storage (const address &addr, const bytes32 &key, const bytes32 &value) noexcept override |
Set the account's storage value (EVMC Host method). | |
uint256be | get_balance (const address &addr) const noexcept override |
Get the account's balance (EVMC Host method). | |
size_t | get_code_size (const address &addr) const noexcept override |
Get the account's code size (EVMC host method). | |
bytes32 | get_code_hash (const address &addr) const noexcept override |
Get the account's code hash (EVMC host method). | |
size_t | copy_code (const address &addr, size_t code_offset, uint8_t *buffer_data, size_t buffer_size) const noexcept override |
Copy the account's code to the given buffer (EVMC host method). | |
bool | selfdestruct (const address &addr, const address &beneficiary) noexcept override |
Selfdestruct the account (EVMC host method). | |
Result | call (const evmc_message &msg) noexcept override |
Call/create other contract (EVMC host method). | |
evmc_tx_context | get_tx_context () const noexcept override |
Get transaction context (EVMC host method). | |
bytes32 | get_block_hash (int64_t block_number) const noexcept override |
Get the block header hash (EVMC host method). | |
void | emit_log (const address &addr, const uint8_t *data, size_t data_size, const bytes32 topics[], size_t topics_count) noexcept override |
Emit LOG (EVMC host method). | |
evmc_access_status | access_account (const address &addr) noexcept override |
Record an account access. | |
evmc_access_status | access_storage (const address &addr, const bytes32 &key) noexcept override |
Access the account's storage value at the given key. | |
bytes32 | get_transient_storage (const address &addr, const bytes32 &key) const noexcept override |
Get account's transient storage. | |
void | set_transient_storage (const address &addr, const bytes32 &key, const bytes32 &value) noexcept override |
Set account's transient storage. | |
Public Member Functions inherited from evmc::Host | |
evmc_host_context * | to_context () noexcept |
Converts the Host object to the opaque host context pointer. | |
virtual bool | account_exists (const address &addr) const noexcept=0 |
Check account existence callback function. | |
virtual bytes32 | get_storage (const address &addr, const bytes32 &key) const noexcept=0 |
Get storage callback function. | |
virtual evmc_storage_status | set_storage (const address &addr, const bytes32 &key, const bytes32 &value) noexcept=0 |
Set storage callback function. | |
virtual uint256be | get_balance (const address &addr) const noexcept=0 |
Get balance callback function. | |
virtual size_t | get_code_size (const address &addr) const noexcept=0 |
Get code size callback function. | |
virtual bytes32 | get_code_hash (const address &addr) const noexcept=0 |
Get code hash callback function. | |
virtual size_t | copy_code (const address &addr, size_t code_offset, uint8_t *buffer_data, size_t buffer_size) const noexcept=0 |
Copy code callback function. | |
virtual bool | selfdestruct (const address &addr, const address &beneficiary) noexcept=0 |
Selfdestruct callback function. | |
virtual Result | call (const evmc_message &msg) noexcept=0 |
Call callback function. | |
virtual evmc_tx_context | get_tx_context () const noexcept=0 |
Get transaction context callback function. | |
virtual bytes32 | get_block_hash (int64_t block_number) const noexcept=0 |
Get block hash callback function. | |
virtual void | emit_log (const address &addr, const uint8_t *data, size_t data_size, const bytes32 topics[], size_t num_topics) noexcept=0 |
Emit log callback function. | |
virtual evmc_access_status | access_account (const address &addr) noexcept=0 |
Access account callback function. | |
virtual evmc_access_status | access_storage (const address &addr, const bytes32 &key) noexcept=0 |
Access storage callback function. | |
virtual bytes32 | get_transient_storage (const address &addr, const bytes32 &key) const noexcept=0 |
Get transient storage callback function. | |
virtual void | set_transient_storage (const address &addr, const bytes32 &key, const bytes32 &value) noexcept=0 |
Set transient storage callback function. | |
+Public Attributes | |
std::unordered_map< address, MockedAccount > | accounts |
The set of all accounts in the Host, organized by their addresses. | |
evmc_tx_context | tx_context = {} |
The EVMC transaction context to be returned by get_tx_context(). | |
bytes32 | block_hash = {} |
The block header hash value to be returned by get_block_hash(). | |
evmc_result | call_result = {} |
The call result to be returned by the call() method. | |
std::vector< int64_t > | recorded_blockhashes |
The record of all block numbers for which get_block_hash() was called. | |
std::vector< address > | recorded_account_accesses |
The record of all account accesses. | |
std::vector< evmc_message > | recorded_calls |
The record of all call messages requested in the call() method. | |
std::vector< log_record > | recorded_logs |
The record of all LOGs passed to the emit_log() method. | |
std::unordered_map< address, std::vector< address > > | recorded_selfdestructs |
The record of all SELFDESTRUCTs from the selfdestruct() method as a map selfdestructed_address => [beneficiary1, beneficiary2, ...]. | |
+Static Public Attributes | |
static constexpr auto | max_recorded_account_accesses = 200 |
The maximum number of entries in recorded_account_accesses record. | |
static constexpr auto | max_recorded_calls = 100 |
The maximum number of entries in recorded_calls record. | |
+Additional Inherited Members | |
Static Public Member Functions inherited from evmc::Host | |
static const evmc_host_interface & | get_interface () noexcept |
Provides access to the global host interface. | |
template<typename DerivedClass = Host> | |
static DerivedClass * | from_context (evmc_host_context *context) noexcept |
Converts the opaque host context pointer back to the original Host object. | |
Mocked EVMC Host implementation.
+ +Definition at line 75 of file mocked_host.hpp.
+
+
|
+ +inlineoverridevirtualnoexcept | +
Record an account access.
+This method is required by EIP-2929 introduced in EVMC_BERLIN. It will record the account access in MockedHost::recorded_account_accesses and return previous access status. This methods returns EVMC_ACCESS_WARM for known addresses of precompiles. The EIP-2929 specifies that evmc_message::sender and evmc_message::recipient are always EVMC_ACCESS_WARM. Therefore, you should init the MockedHost with:
mocked_host.access_account(msg.sender); +mocked_host.access_account(msg.recipient); +
The same way you can mock transaction access list (EIP-2930) for account addresses.
+addr | The address of the accessed account. |
Implements evmc::HostInterface.
+ +Definition at line 440 of file mocked_host.hpp.
+
+
|
+ +inlineoverridevirtualnoexcept | +
Access the account's storage value at the given key.
+This method is required by EIP-2929 introduced in EVMC_BERLIN. In records that the given account's storage key has been access and returns the previous access status. To mock storage access list (EIP-2930), you can pre-init account's storage values with the EVMC_ACCESS_WARM flag:
mocked_host.accounts[msg.recipient].storage[key] = {value, +EVMC_ACCESS_WARM}; +
addr | The account address. |
key | The account's storage key. |
Implements evmc::HostInterface.
+ +Definition at line 471 of file mocked_host.hpp.
+
+
|
+ +inlineoverridevirtualnoexcept | +
Returns true if an account exists (EVMC Host method).
+ +Implements evmc::HostInterface.
+ +Definition at line 150 of file mocked_host.hpp.
+ +
+
|
+ +inlineoverridevirtualnoexcept | +
Call/create other contract (EVMC host method).
+ +Implements evmc::HostInterface.
+ +Definition at line 380 of file mocked_host.hpp.
+
+
|
+ +inlineoverridevirtualnoexcept | +
Copy the account's code to the given buffer (EVMC host method).
+ +Implements evmc::HostInterface.
+ +Definition at line 348 of file mocked_host.hpp.
+
+
|
+ +inlineoverridevirtualnoexcept | +
Emit LOG (EVMC host method).
+ +Implements evmc::HostInterface.
+ +Definition at line 415 of file mocked_host.hpp.
+
+
|
+ +inlineoverridevirtualnoexcept | +
Get the account's balance (EVMC Host method).
+ +Implements evmc::HostInterface.
+ +Definition at line 317 of file mocked_host.hpp.
+ +
+
|
+ +inlineoverridevirtualnoexcept | +
Get the block header hash (EVMC host method).
+ +Implements evmc::HostInterface.
+ +Definition at line 408 of file mocked_host.hpp.
+
+
|
+ +inlineoverridevirtualnoexcept | +
Get the account's code hash (EVMC host method).
+ +Implements evmc::HostInterface.
+ +Definition at line 338 of file mocked_host.hpp.
+ +
+
|
+ +inlineoverridevirtualnoexcept | +
Get the account's code size (EVMC host method).
+ +Implements evmc::HostInterface.
+ +Definition at line 328 of file mocked_host.hpp.
+ +
+
|
+ +inlineoverridevirtualnoexcept | +
Get the account's storage value at the given key (EVMC Host method).
+ +Implements evmc::HostInterface.
+ +Definition at line 157 of file mocked_host.hpp.
+
+
|
+ +inlineoverridevirtualnoexcept | +
Get account's transient storage.
+addr | The account address. |
key | The account's transient storage key. |
Implements evmc::HostInterface.
+ +Definition at line 484 of file mocked_host.hpp.
+
+
|
+ +inlineoverridevirtualnoexcept | +
Get transaction context (EVMC host method).
+ +Implements evmc::HostInterface.
+ +Definition at line 405 of file mocked_host.hpp.
+
+
|
+ +inlineoverridevirtualnoexcept | +
Selfdestruct the account (EVMC host method).
+ +Implements evmc::HostInterface.
+ +Definition at line 371 of file mocked_host.hpp.
+
+
|
+ +inlineoverridevirtualnoexcept | +
Set the account's storage value (EVMC Host method).
+ +Implements evmc::HostInterface.
+ +Definition at line 172 of file mocked_host.hpp.
+
+
|
+ +inlineoverridevirtualnoexcept | +
Set account's transient storage.
+addr | The account address. |
key | The account's transient storage key. |
value | The value to be stored. |
Implements evmc::HostInterface.
+ +Definition at line 503 of file mocked_host.hpp.
+std::unordered_map<address, MockedAccount> evmc::MockedHost::accounts | +
The set of all accounts in the Host, organized by their addresses.
+ +Definition at line 98 of file mocked_host.hpp.
+ +bytes32 evmc::MockedHost::block_hash = {} | +
The block header hash value to be returned by get_block_hash().
+ +Definition at line 104 of file mocked_host.hpp.
+ +evmc_result evmc::MockedHost::call_result = {} | +
The call result to be returned by the call() method.
+ +Definition at line 107 of file mocked_host.hpp.
+ +
+
|
+ +staticconstexpr | +
The maximum number of entries in recorded_account_accesses record.
+This is arbitrary value useful in fuzzing when we don't want the record to explode.
+ +Definition at line 117 of file mocked_host.hpp.
+ +
+
|
+ +staticconstexpr | +
The maximum number of entries in recorded_calls record.
+This is arbitrary value useful in fuzzing when we don't want the record to explode.
+ +Definition at line 124 of file mocked_host.hpp.
+ +
+
|
+ +mutable | +
The record of all account accesses.
+ +Definition at line 113 of file mocked_host.hpp.
+ +
+
|
+ +mutable | +
The record of all block numbers for which get_block_hash() was called.
+ +Definition at line 110 of file mocked_host.hpp.
+ +std::vector<evmc_message> evmc::MockedHost::recorded_calls | +
The record of all call messages requested in the call() method.
+ +Definition at line 120 of file mocked_host.hpp.
+ +std::vector<log_record> evmc::MockedHost::recorded_logs | +
The record of all LOGs passed to the emit_log() method.
+ +Definition at line 127 of file mocked_host.hpp.
+ +std::unordered_map<address, std::vector<address> > evmc::MockedHost::recorded_selfdestructs | +
The record of all SELFDESTRUCTs from the selfdestruct() method as a map selfdestructed_address => [beneficiary1, beneficiary2, ...].
+ +Definition at line 131 of file mocked_host.hpp.
+ +evmc_tx_context evmc::MockedHost::tx_context = {} | +
The EVMC transaction context to be returned by get_tx_context().
+ +Definition at line 101 of file mocked_host.hpp.
+ +
+ EVMC
+
+ |
+
This is the complete list of members for evmc::Result, including all inherited members.
+create_address | evmc::Result | |
gas_left | evmc::Result | |
gas_refund | evmc::Result | |
operator=(Result &&other) noexcept | evmc::Result | inline |
output_data | evmc::Result | |
output_size | evmc::Result | |
raw() noexcept | evmc::Result | inline |
raw() const noexcept | evmc::Result | inline |
release_raw() noexcept | evmc::Result | inline |
Result(evmc_status_code _status_code, int64_t _gas_left, int64_t _gas_refund, const uint8_t *_output_data, size_t _output_size) noexcept | evmc::Result | inlineexplicit |
Result(evmc_status_code _status_code=EVMC_INTERNAL_ERROR, int64_t _gas_left=0, int64_t _gas_refund=0) noexcept | evmc::Result | inlineexplicit |
Result(evmc_status_code _status_code, int64_t _gas_left, int64_t _gas_refund, const evmc_address &_create_address) noexcept | evmc::Result | inlineexplicit |
Result(const evmc_result &res) noexcept | evmc::Result | inlineexplicit |
Result(Result &&other) noexcept | evmc::Result | inline |
status_code | evmc::Result | |
~Result() noexcept | evmc::Result | inline |
+ EVMC
+
+ |
+
The EVM code execution result. + More...
+ +#include <evmc.hpp>
+Public Member Functions | |
Result (evmc_status_code _status_code, int64_t _gas_left, int64_t _gas_refund, const uint8_t *_output_data, size_t _output_size) noexcept | |
Creates the result from the provided arguments. | |
Result (evmc_status_code _status_code=EVMC_INTERNAL_ERROR, int64_t _gas_left=0, int64_t _gas_refund=0) noexcept | |
Creates the result without output. | |
Result (evmc_status_code _status_code, int64_t _gas_left, int64_t _gas_refund, const evmc_address &_create_address) noexcept | |
Creates the result of contract creation. | |
Result (const evmc_result &res) noexcept | |
Converting constructor from raw evmc_result. | |
~Result () noexcept | |
Destructor responsible for automatically releasing attached resources. | |
Result (Result &&other) noexcept | |
Move constructor. | |
Result & | operator= (Result &&other) noexcept |
Move assignment operator. | |
evmc_result & | raw () noexcept |
Access the result object as a referenced to evmc_result. | |
const evmc_result & | raw () const noexcept |
Access the result object as a const referenced to evmc_result. | |
evmc_result | release_raw () noexcept |
Releases the ownership and returns the raw copy of evmc_result. | |
+Public Attributes | |
evmc_address | create_address |
The address of the possibly created contract. | |
int64_t | gas_left |
The amount of gas left after the execution. | |
int64_t | gas_refund |
The refunded gas accumulated from this execution and its sub-calls. | |
const uint8_t * | output_data |
The reference to output data. | |
size_t | output_size |
The size of the output data. | |
enum evmc_status_code | status_code |
The execution status code. | |
The EVM code execution result.
+This is a RAII wrapper for evmc_result and objects of this type automatically release attached resources.
+ + +
+
|
+ +inlineexplicitnoexcept | +
Creates the result from the provided arguments.
+The provided output is copied to memory allocated with malloc() and the evmc_result::release function is set to one invoking free().
+_status_code | The status code. |
_gas_left | The amount of gas left. |
_gas_refund | The amount of refunded gas. |
_output_data | The pointer to the output. |
_output_size | The output size. |
Definition at line 348 of file evmc.hpp.
+
+
|
+ +inlineexplicitnoexcept | +
+
|
+ +inlineexplicitnoexcept | +
Creates the result of contract creation.
+_status_code | The status code. |
_gas_left | The amount of gas left. |
_gas_refund | The amount of refunded gas. |
_create_address | The address of the possibly created account. |
Definition at line 373 of file evmc.hpp.
+
+
|
+ +inlineexplicitnoexcept | +
Converting constructor from raw evmc_result.
+This object takes ownership of the resources of res
.
Definition at line 385 of file evmc.hpp.
+
+
|
+ +inlinenoexcept | +
Destructor responsible for automatically releasing attached resources.
+ +Definition at line 388 of file evmc.hpp.
+
+
|
+ +inlinenoexcept | +
Move constructor.
+ + + +
+
|
+ +inlinenoexcept | +
Move assignment operator.
+The self-assignment MUST never happen.
+other | The other result object. |
Definition at line 406 of file evmc.hpp.
+
+
|
+ +inlinenoexcept | +
Access the result object as a const referenced to evmc_result.
+ +Definition at line 418 of file evmc.hpp.
+
+
|
+ +inlinenoexcept | +
Access the result object as a referenced to evmc_result.
+ +Definition at line 415 of file evmc.hpp.
+
+
|
+ +inlinenoexcept | +
Releases the ownership and returns the raw copy of evmc_result.
+This method drops the ownership of the result (result's resources are not going to be released when this object is destructed). It is the caller's responsibility having the returned copy of the result to release it. This object MUST NOT be used after this method is invoked.
+Definition at line 428 of file evmc.hpp.
+evmc_address evmc_result::create_address | +
The address of the possibly created contract.
+The create address may be provided even though the contract creation has failed (evmc_result::status_code is not EVMC_SUCCESS). This is useful in situations when the address is observable, e.g. access to it remains warm. In all other cases the address MUST be null bytes.
+ + + +int64_t evmc_result::gas_left | +
The amount of gas left after the execution.
+If evmc_result::status_code is neither EVMC_SUCCESS nor EVMC_REVERT the value MUST be 0.
+ + + +int64_t evmc_result::gas_refund | +
The refunded gas accumulated from this execution and its sub-calls.
+The transaction gas refund limit is not applied. If evmc_result::status_code is other than EVMC_SUCCESS the value MUST be 0.
+ + + +const uint8_t* evmc_result::output_data | +
The reference to output data.
+The output contains data coming from RETURN opcode (iff evmc_result::code field is EVMC_SUCCESS) or from REVERT opcode.
+The memory containing the output data is owned by EVM and has to be freed with evmc_result::release().
+This pointer MAY be NULL. If evmc_result::output_size is 0 this pointer MUST NOT be dereferenced.
+ + + +size_t evmc_result::output_size | +
The size of the output data.
+If evmc_result::output_data is NULL this MUST be 0.
+ + + +enum evmc_status_code evmc_result::status_code | +
+ EVMC
+
+ |
+
This is the complete list of members for evmc::VM, including all inherited members.
+execute(const evmc_host_interface &host, evmc_host_context *ctx, evmc_revision rev, const evmc_message &msg, const uint8_t *code, size_t code_size) noexcept | evmc::VM | inline |
execute(Host &host, evmc_revision rev, const evmc_message &msg, const uint8_t *code, size_t code_size) noexcept | evmc::VM | inline |
execute(evmc_revision rev, const evmc_message &msg, const uint8_t *code, size_t code_size) noexcept | evmc::VM | inline |
get_capabilities() const noexcept | evmc::VM | inline |
get_raw_pointer() const noexcept | evmc::VM | inline |
has_capability(evmc_capabilities capability) const noexcept | evmc::VM | inline |
is_abi_compatible() const noexcept | evmc::VM | inline |
name() const noexcept | evmc::VM | inline |
operator bool() const noexcept | evmc::VM | inlineexplicit |
operator=(const VM &)=delete (defined in evmc::VM) | evmc::VM | |
operator=(VM &&other) noexcept | evmc::VM | inline |
set_option(const char name[], const char value[]) noexcept | evmc::VM | inline |
version() const noexcept | evmc::VM | inline |
VM() noexcept=default (defined in evmc::VM) | evmc::VM | |
VM(evmc_vm *vm) noexcept | evmc::VM | inlineexplicit |
VM(const VM &)=delete (defined in evmc::VM) | evmc::VM | |
VM(VM &&other) noexcept | evmc::VM | inline |
VM(evmc_vm *vm, std::initializer_list< std::pair< const char *, const char * > > options) noexcept | evmc::VM | inline |
~VM() noexcept | evmc::VM | inline |
+ EVMC
+
+ |
+
#include <evmc.hpp>
+Public Member Functions | |
VM (evmc_vm *vm) noexcept | |
Converting constructor from evmc_vm. | |
~VM () noexcept | |
Destructor responsible for automatically destroying the VM instance. | |
+ | VM (const VM &)=delete |
+VM & | operator= (const VM &)=delete |
VM (VM &&other) noexcept | |
Move constructor. | |
VM & | operator= (VM &&other) noexcept |
Move assignment operator. | |
VM (evmc_vm *vm, std::initializer_list< std::pair< const char *, const char * > > options) noexcept | |
The constructor that captures a VM instance and configures the instance with the provided list of options. | |
operator bool () const noexcept | |
Checks if contains a valid pointer to the VM instance. | |
bool | is_abi_compatible () const noexcept |
Checks whenever the VM instance is ABI compatible with the current EVMC API. | |
char const * | name () const noexcept |
The name of the EVMC VM implementation. | |
char const * | version () const noexcept |
The version of the EVMC VM implementation, e.g. | |
bool | has_capability (evmc_capabilities capability) const noexcept |
Checks if the VM has the given capability. | |
evmc_capabilities_flagset | get_capabilities () const noexcept |
A method returning capabilities supported by the VM instance. | |
evmc_set_option_result | set_option (const char name[], const char value[]) noexcept |
Sets the option for the VM, if the feature is supported by the VM. | |
Result | execute (const evmc_host_interface &host, evmc_host_context *ctx, evmc_revision rev, const evmc_message &msg, const uint8_t *code, size_t code_size) noexcept |
Executes code in the VM instance. | |
Result | execute (Host &host, evmc_revision rev, const evmc_message &msg, const uint8_t *code, size_t code_size) noexcept |
Convenient variant of the VM::execute() that takes reference to evmc::Host class. | |
Result | execute (evmc_revision rev, const evmc_message &msg, const uint8_t *code, size_t code_size) noexcept |
Executes code without the Host context. | |
evmc_vm * | get_raw_pointer () const noexcept |
Returns the pointer to C EVMC struct representing the VM. | |
The VM instance.
+This is a RAII wrapper for evmc_vm, and object of this type automatically destroys the VM instance.
+ + +
+
|
+ +inlineexplicitnoexcept | +
+
|
+ +inlinenoexcept | +
Destructor responsible for automatically destroying the VM instance.
+ +Definition at line 660 of file evmc.hpp.
+
+
|
+ +inlinenoexcept | +
+
|
+ +inlinenoexcept | +
The constructor that captures a VM instance and configures the instance with the provided list of options.
+ +Definition at line 765 of file evmc.hpp.
+
+
|
+ +inlinenoexcept | +
Executes code in the VM instance.
+Definition at line 717 of file evmc.hpp.
+
+
|
+ +inlinenoexcept | +
Executes code without the Host context.
+The same as execute(const evmc_host_interface&, evmc_host_context*, evmc_revision, + const evmc_message&, const uint8_t*, size_t), but without providing the Host context and interface. This method is for experimental precompiles support where execution is guaranteed not to require any Host access.
+ +Definition at line 745 of file evmc.hpp.
+
+
|
+ +inlinenoexcept | +
Convenient variant of the VM::execute() that takes reference to evmc::Host class.
+ +Definition at line 728 of file evmc.hpp.
+
+
|
+ +inlinenoexcept | +
A method returning capabilities supported by the VM instance.
+The value returned MAY change when different options are set via the set_option() method.
+A Client SHOULD only rely on the value returned if it has queried it after it has called the set_option().
+This is a mandatory method and MUST NOT be set to NULL.
+ +Definition at line 705 of file evmc.hpp.
+
+
|
+ +inlinenoexcept | +
Returns the pointer to C EVMC struct representing the VM.
+Gives access to the C EVMC VM struct to allow advanced interaction with the VM not supported by the C++ interface. Use as the last resort. This object still owns the VM after returning the pointer. The returned pointer MAY be null.
+ +Definition at line 759 of file evmc.hpp.
+
+
|
+ +inlinenoexcept | +
Checks if the VM has the given capability.
+ +Definition at line 699 of file evmc.hpp.
+
+
|
+ +inlinenoexcept | +
Checks whenever the VM instance is ABI compatible with the current EVMC API.
+ +Definition at line 690 of file evmc.hpp.
+
+
|
+ +inlinenoexcept | +
+
|
+ +inlineexplicitnoexcept | +
Move assignment operator.
+ +Definition at line 673 of file evmc.hpp.
+
+
|
+ +inlinenoexcept | +
Sets the option for the VM, if the feature is supported by the VM.
+Definition at line 711 of file evmc.hpp.
+
+
|
+ +inlinenoexcept | +
The version of the EVMC VM implementation, e.g.
+"1.2.3b4".
+It MUST be a NULL-terminated not empty string. The content MUST be UTF-8 encoded (this implies ASCII encoding is also allowed).
+ +Definition at line 696 of file evmc.hpp.
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+Files | |
file | bytes.hpp [code] |
file | evmc.h [code] |
file | evmc.hpp [code] |
file | filter_iterator.hpp [code] |
file | helpers.h [code] |
file | hex.hpp [code] |
file | instructions.h [code] |
file | loader.h [code] |
file | mocked_host.hpp [code] |
file | tooling.hpp [code] |
file | utils.h [code] |
A collection of helper macros to handle some non-portable features of C/C++ compilers. | |
+ EVMC
+
+ |
+
+Files | |
file | example_vm.cpp [code] |
Example implementation of the EVMC VM interface. | |
+ EVMC
+
+ |
+
+Directories | |
directory | example_vm |
+ EVMC
+
+ |
+
+Directories | |
directory | evmc |
+ EVMC
+
+ |
+
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
++Classes | |
struct | evmc_bytes32 |
The fixed size array of 32 bytes. More... | |
struct | evmc_address |
Big-endian 160-bit hash suitable for keeping an Ethereum address. More... | |
struct | evmc_message |
The message describing an EVM call, including a zero-depth calls from a transaction origin. More... | |
struct | evmc_tx_initcode |
The hashed initcode used for TXCREATE instruction. More... | |
struct | evmc_tx_context |
The transaction and block data for execution. More... | |
struct | evmc_result |
The EVM code execution result. More... | |
struct | evmc_host_interface |
The Host interface. More... | |
struct | evmc_vm |
The VM instance. More... | |
+Typedefs | |
typedef struct evmc_bytes32 | evmc_bytes32 |
The fixed size array of 32 bytes. | |
typedef struct evmc_bytes32 | evmc_uint256be |
The alias for evmc_bytes32 to represent a big-endian 256-bit integer. | |
+typedef struct evmc_address | evmc_address |
Big-endian 160-bit hash suitable for keeping an Ethereum address. | |
+typedef struct evmc_tx_initcode | evmc_tx_initcode |
The hashed initcode used for TXCREATE instruction. | |
typedef struct evmc_tx_context(* | evmc_get_tx_context_fn) (struct evmc_host_context *context) |
Get transaction context callback function. | |
typedef evmc_bytes32(* | evmc_get_block_hash_fn) (struct evmc_host_context *context, int64_t number) |
Get block hash callback function. | |
typedef void(* | evmc_release_result_fn) (const struct evmc_result *result) |
Releases resources assigned to an execution result. | |
typedef bool(* | evmc_account_exists_fn) (struct evmc_host_context *context, const evmc_address *address) |
Check account existence callback function. | |
typedef evmc_bytes32(* | evmc_get_storage_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_bytes32 *key) |
Get storage callback function. | |
typedef evmc_bytes32(* | evmc_get_transient_storage_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_bytes32 *key) |
Get transient storage callback function. | |
typedef enum evmc_storage_status(* | evmc_set_storage_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_bytes32 *key, const evmc_bytes32 *value) |
Set storage callback function. | |
typedef void(* | evmc_set_transient_storage_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_bytes32 *key, const evmc_bytes32 *value) |
Set transient storage callback function. | |
typedef evmc_uint256be(* | evmc_get_balance_fn) (struct evmc_host_context *context, const evmc_address *address) |
Get balance callback function. | |
typedef size_t(* | evmc_get_code_size_fn) (struct evmc_host_context *context, const evmc_address *address) |
Get code size callback function. | |
typedef evmc_bytes32(* | evmc_get_code_hash_fn) (struct evmc_host_context *context, const evmc_address *address) |
Get code hash callback function. | |
typedef size_t(* | evmc_copy_code_fn) (struct evmc_host_context *context, const evmc_address *address, size_t code_offset, uint8_t *buffer_data, size_t buffer_size) |
Copy code callback function. | |
typedef bool(* | evmc_selfdestruct_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_address *beneficiary) |
Selfdestruct callback function. | |
typedef void(* | evmc_emit_log_fn) (struct evmc_host_context *context, const evmc_address *address, const uint8_t *data, size_t data_size, const evmc_bytes32 topics[], size_t topics_count) |
Log callback function. | |
typedef enum evmc_access_status(* | evmc_access_account_fn) (struct evmc_host_context *context, const evmc_address *address) |
Access account callback function. | |
typedef enum evmc_access_status(* | evmc_access_storage_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_bytes32 *key) |
Access storage callback function. | |
typedef struct evmc_result(* | evmc_call_fn) (struct evmc_host_context *context, const struct evmc_message *msg) |
Pointer to the callback function supporting EVM calls. | |
typedef void(* | evmc_destroy_fn) (struct evmc_vm *vm) |
Destroys the VM instance. | |
typedef enum evmc_set_option_result(* | evmc_set_option_fn) (struct evmc_vm *vm, char const *name, char const *value) |
Configures the VM instance. | |
typedef struct evmc_result(* | evmc_execute_fn) (struct evmc_vm *vm, const struct evmc_host_interface *host, struct evmc_host_context *context, enum evmc_revision rev, const struct evmc_message *msg, uint8_t const *code, size_t code_size) |
Executes the given code using the input from the message. | |
typedef uint32_t | evmc_capabilities_flagset |
Alias for unsigned integer representing a set of bit flags of EVMC capabilities. | |
typedef evmc_capabilities_flagset(* | evmc_get_capabilities_fn) (struct evmc_vm *vm) |
Return the supported capabilities of the VM instance. | |
+Functions | |
struct evmc_vm * | evmc_create_example_vm (void) |
Example of a function creating an instance of an example EVM implementation. | |
EVMC: Ethereum Client-VM Connector API.
+Definition in file evmc.h.
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
#include <evmc/evmc.h>
#include <evmc/helpers.h>
#include <evmc/hex.hpp>
#include <functional>
#include <initializer_list>
#include <ostream>
#include <string_view>
#include <utility>
Go to the source code of this file.
++Classes | |
struct | evmc::address |
The big-endian 160-bit hash suitable for keeping an Ethereum address. More... | |
struct | evmc::bytes32 |
The fixed size array of 32 bytes for storing 256-bit EVM values. More... | |
class | evmc::Result |
The EVM code execution result. More... | |
class | evmc::HostInterface |
The EVMC Host interface. More... | |
class | evmc::HostContext |
Wrapper around EVMC host context / host interface. More... | |
class | evmc::Host |
Abstract class to be used by Host implementations. More... | |
class | evmc::VM |
The VM instance. More... | |
+Namespaces | |
namespace | evmc |
EVMC C++ API - wrappers and bindings for C++. | |
+Typedefs | |
using | evmc::uint256be = bytes32 |
The alias for evmc::bytes32 to represent a big-endian 256-bit integer. | |
+Functions | |
constexpr uint64_t | evmc::load64be (const uint8_t *data) noexcept |
Loads 64 bits / 8 bytes of data from the given data array in big-endian order. | |
constexpr uint64_t | evmc::load64le (const uint8_t *data) noexcept |
Loads 64 bits / 8 bytes of data from the given data array in little-endian order. | |
constexpr uint32_t | evmc::load32be (const uint8_t *data) noexcept |
Loads 32 bits / 4 bytes of data from the given data array in big-endian order. | |
constexpr uint32_t | evmc::load32le (const uint8_t *data) noexcept |
Loads 32 bits / 4 bytes of data from the given data array in little-endian order. | |
constexpr uint64_t | evmc::fnv::fnv1a_by64 (uint64_t h, uint64_t x) noexcept |
The hashing transformation for 64-bit inputs based on the FNV-1a formula. | |
constexpr bool | evmc::operator== (const address &a, const address &b) noexcept |
The "equal to" comparison operator for the evmc::address type. | |
constexpr bool | evmc::operator!= (const address &a, const address &b) noexcept |
The "not equal to" comparison operator for the evmc::address type. | |
constexpr bool | evmc::operator< (const address &a, const address &b) noexcept |
The "less than" comparison operator for the evmc::address type. | |
constexpr bool | evmc::operator> (const address &a, const address &b) noexcept |
The "greater than" comparison operator for the evmc::address type. | |
constexpr bool | evmc::operator<= (const address &a, const address &b) noexcept |
The "less than or equal to" comparison operator for the evmc::address type. | |
constexpr bool | evmc::operator>= (const address &a, const address &b) noexcept |
The "greater than or equal to" comparison operator for the evmc::address type. | |
constexpr bool | evmc::operator== (const bytes32 &a, const bytes32 &b) noexcept |
The "equal to" comparison operator for the evmc::bytes32 type. | |
constexpr bool | evmc::operator!= (const bytes32 &a, const bytes32 &b) noexcept |
The "not equal to" comparison operator for the evmc::bytes32 type. | |
constexpr bool | evmc::operator< (const bytes32 &a, const bytes32 &b) noexcept |
The "less than" comparison operator for the evmc::bytes32 type. | |
constexpr bool | evmc::operator> (const bytes32 &a, const bytes32 &b) noexcept |
The "greater than" comparison operator for the evmc::bytes32 type. | |
constexpr bool | evmc::operator<= (const bytes32 &a, const bytes32 &b) noexcept |
The "less than or equal to" comparison operator for the evmc::bytes32 type. | |
constexpr bool | evmc::operator>= (const bytes32 &a, const bytes32 &b) noexcept |
The "greater than or equal to" comparison operator for the evmc::bytes32 type. | |
constexpr bool | evmc::is_zero (const address &a) noexcept |
Checks if the given address is the zero address. | |
constexpr bool | evmc::is_zero (const bytes32 &a) noexcept |
Checks if the given bytes32 object has all zero bytes. | |
template<typename T > | |
constexpr T | evmc::literals::parse (std::string_view s) noexcept |
Converts a raw literal into value of type T. | |
constexpr address | evmc::literals::operator""_address (const char *s) noexcept |
Literal for evmc::address. | |
constexpr bytes32 | evmc::literals::operator""_bytes32 (const char *s) noexcept |
Literal for evmc::bytes32. | |
const char * | evmc::to_string (evmc_status_code status_code) noexcept |
Returns text representation of the evmc_status_code. | |
const char * | evmc::to_string (evmc_revision rev) noexcept |
Returns the name of the evmc_revision. | |
std::ostream & | operator<< (std::ostream &os, evmc_status_code status_code) |
"Stream out" operator implementation for evmc_status_code. | |
std::ostream & | operator<< (std::ostream &os, evmc_revision rev) |
"Stream out" operator implementation for evmc_revision. | |
+Variables | |
constexpr auto | evmc::fnv::prime = 0x100000001b3 |
The 64-bit FNV prime number. | |
constexpr auto | evmc::fnv::offset_basis = 0xcbf29ce484222325 |
The 64-bit FNV offset basis. | |
constexpr auto | evmc::make_result = evmc_make_result |
Alias for evmc_make_result(). | |
EVMC C++ API - wrappers and bindings for C++.
+ +Definition in file evmc.hpp.
+
+
|
+ +inlineconstexprnoexcept | +
+
|
+ +constexprnoexcept | +
Literal for evmc::address.
+ +Definition at line 293 of file evmc.hpp.
+
+
|
+ +constexprnoexcept | +
Literal for evmc::bytes32.
+ +Definition at line 299 of file evmc.hpp.
+
+
|
+ +inline | +
"Stream out" operator implementation for evmc_revision.
+Definition at line 920 of file evmc.hpp.
+
+
|
+ +inline | +
"Stream out" operator implementation for evmc_status_code.
+
+
|
+ +constexprnoexcept | +
Converts a raw literal into value of type T.
+This function is expected to be used on literals in constexpr context only. In case the input is invalid the std::terminate() is called. TODO(c++20): Use consteval.
+ +Definition at line 287 of file evmc.hpp.
+
+
|
+ +constexpr | +
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
Example implementation of the EVMC VM interface. +More...
+#include "example_vm.h"
#include <evmc/evmc.h>
#include <evmc/helpers.h>
#include <evmc/instructions.h>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
Go to the source code of this file.
++Functions | |
evmc_vm * | evmc_create_example_vm () |
Example of a function creating an instance of an example EVM implementation. | |
Example implementation of the EVMC VM interface.
+This VM implements a subset of EVM instructions in simplistic, incorrect and unsafe way:
Definition in file example_vm.cpp.
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
▼ examples | |
▼ example_vm | |
example_vm.cpp | Example implementation of the EVMC VM interface |
▼ include | |
▼ evmc | |
bytes.hpp | |
evmc.h | |
evmc.hpp | |
filter_iterator.hpp | |
helpers.h | |
hex.hpp | |
instructions.h | |
loader.h | |
mocked_host.hpp | |
tooling.hpp | |
utils.h | A collection of helper macros to handle some non-portable features of C/C++ compilers |
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
EVMC: Ethereum Client-VM Connector API. +More...
++Classes | |
struct | evmc_bytes32 |
The fixed size array of 32 bytes. More... | |
struct | evmc_address |
Big-endian 160-bit hash suitable for keeping an Ethereum address. More... | |
struct | evmc_message |
The message describing an EVM call, including a zero-depth calls from a transaction origin. More... | |
struct | evmc_tx_initcode |
The hashed initcode used for TXCREATE instruction. More... | |
struct | evmc_tx_context |
The transaction and block data for execution. More... | |
struct | evmc_result |
The EVM code execution result. More... | |
struct | evmc_host_interface |
The Host interface. More... | |
struct | evmc_vm |
The VM instance. More... | |
struct | evmc_host_context |
The opaque data type representing the Host execution context. More... | |
+Typedefs | |
typedef struct evmc_bytes32 | evmc_bytes32 |
The fixed size array of 32 bytes. | |
typedef struct evmc_bytes32 | evmc_uint256be |
The alias for evmc_bytes32 to represent a big-endian 256-bit integer. | |
+typedef struct evmc_address | evmc_address |
Big-endian 160-bit hash suitable for keeping an Ethereum address. | |
+typedef struct evmc_tx_initcode | evmc_tx_initcode |
The hashed initcode used for TXCREATE instruction. | |
typedef struct evmc_tx_context(* | evmc_get_tx_context_fn) (struct evmc_host_context *context) |
Get transaction context callback function. | |
typedef evmc_bytes32(* | evmc_get_block_hash_fn) (struct evmc_host_context *context, int64_t number) |
Get block hash callback function. | |
typedef void(* | evmc_release_result_fn) (const struct evmc_result *result) |
Releases resources assigned to an execution result. | |
typedef bool(* | evmc_account_exists_fn) (struct evmc_host_context *context, const evmc_address *address) |
Check account existence callback function. | |
typedef evmc_bytes32(* | evmc_get_storage_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_bytes32 *key) |
Get storage callback function. | |
typedef evmc_bytes32(* | evmc_get_transient_storage_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_bytes32 *key) |
Get transient storage callback function. | |
typedef enum evmc_storage_status(* | evmc_set_storage_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_bytes32 *key, const evmc_bytes32 *value) |
Set storage callback function. | |
typedef void(* | evmc_set_transient_storage_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_bytes32 *key, const evmc_bytes32 *value) |
Set transient storage callback function. | |
typedef evmc_uint256be(* | evmc_get_balance_fn) (struct evmc_host_context *context, const evmc_address *address) |
Get balance callback function. | |
typedef size_t(* | evmc_get_code_size_fn) (struct evmc_host_context *context, const evmc_address *address) |
Get code size callback function. | |
typedef evmc_bytes32(* | evmc_get_code_hash_fn) (struct evmc_host_context *context, const evmc_address *address) |
Get code hash callback function. | |
typedef size_t(* | evmc_copy_code_fn) (struct evmc_host_context *context, const evmc_address *address, size_t code_offset, uint8_t *buffer_data, size_t buffer_size) |
Copy code callback function. | |
typedef bool(* | evmc_selfdestruct_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_address *beneficiary) |
Selfdestruct callback function. | |
typedef void(* | evmc_emit_log_fn) (struct evmc_host_context *context, const evmc_address *address, const uint8_t *data, size_t data_size, const evmc_bytes32 topics[], size_t topics_count) |
Log callback function. | |
typedef enum evmc_access_status(* | evmc_access_account_fn) (struct evmc_host_context *context, const evmc_address *address) |
Access account callback function. | |
typedef enum evmc_access_status(* | evmc_access_storage_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_bytes32 *key) |
Access storage callback function. | |
typedef struct evmc_result(* | evmc_call_fn) (struct evmc_host_context *context, const struct evmc_message *msg) |
Pointer to the callback function supporting EVM calls. | |
typedef void(* | evmc_destroy_fn) (struct evmc_vm *vm) |
Destroys the VM instance. | |
typedef enum evmc_set_option_result(* | evmc_set_option_fn) (struct evmc_vm *vm, char const *name, char const *value) |
Configures the VM instance. | |
typedef struct evmc_result(* | evmc_execute_fn) (struct evmc_vm *vm, const struct evmc_host_interface *host, struct evmc_host_context *context, enum evmc_revision rev, const struct evmc_message *msg, uint8_t const *code, size_t code_size) |
Executes the given code using the input from the message. | |
typedef uint32_t | evmc_capabilities_flagset |
Alias for unsigned integer representing a set of bit flags of EVMC capabilities. | |
typedef evmc_capabilities_flagset(* | evmc_get_capabilities_fn) (struct evmc_vm *vm) |
Return the supported capabilities of the VM instance. | |
+Functions | |
struct evmc_vm * | evmc_create_example_vm (void) |
Example of a function creating an instance of an example EVM implementation. | |
EVMC: Ethereum Client-VM Connector API.
+typedef enum evmc_access_status(* evmc_access_account_fn) (struct evmc_host_context *context, const evmc_address *address) | +
Access account callback function.
+This callback function is used by a VM to add the given address to accessed_addresses substate (EIP-2929).
+context | The Host execution context. |
address | The address of the account. |
typedef enum evmc_access_status(* evmc_access_storage_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_bytes32 *key) | +
Access storage callback function.
+This callback function is used by a VM to add the given account storage entry to accessed_storage_keys substate (EIP-2929).
+context | The Host execution context. |
address | The address of the account. |
key | The index of the account's storage entry. |
typedef bool(* evmc_account_exists_fn) (struct evmc_host_context *context, const evmc_address *address) | +
Check account existence callback function.
+This callback function is used by the VM to check if there exists an account at given address.
context | The pointer to the Host execution context. |
address | The address of the account the query is about. |
typedef struct evmc_bytes32 evmc_bytes32 | +
The fixed size array of 32 bytes.
+32 bytes of data capable of storing e.g. 256-bit hashes.
+ +typedef struct evmc_result(* evmc_call_fn) (struct evmc_host_context *context, const struct evmc_message *msg) | +
typedef uint32_t evmc_capabilities_flagset | +
Alias for unsigned integer representing a set of bit flags of EVMC capabilities.
+typedef size_t(* evmc_copy_code_fn) (struct evmc_host_context *context, const evmc_address *address, size_t code_offset, uint8_t *buffer_data, size_t buffer_size) | +
Copy code callback function.
+This callback function is used by an EVM to request a copy of the code of the given account to the memory buffer provided by the EVM. The Client MUST copy the requested code, starting with the given offset, to the provided memory buffer up to the size of the buffer or the size of the code, whichever is smaller.
+context | The pointer to the Host execution context. See evmc_host_context. |
address | The address of the account. |
code_offset | The offset of the code to copy. |
buffer_data | The pointer to the memory buffer allocated by the EVM to store a copy of the requested code. |
buffer_size | The size of the memory buffer. |
typedef void(* evmc_destroy_fn) (struct evmc_vm *vm) | +
typedef void(* evmc_emit_log_fn) (struct evmc_host_context *context, const evmc_address *address, const uint8_t *data, size_t data_size, const evmc_bytes32 topics[], size_t topics_count) | +
Log callback function.
+This callback function is used by an EVM to inform about a LOG that happened during an EVM bytecode execution.
+context | The pointer to the Host execution context. See evmc_host_context. |
address | The address of the contract that generated the log. |
data | The pointer to unindexed data attached to the log. |
data_size | The length of the data. |
topics | The pointer to the array of topics attached to the log. |
topics_count | The number of the topics. Valid values are between 0 and 4 inclusively. |
typedef struct evmc_result(* evmc_execute_fn) (struct evmc_vm *vm, const struct evmc_host_interface *host, struct evmc_host_context *context, enum evmc_revision rev, const struct evmc_message *msg, uint8_t const *code, size_t code_size) | +
Executes the given code using the input from the message.
+This function MAY be invoked multiple times for a single VM instance.
+vm | The VM instance. This argument MUST NOT be NULL. |
host | The Host interface. This argument MUST NOT be NULL unless the vm has the EVMC_CAPABILITY_PRECOMPILES capability. |
context | The opaque pointer to the Host execution context. This argument MAY be NULL. The VM MUST pass the same pointer to the methods of the host interface. The VM MUST NOT dereference the pointer. |
rev | The requested EVM specification revision. |
msg | The call parameters. See evmc_message. This argument MUST NOT be NULL. |
code | The reference to the code to be executed. This argument MAY be NULL. |
code_size | The length of the code. If code is NULL this argument MUST be 0. |
typedef evmc_uint256be(* evmc_get_balance_fn) (struct evmc_host_context *context, const evmc_address *address) | +
Get balance callback function.
+This callback function is used by a VM to query the balance of the given account.
+context | The pointer to the Host execution context. |
address | The address of the account. |
typedef evmc_bytes32(* evmc_get_block_hash_fn) (struct evmc_host_context *context, int64_t number) | +
Get block hash callback function.
+This callback function is used by a VM to query the hash of the header of the given block. If the information about the requested block is not available, then this is signalled by returning null bytes.
+context | The pointer to the Host execution context. |
number | The block number. |
typedef evmc_capabilities_flagset(* evmc_get_capabilities_fn) (struct evmc_vm *vm) | +
Return the supported capabilities of the VM instance.
+This function MAY be invoked multiple times for a single VM instance, and its value MAY be influenced by calls to evmc_vm::set_option.
+vm | The VM instance. |
typedef evmc_bytes32(* evmc_get_code_hash_fn) (struct evmc_host_context *context, const evmc_address *address) | +
Get code hash callback function.
+This callback function is used by a VM to get the keccak256 hash of the code stored in the account at the given address. For existing accounts not having a code, this function returns keccak256 hash of empty data.
+context | The pointer to the Host execution context. |
address | The address of the account. |
typedef size_t(* evmc_get_code_size_fn) (struct evmc_host_context *context, const evmc_address *address) | +
Get code size callback function.
+This callback function is used by a VM to get the size of the code stored in the account at the given address.
+context | The pointer to the Host execution context. |
address | The address of the account. |
typedef evmc_bytes32(* evmc_get_storage_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_bytes32 *key) | +
Get storage callback function.
+This callback function is used by a VM to query the given account storage entry.
+context | The Host execution context. |
address | The address of the account. |
key | The index of the account's storage entry. |
typedef evmc_bytes32(* evmc_get_transient_storage_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_bytes32 *key) | +
Get transient storage callback function.
+This callback function is used by a VM to query the given account transient storage (EIP-1153) entry.
+context | The Host execution context. |
address | The address of the account. |
key | The index of the account's transient storage entry. |
typedef struct evmc_tx_context(* evmc_get_tx_context_fn) (struct evmc_host_context *context) | +
typedef void(* evmc_release_result_fn) (const struct evmc_result *result) | +
Releases resources assigned to an execution result.
+This function releases memory (and other resources, if any) assigned to the specified execution result making the result object invalid.
+result | The execution result which resources are to be released. The result itself it not modified by this function, but becomes invalid and user MUST discard it as well. This MUST NOT be NULL. |
typedef bool(* evmc_selfdestruct_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_address *beneficiary) | +
Selfdestruct callback function.
+This callback function is used by an EVM to SELFDESTRUCT given contract. The execution of the contract will not be stopped, that is up to the EVM.
+context | The pointer to the Host execution context. See evmc_host_context. |
address | The address of the contract to be selfdestructed. |
beneficiary | The address where the remaining ETH is going to be transferred. |
typedef enum evmc_set_option_result(* evmc_set_option_fn) (struct evmc_vm *vm, char const *name, char const *value) | +
Configures the VM instance.
+Allows modifying options of the VM instance. Options:
vm | The VM instance to be configured. |
name | The option name. NULL-terminated string. Cannot be NULL. |
value | The new option value. NULL-terminated string. Cannot be NULL. |
typedef enum evmc_storage_status(* evmc_set_storage_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_bytes32 *key, const evmc_bytes32 *value) | +
Set storage callback function.
+This callback function is used by a VM to update the given account storage entry. The VM MUST make sure that the account exists. This requirement is only a formality because VM implementations only modify storage of the account of the current execution context (i.e. referenced by evmc_message::recipient).
+context | The pointer to the Host execution context. |
address | The address of the account. |
key | The index of the storage entry. |
value | The value to be stored. |
typedef void(* evmc_set_transient_storage_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_bytes32 *key, const evmc_bytes32 *value) | +
Set transient storage callback function.
+This callback function is used by a VM to update the given account's transient storage (EIP-1153) entry. The VM MUST make sure that the account exists. This requirement is only a formality because VM implementations only modify storage of the account of the current execution context (i.e. referenced by evmc_message::recipient).
+context | The pointer to the Host execution context. |
address | The address of the account. |
key | The index of the transient storage entry. |
value | The value to be stored. |
typedef struct evmc_bytes32 evmc_uint256be | +
The alias for evmc_bytes32 to represent a big-endian 256-bit integer.
+ + + +anonymous enum | +
Enumerator | |
---|---|
EVMC_ABI_VERSION | The EVMC ABI version number of the interface declared in this file. +The EVMC ABI version always equals the major version number of the EVMC project. The Host SHOULD check if the ABI versions match when dynamically loading VMs. +
|
Definition at line 37 of file evmc.h.
+enum evmc_access_status | +
Access status per EIP-2929: Gas cost increases for state access opcodes.
+Enumerator | |
---|---|
EVMC_ACCESS_COLD | The entry hasn't been accessed before – it's the first access. + |
EVMC_ACCESS_WARM | The entry is already in accessed_addresses or accessed_storage_keys. + |
Definition at line 783 of file evmc.h.
+enum evmc_call_kind | +
The kind of call-like instruction.
+Definition at line 75 of file evmc.h.
+enum evmc_capabilities | +
Possible capabilities of a VM.
+Enumerator | |
---|---|
EVMC_CAPABILITY_EVM1 | The VM is capable of executing EVM1 bytecode. + |
EVMC_CAPABILITY_EWASM | The VM is capable of executing ewasm bytecode. + |
EVMC_CAPABILITY_PRECOMPILES | The VM is capable of executing the precompiled contracts defined for the range of code addresses. +The EIP-1352 (https://eips.ethereum.org/EIPS/eip-1352) specifies the range 0x000...0000 - 0x000...ffff of addresses reserved for precompiled and system contracts. +This capability is experimental and MAY be removed without notice. + |
Definition at line 1090 of file evmc.h.
+enum evmc_flags | +
The flags for evmc_message.
+Enumerator | |
---|---|
EVMC_STATIC | Static call mode. + |
enum evmc_revision | +
EVM revision.
+The revision of the EVM specification based on the Ethereum upgrade / hard fork codenames.
+Enumerator | |
---|---|
EVMC_FRONTIER | The Frontier revision. +The one Ethereum launched with. + |
EVMC_HOMESTEAD | The Homestead revision. + + |
EVMC_TANGERINE_WHISTLE | The Tangerine Whistle revision. + + |
EVMC_SPURIOUS_DRAGON | The Spurious Dragon revision. + + |
EVMC_BYZANTIUM | The Byzantium revision. + + |
EVMC_CONSTANTINOPLE | The Constantinople revision. + + |
EVMC_PETERSBURG | The Petersburg revision. +Other names: Constantinople2, ConstantinopleFix. + + |
EVMC_ISTANBUL | The Istanbul revision. + + |
EVMC_BERLIN | The Berlin revision. +https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/berlin.md + |
EVMC_LONDON | The London revision. +https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/london.md + |
EVMC_PARIS | The Paris revision (aka The Merge). +https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/paris.md + |
EVMC_SHANGHAI | The Shanghai revision. + + |
EVMC_CANCUN | The Cancun revision. +https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/cancun.md + |
EVMC_PRAGUE | The Prague revision. +The future next revision after Cancun. + |
EVMC_OSAKA | The Osaka revision. +The future next revision after Prague. + |
EVMC_MAX_REVISION | The maximum EVM revision supported. + |
EVMC_LATEST_STABLE_REVISION | The latest known EVM revision with finalized specification. +This is handy for EVM tools to always use the latest revision available. + |
Definition at line 940 of file evmc.h.
+enum evmc_set_option_result | +
enum evmc_status_code | +
The execution status code.
+Successful execution is represented by EVMC_SUCCESS having value 0.
+Positive values represent failures defined by VM specifications with generic EVMC_FAILURE code of value 1.
+Status codes with negative values represent VM internal errors not provided by EVM specifications. These errors MUST not be passed back to the caller. They MAY be handled by the Client in predefined manner (see e.g. EVMC_REJECTED), otherwise internal errors are not recoverable. The generic representant of errors is EVMC_INTERNAL_ERROR but an EVM implementation MAY return negative status codes that are not defined in the EVMC documentation.
+Enumerator | |
---|---|
EVMC_SUCCESS | Execution finished with success. + |
EVMC_FAILURE | Generic execution failure. + |
EVMC_REVERT | Execution terminated with REVERT opcode. +In this case the amount of gas left MAY be non-zero and additional output data MAY be provided in evmc_result. + |
EVMC_OUT_OF_GAS | The execution has run out of gas. + |
EVMC_INVALID_INSTRUCTION | The designated INVALID instruction has been hit during execution. +The EIP-141 (https://github.com/ethereum/EIPs/blob/master/EIPS/eip-141.md) defines the instruction 0xfe as INVALID instruction to indicate execution abortion coming from high-level languages. This status code is reported in case this INVALID instruction has been encountered. + |
EVMC_UNDEFINED_INSTRUCTION | An undefined instruction has been encountered. + |
EVMC_STACK_OVERFLOW | The execution has attempted to put more items on the EVM stack than the specified limit. + |
EVMC_STACK_UNDERFLOW | Execution of an opcode has required more items on the EVM stack. + |
EVMC_BAD_JUMP_DESTINATION | Execution has violated the jump destination restrictions. + |
EVMC_INVALID_MEMORY_ACCESS | Tried to read outside memory bounds. +An example is RETURNDATACOPY reading past the available buffer. + |
EVMC_CALL_DEPTH_EXCEEDED | Call depth has exceeded the limit (if any) + |
EVMC_STATIC_MODE_VIOLATION | Tried to execute an operation which is restricted in static mode. + |
EVMC_PRECOMPILE_FAILURE | A call to a precompiled or system contract has ended with a failure. +An example: elliptic curve functions handed invalid EC points. + |
EVMC_CONTRACT_VALIDATION_FAILURE | Contract validation has failed (e.g. +due to EVM 1.5 jump validity, Casper's purity checker or ewasm contract rules). + |
EVMC_ARGUMENT_OUT_OF_RANGE | An argument to a state accessing method has a value outside of the accepted range of values. + |
EVMC_WASM_UNREACHABLE_INSTRUCTION | A WebAssembly |
EVMC_WASM_TRAP | A WebAssembly trap has been hit during execution. +This can be for many reasons, including division by zero, validation errors, etc. + |
EVMC_INSUFFICIENT_BALANCE | The caller does not have enough funds for value transfer. + |
EVMC_INTERNAL_ERROR | EVM implementation generic internal error. + |
EVMC_REJECTED | The execution of the given code and/or message has been rejected by the EVM implementation. +This error SHOULD be used to signal that the EVM is not able to or willing to execute the given code type or message. If an EVM returns the EVMC_REJECTED status code, the Client MAY try to execute it in other EVM implementation. For example, the Client tries running a code in the EVM 1.5. If the code is not supported there, the execution falls back to the EVM 1.0. + |
EVMC_OUT_OF_MEMORY | The VM failed to allocate the amount of memory needed for execution. + |
Definition at line 283 of file evmc.h.
+enum evmc_storage_status | +
The effect of an attempt to modify a contract storage item.
+See EVM Storage Change Status for additional information about design of this enum and analysis of the specification.
+For the purpose of explaining the meaning of each element, the following notation is used:
The order of elements follows EIPs introducing net storage gas costs:
Definition at line 568 of file evmc.h.
+struct evmc_vm * evmc_create_example_vm | +( | +void | +) | ++ |
Example of a function creating an instance of an example EVM implementation.
+Each EVM implementation MUST provide a function returning an EVM instance. The function SHOULD be named evmc_create_<vm-name>(void)
. If the VM name contains hyphens replaces them with underscores in the function names.
libbeta-interpreter.so
.Definition at line 392 of file example_vm.cpp.
+
+ EVMC
+
+ |
+
+Namespaces | |
namespace | evmc |
EVMC C++ API - wrappers and bindings for C++. | |
EVMC C++ API - wrappers and bindings for C++.
+
+ EVMC
+
+ |
+
EVMC Helpers. +More...
++Modules | |
Result Optional Storage | |
Helpers for optional storage of evmc_result. | |
+Macros | |
#define | EVMC_EXPORT __attribute__((visibility("default"))) |
Marks a function to be exported from a shared library. | |
#define | EVMC_NOEXCEPT |
Safe way of marking a function with noexcept C++ specifier. | |
+Functions | |
static bool | evmc_is_abi_compatible (struct evmc_vm *vm) |
Returns true if the VM has a compatible ABI version. | |
static const char * | evmc_vm_name (struct evmc_vm *vm) |
Returns the name of the VM. | |
static const char * | evmc_vm_version (struct evmc_vm *vm) |
Returns the version of the VM. | |
static bool | evmc_vm_has_capability (struct evmc_vm *vm, enum evmc_capabilities capability) |
Checks if the VM has the given capability. | |
static void | evmc_destroy (struct evmc_vm *vm) |
Destroys the VM instance. | |
static enum evmc_set_option_result | evmc_set_option (struct evmc_vm *vm, char const *name, char const *value) |
Sets the option for the VM, if the feature is supported by the VM. | |
static struct evmc_result | evmc_execute (struct evmc_vm *vm, const struct evmc_host_interface *host, struct evmc_host_context *context, enum evmc_revision rev, const struct evmc_message *msg, uint8_t const *code, size_t code_size) |
Executes code in the VM instance. | |
static void | evmc_free_result_memory (const struct evmc_result *result) |
The evmc_result release function using free() for releasing the memory. | |
static struct evmc_result | evmc_make_result (enum evmc_status_code status_code, int64_t gas_left, int64_t gas_refund, const uint8_t *output_data, size_t output_size) |
Creates the result from the provided arguments. | |
static void | evmc_release_result (struct evmc_result *result) |
Releases the resources allocated to the execution result. | |
static const char * | evmc_status_code_to_string (enum evmc_status_code status_code) |
Returns text representation of the evmc_status_code. | |
static const char * | evmc_revision_to_string (enum evmc_revision rev) |
Returns the name of the evmc_revision. | |
EVMC Helpers.
+A collection of C helper functions for invoking a VM instance methods. These are convenient for languages where invoking function pointers is "ugly" or impossible (such as Go).
+#define EVMC_EXPORT __attribute__((visibility("default"))) | +
#define EVMC_NOEXCEPT | +
+
|
+ +inlinestatic | +
Destroys the VM instance.
+Definition at line 68 of file helpers.h.
+
+
|
+ +inlinestatic | +
Executes code in the VM instance.
+Definition at line 92 of file helpers.h.
+
+
|
+ +static | +
The evmc_result release function using free() for releasing the memory.
+This function is used in the evmc_make_result(), but may be also used in other case if convenient.
+result | The result object. |
Definition at line 109 of file helpers.h.
+
+
|
+ +inlinestatic | +
Returns true if the VM has a compatible ABI version.
+ +Definition at line 32 of file helpers.h.
+
+
|
+ +inlinestatic | +
Creates the result from the provided arguments.
+The provided output is copied to memory allocated with malloc() and the evmc_result::release function is set to one invoking free().
+In case of memory allocation failure, the result has all fields zeroed and only evmc_result::status_code is set to EVMC_OUT_OF_MEMORY internal error.
+status_code | The status code. |
gas_left | The amount of gas left. |
gas_refund | The amount of refunded gas. |
output_data | The pointer to the output. |
output_size | The output size. |
Definition at line 127 of file helpers.h.
+
+
|
+ +inlinestatic | +
Releases the resources allocated to the execution result.
+result | The result object to be released. MUST NOT be NULL. |
Definition at line 165 of file helpers.h.
+
+
|
+ +inlinestatic | +
Returns the name of the evmc_revision.
+ +Definition at line 272 of file helpers.h.
+
+
|
+ +inlinestatic | +
Sets the option for the VM, if the feature is supported by the VM.
+Definition at line 78 of file helpers.h.
+
+
|
+ +inlinestatic | +
Returns text representation of the evmc_status_code.
+ +Definition at line 221 of file helpers.h.
+
+
|
+ +inlinestatic | +
Checks if the VM has the given capability.
+Definition at line 58 of file helpers.h.
+
+
|
+ +inlinestatic | +
+
|
+ +inlinestatic | +
Returns the version of the VM.
+ +Definition at line 48 of file helpers.h.
+
+ EVMC
+
+ |
+
EVM Instruction Tables. +More...
++Classes | |
struct | evmc_instruction_metrics |
Metrics for an EVM 1 instruction. More... | |
+Enumerations | |
enum | evmc_opcode { + OP_STOP = 0x00 +, OP_ADD = 0x01 +, OP_MUL = 0x02 +, OP_SUB = 0x03 +, + OP_DIV = 0x04 +, OP_SDIV = 0x05 +, OP_MOD = 0x06 +, OP_SMOD = 0x07 +, + OP_ADDMOD = 0x08 +, OP_MULMOD = 0x09 +, OP_EXP = 0x0a +, OP_SIGNEXTEND = 0x0b +, + OP_LT = 0x10 +, OP_GT = 0x11 +, OP_SLT = 0x12 +, OP_SGT = 0x13 +, + OP_EQ = 0x14 +, OP_ISZERO = 0x15 +, OP_AND = 0x16 +, OP_OR = 0x17 +, + OP_XOR = 0x18 +, OP_NOT = 0x19 +, OP_BYTE = 0x1a +, OP_SHL = 0x1b +, + OP_SHR = 0x1c +, OP_SAR = 0x1d +, OP_KECCAK256 = 0x20 +, OP_ADDRESS = 0x30 +, + OP_BALANCE = 0x31 +, OP_ORIGIN = 0x32 +, OP_CALLER = 0x33 +, OP_CALLVALUE = 0x34 +, + OP_CALLDATALOAD = 0x35 +, OP_CALLDATASIZE = 0x36 +, OP_CALLDATACOPY = 0x37 +, OP_CODESIZE = 0x38 +, + OP_CODECOPY = 0x39 +, OP_GASPRICE = 0x3a +, OP_EXTCODESIZE = 0x3b +, OP_EXTCODECOPY = 0x3c +, + OP_RETURNDATASIZE = 0x3d +, OP_RETURNDATACOPY = 0x3e +, OP_EXTCODEHASH = 0x3f +, OP_BLOCKHASH = 0x40 +, + OP_COINBASE = 0x41 +, OP_TIMESTAMP = 0x42 +, OP_NUMBER = 0x43 +, OP_PREVRANDAO = 0x44 +, + OP_GASLIMIT = 0x45 +, OP_CHAINID = 0x46 +, OP_SELFBALANCE = 0x47 +, OP_BASEFEE = 0x48 +, + OP_POP = 0x50 +, OP_MLOAD = 0x51 +, OP_MSTORE = 0x52 +, OP_MSTORE8 = 0x53 +, + OP_SLOAD = 0x54 +, OP_SSTORE = 0x55 +, OP_JUMP = 0x56 +, OP_JUMPI = 0x57 +, + OP_PC = 0x58 +, OP_MSIZE = 0x59 +, OP_GAS = 0x5a +, OP_JUMPDEST = 0x5b +, + OP_PUSH0 = 0x5f +, OP_PUSH1 = 0x60 +, OP_PUSH2 = 0x61 +, OP_PUSH3 = 0x62 +, + OP_PUSH4 = 0x63 +, OP_PUSH5 = 0x64 +, OP_PUSH6 = 0x65 +, OP_PUSH7 = 0x66 +, + OP_PUSH8 = 0x67 +, OP_PUSH9 = 0x68 +, OP_PUSH10 = 0x69 +, OP_PUSH11 = 0x6a +, + OP_PUSH12 = 0x6b +, OP_PUSH13 = 0x6c +, OP_PUSH14 = 0x6d +, OP_PUSH15 = 0x6e +, + OP_PUSH16 = 0x6f +, OP_PUSH17 = 0x70 +, OP_PUSH18 = 0x71 +, OP_PUSH19 = 0x72 +, + OP_PUSH20 = 0x73 +, OP_PUSH21 = 0x74 +, OP_PUSH22 = 0x75 +, OP_PUSH23 = 0x76 +, + OP_PUSH24 = 0x77 +, OP_PUSH25 = 0x78 +, OP_PUSH26 = 0x79 +, OP_PUSH27 = 0x7a +, + OP_PUSH28 = 0x7b +, OP_PUSH29 = 0x7c +, OP_PUSH30 = 0x7d +, OP_PUSH31 = 0x7e +, + OP_PUSH32 = 0x7f +, OP_DUP1 = 0x80 +, OP_DUP2 = 0x81 +, OP_DUP3 = 0x82 +, + OP_DUP4 = 0x83 +, OP_DUP5 = 0x84 +, OP_DUP6 = 0x85 +, OP_DUP7 = 0x86 +, + OP_DUP8 = 0x87 +, OP_DUP9 = 0x88 +, OP_DUP10 = 0x89 +, OP_DUP11 = 0x8a +, + OP_DUP12 = 0x8b +, OP_DUP13 = 0x8c +, OP_DUP14 = 0x8d +, OP_DUP15 = 0x8e +, + OP_DUP16 = 0x8f +, OP_SWAP1 = 0x90 +, OP_SWAP2 = 0x91 +, OP_SWAP3 = 0x92 +, + OP_SWAP4 = 0x93 +, OP_SWAP5 = 0x94 +, OP_SWAP6 = 0x95 +, OP_SWAP7 = 0x96 +, + OP_SWAP8 = 0x97 +, OP_SWAP9 = 0x98 +, OP_SWAP10 = 0x99 +, OP_SWAP11 = 0x9a +, + OP_SWAP12 = 0x9b +, OP_SWAP13 = 0x9c +, OP_SWAP14 = 0x9d +, OP_SWAP15 = 0x9e +, + OP_SWAP16 = 0x9f +, OP_LOG0 = 0xa0 +, OP_LOG1 = 0xa1 +, OP_LOG2 = 0xa2 +, + OP_LOG3 = 0xa3 +, OP_LOG4 = 0xa4 +, OP_CREATE = 0xf0 +, OP_CALL = 0xf1 +, + OP_CALLCODE = 0xf2 +, OP_RETURN = 0xf3 +, OP_DELEGATECALL = 0xf4 +, OP_CREATE2 = 0xf5 +, + OP_STATICCALL = 0xfa +, OP_REVERT = 0xfd +, OP_INVALID = 0xfe +, OP_SELFDESTRUCT = 0xff + + } |
The list of EVM 1 opcodes from every EVM revision. More... | |
+Functions | |
EVMC_EXPORT const struct evmc_instruction_metrics * | evmc_get_instruction_metrics_table (enum evmc_revision revision) |
Get the table of the EVM 1 instructions metrics. | |
EVMC_EXPORT const char *const * | evmc_get_instruction_names_table (enum evmc_revision revision) |
Get the table of the EVM 1 instruction names. | |
EVM Instruction Tables.
+A collection of metrics for EVM1 instruction set.
+enum evmc_opcode | +
The list of EVM 1 opcodes from every EVM revision.
+ +Definition at line 25 of file instructions.h.
+EVMC_EXPORT const struct evmc_instruction_metrics * evmc_get_instruction_metrics_table | +( | +enum evmc_revision | +revision | ) | ++ |
Get the table of the EVM 1 instructions metrics.
+revision | The EVM revision. |
EVMC_EXPORT const char *const * evmc_get_instruction_names_table | +( | +enum evmc_revision | +revision | ) | ++ |
Get the table of the EVM 1 instruction names.
+The entries for undefined instructions contain null pointers.
+revision | The EVM revision. |
+ EVMC
+
+ |
+
EVMC Loader Library. +More...
++Typedefs | |
typedef struct evmc_vm *(* | evmc_create_fn) (void) |
The function pointer type for EVMC create functions. | |
+Enumerations | |
enum | evmc_loader_error_code { + EVMC_LOADER_SUCCESS = 0 +, EVMC_LOADER_CANNOT_OPEN = 1 +, EVMC_LOADER_SYMBOL_NOT_FOUND = 2 +, EVMC_LOADER_INVALID_ARGUMENT = 3 +, + EVMC_LOADER_VM_CREATION_FAILURE = 4 +, EVMC_LOADER_ABI_VERSION_MISMATCH = 5 +, EVMC_LOADER_INVALID_OPTION_NAME = 6 +, EVMC_LOADER_INVALID_OPTION_VALUE = 7 +, + EVMC_LOADER_UNSPECIFIED_ERROR = -1 + + } |
Error codes for the EVMC loader. More... | |
+Functions | |
evmc_create_fn | evmc_load (const char *filename, enum evmc_loader_error_code *error_code) |
Dynamically loads the EVMC module with a VM implementation. | |
struct evmc_vm * | evmc_load_and_create (const char *filename, enum evmc_loader_error_code *error_code) |
Dynamically loads the EVMC module and creates the VM instance. | |
struct evmc_vm * | evmc_load_and_configure (const char *config, enum evmc_loader_error_code *error_code) |
Dynamically loads the EVMC module, then creates and configures the VM instance. | |
const char * | evmc_last_error_msg (void) |
Returns the human-readable message describing the most recent error that occurred in EVMC loading since the last call to this function. | |
EVMC Loader Library.
+The EVMC Loader Library supports loading VMs implemented as Dynamically Loaded Libraries (DLLs, shared objects).
+typedef struct evmc_vm *(* evmc_create_fn) (void) | +
enum evmc_loader_error_code | +
Error codes for the EVMC loader.
+Objects of this type SHOULD be initialized with EVMC_LOADER_UNSPECIFIED_ERROR before passing to the EVMC loader.
+Definition at line 27 of file loader.h.
+const char * evmc_last_error_msg | +( | +void | +) | ++ |
Returns the human-readable message describing the most recent error that occurred in EVMC loading since the last call to this function.
+In case any loading function returned EVMC_LOADER_SUCCESS this function always returns NULL. In case of error code other than success returned, this function MAY return the error message. Calling this function "consumes" the error message and the function will return NULL from subsequent invocations. This function is not thread-safe.
+evmc_create_fn evmc_load | +( | +const char * | +filename, | +
+ | + | enum evmc_loader_error_code * | +error_code | +
+ | ) | ++ |
Dynamically loads the EVMC module with a VM implementation.
+This function tries to open a dynamically loaded library (DLL) at the given filename
. On UNIX-like systems dlopen() function is used. On Windows LoadLibrary() function is used.
If the file does not exist or is not a valid shared library the EVMC_LOADER_CANNOT_OPEN error code is signaled and NULL is returned.
+After the DLL is successfully loaded the function tries to find the EVM create function in the library. The filename
is used to guess the EVM name and the name of the create function. The create function name is constructed by the following rules. Consider example path: "/ethereum/libexample-interpreter.so.1.0".
If the create function is found in the library, the pointer to the function is returned. Otherwise, the EVMC_LOADER_SYMBOL_NOT_FOUND error code is signaled and NULL is returned.
+It is safe to call this function with the same filename argument multiple times (the DLL is not going to be loaded multiple times).
+filename | The null terminated path (absolute or relative) to an EVMC module (dynamically loaded library) containing the VM implementation. If the value is NULL, an empty C-string or longer than the path maximum length the EVMC_LOADER_INVALID_ARGUMENT is signaled. |
error_code | The pointer to the error code. If not NULL the value is set to EVMC_LOADER_SUCCESS on success or any other error code as described above. |
struct evmc_vm * evmc_load_and_configure | +( | +const char * | +config, | +
+ | + | enum evmc_loader_error_code * | +error_code | +
+ | ) | ++ |
Dynamically loads the EVMC module, then creates and configures the VM instance.
+This function performs the following actions atomically:
config
parameter.The configuration string (config
) has the following syntax:
<path> ("," <option-name> ["=" <option-value>])* +
In this syntax, an option without a value can be specified (,option,
) as a shortcut for using empty value (,option=,
).
Options are passed to a VM in the order they are specified in the configuration string. It is up to the VM implementation how to handle duplicated options and other conflicts.
+Example configuration string:
./modules/vm.so,engine=compiler,trace,verbosity=2 +
The function signals the same errors as evmc_load_and_create() and additionally:
config | The path to the EVMC module with additional configuration options. |
error_code | The pointer to the error code. If not NULL the value is set to EVMC_LOADER_SUCCESS on success or any other error code as described above. |
struct evmc_vm * evmc_load_and_create | +( | +const char * | +filename, | +
+ | + | enum evmc_loader_error_code * | +error_code | +
+ | ) | ++ |
Dynamically loads the EVMC module and creates the VM instance.
+This is a macro for creating the VM instance with the function returned from evmc_load(). The function signals the same errors as evmc_load() and additionally:
It is safe to call this function with the same filename argument multiple times: the DLL is not going to be loaded multiple times, but the function will return new VM instance each time.
+filename | The null terminated path (absolute or relative) to an EVMC module (dynamically loaded library) containing the VM implementation. If the value is NULL, an empty C-string or longer than the path maximum length the EVMC_LOADER_INVALID_ARGUMENT is signaled. |
error_code | The pointer to the error code. If not NULL the value is set to EVMC_LOADER_SUCCESS on success or any other error code as described above. |
+ EVMC
+
+ |
+
Helpers for optional storage of evmc_result. +More...
++Classes | |
union | evmc_result_optional_storage |
The union representing evmc_result "optional storage". More... | |
+Functions | |
static union evmc_result_optional_storage * | evmc_get_optional_storage (struct evmc_result *result) |
Provides read-write access to evmc_result "optional storage". | |
static const union evmc_result_optional_storage * | evmc_get_const_optional_storage (const struct evmc_result *result) |
Provides read-only access to evmc_result "optional storage". | |
Helpers for optional storage of evmc_result.
+In some contexts (i.e. evmc_result::create_address is unused) objects of type evmc_result contains a memory storage that MAY be used by the object owner. This group defines helper types and functions for accessing the optional storage.
+
+
|
+ +static | +
Provides read-only access to evmc_result "optional storage".
+ +Definition at line 212 of file helpers.h.
+
+
|
+ +static | +
Provides read-write access to evmc_result "optional storage".
+ + + +
+ EVMC
+
+ |
+
Go to the source code of this file.
++Classes | |
union | evmc_result_optional_storage |
The union representing evmc_result "optional storage". More... | |
+Functions | |
static bool | evmc_is_abi_compatible (struct evmc_vm *vm) |
Returns true if the VM has a compatible ABI version. | |
static const char * | evmc_vm_name (struct evmc_vm *vm) |
Returns the name of the VM. | |
static const char * | evmc_vm_version (struct evmc_vm *vm) |
Returns the version of the VM. | |
static bool | evmc_vm_has_capability (struct evmc_vm *vm, enum evmc_capabilities capability) |
Checks if the VM has the given capability. | |
static void | evmc_destroy (struct evmc_vm *vm) |
Destroys the VM instance. | |
static enum evmc_set_option_result | evmc_set_option (struct evmc_vm *vm, char const *name, char const *value) |
Sets the option for the VM, if the feature is supported by the VM. | |
static struct evmc_result | evmc_execute (struct evmc_vm *vm, const struct evmc_host_interface *host, struct evmc_host_context *context, enum evmc_revision rev, const struct evmc_message *msg, uint8_t const *code, size_t code_size) |
Executes code in the VM instance. | |
static void | evmc_free_result_memory (const struct evmc_result *result) |
The evmc_result release function using free() for releasing the memory. | |
static struct evmc_result | evmc_make_result (enum evmc_status_code status_code, int64_t gas_left, int64_t gas_refund, const uint8_t *output_data, size_t output_size) |
Creates the result from the provided arguments. | |
static void | evmc_release_result (struct evmc_result *result) |
Releases the resources allocated to the execution result. | |
static union evmc_result_optional_storage * | evmc_get_optional_storage (struct evmc_result *result) |
Provides read-write access to evmc_result "optional storage". | |
static const union evmc_result_optional_storage * | evmc_get_const_optional_storage (const struct evmc_result *result) |
Provides read-only access to evmc_result "optional storage". | |
static const char * | evmc_status_code_to_string (enum evmc_status_code status_code) |
Returns text representation of the evmc_status_code. | |
static const char * | evmc_revision_to_string (enum evmc_revision rev) |
Returns the name of the evmc_revision. | |
EVMC Helpers.
+A collection of C helper functions for invoking a VM instance methods. These are convenient for languages where invoking function pointers is "ugly" or impossible (such as Go).
+ +Definition in file helpers.h.
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
+ EVMC
+
+ |
+
▼Cstd::char_traits | |
Cevmc::byte_traits< T > | The char traits for byte-like types |
▼Cevmc_address | Big-endian 160-bit hash suitable for keeping an Ethereum address |
Cevmc::address | The big-endian 160-bit hash suitable for keeping an Ethereum address |
▼Cevmc_bytes32 | The fixed size array of 32 bytes |
Cevmc::bytes32 | The fixed size array of 32 bytes for storing 256-bit EVM values |
Cevmc_host_context | The opaque data type representing the Host execution context |
Cevmc_host_interface | The Host interface |
Cevmc_instruction_metrics | Metrics for an EVM 1 instruction |
Cevmc_message | The message describing an EVM call, including a zero-depth calls from a transaction origin |
▼Cevmc_result | The EVM code execution result |
Cevmc::Result | The EVM code execution result. |
Cevmc_result_optional_storage | The union representing evmc_result "optional storage" |
Cevmc_tx_context | The transaction and block data for execution |
Cevmc_tx_initcode | The hashed initcode used for TXCREATE instruction |
Cevmc_vm | The VM instance |
Cevmc::filter_iterator< BaseIterator, noexcept > | The filter iterator adaptor creates a view of an iterator range in which some elements of the range are skipped |
▼Cevmc::filter_iterator< BaseIterator, is_not_space > | |
Cevmc::skip_space_iterator< BaseIterator > | The input filter iterator which skips whitespace characters from the base input iterator |
▼Cevmc::HostInterface | The EVMC Host interface |
▼Cevmc::Host | Abstract class to be used by Host implementations |
Cevmc::MockedHost | Mocked EVMC Host implementation |
Cevmc::HostContext | Wrapper around EVMC host context / host interface |
Cevmc::MockedHost::log_record | LOG record |
Cevmc::MockedAccount | Mocked account |
Cevmc::StorageValue | Extended value (with original value and access flag) for account storage |
Cevmc::VM | The VM instance. |
+ EVMC
+
+ |
+
++How to bring EVMC support to Your Ethereum Client.
+
First of all, you have to implement the Host interface. The Host interface allows VMs to query and modify Ethereum state during the execution.
+The implementation can be done in object-oriented manner. The evmc_host_interface lists the methods any Host must implement.
+Moreover, each of the methods has a pointer to evmc_host_context as a parameter. The context is owned entirely by the Host allowing a Host instance to behave as an object with data.
+When Host implementation is ready it's time to start using EVMC VMs.
+Have fun!
+
+ EVMC
+
+ |
+
The EVMC is the low-level ABI between Ethereum Virtual Machines (EVMs) and Ethereum Clients. On the EVM-side it supports classic EVM1 and ewasm. On the Client-side it defines the interface for EVM implementations to access Ethereum environment and state.
+The EVMC project uses Semantic Versioning. The version format is MAJOR.MINOR.PATCH
.
The MAJOR version number is also referenced as the EVMC ABI version. This ABI version is available to VM and Host implementations by EVMC_ABI_VERSION. For example EVMC 3.2.1 would have ABI version 3 and therefore this project release can be referenced as EVMC ABIv3 or just EVMC 3. Every C ABI breaking change requires increasing the MAJOR version number.
+The releases with MINOR version change allow adding new API features and modifying the language bindings API. Backward incompatible API changes are allowed but should be avoided if possible.
+The releases with PATCH should only include bug fixes. Exceptionally, API changes are allowed when required to fix a broken feature.
+
+ EVMC
+
+ |
+
Go to the source code of this file.
++Classes | |
struct | evmc_instruction_metrics |
Metrics for an EVM 1 instruction. More... | |
+Enumerations | |
enum | evmc_opcode { + OP_STOP = 0x00 +, OP_ADD = 0x01 +, OP_MUL = 0x02 +, OP_SUB = 0x03 +, + OP_DIV = 0x04 +, OP_SDIV = 0x05 +, OP_MOD = 0x06 +, OP_SMOD = 0x07 +, + OP_ADDMOD = 0x08 +, OP_MULMOD = 0x09 +, OP_EXP = 0x0a +, OP_SIGNEXTEND = 0x0b +, + OP_LT = 0x10 +, OP_GT = 0x11 +, OP_SLT = 0x12 +, OP_SGT = 0x13 +, + OP_EQ = 0x14 +, OP_ISZERO = 0x15 +, OP_AND = 0x16 +, OP_OR = 0x17 +, + OP_XOR = 0x18 +, OP_NOT = 0x19 +, OP_BYTE = 0x1a +, OP_SHL = 0x1b +, + OP_SHR = 0x1c +, OP_SAR = 0x1d +, OP_KECCAK256 = 0x20 +, OP_ADDRESS = 0x30 +, + OP_BALANCE = 0x31 +, OP_ORIGIN = 0x32 +, OP_CALLER = 0x33 +, OP_CALLVALUE = 0x34 +, + OP_CALLDATALOAD = 0x35 +, OP_CALLDATASIZE = 0x36 +, OP_CALLDATACOPY = 0x37 +, OP_CODESIZE = 0x38 +, + OP_CODECOPY = 0x39 +, OP_GASPRICE = 0x3a +, OP_EXTCODESIZE = 0x3b +, OP_EXTCODECOPY = 0x3c +, + OP_RETURNDATASIZE = 0x3d +, OP_RETURNDATACOPY = 0x3e +, OP_EXTCODEHASH = 0x3f +, OP_BLOCKHASH = 0x40 +, + OP_COINBASE = 0x41 +, OP_TIMESTAMP = 0x42 +, OP_NUMBER = 0x43 +, OP_PREVRANDAO = 0x44 +, + OP_GASLIMIT = 0x45 +, OP_CHAINID = 0x46 +, OP_SELFBALANCE = 0x47 +, OP_BASEFEE = 0x48 +, + OP_POP = 0x50 +, OP_MLOAD = 0x51 +, OP_MSTORE = 0x52 +, OP_MSTORE8 = 0x53 +, + OP_SLOAD = 0x54 +, OP_SSTORE = 0x55 +, OP_JUMP = 0x56 +, OP_JUMPI = 0x57 +, + OP_PC = 0x58 +, OP_MSIZE = 0x59 +, OP_GAS = 0x5a +, OP_JUMPDEST = 0x5b +, + OP_PUSH0 = 0x5f +, OP_PUSH1 = 0x60 +, OP_PUSH2 = 0x61 +, OP_PUSH3 = 0x62 +, + OP_PUSH4 = 0x63 +, OP_PUSH5 = 0x64 +, OP_PUSH6 = 0x65 +, OP_PUSH7 = 0x66 +, + OP_PUSH8 = 0x67 +, OP_PUSH9 = 0x68 +, OP_PUSH10 = 0x69 +, OP_PUSH11 = 0x6a +, + OP_PUSH12 = 0x6b +, OP_PUSH13 = 0x6c +, OP_PUSH14 = 0x6d +, OP_PUSH15 = 0x6e +, + OP_PUSH16 = 0x6f +, OP_PUSH17 = 0x70 +, OP_PUSH18 = 0x71 +, OP_PUSH19 = 0x72 +, + OP_PUSH20 = 0x73 +, OP_PUSH21 = 0x74 +, OP_PUSH22 = 0x75 +, OP_PUSH23 = 0x76 +, + OP_PUSH24 = 0x77 +, OP_PUSH25 = 0x78 +, OP_PUSH26 = 0x79 +, OP_PUSH27 = 0x7a +, + OP_PUSH28 = 0x7b +, OP_PUSH29 = 0x7c +, OP_PUSH30 = 0x7d +, OP_PUSH31 = 0x7e +, + OP_PUSH32 = 0x7f +, OP_DUP1 = 0x80 +, OP_DUP2 = 0x81 +, OP_DUP3 = 0x82 +, + OP_DUP4 = 0x83 +, OP_DUP5 = 0x84 +, OP_DUP6 = 0x85 +, OP_DUP7 = 0x86 +, + OP_DUP8 = 0x87 +, OP_DUP9 = 0x88 +, OP_DUP10 = 0x89 +, OP_DUP11 = 0x8a +, + OP_DUP12 = 0x8b +, OP_DUP13 = 0x8c +, OP_DUP14 = 0x8d +, OP_DUP15 = 0x8e +, + OP_DUP16 = 0x8f +, OP_SWAP1 = 0x90 +, OP_SWAP2 = 0x91 +, OP_SWAP3 = 0x92 +, + OP_SWAP4 = 0x93 +, OP_SWAP5 = 0x94 +, OP_SWAP6 = 0x95 +, OP_SWAP7 = 0x96 +, + OP_SWAP8 = 0x97 +, OP_SWAP9 = 0x98 +, OP_SWAP10 = 0x99 +, OP_SWAP11 = 0x9a +, + OP_SWAP12 = 0x9b +, OP_SWAP13 = 0x9c +, OP_SWAP14 = 0x9d +, OP_SWAP15 = 0x9e +, + OP_SWAP16 = 0x9f +, OP_LOG0 = 0xa0 +, OP_LOG1 = 0xa1 +, OP_LOG2 = 0xa2 +, + OP_LOG3 = 0xa3 +, OP_LOG4 = 0xa4 +, OP_CREATE = 0xf0 +, OP_CALL = 0xf1 +, + OP_CALLCODE = 0xf2 +, OP_RETURN = 0xf3 +, OP_DELEGATECALL = 0xf4 +, OP_CREATE2 = 0xf5 +, + OP_STATICCALL = 0xfa +, OP_REVERT = 0xfd +, OP_INVALID = 0xfe +, OP_SELFDESTRUCT = 0xff + + } |
The list of EVM 1 opcodes from every EVM revision. More... | |
+Functions | |
EVMC_EXPORT const struct evmc_instruction_metrics * | evmc_get_instruction_metrics_table (enum evmc_revision revision) |
Get the table of the EVM 1 instructions metrics. | |
EVMC_EXPORT const char *const * | evmc_get_instruction_names_table (enum evmc_revision revision) |
Get the table of the EVM 1 instruction names. | |
EVM Instruction Tables.
+A collection of metrics for EVM1 instruction set.
+ +Definition in file instructions.h.
+
+ EVMC
+
+ |
+