extstate

package
v0.15.63 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2025 License: GPL-3.0, LGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDatabase

func NewDatabase(tdb *triedb.Database, snap *corethsnap.Tree) state.Database

NewDatabase creates a new state database using the standard geth API. The coreth snapshot.Tree is not directly compatible with geth's snapshot.Tree, so we pass nil and let the state package handle it.

func NewDatabaseWithConfig

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

NewDatabaseWithConfig creates a new state database with the given triedb config.

func NewDatabaseWithNodeDB

func NewDatabaseWithNodeDB(db ethdb.Database, tdb *triedb.Database) state.Database

NewDatabaseWithNodeDB creates a new state database with an existing triedb.

Types

type StateDB

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

func New

func New(vm *state.StateDB) *StateDB

New creates a new StateDB with the given state.StateDB, wrapping it with additional functionality.

func (*StateDB) AddBalance

func (s *StateDB) AddBalance(addr common.Address, amount *uint256.Int, reason tracing.BalanceChangeReason) uint256.Int

AddBalance wraps the underlying StateDB's AddBalance.

func (*StateDB) AddBalanceMultiCoin

func (s *StateDB) AddBalanceMultiCoin(addr common.Address, coinID common.Hash, amount *big.Int)

AddBalanceMultiCoin adds amount to the account associated with addr.

func (*StateDB) AddBalanceSimple

func (s *StateDB) AddBalanceSimple(addr common.Address, amount *uint256.Int)

AddBalanceSimple adds balance without returning the result.

func (*StateDB) GetBalanceMultiCoin

func (s *StateDB) GetBalanceMultiCoin(addr common.Address, coinID common.Hash) *big.Int

Retrieve the balance from the given address or 0 if object not found

func (*StateDB) GetPredicateStorageSlots

func (s *StateDB) GetPredicateStorageSlots(address common.Address, index int) ([]byte, bool)

GetPredicateStorageSlots returns the storage slots associated with the address, index pair. A list of access tuples can be included within transaction types post EIP-2930. The address is declared directly on the access tuple and the index is the i'th occurrence of an access tuple with the specified address.

Ex. AccessList[[AddrA, Predicate1], [AddrB, Predicate2], [AddrA, Predicate3]] In this case, the caller could retrieve predicates 1-3 with the following calls: GetPredicateStorageSlots(AddrA, 0) -> Predicate1 GetPredicateStorageSlots(AddrB, 0) -> Predicate2 GetPredicateStorageSlots(AddrA, 1) -> Predicate3

func (*StateDB) GetStateWithOptions

func (s *StateDB) GetStateWithOptions(addr common.Address, hash common.Hash, _ ...stateconf.StateDBStateOption) common.Hash

GetStateWithOptions wraps GetState accepting optional stateconf options for compatibility with the contract.StateDB interface.

func (*StateDB) Prepare

func (s *StateDB) Prepare(rules params.Rules, sender, coinbase common.Address, dst *common.Address, precompiles []common.Address, list types.AccessList)

func (*StateDB) SetCode

func (s *StateDB) SetCode(addr common.Address, code []byte, reason tracing.CodeChangeReason) []byte

SetCode wraps the underlying StateDB's SetCode.

func (*StateDB) SetNonce

func (s *StateDB) SetNonce(addr common.Address, nonce uint64, reason tracing.NonceChangeReason)

SetNonce wraps the underlying StateDB's SetNonce.

func (*StateDB) SetNonceSimple

func (s *StateDB) SetNonceSimple(addr common.Address, nonce uint64)

SetNonceSimple sets nonce without specifying a reason.

func (*StateDB) SetState

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

SetState wraps the underlying StateDB's SetState.

func (*StateDB) SetStateWithOptions

func (s *StateDB) SetStateWithOptions(addr common.Address, key, value common.Hash, _ ...stateconf.StateDBStateOption)

SetStateWithOptions wraps SetState accepting optional stateconf options for compatibility with the contract.StateDB interface.

func (*StateDB) SubBalance

func (s *StateDB) SubBalance(addr common.Address, amount *uint256.Int, reason tracing.BalanceChangeReason) uint256.Int

SubBalance wraps the underlying StateDB's SubBalance.

func (*StateDB) SubBalanceMultiCoin

func (s *StateDB) SubBalanceMultiCoin(addr common.Address, coinID common.Hash, amount *big.Int)

SubBalance subtracts amount from the account associated with addr.

func (*StateDB) TxHash

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

TxHash returns the current transaction hash. This is required by contract.StateDB interface.

type WorkerPool

type WorkerPool struct {
	*utils.BoundedWorkers
}

WorkerPool is a bounded worker pool for concurrent operations.

func NewWorkerPool

func NewWorkerPool(workers int) *WorkerPool

NewWorkerPool creates a new worker pool with the specified number of workers.

func (*WorkerPool) Done

func (wp *WorkerPool) Done()

Done waits for all workers to finish.

Jump to

Keyboard shortcuts

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