pending_state

package
v0.0.0-...-2740610 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAddressConflict

func IsAddressConflict(a1, a2 map[common.Address]VisitTxnID) bool

func IsStateConflict

func IsStateConflict(a1, a2 map[common.Address]map[common.Hash]VisitTxnID) bool

Types

type PendingStateWrapper

type PendingStateWrapper struct {
	TxnID int64
	// contains filtered or unexported fields
}

func NewPendingStateWrapper

func NewPendingStateWrapper(statedb *StateDBWrapper, sctx *StateContext, TxnID int64) *PendingStateWrapper

func (*PendingStateWrapper) AddAddressToAccessList

func (psw *PendingStateWrapper) AddAddressToAccessList(addr common.Address)

func (*PendingStateWrapper) AddBalance

func (psw *PendingStateWrapper) AddBalance(address common.Address, u *uint256.Int, reason tracing.BalanceChangeReason)

func (*PendingStateWrapper) AddLog

func (psw *PendingStateWrapper) AddLog(log *types.Log)

func (*PendingStateWrapper) AddPreimage

func (psw *PendingStateWrapper) AddPreimage(hash common.Hash, bytes []byte)

func (*PendingStateWrapper) AddRefund

func (psw *PendingStateWrapper) AddRefund(u uint64)

func (*PendingStateWrapper) AddSlotToAccessList

func (psw *PendingStateWrapper) AddSlotToAccessList(addr common.Address, slot common.Hash)

func (*PendingStateWrapper) AddressInAccessList

func (psw *PendingStateWrapper) AddressInAccessList(addr common.Address) bool

func (*PendingStateWrapper) AllLogs

func (psw *PendingStateWrapper) AllLogs() []*types.Log

func (*PendingStateWrapper) CreateAccount

func (psw *PendingStateWrapper) CreateAccount(address common.Address)

func (*PendingStateWrapper) Empty

func (psw *PendingStateWrapper) Empty(address common.Address) bool

func (*PendingStateWrapper) Exist

func (psw *PendingStateWrapper) Exist(address common.Address) bool

func (*PendingStateWrapper) GetBalance

func (psw *PendingStateWrapper) GetBalance(address common.Address) *uint256.Int

func (*PendingStateWrapper) GetCode

func (psw *PendingStateWrapper) GetCode(address common.Address) []byte

func (*PendingStateWrapper) GetCodeHash

func (psw *PendingStateWrapper) GetCodeHash(address common.Address) common.Hash

func (*PendingStateWrapper) GetCodeSize

func (psw *PendingStateWrapper) GetCodeSize(address common.Address) int

func (*PendingStateWrapper) GetCommittedState

func (psw *PendingStateWrapper) GetCommittedState(address common.Address, hash common.Hash) common.Hash

func (*PendingStateWrapper) GetCtx

func (psw *PendingStateWrapper) GetCtx() *StateContext

func (*PendingStateWrapper) GetNonce

func (psw *PendingStateWrapper) GetNonce(address common.Address) uint64

func (*PendingStateWrapper) GetRefund

func (psw *PendingStateWrapper) GetRefund() uint64

func (*PendingStateWrapper) GetState

func (psw *PendingStateWrapper) GetState(address common.Address, hash common.Hash) common.Hash

func (*PendingStateWrapper) GetStateDB

func (psw *PendingStateWrapper) GetStateDB() *state.StateDB

func (*PendingStateWrapper) GetStorageRoot

func (psw *PendingStateWrapper) GetStorageRoot(addr common.Address) common.Hash

func (*PendingStateWrapper) GetTransientState

func (psw *PendingStateWrapper) GetTransientState(addr common.Address, key common.Hash) common.Hash

func (*PendingStateWrapper) HasSelfDestructed

func (psw *PendingStateWrapper) HasSelfDestructed(address common.Address) bool

func (*PendingStateWrapper) MergeInto

func (psw *PendingStateWrapper) MergeInto(stateDB *state.StateDB, sender common.Address)

func (*PendingStateWrapper) Prepare

func (psw *PendingStateWrapper) Prepare(rules params.Rules, sender, coinbase common.Address, dest *common.Address, precompiles []common.Address, txAccesses types.AccessList)

func (*PendingStateWrapper) RevertToSnapshot

func (psw *PendingStateWrapper) RevertToSnapshot(i int)

func (*PendingStateWrapper) SelfDestruct

func (psw *PendingStateWrapper) SelfDestruct(address common.Address)

func (*PendingStateWrapper) Selfdestruct6780

func (psw *PendingStateWrapper) Selfdestruct6780(address common.Address)

func (*PendingStateWrapper) SetCode

func (psw *PendingStateWrapper) SetCode(address common.Address, bytes []byte)

func (*PendingStateWrapper) SetNonce

func (psw *PendingStateWrapper) SetNonce(address common.Address, u uint64)

func (*PendingStateWrapper) SetState

func (psw *PendingStateWrapper) SetState(address common.Address, hash common.Hash, hash2 common.Hash)

