state

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2024 License: GPL-3.0 Imports: 32 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package state provides a caching layer atop the Ethereum state trie.

Index

Constants

View Source
const (
	//FirstContractIncarnation - first incarnation for contract accounts. After 1 it increases by 1.
	FirstContractIncarnation = 1
	//NonContractIncarnation incarnation for non contracts
	NonContractIncarnation = 0
)

Variables

View Source
var SystemAddress = types.HexToAddress("0xfffffffffffffffffffffffffffffffffffffffe")

SystemAddress - sender address for internal state updates.

Functions

func EncodeBeforeState

func EncodeBeforeState(w io.Writer, list Items, codeHash HashCodes)

func FindByHistory

func FindByHistory(tx kv.Tx, indexC kv.Cursor, changesC kv.CursorDupSort, storage bool, key []byte, timestamp uint64) ([]byte, error)

func GetAsOf

func GetAsOf(tx kv.Tx, indexC kv.Cursor, changesC kv.CursorDupSort, storage bool, key []byte, timestamp uint64) ([]byte, error)

func WalkAsOfAccounts

func WalkAsOfAccounts(tx kv.Tx, startAddress types.Address, timestamp uint64, walker func(k []byte, v []byte) (bool, error)) error

func WalkAsOfStorage

func WalkAsOfStorage(tx kv.Tx, address types.Address, incarnation uint16, startLocation types.Hash, timestamp uint64, walker func(k1, k2, v []byte) (bool, error)) error

startKey is the concatenation of address and incarnation (BigEndian 8 byte)

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 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 types.Address) error

func (*ChangeSetWriter) DeleteAccount

func (w *ChangeSetWriter) DeleteAccount(address types.Address, original *account.StateAccount) error

func (*ChangeSetWriter) GetAccountChanges

func (w *ChangeSetWriter) GetAccountChanges() (*changeset.ChangeSet, error)

func (*ChangeSetWriter) GetStorageChanges

func (w *ChangeSetWriter) GetStorageChanges() (*changeset.ChangeSet, error)

func (*ChangeSetWriter) PrintChangedAccounts

func (w *ChangeSetWriter) PrintChangedAccounts()

func (*ChangeSetWriter) UpdateAccountCode

func (w *ChangeSetWriter) UpdateAccountCode(address types.Address, incarnation uint16, codeHash types.Hash, code []byte) error

func (*ChangeSetWriter) UpdateAccountData

func (w *ChangeSetWriter) UpdateAccountData(address types.Address, original, account *account.StateAccount) error

func (*ChangeSetWriter) WriteAccountStorage

func (w *ChangeSetWriter) WriteAccountStorage(address types.Address, incarnation uint16, key *types.Hash, original, value *uint256.Int) error

func (*ChangeSetWriter) WriteChangeSets

func (w *ChangeSetWriter) WriteChangeSets() error

func (*ChangeSetWriter) WriteHistory

func (w *ChangeSetWriter) WriteHistory() error

type Code

type Code []byte

func (Code) String

func (c Code) String() string

type Entire

type Entire struct {
	Header       *block.Header    `json:"header"`
	Uncles       []*types2.Header `json:"uncles"`
	Transactions [][]byte         `json:"transactions"`
	Snap         *Snapshot        `json:"snap"`
	Proof        types.Hash       `json:"proof"`
	Senders      []types.Address  `json:"senders"`
}

func (Entire) Clone

func (e Entire) Clone() Entire

type EntireCode

type EntireCode struct {
	CoinBase types.Address   `json:"coinBase"`
	Entire   Entire          `json:"entire"`
	Codes    []*HashCode     `json:"codes"`
	Headers  []*block.Header `json:"headers"`
	Rewards  []*block.Reward `json:"rewards"`
}

type GetOneFun

type GetOneFun func(table string, key []byte) ([]byte, error)

type HashCode

type HashCode struct {
	Hash types.Hash `json:"hash"`
	Code []byte     `json:"code"`
}

type HashCodes

type HashCodes []*HashCode

func (HashCodes) Len

