EVMC
example_vm.cpp File Reference

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_vmevmc_create_example_vm ()
 Example of a function creating an instance of an example EVM implementation.
 

Detailed Description

Example implementation of the EVMC VM interface.

This VM implements a subset of EVM instructions in simplistic, incorrect and unsafe way:

  • memory bounds are not checked,
  • stack bounds are not checked,
  • most of the operations are done with 32-bit precision (instead of EVM 256-bit precision). Yet, it is capable of coping with some example EVM bytecode inputs, which is very useful in integration testing. The implementation is done in simple C++ for readability and uses pure C API and some C helpers.

Definition in file example_vm.cpp.