state

package
v0.0.38 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Represents the sum of all unassociated evm account balances
	// If evm module balance is higher than this value at the end of
	// the transaction, we need to burn from module balance in order
	// for this number to align.
	GasRefundKey  = []byte{0x01}
	LogsKey       = []byte{0x02}
	AccessListKey = []byte{0x03}
)

* Transient Module State Keys

View Source
var (
	AccountCreated = []byte{0x01}
	AccountDeleted = []byte{0x02}
)

* Transient Account State Keys

View Source
var CoinbaseAddressPrefix = []byte("evm_coinbase")
View Source
var SdkUseiToSweiMultiplier = sdk.NewIntFromBigInt(UseiToSweiMultiplier)
View Source
var UseiToSweiMultiplier = big.NewInt(1_000_000_000_000)

UseiToSweiMultiplier Fields that were denominated in usei will be converted to swei (1usei = 10^12swei) for existing Ethereum application (which assumes 18 decimal points) to display properly.

Functions

func GetCoinbaseAddress

func GetCoinbaseAddress(txIdx int) sdk.AccAddress

func SplitUseiWeiAmount

func SplitUseiWeiAmount(amt *big.Int) (sdk.Int, sdk.Int)

func TransferWithoutEvents

func TransferWithoutEvents(db vm.StateDB, sender, recipient common.Address, amount *big.Int)

Types

type DBImpl

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

Initialized for each transaction individually

func NewDBImpl

func NewDBImpl(ctx sdk.Context, k EVMKeeper, simulation bool) *DBImpl

func (*DBImpl) AddAddressToAccessList

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

func (*DBImpl) AddBalance

func (s *DBImpl) AddBalance(evmAddr common.Address, amt *big.Int, reason tracing.BalanceChangeReason)

func (*DBImpl) AddLog

func (s *DBImpl) AddLog(l *ethtypes.Log)

func (*DBImpl) AddPreimage

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

AddPreimage records a SHA3 preimage seen by the VM. AddPreimage performs a no-op since the EnablePreimageRecording flag is disabled on the vm.Config during state transitions. No store trie preimages are written to the database.

func (*DBImpl) AddRefund

func (s *DBImpl) AddRefund(gas uint64)

func (*DBImpl) AddSlotToAccessList

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

func (*DBImpl) AddSurplus

func (s *DBImpl) AddSurplus(surplus sdk.Int)

func (*DBImpl) AddressInAccessList

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

func (*DBImpl) Commit

func (s *DBImpl) Commit(uint64, bool) (common.Hash, error)

func (*DBImpl) Copy

func (s *DBImpl) Copy() vm.StateDB

func (*DBImpl) CreateAccount

func (s *DBImpl) CreateAccount(acc common.Address)

func (*DBImpl) Created

func (s *DBImpl) Created(acc common.Address) bool

func (*DBImpl) Ctx

func (s *DBImpl) Ctx() sdk.Context

func (*DBImpl) DisableEvents

func (s *DBImpl) DisableEvents()

func (*DBImpl) Empty

func (s *DBImpl) Empty(addr common.Address) bool

Empty returns whether the given account is empty. Empty is defined according to EIP161 (balance = nonce = code = 0).

func (*DBImpl) EnableEvents

func (s *DBImpl) EnableEvents()

func (*DBImpl) Err

func (s *DBImpl) Err() error

** TEST ONLY FUNCTIONS **//

func (*DBImpl) Error

func (s *DBImpl) Error() error

Backward-compatibility functions

func (*DBImpl) Exist

func (s *DBImpl) Exist(addr common.Address) bool

Exist reports whether the given account exists in state. Notably this should also return true for self-destructed accounts.

func (*DBImpl) Finalise

func (s *DBImpl) Finalise(bool)

func (*DBImpl) Finalize

func (s *DBImpl) Finalize() (surplus sdk.Int, err error)

func (*DBImpl) GetAllLogs

func (s *DBImpl) GetAllLogs() []*ethtypes.Log

func (*DBImpl) GetBalance

func (s *DBImpl) GetBalance(evmAddr common.Address) *big.Int

func (*DBImpl) GetCode

func (s *DBImpl) GetCode(addr common.Address) []byte

func (*DBImpl) GetCodeHash

func (s *DBImpl) GetCodeHash(addr common.Address) common.Hash

func (*DBImpl) GetCodeSize

func (s *DBImpl) GetCodeSize(addr common.Address) int

func (*DBImpl) GetCommittedState

func (s *DBImpl) GetCommittedState(addr common.Address, hash common.Hash) common.Hash

func (*DBImpl) GetLogs

func (s *DBImpl) GetLogs(common.Hash, uint64, common.Hash) []*ethtypes.Log

func (*DBImpl) GetNonce

func (s *DBImpl) GetNonce(addr common.Address) uint64

func (*DBImpl) GetPrecompileError

func (s *DBImpl) GetPrecompileError() error

func (*DBImpl) GetRefund

func (s *DBImpl) GetRefund() uint64

