Template Class transaction_t#

Nested Relationships#

Nested Types#

Class Documentation#

template<class params>
class transaction_t#

The transaction type YP: \(T\)

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 message_t<params> message_t#

The message type.

typedef world_state_t<params> world_state_t#

The world state class.

typedef accessed_state_t<params> accessed_state_t#

The accessed state class.

typedef touch_state_t<params> touch_state_t#

The touch state class.

typedef world_state_t::account_t account_t#

The account class.

typedef keccak::keccak_t keccak_t#

THe keccak class

Public Functions

inline __host__ __device__ __forceinline__ transaction_t (arith_t arith, transaction_data_t *content)

The constructor. Takes the transaction content.

Parameters
  • arith[in] The arithmetical environment.

  • content[in] The transaction content.

inline __host__ __device__ __forceinline__ ~transaction_t ()

The destructor.

inline __host__ __device__ __forceinline__ void get_nonce (bn_t &nonce)

Get the transation nonce.

Parameters

nonce[out] The nonce YP: \(T_{n}\).

inline __host__ __device__ __forceinline__ void get_gas_limit (bn_t &gas_limit)

Get the transation gas limit.

Parameters

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

inline __host__ __device__ __forceinline__ void get_to (bn_t &to)

Get the transaction receiver.

Parameters

to[out] The receiver address YP: \(T_{t}\).

inline __host__ __device__ __forceinline__ void get_value (bn_t &value)

Get the transaction value.

Parameters

value[out] The value YP: \(T_{v}\).

inline __host__ __device__ __forceinline__ void get_sender (bn_t &sender)

Get the transaction sender.

Parameters

sender[out] The sender address YP: \(T_{s}\) or \(T_{r}\).

inline __host__ __device__ __forceinline__ void get_max_fee_per_gas (bn_t &max_fee_per_gas)

Get the maximum fee per gas.

Parameters

max_fee_per_gas[out] The maximum fee per gas YP: \(T_{m}\).

inline __host__ __device__ __forceinline__ void get_max_priority_fee_per_gas (bn_t &max_priority_fee_per_gas)

Get the maximum priority fee per gas.

Parameters

max_priority_fee_per_gas[out] The maximum priority fee per gas YP: \(T_{f}\).

inline __host__ __device__ __forceinline__ void get_gas_price (bn_t &gas_price)

Get the transaction gas price.

Parameters

gas_price[out] The gas price YP: \(T_{p}\).

inline __host__ __device__ __forceinline__ void get_intrisinc_gas (bn_t &intrisinc_gas, accessed_state_t &accessed_state)

Get the intrisinc gas value for the transacation. Add the accounts and storage keys from access list to the warm accessed accounts and storage keys.

Parameters
  • intrisinc_gas[out] The intrisinc gas value YP: \(g_{0}\).

  • accessed_state[out] The accessed state.

inline __host__ __device__ __forceinline__ uint32_t get_transaction_fees (bn_t &gas_value, bn_t &gas_limit, bn_t &gas_price, bn_t &gas_priority_fee, bn_t &up_front_cost, bn_t &m, bn_t &block_base_fee)

Get the transaction fees. The fees are computed based on the transaction information and block base fee.

Parameters
  • gas_value[out] The WEI gas value YP: \(p \dot T_{g}\)

  • gas_limit[out] The gas limit YP: \(T_{g}\)

  • gas_price[out] The gas price YP: \(p\)

  • gas_priority_fee[out] The gas priority fee YP: \(f\)

  • up_front_cost[out] The up front cost YP: \(v_{0}\)

  • m[out] The max gas fee YP: \(m\)

  • block_base_fee[in] The block base fee YP: \(H_{f}\)

Returns

The error code.

inline __host__ __device__ __forceinline__ void get_computed_gas_price (bn_t &gas_price, bn_t &block_base_fee, uint32_t &error_code)
inline __host__ __device__ void validate_transaction (touch_state_t &touch_state, bn_t &gas_used, bn_t &gas_price, bn_t &gas_priority_fee, uint32_t &error_code, bn_t &block_base_fee, bn_t &block_gas_limit)

Validate the transaction. The validation is done based on the transaction information and block base fee. It gives the gas price, the gas used for the transaction, the gas priority fee, the error code (if the transaction is invalid). If the transaction is valid it updates the touch state by subtracting the gas value from the sender balance and incrementing the sender nonce.

Parameters
  • touch_state[out] The touch state.

  • gas_used[out] The gas used YP: \(g_{0}\)

  • gas_price[out] The gas price YP: \(p\)

  • gas_priority_fee[out] The gas priority fee YP: \(f\)

  • error_code[out] The error code.

  • block_base_fee[in] The block base fee YP: \(H_{f}\)

  • block_gas_limit[in] The block gas limit YP: \(H_{l}\)

inline __host__ __device__ message_t * get_message_call (accessed_state_t &accessed_state, keccak_t &keccak)

Get the message call from the transaction.

Returns

The message call.

inline __host__ __device__ void print ()

Print the transaction information.

inline __host__ cJSON * json ()

Get the transaction in json format.

Returns

The transaction in json format.

Public Members

transaction_data_t *_content#

The transaction content

arith_t _arith#

The arithmetic

Public Static Functions

static inline __host__ __device__ void print_transaction_data_t (arith_t &arith, transaction_data_t &transaction_data)

Print the transaction data structure.

Parameters
  • arith[in] The arithmetical environment.

  • transaction_data[in] The transaction data.

static inline __host__ size_t get_no_transaction (const cJSON *test)

Get the number of transactions from a test in json format.

Parameters

test[in] The json format of the test.

Returns

The number of transactions.

static inline __host__ void get_transactions (transaction_data_t *&transactions, const cJSON *test, size_t &count, size_t start_index=0)

Get the transactions from a test in json format. The number of transaction is limited by MAX_TRANSACTION_COUNT.

Parameters
  • transactions[out] The transactions.

  • test[in] The json format of the test.

  • count[out] The number of transactions.

  • start_index[in] The index of the first transaction to be returned.

static inline __host__ void free_instances (transaction_data_t *transactions, size_t count)

Free the memory allocated for transactions.

Parameters
  • transactions[in] The transactions.

  • count[in] The number of transactions.

Public Static Attributes

static const size_t MAX_TRANSACTION_COUNT = 2000#

The maximum number of transactions per test.

struct access_list_account_t#

The access list account. YP: \(E_{a}\)

Public Members

evm_word_t address#

The address YP: \(a\)

uint32_t no_storage_keys#

The number of storage keys YP: \(|E_{s}|\)

evm_word_t *storage_keys#

The storage keys YP: \(E_{s}\)

struct access_list_t#

The access list. YP: \(T_{A}\)

Public Members

uint32_t no_accounts#

The number of accounts YP: \(|T_{A}|\)

access_list_account_t *accounts#

The accounts YP: \(T_{A}\)