Template Class environmental_operations#
Defined in File env_operations.cuh
Class Documentation#
-
template<class params>
class environmental_operations# The environmental operations class. Contains the environmental operations
20s: KECCAK256:
SHA3
30s: Environmental Information:
ADDRESS
BALANCE
ORIGIN
CALLER
CALLVALUE
CALLDATALOAD
CALLDATASIZE
CALLDATACOPY
CODESIZE
CODECOPY
GASPRICE
EXTCODESIZE
EXTCODECOPY
RETURNDATASIZE
RETURNDATACOPY
EXTCODEHASH
Public Types
-
typedef arith_env_t<params> arith_t#
The arithmetical environment used by the arbitrary length integer library.
-
typedef touch_state_t<params> touch_state_t#
The touch state class.
-
typedef transaction_t<params> transaction_t#
The transaction class.
Public Static Functions
- static inline __host__ __device__ __forceinline__ void operation_SHA3 (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack, keccak_t &keccak, memory_t &memory)
The SHA3 operation implementation. Takes the offset and length from the stack and pushes the hash of the data from the memory at the given offset for the given length. The dynamic gas cost is computed as:
word_size = (length + 31) / 32
dynamic_gas_cost = word_size * GAS_KECCAK256_WORD Adittional gas cost is added for the memory expansion.
- Parameters
arith – [in] The arithmetical environment.
gas_limit – [in] The gas limit.
gas_used – [inout] The gas used.
error_code – [out] The error code.
pc – [inout] The program counter.
stack – [inout] The stack.
keccak – [in] The keccak object.
memory – [inout] The memory object.
- static inline __host__ __device__ __forceinline__ void operation_ADDRESS (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack, message_t &message)
The ADDRESS operation implementation. Pushes on the stack the address of currently executing account. The executing account is consider the current context, so it can be different than the owner of the code.
- Parameters
arith – [in] The arithmetical environment.
gas_limit – [in] The gas limit.
gas_used – [inout] The gas used.
error_code – [out] The error code.
pc – [inout] The program counter.
stack – [out] The stack.
message – [in] The message.
- static inline __host__ __device__ __forceinline__ void operation_BALANCE (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack, touch_state_t &touch_state)
The BALANCE operation implementation. Takes the address from the stack and pushes the balance of the account with that address. Gas is charged for accessing the account if it is warm or cold access.
- Parameters
arith – [in] The arithmetical environment.
gas_limit – [in] The gas limit.
gas_used – [inout] The gas used.
error_code – [out] The error code.
pc – [inout] The program counter.
stack – [inout] The stack.
touch_state – [in] The touch state object.
- static inline __host__ __device__ __forceinline__ void operation_ORIGIN (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack, transaction_t &transaction)
The ORIGIN operation implementation. Pushes on the stack the address of the sender of the transaction that started the execution.
- Parameters
arith – [in] The arithmetical environment.
gas_limit – [in] The gas limit.
gas_used – [inout] The gas used.
error_code – [out] The error code.
pc – [inout] The program counter.
stack – [out] The stack.
transaction – [in] The transaction.
- static inline __host__ __device__ __forceinline__ void operation_CALLER (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack, message_t &message)
The CALLER operation implementation. Pushes on the stack the address of the sender of the message that started the execution.
- Parameters
arith – [in] The arithmetical environment.
gas_limit – [in] The gas limit.
gas_used – [inout] The gas used.
error_code – [out] The error code.
pc – [inout] The program counter.
stack – [out] The stack.
message – [in] The message.
- static inline __host__ __device__ __forceinline__ void operation_CALLVALUE (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack, message_t &message)
The CALLVALUE operation implementation. Pushes on the stack the value of the message that started the execution.
- Parameters
arith – [in] The arithmetical environment.
gas_limit – [in] The gas limit.
gas_used – [inout] The gas used.
error_code – [out] The error code.
pc – [inout] The program counter.
stack – [out] The stack.
message – [in] The message.
- static inline __host__ __device__ __forceinline__ void operation_CALLDATALOAD (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack, message_t &message)
The CALLDATALOAD operation implementation. Takes the index from the stack and pushes the data from the message call data at the given index. The data pushed is a evm word. If the call data has less bytes than neccessay to fill the evm word, the remaining bytes are filled with zeros. (the least significant bytes)
- Parameters
arith – [in] The arithmetical environment.
gas_limit – [in] The gas limit.
gas_used – [inout] The gas used.
error_code – [out] The error code.
pc – [inout] The program counter.
stack – [inout] The stack.
message – [in] The message.
- static inline __host__ __device__ __forceinline__ void operation_CALLDATASIZE (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack, message_t &message)
The CALLDATASIZE operation implementation. Pushes on the stack the size of the message call data.
- Parameters
arith – [in] The arithmetical environment.
gas_limit – [in] The gas limit.
gas_used – [inout] The gas used.
error_code – [out] The error code.
pc – [inout] The program counter.
stack – [out] The stack.
message – [in] The message.
- static inline __host__ __device__ __forceinline__ void operation_CALLDATACOPY (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack, message_t &message, memory_t &memory)
The CALLDATACOPY operation implementation. Takes the memory offset, data offset and length from the stack and copies the data from the message call data at the given data offset for the given length to the memory at the given memory offset. If the call data has less bytes than neccessay to fill the memory, the remaining bytes are filled with zeros. The dynamic gas cost is computed as:
word_size = (length + 31) / 32
dynamic_gas_cost = word_size * GAS_MEMORY Adittional gas cost is added for the memory expansion.
- Parameters
arith – [in] The arithmetical environment.
gas_limit – [in] The gas limit.
gas_used – [inout] The gas used.
error_code – [out] The error code.
pc – [out] The program counter.
stack – [inout] The stack.
message – [in] The message.
memory – [out] The memory.
- static inline __host__ __device__ __forceinline__ void operation_CODESIZE (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack, message_t &message)
The CODESIZE operation implementation. Pushes on the stack the size of code running in current environment.
- Parameters
arith – [in] The arithmetical environment.
gas_limit – [in] The gas limit.
gas_used – [inout] The gas used.
error_code – [out] The error code.
pc – [inout] The program counter.
stack – [out] The stack.
message – [in] The message.
- static inline __host__ __device__ __forceinline__ void operation_CODECOPY (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack, message_t &message, memory_t &memory)
The CODECOPY operation implementation. Takes the memory offset, code offset and length from the stack and copies code running in current environment at the given code offset for the given length to the memory at the given memory offset. If the code has less bytes than neccessay to fill the memory, the remaining bytes are filled with zeros. The dynamic gas cost is computed as:
word_size = (length + 31) / 32
dynamic_gas_cost = word_size * GAS_MEMORY Adittional gas cost is added for the memory expansion.
- Parameters
arith – [in] The arithmetical environment.
gas_limit – [in] The gas limit.
gas_used – [inout] The gas used.
error_code – [out] The error code.
pc – [inout] The program counter.
stack – [inout] The stack.
message – [in] The message.
touch_state – [in] The touch state object. The executing world state.
memory – [out] The memory.
- static inline __host__ __device__ __forceinline__ void operation_GASPRICE (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack, block_t &block, transaction_t &transaction)
The GASPRICE operation implementation. Pushes on the stack the gas price of the current transaction. The gas price is the price per unit of gas in the transaction.
- Parameters
arith – [in] The arithmetical environment.
gas_limit – [in] The gas limit.
gas_used – [inout] The gas used.
error_code – [out] The error code.
pc – [inout] The program counter.
stack – [out] The stack.
block – [in] The block.
transaction – [in] The transaction.
- static inline __host__ __device__ __forceinline__ void operation_EXTCODESIZE (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack, touch_state_t &touch_state)
The EXTCODESIZE operation implementation. Takes the address from the stack and pushes the size of the code of the account with that address. Gas is charged for accessing the account if it is warm or cold access.
- Parameters
arith – [in] The arithmetical environment.
gas_limit – [in] The gas limit.
gas_used – [inout] The gas used.
error_code – [out] The error code.
pc – [inout] The program counter.
stack – [inout] The stack.
touch_state – [in] The touch state object. The executing world state.
- static inline __host__ __device__ __forceinline__ void operation_EXTCODECOPY (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack, touch_state_t &touch_state, memory_t &memory)
The EXTCODECOPY operation implementation. Takes the address, memory offset, code offset and length from the stack and copies the code from the account with the given address at the given code offset for the given length to the memory at the given memory offset. If the code has less bytes than neccessay to fill the memory, the remaining bytes are filled with zeros. The dynamic gas cost is computed as:
word_size = (length + 31) / 32
dynamic_gas_cost = word_size * GAS_MEMORY Adittional gas cost is added for the memory expansion. Gas is charged for accessing the account if it is warm or cold access.
- Parameters
arith – [in] The arithmetical environment.
gas_limit – [in] The gas limit.
gas_used – [inout] The gas used.
error_code – [out] The error code.
pc – [inout] The program counter.
stack – [in] The stack.
touch_state – [in] The touch state object. The executing world state.
memory – [out] The memory.
- static inline __host__ __device__ __forceinline__ void operation_RETURNDATASIZE (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack, return_data_t &return_data)
The RETURNDATASIZE operation implementation. Pushes on the stack the size of the return data of the last call.
- Parameters
arith – [in] The arithmetical environment.
gas_limit – [in] The gas limit.
gas_used – [inout] The gas used.
error_code – [out] The error code.
pc – [inout] The program counter.
stack – [out] The stack.
return_data – [in] The return data.
- static inline __host__ __device__ __forceinline__ void operation_RETURNDATACOPY (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack, memory_t &memory, return_data_t &return_data)
The RETURNDATACOPY operation implementation. Takes the memory offset, data offset and length from the stack and copies the return data from the last call at the given data offset for the given length to the memory at the given memory offset. If the return data has less bytes than neccessay to fill the memory, an ERROR is generated. The dynamic gas cost is computed as:
word_size = (length + 31) / 32
dynamic_gas_cost = word_size * GAS_MEMORY Adittional gas cost is added for the memory expansion.
- Parameters
arith – [in] The arithmetical environment.
gas_limit – [in] The gas limit.
gas_used – [inout] The gas used.
error_code – [out] The error code.
pc – [inout] The program counter.
stack – [in] The stack.
memory – [out] The memory.
return_data – [in] The return data.
- static inline __host__ __device__ __forceinline__ void operation_EXTCODEHASH (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack, touch_state_t &touch_state, keccak_t &keccak)
The EXTCODEHASH operation implementation. Takes the address from the stack and pushes the hash of the code of the account with that address. Gas is charged for accessing the account if it is warm or cold access. If the account does not exist or is empty or the account is selfdestructed, the hash is zero.
- Parameters
arith – [in] The arithmetical environment.
gas_limit – [in] The gas limit.
gas_used – [inout] The gas used.
error_code – [out] The error code.
pc – [inout] The program counter.
stack – [inout] The stack.
touch_state – [in] The touch state object. The executing world state.
keccak – [in] The keccak object.
- static inline __host__ __device__ __forceinline__ void operation_SELFBALANCE (arith_t &arith, bn_t &gas_limit, bn_t &gas_used, uint32_t &error_code, uint32_t &pc, stack_t &stack, touch_state_t &touch_state, message_t &message)
The SELFBALANCE operation implementation. Pushes on the stack the balance of the current contract. The current contract is consider the contract that owns the execution code.
- Parameters
arith – [in] The arithmetical environment.
gas_limit – [in] The gas limit.
gas_used – [inout] The gas used.
error_code – [out] The error code.
pc – [inout] The program counter.
stack – [out] The stack.
touch_state – [inout] The touch state object. The executing world state.
transaction – [in] The transaction.
Public Static Attributes
-
static const uint32_t HASH_BYTES = 32#
The numver of bytes in a hash.