func (*PendingStateWrapper) SetTransientState

func (psw *PendingStateWrapper) SetTransientState(addr common.Address, key, value common.Hash)

func (*PendingStateWrapper) SetTxContext

func (psw *PendingStateWrapper) SetTxContext(txHash common.Hash, txIndex int)

func (*PendingStateWrapper) SlotInAccessList

func (psw *PendingStateWrapper) SlotInAccessList(addr common.Address, slot common.Hash) (addressOk bool, slotOk bool)

func (*PendingStateWrapper) Snapshot

func (psw *PendingStateWrapper) Snapshot() int

func (*PendingStateWrapper) SubBalance

func (psw *PendingStateWrapper) SubBalance(address common.Address, u *uint256.Int, reason tracing.BalanceChangeReason)

func (*PendingStateWrapper) SubRefund

func (psw *PendingStateWrapper) SubRefund(u uint64)

type StateContext

type StateContext struct {
	sync.RWMutex

	Read  *VisitedAddress
	Write *VisitedAddress
	// contains filtered or unexported fields
}

func NewStateContext

func NewStateContext(needCheck bool) *StateContext

func (*StateContext) AddAddressToList

func (sctx *StateContext) AddAddressToList(address common.Address)

func (*StateContext) AddSlot2Address

func (sctx *StateContext) AddSlot2Address(slot slotToAddress)

func (*StateContext) GetReadAddress

func (sctx *StateContext) GetReadAddress() map[common.Address]VisitTxnID

func (*StateContext) GetReadState

func (sctx *StateContext) GetReadState() map[common.Address]map[common.Hash]VisitTxnID

func (*StateContext) GetWriteAddress

func (sctx *StateContext) GetWriteAddress() map[common.Address]VisitTxnID

func (*StateContext) GetWriteState

func (sctx *StateContext) GetWriteState() map[common.Address]map[common.Hash]VisitTxnID

func (*StateContext) IsConflict

func (sctx *StateContext) IsConflict(tar *StateContext) bool

func (*StateContext) ReadAddress

func (sctx *StateContext) ReadAddress() map[common.Address]VisitTxnID

func (*StateContext) ReadBalance

func (sctx *StateContext) ReadBalance(addr common.Address, txnID int64) error

func (*StateContext) ReadCode

func (sctx *StateContext) ReadCode(addr common.Address, txnID int64) error

func (*StateContext) ReadConflict

func (sctx *StateContext) ReadConflict(addr common.Address, txnID int64) bool

func (*StateContext) ReadState

func (sctx *StateContext) ReadState(addr common.Address, key common.Hash, txnID int64) error

func (*StateContext) SelfDestruct

func (sctx *StateContext) SelfDestruct(addr common.Address, txnID int64) error

func (*StateContext) SetPrepare

func (sctx *StateContext) SetPrepare(rules params.Rules, sender, coinbase common.Address, dest *common.Address, precompiles []common.Address, txAccesses types.AccessList)

func (*StateContext) WriteAccount

func (sctx *StateContext) WriteAccount(addr common.Address, txnID int64) error

func (*StateContext) WriteBalance

func (sctx *StateContext) WriteBalance(addr common.Address, txnID int64) error

func (*StateContext) WriteCode

func (sctx *StateContext) WriteCode(addr common.Address, txnID int64) error

func (*StateContext) WriteConflict

func (sctx *StateContext) WriteConflict(addr common.Address, txnID int64) bool

func (*StateContext) WriteState

func (sctx *StateContext) WriteState(addr common.Address, key common.Hash, txnID int64) error

type StateDBWrapper

type StateDBWrapper struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

StateDBWrapper provides a pending state for a transaction.

func NewStateDBWrapper

func NewStateDBWrapper(db *state.StateDB) *StateDBWrapper

func (*StateDBWrapper) AddAddressToAccessList

func (s *StateDBWrapper) AddAddressToAccessList(addr common.Address)

func (*StateDBWrapper) AddBalance

func (s *StateDBWrapper) AddBalance(address common.Address, u *uint256.Int, reason tracing.BalanceChangeReason)

func (*StateDBWrapper) AddLog

func (s *StateDBWrapper) AddLog(log *types.Log)

func (*StateDBWrapper) AddPreimage

func (s *StateDBWrapper) AddPreimage(hash common.Hash, bytes []byte)

func (*StateDBWrapper) AddRefund

func (s *StateDBWrapper) AddRefund(u uint64)

func (*StateDBWrapper) AddSlotToAccessList

func (s *StateDBWrapper) AddSlotToAccessList(addr common.Address, slot common.Hash)

func (*StateDBWrapper) AddressInAccessList

func (s *StateDBWrapper) AddressInAccessList(addr common.Address) bool

func (*StateDBWrapper) AllPreimages

func (s *StateDBWrapper) AllPreimages() map[common.Hash][]byte

func (*StateDBWrapper) CreateAccount

func (s *StateDBWrapper) CreateAccount(address common.Address)

func (*StateDBWrapper) Empty