func (*DBImpl) GetState

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

func (*DBImpl) GetStorageRoot

func (s *DBImpl) GetStorageRoot(common.Address) common.Hash

func (*DBImpl) GetTransientState

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

func (*DBImpl) HasSelfDestructed

func (s *DBImpl) HasSelfDestructed(acc common.Address) bool

the Ethereum semantics of HasSelfDestructed checks if the account is self destructed in the **CURRENT** block

func (*DBImpl) IntermediateRoot

func (s *DBImpl) IntermediateRoot(bool) common.Hash

func (*DBImpl) MarkAccount

func (s *DBImpl) MarkAccount(acc common.Address, status []byte)

func (*DBImpl) Preimages

func (s *DBImpl) Preimages() map[common.Hash][]byte

func (*DBImpl) Prepare

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

func (*DBImpl) RevertToSnapshot

func (s *DBImpl) RevertToSnapshot(rev int)

func (*DBImpl) SelfDestruct

func (s *DBImpl) SelfDestruct(acc common.Address)

debits account's balance. The corresponding credit happens here: https://github.com/sei-protocol/go-ethereum/blob/master/core/vm/instructions.go#L825 clear account's state except the transient state (in Ethereum transient states are still available even after self destruction in the same tx)

func (*DBImpl) Selfdestruct6780

func (s *DBImpl) Selfdestruct6780(acc common.Address)

func (*DBImpl) SetBalance

func (s *DBImpl) SetBalance(evmAddr common.Address, amt *big.Int, reason tracing.BalanceChangeReason)

should only be called during simulation

func (*DBImpl) SetCode

func (s *DBImpl) SetCode(addr common.Address, code []byte)

func (*DBImpl) SetEVM

func (s *DBImpl) SetEVM(evm *vm.EVM)

for interface compliance

func (*DBImpl) SetLogger

func (s *DBImpl) SetLogger(logger *tracing.Hooks)

func (*DBImpl) SetNonce

func (s *DBImpl) SetNonce(addr common.Address, nonce uint64)

func (*DBImpl) SetPrecompileError

func (s *DBImpl) SetPrecompileError(err error)

func (*DBImpl) SetState

func (s *DBImpl) SetState(addr common.Address, key common.Hash, val common.Hash)

func (*DBImpl) SetStorage

func (s *DBImpl) SetStorage(addr common.Address, states map[common.Hash]common.Hash)

func (*DBImpl) SetTransientState

func (s *DBImpl) SetTransientState(addr common.Address, key, val common.Hash)

func (*DBImpl) SetTxContext

func (s *DBImpl) SetTxContext(common.Hash, int)

func (*DBImpl) SlotInAccessList

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

func (*DBImpl) Snapshot

func (s *DBImpl) Snapshot() int

func (*DBImpl) SubBalance

func (s *DBImpl) SubBalance(evmAddr common.Address, amt *big.Int, reason tracing.BalanceChangeReason)

func (*DBImpl) SubRefund

func (s *DBImpl) SubRefund(gas uint64)

Copied from go-ethereum as-is SubRefund removes gas from the refund counter. This method will panic if the refund counter goes below zero

func (*DBImpl) TxIndex

func (s *DBImpl) TxIndex() int

func (*DBImpl) WithCtx

func (s *DBImpl) WithCtx(ctx sdk.Context)

func (*DBImpl) WithErr

func (s *DBImpl) WithErr(err error)

type EVMKeeper

type EVMKeeper interface {
	PrefixStore(sdk.Context, []byte) sdk.KVStore
	PurgePrefix(sdk.Context, []byte)
	GetSeiAddress(sdk.Context, common.Address) (sdk.AccAddress, bool)
	GetSeiAddressOrDefault(ctx sdk.Context, evmAddress common.Address) sdk.AccAddress
	BankKeeper() bankkeeper.Keeper
	GetBaseDenom(sdk.Context) string
	DeleteAddressMapping(sdk.Context, sdk.AccAddress, common.Address)
	GetCode(sdk.Context, common.Address) []byte
	SetCode(sdk.Context, common.Address, []byte)
	GetCodeHash(sdk.Context, common.Address) common.Hash
	GetCodeSize(sdk.Context, common.Address) int
	GetState(sdk.Context, common.Address, common.Hash) common.Hash
	SetState(sdk.Context, common.Address, common.Hash, common.Hash)
	AccountKeeper() *authkeeper.AccountKeeper
	GetFeeCollectorAddress(sdk.Context) (common.Address, error)
	GetNonce(sdk.Context, common.Address) uint64
	SetNonce(sdk.Context, common.Address, uint64)
	PrepareReplayedAddr(ctx sdk.Context, addr common.Address)
}

type Logs

type Logs struct {
	Ls []*ethtypes.Log `json:"logs"`
}

type TemporaryState

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

in-memory state that's generated by a specific EVM snapshot in a single transaction

func NewTemporaryState

func NewTemporaryState() *TemporaryState

Jump to

Keyboard shortcuts

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