func (s HashCodes) Len() int

func (HashCodes) Less

func (s HashCodes) Less(i, j int) bool

func (HashCodes) Swap

func (s HashCodes) Swap(i, j int)

type HistoryStateReader

type HistoryStateReader struct {
	// contains filtered or unexported fields
}

func NewStateHistoryReader

func NewStateHistoryReader(tx kv.Tx, db kv.Getter, blockNr uint64) *HistoryStateReader

func (*HistoryStateReader) GetOne

func (dbr *HistoryStateReader) GetOne(bucket string, key []byte) ([]byte, error)

func (*HistoryStateReader) ReadAccountCode

func (r *HistoryStateReader) ReadAccountCode(address types.Address, incarnation uint16, codeHash types.Hash) ([]byte, error)

func (*HistoryStateReader) ReadAccountCodeSize

func (r *HistoryStateReader) ReadAccountCodeSize(address types.Address, incarnation uint16, codeHash types.Hash) (int, error)

func (*HistoryStateReader) ReadAccountData

func (r *HistoryStateReader) ReadAccountData(address types.Address) (*account.StateAccount, error)

func (*HistoryStateReader) ReadAccountIncarnation

func (r *HistoryStateReader) ReadAccountIncarnation(address types.Address) (uint16, error)

func (*HistoryStateReader) ReadAccountStorage

func (r *HistoryStateReader) ReadAccountStorage(address types.Address, incarnation uint16, key *types.Hash) ([]byte, error)

func (*HistoryStateReader) Rollback

func (dbr *HistoryStateReader) Rollback()

func (*HistoryStateReader) SetBlockNumber

