Template Class world_state_t#
Defined in File state.cuh
Nested Relationships#
Nested Types#
Class Documentation#
-
template<class params>
class world_state_t# The world state (YP: \(\sigma\)) class. It cotains all the active accounts and their storage.
Public Types
-
typedef arith_env_t<params> arith_t#
The arithmetical environment used by the arbitrary length integer library.
Public Functions
- inline __host__ __device__ __forceinline__ world_state_t (arith_t arith, state_data_t *content)
The constructor of the state given the content.
- Parameters
arith – The arithmetical environment
content – The content of the state
- inline __host__ __device__ __forceinline__ ~world_state_t ()
The destructor of the state.
- inline __host__ void free_content ()
The destructor of the state on the host. It use cudaFree to free the memory, because the state is allocated with cudaMallocManaged.
-
inline __host__ world_state_t(arith_t arith, const cJSON *test)#
The constructor of the state on the host.
It reads the json file and creates the state. It pass through all the account and their storage and creates the corresponding data. It used unnified memory so the state can be easily used on the device.
- Parameters
arith – The arithmetical environment
test – the json for the current test
- 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__ account_t * get_account (bn_t &address, uint32_t &error_code)
Get 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 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_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.
- 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 print ()
Print the state.
- inline __host__ __forceinline__ cJSON * json ()
Get json of the state
- Returns
The json of the state
Public Members
-
state_data_t *_content#
The content of the state
Public Static Functions
- static inline __host__ __device__ __forceinline__ void print_account_t (arith_t &arith, account_t &account)
Print the account.
- Parameters
arith – [in] The arithmetical environment
account – [in] The account
- static inline __host__ cJSON * json_from_account_t (arith_t &arith, account_t &account)
Get json of the account
- Parameters
arith – [in] The arithmetical environment
account – [in] The account
- Returns
The json of the account
- static inline __host__ __device__ __forceinline__ void print_state_data_t (arith_t &arith, state_data_t &state_data)
Print the state data structure.
- Parameters
arith – [in] The arithmetical environment
state_data – [in] The state data
- static inline __host__ __forceinline__ cJSON * json_from_state_data_t (arith_t &arith, state_data_t &state_data)
Get json from the state data structure.
-
struct contract_storage_t#
The storage entry type.
Public Members
-
evm_word_t key#
The key of the storage
-
evm_word_t value#
The value of the storage for the given key
-
evm_word_t key#
-
struct state_data_t#
The state data type.
-
typedef arith_env_t<params> arith_t#