statedb

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: AGPL-3.0 Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAccountAndAddCredit

func CreateAccountAndAddCredit(addr common.Address, owner types.PredicateBytes, balance *big.Int, timeout uint64, transactionRecordHash []byte) state.Action

CreateAccountAndAddCredit - creates EMV account from add fee credit

func SetBalance

func SetBalance(id types.UnitID, value *big.Int) state.Action

SetBalance - set balance to value

func UpdateEthAccountAddCredit

func UpdateEthAccountAddCredit(id types.UnitID, value *big.Int, timeout uint64, transactionRecordHash []byte) state.Action

UpdateEthAccountAddCredit - increments the balance and updates free credit link

func UpdateEthAccountCloseCredit

func UpdateEthAccountCloseCredit(id types.UnitID, value *big.Int, txHash []byte) state.Action

UpdateEthAccountCloseCredit - decrements the balance and updates free credit link

Types

type Account

type Account struct {
	Balance  *big.Int
	CodeHash []byte
	Code     []byte
	Nonce    uint64
	// contains filtered or unexported fields
}

Account represents an account in Ethereum.

func (*Account) Copy

func (a *Account) Copy() *Account
type AlphaBillLink struct {
	TxHash  []byte
	Timeout uint64
	// contains filtered or unexported fields
}

AlphaBillLink links Account to AB FCR bill

func (*AlphaBillLink) Copy

func (f *AlphaBillLink) Copy() *AlphaBillLink

func (*AlphaBillLink) GetTimeout

func (f *AlphaBillLink) GetTimeout() uint64

type LogEntry

type LogEntry struct {
	Address common.Address
	Topics  []common.Hash
	Data    []byte
	// contains filtered or unexported fields
}

type StateDB

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

func NewStateDB

func NewStateDB(tree *state.State, log *slog.Logger) *StateDB

func (*StateDB) AddAddressToAccessList

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

AddAddressToAccessList adds the given address to the access list

func (*StateDB) AddBalance

func (s *StateDB) AddBalance(address common.Address, amount *big.Int)

func (*StateDB) AddLog

func (s *StateDB) AddLog(log *ethtypes.Log)

func (*StateDB) AddPreimage

func (s *StateDB) AddPreimage(_ common.Hash, _ []byte)

func (*StateDB) AddRefund

func (s *StateDB) AddRefund(gas uint64)

func (*StateDB) AddSlotToAccessList

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

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

func (*StateDB) AddressInAccessList

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

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

func (*StateDB) CreateAccount

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

func (*StateDB) DBError

func (s *StateDB) DBError() error

func (*StateDB) Empty

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

func (*StateDB) Exist

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

func (*StateDB) Finalize

func (s *StateDB) Finalize() error

func (*StateDB) ForEachStorage

func (s *StateDB) ForEachStorage(address common.Address, f func(common.Hash, common.Hash) bool) error

func (*StateDB) GetAlphaBillData

func (s *StateDB) GetAlphaBillData(address common.Address) *AlphaBillLink

func (*StateDB) GetBalance

func (s *StateDB) GetBalance(address common.Address) *big.Int

func (*StateDB) GetCode

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

func (*StateDB) GetCodeHash

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

func (*StateDB) GetCodeSize

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

func (*StateDB) GetCommittedState

func (s *StateDB) GetCommittedState(address common.Address, key common.Hash) common.Hash

func (*StateDB) GetLogs

func (s *StateDB) GetLogs() []*LogEntry

func (*StateDB) GetNonce

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

func (*StateDB) GetRefund

func (s *StateDB) GetRefund() uint64

func (*StateDB) GetState

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

func (*StateDB) GetTransientState

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

GetTransientState gets transient storage for a given account.

func (*StateDB) GetUpdatedUnits

func (s *StateDB) GetUpdatedUnits() []types.UnitID

GetUpdatedUnits returns updated UnitID's since last Finalize call

func (*StateDB) HasSelfDestructed

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

func (*StateDB) Prepare

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

Prepare handles the preparatory steps for executing a state transition with. This method must be invoked before state transition.

Berlin fork: - 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)

Potential EIPs: - Reset access list (Berlin) - Add coinbase to access list (EIP-3651) - Reset transient storage (EIP-1153)

func (*StateDB) RevertToSnapshot

func (s *StateDB) RevertToSnapshot(i int)

func (*StateDB) SelfDestruct

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

func (*StateDB) Selfdestruct6780

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

Selfdestruct6780 - EIP-6780 changes the functionality of the SELFDESTRUCT opcode. The new functionality will be only to send all Ether in the account to the caller, except that the current behaviour is preserved when SELFDESTRUCT is called in the same transaction a contract was created.

func (*StateDB) SetAlphaBillData

func (s *StateDB) SetAlphaBillData(address common.Address, fee *AlphaBillLink)

func (*StateDB) SetCode

func (s *StateDB) SetCode(address common.Address, code []byte)

func (*StateDB) SetNonce

func (s *StateDB) SetNonce(address common.Address, nonce uint64)

func (*StateDB) SetState

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

func (*StateDB) SetTransientState

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

SetTransientState sets transient storage for a given account. It adds the change to the journal so that it can be rolled back to its previous value if there is a revert. (for more see https://eips.ethereum.org/EIPS/eip-6780)

func (*StateDB) SlotInAccessList

func (s *StateDB) SlotInAccessList(addr common.Address, slot common.Hash) (addressPresent bool, slotPresent bool)

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

func (*StateDB) Snapshot

func (s *StateDB) Snapshot() int

func (*StateDB) SubBalance

func (s *StateDB) SubBalance(address common.Address, amount *big.Int)

func (*StateDB) SubRefund

func (s *StateDB) SubRefund(gas uint64)

type StateObject

type StateObject struct {
	Address   common.Address
	Account   *Account
	Storage   state.Storage
	AlphaBill *AlphaBillLink

	Suicided bool
	// contains filtered or unexported fields
}

func (*StateObject) Copy

func (s *StateObject) Copy() abstate.UnitData

func (*StateObject) SummaryValueInput

func (s *StateObject) SummaryValueInput() uint64

func (*StateObject) Write

func (s *StateObject) Write(hasher hash.Hash) error

Jump to

Keyboard shortcuts

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