func (dbr *HistoryStateReader) SetBlockNumber(blockNr 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 New

func New(stateReader StateReader) *IntraBlockState

Create a new state from a given trie

func (*IntraBlockState) AddAddressToAccessList

func (sdb *IntraBlockState) AddAddressToAccessList(addr types.Address)

AddAddressToAccessList adds the given address to the access list

func (*IntraBlockState) AddBalance

func (sdb *IntraBlockState) AddBalance(addr types.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 *block.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 types.Address, slot types.Hash)

AddSlotToAccessList adds the given (address, slot)-tuple to the access list

func (*IntraBlockState) AddressInAccessList

func (sdb *IntraBlockState) AddressInAccessList(addr types.Address) bool

AddressInAccessList returns true if the given address is in the access list.

func (*IntraBlockState) BalanceIncreaseSet

func (sdb *IntraBlockState) BalanceIncreaseSet() map[types.Address]uint256.Int

func (*IntraBlockState) BeforeStateRoot

func (sdb *IntraBlockState) BeforeStateRoot() (hash types.Hash)

BeforeStateRoot calculate used state hash

it should be invoked after all txs exec

func (*IntraBlockState) BeginWriteCodes

func (sdb *IntraBlockState) BeginWriteCodes()

func (*IntraBlockState) BeginWriteSnapshot

func (sdb *IntraBlockState) BeginWriteSnapshot()

func (*IntraBlockState) CodeHashes

func (sdb *IntraBlockState) CodeHashes() map[types.Hash][]byte

func (*IntraBlockState) CommitBlock

func (sdb *IntraBlockState) CommitBlock(chainRules *params.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 types.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:

  1. sends funds to sha(account ++ (nonce + 1))
  2. tx_create(sha(account ++ nonce)) (note that this gets the address of 1)

Carrying over the balance ensures that AMT doesn't disappear.

func (*IntraBlockState) Empty

func (sdb *IntraBlockState) Empty(addr types.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 types.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 *params.Rules, stateWriter StateWriter) error

FinalizeTx should be called after every transaction.

func (*IntraBlockState) GenerateRootHash

func (s *IntraBlockState) GenerateRootHash() types.Hash

GenerateRootHash calculate root hash

func (*IntraBlockState) GetBalance

func (sdb *IntraBlockState) GetBalance(addr types.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 types.Address) []byte

DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account

func (*IntraBlockState) GetCodeHash

func (sdb *IntraBlockState) GetCodeHash(addr types.Address) types.Hash

DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account

func (*IntraBlockState) GetCodeSize

func (sdb *IntraBlockState) GetCodeSize(addr types.Address) int

DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account

func (*IntraBlockState) GetCommittedState

func (sdb *IntraBlockState) GetCommittedState(addr types.Address, key *types.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 types.Address) uint16

func (*IntraBlockState) GetLogs

func (sdb *IntraBlockState) GetLogs(hash types.Hash) []*block.Log

func (*IntraBlockState) GetNonce

func (sdb *IntraBlockState) GetNonce(addr types.Address) uint64

DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account

func (*IntraBlockState) GetOrNewStateObject

func (sdb *IntraBlockState) GetOrNewStateObject(addr types.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 types.Address, key *types.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) GetStateReader

func (sdb *IntraBlockState) GetStateReader() StateReader

func (*IntraBlockState) HasSelfdestructed

func (sdb *IntraBlockState) HasSelfdestructed(addr types.Address) bool

func (*IntraBlockState) HasSuicided

func (sdb *IntraBlockState) HasSuicided(addr types.Address) bool

func (*IntraBlockState) IntermediateRoot

func (s *IntraBlockState) IntermediateRoot() types.Hash

IntermediateRoot root

func (*IntraBlockState) Logs

func (sdb *IntraBlockState) Logs() []*block.Log

func (*IntraBlockState) MakeWriteSet

func (sdb *IntraBlockState) MakeWriteSet(chainRules *params.Rules, stateWriter StateWriter) error

func (*IntraBlockState) Prepare

func (sdb *IntraBlockState) Prepare(thash, bhash types.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 types.Address, dst *types.Address, precompiles []types.Address, list transaction.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) PrepareReadableSnapshot

func (sdb *IntraBlockState) PrepareReadableSnapshot(data []byte) error

func (*IntraBlockState) Print

func (sdb *IntraBlockState) Print()

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) Selfdestruct

func (sdb *IntraBlockState) Selfdestruct(addr types.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 types.Address, amount *uint256.Int)

DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account

func (*IntraBlockState) SetCode

func (sdb *IntraBlockState) SetCode(addr types.Address, code []byte)

DESCRIBED: docs/programmers_guide/guide.md#code-hash DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account

func (*IntraBlockState) SetGetOneFun

func (s *IntraBlockState) SetGetOneFun(f1 GetOneFun)

func (*IntraBlockState) SetHeight

func (sdb *IntraBlockState) SetHeight(height uint64)

func (*IntraBlockState) SetIncarnation

func (sdb *IntraBlockState) SetIncarnation(addr types.Address, incarnation uint16)

SetIncarnation sets incarnation for account if account exists

func (*IntraBlockState) SetNonce

func (sdb *IntraBlockState) SetNonce(addr types.Address, nonce uint64)

DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account

func (*IntraBlockState) SetOutHash

func (sdb *IntraBlockState) SetOutHash(hash types.Hash)

func (*IntraBlockState) SetSnapshot

func (sdb *IntraBlockState) SetSnapshot(snap *Snapshot)

func (*IntraBlockState) SetState

func (sdb *IntraBlockState) SetState(addr types.Address, key *types.Hash, value uint256.Int)

DESCRIBED: docs/programmers_guide/guide.md#address---identifier-of-an-account

func (*IntraBlockState) SetStateReader

func (sdb *IntraBlockState) SetStateReader(reader StateReader)

func (*IntraBlockState) SetStorage

func (sdb *IntraBlockState) SetStorage(addr types.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) SetTracer

func (sdb *IntraBlockState) SetTracer(tracer StateTracer)

func (*IntraBlockState) SlotInAccessList

func (sdb *IntraBlockState) SlotInAccessList(addr types.Address, slot types.Hash) (addressPresent bool, slotPresent bool)

SlotInAccessList returns true if the given (address, slot)-tuple is in the access list.

func (*IntraBlockState) Snap

func (sdb *IntraBlockState) Snap() *Snapshot

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 types.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) Suicide