func (s *StateDBWrapper) Empty(address common.Address) bool

func (*StateDBWrapper) Exist

func (s *StateDBWrapper) Exist(address common.Address) bool

func (*StateDBWrapper) GetBalance

func (s *StateDBWrapper) GetBalance(address common.Address) *uint256.Int

func (*StateDBWrapper) GetCode

func (s *StateDBWrapper) GetCode(address common.Address) []byte

func (*StateDBWrapper) GetCodeHash

func (s *StateDBWrapper) GetCodeHash(address common.Address) common.Hash

func (*StateDBWrapper) GetCodeSize

func (s *StateDBWrapper) GetCodeSize(address common.Address) int

func (*StateDBWrapper) GetCommittedState

func (s *StateDBWrapper) GetCommittedState(address common.Address, hash common.Hash) common.Hash

func (*StateDBWrapper) GetNonce

func (s *StateDBWrapper) GetNonce(address common.Address) uint64

func (*StateDBWrapper) GetRefund

func (s *StateDBWrapper) GetRefund() uint64

func (*StateDBWrapper) GetState

func (s *StateDBWrapper) GetState(address common.Address, key common.Hash) common.Hash

func (*StateDBWrapper) GetStateDB

func (s *StateDBWrapper) GetStateDB() *state.StateDB

func (*StateDBWrapper) GetStorageRoot

func (s *StateDBWrapper) GetStorageRoot(addr common.Address) common.Hash

func (*StateDBWrapper) GetTransientState

func (s *StateDBWrapper) GetTransientState(addr common.Address, key common.Hash) common.Hash

func (*StateDBWrapper) HasSelfDestructed

func (s *StateDBWrapper) HasSelfDestructed(address common.Address) bool

func (*StateDBWrapper) Prepare

func (s *StateDBWrapper) Prepare(rules params.Rules, sender, coinbase common.Address, dest *common.Address, precompiles []common.Address, txAccesses types.AccessList)

func (*StateDBWrapper) RevertToSnapshot

func (s *StateDBWrapper) RevertToSnapshot(i int)

func (*StateDBWrapper) SelfDestruct

func (s *StateDBWrapper) SelfDestruct(address common.Address)

func (*StateDBWrapper) Selfdestruct6780

func (s *StateDBWrapper) Selfdestruct6780(address common.Address)

func (*StateDBWrapper) SetCode

func (s *StateDBWrapper) SetCode(address common.Address, bytes []byte)

func (*StateDBWrapper) SetNonce

func (s *StateDBWrapper) SetNonce(address common.Address, u uint64)

func (*StateDBWrapper) SetState

func (s *StateDBWrapper) SetState(address common.Address, key common.Hash, value common.Hash)

func (*StateDBWrapper) SetTransientState

func (s *StateDBWrapper) SetTransientState(addr common.Address, key, value common.Hash)

func (*StateDBWrapper) SetTxContext

func (s *StateDBWrapper) SetTxContext(txHash common.Hash, txIndex int)

func (*StateDBWrapper) SlotInAccessList

func (s *StateDBWrapper) SlotInAccessList(addr common.Address, slot common.Hash) (addressOk bool, slotOk bool)

func (*StateDBWrapper) Snapshot

func (s *StateDBWrapper) Snapshot() int

func (*StateDBWrapper) SubBalance

func (s *StateDBWrapper) SubBalance(address common.Address, u *uint256.Int, reason tracing.BalanceChangeReason)

func (*StateDBWrapper) SubRefund

func (s *StateDBWrapper) SubRefund(u uint64)

type VisitTxnID

type VisitTxnID map[int64]struct{}

type VisitedAddress

type VisitedAddress struct {
	// address -> TxnID
	Address map[common.Address]VisitTxnID
	Account map[common.Address]VisitTxnID
	Balance map[common.Address]VisitTxnID
	Code    map[common.Address]VisitTxnID
	State   map[common.Address]map[common.Hash]VisitTxnID
}

func NewVisitedAddress

func NewVisitedAddress() *VisitedAddress

func (*VisitedAddress) GetAccountVisitedTxn

func (v *VisitedAddress) GetAccountVisitedTxn(addr common.Address) VisitTxnID

func (*VisitedAddress) GetBalanceVisitedTxn

func (v *VisitedAddress) GetBalanceVisitedTxn(addr common.Address) VisitTxnID

func (*VisitedAddress) VisitAccount

func (v *VisitedAddress) VisitAccount(addr common.Address, txnID int64)

func (*VisitedAddress) VisitBalance

func (v *VisitedAddress) VisitBalance(addr common.Address, txnID int64)

func (*VisitedAddress) VisitCode

func (v *VisitedAddress) VisitCode(addr common.Address, txnID int64)

func (*VisitedAddress) VisitDestruct

func (v *VisitedAddress) VisitDestruct(addr common.Address, txnID int64)

func (*VisitedAddress) VisitState

func (v *VisitedAddress) VisitState(addr common.Address, key common.Hash, txnID int64)

Jump to

Keyboard shortcuts

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