Documentation ¶
Overview ¶
Package state provides a caching layer atop the Ethereum state trie.
Index ¶
- Constants
- Variables
- func ReconnLess(i, thanItem reconPair) bool
- type BalanceIncrease
- type BlockContext
- type CachedReader
- func (cr *CachedReader) ReadAccountCode(address common.Address, incarnation uint64, codeHash common.Hash) ([]byte, error)
- func (cr *CachedReader) ReadAccountCodeSize(address common.Address, incarnation uint64, codeHash common.Hash) (int, error)
- func (cr *CachedReader) ReadAccountData(address common.Address) (*accounts.Account, error)
- func (cr *CachedReader) ReadAccountIncarnation(address common.Address) (uint64, error)
- func (cr *CachedReader) ReadAccountStorage(address common.Address, incarnation uint64, key *common.Hash) ([]byte, error)
- type CachedReader3
- func (r *CachedReader3) ReadAccountCode(address common.Address, incarnation uint64, codeHash common.Hash) ([]byte, error)
- func (r *CachedReader3) ReadAccountCodeSize(address common.Address, incarnation uint64, codeHash common.Hash) (int, error)
- func (r *CachedReader3) ReadAccountData(address common.Address) (*accounts.Account, error)
- func (r *CachedReader3) ReadAccountIncarnation(address common.Address) (uint64, error)
- func (r *CachedReader3) ReadAccountStorage(address common.Address, incarnation uint64, key *common.Hash) ([]byte, error)
- type CachedWriter
- func (cw *CachedWriter) CreateContract(address common.Address) error
- func (cw *CachedWriter) DeleteAccount(address common.Address, original *accounts.Account) error
- func (cw *CachedWriter) UpdateAccountCode(address common.Address, incarnation uint64, codeHash common.Hash, code []byte) error
- func (cw *CachedWriter) UpdateAccountData(address common.Address, original, account *accounts.Account) error
- func (cw *CachedWriter) WriteAccountStorage(address common.Address, incarnation uint64, key *common.Hash, ...) error
- func (cw *CachedWriter) WriteChangeSets() error
- func (cw *CachedWriter) WriteHistory() error
- type CanTransferFunc
- type Code
- type Dump
- type DumpAccount
- type DumpCollector
- type Dumper
- func (d *Dumper) DefaultDump() []byte
- func (d *Dumper) DefaultRawDump() Dump
- func (d *Dumper) Dump(excludeCode, excludeStorage bool) []byte
- func (d *Dumper) DumpToCollector(c DumpCollector, excludeCode, excludeStorage bool, ...) ([]byte, error)
- func (d *Dumper) IterativeDump(excludeCode, excludeStorage bool, output *json.Encoder)
- func (d *Dumper) IteratorDump(excludeCode, excludeStorage bool, start libcommon.Address, maxResults int) (IteratorDump, error)
- func (d *Dumper) RawDump(excludeCode, excludeStorage bool) Dump
- type GetHashFunc
- type HistoricalStateReader
- type HistoryReaderV3
- func (hr *HistoryReaderV3) DiscardReadList()
- func (hr *HistoryReaderV3) GetTxNum() uint64
- func (hr *HistoryReaderV3) ReadAccountCode(address common.Address, incarnation uint64, codeHash common.Hash) ([]byte, error)
- func (hr *HistoryReaderV3) ReadAccountCodeSize(address common.Address, incarnation uint64, codeHash common.Hash) (int, error)
- func (hr *HistoryReaderV3) ReadAccountData(address common.Address) (*accounts.Account, error)
- func (hr *HistoryReaderV3) ReadAccountIncarnation(address common.Address) (uint64, error)
- func (hr *HistoryReaderV3) ReadAccountStorage(address common.Address, incarnation uint64, key *common.Hash) ([]byte, error)
- func (hr *HistoryReaderV3) ReadSet() map[string]*state.KvList
- func (hr *HistoryReaderV3) ResetReadSet()
- func (hr *HistoryReaderV3) SetTrace(trace bool)
- func (hr *HistoryReaderV3) SetTx(tx kv.Tx)
- func (hr *HistoryReaderV3) SetTxNum(txNum uint64)
- func (hr *HistoryReaderV3) String() string
- type IntraBlockState
- func (sdb *IntraBlockState) AddAddressToAccessList(addr libcommon.Address) (addrMod bool)
- func (sdb *IntraBlockState) AddBalance(addr libcommon.Address, amount *uint256.Int, ...)
- func (sdb *IntraBlockState) AddLog(log2 *types.Log)
- func (sdb *IntraBlockState) AddRefund(gas uint64)
- func (sdb *IntraBlockState) AddSlotToAccessList(addr libcommon.Address, slot libcommon.Hash) (addrMod, slotMod bool)
- func (sdb *IntraBlockState) AddressInAccessList(addr libcommon.Address) bool
- func (sdb *IntraBlockState) BalanceIncreaseSet() map[libcommon.Address]uint256.Int
- func (sdb *IntraBlockState) CommitBlock(chainRules *chain.Rules, stateWriter StateWriter) error
- func (sdb *IntraBlockState) CreateAccount(addr libcommon.Address, contractCreation bool)
- func (sdb *IntraBlockState) Empty(addr libcommon.Address) bool
- func (sdb *IntraBlockState) Error() error
- func (sdb *IntraBlockState) Exist(addr libcommon.Address) bool
- func (sdb *IntraBlockState) FinalizeTx(chainRules *chain.Rules, stateWriter StateWriter) error
- func (sdb *IntraBlockState) GetBalance(addr libcommon.Address) *uint256.Int
- func (sdb *IntraBlockState) GetCode(addr libcommon.Address) []byte
- func (sdb *IntraBlockState) GetCodeHash(addr libcommon.Address) libcommon.Hash
- func (sdb *IntraBlockState) GetCodeSize(addr libcommon.Address) int
- func (sdb *IntraBlockState) GetCommittedState(addr libcommon.Address, key *libcommon.Hash, value *uint256.Int)
- func (sdb *IntraBlockState) GetDelegatedDesignation(addr libcommon.Address) (libcommon.Address, bool)
- func (sdb *IntraBlockState) GetIncarnation(addr libcommon.Address) uint64
- func (sdb *IntraBlockState) GetLogs(txIndex int, txnHash libcommon.Hash, blockNumber uint64, ...) types.Logs
- func (sdb *IntraBlockState) GetNonce(addr libcommon.Address) uint64
- func (sdb *IntraBlockState) GetOrNewStateObject(addr libcommon.Address) *stateObject
- func (sdb *IntraBlockState) GetRawLogs(txIndex int) types.Logs
- func (sdb *IntraBlockState) GetRefund() uint64
- func (sdb *IntraBlockState) GetState(addr libcommon.Address, key *libcommon.Hash, value *uint256.Int)
- func (sdb *IntraBlockState) GetTransientState(addr libcommon.Address, key libcommon.Hash) uint256.Int
- func (sdb *IntraBlockState) HasSelfdestructed(addr libcommon.Address) bool
- func (sdb *IntraBlockState) Logs() types.Logs
- func (sdb *IntraBlockState) MakeWriteSet(chainRules *chain.Rules, stateWriter StateWriter) error
- func (sdb *IntraBlockState) Prepare(rules *chain.Rules, sender, coinbase libcommon.Address, dst *libcommon.Address, ...)
- func (sdb *IntraBlockState) Print(chainRules chain.Rules)
- func (sdb *IntraBlockState) Reset()
- func (sdb *IntraBlockState) ResolveCode(addr libcommon.Address) []byte
- func (sdb *IntraBlockState) ResolveCodeHash(addr libcommon.Address) libcommon.Hash
- func (sdb *IntraBlockState) ResolveCodeSize(addr libcommon.Address) int
- func (sdb *IntraBlockState) RevertToSnapshot(revid int)
- func (sdb *IntraBlockState) Selfdestruct(addr libcommon.Address) bool
- func (sdb *IntraBlockState) Selfdestruct6780(addr libcommon.Address)
- func (sdb *IntraBlockState) SetBalance(addr libcommon.Address, amount *uint256.Int, ...)
- func (sdb *IntraBlockState) SetCode(addr libcommon.Address, code []byte)
- func (sdb *IntraBlockState) SetIncarnation(addr libcommon.Address, incarnation uint64)
- func (sdb *IntraBlockState) SetNonce(addr libcommon.Address, nonce uint64)
- func (sdb *IntraBlockState) SetState(addr libcommon.Address, key *libcommon.Hash, value uint256.Int)
- func (sdb *IntraBlockState) SetStorage(addr libcommon.Address, storage Storage)
- func (sdb *IntraBlockState) SetTrace(trace bool)
- func (sdb *IntraBlockState) SetTransientState(addr libcommon.Address, key libcommon.Hash, value uint256.Int)
- func (sdb *IntraBlockState) SetTxContext(ti int)
- func (sdb *IntraBlockState) SlotInAccessList(addr libcommon.Address, slot libcommon.Hash) (addressPresent bool, slotPresent bool)
- func (sdb *IntraBlockState) Snapshot() int
- func (sdb *IntraBlockState) SoftFinalise()
- func (sdb *IntraBlockState) SubBalance(addr libcommon.Address, amount *uint256.Int, ...)
- func (sdb *IntraBlockState) SubRefund(gas uint64)
- func (sdb *IntraBlockState) TxnIndex() int
- type IteratorDump
- type NoopWriter
- func (nw *NoopWriter) CreateContract(address common.Address) error
- func (nw *NoopWriter) DeleteAccount(address common.Address, original *accounts.Account) error
- func (nw *NoopWriter) UpdateAccountCode(address common.Address, incarnation uint64, codeHash common.Hash, code []byte) error
- func (nw *NoopWriter) UpdateAccountData(address common.Address, original, account *accounts.Account) error
- func (nw *NoopWriter) WriteAccountStorage(address common.Address, incarnation uint64, key *common.Hash, ...) error
- func (nw *NoopWriter) WriteChangeSets() error
- func (nw *NoopWriter) WriteHistory() error
- type QueueWithRetry
- func (q *QueueWithRetry) Add(ctx context.Context, t *TxTask)
- func (q *QueueWithRetry) Capacity() int
- func (q *QueueWithRetry) Close()
- func (q *QueueWithRetry) Len() (l int)
- func (q *QueueWithRetry) NewTasksLen() int
- func (q *QueueWithRetry) Next(ctx context.Context) (*TxTask, bool)
- func (q *QueueWithRetry) ReTry(t *TxTask)
- func (q *QueueWithRetry) RetriesLen() (l int)
- func (q *QueueWithRetry) RetryTxNumsList() (out []uint64)
- type ReaderParallelV3
- func (r *ReaderParallelV3) DiscardReadList()
- func (r *ReaderParallelV3) ReadAccountCode(address common.Address, incarnation uint64, codeHash common.Hash) ([]byte, error)
- func (r *ReaderParallelV3) ReadAccountCodeSize(address common.Address, incarnation uint64, codeHash common.Hash) (int, error)
- func (r *ReaderParallelV3) ReadAccountData(address common.Address) (*accounts.Account, error)
- func (r *ReaderParallelV3) ReadAccountIncarnation(address common.Address) (uint64, error)
- func (r *ReaderParallelV3) ReadAccountStorage(address common.Address, incarnation uint64, key *common.Hash) ([]byte, error)
- func (r *ReaderParallelV3) ReadSet() map[string]*libstate.KvList
- func (r *ReaderParallelV3) ResetReadSet()
- func (r *ReaderParallelV3) SetTrace(trace bool)
- func (r *ReaderParallelV3) SetTx(tx kv.Tx)
- func (r *ReaderParallelV3) SetTxNum(txNum uint64)
- type ReaderV3
- func (r *ReaderV3) DiscardReadList()
- func (r *ReaderV3) ReadAccountCode(address common.Address, incarnation uint64, codeHash common.Hash) ([]byte, error)
- func (r *ReaderV3) ReadAccountCodeSize(address common.Address, incarnation uint64, codeHash common.Hash) (int, error)
- func (r *ReaderV3) ReadAccountData(address common.Address) (*accounts.Account, error)
- func (r *ReaderV3) ReadAccountIncarnation(address common.Address) (uint64, error)
- func (r *ReaderV3) ReadAccountStorage(address common.Address, incarnation uint64, key *common.Hash) ([]byte, error)
- func (r *ReaderV3) ReadSet() map[string]*libstate.KvList
- func (r *ReaderV3) ResetReadSet()
- func (r *ReaderV3) SetTrace(trace bool)
- func (r *ReaderV3) SetTx(tx kv.Tx)
- func (r *ReaderV3) SetTxNum(txNum uint64)
- type ReconState
- func (rs *ReconState) Delete(table string, key1, key2 []byte, txNum uint64)
- func (rs *ReconState) Flush(rwTx kv.RwTx) error
- func (rs *ReconState) Get(table string, key1, key2 []byte, txNum uint64) []byte
- func (rs *ReconState) Put(table string, key1, key2, val []byte, txNum uint64)
- func (rs *ReconState) RemoveAll(table string, key1 []byte)
- func (rs *ReconState) Reset(workCh chan *TxTask)
- func (rs *ReconState) SizeEstimate() uint64
- type ReconnWork
- func (rs *ReconnWork) CommitTxNum(txNum uint64)
- func (rs *ReconnWork) Done(txNum uint64) bool
- func (rs *ReconnWork) DoneCount() uint64
- func (rs *ReconnWork) MaxTxNum() uint64
- func (rs *ReconnWork) QueueLen() int
- func (rs *ReconnWork) RollbackCount() uint64
- func (rs *ReconnWork) RollbackTx(txTask *TxTask, dependency uint64)
- func (rs *ReconnWork) Schedule(ctx context.Context) (*TxTask, bool, error)
- type ResettableStateReader
- type ResultsQueue
- func (q *ResultsQueue) Add(ctx context.Context, task *TxTask) error
- func (q *ResultsQueue) Close()
- func (q *ResultsQueue) Dbg() (t *TxTask)
- func (q *ResultsQueue) Drain(ctx context.Context) error
- func (q *ResultsQueue) DrainNonBlocking(ctx context.Context) error
- func (q *ResultsQueue) DropResults(ctx context.Context, f func(t *TxTask))
- func (q *ResultsQueue) FirstTxNumLocked() uint64
- func (q *ResultsQueue) HasLocked() bool
- func (q *ResultsQueue) Iter() *ResultsQueueIter
- func (q *ResultsQueue) Len() (l int)
- func (q *ResultsQueue) LenLocked() (l int)
- func (q *ResultsQueue) Limit() int
- func (q *ResultsQueue) PopLocked() (t *TxTask)
- func (q *ResultsQueue) Push(t *TxTask)
- func (q *ResultsQueue) PushLocked(t *TxTask)
- func (q *ResultsQueue) ResultChCap() int
- func (q *ResultsQueue) ResultChLen() int
- type ResultsQueueIter
- type StateReader
- type StateReconWriterInc
- func (w *StateReconWriterInc) CreateContract(address libcommon.Address) error
- func (w *StateReconWriterInc) DeleteAccount(address libcommon.Address, original *accounts.Account) error
- func (w *StateReconWriterInc) SetChainTx(chainTx kv.Tx)
- func (w *StateReconWriterInc) SetTx(tx kv.Tx)
- func (w *StateReconWriterInc) SetTxNum(txNum uint64)
- func (w *StateReconWriterInc) UpdateAccountCode(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash, ...) error
- func (w *StateReconWriterInc) UpdateAccountData(address libcommon.Address, original, account *accounts.Account) error
- func (w *StateReconWriterInc) WriteAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash, ...) error
- type StateV3
- func (rs *StateV3) AddWork(ctx context.Context, txTask *TxTask, in *QueueWithRetry)
- func (rs *StateV3) ApplyLogsAndTraces4(txTask *TxTask, domains *libstate.SharedDomains) error
- func (rs *StateV3) ApplyState4(ctx context.Context, txTask *TxTask) error
- func (rs *StateV3) CommitTxNum(sender *common.Address, txNum uint64, in *QueueWithRetry) (count int)
- func (rs *StateV3) Domains() *libstate.SharedDomains
- func (rs *StateV3) DoneCount() uint64
- func (rs *StateV3) ReTry(txTask *TxTask, in *QueueWithRetry)
- func (rs *StateV3) ReadsValid(readLists map[string]*libstate.KvList) bool
- func (rs *StateV3) RegisterSender(txTask *TxTask) bool
- func (rs *StateV3) SetTxNum(txNum, blockNum uint64)
- func (rs *StateV3) SizeEstimate() (r uint64)
- func (rs *StateV3) Unwind(ctx context.Context, tx kv.RwTx, blockUnwindTo, txUnwindTo uint64, ...) error
- type StateWriter
- type StateWriterBufferedV3
- func (w *StateWriterBufferedV3) CreateContract(address common.Address) error
- func (w *StateWriterBufferedV3) DeleteAccount(address common.Address, original *accounts.Account) error
- func (w *StateWriterBufferedV3) PrevAndDels() (map[string][]byte, map[string]*accounts.Account, map[string][]byte, ...)
- func (w *StateWriterBufferedV3) ResetWriteSet()
- func (w *StateWriterBufferedV3) SetTx(tx kv.Tx)
- func (w *StateWriterBufferedV3) SetTxNum(ctx context.Context, txNum uint64)
- func (w *StateWriterBufferedV3) UpdateAccountCode(address common.Address, incarnation uint64, codeHash common.Hash, code []byte) error
- func (w *StateWriterBufferedV3) UpdateAccountData(address common.Address, original, account *accounts.Account) error
- func (w *StateWriterBufferedV3) WriteAccountStorage(address common.Address, incarnation uint64, key *common.Hash, ...) error
- func (w *StateWriterBufferedV3) WriteSet() map[string]*libstate.KvList
- type StateWriterV3
- func (w *StateWriterV3) CreateContract(address common.Address) error
- func (w *StateWriterV3) DeleteAccount(address common.Address, original *accounts.Account) error
- func (w *StateWriterV3) PrevAndDels() (map[string][]byte, map[string]*accounts.Account, map[string][]byte, ...)
- func (w *StateWriterV3) ResetWriteSet()
- func (w *StateWriterV3) UpdateAccountCode(address common.Address, incarnation uint64, codeHash common.Hash, code []byte) error
- func (w *StateWriterV3) UpdateAccountData(address common.Address, original, account *accounts.Account) error
- func (w *StateWriterV3) WriteAccountStorage(address common.Address, incarnation uint64, key *common.Hash, ...) error
- func (w *StateWriterV3) WriteSet() map[string]*libstate.KvList
- type Storage
- type TransferFunc
- type TxContext
- type TxTask
- type TxTaskQueue
- type WriterV4
- func (w *WriterV4) CreateContract(address libcommon.Address) (err error)
- func (w *WriterV4) DeleteAccount(address libcommon.Address, original *accounts.Account) error
- func (w *WriterV4) UpdateAccountCode(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash, ...) error
- func (w *WriterV4) UpdateAccountData(address libcommon.Address, original, account *accounts.Account) error
- func (w *WriterV4) WriteAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash, ...) error
- func (cw *WriterV4) WriteChangeSets() error
- func (cw *WriterV4) WriteHistory() error
- type WriterWithChangeSets
Constants ¶
const ( //FirstContractIncarnation - first incarnation for contract accounts. After 1 it increases by 1. FirstContractIncarnation = 1 //NonContractIncarnation incarnation for non contracts NonContractIncarnation = 0 )
Variables ¶
var EmptyAddress = libcommon.Address{}
var SystemAddress = libcommon.HexToAddress("0xfffffffffffffffffffffffffffffffffffffffe")
SystemAddress - sender address for internal state updates.
Functions ¶
func ReconnLess ¶
func ReconnLess(i, thanItem reconPair) bool
Types ¶
type BalanceIncrease ¶
type BalanceIncrease struct {
// contains filtered or unexported fields
}
BalanceIncrease represents the increase of balance of an account that did not require reading the account first
type BlockContext ¶
type BlockContext struct { // CanTransfer returns whether the account contains // sufficient ether to transfer the value CanTransfer CanTransferFunc // Transfer transfers ether from one account to the other Transfer TransferFunc // GetHash returns the hash corresponding to n GetHash GetHashFunc // Block information Coinbase common.Address // Provides information for COINBASE GasLimit uint64 // Provides information for GASLIMIT MaxGasLimit bool // Use GasLimit override for 2^256-1 (to be compatible with OpenEthereum's trace_call) BlockNumber uint64 // Provides information for NUMBER Time uint64 // Provides information for TIME Difficulty *big.Int // Provides information for DIFFICULTY BaseFee *uint256.Int // Provides information for BASEFEE PrevRanDao *common.Hash // Provides information for PREVRANDAO ExcessBlobGas *uint64 // Provides information for handling data blobs }
BlockContext provides the EVM with auxiliary information. Once provided it shouldn't be modified.
type CachedReader ¶
type CachedReader struct {
// contains filtered or unexported fields
}
CachedReader is a wrapper for an instance of type StateReader This wrapper only makes calls to the underlying reader if the item is not in the cache
func NewCachedReader ¶
func NewCachedReader(r StateReader, cache *shards.StateCache) *CachedReader
NewCachedReader wraps a given state reader into the cached reader
func (*CachedReader) ReadAccountCode ¶
func (cr *CachedReader) ReadAccountCode(address common.Address, incarnation uint64, codeHash common.Hash) ([]byte, error)
ReadAccountCode is called when code of an account needs to be fetched from the state Usually, one of (address;incarnation) or codeHash is enough to uniquely identify the code
func (*CachedReader) ReadAccountCodeSize ¶
func (*CachedReader) ReadAccountData ¶
ReadAccountData is called when an account needs to be fetched from the state
func (*CachedReader) ReadAccountIncarnation ¶
func (cr *CachedReader) ReadAccountIncarnation(address common.Address) (uint64, error)
ReadAccountIncarnation is called when incarnation of the account is required (to create and recreate contract)
func (*CachedReader) ReadAccountStorage ¶
func (cr *CachedReader) ReadAccountStorage(address common.Address, incarnation uint64, key *common.Hash) ([]byte, error)
ReadAccountStorage is called when a storage item needs to be fetched from the state
type CachedReader3 ¶
type CachedReader3 struct {
// contains filtered or unexported fields
}
CachedReader3 is a wrapper for an instance of type StateReader This wrapper only makes calls to the underlying reader if the item is not in the cache
func NewCachedReader3 ¶
func NewCachedReader3(cache kvcache.CacheView, tx kv.TemporalTx) *CachedReader3
NewCachedReader3 wraps a given state reader into the cached reader
func (*CachedReader3) ReadAccountCode ¶
func (*CachedReader3) ReadAccountCodeSize ¶
func (*CachedReader3) ReadAccountData ¶
ReadAccountData is called when an account needs to be fetched from the state
func (*CachedReader3) ReadAccountIncarnation ¶
func (r *CachedReader3) ReadAccountIncarnation(address common.Address) (uint64, error)
func (*CachedReader3) ReadAccountStorage ¶
type CachedWriter ¶
type CachedWriter struct {
// contains filtered or unexported fields
}
CachedWriter is a wrapper for an instance of type StateWriter
func NewCachedWriter ¶
func NewCachedWriter(w WriterWithChangeSets, cache *shards.StateCache) *CachedWriter
NewCachedWriter wraps a given state writer into a cached writer
func (*CachedWriter) CreateContract ¶
func (cw *CachedWriter) CreateContract(address common.Address) error
func (*CachedWriter) DeleteAccount ¶
func (*CachedWriter) UpdateAccountCode ¶
func (*CachedWriter) UpdateAccountData ¶
func (*CachedWriter) WriteAccountStorage ¶
func (*CachedWriter) WriteChangeSets ¶
func (cw *CachedWriter) WriteChangeSets() error
func (*CachedWriter) WriteHistory ¶
func (cw *CachedWriter) WriteHistory() error
type CanTransferFunc ¶
CanTransferFunc is the signature of a transfer guard function
type Dump ¶
type Dump struct { Root string `json:"root"` Accounts map[libcommon.Address]DumpAccount `json:"accounts"` }
Dump represents the full dump in a collected format, as one large map.
type DumpAccount ¶
type DumpAccount struct { Balance string `json:"balance"` Nonce uint64 `json:"nonce"` Root hexutility.Bytes `json:"root"` CodeHash hexutility.Bytes `json:"codeHash"` Code hexutility.Bytes `json:"code,omitempty"` Storage map[string]string `json:"storage,omitempty"` Address *libcommon.Address `json:"address,omitempty"` // Address only present in iterative (line-by-line) mode SecureKey *hexutility.Bytes `json:"key,omitempty"` // If we don't have address, we can output the key }
DumpAccount represents tan account in the state.
type DumpCollector ¶
type DumpCollector interface { // OnRoot is called with the state root OnRoot(libcommon.Hash) // OnAccount is called once for each account in the trie OnAccount(libcommon.Address, DumpAccount) }
DumpCollector interface which the state trie calls during iteration
type Dumper ¶
type Dumper struct {
// contains filtered or unexported fields
}
func (*Dumper) DefaultDump ¶
DefaultDump returns a JSON string representing the state with the default params
func (*Dumper) DefaultRawDump ¶
func (*Dumper) Dump ¶
Dump returns a JSON string representing the entire state as a single json-object
func (*Dumper) DumpToCollector ¶
func (*Dumper) IterativeDump ¶
IterativeDump dumps out accounts as json-objects, delimited by linebreaks on stdout
func (*Dumper) IteratorDump ¶
func (d *Dumper) IteratorDump(excludeCode, excludeStorage bool, start libcommon.Address, maxResults int) (IteratorDump, error)
IteratorDump dumps out a batch of accounts starts with the given start key
type GetHashFunc ¶
GetHashFunc returns the nth block hash in the blockchain and is used by the BLOCKHASH EVM op code.
type HistoricalStateReader ¶
type HistoryReaderV3 ¶
type HistoryReaderV3 struct {
// contains filtered or unexported fields
}
HistoryReaderV3 Implements StateReader and StateWriter
func NewHistoryReaderV3 ¶
func NewHistoryReaderV3() *HistoryReaderV3
func (*HistoryReaderV3) DiscardReadList ¶
func (hr *HistoryReaderV3) DiscardReadList()
func (*HistoryReaderV3) GetTxNum ¶
func (hr *HistoryReaderV3) GetTxNum() uint64
func (*HistoryReaderV3) ReadAccountCode ¶
func (*HistoryReaderV3) ReadAccountCodeSize ¶
func (*HistoryReaderV3) ReadAccountData ¶
func (*HistoryReaderV3) ReadAccountIncarnation ¶
func (hr *HistoryReaderV3) ReadAccountIncarnation(address common.Address) (uint64, error)
func (*HistoryReaderV3) ReadAccountStorage ¶
func (*HistoryReaderV3) ResetReadSet ¶
func (hr *HistoryReaderV3) ResetReadSet()
func (*HistoryReaderV3) SetTrace ¶
func (hr *HistoryReaderV3) SetTrace(trace bool)
func (*HistoryReaderV3) SetTx ¶
func (hr *HistoryReaderV3) SetTx(tx kv.Tx)
func (*HistoryReaderV3) SetTxNum ¶
func (hr *HistoryReaderV3) SetTxNum(txNum uint64)
func (*HistoryReaderV3) String ¶
func (hr *HistoryReaderV3) String() string
type IntraBlockState ¶
type IntraBlockState struct {
// contains filtered or unexported fields
}
IntraBlockState is responsible for caching and managing state changes that occur during block's execution. NOT THREAD SAFE!
func (*IntraBlockState) AddAddressToAccessList ¶
func (sdb *IntraBlockState) AddAddressToAccessList(addr libcommon.Address) (addrMod bool)
AddAddressToAccessList adds the given address to the access list
func (*IntraBlockState) AddBalance ¶
func (sdb *IntraBlockState) AddBalance(addr libcommon.Address, amount *uint256.Int, reason tracing.BalanceChangeReason)
AddBalance adds amount to the account associated with addr. DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account
func (*IntraBlockState) AddLog ¶
func (sdb *IntraBlockState) AddLog(log2 *types.Log)
func (*IntraBlockState) AddRefund ¶
func (sdb *IntraBlockState) AddRefund(gas uint64)
AddRefund adds gas to the refund counter
func (*IntraBlockState) AddSlotToAccessList ¶
func (sdb *IntraBlockState) AddSlotToAccessList(addr libcommon.Address, slot libcommon.Hash) (addrMod, slotMod bool)
AddSlotToAccessList adds the given (address, slot)-tuple to the access list
func (*IntraBlockState) AddressInAccessList ¶
func (sdb *IntraBlockState) AddressInAccessList(addr libcommon.Address) bool
AddressInAccessList returns true if the given address is in the access list.
func (*IntraBlockState) BalanceIncreaseSet ¶
func (sdb *IntraBlockState) BalanceIncreaseSet() map[libcommon.Address]uint256.Int
func (*IntraBlockState) CommitBlock ¶
func (sdb *IntraBlockState) CommitBlock(chainRules *chain.Rules, stateWriter StateWriter) error
CommitBlock finalizes the state by removing the self destructed objects and clears the journal as well as the refunds.
func (*IntraBlockState) CreateAccount ¶
func (sdb *IntraBlockState) CreateAccount(addr libcommon.Address, contractCreation bool)
CreateAccount explicitly creates a state object. If a state object with the address already exists the balance is carried over to the new account.
CreateAccount is called during the EVM CREATE operation. The situation might arise that a contract does the following:
- sends funds to sha(account ++ (nonce + 1))
- tx_create(sha(account ++ nonce)) (note that this gets the address of 1)
Carrying over the balance ensures that Ether doesn't disappear.
func (*IntraBlockState) Empty ¶
func (sdb *IntraBlockState) Empty(addr libcommon.Address) bool
Empty returns whether the state object is either non-existent or empty according to the EIP161 specification (balance = nonce = code = 0)
func (*IntraBlockState) Error ¶
func (sdb *IntraBlockState) Error() error
func (*IntraBlockState) Exist ¶
func (sdb *IntraBlockState) Exist(addr libcommon.Address) bool
Exist reports whether the given account address exists in the state. Notably this also returns true for suicided accounts.
func (*IntraBlockState) FinalizeTx ¶
func (sdb *IntraBlockState) FinalizeTx(chainRules *chain.Rules, stateWriter StateWriter) error
FinalizeTx should be called after every transaction.
func (*IntraBlockState) GetBalance ¶
func (sdb *IntraBlockState) GetBalance(addr libcommon.Address) *uint256.Int
GetBalance retrieves the balance from the given address or 0 if object not found DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account
func (*IntraBlockState) GetCode ¶
func (sdb *IntraBlockState) GetCode(addr libcommon.Address) []byte
DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account
func (*IntraBlockState) GetCodeHash ¶
func (sdb *IntraBlockState) GetCodeHash(addr libcommon.Address) libcommon.Hash
DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account
func (*IntraBlockState) GetCodeSize ¶
func (sdb *IntraBlockState) GetCodeSize(addr libcommon.Address) int
DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account
func (*IntraBlockState) GetCommittedState ¶
func (sdb *IntraBlockState) GetCommittedState(addr libcommon.Address, key *libcommon.Hash, value *uint256.Int)
GetCommittedState retrieves a value from the given account's committed storage trie. DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account
func (*IntraBlockState) GetDelegatedDesignation ¶
func (*IntraBlockState) GetIncarnation ¶
func (sdb *IntraBlockState) GetIncarnation(addr libcommon.Address) uint64
func (*IntraBlockState) GetNonce ¶
func (sdb *IntraBlockState) GetNonce(addr libcommon.Address) uint64
DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account
func (*IntraBlockState) GetOrNewStateObject ¶
func (sdb *IntraBlockState) GetOrNewStateObject(addr libcommon.Address) *stateObject
Retrieve a state object or create a new state object if nil.
func (*IntraBlockState) GetRawLogs ¶
func (sdb *IntraBlockState) GetRawLogs(txIndex int) types.Logs
GetRawLogs - is like GetLogs, but allow postpone calculation of `txn.Hash()`. Example: if you need filter logs and only then set `txn.Hash()` for filtered logs - then no reason to calc for all transactions.
func (*IntraBlockState) GetRefund ¶
func (sdb *IntraBlockState) GetRefund() uint64
GetRefund returns the current value of the refund counter.
func (*IntraBlockState) GetState ¶
func (sdb *IntraBlockState) GetState(addr libcommon.Address, key *libcommon.Hash, value *uint256.Int)
GetState retrieves a value from the given account's storage trie. DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account
func (*IntraBlockState) GetTransientState ¶
func (sdb *IntraBlockState) GetTransientState(addr libcommon.Address, key libcommon.Hash) uint256.Int
GetTransientState gets transient storage for a given account.
func (*IntraBlockState) HasSelfdestructed ¶
func (sdb *IntraBlockState) HasSelfdestructed(addr libcommon.Address) bool
func (*IntraBlockState) Logs ¶
func (sdb *IntraBlockState) Logs() types.Logs
func (*IntraBlockState) MakeWriteSet ¶
func (sdb *IntraBlockState) MakeWriteSet(chainRules *chain.Rules, stateWriter StateWriter) error
func (*IntraBlockState) Prepare ¶
func (sdb *IntraBlockState) Prepare(rules *chain.Rules, sender, coinbase libcommon.Address, dst *libcommon.Address, precompiles []libcommon.Address, list types2.AccessList, authorities []libcommon.Address)
Prepare handles the preparatory steps for executing a state transition. This method must be invoked before state transition.
Berlin fork: - Add sender to access list (EIP-2929) - Add destination to access list (EIP-2929) - Add precompiles to access list (EIP-2929) - Add the contents of the optional txn access list (EIP-2930)
Shanghai fork: - Add coinbase to access list (EIP-3651)
Cancun fork: - Reset transient storage (EIP-1153)
Prague fork: - Add authorities to access list (EIP-7702) - Add delegated designation (if it exists for dst) to access list (EIP-7702)
func (*IntraBlockState) Print ¶
func (sdb *IntraBlockState) Print(chainRules chain.Rules)
func (*IntraBlockState) Reset ¶
func (sdb *IntraBlockState) Reset()
Reset clears out all ephemeral state objects from the state db, but keeps the underlying state trie to avoid reloading data for the next operations.
func (*IntraBlockState) ResolveCode ¶
func (sdb *IntraBlockState) ResolveCode(addr libcommon.Address) []byte
func (*IntraBlockState) ResolveCodeHash ¶
func (sdb *IntraBlockState) ResolveCodeHash(addr libcommon.Address) libcommon.Hash
func (*IntraBlockState) ResolveCodeSize ¶
func (sdb *IntraBlockState) ResolveCodeSize(addr libcommon.Address) int
func (*IntraBlockState) RevertToSnapshot ¶
func (sdb *IntraBlockState) RevertToSnapshot(revid int)
RevertToSnapshot reverts all state changes made since the given revision.
func (*IntraBlockState) Selfdestruct ¶
func (sdb *IntraBlockState) Selfdestruct(addr libcommon.Address) bool
Selfdestruct marks the given account as suicided. This clears the account balance.
The account's state object is still available until the state is committed, getStateObject will return a non-nil account after Suicide.
func (*IntraBlockState) Selfdestruct6780 ¶
func (sdb *IntraBlockState) Selfdestruct6780(addr libcommon.Address)
func (*IntraBlockState) SetBalance ¶
func (sdb *IntraBlockState) SetBalance(addr libcommon.Address, amount *uint256.Int, reason tracing.BalanceChangeReason)
DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account
func (*IntraBlockState) SetCode ¶
func (sdb *IntraBlockState) SetCode(addr libcommon.Address, code []byte)
DESCRIBED: docs/programmers_guide/guide.md#code-hash DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account
func (*IntraBlockState) SetIncarnation ¶
func (sdb *IntraBlockState) SetIncarnation(addr libcommon.Address, incarnation uint64)
SetIncarnation sets incarnation for account if account exists
func (*IntraBlockState) SetNonce ¶
func (sdb *IntraBlockState) SetNonce(addr libcommon.Address, nonce uint64)
DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account
func (*IntraBlockState) SetState ¶
func (sdb *IntraBlockState) SetState(addr libcommon.Address, key *libcommon.Hash, value uint256.Int)
DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account
func (*IntraBlockState) SetStorage ¶
func (sdb *IntraBlockState) SetStorage(addr libcommon.Address, storage Storage)
SetStorage replaces the entire storage for the specified account with given storage. This function should only be used for debugging.
func (*IntraBlockState) SetTrace ¶
func (sdb *IntraBlockState) SetTrace(trace bool)
func (*IntraBlockState) SetTransientState ¶
func (sdb *IntraBlockState) SetTransientState(addr libcommon.Address, key libcommon.Hash, value uint256.Int)
SetTransientState sets transient storage for a given account. It adds the change to the journal so that it can be rolled back to its previous value if there is a revert.
func (*IntraBlockState) SetTxContext ¶
func (sdb *IntraBlockState) SetTxContext(ti int)
SetTxContext sets the current transaction index which used when the EVM emits new state logs. It should be invoked before transaction execution.
func (*IntraBlockState) SlotInAccessList ¶
func (*IntraBlockState) Snapshot ¶
func (sdb *IntraBlockState) Snapshot() int
Snapshot returns an identifier for the current revision of the state.
func (*IntraBlockState) SoftFinalise ¶
func (sdb *IntraBlockState) SoftFinalise()
func (*IntraBlockState) SubBalance ¶
func (sdb *IntraBlockState) SubBalance(addr libcommon.Address, amount *uint256.Int, reason tracing.BalanceChangeReason)
SubBalance subtracts amount from the account associated with addr. DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account
func (*IntraBlockState) SubRefund ¶
func (sdb *IntraBlockState) SubRefund(gas uint64)
SubRefund removes gas from the refund counter. This method will panic if the refund counter goes below zero
func (*IntraBlockState) TxnIndex ¶
func (sdb *IntraBlockState) TxnIndex() int
TxIndex returns the current transaction index set by Prepare.
type IteratorDump ¶
type IteratorDump struct { Root string `json:"root"` Accounts map[libcommon.Address]DumpAccount `json:"accounts"` Next []byte `json:"next,omitempty"` // nil if no more accounts }
IteratorDump is an implementation for iterating over data.
func (*IteratorDump) OnAccount ¶
func (d *IteratorDump) OnAccount(addr libcommon.Address, account DumpAccount)
OnAccount implements DumpCollector interface
func (*IteratorDump) OnRoot ¶
func (d *IteratorDump) OnRoot(root libcommon.Hash)
OnRoot implements DumpCollector interface
type NoopWriter ¶
type NoopWriter struct { }
func NewNoopWriter ¶
func NewNoopWriter() *NoopWriter
func (*NoopWriter) CreateContract ¶
func (nw *NoopWriter) CreateContract(address common.Address) error
func (*NoopWriter) DeleteAccount ¶
func (*NoopWriter) UpdateAccountCode ¶
func (*NoopWriter) UpdateAccountData ¶
func (*NoopWriter) WriteAccountStorage ¶
func (*NoopWriter) WriteChangeSets ¶
func (nw *NoopWriter) WriteChangeSets() error
func (*NoopWriter) WriteHistory ¶
func (nw *NoopWriter) WriteHistory() error
type QueueWithRetry ¶
type QueueWithRetry struct {
// contains filtered or unexported fields
}
QueueWithRetry is trhead-safe priority-queue of tasks - which attempt to minimize conflict-rate (retry-rate). Tasks may conflict and return to queue for re-try/re-exec. Tasks added by method `ReTry` have higher priority than tasks added by `Add`. Method `Add` expecting already-ordered (by priority) tasks - doesn't do any additional sorting of new tasks.
func NewQueueWithRetry ¶
func NewQueueWithRetry(capacity int) *QueueWithRetry
func (*QueueWithRetry) Add ¶
func (q *QueueWithRetry) Add(ctx context.Context, t *TxTask)
Add "new task" (which was never executed yet). May block internal channel is full. Expecting already-ordered tasks.
func (*QueueWithRetry) Capacity ¶
func (q *QueueWithRetry) Capacity() int
func (*QueueWithRetry) Len ¶
func (q *QueueWithRetry) Len() (l int)
func (*QueueWithRetry) NewTasksLen ¶
func (q *QueueWithRetry) NewTasksLen() int
func (*QueueWithRetry) Next ¶
func (q *QueueWithRetry) Next(ctx context.Context) (*TxTask, bool)
Next - blocks until new task available
func (*QueueWithRetry) ReTry ¶
func (q *QueueWithRetry) ReTry(t *TxTask)
ReTry returns failed (conflicted) task. It's non-blocking method. All failed tasks have higher priority than new one. No limit on amount of txs added by this method.
func (*QueueWithRetry) RetriesLen ¶
func (q *QueueWithRetry) RetriesLen() (l int)
func (*QueueWithRetry) RetryTxNumsList ¶
func (q *QueueWithRetry) RetryTxNumsList() (out []uint64)
type ReaderParallelV3 ¶
type ReaderParallelV3 struct {
// contains filtered or unexported fields
}
func NewReaderParallelV3 ¶
func NewReaderParallelV3(sd *libstate.SharedDomains) *ReaderParallelV3
func (*ReaderParallelV3) DiscardReadList ¶
func (r *ReaderParallelV3) DiscardReadList()
func (*ReaderParallelV3) ReadAccountCode ¶
func (*ReaderParallelV3) ReadAccountCodeSize ¶
func (*ReaderParallelV3) ReadAccountData ¶
func (*ReaderParallelV3) ReadAccountIncarnation ¶
func (r *ReaderParallelV3) ReadAccountIncarnation(address common.Address) (uint64, error)
func (*ReaderParallelV3) ReadAccountStorage ¶
func (*ReaderParallelV3) ResetReadSet ¶
func (r *ReaderParallelV3) ResetReadSet()
func (*ReaderParallelV3) SetTrace ¶
func (r *ReaderParallelV3) SetTrace(trace bool)
func (*ReaderParallelV3) SetTx ¶
func (r *ReaderParallelV3) SetTx(tx kv.Tx)
func (*ReaderParallelV3) SetTxNum ¶
func (r *ReaderParallelV3) SetTxNum(txNum uint64)
type ReaderV3 ¶
type ReaderV3 struct {
// contains filtered or unexported fields
}
func NewReaderV3 ¶
func NewReaderV3(tx kv.TemporalGetter) *ReaderV3
func (*ReaderV3) DiscardReadList ¶
func (r *ReaderV3) DiscardReadList()
func (*ReaderV3) ReadAccountCode ¶
func (*ReaderV3) ReadAccountCodeSize ¶
func (*ReaderV3) ReadAccountData ¶
func (*ReaderV3) ReadAccountIncarnation ¶
func (*ReaderV3) ReadAccountStorage ¶
func (*ReaderV3) ResetReadSet ¶
func (r *ReaderV3) ResetReadSet()
type ReconState ¶
type ReconState struct { *ReconnWork //has it's own mutex. allow avoid lock-contention between state.Get() and work.Done() methods // contains filtered or unexported fields }
ReconState is the accumulator of changes to the state
func NewReconState ¶
func NewReconState(workCh chan *TxTask) *ReconState
func (*ReconState) Delete ¶
func (rs *ReconState) Delete(table string, key1, key2 []byte, txNum uint64)
func (*ReconState) Get ¶
func (rs *ReconState) Get(table string, key1, key2 []byte, txNum uint64) []byte
func (*ReconState) Put ¶
func (rs *ReconState) Put(table string, key1, key2, val []byte, txNum uint64)
func (*ReconState) RemoveAll ¶
func (rs *ReconState) RemoveAll(table string, key1 []byte)
func (*ReconState) Reset ¶
func (rs *ReconState) Reset(workCh chan *TxTask)
func (*ReconState) SizeEstimate ¶
func (rs *ReconState) SizeEstimate() uint64
type ReconnWork ¶
type ReconnWork struct {
// contains filtered or unexported fields
}
func (*ReconnWork) CommitTxNum ¶
func (rs *ReconnWork) CommitTxNum(txNum uint64)
func (*ReconnWork) Done ¶
func (rs *ReconnWork) Done(txNum uint64) bool
func (*ReconnWork) DoneCount ¶
func (rs *ReconnWork) DoneCount() uint64
func (*ReconnWork) MaxTxNum ¶
func (rs *ReconnWork) MaxTxNum() uint64
func (*ReconnWork) QueueLen ¶
func (rs *ReconnWork) QueueLen() int
func (*ReconnWork) RollbackCount ¶
func (rs *ReconnWork) RollbackCount() uint64
func (*ReconnWork) RollbackTx ¶
func (rs *ReconnWork) RollbackTx(txTask *TxTask, dependency uint64)
type ResettableStateReader ¶
type ResultsQueue ¶
ResultsQueue thread-safe priority-queue of execution results
func NewResultsQueue ¶
func NewResultsQueue(resultChannelLimit, heapLimit int) *ResultsQueue
func (*ResultsQueue) Add ¶
func (q *ResultsQueue) Add(ctx context.Context, task *TxTask) error
Add result of execution. May block when internal channel is full
func (*ResultsQueue) Close ¶
func (q *ResultsQueue) Close()
func (*ResultsQueue) Dbg ¶
func (q *ResultsQueue) Dbg() (t *TxTask)
func (*ResultsQueue) DrainNonBlocking ¶
func (q *ResultsQueue) DrainNonBlocking(ctx context.Context) error
func (*ResultsQueue) DropResults ¶
func (q *ResultsQueue) DropResults(ctx context.Context, f func(t *TxTask))
func (*ResultsQueue) FirstTxNumLocked ¶
func (q *ResultsQueue) FirstTxNumLocked() uint64
func (*ResultsQueue) HasLocked ¶
func (q *ResultsQueue) HasLocked() bool
func (*ResultsQueue) Iter ¶
func (q *ResultsQueue) Iter() *ResultsQueueIter
func (*ResultsQueue) Len ¶
func (q *ResultsQueue) Len() (l int)
func (*ResultsQueue) LenLocked ¶
func (q *ResultsQueue) LenLocked() (l int)
func (*ResultsQueue) Limit ¶
func (q *ResultsQueue) Limit() int
func (*ResultsQueue) PopLocked ¶
func (q *ResultsQueue) PopLocked() (t *TxTask)
func (*ResultsQueue) Push ¶
func (q *ResultsQueue) Push(t *TxTask)
func (*ResultsQueue) PushLocked ¶
func (q *ResultsQueue) PushLocked(t *TxTask)
func (*ResultsQueue) ResultChCap ¶
func (q *ResultsQueue) ResultChCap() int
func (*ResultsQueue) ResultChLen ¶
func (q *ResultsQueue) ResultChLen() int
type ResultsQueueIter ¶
type ResultsQueueIter struct {
// contains filtered or unexported fields
}
func (*ResultsQueueIter) Close ¶
func (q *ResultsQueueIter) Close()
func (*ResultsQueueIter) HasNext ¶
func (q *ResultsQueueIter) HasNext(outputTxNum uint64) bool
func (*ResultsQueueIter) PopNext ¶
func (q *ResultsQueueIter) PopNext() *TxTask
type StateReader ¶
type StateReader interface { ReadAccountData(address common.Address) (*accounts.Account, error) ReadAccountStorage(address common.Address, incarnation uint64, key *common.Hash) ([]byte, error) ReadAccountCode(address common.Address, incarnation uint64, codeHash common.Hash) ([]byte, error) ReadAccountCodeSize(address common.Address, incarnation uint64, codeHash common.Hash) (int, error) ReadAccountIncarnation(address common.Address) (uint64, error) }
type StateReconWriterInc ¶
type StateReconWriterInc struct {
// contains filtered or unexported fields
}
func NewStateReconWriterInc ¶
func NewStateReconWriterInc(as *libstate.AggregatorStep, rs *ReconState) *StateReconWriterInc
func (*StateReconWriterInc) CreateContract ¶
func (w *StateReconWriterInc) CreateContract(address libcommon.Address) error
func (*StateReconWriterInc) DeleteAccount ¶
func (*StateReconWriterInc) SetChainTx ¶
func (w *StateReconWriterInc) SetChainTx(chainTx kv.Tx)
func (*StateReconWriterInc) SetTx ¶
func (w *StateReconWriterInc) SetTx(tx kv.Tx)
func (*StateReconWriterInc) SetTxNum ¶
func (w *StateReconWriterInc) SetTxNum(txNum uint64)
func (*StateReconWriterInc) UpdateAccountCode ¶
func (*StateReconWriterInc) UpdateAccountData ¶
type StateV3 ¶
type StateV3 struct {
// contains filtered or unexported fields
}
func NewStateV3 ¶
func NewStateV3(domains *libstate.SharedDomains, logger log.Logger) *StateV3
func (*StateV3) AddWork ¶
func (rs *StateV3) AddWork(ctx context.Context, txTask *TxTask, in *QueueWithRetry)
func (*StateV3) ApplyLogsAndTraces4 ¶
func (rs *StateV3) ApplyLogsAndTraces4(txTask *TxTask, domains *libstate.SharedDomains) error
func (*StateV3) ApplyState4 ¶
func (*StateV3) CommitTxNum ¶
func (*StateV3) Domains ¶
func (rs *StateV3) Domains() *libstate.SharedDomains
func (*StateV3) ReTry ¶
func (rs *StateV3) ReTry(txTask *TxTask, in *QueueWithRetry)
func (*StateV3) ReadsValid ¶
func (*StateV3) RegisterSender ¶
func (*StateV3) SizeEstimate ¶
type StateWriter ¶
type StateWriter interface { UpdateAccountData(address common.Address, original, account *accounts.Account) error UpdateAccountCode(address common.Address, incarnation uint64, codeHash common.Hash, code []byte) error DeleteAccount(address common.Address, original *accounts.Account) error WriteAccountStorage(address common.Address, incarnation uint64, key *common.Hash, original, value *uint256.Int) error CreateContract(address common.Address) error }
type StateWriterBufferedV3 ¶
type StateWriterBufferedV3 struct {
// contains filtered or unexported fields
}
StateWriterBufferedV3 - used by parallel workers to accumulate updates and then send them to conflict-resolution.
func NewStateWriterBufferedV3 ¶
func NewStateWriterBufferedV3(rs *StateV3, accumulator *shards.Accumulator) *StateWriterBufferedV3
func (*StateWriterBufferedV3) CreateContract ¶
func (w *StateWriterBufferedV3) CreateContract(address common.Address) error
func (*StateWriterBufferedV3) DeleteAccount ¶
func (*StateWriterBufferedV3) PrevAndDels ¶
func (*StateWriterBufferedV3) ResetWriteSet ¶
func (w *StateWriterBufferedV3) ResetWriteSet()
func (*StateWriterBufferedV3) SetTx ¶
func (w *StateWriterBufferedV3) SetTx(tx kv.Tx)
func (*StateWriterBufferedV3) SetTxNum ¶
func (w *StateWriterBufferedV3) SetTxNum(ctx context.Context, txNum uint64)
func (*StateWriterBufferedV3) UpdateAccountCode ¶
func (*StateWriterBufferedV3) UpdateAccountData ¶
func (*StateWriterBufferedV3) WriteAccountStorage ¶
type StateWriterV3 ¶
type StateWriterV3 struct {
// contains filtered or unexported fields
}
StateWriterV3 - used by parallel workers to accumulate updates and then send them to conflict-resolution.
func NewStateWriterV3 ¶
func NewStateWriterV3(rs *StateV3, accumulator *shards.Accumulator) *StateWriterV3
func (*StateWriterV3) CreateContract ¶
func (w *StateWriterV3) CreateContract(address common.Address) error
func (*StateWriterV3) DeleteAccount ¶
func (*StateWriterV3) PrevAndDels ¶
func (*StateWriterV3) ResetWriteSet ¶
func (w *StateWriterV3) ResetWriteSet()
func (*StateWriterV3) UpdateAccountCode ¶
func (*StateWriterV3) UpdateAccountData ¶
func (*StateWriterV3) WriteAccountStorage ¶
type TransferFunc ¶
TransferFunc is the signature of a transfer function
type TxContext ¶
type TxContext struct { // Message information TxHash common.Hash Origin common.Address // Provides information for ORIGIN GasPrice *uint256.Int // Provides information for GASPRICE BlobHashes []common.Hash // Provides versioned blob hashes for BLOBHASH }
TxContext provides the EVM with information about a transaction. All fields can change between transactions.
type TxTask ¶
type TxTask struct { TxNum uint64 BlockNum uint64 Rules *chain.Rules Header *types.Header Txs types.Transactions Uncles []*types.Header Coinbase libcommon.Address Withdrawals types.Withdrawals BlockHash libcommon.Hash Sender *libcommon.Address SkipAnalysis bool PruneNonEssentials bool TxIndex int // -1 for block initialisation Final bool Failed bool Tx types.Transaction GetHashFn func(n uint64) libcommon.Hash TxAsMessage types.Message EvmBlockContext evmtypes.BlockContext HistoryExecution bool // use history reader for that txn instead of state reader BalanceIncreaseSet map[libcommon.Address]uint256.Int ReadLists map[string]*state.KvList WriteLists map[string]*state.KvList AccountPrevs map[string][]byte AccountDels map[string]*accounts.Account StoragePrevs map[string][]byte CodePrevs map[string]uint64 Error error Logs []*types.Log TraceFroms map[libcommon.Address]struct{} TraceTos map[libcommon.Address]struct{} UsedGas uint64 // BlockReceipts is used only by Gnosis: // - it does store `proof, err := rlp.EncodeToBytes(ValidatorSetProof{Header: header, Receipts: r})` // - and later read it by filter: len(l.Topics) == 2 && l.Address == s.contractAddress && l.Topics[0] == EVENT_NAME_HASH && l.Topics[1] == header.ParentHash // Need investigate if we can pass here - only limited amount of receipts // And remove this field if possible - because it will make problems for parallel-execution BlockReceipts types.Receipts Config *chain.Config }
ReadWriteSet contains ReadSet, WriteSet and BalanceIncrease of a transaction, which is processed by a single thread that writes into the ReconState1 and flushes to the database
func (*TxTask) CreateReceipt ¶
type TxTaskQueue ¶
type TxTaskQueue []*TxTask
TxTaskQueue non-thread-safe priority-queue
func (TxTaskQueue) Len ¶
func (h TxTaskQueue) Len() int
func (TxTaskQueue) Less ¶
func (h TxTaskQueue) Less(i, j int) bool
func (*TxTaskQueue) Pop ¶
func (h *TxTaskQueue) Pop() interface{}
func (*TxTaskQueue) Push ¶
func (h *TxTaskQueue) Push(a interface{})
func (TxTaskQueue) Swap ¶
func (h TxTaskQueue) Swap(i, j int)
type WriterV4 ¶
type WriterV4 struct {
// contains filtered or unexported fields
}
func NewWriterV4 ¶
func NewWriterV4(tx kv.TemporalPutDel) *WriterV4
func (*WriterV4) CreateContract ¶
func (*WriterV4) DeleteAccount ¶
func (*WriterV4) UpdateAccountCode ¶
func (*WriterV4) UpdateAccountData ¶
func (*WriterV4) WriteAccountStorage ¶
func (*WriterV4) WriteChangeSets ¶
func (*WriterV4) WriteHistory ¶
type WriterWithChangeSets ¶
type WriterWithChangeSets interface { StateWriter WriteChangeSets() error WriteHistory() error }