func (sdb *IntraBlockState) Suicide(addr types.Address) bool

Suicide 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) TxIndex

func (sdb *IntraBlockState) TxIndex() int

TxIndex returns the current transaction index set by Prepare.

func (*IntraBlockState) WrittenSnapshot

func (sdb *IntraBlockState) WrittenSnapshot(hash types.Hash) []byte

type Item

type Item struct {
	Key   []byte `json:"key"`
	Value []byte `json:"value"`
}

type Items

type Items []*Item

func (Items) Len

func (s Items) Len() int

func (Items) Less

func (s Items) Less(i, j int) bool

func (Items) Swap

func (s Items) Swap(i, j int)

type NoopWriter

type NoopWriter struct {
}

func NewNoopWriter

func NewNoopWriter() *NoopWriter

func (*NoopWriter) CreateContract

func (nw *NoopWriter) CreateContract(address types.Address) error

func (*NoopWriter) DeleteAccount

func (nw *NoopWriter) DeleteAccount(address types.Address, original *account.StateAccount) error

func (*NoopWriter) UpdateAccountCode

func (nw *NoopWriter) UpdateAccountCode(address types.Address, incarnation uint16, codeHash types.Hash, code []byte) error

func (*NoopWriter) UpdateAccountData

func (nw *NoopWriter) UpdateAccountData(address types.Address, original, account *account.StateAccount) error

func (*NoopWriter) WriteAccountStorage

func (nw *NoopWriter) WriteAccountStorage(address types.Address, incarnation uint16, key *types.Hash, original, value *uint256.Int) error

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) *PlainState

func (*PlainState) CreateContract

func (s *PlainState) CreateContract(address types.Address) error

func (*PlainState) DeleteAccount

func (s *PlainState) DeleteAccount(address types.Address, original *account.StateAccount) error

func (*PlainState) ForEachStorage

func (s *PlainState) ForEachStorage(addr types.Address, startLocation types.Hash, cb func(key, seckey types.Hash, value uint256.Int) bool, maxResults int) error

func (*PlainState) GetBlockNr

func (s *PlainState) GetBlockNr() uint64

func (*PlainState) ReadAccountCode

func (s *PlainState) ReadAccountCode(address types.Address, incarnation uint16, codeHash types.Hash) ([]byte, error)

func (*PlainState) ReadAccountCodeSize

func (s *PlainState) ReadAccountCodeSize(address types.Address, incarnation uint16, codeHash types.Hash) (int, error)

func (*PlainState) ReadAccountData

func (s *PlainState) ReadAccountData(address types.Address) (*account.StateAccount, error)

func (*PlainState) ReadAccountIncarnation

func (s *PlainState) ReadAccountIncarnation(address types.Address) (uint16, error)

func (*PlainState) ReadAccountStorage

func (s *PlainState) ReadAccountStorage(address types.Address, incarnation uint16, key *types.Hash) ([]byte, error)

func (*PlainState) SetBlockNr

func (s *PlainState) SetBlockNr(blockNr uint64)

func (*PlainState) SetTrace

func (s *PlainState) SetTrace(trace bool)

func (*PlainState) UpdateAccountCode

func (s *PlainState) UpdateAccountCode(address types.Address, incarnation uint16, codeHash types.Hash, code []byte) error

func (*PlainState) UpdateAccountData

func (s *PlainState) UpdateAccountData(address types.Address, original, account *account.StateAccount) error

func (*PlainState) WriteAccountStorage

func (s *PlainState) WriteAccountStorage(address types.Address, incarnation uint16, key *types.Hash, original, value *uint256.Int) error

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) ReadAccountCode

func (r *PlainStateReader) ReadAccountCode(address types.Address, incarnation uint16, codeHash types.Hash) ([]byte, error)

func (*PlainStateReader) ReadAccountCodeSize

func (r *PlainStateReader) ReadAccountCodeSize(address types.Address, incarnation uint16, codeHash types.Hash) (int, error)

func (*PlainStateReader) ReadAccountData

func (r *PlainStateReader) ReadAccountData(address types.Address) (*account.StateAccount, error)

