diff --git a/docs/EVMC_8md.html b/docs/EVMC_8md.html deleted file mode 100644 index 7504033..0000000 --- a/docs/EVMC_8md.html +++ /dev/null @@ -1,51 +0,0 @@ - - -
- - - - -
- EVMC
-
- |
-
- EVMC
-
- |
-
- EVMC
-
- |
-
- EVMC
-
- |
-
- EVMC
-
- |
-
▼Nevmc | EVMC C++ API - wrappers and bindings for C++ |
Caddress | The big-endian 160-bit hash suitable for keeping an Ethereum address |
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 |
Cselfdestruct_record | SELFDESTRUCT record |
Cresult | The EVM code execution result. |
Cskip_space_iterator | The input filter iterator which skips whitespace characters from the base input iterator |
Cstorage_value | Extended value (by dirty 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_vm | The VM instance |
- EVMC
-
- |
-
This is the complete list of members for ExampleHost, including all inherited members.
-access_account(const evmc::address &addr) noexcept final | ExampleHost | inlinevirtual |
access_storage(const evmc::address &addr, const evmc::bytes32 &key) noexcept final | ExampleHost | inlinevirtual |
account_exists(const evmc::address &addr) const noexcept final | ExampleHost | inlinevirtual |
accounts | ExampleHost | private |
call(const evmc_message &msg) noexcept final | ExampleHost | inlinevirtual |
copy_code(const evmc::address &addr, size_t code_offset, uint8_t *buffer_data, size_t buffer_size) const noexcept final | ExampleHost | inlinevirtual |
emit_log(const evmc::address &addr, const uint8_t *data, size_t data_size, const evmc::bytes32 topics[], size_t topics_count) noexcept final | ExampleHost | inlinevirtual |
ExampleHost()=default | ExampleHost | |
ExampleHost(evmc_tx_context &_tx_context) noexcept | ExampleHost | inlineexplicit |
ExampleHost(evmc_tx_context &_tx_context, evmc::accounts &_accounts) noexcept | ExampleHost | inline |
from_context(evmc_host_context *context) noexcept | evmc::Host | inlinestatic |
get_balance(const evmc::address &addr) const noexcept final | ExampleHost | inlinevirtual |
get_block_hash(int64_t number) const noexcept final | ExampleHost | inlinevirtual |
get_code_hash(const evmc::address &addr) const noexcept final | ExampleHost | inlinevirtual |
get_code_size(const evmc::address &addr) const noexcept final | ExampleHost | inlinevirtual |
get_interface() noexcept | evmc::Host | inlinestatic |
get_storage(const evmc::address &addr, const evmc::bytes32 &key) const noexcept final | ExampleHost | inlinevirtual |
get_tx_context() const noexcept final | ExampleHost | inlinevirtual |
selfdestruct(const evmc::address &addr, const evmc::address &beneficiary) noexcept final | ExampleHost | inlinevirtual |
set_storage(const evmc::address &addr, const evmc::bytes32 &key, const evmc::bytes32 &value) noexcept final | ExampleHost | inlinevirtual |
to_context() noexcept | evmc::Host | inline |
tx_context | ExampleHost | private |
~HostInterface() noexcept=default | evmc::HostInterface | virtual |
- EVMC
-
- |
-
-Public Member Functions | |
ExampleHost ()=default | |
ExampleHost (evmc_tx_context &_tx_context) noexcept | |
ExampleHost (evmc_tx_context &_tx_context, evmc::accounts &_accounts) noexcept | |
bool | account_exists (const evmc::address &addr) const noexcept final |
Check account existence callback function. More... | |
evmc::bytes32 | get_storage (const evmc::address &addr, const evmc::bytes32 &key) const noexcept final |
Get storage callback function. More... | |
evmc_storage_status | set_storage (const evmc::address &addr, const evmc::bytes32 &key, const evmc::bytes32 &value) noexcept final |
Set storage callback function. More... | |
evmc::uint256be | get_balance (const evmc::address &addr) const noexcept final |
Get balance callback function. More... | |
size_t | get_code_size (const evmc::address &addr) const noexcept final |
Get code size callback function. More... | |
evmc::bytes32 | get_code_hash (const evmc::address &addr) const noexcept final |
Get code hash callback function. More... | |
size_t | copy_code (const evmc::address &addr, size_t code_offset, uint8_t *buffer_data, size_t buffer_size) const noexcept final |
Copy code callback function. More... | |
void | selfdestruct (const evmc::address &addr, const evmc::address &beneficiary) noexcept final |
Selfdestruct callback function. More... | |
evmc::result | call (const evmc_message &msg) noexcept final |
Call callback function. More... | |
evmc_tx_context | get_tx_context () const noexcept final |
Get transaction context callback function. More... | |
evmc::bytes32 | get_block_hash (int64_t number) const noexcept final |
Get block hash callback function. More... | |
void | emit_log (const evmc::address &addr, const uint8_t *data, size_t data_size, const evmc::bytes32 topics[], size_t topics_count) noexcept final |
Emit log callback function. More... | |
evmc_access_status | access_account (const evmc::address &addr) noexcept final |
Access account callback function. More... | |
evmc_access_status | access_storage (const evmc::address &addr, const evmc::bytes32 &key) noexcept final |
Access storage callback function. More... | |
![]() | |
evmc_host_context * | to_context () noexcept |
Converts the Host object to the opaque host context pointer. More... | |
![]() | |
virtual | ~HostInterface () noexcept=default |
-Private Attributes | |
evmc::accounts | accounts |
evmc_tx_context | tx_context {} |
-Additional Inherited Members | |
![]() | |
static const evmc_host_interface & | get_interface () noexcept |
Provides access to the global host interface. More... | |
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. More... | |
Definition at line 46 of file example_host.cpp.
-
-
|
- -default | -
-
|
- -inlineexplicitnoexcept | -
Definition at line 53 of file example_host.cpp.
-
-
|
- -inlinenoexcept | -
Definition at line 54 of file example_host.cpp.
-
-
|
- -inlinefinalvirtualnoexcept | -
Access account callback function.
- -Implements evmc::HostInterface.
- -Definition at line 167 of file example_host.cpp.
-
-
|
- -inlinefinalvirtualnoexcept | -
Access storage callback function.
- -Implements evmc::HostInterface.
- -Definition at line 173 of file example_host.cpp.
- -
-
|
- -inlinefinalvirtualnoexcept | -
Check account existence callback function.
- -Implements evmc::HostInterface.
- -Definition at line 58 of file example_host.cpp.
- -
-
|
- -inlinefinalvirtualnoexcept | -
Call callback function.
- -Implements evmc::HostInterface.
- -Definition at line 138 of file example_host.cpp.
-
-
|
- -inlinefinalvirtualnoexcept | -
Copy code callback function.
- -Implements evmc::HostInterface.
- -Definition at line 111 of file example_host.cpp.
-
-
|
- -inlinefinalvirtualnoexcept | -
Emit log callback function.
- -Implements evmc::HostInterface.
- -Definition at line 154 of file example_host.cpp.
- -
-
|
- -inlinefinalvirtualnoexcept | -
Get balance callback function.
- -Implements evmc::HostInterface.
- -Definition at line 87 of file example_host.cpp.
- -
-
|
- -inlinefinalvirtualnoexcept | -
Get block hash callback function.
- -Implements evmc::HostInterface.
- -Definition at line 145 of file example_host.cpp.
-
-
|
- -inlinefinalvirtualnoexcept | -
Get code hash callback function.
- -Implements evmc::HostInterface.
- -Definition at line 103 of file example_host.cpp.
- -
-
|
- -inlinefinalvirtualnoexcept | -
Get code size callback function.
- -Implements evmc::HostInterface.
- -Definition at line 95 of file example_host.cpp.
- -
-
|
- -inlinefinalvirtualnoexcept | -
Get storage callback function.
- -Implements evmc::HostInterface.
- -Definition at line 63 of file example_host.cpp.
-
-
|
- -inlinefinalvirtualnoexcept | -
Get transaction context callback function.
- -Implements evmc::HostInterface.
- -Definition at line 143 of file example_host.cpp.
-
-
|
- -inlinefinalvirtualnoexcept | -
Selfdestruct callback function.
- -Implements evmc::HostInterface.
- -Definition at line 132 of file example_host.cpp.
- -
-
|
- -inlinefinalvirtualnoexcept | -
Set storage callback function.
- -Implements evmc::HostInterface.
- -Definition at line 76 of file example_host.cpp.
-
-
|
- -private | -
Definition at line 48 of file example_host.cpp.
- -
-
|
- -private | -
Definition at line 49 of file example_host.cpp.
- -
- 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_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 |
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. More... | |
![]() | |
virtual bool | account_exists (const address &addr) const noexcept=0 |
Check account existence callback function. More... | |
virtual bytes32 | get_storage (const address &addr, const bytes32 &key) const noexcept=0 |
Get storage callback function. More... | |
virtual evmc_storage_status | set_storage (const address &addr, const bytes32 &key, const bytes32 &value) noexcept=0 |
Set storage callback function. More... | |
virtual uint256be | get_balance (const address &addr) const noexcept=0 |
Get balance callback function. More... | |
virtual size_t | get_code_size (const address &addr) const noexcept=0 |
Get code size callback function. More... | |
virtual bytes32 | get_code_hash (const address &addr) const noexcept=0 |
Get code hash callback function. More... | |
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. More... | |
virtual void | selfdestruct (const address &addr, const address &beneficiary) noexcept=0 |
Selfdestruct callback function. More... | |
virtual result | call (const evmc_message &msg) noexcept=0 |
Call callback function. More... | |
virtual evmc_tx_context | get_tx_context () const noexcept=0 |
Get transaction context callback function. More... | |
virtual bytes32 | get_block_hash (int64_t block_number) const noexcept=0 |
Get block hash callback function. More... | |
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. More... | |
virtual evmc_access_status | access_account (const address &addr) noexcept=0 |
Access account callback function. More... | |
virtual evmc_access_status | access_storage (const address &addr, const bytes32 &key) noexcept=0 |
Access storage callback function. More... | |
-Static Public Member Functions | |
static const evmc_host_interface & | get_interface () noexcept |
Provides access to the global host interface. More... | |
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. More... | |
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 581 of file evmc.hpp.
-
-
|
- -inlinestaticnoexcept | -
-
|
- -inlinenoexcept | -
Converts the Host object to the opaque host context pointer.
-Definition at line 574 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_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 |
~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. More... | |
bool | account_exists (const address &address) const noexcept final |
Check account existence callback function. More... | |
bytes32 | get_storage (const address &address, const bytes32 &key) const noexcept final |
Get storage callback function. More... | |
evmc_storage_status | set_storage (const address &address, const bytes32 &key, const bytes32 &value) noexcept final |
Set storage callback function. More... | |
uint256be | get_balance (const address &address) const noexcept final |
Get balance callback function. More... | |
size_t | get_code_size (const address &address) const noexcept final |
Get code size callback function. More... | |
bytes32 | get_code_hash (const address &address) const noexcept final |
Get code hash callback function. More... | |
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. More... | |
void | selfdestruct (const address &addr, const address &beneficiary) noexcept final |
Selfdestruct callback function. More... | |
result | call (const evmc_message &message) noexcept final |
Call callback function. More... | |
evmc_tx_context | get_tx_context () const noexcept final |
Get transaction context callback function. More... | |
bytes32 | get_block_hash (int64_t number) const noexcept final |
Get block hash callback function. More... | |
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. More... | |
evmc_access_status | access_account (const address &address) noexcept final |
Access account callback function. More... | |
evmc_access_status | access_storage (const address &address, const bytes32 &key) noexcept final |
Access storage callback function. More... | |
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 548 of file evmc.hpp.
-
-
|
- -inlinefinalvirtualnoexcept | -
Access storage callback function.
- -Implements evmc::HostInterface.
- -Definition at line 553 of file evmc.hpp.
-
-
|
- -inlinefinalvirtualnoexcept | -
Check account existence callback function.
- -Implements evmc::HostInterface.
- -Definition at line 481 of file evmc.hpp.
-
-
|
- -inlinefinalvirtualnoexcept | -
Call callback function.
- -Implements evmc::HostInterface.
- -Definition at line 526 of file evmc.hpp.
-
-
|
- -inlinefinalvirtualnoexcept | -
Copy code callback function.
- -Implements evmc::HostInterface.
- -Definition at line 513 of file evmc.hpp.
-
-
|
- -inlinefinalvirtualnoexcept | -
Emit log callback function.
- -Implements evmc::HostInterface.
- -Definition at line 539 of file evmc.hpp.
-
-
|
- -inlinefinalvirtualnoexcept | -
Get balance callback function.
- -Implements evmc::HostInterface.
- -Definition at line 498 of file evmc.hpp.
-
-
|
- -inlinefinalvirtualnoexcept | -
Get block hash callback function.
- -Implements evmc::HostInterface.
- -Definition at line 534 of file evmc.hpp.
-
-
|
- -inlinefinalvirtualnoexcept | -
Get code hash callback function.
- -Implements evmc::HostInterface.
- -Definition at line 508 of file evmc.hpp.
-
-
|
- -inlinefinalvirtualnoexcept | -
Get code size callback function.
- -Implements evmc::HostInterface.
- -Definition at line 503 of file evmc.hpp.
-
-
|
- -inlinefinalvirtualnoexcept | -
Get storage callback function.
- -Implements evmc::HostInterface.
- -Definition at line 486 of file evmc.hpp.
-
-
|
- -inlinefinalvirtualnoexcept | -
Get transaction context callback function.
- -Implements evmc::HostInterface.
- -Definition at line 532 of file evmc.hpp.
-
-
|
- -inlinefinalvirtualnoexcept | -
Selfdestruct callback function.
- -Implements evmc::HostInterface.
- -Definition at line 521 of file evmc.hpp.
-
-
|
- -inlinefinalvirtualnoexcept | -
Set storage callback function.
- -Implements evmc::HostInterface.
- -Definition at line 491 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_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 |
~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. More... | |
virtual bytes32 | get_storage (const address &addr, const bytes32 &key) const noexcept=0 |
Get storage callback function. More... | |
virtual evmc_storage_status | set_storage (const address &addr, const bytes32 &key, const bytes32 &value) noexcept=0 |
Set storage callback function. More... | |
virtual uint256be | get_balance (const address &addr) const noexcept=0 |
Get balance callback function. More... | |
virtual size_t | get_code_size (const address &addr) const noexcept=0 |
Get code size callback function. More... | |
virtual bytes32 | get_code_hash (const address &addr) const noexcept=0 |
Get code hash callback function. More... | |
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. More... | |
virtual void | selfdestruct (const address &addr, const address &beneficiary) noexcept=0 |
Selfdestruct callback function. More... | |
virtual result | call (const evmc_message &msg) noexcept=0 |
Call callback function. More... | |
virtual evmc_tx_context | get_tx_context () const noexcept=0 |
Get transaction context callback function. More... | |
virtual bytes32 | get_block_hash (int64_t block_number) const noexcept=0 |
Get block hash callback function. More... | |
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. More... | |
virtual evmc_access_status | access_account (const address &addr) noexcept=0 |
Access account callback function. More... | |
virtual evmc_access_status | access_storage (const address &addr, const bytes32 &key) noexcept=0 |
Access storage callback function. More... | |
-
|
- -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 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.
- -
- 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_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 |
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... | |
struct | selfdestruct_record |
SELFDESTRUCT record. More... | |
-Public Member Functions | |
bool | account_exists (const address &addr) const noexcept override |
Returns true if an account exists (EVMC Host method). More... | |
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). More... | |
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). More... | |
uint256be | get_balance (const address &addr) const noexcept override |
Get the account's balance (EVMC Host method). More... | |
size_t | get_code_size (const address &addr) const noexcept override |
Get the account's code size (EVMC host method). More... | |
bytes32 | get_code_hash (const address &addr) const noexcept override |
Get the account's code hash (EVMC host method). More... | |
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). More... | |
void | selfdestruct (const address &addr, const address &beneficiary) noexcept override |
Selfdestruct the account (EVMC host method). More... | |
result | call (const evmc_message &msg) noexcept override |
Call/create other contract (EVMC host method). More... | |
evmc_tx_context | get_tx_context () const noexcept override |
Get transaction context (EVMC host method). More... | |
bytes32 | get_block_hash (int64_t block_number) const noexcept override |
Get the block header hash (EVMC host method). More... | |
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). More... | |
evmc_access_status | access_account (const address &addr) noexcept override |
Record an account access. More... | |
evmc_access_status | access_storage (const address &addr, const bytes32 &key) noexcept override |
Access the account's storage value at the given key. More... | |
![]() | |
evmc_host_context * | to_context () noexcept |
Converts the Host object to the opaque host context pointer. More... | |
-Public Attributes | |
std::unordered_map< address, MockedAccount > | accounts |
The set of all accounts in the Host, organized by their addresses. More... | |
evmc_tx_context | tx_context = {} |
The EVMC transaction context to be returned by get_tx_context(). More... | |
bytes32 | block_hash = {} |
The block header hash value to be returned by get_block_hash(). More... | |
evmc_result | call_result = {} |
The call result to be returned by the call() method. More... | |
std::vector< int64_t > | recorded_blockhashes |
The record of all block numbers for which get_block_hash() was called. More... | |
std::vector< address > | recorded_account_accesses |
The record of all account accesses. More... | |
std::vector< evmc_message > | recorded_calls |
The record of all call messages requested in the call() method. More... | |
std::vector< log_record > | recorded_logs |
The record of all LOGs passed to the emit_log() method. More... | |
std::vector< selfdestruct_record > | recorded_selfdestructs |
The record of all SELFDESTRUCTs from the selfdestruct() method. More... | |
-Static Public Attributes | |
static constexpr auto | max_recorded_account_accesses = 200 |
The maximum number of entries in recorded_account_accesses record. More... | |
static constexpr auto | max_recorded_calls = 100 |
The maximum number of entries in recorded_calls record. More... | |
-Additional Inherited Members | |
![]() | |
static const evmc_host_interface & | get_interface () noexcept |
Provides access to the global host interface. More... | |
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. More... | |
Mocked EVMC Host implementation.
- -Definition at line 71 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 341 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 371 of file mocked_host.hpp.
-
-
|
- -inlineoverridevirtualnoexcept | -
Returns true if an account exists (EVMC Host method).
- -Implements evmc::HostInterface.
- -Definition at line 161 of file mocked_host.hpp.
- -
-
|
- -inlineoverridevirtualnoexcept | -
Call/create other contract (EVMC host method).
- -Implements evmc::HostInterface.
- -Definition at line 281 of file mocked_host.hpp.
-
-
|
- -inlineoverridevirtualnoexcept | -
Copy the account's code to the given buffer (EVMC host method).
- -Implements evmc::HostInterface.
- -Definition at line 251 of file mocked_host.hpp.
-
-
|
- -inlineoverridevirtualnoexcept | -
Emit LOG (EVMC host method).
- -Implements evmc::HostInterface.
- -Definition at line 316 of file mocked_host.hpp.
-
-
|
- -inlineoverridevirtualnoexcept | -
Get the account's balance (EVMC Host method).
- -Implements evmc::HostInterface.
- -Definition at line 220 of file mocked_host.hpp.
- -
-
|
- -inlineoverridevirtualnoexcept | -
Get the block header hash (EVMC host method).
- -Implements evmc::HostInterface.
- -Definition at line 309 of file mocked_host.hpp.
-
-
|
- -inlineoverridevirtualnoexcept | -
Get the account's code hash (EVMC host method).
- -Implements evmc::HostInterface.
- -Definition at line 241 of file mocked_host.hpp.
- -
-
|
- -inlineoverridevirtualnoexcept | -
Get the account's code size (EVMC host method).
- -Implements evmc::HostInterface.
- -Definition at line 231 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 168 of file mocked_host.hpp.
-
-
|
- -inlineoverridevirtualnoexcept | -
Get transaction context (EVMC host method).
- -Implements evmc::HostInterface.
- -Definition at line 306 of file mocked_host.hpp.
-
-
|
- -inlineoverridevirtualnoexcept | -
Selfdestruct the account (EVMC host method).
- -Implements evmc::HostInterface.
- -Definition at line 274 of file mocked_host.hpp.
-
-
|
- -inlineoverridevirtualnoexcept | -
Set the account's storage value (EVMC Host method).
- -Implements evmc::HostInterface.
- -Definition at line 183 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 110 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 116 of file mocked_host.hpp.
- -evmc_result evmc::MockedHost::call_result = {} | -
The call result to be returned by the call() method.
- -Definition at line 119 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 129 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 136 of file mocked_host.hpp.
- -
-
|
- -mutable | -
The record of all account accesses.
- -Definition at line 125 of file mocked_host.hpp.
- -
-
|
- -mutable | -
The record of all block numbers for which get_block_hash() was called.
- -Definition at line 122 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 132 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 139 of file mocked_host.hpp.
- -std::vector<selfdestruct_record> evmc::MockedHost::recorded_selfdestructs | -
The record of all SELFDESTRUCTs from the selfdestruct() method.
- -Definition at line 142 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 113 of file mocked_host.hpp.
- -
- 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. More... | |
~VM () noexcept | |
Destructor responsible for automatically destroying the VM instance. More... | |
- | VM (const VM &)=delete |
-VM & | operator= (const VM &)=delete |
VM (VM &&other) noexcept | |
Move constructor. More... | |
VM & | operator= (VM &&other) noexcept |
Move assignment operator. More... | |
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. More... | |
operator bool () const noexcept | |
Checks if contains a valid pointer to the VM instance. More... | |
bool | is_abi_compatible () const noexcept |
Checks whenever the VM instance is ABI compatible with the current EVMC API. More... | |
char const * | name () const noexcept |
The name of the EVMC VM implementation. More... | |
char const * | version () const noexcept |
The version of the EVMC VM implementation, e.g. More... | |
bool | has_capability (evmc_capabilities capability) const noexcept |
Checks if the VM has the given capability. More... | |
evmc_capabilities_flagset | get_capabilities () const noexcept |
A method returning capabilities supported by the VM instance. More... | |
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. More... | |
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. More... | |
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. More... | |
result | execute (evmc_revision rev, const evmc_message &msg, const uint8_t *code, size_t code_size) noexcept |
Executes code without the Host context. More... | |
evmc_vm * | get_raw_pointer () const noexcept |
Returns the pointer to C EVMC struct representing the VM. More... | |
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 605 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 710 of file evmc.hpp.
-
-
|
- -inlinenoexcept | -
Executes code in the VM instance.
-Definition at line 662 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.
- - - -
-
|
- -inlinenoexcept | -
Convenient variant of the VM::execute() that takes reference to evmc::Host class.
- -Definition at line 673 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 650 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.
- - - -
-
|
- -inlinenoexcept | -
Checks if the VM has the given capability.
- -Definition at line 644 of file evmc.hpp.
-
-
|
- -inlinenoexcept | -
Checks whenever the VM instance is ABI compatible with the current EVMC API.
- -Definition at line 635 of file evmc.hpp.
-
-
|
- -inlinenoexcept | -
-
|
- -inlineexplicitnoexcept | -
Move assignment operator.
- -Definition at line 618 of file evmc.hpp.
-
-
|
- -inlinenoexcept | -
Sets the option for the VM, if the feature is supported by the VM.
-Definition at line 656 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 641 of file evmc.hpp.
-
- EVMC
-
- |
-
This is the complete list of members for evmc::result, including all inherited members.
-create_address | evmc::result | |
gas_left | evmc::result | |
operator=(result &&other) noexcept | evmc::result | inline |
output_data | evmc::result | |
output_size | evmc::result | |
release_raw() noexcept | evmc::result | inline |
result(evmc_status_code _status_code, int64_t _gas_left, const uint8_t *_output_data, size_t _output_size) noexcept | evmc::result | inline |
result(evmc_result const &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, const uint8_t *_output_data, size_t _output_size) noexcept | |
Creates the result from the provided arguments. More... | |
result (evmc_result const &res) noexcept | |
Converting constructor from raw evmc_result. More... | |
~result () noexcept | |
Destructor responsible for automatically releasing attached resources. More... | |
result (result &&other) noexcept | |
Move constructor. More... | |
result & | operator= (result &&other) noexcept |
Move assignment operator. More... | |
evmc_result | release_raw () noexcept |
Releases the ownership and returns the raw copy of evmc_result. More... | |
-Public Attributes | |
evmc_address | create_address |
The address of the contract created by create instructions. More... | |
int64_t | gas_left |
The amount of gas left after the execution. More... | |
const uint8_t * | output_data |
The reference to output data. More... | |
size_t | output_size |
The size of the output data. More... | |
enum evmc_status_code | status_code |
The execution status code. More... | |
The EVM code execution result.
-This is a RAII wrapper for evmc_result and objects of this type automatically release attached resources.
- - -
-
|
- -inlinenoexcept | -
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. |
_output_data | The pointer to the output. |
_output_size | The output size. |
Definition at line 349 of file evmc.hpp.
-
-
|
- -inlineexplicitnoexcept | -
-
|
- -inlinenoexcept | -
Destructor responsible for automatically releasing attached resources.
- -Definition at line 360 of file evmc.hpp.
-
-
|
- -inlinenoexcept | -
-
|
- -inlinenoexcept | -
Move assignment operator.
-The self-assigment MUST never happen.
-other | The other result object. |
Definition at line 378 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 394 of file evmc.hpp.
-evmc_address evmc_result::create_address | -
The address of the contract created by create instructions.
-This field has valid value only if:
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.
- - - -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 MAY be NULL.
- - - -size_t evmc_result::output_size | -
enum evmc_status_code evmc_result::status_code | -
- EVMC
-
- |
-
- EVMC
-
- |
-
File in examples | Includes file in include |
---|---|
example.c | evmc / helpers.h |
example.c | evmc / loader.h |
example_host.cpp | evmc / evmc.hpp |
example_host.h | evmc / evmc.h |
- EVMC
-
- |
-
- EVMC
-
- |
-
-Files | |
file | evmc.h [code] |
EVMC: Ethereum Client-VM Connector API. | |
file | evmc.hpp [code] |
EVMC C++ API - wrappers and bindings for C++. | |
file | helpers.h [code] |
EVMC Helpers. | |
file | instructions.h [code] |
EVM Instruction Tables. | |
file | loader.h [code] |
EVMC Loader Library. | |
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
-
- |
-
- EVMC
-
- |
-
-How to bring EVMC support to Your Ethereum Client. -
-How to add EVMC interface to Your Ethereum VM implementation. -
- EVMC
-
- |
-
EVMC: Ethereum Client-VM Connector API. -More...
-#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_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. More... | |
typedef struct evmc_bytes32 | evmc_uint256be |
The alias for evmc_bytes32 to represent a big-endian 256-bit integer. More... | |
-typedef struct evmc_address | evmc_address |
Big-endian 160-bit hash suitable for keeping an Ethereum address. | |
typedef struct evmc_tx_context(* | evmc_get_tx_context_fn) (struct evmc_host_context *context) |
Get transaction context callback function. More... | |
typedef evmc_bytes32(* | evmc_get_block_hash_fn) (struct evmc_host_context *context, int64_t number) |
Get block hash callback function. More... | |
typedef void(* | evmc_release_result_fn) (const struct evmc_result *result) |
Releases resources assigned to an execution result. More... | |
typedef bool(* | evmc_account_exists_fn) (struct evmc_host_context *context, const evmc_address *address) |
Check account existence callback function. More... | |
typedef evmc_bytes32(* | evmc_get_storage_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_bytes32 *key) |
Get storage callback function. More... | |
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. More... | |
typedef evmc_uint256be(* | evmc_get_balance_fn) (struct evmc_host_context *context, const evmc_address *address) |
Get balance callback function. More... | |
typedef size_t(* | evmc_get_code_size_fn) (struct evmc_host_context *context, const evmc_address *address) |
Get code size callback function. More... | |
typedef evmc_bytes32(* | evmc_get_code_hash_fn) (struct evmc_host_context *context, const evmc_address *address) |
Get code hash callback function. More... | |
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. More... | |
typedef void(* | evmc_selfdestruct_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_address *beneficiary) |
Selfdestruct callback function. More... | |
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. More... | |
typedef enum evmc_access_status(* | evmc_access_account_fn) (struct evmc_host_context *context, const evmc_address *address) |
Access account callback function. More... | |
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. More... | |
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. More... | |
typedef void(* | evmc_destroy_fn) (struct evmc_vm *vm) |
Destroys the VM instance. More... | |
typedef enum evmc_set_option_result(* | evmc_set_option_fn) (struct evmc_vm *vm, char const *name, char const *value) |
Configures the VM instance. More... | |
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. More... | |
typedef uint32_t | evmc_capabilities_flagset |
Alias for unsigned integer representing a set of bit flags of EVMC capabilities. More... | |
typedef evmc_capabilities_flagset(* | evmc_get_capabilities_fn) (struct evmc_vm *vm) |
Return the supported capabilities of the VM instance. More... | |
-Functions | |
struct evmc_vm * | evmc_create_example_vm (void) |
Example of a function creating an instance of an example EVM implementation. More... | |
EVMC: Ethereum Client-VM Connector API.
-Definition in file evmc.h.
-
- EVMC
-
- |
-
- EVMC
-
- |
-
EVMC C++ API - wrappers and bindings for C++. -More...
-#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::bytes_view = std::basic_string_view< uint8_t > |
String view of uint8_t chars. More... | |
using | evmc::uint256be = bytes32 |
The alias for evmc::bytes32 to represent a big-endian 256-bit integer. More... | |
-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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
constexpr bool | evmc::operator== (const address &a, const address &b) noexcept |
The "equal to" comparison operator for the evmc::address type. More... | |
constexpr bool | evmc::operator!= (const address &a, const address &b) noexcept |
The "not equal to" comparison operator for the evmc::address type. More... | |
constexpr bool | evmc::operator< (const address &a, const address &b) noexcept |
The "less than" comparison operator for the evmc::address type. More... | |
constexpr bool | evmc::operator> (const address &a, const address &b) noexcept |
The "greater than" comparison operator for the evmc::address type. More... | |
constexpr bool | evmc::operator<= (const address &a, const address &b) noexcept |
The "less than or equal to" comparison operator for the evmc::address type. More... | |
constexpr bool | evmc::operator>= (const address &a, const address &b) noexcept |
The "greater than or equal to" comparison operator for the evmc::address type. More... | |
constexpr bool | evmc::operator== (const bytes32 &a, const bytes32 &b) noexcept |
The "equal to" comparison operator for the evmc::bytes32 type. More... | |
constexpr bool | evmc::operator!= (const bytes32 &a, const bytes32 &b) noexcept |
The "not equal to" comparison operator for the evmc::bytes32 type. More... | |
constexpr bool | evmc::operator< (const bytes32 &a, const bytes32 &b) noexcept |
The "less than" comparison operator for the evmc::bytes32 type. More... | |
constexpr bool | evmc::operator> (const bytes32 &a, const bytes32 &b) noexcept |
The "greater than" comparison operator for the evmc::bytes32 type. More... | |
constexpr bool | evmc::operator<= (const bytes32 &a, const bytes32 &b) noexcept |
The "less than or equal to" comparison operator for the evmc::bytes32 type. More... | |
constexpr bool | evmc::operator>= (const bytes32 &a, const bytes32 &b) noexcept |
The "greater than or equal to" comparison operator for the evmc::bytes32 type. More... | |
constexpr bool | evmc::is_zero (const address &a) noexcept |
Checks if the given address is the zero address. More... | |
constexpr bool | evmc::is_zero (const bytes32 &a) noexcept |
Checks if the given bytes32 object has all zero bytes. More... | |
template<typename T > | |
constexpr T | evmc::literals::parse (std::string_view s) noexcept |
Converts a raw literal into value of type T. More... | |
constexpr address | evmc::literals::operator""_address (const char *s) noexcept |
Literal for evmc::address. More... | |
constexpr bytes32 | evmc::literals::operator""_bytes32 (const char *s) noexcept |
Literal for evmc::bytes32. More... | |
const char * | evmc::to_string (evmc_status_code status_code) noexcept |
Returns text representation of the evmc_status_code. More... | |
const char * | evmc::to_string (evmc_revision rev) noexcept |
Returns the name of the evmc_revision. More... | |
std::ostream & | operator<< (std::ostream &os, evmc_status_code status_code) |
"Stream out" operator implementation for evmc_status_code. More... | |
std::ostream & | operator<< (std::ostream &os, evmc_revision rev) |
"Stream out" operator implementation for evmc_revision. More... | |
-Variables | |
constexpr auto | evmc::fnv::prime = 0x100000001b3 |
The 64-bit FNV prime number. More... | |
constexpr auto | evmc::fnv::offset_basis = 0xcbf29ce484222325 |
The 64-bit FNV offset basis. More... | |
constexpr auto | evmc::make_result = evmc_make_result |
Alias for evmc_make_result(). More... | |
EVMC C++ API - wrappers and bindings for C++.
- -Definition in file evmc.hpp.
-
-
|
- -inlineconstexprnoexcept | -
-
|
- -constexprnoexcept | -
Literal for evmc::address.
- - - -
-
|
- -constexprnoexcept | -
Literal for evmc::bytes32.
- - - -
-
|
- -inline | -
"Stream out" operator implementation for evmc_revision.
-Definition at line 841 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.
- - - -
-
|
- -constexpr | -
- EVMC
-
- |
-
- EVMC
-
- |
-
#include "example_host.h"
#include <evmc/helpers.h>
#include <evmc/loader.h>
#include <inttypes.h>
#include <stdio.h>
Go to the source code of this file.
--Functions | |
int | main (int argc, char *argv[]) |
int main | -( | -int | -argc, | -
- | - | char * | -argv[] | -
- | ) | -- |
Definition at line 17 of file example.c.
-
- EVMC
-
- |
-
- EVMC
-
- |
-
Example implementation of an EVMC Host. -More...
-#include "example_host.h"
#include <evmc/evmc.hpp>
#include <algorithm>
#include <map>
#include <vector>
Go to the source code of this file.
--Classes | |
struct | evmc::account |
class | ExampleHost |
-Namespaces | |
namespace | evmc |
EVMC C++ API - wrappers and bindings for C++. | |
-Typedefs | |
using | evmc::accounts = std::map< evmc::address, account > |
-Functions | |
const evmc_host_interface * | example_host_get_interface () |
evmc_host_context * | example_host_create_context (evmc_tx_context tx_context) |
void | example_host_destroy_context (evmc_host_context *context) |
Example implementation of an EVMC Host.
- -Definition in file example_host.cpp.
-evmc_host_context * example_host_create_context | -( | -evmc_tx_context | -tx_context | ) | -- |
Definition at line 190 of file example_host.cpp.
-void example_host_destroy_context | -( | -evmc_host_context * | -context | ) | -- |
Definition at line 196 of file example_host.cpp.
- -const evmc_host_interface * example_host_get_interface | -( | -) | -- |
Definition at line 185 of file example_host.cpp.
-
- EVMC
-
- |
-
- EVMC
-
- |
-
#include <evmc/evmc.h>
Go to the source code of this file.
--Functions | |
const struct evmc_host_interface * | example_host_get_interface () |
struct evmc_host_context * | example_host_create_context (struct evmc_tx_context tx_context) |
void | example_host_destroy_context (struct evmc_host_context *context) |
struct evmc_host_context * example_host_create_context | -( | -struct evmc_tx_context | -tx_context | ) | -- |
Definition at line 190 of file example_host.cpp.
-void example_host_destroy_context | -( | -struct evmc_host_context * | -context | ) | -- |
Definition at line 196 of file example_host.cpp.
- -const struct evmc_host_interface * example_host_get_interface | -( | -) | -- |
Definition at line 185 of file example_host.cpp.
-
- 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. More... | |
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 | |
evmc.h | EVMC: Ethereum Client-VM Connector API. |
evmc.hpp | EVMC C++ API - wrappers and bindings for C++. |
filter_iterator.hpp | |
helpers.h | EVMC Helpers. |
hex.hpp | |
instructions.h | EVM Instruction Tables. |
loader.h | EVMC Loader Library. |
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
-
- |
-
This page explains how to interpret the graphs that are generated by doxygen.
-Consider the following example:
This will result in the following graph:
-The boxes in the above graph have the following meaning:
-The arrows have the following meaning:
-
- 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_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. More... | |
typedef struct evmc_bytes32 | evmc_uint256be |
The alias for evmc_bytes32 to represent a big-endian 256-bit integer. More... | |
-typedef struct evmc_address | evmc_address |
Big-endian 160-bit hash suitable for keeping an Ethereum address. | |
typedef struct evmc_tx_context(* | evmc_get_tx_context_fn) (struct evmc_host_context *context) |
Get transaction context callback function. More... | |
typedef evmc_bytes32(* | evmc_get_block_hash_fn) (struct evmc_host_context *context, int64_t number) |
Get block hash callback function. More... | |
typedef void(* | evmc_release_result_fn) (const struct evmc_result *result) |
Releases resources assigned to an execution result. More... | |
typedef bool(* | evmc_account_exists_fn) (struct evmc_host_context *context, const evmc_address *address) |
Check account existence callback function. More... | |
typedef evmc_bytes32(* | evmc_get_storage_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_bytes32 *key) |
Get storage callback function. More... | |
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. More... | |
typedef evmc_uint256be(* | evmc_get_balance_fn) (struct evmc_host_context *context, const evmc_address *address) |
Get balance callback function. More... | |
typedef size_t(* | evmc_get_code_size_fn) (struct evmc_host_context *context, const evmc_address *address) |
Get code size callback function. More... | |
typedef evmc_bytes32(* | evmc_get_code_hash_fn) (struct evmc_host_context *context, const evmc_address *address) |
Get code hash callback function. More... | |
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. More... | |
typedef void(* | evmc_selfdestruct_fn) (struct evmc_host_context *context, const evmc_address *address, const evmc_address *beneficiary) |
Selfdestruct callback function. More... | |
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. More... | |
typedef enum evmc_access_status(* | evmc_access_account_fn) (struct evmc_host_context *context, const evmc_address *address) |
Access account callback function. More... | |
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. More... | |
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. More... | |
typedef void(* | evmc_destroy_fn) (struct evmc_vm *vm) |
Destroys the VM instance. More... | |
typedef enum evmc_set_option_result(* | evmc_set_option_fn) (struct evmc_vm *vm, char const *name, char const *value) |
Configures the VM instance. More... | |
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. More... | |
typedef uint32_t | evmc_capabilities_flagset |
Alias for unsigned integer representing a set of bit flags of EVMC capabilities. More... | |
typedef evmc_capabilities_flagset(* | evmc_get_capabilities_fn) (struct evmc_vm *vm) |
Return the supported capabilities of the VM instance. More... | |
-Functions | |
struct evmc_vm * | evmc_create_example_vm (void) |
Example of a function creating an instance of an example EVM implementation. More... | |
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 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 void(* 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 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 657 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 944 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. -The future next revision after Shanghai. - |
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 808 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 259 of file evmc.h.
-enum evmc_storage_status | -
The effect of an attempt to modify a contract storage item.
-For the purpose of explaining the meaning of each element, the following notation is used:
Definition at line 510 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
-
- |
-
- 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. More... | |
#define | EVMC_NOEXCEPT |
Safe way of marking a function with noexcept C++ specifier. More... | |
-Functions | |
static bool | evmc_is_abi_compatible (struct evmc_vm *vm) |
Returns true if the VM has a compatible ABI version. More... | |
static const char * | evmc_vm_name (struct evmc_vm *vm) |
Returns the name of the VM. More... | |
static const char * | evmc_vm_version (struct evmc_vm *vm) |
Returns the version of the VM. More... | |
static bool | evmc_vm_has_capability (struct evmc_vm *vm, enum evmc_capabilities capability) |
Checks if the VM has the given capability. More... | |
static void | evmc_destroy (struct evmc_vm *vm) |
Destroys the VM instance. More... | |
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. More... | |
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. More... | |
static void | evmc_free_result_memory (const struct evmc_result *result) |
The evmc_result release function using free() for releasing the memory. More... | |
static struct evmc_result | evmc_make_result (enum evmc_status_code status_code, int64_t gas_left, const uint8_t *output_data, size_t output_size) |
Creates the result from the provided arguments. More... | |
static void | evmc_release_result (struct evmc_result *result) |
Releases the resources allocated to the execution result. More... | |
static const char * | evmc_status_code_to_string (enum evmc_status_code status_code) |
Returns text representation of the evmc_status_code. More... | |
static const char * | evmc_revision_to_string (enum evmc_revision rev) |
Returns the name of the evmc_revision. More... | |
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 66 of file helpers.h.
-
-
|
- -inlinestatic | -
Executes code in the VM instance.
-Definition at line 90 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 107 of file helpers.h.
-
-
|
- -inlinestatic | -
Returns true if the VM has a compatible ABI version.
- -Definition at line 30 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. |
output_data | The pointer to the output. |
output_size | The output size. |
Definition at line 124 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 160 of file helpers.h.
-
-
|
- -inlinestatic | -
Returns the name of the evmc_revision.
- -Definition at line 267 of file helpers.h.
-
-
|
- -inlinestatic | -
Sets the option for the VM, if the feature is supported by the VM.
-Definition at line 76 of file helpers.h.
-
-
|
- -inlinestatic | -
Returns text representation of the evmc_status_code.
- -Definition at line 216 of file helpers.h.
-
-
|
- -inlinestatic | -
Checks if the VM has the given capability.
-Definition at line 56 of file helpers.h.
-
-
|
- -inlinestatic | -
-
|
- -inlinestatic | -
Returns the version of the VM.
- -Definition at line 46 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. More... | |
EVMC_EXPORT const char *const * | evmc_get_instruction_names_table (enum evmc_revision revision) |
Get the table of the EVM 1 instruction names. More... | |
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. More... | |
-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. More... | |
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. More... | |
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. More... | |
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. More... | |
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". More... | |
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". More... | |
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 207 of file helpers.h.
-
-
|
- -static | -
Provides read-write access to evmc_result "optional storage".
- - - -
- EVMC
-
- |
-
EVMC Helpers. -More...
- -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. More... | |
static const char * | evmc_vm_name (struct evmc_vm *vm) |
Returns the name of the VM. More... | |
static const char * | evmc_vm_version (struct evmc_vm *vm) |
Returns the version of the VM. More... | |
static bool | evmc_vm_has_capability (struct evmc_vm *vm, enum evmc_capabilities capability) |
Checks if the VM has the given capability. More... | |
static void | evmc_destroy (struct evmc_vm *vm) |
Destroys the VM instance. More... | |
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. More... | |
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. More... | |
static void | evmc_free_result_memory (const struct evmc_result *result) |
The evmc_result release function using free() for releasing the memory. More... | |
static struct evmc_result | evmc_make_result (enum evmc_status_code status_code, int64_t gas_left, const uint8_t *output_data, size_t output_size) |
Creates the result from the provided arguments. More... | |
static void | evmc_release_result (struct evmc_result *result) |
Releases the resources allocated to the execution result. More... | |
static union evmc_result_optional_storage * | evmc_get_optional_storage (struct evmc_result *result) |
Provides read-write access to evmc_result "optional storage". More... | |
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". More... | |
static const char * | evmc_status_code_to_string (enum evmc_status_code status_code) |
Returns text representation of the evmc_status_code. More... | |
static const char * | evmc_revision_to_string (enum evmc_revision rev) |
Returns the name of the evmc_revision. More... | |
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
-
- |
-
#include <cstdint>
#include <iterator>
#include <string>
#include <string_view>
#include <system_error>
Go to the source code of this file.
--Classes | |
struct | evmc::hex_error |
Hex decoding exception. More... | |
-Namespaces | |
namespace | evmc |
EVMC C++ API - wrappers and bindings for C++. | |
-Typedefs | |
using | evmc::bytes = std::basic_string< uint8_t > |
String of uint8_t chars. More... | |
using | evmc::bytes_view = std::basic_string_view< uint8_t > |
String view of uint8_t chars. More... | |
-Enumerations | |
enum class | evmc::hex_errc { evmc::invalid_hex_digit = 1 -, evmc::incomplete_hex_byte_pair = 2 - } |
Hex decoding error codes. More... | |
-Functions | |
const std::error_category & | evmc::hex_category () noexcept |
Obtains a reference to the static error category object for hex errors. More... | |
std::error_code | evmc::make_error_code (hex_errc errc) noexcept |
Creates error_code object out of a hex error code value. More... | |
std::string | evmc::hex (uint8_t b) noexcept |
Encode a byte to a hex string. More... | |
std::error_code | evmc::validate_hex (std::string_view hex) noexcept |
Validates hex encoded string. More... | |
bytes | evmc::from_hex (std::string_view hex) |
Decodes hex encoded string to bytes. More... | |
std::string | evmc::hex (bytes_view bs) |
Encodes bytes as hex string. More... | |
- EVMC
-
- |
-
- EVMC
-
- |
-
▼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_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::MockedHost::selfdestruct_record | SELFDESTRUCT record |
Cevmc::storage_value | Extended value (by dirty 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
-
- |
-