keeper

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: 63 Imported by: 0

Documentation

Index

Constants

View Source
const BaseDenom = "usei"
View Source
const CoinbaseNonce = 42
View Source
const CoinbaseSeedAddress = "0000000000000000000000000000000000000001"

Variables

View Source
var ErrorPointerToPointerNotAllowed = sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "cannot create a pointer to a pointer")
View Source
var MaxUint64BigInt = new(big.Int).SetUint64(math.MaxUint64)

Functions

func ConvertEthLog

func ConvertEthLog(l *ethtypes.Log) *types.Log

func GetCoinbaseAddress

func GetCoinbaseAddress() common.Address

func GetLogsForTx

func GetLogsForTx(receipt *types.Receipt) []*ethtypes.Log

func IsPayablePrecompile

func IsPayablePrecompile(addr *common.Address) bool

func NewMsgServerImpl

func NewMsgServerImpl(keeper *Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.

Types

type AddressNoncePair

type AddressNoncePair struct {
	Address common.Address
	Nonce   uint64
}

type EVMCallFunc

type EVMCallFunc func(caller vm.ContractRef, addr *common.Address, input []byte, gas uint64, value *big.Int) (ret []byte, leftOverGas uint64, err error)

type EvmTxDeferredInfo

type EvmTxDeferredInfo struct {
	TxIndx  int
	TxHash  common.Hash
	TxBloom ethtypes.Bloom
	Surplus sdk.Int
	Error   string
}

type Keeper

type Keeper struct {
	Paramstore paramtypes.Subspace

	QueryConfig *querier.Config

	// only used during ETH replay. Not used in chain critical path.
	EthClient       *ethclient.Client
	EthReplayConfig replay.Config

	// only used during blocktest. Not used in chain critical path.
	EthBlockTestConfig blocktest.Config
	BlockTest          *tests.BlockTest

	// used for both ETH replay and block tests. Not used in chain critical path.
	Trie        ethstate.Trie
	DB          ethstate.Database
	Root        common.Hash
	ReplayBlock *ethtypes.Block
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	storeKey sdk.StoreKey, memStoreKey sdk.StoreKey, paramstore paramtypes.Subspace,
	bankKeeper bankkeeper.Keeper, accountKeeper *authkeeper.AccountKeeper, stakingKeeper *stakingkeeper.Keeper,
	transferKeeper ibctransferkeeper.Keeper, wasmKeeper *wasmkeeper.PermissionedKeeper) *Keeper

func (*Keeper) AccountKeeper

func (k *Keeper) AccountKeeper() *authkeeper.AccountKeeper

func (*Keeper) AddAnteSurplus

func (k *Keeper) AddAnteSurplus(ctx sdk.Context, txHash common.Hash, surplus sdk.Int) error

func (*Keeper) AddPendingNonce

func (k *Keeper) AddPendingNonce(key tmtypes.TxKey, addr common.Address, nonce uint64, priority int64)

AddPendingNonce adds a pending nonce to the keeper

func (*Keeper) AppendErrorToEvmTxDeferredInfo

func (k *Keeper) AppendErrorToEvmTxDeferredInfo(ctx sdk.Context, txHash common.Hash, err string)

func (*Keeper) AppendToEvmTxDeferredInfo

func (k *Keeper) AppendToEvmTxDeferredInfo(ctx sdk.Context, bloom ethtypes.Bloom, txHash common.Hash, surplus sdk.Int)

func (*Keeper) BankKeeper

func (k *Keeper) BankKeeper() bankkeeper.Keeper

func (*Keeper) CalculateNextNonce

func (k *Keeper) CalculateNextNonce(ctx sdk.Context, addr common.Address, includePending bool) uint64

CalculateNextNonce calculates the next nonce for an address If includePending is true, it will consider pending nonces If includePending is false, it will only return the next nonce from GetNonce

func (*Keeper) CallEVM

func (k *Keeper) CallEVM(ctx sdk.Context, from common.Address, to *common.Address, val *sdk.Int, data []byte) (retdata []byte, reterr error)

func (*Keeper) ChainID

func (k *Keeper) ChainID(ctx sdk.Context) *big.Int

func (*Keeper) ClearEVMTxDeferredInfo

func (k *Keeper) ClearEVMTxDeferredInfo()

func (*Keeper) DeleteAddressMapping

func (k *Keeper) DeleteAddressMapping(ctx sdk.Context, seiAddress sdk.AccAddress, evmAddress common.Address)

func (*Keeper) DeleteAllAnteSurplus

func (k *Keeper) DeleteAllAnteSurplus(ctx sdk.Context)

func (*Keeper) DeleteERC20CW20Pointer

func (k *Keeper) DeleteERC20CW20Pointer(ctx sdk.Context, cw20Address string, version uint16)

ERC20 -> CW20

func (*Keeper) DeleteERC20NativePointer

func (k *Keeper) DeleteERC20NativePointer(ctx sdk.Context, token string, version uint16)

ERC20 -> Native Token

func (*Keeper) DeleteERC721CW721Pointer

func (k *Keeper) DeleteERC721CW721Pointer(ctx sdk.Context, cw721Address string, version uint16)

ERC721 -> CW721

func (*Keeper) GetAnteSurplusSum

func (k *Keeper) GetAnteSurplusSum(ctx sdk.Context) sdk.Int

func (*Keeper) GetBaseDenom

func (k *Keeper) GetBaseDenom(ctx sdk.Context) string

func (*Keeper) GetBaseFee

func (k *Keeper) GetBaseFee(ctx sdk.Context) *big.Int

func (*Keeper) GetBaseFeePerGas

func (k *Keeper) GetBaseFeePerGas(ctx sdk.Context) sdk.Dec

func (*Keeper) GetBlockBloom

func (k *Keeper) GetBlockBloom(ctx sdk.Context, height int64) (res ethtypes.Bloom)

func (*Keeper) GetCW20ERC20Pointer

func (k *Keeper) GetCW20ERC20Pointer(ctx sdk.Context, erc20Address common.Address) (addr sdk.AccAddress, version uint16, exists bool)

CW20 -> ERC20

func (*Keeper) GetCW721ERC721Pointer

func (k *Keeper) GetCW721ERC721Pointer(ctx sdk.Context, erc721Address common.Address) (addr sdk.AccAddress, version uint16, exists bool)

func (*Keeper) GetCode

func (k *Keeper) GetCode(ctx sdk.Context, addr common.Address) []byte

func (*Keeper) GetCodeHash

func (k *Keeper) GetCodeHash(ctx sdk.Context, addr common.Address) common.Hash

func (*Keeper) GetCodeSize

func (k *Keeper) GetCodeSize(ctx sdk.Context, addr common.Address) int

func (*Keeper) GetERC20CW20Pointer

func (k *Keeper) GetERC20CW20Pointer(ctx sdk.Context, cw20Address string) (addr common.Address, version uint16, exists bool)

ERC20 -> CW20

func (*Keeper) GetERC20NativePointer

func (k *Keeper) GetERC20NativePointer(ctx sdk.Context, token string) (addr common.Address, version uint16, exists bool)

ERC20 -> Native Token

func (*Keeper) GetERC721CW721Pointer

func (k *Keeper) GetERC721CW721Pointer(ctx sdk.Context, cw721Address string) (addr common.Address, version uint16, exists bool)

ERC721 -> CW721

func (*Keeper) GetEVMAddress

func (k *Keeper) GetEVMAddress(ctx sdk.Context, seiAddress sdk.AccAddress) (common.Address, bool)

func (*Keeper) GetEVMAddressOrDefault

func (k *Keeper) GetEVMAddressOrDefault(ctx sdk.Context, seiAddress sdk.AccAddress) common.Address

func (*Keeper) GetEVMMessage

func (k *Keeper) GetEVMMessage(ctx sdk.Context, tx *ethtypes.Transaction, sender common.Address) *core.Message

func (*Keeper) GetEVMTxDeferredInfo

func (k *Keeper) GetEVMTxDeferredInfo(ctx sdk.Context) (res []EvmTxDeferredInfo)

func (*Keeper) GetFeeCollectorAddress

func (k *Keeper) GetFeeCollectorAddress(ctx sdk.Context) (common.Address, error)

func (*Keeper) GetGasPool

func (k *Keeper) GetGasPool() core.GasPool

func (*Keeper) GetHashFn

func (k *Keeper) GetHashFn(ctx sdk.Context) vm.GetHashFunc

returns a function that provides block header hash based on block number

func (*Keeper) GetKeysToNonces

func (k *Keeper) GetKeysToNonces() map[tmtypes.TxKey]*AddressNoncePair

Test use only

func (*Keeper) GetMinimumFeePerGas

func (k *Keeper) GetMinimumFeePerGas(ctx sdk.Context) sdk.Dec

func (*Keeper) GetNonce

func (k *Keeper) GetNonce(ctx sdk.Context, addr common.Address) uint64

func (*Keeper) GetParams

func (k *Keeper) GetParams(ctx sdk.Context) types.Params

func (*Keeper) GetPendingTxs

func (k *Keeper) GetPendingTxs() map[string][]*PendingTx

Test use only

func (*Keeper) GetPointerInfo

func (k *Keeper) GetPointerInfo(ctx sdk.Context, pref []byte) (addr []byte, version uint16, exists bool)

func (*Keeper) GetPriorityNormalizer

func (k *Keeper) GetPriorityNormalizer(ctx sdk.Context) sdk.Dec

func (*Keeper) GetReceipt

func (k *Keeper) GetReceipt(ctx sdk.Context, txHash common.Hash) (*types.Receipt, error)

Receipt is a data structure that stores EVM specific transaction metadata. Many EVM applications (e.g. MetaMask) relies on being on able to query receipt by EVM transaction hash (not Sei transaction hash) to function properly.

func (*Keeper) GetReplayInitialHeight

func (k *Keeper) GetReplayInitialHeight(ctx sdk.Context) int64

func (*Keeper) GetReplayedHeight

func (k *Keeper) GetReplayedHeight(ctx sdk.Context) int64

func (*Keeper) GetSeiAddress

func (k *Keeper) GetSeiAddress(ctx sdk.Context, evmAddress common.Address) (sdk.AccAddress, bool)

func (*Keeper) GetSeiAddressOrDefault

func (k *Keeper) GetSeiAddressOrDefault(ctx sdk.Context, evmAddress common.Address) sdk.AccAddress

func (*Keeper) GetState

func (k *Keeper) GetState(ctx sdk.Context, addr common.Address, hash common.Hash) common.Hash

func (*Keeper) GetStoreKey

func (k *Keeper) GetStoreKey() sdk.StoreKey

func (*Keeper) GetStoredPointerCodeID

func (k *Keeper) GetStoredPointerCodeID(ctx sdk.Context, pointerType types.PointerType) uint64

func (*Keeper) GetTxHashesOnHeight

func (k *Keeper) GetTxHashesOnHeight(ctx sdk.Context, height int64) (res []common.Hash)

func (*Keeper) GetVMBlockContext

func (k *Keeper) GetVMBlockContext(ctx sdk.Context, gp core.GasPool) (*vm.BlockContext, error)

func (*Keeper) HandleInternalEVMCall

func (k *Keeper) HandleInternalEVMCall(ctx sdk.Context, req *types.MsgInternalEVMCall) (*sdk.Result, error)

func (*Keeper) HandleInternalEVMDelegateCall

func (k *Keeper) HandleInternalEVMDelegateCall(ctx sdk.Context, req *types.MsgInternalEVMDelegateCall) (*sdk.Result, error)

func (*Keeper) InitGenesis

func (k *Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)

func (*Keeper) IterateAll

func (k *Keeper) IterateAll(ctx sdk.Context, pref []byte, cb func(key, val []byte) bool)

func (*Keeper) IterateAllCode

func (k *Keeper) IterateAllCode(ctx sdk.Context, cb func(addr common.Address, code []byte) bool)

func (*Keeper) IterateAllNonces

func (k *Keeper) IterateAllNonces(ctx sdk.Context, cb func(addr common.Address, nonce uint64) bool)

func (*Keeper) IterateSeiAddressMapping

func (k *Keeper) IterateSeiAddressMapping(ctx sdk.Context, cb func(evmAddr common.Address, seiAddr sdk.AccAddress) bool)

func (*Keeper) IterateState

func (k *Keeper) IterateState(ctx sdk.Context, cb func(addr common.Address, key common.Hash, val common.Hash) bool)

func (*Keeper) OpenEthDatabase

func (k *Keeper) OpenEthDatabase() *ethtypes.Header

func (*Keeper) PrefixStore

func (k *Keeper) PrefixStore(ctx sdk.Context, pref []byte) sdk.KVStore

func (*Keeper) PrepareReplayedAddr

func (k *Keeper) PrepareReplayedAddr(ctx sdk.Context, addr common.Address)

Only used in ETH replay

func (*Keeper) PurgePrefix

func (k *Keeper) PurgePrefix(ctx sdk.Context, pref []byte)

func (*Keeper) RemovePendingNonce

func (k *Keeper) RemovePendingNonce(key tmtypes.TxKey)

RemovePendingNonce removes a pending nonce from the keeper but leaves a hole so that a future transaction must use this nonce.

func (*Keeper) SetAddressMapping

func (k *Keeper) SetAddressMapping(ctx sdk.Context, seiAddress sdk.AccAddress, evmAddress common.Address)

func (*Keeper) SetBlockBloom

func (k *Keeper) SetBlockBloom(ctx sdk.Context, height int64, blooms []ethtypes.Bloom)

func (*Keeper) SetCW20ERC20Pointer

func (k *Keeper) SetCW20ERC20Pointer(ctx sdk.Context, erc20Address common.Address, addr string) error

CW20 -> ERC20

func (*Keeper) SetCW721ERC721Pointer

func (k *Keeper) SetCW721ERC721Pointer(ctx sdk.Context, erc721Address common.Address, addr string) error

func (*Keeper) SetCode

func (k *Keeper) SetCode(ctx sdk.Context, addr common.Address, code []byte)

func (*Keeper) SetERC20CW20Pointer

func (k *Keeper) SetERC20CW20Pointer(ctx sdk.Context, cw20Address string, addr common.Address) error

ERC20 -> CW20

func (*Keeper) SetERC20CW20PointerWithVersion

func (k *Keeper) SetERC20CW20PointerWithVersion(ctx sdk.Context, cw20Address string, addr common.Address, version uint16) error

ERC20 -> CW20

func (*Keeper) SetERC20NativePointer

func (k *Keeper) SetERC20NativePointer(ctx sdk.Context, token string, addr common.Address) error

ERC20 -> Native Token

func (*Keeper) SetERC20NativePointerWithVersion

func (k *Keeper) SetERC20NativePointerWithVersion(ctx sdk.Context, token string, addr common.Address, version uint16) error

ERC20 -> Native Token

func (*Keeper) SetERC721CW721Pointer

func (k *Keeper) SetERC721CW721Pointer(ctx sdk.Context, cw721Address string, addr common.Address) error

ERC721 -> CW721

func (*Keeper) SetERC721CW721PointerWithVersion

func (k *Keeper) SetERC721CW721PointerWithVersion(ctx sdk.Context, cw721Address string, addr common.Address, version uint16) error

ERC721 -> CW721

func (*Keeper) SetNonce

func (k *Keeper) SetNonce(ctx sdk.Context, addr common.Address, nonce uint64)

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

func (*Keeper) SetReceipt

func (k *Keeper) SetReceipt(ctx sdk.Context, txHash common.Hash, receipt *types.Receipt) error

func (*Keeper) SetReplayInitialHeight

func (k *Keeper) SetReplayInitialHeight(ctx sdk.Context, h int64)

func (*Keeper) SetReplayedHeight

func (k *Keeper) SetReplayedHeight(ctx sdk.Context)

func (*Keeper) SetState

func (k *Keeper) SetState(ctx sdk.Context, addr common.Address, key common.Hash, val common.Hash)

func (*Keeper) SetTxHashesOnHeight

func (k *Keeper) SetTxHashesOnHeight(ctx sdk.Context, height int64, hashes []common.Hash)

func (*Keeper) SetTxResults

func (k *Keeper) SetTxResults(txResults []*abci.ExecTxResult)

func (*Keeper) StaticCallEVM

func (k *Keeper) StaticCallEVM(ctx sdk.Context, from sdk.AccAddress, to *common.Address, data []byte) ([]byte, error)

func (*Keeper) VerifyAccount

func (k *Keeper) VerifyAccount(ctx sdk.Context, addr common.Address, accountData core.GenesisAccount)

func (*Keeper) VerifyBalance

func (k *Keeper) VerifyBalance(ctx sdk.Context, addr common.Address)

func (*Keeper) VerifyState

func (k *Keeper) VerifyState(ctx sdk.Context, addr common.Address)

func (*Keeper) VerifyTxResult

func (k *Keeper) VerifyTxResult(ctx sdk.Context, hash common.Hash)

func (*Keeper) WasmKeeper

func (k *Keeper) WasmKeeper() *wasmkeeper.PermissionedKeeper

type PendingTx

type PendingTx struct {
	Key      tmtypes.TxKey
	Nonce    uint64
	Priority int64
}

type Querier

type Querier struct {
	*Keeper
}

Querier defines a wrapper around the x/mint keeper providing gRPC method handlers.

func NewQuerier

func NewQuerier(k *Keeper) Querier

func (Querier) Pointer

type ReplayChainContext

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

only used during ETH replay

func (*ReplayChainContext) Engine

func (ctx *ReplayChainContext) Engine() consensus.Engine

func (*ReplayChainContext) GetHeader

func (ctx *ReplayChainContext) GetHeader(hash common.Hash, number uint64) *ethtypes.Header

Jump to

Keyboard shortcuts

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