Template Class message_t#

Nested Relationships#

Nested Types#

Class Documentation#

template<class params>
class message_t#

The message call class. YP: \(M\)

Public Types

typedef arith_env_t<params> arith_t#

The arithmetical environment used by the arbitrary length integer library.

typedef arith_t::bn_t bn_t#

The arbitrary length integer type.

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 keccak::keccak_t keccak_t#

THe keccak class

Public Functions

inline __host__ __device__ __forceinline__ message_t (arith_t &arith, bn_t &sender, bn_t &recipient, bn_t &contract_address, bn_t &gas_limit, bn_t &value, uint32_t depth, uint8_t call_type, bn_t &storage_address, uint8_t *data, size_t data_size, uint8_t *byte_code, size_t byte_code_size, bn_t &return_data_offset, bn_t &return_data_size, uint32_t static_env=0)

The constructor. Takes the message parameters.

Parameters
  • arith[in] The arithmetical environment.

  • sender[in] The sender address YP: \(s\).

  • recipient[in] The recipient address YP: \(r\).

  • contract_address[in] The contract address YP: \(c\).

  • gas_limit[in] The gas limit YP: \(g\).

  • value[in] The value YP: \(v\) or \(v^{'}\) for DelegateCALL.

  • depth[in] The depth YP: \(e\).

  • call_type[in] The call type internal has the opcode YP: \(w\).

  • storage_address[in] The storage address YP: \(a\).

  • data[in] The data YP: \(d\).

  • data_size[in] The data size YP: \(|d|\).

  • byte_code[in] The byte code YP: \(b\).

  • byte_code_size[in] The byte code size YP: \(|b|\).

  • return_data_offset[in] The return data offset in memory.

  • return_data_size[in] The return data size in memory.

  • static_env[in] The static flag (STATICCALL) YP: \(w\).

inline __host__ __device__ __forceinline__ ~message_t ()

The destructor.

inline __host__ __device__ __forceinline__ void get_sender (bn_t &sender)

Get the sender address.

Parameters

sender[out] The sender address YP: \(s\).

inline __host__ __device__ __forceinline__ void get_recipient (bn_t &recipient)

Get the recipient address.

Parameters

recipient[out] The recipient address YP: \(r\).

inline __host__ __device__ __forceinline__ void get_contract_address (bn_t &contract_address)

Get the contract address.

Parameters

contract_address[out] The contract address YP: \(c\).

inline __host__ __device__ __forceinline__ void get_gas_limit (bn_t &gas_limit)

Get the gas limit.

Parameters

gas_limit[out] The gas limit YP: \(g\).

inline __host__ __device__ __forceinline__ void get_value (bn_t &value)

Get the value.

Parameters

value[out] The value YP: \(v\) or \(v^{'}\) for DelegateCALL.

inline __host__ __device__ __forceinline__ uint32_t get_depth ()

Get the depth.

Returns

The depth YP: \(e\).

inline __host__ __device__ __forceinline__ uint8_t get_call_type ()

Get the call type.

Returns

The call type internal has the opcode YP: \(w\).

inline __host__ __device__ __forceinline__ void get_storage_address (bn_t &storage_address)

Get the storage address.

Parameters

storage_address[out] The storage address YP: \(a\).

inline __host__ __device__ __forceinline__ size_t get_data_size ()

Get the call/init data size.

Returns

The data size YP: \(|d|\).

inline __host__ __device__ __forceinline__ uint8_t * get_data (bn_t &index, bn_t &length, size_t &available_size)

Get the call/init data.

Parameters
  • index[in] The index of the first byte to be returned.

  • length[in] The number of bytes to be returned.

  • available_size[out] The number of bytes available starting from index.

Returns

The pointer to the data.

inline __host__ __device__ __forceinline__ size_t get_code_size ()

Get the byte code size.

Returns

The byte code size YP: \(|b|\).

inline __host__ __device__ __forceinline__ uint8_t * get_byte_code ()

Get the byte code.

Returns

The pointer to the byte code YP: \(b\).

inline __host__ __device__ __forceinline__ uint8_t * get_byte_code_data (bn_t &index, bn_t &length, size_t &available_size)

Get the code at the given index for the given length. If the index is greater than the code size, it returns NULL. If the length is greater than the code size - index, it returns the code data from index to the end of the code and sets the available size to the code size - index. Otherwise, it returns the code data from index to index + length and sets the available size to length.

Parameters
  • index[in] The index of the code data

  • length[in] The length of the code data

  • available_size[out] The available size of the code data

inline __host__ __device__ __forceinline__ void get_return_data_offset (bn_t &return_data_offset)

Get the return data offset.

Parameters

return_data_offset[out] The return data offset in memory.

inline __host__ __device__ __forceinline__ void get_return_data_size (bn_t &return_data_size)

Get the return data size.

Parameters

return_data_size[out] The return data size in memory.

inline __host__ __device__ __forceinline__ uint32_t get_static_env ()

Get the static flag.

Returns

The static flag (STATICCALL) YP: \(w\).

inline __host__ __device__ __forceinline__ void set_gas_limit (bn_t &gas_limit)

Set the gas limit.

Parameters

gas_limit[in] The gas limit YP: \(g\).

inline __host__ __device__ __forceinline__ void set_data (uint8_t *data, size_t data_size)

Set the call data.

Parameters
  • data[in] The data YP: \(d\).

  • data_size[in] The data size YP: \(|d|\).

inline __host__ __device__ __forceinline__ void set_byte_code (uint8_t *byte_code, size_t byte_code_size)

Set the byte code.

Parameters
  • byte_code[in] The byte code YP: \(b\).

  • byte_code_size[in] The byte code size YP: \(|b|\).

inline __host__ __device__ __forceinline__ void set_return_data_offset (bn_t &return_data_offset)

Set the return data offset.

Parameters

return_data_offset[in] The return data offset in memory.

inline __host__ __device__ __forceinline__ void set_return_data_size (bn_t &return_data_size)

Set the return data size.

Parameters

return_data_size[in] The return data size in memory.

inline __host__ __device__ __forceinline__ void print ()

Print the message.

Public Members

message_data_t *_content#

The message content

arith_t _arith#

The arithmetical environment

Public Static Functions

static inline __host__ __device__ __forceinline__ void get_create_contract_address (arith_t &arith, bn_t &contract_address, bn_t &sender_address, bn_t &sender_nonce, keccak_t &keccak)
static inline __host__ __device__ __forceinline__ void get_create2_contract_address (arith_t &arith, bn_t &contract_address, bn_t &sender_address, bn_t &salt, data_content_t &byte_code, keccak_t &keccak)

Get the CREATE2 contract address.

Parameters
  • arith[in] The arithmetical environment.

  • contract_address[out] The contract address YP: \(a\).

  • sender_address[in] The sender address YP: \(s\).

  • salt[in] The salt YP: \(n\).

  • byte_code[in] The byte code YP: \(b\).

  • keccak[in] The keccak class.

Public Static Attributes

static const uint32_t HASH_BYTES = 32#

the number of byte in hash

struct message_data_t#

The message data.

Public Members

evm_word_t sender#

The sender address YP: \(s\)

evm_word_t recipient#

The recipient address YP: \(r\) also \(I_{a}\)

evm_word_t contract_address#

The contract address YP: \(c\)

evm_word_t gas_limit#

The gas limit YP: \(g\)

evm_word_t value#

The value YP: \(v\) or \(v^{'}\) for DelegateCALL

uint32_t depth#

The depth YP: \(e\)

uint8_t call_type#

The call type internal has the opcode

evm_word_t storage_address#

The storage address YP: \(a\)

data_content_t data#

The data YP: \(d\)

data_content_t byte_code#

The byte code YP: \(b\) or \(I_{b}\)

evm_word_t return_data_offset#

The return data offset in memory

evm_word_t return_data_size#

The return data size in memory

uint32_t static_env#

The static flag (STATICCALL) YP: \(w\)