Documentation ¶
Overview ¶
Package state provides a caching layer atop the Ethereum state trie.
Index ¶
- Constants
- Variables
- func ReconnLess(i, thanItem reconPair) bool
- func WalkAsOfAccounts(tx kv.Tx, startAddress libcommon.Address, timestamp uint64, ...) error
- func WalkAsOfStorage(tx kv.Tx, address libcommon.Address, incarnation uint64, ...) error
- type BalanceIncrease
- type CachedReader
- func (cr *CachedReader) ReadAccountCode(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash) ([]byte, error)
- func (cr *CachedReader) ReadAccountCodeSize(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash) (int, error)
- func (cr *CachedReader) ReadAccountData(address libcommon.Address) (*accounts.Account, error)
- func (cr *CachedReader) ReadAccountIncarnation(address libcommon.Address) (uint64, error)
- func (cr *CachedReader) ReadAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash) ([]byte, error)
- type CachedReader2
- func (r *CachedReader2) ReadAccountCode(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash) ([]byte, error)
- func (r *CachedReader2) ReadAccountCodeSize(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash) (int, error)
- func (r *CachedReader2) ReadAccountData(address libcommon.Address) (*accounts.Account, error)
- func (r *CachedReader2) ReadAccountIncarnation(address libcommon.Address) (uint64, error)
- func (r *CachedReader2) ReadAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash) ([]byte, error)
- type CachedWriter
- func (cw *CachedWriter) CreateContract(address libcommon.Address) error
- func (cw *CachedWriter) DeleteAccount(address libcommon.Address, original *accounts.Account) error
- func (cw *CachedWriter) UpdateAccountCode(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash, ...) error
- func (cw *CachedWriter) UpdateAccountData(address libcommon.Address, original, account *accounts.Account) error
- func (cw *CachedWriter) WriteAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash, ...) error
- func (cw *CachedWriter) WriteChangeSets() error
- func (cw *CachedWriter) WriteHistory() error
- type ChangeSetWriter
- func (w *ChangeSetWriter) CreateContract(address libcommon.Address) error
- func (w *ChangeSetWriter) DeleteAccount(address libcommon.Address, original *accounts.Account) error
- func (w *ChangeSetWriter) GetAccountChanges() (*historyv22.ChangeSet, error)
- func (w *ChangeSetWriter) GetStorageChanges() (*historyv22.ChangeSet, error)
- func (w *ChangeSetWriter) PrintChangedAccounts()
- func (w *ChangeSetWriter) UpdateAccountCode(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash, ...) error
- func (w *ChangeSetWriter) UpdateAccountData(address libcommon.Address, original, account *accounts.Account) error
- func (w *ChangeSetWriter) WriteAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash, ...) error
- func (w *ChangeSetWriter) WriteChangeSets() error
- func (w *ChangeSetWriter) WriteHistory() error
- type Code
- type DbStateReader
- func (dbr *DbStateReader) ReadAccountCode(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash) ([]byte, error)
- func (dbr *DbStateReader) ReadAccountCodeSize(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash) (codeSize int, err error)
- func (dbr *DbStateReader) ReadAccountData(address libcommon.Address) (*accounts.Account, error)
- func (dbr *DbStateReader) ReadAccountIncarnation(address libcommon.Address) (uint64, error)
- func (dbr *DbStateReader) ReadAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash) ([]byte, error)
- func (dbr *DbStateReader) SetAccountCache(accountCache *fastcache.Cache)
- func (dbr *DbStateReader) SetCodeCache(codeCache *fastcache.Cache)
- func (dbr *DbStateReader) SetCodeSizeCache(codeSizeCache *fastcache.Cache)
- func (dbr *DbStateReader) SetStorageCache(storageCache *fastcache.Cache)
- type DbStateWriter
- func (dsw *DbStateWriter) ChangeSetWriter() *ChangeSetWriter
- func (dsw *DbStateWriter) CreateContract(address libcommon.Address) error
- func (dsw *DbStateWriter) DeleteAccount(address libcommon.Address, original *accounts.Account) error
- func (dsw *DbStateWriter) UpdateAccountCode(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash, ...) error
- func (dsw *DbStateWriter) UpdateAccountData(address libcommon.Address, original, account *accounts.Account) error
- func (dsw *DbStateWriter) WriteAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash, ...) error
- func (dsw *DbStateWriter) WriteChangeSets() error
- func (dsw *DbStateWriter) WriteHistory() error
- 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 HistoryReaderInc
- func (hr *HistoryReaderInc) ReadAccountCode(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash) ([]byte, error)
- func (hr *HistoryReaderInc) ReadAccountCodeSize(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash) (int, error)
- func (hr *HistoryReaderInc) ReadAccountData(address libcommon.Address) (*accounts.Account, error)
- func (hr *HistoryReaderInc) ReadAccountIncarnation(address libcommon.Address) (uint64, error)
- func (hr *HistoryReaderInc) ReadAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash) ([]byte, error)
- func (hr *HistoryReaderInc) ReadError() (uint64, bool)
- func (hr *HistoryReaderInc) ResetError()
- func (hr *HistoryReaderInc) SetChainTx(chainTx kv.Tx)
- func (hr *HistoryReaderInc) SetTrace(trace bool)
- func (hr *HistoryReaderInc) SetTx(tx kv.Tx)
- func (hr *HistoryReaderInc) SetTxNum(txNum uint64)
- type HistoryReaderV3
- func (hr *HistoryReaderV3) GetTxCount() (uint64, error)
- func (hr *HistoryReaderV3) ReadAccountCode(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash) ([]byte, error)
- func (hr *HistoryReaderV3) ReadAccountCodeSize(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash) (int, error)
- func (hr *HistoryReaderV3) ReadAccountData(address libcommon.Address) (*accounts.Account, error)
- func (hr *HistoryReaderV3) ReadAccountIncarnation(address libcommon.Address) (uint64, error)
- func (hr *HistoryReaderV3) ReadAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash) ([]byte, error)
- func (hr *HistoryReaderV3) SetTrace(trace bool)
- func (hr *HistoryReaderV3) SetTx(tx kv.Tx)
- func (hr *HistoryReaderV3) SetTxNum(txNum uint64)
- type HistoryReaderV4
- func (hr *HistoryReaderV4) FinishTx() error
- func (hr *HistoryReaderV4) ReadAccountCode(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash) ([]byte, error)
- func (hr *HistoryReaderV4) ReadAccountCodeSize(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash) (int, error)
- func (hr *HistoryReaderV4) ReadAccountData(address libcommon.Address) (*accounts.Account, error)
- func (hr *HistoryReaderV4) ReadAccountIncarnation(address libcommon.Address) (uint64, error)
- func (hr *HistoryReaderV4) ReadAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash) ([]byte, error)
- func (hr *HistoryReaderV4) SetRwTx(tx kv.RwTx)
- func (hr *HistoryReaderV4) SetTrace(trace bool)
- func (hr *HistoryReaderV4) SetTx(tx kv.Tx)
- func (hr *HistoryReaderV4) SetTxNum(txNum uint64)
- type IntraBlockState
- func (sdb *IntraBlockState) AddAddressToAccessList(addr libcommon.Address)
- 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)
- 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) GetIncarnation(addr libcommon.Address) uint64
- func (sdb *IntraBlockState) GetLogs(hash libcommon.Hash) []*types.Log
- func (sdb *IntraBlockState) GetNonce(addr libcommon.Address) uint64
- func (sdb *IntraBlockState) GetOrNewStateObject(addr libcommon.Address) *stateObject
- func (sdb *IntraBlockState) GetRefund() uint64
- func (sdb *IntraBlockState) GetState(addr libcommon.Address, key *libcommon.Hash, value *uint256.Int)
- func (sdb *IntraBlockState) GetTxCount() (uint64, error)
- func (sdb *IntraBlockState) HasSelfdestructed(addr libcommon.Address) bool
- func (sdb *IntraBlockState) Logs() []*types.Log
- func (sdb *IntraBlockState) MakeWriteSet(chainRules *chain.Rules, stateWriter StateWriter) error
- func (sdb *IntraBlockState) Prepare(thash, bhash libcommon.Hash, ti int)
- func (sdb *IntraBlockState) PrepareAccessList(sender libcommon.Address, dst *libcommon.Address, ...)
- func (sdb *IntraBlockState) Print(chainRules chain.Rules)
- func (sdb *IntraBlockState) Reset()
- func (sdb *IntraBlockState) RevertToSnapshot(revid int)
- func (sdb *IntraBlockState) ScalableSetSmtRootHash(roHermezDb ReadOnlyHermezDb) error
- func (sdb *IntraBlockState) ScalableSetTxNum()
- func (sdb *IntraBlockState) Selfdestruct(addr libcommon.Address) bool
- 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) 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) TxIndex() int
- type IteratorDump
- type NoopWriter
- func (nw *NoopWriter) CreateContract(address libcommon.Address) error
- func (nw *NoopWriter) DeleteAccount(address libcommon.Address, original *accounts.Account) error
- func (nw *NoopWriter) UpdateAccountCode(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash, ...) error
- func (nw *NoopWriter) UpdateAccountData(address libcommon.Address, original, account *accounts.Account) error
- func (nw *NoopWriter) WriteAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash, ...) error
- func (nw *NoopWriter) WriteChangeSets() error
- func (nw *NoopWriter) WriteHistory() error
- type PlainState
- func (s *PlainState) CreateContract(address libcommon.Address) error
- func (s *PlainState) DeleteAccount(address libcommon.Address, original *accounts.Account) error
- func (s *PlainState) ForEachStorage(addr libcommon.Address, startLocation libcommon.Hash, ...) error
- func (s *PlainState) GetBlockNr() uint64
- func (s *PlainState) ReadAccountCode(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash) ([]byte, error)
- func (s *PlainState) ReadAccountCodeSize(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash) (int, error)
- func (s *PlainState) ReadAccountData(address libcommon.Address) (*accounts.Account, error)
- func (s *PlainState) ReadAccountDataMaybeNil(address libcommon.Address) (*accounts.Account, error)
- func (s *PlainState) ReadAccountIncarnation(address libcommon.Address) (uint64, error)
- func (s *PlainState) ReadAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash) ([]byte, error)
- func (s *PlainState) SetBlockNr(blockNr uint64)
- func (s *PlainState) SetTrace(trace bool)
- func (s *PlainState) UpdateAccountCode(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash, ...) error
- func (s *PlainState) UpdateAccountData(address libcommon.Address, original, account *accounts.Account) error
- func (s *PlainState) WriteAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash, ...) error
- type PlainStateReader
- func (r *PlainStateReader) ForEach(table string, fromPrefix []byte, walker func(k, v []byte) error) error
- func (r *PlainStateReader) GetTxCount() (uint64, error)
- func (r *PlainStateReader) ReadAccountCode(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash) ([]byte, error)
- func (r *PlainStateReader) ReadAccountCodeSize(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash) (int, error)
- func (r *PlainStateReader) ReadAccountData(address libcommon.Address) (*accounts.Account, error)
- func (r *PlainStateReader) ReadAccountIncarnation(address libcommon.Address) (uint64, error)
- func (r *PlainStateReader) ReadAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash) ([]byte, error)
- type PlainStateWriter
- func (w *PlainStateWriter) ChangeSetWriter() *ChangeSetWriter
- func (w *PlainStateWriter) CreateContract(address libcommon.Address) error
- func (w *PlainStateWriter) DeleteAccount(address libcommon.Address, original *accounts.Account) error
- func (w *PlainStateWriter) SetAccumulator(accumulator *shards.Accumulator) *PlainStateWriter
- func (w *PlainStateWriter) UpdateAccountCode(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash, ...) error
- func (w *PlainStateWriter) UpdateAccountData(address libcommon.Address, original, account *accounts.Account) error
- func (w *PlainStateWriter) WriteAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash, ...) error
- func (w *PlainStateWriter) WriteChangeSets() error
- func (w *PlainStateWriter) WriteHistory() error
- type ReadOnlyHermezDb
- 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 *exec22.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 *exec22.TxTask, dependency uint64)
- func (rs *ReconnWork) Schedule(ctx context.Context) (*exec22.TxTask, bool, error)
- type RequiredStateError
- type StateReader
- type StateReaderIterator
- type StateReaderV3
- func (r *StateReaderV3) DiscardReadList()
- func (r *StateReaderV3) ReadAccountCode(address common.Address, incarnation uint64, codeHash common.Hash) ([]byte, error)
- func (r *StateReaderV3) ReadAccountCodeSize(address common.Address, incarnation uint64, codeHash common.Hash) (int, error)
- func (r *StateReaderV3) ReadAccountData(address common.Address) (*accounts.Account, error)
- func (r *StateReaderV3) ReadAccountIncarnation(address common.Address) (uint64, error)
- func (r *StateReaderV3) ReadAccountStorage(address common.Address, incarnation uint64, key *common.Hash) ([]byte, error)
- func (r *StateReaderV3) ReadSet() map[string]*exec22.KvList
- func (r *StateReaderV3) ResetReadSet()
- func (r *StateReaderV3) SetTrace(trace bool)
- func (r *StateReaderV3) SetTx(tx kv.Tx)
- func (r *StateReaderV3) SetTxNum(txNum uint64)
- 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 *exec22.TxTask, in *exec22.QueueWithRetry)
- func (rs *StateV3) ApplyHistory(txTask *exec22.TxTask, agg *libstate.AggregatorV3) error
- func (rs *StateV3) ApplyState(roTx kv.Tx, txTask *exec22.TxTask, agg *libstate.AggregatorV3) error
- func (rs *StateV3) CommitTxNum(sender *common.Address, txNum uint64, in *exec22.QueueWithRetry) (count int)
- func (rs *StateV3) DoneCount() uint64
- func (rs *StateV3) Flush(ctx context.Context, rwTx kv.RwTx, logPrefix string, logEvery *time.Ticker) error
- func (rs *StateV3) Get(table string, key []byte) (v []byte, ok bool)
- func (rs *StateV3) ReTry(txTask *exec22.TxTask, in *exec22.QueueWithRetry)
- func (rs *StateV3) ReadsValid(readLists map[string]*exec22.KvList) bool
- func (rs *StateV3) RegisterSender(txTask *exec22.TxTask) bool
- func (rs *StateV3) SizeEstimate() (r uint64)
- func (rs *StateV3) Unwind(ctx context.Context, tx kv.RwTx, txUnwindTo uint64, agg *libstate.AggregatorV3, ...) error
- type StateWriter
- 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) SetTxNum(txNum uint64)
- 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]*exec22.KvList
- type Storage
- type TxCountReader
- 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 )
const CodeSizeTable = "CodeSize"
const StorageTable = "Storage"
Variables ¶
var ExecTxsDone = metrics.NewCounter(`exec_txs_done`)
var SystemAddress = libcommon.HexToAddress("0xfffffffffffffffffffffffffffffffffffffffe")
SystemAddress - sender address for internal state updates.
Functions ¶
func ReconnLess ¶
func ReconnLess(i, thanItem reconPair) bool
func WalkAsOfAccounts ¶
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 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 libcommon.Address, incarnation uint64, codeHash libcommon.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 libcommon.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 libcommon.Address, incarnation uint64, key *libcommon.Hash) ([]byte, error)
ReadAccountStorage is called when a storage item needs to be fetched from the state
type CachedReader2 ¶
type CachedReader2 struct {
// contains filtered or unexported fields
}
CachedReader2 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 NewCachedReader2 ¶
func NewCachedReader2(cache kvcache.CacheView, tx kv.Tx) *CachedReader2
NewCachedReader2 wraps a given state reader into the cached reader
func (*CachedReader2) ReadAccountCode ¶
func (*CachedReader2) ReadAccountCodeSize ¶
func (*CachedReader2) ReadAccountData ¶
ReadAccountData is called when an account needs to be fetched from the state
func (*CachedReader2) ReadAccountIncarnation ¶
func (r *CachedReader2) ReadAccountIncarnation(address libcommon.Address) (uint64, error)
func (*CachedReader2) 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 libcommon.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 ChangeSetWriter ¶
type ChangeSetWriter struct {
// contains filtered or unexported fields
}
ChangeSetWriter is a mock StateWriter that accumulates changes in-memory into ChangeSets.
func NewChangeSetWriter ¶
func NewChangeSetWriter() *ChangeSetWriter
func NewChangeSetWriterPlain ¶
func NewChangeSetWriterPlain(db kv.RwTx, blockNumber uint64) *ChangeSetWriter
func (*ChangeSetWriter) CreateContract ¶
func (w *ChangeSetWriter) CreateContract(address libcommon.Address) error
func (*ChangeSetWriter) DeleteAccount ¶
func (*ChangeSetWriter) GetAccountChanges ¶
func (w *ChangeSetWriter) GetAccountChanges() (*historyv22.ChangeSet, error)
func (*ChangeSetWriter) GetStorageChanges ¶
func (w *ChangeSetWriter) GetStorageChanges() (*historyv22.ChangeSet, error)
func (*ChangeSetWriter) PrintChangedAccounts ¶
func (w *ChangeSetWriter) PrintChangedAccounts()
func (*ChangeSetWriter) UpdateAccountCode ¶
func (*ChangeSetWriter) UpdateAccountData ¶
func (*ChangeSetWriter) WriteAccountStorage ¶
func (*ChangeSetWriter) WriteChangeSets ¶
func (w *ChangeSetWriter) WriteChangeSets() error
func (*ChangeSetWriter) WriteHistory ¶
func (w *ChangeSetWriter) WriteHistory() error
type DbStateReader ¶
type DbStateReader struct {
// contains filtered or unexported fields
}
Implements StateReader by wrapping database only, without trie
func NewDbStateReader ¶
func NewDbStateReader(db kv.Getter) *DbStateReader
func (*DbStateReader) ReadAccountCode ¶
func (*DbStateReader) ReadAccountCodeSize ¶
func (*DbStateReader) ReadAccountData ¶
func (*DbStateReader) ReadAccountIncarnation ¶
func (dbr *DbStateReader) ReadAccountIncarnation(address libcommon.Address) (uint64, error)
func (*DbStateReader) ReadAccountStorage ¶
func (*DbStateReader) SetAccountCache ¶
func (dbr *DbStateReader) SetAccountCache(accountCache *fastcache.Cache)
func (*DbStateReader) SetCodeCache ¶
func (dbr *DbStateReader) SetCodeCache(codeCache *fastcache.Cache)
func (*DbStateReader) SetCodeSizeCache ¶
func (dbr *DbStateReader) SetCodeSizeCache(codeSizeCache *fastcache.Cache)
func (*DbStateReader) SetStorageCache ¶
func (dbr *DbStateReader) SetStorageCache(storageCache *fastcache.Cache)
type DbStateWriter ¶
type DbStateWriter struct {
// contains filtered or unexported fields
}
func NewDbStateWriter ¶
func NewDbStateWriter(db putDel, blockNr uint64) *DbStateWriter
func (*DbStateWriter) ChangeSetWriter ¶
func (dsw *DbStateWriter) ChangeSetWriter() *ChangeSetWriter
func (*DbStateWriter) CreateContract ¶
func (dsw *DbStateWriter) CreateContract(address libcommon.Address) error
func (*DbStateWriter) DeleteAccount ¶
func (*DbStateWriter) UpdateAccountCode ¶
func (*DbStateWriter) UpdateAccountData ¶
func (*DbStateWriter) WriteAccountStorage ¶
func (*DbStateWriter) WriteChangeSets ¶
func (dsw *DbStateWriter) WriteChangeSets() error
WriteChangeSets causes accumulated change sets to be written into the database (or batch) associated with the `dsw`
func (*DbStateWriter) WriteHistory ¶
func (dsw *DbStateWriter) WriteHistory() error
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 an 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 HistoryReaderInc ¶
type HistoryReaderInc struct {
// contains filtered or unexported fields
}
func NewHistoryReaderInc ¶
func NewHistoryReaderInc(as *libstate.AggregatorStep, rs *ReconState) *HistoryReaderInc
func (*HistoryReaderInc) ReadAccountCode ¶
func (*HistoryReaderInc) ReadAccountCodeSize ¶
func (*HistoryReaderInc) ReadAccountData ¶
func (*HistoryReaderInc) ReadAccountIncarnation ¶
func (hr *HistoryReaderInc) ReadAccountIncarnation(address libcommon.Address) (uint64, error)
func (*HistoryReaderInc) ReadAccountStorage ¶
func (*HistoryReaderInc) ReadError ¶
func (hr *HistoryReaderInc) ReadError() (uint64, bool)
func (*HistoryReaderInc) ResetError ¶
func (hr *HistoryReaderInc) ResetError()
func (*HistoryReaderInc) SetChainTx ¶
func (hr *HistoryReaderInc) SetChainTx(chainTx kv.Tx)
func (*HistoryReaderInc) SetTrace ¶
func (hr *HistoryReaderInc) SetTrace(trace bool)
func (*HistoryReaderInc) SetTx ¶
func (hr *HistoryReaderInc) SetTx(tx kv.Tx)
func (*HistoryReaderInc) SetTxNum ¶
func (hr *HistoryReaderInc) SetTxNum(txNum uint64)
type HistoryReaderV3 ¶
type HistoryReaderV3 struct {
// contains filtered or unexported fields
}
HistoryReaderV3 Implements StateReader and StateWriter
func NewHistoryReaderV3 ¶
func NewHistoryReaderV3() *HistoryReaderV3
func (*HistoryReaderV3) GetTxCount ¶
func (hr *HistoryReaderV3) GetTxCount() (uint64, error)
func (*HistoryReaderV3) ReadAccountCode ¶
func (*HistoryReaderV3) ReadAccountCodeSize ¶
func (*HistoryReaderV3) ReadAccountData ¶
func (*HistoryReaderV3) ReadAccountIncarnation ¶
func (hr *HistoryReaderV3) ReadAccountIncarnation(address libcommon.Address) (uint64, error)
func (*HistoryReaderV3) ReadAccountStorage ¶
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)
type HistoryReaderV4 ¶
type HistoryReaderV4 struct {
// contains filtered or unexported fields
}
HistoryReaderV4 Implements StateReader and StateWriter
func NewHistoryReaderV4 ¶
func NewHistoryReaderV4(ac *libstate.AggregatorContext, ri *libstate.ReadIndices) *HistoryReaderV4
func (*HistoryReaderV4) FinishTx ¶
func (hr *HistoryReaderV4) FinishTx() error
func (*HistoryReaderV4) ReadAccountCode ¶
func (*HistoryReaderV4) ReadAccountCodeSize ¶
func (*HistoryReaderV4) ReadAccountData ¶
func (*HistoryReaderV4) ReadAccountIncarnation ¶
func (hr *HistoryReaderV4) ReadAccountIncarnation(address libcommon.Address) (uint64, error)
func (*HistoryReaderV4) ReadAccountStorage ¶
func (*HistoryReaderV4) SetRwTx ¶
func (hr *HistoryReaderV4) SetRwTx(tx kv.RwTx)
func (*HistoryReaderV4) SetTrace ¶
func (hr *HistoryReaderV4) SetTrace(trace bool)
func (*HistoryReaderV4) SetTx ¶
func (hr *HistoryReaderV4) SetTx(tx kv.Tx)
func (*HistoryReaderV4) SetTxNum ¶
func (hr *HistoryReaderV4) SetTxNum(txNum uint64)
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)
AddAddressToAccessList adds the given address to the access list
func (*IntraBlockState) AddBalance ¶
func (sdb *IntraBlockState) AddBalance(addr libcommon.Address, amount *uint256.Int)
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)
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) GetIncarnation ¶
func (sdb *IntraBlockState) GetIncarnation(addr libcommon.Address) uint64
func (*IntraBlockState) GetLogs ¶
func (sdb *IntraBlockState) GetLogs(hash libcommon.Hash) []*types.Log
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) 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) GetTxCount ¶
func (sdb *IntraBlockState) GetTxCount() (uint64, error)
func (*IntraBlockState) HasSelfdestructed ¶
func (sdb *IntraBlockState) HasSelfdestructed(addr libcommon.Address) bool
func (*IntraBlockState) Logs ¶
func (sdb *IntraBlockState) Logs() []*types.Log
func (*IntraBlockState) MakeWriteSet ¶
func (sdb *IntraBlockState) MakeWriteSet(chainRules *chain.Rules, stateWriter StateWriter) error
func (*IntraBlockState) Prepare ¶
func (sdb *IntraBlockState) Prepare(thash, bhash libcommon.Hash, ti int)
Prepare sets the current transaction hash and index and block hash which is used when the EVM emits new state logs.
func (*IntraBlockState) PrepareAccessList ¶
func (sdb *IntraBlockState) PrepareAccessList(sender libcommon.Address, dst *libcommon.Address, precompiles []libcommon.Address, list types2.AccessList)
PrepareAccessList handles the preparatory steps for executing a state transition with regards to both EIP-2929 and EIP-2930:
- Add sender to access list (2929) - Add destination to access list (2929) - Add precompiles to access list (2929) - Add the contents of the optional tx access list (2930)
This method should only be called if Yolov3/Berlin/2929+2930 is applicable at the current number.
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) RevertToSnapshot ¶
func (sdb *IntraBlockState) RevertToSnapshot(revid int)
RevertToSnapshot reverts all state changes made since the given revision.
func (*IntraBlockState) ScalableSetSmtRootHash ¶
func (sdb *IntraBlockState) ScalableSetSmtRootHash(roHermezDb ReadOnlyHermezDb) error
func (*IntraBlockState) ScalableSetTxNum ¶
func (sdb *IntraBlockState) ScalableSetTxNum()
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) SetBalance ¶
func (sdb *IntraBlockState) SetBalance(addr libcommon.Address, amount *uint256.Int)
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) SlotInAccessList ¶
func (sdb *IntraBlockState) SlotInAccessList(addr libcommon.Address, slot libcommon.Hash) (addressPresent bool, slotPresent bool)
SlotInAccessList returns true if the given (address, slot)-tuple is in the access list.
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)
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) TxIndex ¶
func (sdb *IntraBlockState) TxIndex() 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 libcommon.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 PlainState ¶
type PlainState struct {
// contains filtered or unexported fields
}
State at the beginning of blockNr
func NewPlainState ¶
func NewPlainState(tx kv.Tx, blockNr uint64, systemContractLookup map[libcommon.Address][]libcommon.CodeRecord) *PlainState
func (*PlainState) CreateContract ¶
func (s *PlainState) CreateContract(address libcommon.Address) error
func (*PlainState) DeleteAccount ¶
func (*PlainState) ForEachStorage ¶
func (*PlainState) GetBlockNr ¶
func (s *PlainState) GetBlockNr() uint64
func (*PlainState) ReadAccountCode ¶
func (*PlainState) ReadAccountCodeSize ¶
func (*PlainState) ReadAccountData ¶
func (*PlainState) ReadAccountDataMaybeNil ¶
func (*PlainState) ReadAccountIncarnation ¶
func (s *PlainState) ReadAccountIncarnation(address libcommon.Address) (uint64, error)
func (*PlainState) ReadAccountStorage ¶
func (*PlainState) SetBlockNr ¶
func (s *PlainState) SetBlockNr(blockNr uint64)
func (*PlainState) SetTrace ¶
func (s *PlainState) SetTrace(trace bool)
func (*PlainState) UpdateAccountCode ¶
func (*PlainState) UpdateAccountData ¶
type PlainStateReader ¶
type PlainStateReader struct {
// contains filtered or unexported fields
}
PlainStateReader reads data from so called "plain state". Data in the plain state is stored using un-hashed account/storage items as opposed to the "normal" state that uses hashes of merkle paths to store items.
func NewPlainStateReader ¶
func NewPlainStateReader(db kv.Getter) *PlainStateReader
func (*PlainStateReader) GetTxCount ¶
func (r *PlainStateReader) GetTxCount() (uint64, error)
func (*PlainStateReader) ReadAccountCode ¶
func (*PlainStateReader) ReadAccountCodeSize ¶
func (*PlainStateReader) ReadAccountData ¶
func (*PlainStateReader) ReadAccountIncarnation ¶
func (r *PlainStateReader) ReadAccountIncarnation(address libcommon.Address) (uint64, error)
func (*PlainStateReader) ReadAccountStorage ¶
type PlainStateWriter ¶
type PlainStateWriter struct {
// contains filtered or unexported fields
}
func NewPlainStateWriter ¶
func NewPlainStateWriter(db putDel, changeSetsDB kv.RwTx, blockNumber uint64) *PlainStateWriter
func NewPlainStateWriterNoHistory ¶
func NewPlainStateWriterNoHistory(db putDel) *PlainStateWriter
func (*PlainStateWriter) ChangeSetWriter ¶
func (w *PlainStateWriter) ChangeSetWriter() *ChangeSetWriter
func (*PlainStateWriter) CreateContract ¶
func (w *PlainStateWriter) CreateContract(address libcommon.Address) error
func (*PlainStateWriter) DeleteAccount ¶
func (*PlainStateWriter) SetAccumulator ¶
func (w *PlainStateWriter) SetAccumulator(accumulator *shards.Accumulator) *PlainStateWriter
func (*PlainStateWriter) UpdateAccountCode ¶
func (*PlainStateWriter) UpdateAccountData ¶
func (*PlainStateWriter) WriteAccountStorage ¶
func (*PlainStateWriter) WriteChangeSets ¶
func (w *PlainStateWriter) WriteChangeSets() error
func (*PlainStateWriter) WriteHistory ¶
func (w *PlainStateWriter) WriteHistory() error
type ReadOnlyHermezDb ¶
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 *exec22.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 *exec22.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 *exec22.TxTask, dependency uint64)
type RequiredStateError ¶
type RequiredStateError struct {
StateTxNum uint64
}
func (*RequiredStateError) Error ¶
func (r *RequiredStateError) Error() string
type StateReader ¶
type StateReader interface { ReadAccountData(address libcommon.Address) (*accounts.Account, error) ReadAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash) ([]byte, error) ReadAccountCode(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash) ([]byte, error) ReadAccountCodeSize(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash) (int, error) ReadAccountIncarnation(address libcommon.Address) (uint64, error) }
type StateReaderIterator ¶
type StateReaderV3 ¶
type StateReaderV3 struct {
// contains filtered or unexported fields
}
func NewStateReaderV3 ¶
func NewStateReaderV3(rs *StateV3) *StateReaderV3
func (*StateReaderV3) DiscardReadList ¶
func (r *StateReaderV3) DiscardReadList()
func (*StateReaderV3) ReadAccountCode ¶
func (*StateReaderV3) ReadAccountCodeSize ¶
func (*StateReaderV3) ReadAccountData ¶
func (*StateReaderV3) ReadAccountIncarnation ¶
func (r *StateReaderV3) ReadAccountIncarnation(address common.Address) (uint64, error)
func (*StateReaderV3) ReadAccountStorage ¶
func (*StateReaderV3) ResetReadSet ¶
func (r *StateReaderV3) ResetReadSet()
func (*StateReaderV3) SetTrace ¶
func (r *StateReaderV3) SetTrace(trace bool)
func (*StateReaderV3) SetTx ¶
func (r *StateReaderV3) SetTx(tx kv.Tx)
func (*StateReaderV3) SetTxNum ¶
func (r *StateReaderV3) SetTxNum(txNum uint64)
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 (*StateV3) ApplyHistory ¶
func (*StateV3) ApplyState ¶
func (*StateV3) CommitTxNum ¶
func (*StateV3) ReadsValid ¶
func (*StateV3) SizeEstimate ¶
type StateWriter ¶
type StateWriter interface { UpdateAccountData(address libcommon.Address, original, account *accounts.Account) error UpdateAccountCode(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash, code []byte) error DeleteAccount(address libcommon.Address, original *accounts.Account) error WriteAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash, original, value *uint256.Int) error CreateContract(address libcommon.Address) error }
type StateWriterV3 ¶
type StateWriterV3 struct {
// contains filtered or unexported fields
}
func NewStateWriterV3 ¶
func NewStateWriterV3(rs *StateV3) *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) SetTxNum ¶
func (w *StateWriterV3) SetTxNum(txNum uint64)
func (*StateWriterV3) UpdateAccountCode ¶
func (*StateWriterV3) UpdateAccountData ¶
func (*StateWriterV3) WriteAccountStorage ¶
type TxCountReader ¶
type WriterWithChangeSets ¶
type WriterWithChangeSets interface { StateWriter WriteChangeSets() error WriteHistory() error }
Source Files ¶
- access_list.go
- cached_reader.go
- cached_reader2.go
- cached_writer.go
- change_set_writer.go
- database.go
- db_state_reader.go
- db_state_writer.go
- dump.go
- helper.go
- history_reader_inc.go
- history_reader_v3.go
- history_reader_v4.go
- history_walk.go
- intra_block_state.go
- journal.go
- plain_readonly.go
- plain_state_reader.go
- plain_state_writer.go
- recon_state.go
- recon_writer_inc.go
- rw_v3.go
- state_object.go