Documentation
¶
Overview ¶
Package state provides a caching layer atop the Ethereum state trie.
Index ¶
- type Database
- type Dump
- type DumpAccount
- type DumpCollector
- type DumpConfig
- type StateDB
- func (s *StateDB) Copy() *StateDB
- func (s *StateDB) GetState(addr common.Address, hash common.Hash) common.Hash
- func (s *StateDB) GetTxHash() common.Hash
- func (s *StateDB) SetCode(addr common.Address, code []byte, reason tracing.CodeChangeReason) []byte
- func (s *StateDB) SetState(addr common.Address, key, value common.Hash) common.Hash
- func (s *StateDB) SetTxContext(thash common.Hash, ti int)
- func (s *StateDB) VMStateDBAdapter() *ethstate.StateDB
- type StateUpgradeAdapter
- func (a *StateUpgradeAdapter) AddBalance(addr common.Address, amount *uint256.Int)
- func (a *StateUpgradeAdapter) SetCode(addr common.Address, code []byte)
- func (a *StateUpgradeAdapter) SetNonce(addr common.Address, nonce uint64)
- func (a *StateUpgradeAdapter) SetState(addr common.Address, key, value common.Hash)
- type Trie
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DumpAccount ¶
type DumpAccount = ethstate.DumpAccount
type DumpCollector ¶
type DumpCollector = ethstate.DumpCollector
type DumpConfig ¶
type DumpConfig = ethstate.DumpConfig
type StateDB ¶
StateDB structs within the ethereum protocol are used to store anything within the merkle trie. StateDBs take care of caching and storing nested states. It's the general query interface to retrieve:
* Contracts * Accounts
Once the state is committed, tries cached in stateDB (including account trie, storage tries) will no longer be functional. A new state instance must be created with new root and updated database for accessing post- commit states.
func (*StateDB) GetTxHash ¶
GetTxHash returns the current tx hash on the StateDB set by SetTxContext.
func (*StateDB) SetCode ¶ added in v0.8.1
SetCode delegates to the underlying StateDB This wrapper handles compatibility between different geth API versions
func (*StateDB) SetTxContext ¶
SetTxContext sets the current transaction hash and index which are used when the EVM emits new state logs. It should be invoked before transaction execution.
func (*StateDB) VMStateDBAdapter ¶ added in v0.8.8
VMStateDBAdapter provides VM interface compatibility by exposing the underlying geth StateDB
type StateUpgradeAdapter ¶ added in v0.8.6
type StateUpgradeAdapter struct {
*StateDB
}
StateUpgradeAdapter adapts the new geth StateDB interface (with BalanceChangeReason) to the legacy stateupgrade.StateDB interface that doesn't use BalanceChangeReason.
func NewStateUpgradeAdapter ¶ added in v0.8.6
func NewStateUpgradeAdapter(stateDB *StateDB) *StateUpgradeAdapter
NewStateUpgradeAdapter creates a new adapter for state upgrade compatibility
func (*StateUpgradeAdapter) AddBalance ¶ added in v0.8.6
func (a *StateUpgradeAdapter) AddBalance(addr common.Address, amount *uint256.Int)
AddBalance implements the legacy AddBalance without BalanceChangeReason
func (*StateUpgradeAdapter) SetCode ¶ added in v0.8.6
func (a *StateUpgradeAdapter) SetCode(addr common.Address, code []byte)
SetCode implements the stateupgrade.StateDB interface (no return value)