Template Class accessed_state_t#

Nested Relationships#

Nested Types#

Class Documentation#

template<class params>
class accessed_state_t#

The accessed state data class type. YP: accrued transaction substate \(A_{a}\) for accessed accounts \(A_{k}\) for accessed storage keys

Public Types

typedef world_state_t<params> world_state_t#
typedef world_state_t::arith_t arith_t#

The arithmetical environment used by the arbitrary length integer library.

typedef world_state_t::bn_t bn_t#

The arbitrary length integer type.

typedef world_state_t::evm_word_t evm_word_t#

The arbitrary length integer type used for the storage. It is defined as the EVM word type.

typedef world_state_t::contract_storage_t contract_storage_t#

The storage entry type.

typedef world_state_t::account_t account_t#

The account type.

typedef world_state_t::state_data_t state_data_t#

The state data type. Contains the accounts with their storage.

Public Functions

inline __host__ __device__ __forceinline__ accessed_state_t (accessed_state_data_t *content, world_state_t *world_state)

The constructor of the accessed state given the content.

Parameters
  • content – The content of the accessed state

  • world_state – The world state

inline __host__ __device__ __forceinline__ accessed_state_t (world_state_t *world_state)

The constructor of the accessed state given the world state.

Parameters

world_state – The world state

inline __host__ __device__ __forceinline__ ~accessed_state_t ()

The destructor of the accessed state. It frees the memory allocated for the content.

inline __host__ __device__ __forceinline__ size_t get_account_index (bn_t &address, uint32_t &error_code)

Get the index of the account with the given address.

Parameters
  • address[in] The address of the account

  • error_code[out] The error code if the account does not exist

Returns

The index of the account

inline __host__ __device__ __forceinline__ void get_access_account_gas_cost (bn_t &address, bn_t &gas_cost)

Get the gas cost for accessing the account with the given address.

Parameters
  • address[in] The address of the account

  • gas_cost[out] The gas cost for accessing the account

inline __host__ __device__ __forceinline__ account_t * get_account (bn_t &address, uint32_t read_type)

Get the account with the given address. If the account does not exist, it duplicates the one from the world state or if the world state does not contain the account, it creates an empty one.

Parameters
  • address[in] The address of the account

  • read_type[in] The type of the read operation

Returns

The account

inline __host__ __device__ __forceinline__ size_t get_storage_index (account_t *account, bn_t &key, uint32_t &error_code)

Get the index of the storage inside the given account with the given key.

Parameters
  • account[in] The account

  • key[in] The key of the storage

  • error_code[out] The error code if the key is not found

Returns

The index of the storage in the account

inline __host__ __device__ __forceinline__ void get_access_storage_gas_cost (bn_t &address, bn_t &key, bn_t &gas_cost)

Get the gas cost for accessing the storage with the given key from the account with the given address.

Parameters
  • address[in] The address of the account

  • key[in] The key of the storage

  • gas_cost[out] The gas cost for accessing the storage

inline __host__ __device__ __forceinline__ void get_value (bn_t &address, bn_t &key, bn_t &value)

Get the value of the storage with the given key from the account with the given address. If the storage does not exist, it duplicates the one from the world state or if the world state does not contain the storage, it creates an empty one.

Parameters
  • address[in] The address of the account

  • key[in] The key of the storage

  • value[out] The value of the storage

inline __host__ __device__ __forceinline__ void to_accessed_state_data_t (accessed_state_data_t &accessed_state_data)

Copy the content of the accessed state to the given accessed state data.

Parameters

accessed_state_data[out] The accessed state data

inline __host__ __device__ __forceinline__ void print ()

Print the state.

inline __host__ __forceinline__ cJSON * json ()

Get json of the state

Returns

The json of the state

Public Members

accessed_state_data_t *_content#

The content of the accessed state

arith_t _arith#

The arithmetical environment

world_state_t *_world_state#

The world state

Public Static Functions

static inline __host__ accessed_state_data_t * get_cpu_instances (uint32_t count)

Generate the CPU instances of the accessed state data.

Parameters

count[in] The number of instances

static inline __host__ void free_cpu_instances (accessed_state_data_t *cpu_instances, uint32_t count)

Free the CPU instances of the accessed state data.

Parameters
  • cpu_instances[in] The CPU instances

  • count[in] The number of instances

static inline __host__ accessed_state_data_t * get_gpu_instances_from_cpu_instances (accessed_state_data_t *cpu_instances, uint32_t count)

Generate the GPU instances of the accessed state data from the CPU counterparts.

Parameters
  • cpu_instances[in] The CPU instances

  • count[in] The number of instances

static inline __host__ void free_gpu_instances (accessed_state_data_t *gpu_instances, uint32_t count)

Free the GPU instances of the accessed state data.

Parameters
  • gpu_instances[in] The GPU instances

  • count[in] The number of instances

static inline __host__ accessed_state_data_t * get_cpu_instances_from_gpu_instances (accessed_state_data_t *gpu_instances, uint32_t count)

Get the CPU instances of the accessed state data from the GPU counterparts.

Parameters
  • gpu_instances[in] The GPU instances

  • count[in] The number of instances

static inline __host__ __device__ __forceinline__ void print_accessed_state_data_t (arith_t &arith, accessed_state_data_t &accessed_state_data)

Print the accessed state data structure.

Parameters
  • arith[in] The arithemtic instance

  • accessed_state_data[in] The accessed state data

static inline __host__ cJSON * json_from_accessed_state_data_t (arith_t &arith, accessed_state_data_t &accessed_state_data)

Get json from the accessed state data structure.

Parameters
  • arith[in] The arithemtic instance

  • accessed_state_data[in] The accessed state data

Returns

The json of the accessed state data

struct accessed_state_data_t#

The accessed state data type. Contains the accounts with their storage similar to world state. It also contains the information about the read operations performed on the accounts. It can be 0 - no, 1 - bytecode, 2 - balance, 4 - nonce, 8 - storage

Public Members

state_data_t accessed_accounts#

The accessed accounts

uint8_t *reads#

The read operations performed on the accounts