func (*PlainStateReader) ReadAccountIncarnation

func (r *PlainStateReader) ReadAccountIncarnation(address types.Address) (uint16, error)

func (*PlainStateReader) ReadAccountStorage

func (r *PlainStateReader) ReadAccountStorage(address types.Address, incarnation uint16, key *types.Hash) ([]byte, error)

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 types.Address) error

func (*PlainStateWriter) DeleteAccount

func (w *PlainStateWriter) DeleteAccount(address types.Address, original *account.StateAccount) error

func (*PlainStateWriter) UpdateAccountCode

func (w *PlainStateWriter) UpdateAccountCode(address types.Address, incarnation uint16, codeHash types.Hash, code []byte) error

func (*PlainStateWriter) UpdateAccountData

func (w *PlainStateWriter) UpdateAccountData(address types.Address, original, account *account.StateAccount) error

func (*PlainStateWriter) WriteAccountStorage

func (w *PlainStateWriter) WriteAccountStorage(address types.Address, incarnation uint16, key *types.Hash, original, value *uint256.Int) error

func (*PlainStateWriter) WriteChangeSets

func (w *PlainStateWriter) WriteChangeSets() error

func (*PlainStateWriter) WriteHistory

func (w *PlainStateWriter) WriteHistory() error

type Snapshot

type Snapshot struct {
	Items   Items      `json:"items"`
	OutHash types.Hash `json:"outHash"`
	// contains filtered or unexported fields
}

func NewReadableSnapshot

func NewReadableSnapshot() *Snapshot

func NewWritableSnapshot

func NewWritableSnapshot() *Snapshot

func ReadSnapshotData

func ReadSnapshotData(data []byte) (*Snapshot, error)

func (*Snapshot) AddAccount

func (s *Snapshot) AddAccount(address types.Address, account *account.StateAccount)

func (*Snapshot) AddStorage

func (s *Snapshot) AddStorage(address types.Address, key *types.Hash, incarnation uint16, value []byte)

func (*Snapshot) CanWrite

func (s *Snapshot) CanWrite() bool

func (*Snapshot) ReadAccountData

func (s *Snapshot) ReadAccountData(address types.Address) (*account.StateAccount, error)

func (*Snapshot) ReadAccountStorage

func (s *Snapshot) ReadAccountStorage(address types.Address, incarnation uint16, key *types.Hash) ([]byte, error)

func (*Snapshot) SetGetFun

func (s *Snapshot) SetGetFun(f GetOneFun)

func (*Snapshot) SetHash

func (s *Snapshot) SetHash(hash types.Hash)

type StateReader

type StateReader interface {
	ReadAccountData(address types.Address) (*account.StateAccount, error)
	ReadAccountStorage(address types.Address, incarnation uint16, key *types.Hash) ([]byte, error)
	ReadAccountCode(address types.Address, incarnation uint16, codeHash types.Hash) ([]byte, error)
	ReadAccountCodeSize(address types.Address, incarnation uint16, codeHash types.Hash) (int, error)
	ReadAccountIncarnation(address types.Address) (uint16, error)
}

type StateTracer

type StateTracer interface {
	CaptureAccountRead(account types.Address) error
	CaptureAccountWrite(account types.Address) error
}

type StateWriter

type StateWriter interface {
	UpdateAccountData(address types.Address, original, account *account.StateAccount) error
	UpdateAccountCode(address types.Address, incarnation uint16, codeHash types.Hash, code []byte) error
	DeleteAccount(address types.Address, original *account.StateAccount) error
	WriteAccountStorage(address types.Address, incarnation uint16, key *types.Hash, original, value *uint256.Int) error
	CreateContract(address types.Address) error
}

type Storage

type Storage map[types.Hash]uint256.Int

func (Storage) Copy

func (s Storage) Copy() Storage

func (Storage) String

func (s Storage) String() (str string)

type WriterWithChangeSets

type WriterWithChangeSets interface {
	StateWriter
	WriteChangeSets() error
	WriteHistory() error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL