Template Class tracer_t#
Defined in File tracer.cuh
Class Documentation#
-
template<class params>
class tracer_t# The tracer class is used to store the execution trace of the EVM. It is used to generate the execution trace JSON file. It contains the following information:
the address of the contract
the program counter
the opcode
the stack
the memory
the touched accounts
the gas used
the gas limit
the gas refund
the error code
Public Types
-
typedef arith_env_t<params> arith_t#
The arithmetical environment used by the arbitrary length integer library.
-
typedef cgbn_mem_t<params::BITS> evm_word_t#
The arbitrary length integer type used for the storage. It is defined as the EVM word type.
-
typedef touch_state_t<params> touch_state_t#
The touch state type.
-
typedef touch_state_t::touch_state_data_t touch_state_data_t#
The touch state data type.
Public Functions
- inline __host__ __device__ __forceinline__ tracer_t (arith_t arith, tracer_data_t *content)
The constructor of the tracer.
- inline __host__ __device__ __forceinline__ ~tracer_t ()
The destructor of the tracer.
- inline __host__ __device__ __forceinline__ void grow ()
The grow function when the capacity is full.
- inline __host__ __device__ __forceinline__ void push (bn_t &address, uint32_t pc, uint8_t opcode, stack_t &stack, memory_t &memory, touch_state_t &touch_state, bn_t &gas_used, bn_t &gas_limit, bn_t &gas_refund, uint32_t error_code)
The push function to add a new element to the trace.
- Parameters
address – [in] The address of the contract.
pc – [in] The program counter.
opcode – [in] The opcode.
stack – [in] The stack.
memory – [in] The memory.
touch_state – [in] The touched accounts.
gas_used – [in] The gas used.
gas_limit – [in] The gas limit.
gas_refund – [in] The gas refund.
error_code – [in] The error code.
- inline __host__ __device__ __forceinline__ void modify_last_stack (stack_t &stack)
Modify the last stack of the trace.
- Parameters
stack – [in] The stack.
- inline __host__ __device__ void print ()
Print the tracer.
- inline __host__ cJSON * json ()
Get the json object from the tracer.
- Returns
The json object.
Public Members
-
tracer_data_t *_content#
The content of the tracer
Public Static Functions
- static inline __host__ __device__ __forceinline__ void print_tracer_data_t (arith_t &arith, tracer_data_t &tracer_data)
Print the trace data structure.
- Parameters
arith – [in] The arithmetical environment.
tracer_data – [in] The trace data structure.
- static inline __host__ cJSON * json_from_tracer_data_t (arith_t &arith, tracer_data_t &tracer_data)
Get the json object from the tracer data structure.
- Parameters
arith – [in] The arithmetical environment.
tracer_data – [in] The trace data structure.
- Returns
The json object.
- static inline __host__ tracer_data_t * get_cpu_instances (uint32_t count)
Get the cpu tracer data structures.
- Parameters
count – [in] The number of tracer data structures.
- Returns
The cpu tracer data structures.
- static inline __host__ void free_cpu_instances (tracer_data_t *cpu_instances, uint32_t count)
Free the cpu tracer data structures.
- Parameters
cpu_instances – [in] The cpu tracer data structures.
count – [in] The number of tracer data structures.
- static inline __host__ tracer_data_t * get_gpu_instances_from_cpu_instances (tracer_data_t *cpu_instances, uint32_t count)
Get the gpu tracer data structures from the cpu tracer data structures.
- Parameters
cpu_instances – [in] The cpu tracer data structures.
count – [in] The number of tracer data structures.
- Returns
The gpu tracer data structures.
- static inline __host__ void free_gpu_instances (tracer_data_t *gpu_instances, uint32_t count)
Free the gpu tracer data structures.
- Parameters
gpu_instances – [in] The gpu tracer data structures.
count – [in] The number of tracer data structures.
- static inline __host__ tracer_data_t * get_cpu_instances_from_gpu_instances (tracer_data_t *gpu_instances, uint32_t count)
Get the cpu tracer data structures from the gpu tracer data structures. Frees the GPU memory.
- Parameters
gpu_instances – [in] The gpu tracer data structures.
count – [in] The number of tracer data structures.
- Returns
The cpu tracer data structures.
Public Static Attributes
-
static const size_t PAGE_SIZE = 128#
The stept of page allocation for the trace