pub struct Account { /* private fields */ }
Expand description

Single account in the system. Keeps track of changes to the code and storage. The changes are applied in commit_storage and commit_code

Implementations

General constructor.

Create a new account with the given balance.

Create a new account from RLP.

Create a new contract account. NOTE: make sure you use init_code on this before commiting.

Set this account’s code to the given code. NOTE: Account should have been created with new_contract()

Reset this account’s code to the given code.

Reset this account’s code and storage to given values.

Set (and cache) the contents of the trie’s storage at key to value.

Get (and cache) the contents of the trie’s storage at key. Takes modified storage into account.

Get (and cache) the contents of the trie’s storage at key. Does not take modified storage into account.

Get cached storage value if any. Returns None if the key is not in the cache.

Get cached original storage value after last state commitment. Returns None if the key is not in the cache.

return the balance associated with this account.

return the nonce associated with this account.

return the code hash associated with this account.

return and cache keccak(address), address must be the address of this account.

returns the account’s code. If None then the code cache isn’t available - get someone who knows to call note_code.

returns the account’s code size. If None then the code cache or code size cache isn’t available - get someone who knows to call note_code.

Is code_cache valid; such that code is going to return Some?

Provide a database to get code_hash. Should not be called if it is a contract without code. Returns the cached code, if successful.

Provide code to cache. For correctness, should be the correct code for the account.

Provide a database to get code_size. Should not be called if it is a contract without code. Returns whether the cache succeeds.

Determine whether there are any un-commit()-ed storage-setting operations.

Check if account has zero nonce, balance, no code and no storage.

NOTE: Will panic if !self.storage_is_clean()

Check if account has zero nonce, balance, no code.

Check if account is basic (Has no code).

Return the storage root associated with this account or None if it has been altered via the overlay.

Return the original storage root of this account.

Whether the base storage root of this account is unchanged.

Storage root where the account changes are based upon.

Return the storage overlay.

Increment the nonce of the account by one.

Increase account balance.

Decrease account balance. Panics if balance is less than x

Commit the storage_changes to the backing DB and update storage_root.

Commit any unsaved code. code_hash will always return the hash of the code_cache after this.

Export to RLP.

Clone basic account data

Clone account data and dirty storage keys

Clone account data, dirty storage keys and cached storage keys.

Replace self with the data from other account merging storage cache. Basic account data and all modifications are overwritten with new values.

Prove a storage key’s existence or nonexistence in the account’s storage trie. storage_key is the hash of the desired storage key, meaning this will only work correctly under a secure trie.

Trait Implementations

Formats the value using the given formatter. Read more

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.