state

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2025 License: GPL-3.0, LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDatabase

func NewDatabase(db ethdb.Database) ethstate.Database

func NewDatabaseWithConfig

func NewDatabaseWithConfig(db ethdb.Database, config *triedb.Config) ethstate.Database

func NewDatabaseWithNodeDB added in v0.5.3

func NewDatabaseWithNodeDB(db ethdb.Database, triedb *triedb.Database) ethstate.Database

func WithConcurrentWorkers added in v0.7.1

func WithConcurrentWorkers(prefetchers int) ethstate.PrefetcherOption

Types

type Database

type Database = ethstate.Database

type Dump

type Dump = ethstate.Dump

type DumpAccount

type DumpAccount = ethstate.DumpAccount

type DumpCollector

type DumpCollector = ethstate.DumpCollector

type DumpConfig

type DumpConfig = ethstate.DumpConfig

type StateDB

type StateDB struct {
	*ethstate.StateDB
	// contains filtered or unexported fields
}

StateDB structs within the ethereum protocol are used to store anything within the merkle trie. StateDBs take care of caching and storing nested states. It's the general query interface to retrieve:

* Contracts * Accounts

Once the state is committed, tries cached in stateDB (including account trie, storage tries) will no longer be functional. A new state instance must be created with new root and updated database for accessing post- commit states.

func New

func New(root common.Hash, db Database, snaps ethstate.SnapshotTree) (*StateDB, error)

New creates a new state from a given trie.

func (*StateDB) Copy

func (s *StateDB) Copy() *StateDB

func (*StateDB) GetState

func (s *StateDB) GetState(addr common.Address, hash common.Hash) common.Hash

GetState retrieves a value from the given account's storage trie.

func (*StateDB) GetTxHash added in v0.5.6

func (s *StateDB) GetTxHash() common.Hash

GetTxHash returns the current tx hash on the StateDB set by SetTxContext.

func (*StateDB) SetState

func (s *StateDB) SetState(addr common.Address, key, value common.Hash)

func (*StateDB) SetTxContext added in v0.5.3

func (s *StateDB) SetTxContext(thash common.Hash, ti int)

SetTxContext sets the current transaction hash and index which are used when the EVM emits new state logs. It should be invoked before transaction execution.

type Trie

type Trie = ethstate.Trie

Directories

Path Synopsis
Package snapshot implements a journalled, dynamic state dump.
Package snapshot implements a journalled, dynamic state dump.

Jump to

Keyboard shortcuts

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