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 Buffer
- type CachedReader
- func (cr *CachedReader) ReadAccountCode(address common.Address, incarnation uint64) ([]byte, error)
- func (cr *CachedReader) ReadAccountCodeSize(address common.Address, incarnation uint64) (int, error)
- func (cr *CachedReader) ReadAccountData(address common.Address) (*accounts.Account, error)
- func (cr *CachedReader) ReadAccountDataForDebug(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) ([]byte, error)
- func (r *CachedReader3) ReadAccountCodeSize(address common.Address, incarnation uint64) (int, error)
- func (r *CachedReader3) ReadAccountData(address common.Address) (*accounts.Account, error)
- func (r *CachedReader3) ReadAccountDataForDebug(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) ([]byte, error)
- func (hr *HistoryReaderV3) ReadAccountCodeSize(address common.Address, incarnation uint64) (int, error)
- func (hr *HistoryReaderV3) ReadAccountData(address common.Address) (*accounts.Account, error)
- func (hr *HistoryReaderV3) ReadAccountDataForDebug(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.TemporalTx)
- func (hr *HistoryReaderV3) SetTxNum(txNum uint64)
- func (hr *HistoryReaderV3) StateHistoryStartFrom() 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, ...) error
- 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) error
- func (sdb *IntraBlockState) Empty(addr libcommon.Address) (bool, error)
- func (sdb *IntraBlockState) Error() errordeprecated
- func (sdb *IntraBlockState) Exist(addr libcommon.Address) (bool, error)
- func (sdb *IntraBlockState) FinalizeTx(chainRules *chain.Rules, stateWriter StateWriter) error
- func (sdb *IntraBlockState) GetBalance(addr libcommon.Address) (*uint256.Int, error)
- func (sdb *IntraBlockState) GetCode(addr libcommon.Address) ([]byte, error)
- func (sdb *IntraBlockState) GetCodeHash(addr libcommon.Address) (libcommon.Hash, error)
- func (sdb *IntraBlockState) GetCodeSize(addr libcommon.Address) (int, error)
- func (sdb *IntraBlockState) GetCommittedState(addr libcommon.Address, key *libcommon.Hash, value *uint256.Int) error
- func (sdb *IntraBlockState) GetDelegatedDesignation(addr libcommon.Address) (libcommon.Address, bool, error)
- func (sdb *IntraBlockState) GetIncarnation(addr libcommon.Address) (uint64, error)
- func (sdb *IntraBlockState) GetLogs(txIndex int, txnHash libcommon.Hash, blockNumber uint64, ...) types.Logs
- func (sdb *IntraBlockState) GetNonce(addr libcommon.Address) (uint64, error)
- func (sdb *IntraBlockState) GetOrNewStateObject(addr libcommon.Address) (*stateObject, error)
- 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) error
- func (sdb *IntraBlockState) GetTransientState(addr libcommon.Address, key libcommon.Hash) uint256.Int
- func (sdb *IntraBlockState) HasSelfdestructed(addr libcommon.Address) (bool, error)
- 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, ...) error
- func (sdb *IntraBlockState) Print(chainRules chain.Rules)
- func (sdb *IntraBlockState) Reset()
- func (sdb *IntraBlockState) ResolveCode(addr libcommon.Address) ([]byte, error)
- func (sdb *IntraBlockState) ResolveCodeHash(addr libcommon.Address) (libcommon.Hash, error)
- func (sdb *IntraBlockState) RevertToSnapshot(revid int)
- func (sdb *IntraBlockState) Selfdestruct(addr libcommon.Address) (bool, error)
- func (sdb *IntraBlockState) Selfdestruct6780(addr libcommon.Address) error
- func (sdb *IntraBlockState) SetBalance(addr libcommon.Address, amount *uint256.Int, ...) error
- func (sdb *IntraBlockState) SetCode(addr libcommon.Address, code []byte) error
- func (sdb *IntraBlockState) SetHooks(hooks *tracing.Hooks)
- func (sdb *IntraBlockState) SetIncarnation(addr libcommon.Address, incarnation uint64) error
- func (sdb *IntraBlockState) SetNonce(addr libcommon.Address, nonce uint64) error
- func (sdb *IntraBlockState) SetState(addr libcommon.Address, key *libcommon.Hash, value uint256.Int) error
- func (sdb *IntraBlockState) SetStorage(addr libcommon.Address, storage Storage) error
- 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, ...) error
- 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) ([]byte, error)
- func (r *ReaderParallelV3) ReadAccountCodeSize(address common.Address, incarnation uint64) (int, error)
- func (r *ReaderParallelV3) ReadAccountData(address common.Address) (*accounts.Account, error)
- func (r *ReaderParallelV3) ReadAccountDataForDebug(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.TemporalTx)
- func (r *ReaderParallelV3) SetTxNum(txNum uint64)
- type ReaderV3
- func (r *ReaderV3) DiscardReadList()
- func (r *ReaderV3) ReadAccountCode(address common.Address, incarnation uint64) ([]byte, error)
- func (r *ReaderV3) ReadAccountCodeSize(address common.Address, incarnation uint64) (int, error)
- func (r *ReaderV3) ReadAccountData(address common.Address) (*accounts.Account, error)
- func (r *ReaderV3) ReadAccountDataForDebug(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.TemporalTx)
- 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) (err 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 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 Stateless
- func (s *Stateless) CheckRoot(expected common.Hash) error
- func (s *Stateless) CreateContract(address common.Address) error
- func (s *Stateless) DeleteAccount(address common.Address, original *accounts.Account) error
- func (s *Stateless) Finalize() common.Hash
- func (s *Stateless) GetTrie() *trie.Trie
- func (s *Stateless) ReadAccountCode(address common.Address, incarnation uint64) (code []byte, err error)
- func (s *Stateless) ReadAccountCodeSize(address common.Address, incarnation uint64) (codeSize int, err error)
- func (s *Stateless) ReadAccountData(address common.Address) (*accounts.Account, error)
- func (s *Stateless) ReadAccountDataForDebug(address common.Address) (*accounts.Account, error)
- func (s *Stateless) ReadAccountIncarnation(address common.Address) (uint64, error)
- func (s *Stateless) ReadAccountStorage(address common.Address, incarnation uint64, key *common.Hash) ([]byte, error)
- func (s *Stateless) SetBlockNr(blockNr uint64)
- func (s *Stateless) SetStrictHash(strict bool)
- func (s *Stateless) UpdateAccountCode(address common.Address, incarnation uint64, codeHash common.Hash, code []byte) error
- func (s *Stateless) UpdateAccountData(address common.Address, original, account *accounts.Account) error
- func (s *Stateless) WriteAccountStorage(address common.Address, incarnation uint64, key *common.Hash, ...) error
- func (s *Stateless) WriteChangeSets() error
- func (s *Stateless) WriteHistory() error
- type Storage
- type TransferFunc
- type TrieDbState
- func (tds *TrieDbState) BuildAccountReads() common.Hashes
- func (tds *TrieDbState) BuildCodeTouches() map[libcommon.Hash]witnesstypes.CodeWithHash
- func (tds *TrieDbState) BuildStorageReads() common.StorageKeys
- func (tds *TrieDbState) ClearUpdates()
- func (tds *TrieDbState) Copy() *TrieDbState
- func (tds *TrieDbState) ExtractTouches() (accountTouches [][]byte, storageTouches [][]byte)
- func (tds *TrieDbState) ExtractWitness(trace bool, isBinary bool) (*trie.Witness, error)
- func (tds *TrieDbState) ExtractWitnessForPrefix(prefix []byte, trace bool, isBinary bool) (*trie.Witness, error)
- func (tds *TrieDbState) GetAccount(addrHash libcommon.Hash) (*accounts.Account, bool)
- func (tds *TrieDbState) GetBlockNr() uint64
- func (tds *TrieDbState) GetRetainList() *trie.RetainList
- func (tds *TrieDbState) GetTouchedPlainKeys() (plainKeys [][]byte, hashedKeys [][]byte)
- func (tds *TrieDbState) GetTrieHash() libcommon.Hash
- func (tds *TrieDbState) LastRoot() libcommon.Hash
- func (tds *TrieDbState) PopulateAccountBlockProof(accountTouches common.Hashes)
- func (tds *TrieDbState) PopulateStorageBlockProof(storageTouches common.StorageKeys) error
- func (tds *TrieDbState) PrintTrie(w io.Writer)
- func (tds *TrieDbState) ReadAccountCode(address libcommon.Address, incarnation uint64) (code []byte, err error)
- func (tds *TrieDbState) ReadAccountCodeSize(address libcommon.Address, incarnation uint64) (codeSize int, err error)
- func (tds *TrieDbState) ReadAccountData(address libcommon.Address) (*accounts.Account, error)
- func (tds *TrieDbState) ReadAccountDataForDebug(address libcommon.Address) (*accounts.Account, error)
- func (tds *TrieDbState) ReadAccountIncarnation(address libcommon.Address) (uint64, error)
- func (tds *TrieDbState) ReadAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash) ([]byte, error)
- func (tds *TrieDbState) ResolveBuffer()
- func (tds *TrieDbState) SetBlockNr(blockNr uint64)
- func (tds *TrieDbState) SetResolveReads(rr bool)
- func (tds *TrieDbState) SetRetainList(rl *trie.RetainList)
- func (tds *TrieDbState) SetTrie(tr *trie.Trie)
- func (tds *TrieDbState) StartNewBuffer()
- func (tds *TrieDbState) Trie() *trie.Trie
- func (tds *TrieDbState) TrieStateWriter() *TrieStateWriter
- func (tds *TrieDbState) UpdateStateTrie() ([]libcommon.Hash, error)
- func (tds *TrieDbState) WithLastBuffer() *TrieDbState
- func (tds *TrieDbState) WithNewBuffer() *TrieDbState
- type TrieStateWriter
- func (tsw *TrieStateWriter) CreateContract(address libcommon.Address) error
- func (tsw *TrieStateWriter) DeleteAccount(address libcommon.Address, original *accounts.Account) error
- func (tsw *TrieStateWriter) UpdateAccountCode(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash, ...) error
- func (tsw *TrieStateWriter) UpdateAccountData(address libcommon.Address, original, account *accounts.Account) error
- func (tsw *TrieStateWriter) WriteAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash, ...) error
- func (tds *TrieStateWriter) WriteChangeSets() error
- func (tds *TrieStateWriter) WriteHistory() error
- 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 PrunedError = errors.New("old data not available due to pruning")
var SystemAddress = libcommon.HexToAddress("0xfffffffffffffffffffffffffffffffffffffffe")
SystemAddress - sender address for internal state updates.
var TooMuchIterations = errors.New("[rpc] dumper: too much iterations protection triggered")
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 Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is a structure holding updates, deletes, and reads registered within one change period A change period can be transaction within a block, or a block within group of blocks
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 ¶
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) ReadAccountDataForDebug ¶
ReadAccountDataForDebug 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) ReadAccountDataForDebug ¶
ReadAccountDataForDebug - is like ReadAccountData, but without adding key to `readList`. Used to get `prev` account balance
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 hexutil.Bytes `json:"root"` CodeHash hexutil.Bytes `json:"codeHash"` Code hexutil.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 *hexutil.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 NewDumper ¶
func NewDumper(db kv.TemporalTx, txNumsReader rawdbv3.TxNumsReader, blockNumber uint64) *Dumper
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) ReadAccountDataForDebug ¶
func (hr *HistoryReaderV3) ReadAccountDataForDebug(address common.Address) (*accounts.Account, error)
ReadAccountDataForDebug - is like ReadAccountData, but without adding key to `readList`. Used to get `prev` account balance
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.TemporalTx)
func (*HistoryReaderV3) SetTxNum ¶
func (hr *HistoryReaderV3) SetTxNum(txNum uint64)
func (*HistoryReaderV3) StateHistoryStartFrom ¶
func (hr *HistoryReaderV3) StateHistoryStartFrom() uint64
Gets the txNum where Account, Storage and Code history begins. If the node is an archive node all history will be available therefore the result will be 0.
For non-archive node old history files get deleted, so this number will vary but the goal is to know where the historical data begins.
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) error
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) error
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, error)
Empty returns whether the state object is either non-existent or empty according to the EIP161 specification (balance = nonce = code = 0)
func (*IntraBlockState) Error
deprecated
func (sdb *IntraBlockState) Error() error
Deprecated: The IBS api now returns errors directly
func (*IntraBlockState) Exist ¶
func (sdb *IntraBlockState) Exist(addr libcommon.Address) (bool, error)
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 ¶
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, error)
DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account
func (*IntraBlockState) GetCodeHash ¶
DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account
func (*IntraBlockState) GetCodeSize ¶
func (sdb *IntraBlockState) GetCodeSize(addr libcommon.Address) (int, error)
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) error
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, error)
func (*IntraBlockState) GetNonce ¶
func (sdb *IntraBlockState) GetNonce(addr libcommon.Address) (uint64, error)
DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account
func (*IntraBlockState) GetOrNewStateObject ¶
func (sdb *IntraBlockState) GetOrNewStateObject(addr libcommon.Address) (*stateObject, error)
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) error
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, error)
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 types.AccessList, authorities []libcommon.Address) error
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, error)
func (*IntraBlockState) ResolveCodeHash ¶
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, error)
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) error
func (*IntraBlockState) SetBalance ¶
func (sdb *IntraBlockState) SetBalance(addr libcommon.Address, amount *uint256.Int, reason tracing.BalanceChangeReason) error
DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account
func (*IntraBlockState) SetCode ¶
func (sdb *IntraBlockState) SetCode(addr libcommon.Address, code []byte) error
DESCRIBED: docs/programmers_guide/guide.md#code-hash DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account
func (*IntraBlockState) SetHooks ¶
func (sdb *IntraBlockState) SetHooks(hooks *tracing.Hooks)
func (*IntraBlockState) SetIncarnation ¶
func (sdb *IntraBlockState) SetIncarnation(addr libcommon.Address, incarnation uint64) error
SetIncarnation sets incarnation for account if account exists
func (*IntraBlockState) SetNonce ¶
func (sdb *IntraBlockState) SetNonce(addr libcommon.Address, nonce uint64) error
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) error
DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account
func (*IntraBlockState) SetStorage ¶
func (sdb *IntraBlockState) SetStorage(addr libcommon.Address, storage Storage) error
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) error
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) ReadAccountDataForDebug ¶
func (r *ReaderParallelV3) ReadAccountDataForDebug(address common.Address) (*accounts.Account, error)
ReadAccountDataForDebug - is like ReadAccountData, but without adding key to `readList`. Used to get `prev` account balance
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.TemporalTx)
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) ReadAccountDataForDebug ¶
func (*ReaderV3) ReadAccountIncarnation ¶
func (*ReaderV3) ReadAccountStorage ¶
func (*ReaderV3) ResetReadSet ¶
func (r *ReaderV3) ResetReadSet()
func (*ReaderV3) SetTx ¶
func (r *ReaderV3) SetTx(tx kv.TemporalTx)
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 ResettableStateReader interface { StateReader SetTx(tx kv.TemporalTx) SetTxNum(txn uint64) DiscardReadList() ReadSet() map[string]*state.KvList ResetReadSet() }
type ResultsQueue ¶
type ResultsQueue struct {
// contains filtered or unexported fields
}
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) (err error)
DrainNonBlocking - does drain batch of results to heap. Immediately stops at `q.limit` or if nothing to drain
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) ReadAccountDataForDebug(address common.Address) (*accounts.Account, error) ReadAccountStorage(address common.Address, incarnation uint64, key *common.Hash) ([]byte, error) ReadAccountCode(address common.Address, incarnation uint64) ([]byte, error) ReadAccountCodeSize(address common.Address, incarnation uint64) (int, error) ReadAccountIncarnation(address common.Address) (uint64, error) }
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 Stateless ¶
type Stateless struct {
// contains filtered or unexported fields
}
Stateless is the inter-block cache for stateless client prototype, iteration 2 It creates the initial state trie during the construction, and then updates it during the execution of block(s)
func NewStateless ¶
func NewStateless(stateRoot common.Hash, blockWitness *trie.Witness, blockNr uint64, trace bool, isBinary bool) (*Stateless, error)
NewStateless creates a new instance of Stateless It deserialises the block witness and creates the state trie out of it, checking that the root of the constructed state trie matches the value of `stateRoot` parameter
func (*Stateless) CheckRoot ¶
CheckRoot finalises the execution of a block and computes the resulting state root
func (*Stateless) CreateContract ¶
CreateContract is a part of StateWriter interface This implementation registers given address in the internal map `created`
func (*Stateless) DeleteAccount ¶
DeleteAccount is a part of the StateWriter interface This implementation registers the deletion of the account in two internal maps
func (*Stateless) Finalize ¶
Finalize the execution of a block and computes the resulting state root
func (*Stateless) ReadAccountCode ¶
func (s *Stateless) ReadAccountCode(address common.Address, incarnation uint64) (code []byte, err error)
ReadAccountCode is a part of the StateReader interface
func (*Stateless) ReadAccountCodeSize ¶
func (s *Stateless) ReadAccountCodeSize(address common.Address, incarnation uint64) (codeSize int, err error)
ReadAccountCodeSize is a part of the StateReader interface This implementation looks the code up in the codeMap, and returns its size It fails if the code is not found in the map
func (*Stateless) ReadAccountData ¶
ReadAccountData is a part of the StateReader interface This implementation attempts to look up account data in the state trie, and fails if it is not found
func (*Stateless) ReadAccountDataForDebug ¶
func (*Stateless) ReadAccountIncarnation ¶
func (*Stateless) ReadAccountStorage ¶
func (s *Stateless) ReadAccountStorage(address common.Address, incarnation uint64, key *common.Hash) ([]byte, error)
ReadAccountStorage is a part of the StateReader interface This implementation attempts to look up the storage in the state trie, and fails if it is not found
func (*Stateless) SetBlockNr ¶
SetBlockNr changes the block number associated with this
func (*Stateless) SetStrictHash ¶
func (*Stateless) UpdateAccountCode ¶
func (s *Stateless) UpdateAccountCode(address common.Address, incarnation uint64, codeHash common.Hash, code []byte) error
UpdateAccountCode is a part of the StateWriter interface This implementation adds the code to the codeMap to make it available for further accesses
func (*Stateless) UpdateAccountData ¶
func (s *Stateless) UpdateAccountData(address common.Address, original, account *accounts.Account) error
UpdateAccountData is a part of the StateWriter interface This implementation registers the account update in the `accountUpdates` map
func (*Stateless) WriteAccountStorage ¶
func (s *Stateless) WriteAccountStorage(address common.Address, incarnation uint64, key *common.Hash, original, value *uint256.Int) error
WriteAccountStorage is a part of the StateWriter interface This implementation registeres the change of the account's storage in the internal double map `storageUpdates`
func (*Stateless) WriteChangeSets ¶
func (*Stateless) WriteHistory ¶
type TransferFunc ¶
TransferFunc is the signature of a transfer function
type TrieDbState ¶
type TrieDbState struct { StateReader StateReader // contains filtered or unexported fields }
TrieDbState implements StateReader by wrapping a trie and a database, where trie acts as a cache for the database
func NewTrieDbState ¶
func NewTrieDbState(root libcommon.Hash, blockNr uint64, stateReader StateReader) *TrieDbState
func (*TrieDbState) BuildAccountReads ¶
func (tds *TrieDbState) BuildAccountReads() common.Hashes
BuildAccountReads builds a sorted list of all address hashes that were modified (or also just read, if tds.resolveReads flags is turned one) within the period for which we are aggregating update
func (*TrieDbState) BuildCodeTouches ¶
func (tds *TrieDbState) BuildCodeTouches() map[libcommon.Hash]witnesstypes.CodeWithHash
func (*TrieDbState) BuildStorageReads ¶
func (tds *TrieDbState) BuildStorageReads() common.StorageKeys
BuildStorageReads builds a sorted list of all storage key hashes that were modified (or also just read, if tds.resolveReads flag is turned on) within the period for which we are aggregating updates. It includes the keys of items that were nullified by subsequent updates - best example is the self-destruction of a contract, which nullifies all previous modifications of the contract's storage. In such case, all previously modified storage item updates would be inclided.
func (*TrieDbState) ClearUpdates ¶
func (tds *TrieDbState) ClearUpdates()
func (*TrieDbState) Copy ¶
func (tds *TrieDbState) Copy() *TrieDbState
func (*TrieDbState) ExtractTouches ¶
func (tds *TrieDbState) ExtractTouches() (accountTouches [][]byte, storageTouches [][]byte)
ExtractTouches returns two lists of keys - for accounts and storage items correspondingly Each list is the collection of keys that have been "touched" (inserted, updated, or simply accessed) since the last invocation of `ExtractTouches`.
func (*TrieDbState) ExtractWitness ¶
ExtractWitness produces block witness for the block just been processed, in a serialised form
func (*TrieDbState) ExtractWitnessForPrefix ¶
func (tds *TrieDbState) ExtractWitnessForPrefix(prefix []byte, trace bool, isBinary bool) (*trie.Witness, error)
ExtractWitness produces block witness for the block just been processed, in a serialised form
func (*TrieDbState) GetAccount ¶
func (*TrieDbState) GetBlockNr ¶
func (tds *TrieDbState) GetBlockNr() uint64
func (*TrieDbState) GetRetainList ¶
func (tds *TrieDbState) GetRetainList() *trie.RetainList
func (*TrieDbState) GetTouchedPlainKeys ¶
func (tds *TrieDbState) GetTouchedPlainKeys() (plainKeys [][]byte, hashedKeys [][]byte)
Get list of account and storage touches First come the account touches then the storage touches
func (*TrieDbState) GetTrieHash ¶
func (tds *TrieDbState) GetTrieHash() libcommon.Hash
func (*TrieDbState) LastRoot ¶
func (tds *TrieDbState) LastRoot() libcommon.Hash
func (*TrieDbState) PopulateAccountBlockProof ¶
func (tds *TrieDbState) PopulateAccountBlockProof(accountTouches common.Hashes)
func (*TrieDbState) PopulateStorageBlockProof ¶
func (tds *TrieDbState) PopulateStorageBlockProof(storageTouches common.StorageKeys) error
Populate pending block proof so that it will be sufficient for accessing all storage slots in storageTouches
func (*TrieDbState) PrintTrie ¶
func (tds *TrieDbState) PrintTrie(w io.Writer)
func (*TrieDbState) ReadAccountCode ¶
func (*TrieDbState) ReadAccountCodeSize ¶
func (*TrieDbState) ReadAccountData ¶
func (*TrieDbState) ReadAccountDataForDebug ¶
func (*TrieDbState) ReadAccountIncarnation ¶
func (tds *TrieDbState) ReadAccountIncarnation(address libcommon.Address) (uint64, error)
func (*TrieDbState) ReadAccountStorage ¶
func (*TrieDbState) ResolveBuffer ¶
func (tds *TrieDbState) ResolveBuffer()
func (*TrieDbState) SetBlockNr ¶
func (tds *TrieDbState) SetBlockNr(blockNr uint64)
func (*TrieDbState) SetResolveReads ¶
func (tds *TrieDbState) SetResolveReads(rr bool)
func (*TrieDbState) SetRetainList ¶
func (tds *TrieDbState) SetRetainList(rl *trie.RetainList)
func (*TrieDbState) SetTrie ¶
func (tds *TrieDbState) SetTrie(tr *trie.Trie)
func (*TrieDbState) StartNewBuffer ¶
func (tds *TrieDbState) StartNewBuffer()
func (*TrieDbState) Trie ¶
func (tds *TrieDbState) Trie() *trie.Trie
func (*TrieDbState) TrieStateWriter ¶
func (tds *TrieDbState) TrieStateWriter() *TrieStateWriter
func (*TrieDbState) UpdateStateTrie ¶
func (tds *TrieDbState) UpdateStateTrie() ([]libcommon.Hash, error)
UpdateStateTrie assumes that the state trie is already fully resolved, i.e. any operations will find necessary data inside the trie.
func (*TrieDbState) WithLastBuffer ¶
func (tds *TrieDbState) WithLastBuffer() *TrieDbState
func (*TrieDbState) WithNewBuffer ¶
func (tds *TrieDbState) WithNewBuffer() *TrieDbState
type TrieStateWriter ¶
type TrieStateWriter struct {
// contains filtered or unexported fields
}
func (*TrieStateWriter) CreateContract ¶
func (tsw *TrieStateWriter) CreateContract(address libcommon.Address) error
func (*TrieStateWriter) DeleteAccount ¶
func (*TrieStateWriter) UpdateAccountCode ¶
func (*TrieStateWriter) UpdateAccountData ¶
func (*TrieStateWriter) WriteAccountStorage ¶
func (*TrieStateWriter) WriteChangeSets ¶
func (tds *TrieStateWriter) WriteChangeSets() error
func (*TrieStateWriter) WriteHistory ¶
func (tds *TrieStateWriter) WriteHistory() error
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 SkipAnalysis 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 // contains filtered or unexported fields }
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 }