Documentation ¶
Index ¶
- Constants
- Variables
- func AddressStoragePrefix(address common.Address) []byte
- func BinSearch(lo, hi uint64, ...) (uint64, error)
- func DecodeTransactionLogs(data []byte) (types.TransactionLogs, error)
- func DecodeTxResponse(in []byte) (*types.MsgEthereumTxResponse, error)
- func DefaultGenesisState() *types.GenesisState
- func DefaultParams() types.Params
- func EncodeTransactionLogs(res *types.TransactionLogs) ([]byte, error)
- func IsLondon(ethConfig *params.ChainConfig, height int64) bool
- func NewParams(evmDenom string, enableCreate, enableCall bool, config types.ChainConfig, ...) types.Params
- func NewTracer(tracer string, msg core.Message, cfg *params.ChainConfig, height int64) vm.EVMLogger
- func ParamKeyTable() paramtypes.KeyTable
- func StateKey(address common.Address, key []byte) []byte
- func UnwrapEthereumMsg(tx *sdk.Tx, ethHash common.Hash) (*types.MsgEthereumTx, error)
- type AccountKeeper
- type BankKeeper
- type CompiledContract
- type EVMConfig
- type EvmHooks
- type FeeMarketKeeper
- type HexString
- type NoOpTracer
- func (dt NoOpTracer) CaptureEnd(output []byte, gasUsed uint64, tm time.Duration, err error)
- func (dt NoOpTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, ...)
- func (dt NoOpTracer) CaptureExit(output []byte, gasUsed uint64, err error)
- func (dt NoOpTracer) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, depth int, ...)
- func (dt NoOpTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, ...)
- func (dt NoOpTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, ...)
- func (dt NoOpTracer) CaptureTxEnd(restGas uint64)
- func (dt NoOpTracer) CaptureTxStart(gasLimit uint64)
- type StakingKeeper
- type TransactionArgs
- type TxTraceResult
Constants ¶
const ( EventTypeEthereumTx = types.TypeMsgEthereumTx EventTypeBlockBloom = "block_bloom" EventTypeTxLog = "tx_log" AttributeKeyContractAddress = "contract" AttributeKeyRecipient = "recipient" AttributeKeyTxHash = "txHash" AttributeKeyEthereumTxHash = "ethereumTxHash" AttributeKeyTxIndex = "txIndex" AttributeKeyTxGasUsed = "txGasUsed" AttributeKeyTxType = "txType" AttributeKeyTxLog = "txLog" // tx failed in eth vm execution AttributeKeyEthereumTxFailed = "ethereumTxFailed" AttributeValueCategory = ModuleName AttributeKeyEthereumBloom = "bloom" MetricKeyTransitionDB = "transition_db" MetricKeyStaticCall = "static_call" )
Evm module events
const ( // ModuleName string name of module ModuleName = "evm" // StoreKey key for ethereum storage data, account code (StateDB) or block // related data for Web3. // The EVM module should use a prefix store. StoreKey = ModuleName // TransientKey is the key to access the EVM transient store, that is reset // during the Commit phase. TransientKey = "transient_" + ModuleName // RouterKey uses module name for routing RouterKey = ModuleName )
const ( TracerAccessList = "access_list" TracerJSON = "json" TracerStruct = "struct" TracerMarkdown = "markdown" )
Variables ¶
var ( KeyPrefixCode = []byte{prefixCode} KeyPrefixStorage = []byte{prefixStorage} )
KVStore key prefixes
var ( KeyPrefixTransientBloom = []byte{prefixTransientBloom} KeyPrefixTransientTxIndex = []byte{prefixTransientTxIndex} KeyPrefixTransientLogSize = []byte{prefixTransientLogSize} KeyPrefixTransientGasUsed = []byte{prefixTransientGasUsed} )
Transient Store key prefixes
var ( // DefaultEVMDenom defines the default EVM denomination on Ethermint DefaultEVMDenom = maratypes.AttoMara // DefaultMinGasMultiplier is 0.5 or 50% DefaultMinGasMultiplier = sdk.NewDecWithPrec(50, 2) // DefaultAllowUnprotectedTxs rejects all unprotected txs (i.e false) DefaultAllowUnprotectedTxs = false )
var ( ParamStoreKeyEVMDenom = []byte("EVMDenom") ParamStoreKeyEnableCreate = []byte("EnableCreate") ParamStoreKeyEnableCall = []byte("EnableCall") ParamStoreKeyExtraEIPs = []byte("EnableExtraEIPs") ParamStoreKeyChainConfig = []byte("ChainConfig") ParamStoreKeyAllowUnprotectedTxs = []byte("AllowUnprotectedTxs") // AvailableExtraEIPs define the list of all EIPs that can be enabled by the // EVM interpreter. These EIPs are applied in order and can override the // instruction sets from the latest hard fork enabled by the ChainConfig. For // more info check: // https://github.com/ethereum/go-ethereum/blob/master/core/vm/interpreter.go#L97 AvailableExtraEIPs = []int64{1344, 1884, 2200, 2929, 3198, 3529} )
Parameter keys
var EmptyCodeHash = crypto.Keccak256(nil)
Functions ¶
func AddressStoragePrefix ¶
AddressStoragePrefix returns a prefix to iterate over a given account storage.
func BinSearch ¶
func BinSearch(lo, hi uint64, executable func(uint64) (bool, *types.MsgEthereumTxResponse, error)) (uint64, error)
BinSearch execute the binary search and hone in on an executable gas limit
func DecodeTransactionLogs ¶
func DecodeTransactionLogs(data []byte) (types.TransactionLogs, error)
DecodeTxResponse decodes an protobuf-encoded byte slice into TransactionLogs
func DecodeTxResponse ¶
func DecodeTxResponse(in []byte) (*types.MsgEthereumTxResponse, error)
DecodeTxResponse decodes an protobuf-encoded byte slice into TxResponse
func DefaultGenesisState ¶
func DefaultGenesisState() *types.GenesisState
DefaultGenesisState sets default evm genesis state with empty accounts and default params and chain config values.
func DefaultParams ¶
DefaultParams returns default evm parameters ExtraEIPs is empty to prevent overriding the latest hard fork instruction set
func EncodeTransactionLogs ¶
func EncodeTransactionLogs(res *types.TransactionLogs) ([]byte, error)
EncodeTransactionLogs encodes TransactionLogs slice into a protobuf-encoded byte slice.
func IsLondon ¶
func IsLondon(ethConfig *params.ChainConfig, height int64) bool
IsLondon returns if london hardfork is enabled.
func NewParams ¶
func NewParams(evmDenom string, enableCreate, enableCall bool, config types.ChainConfig, extraEIPs ...int64) types.Params
NewParams creates a new types.Params instance
func NewTracer ¶
NewTracer creates a new Logger tracer to collect execution traces from an EVM transaction.
func ParamKeyTable ¶
func ParamKeyTable() paramtypes.KeyTable
ParamKeyTable returns the parameter key table.
func UnwrapEthereumMsg ¶
UnwrapEthereumMsg extract MsgEthereumTx from wrapping sdk.Tx
Types ¶
type AccountKeeper ¶
type AccountKeeper interface { NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI GetModuleAddress(moduleName string) sdk.AccAddress GetAllAccounts(ctx sdk.Context) (accounts []authtypes.AccountI) IterateAccounts(ctx sdk.Context, cb func(account authtypes.AccountI) bool) GetSequence(sdk.Context, sdk.AccAddress) (uint64, error) GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI SetAccount(ctx sdk.Context, account authtypes.AccountI) RemoveAccount(ctx sdk.Context, account authtypes.AccountI) GetParams(ctx sdk.Context) (params authtypes.Params) }
AccountKeeper defines the expected account keeper interface
type BankKeeper ¶
type BankKeeper interface { GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error // SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error }
BankKeeper defines the expected interface needed to retrieve account balances.
type CompiledContract ¶
CompiledContract contains compiled bytecode and abi
var ( // ERC20Contract is the compiled test erc20 contract ERC20Contract CompiledContract // SimpleStorageContract is the compiled test simple storage contract SimpleStorageContract CompiledContract // TestMessageCall is the compiled message call benchmark contract TestMessageCall CompiledContract )
func (CompiledContract) MarshalJSON ¶
func (s CompiledContract) MarshalJSON() ([]byte, error)
MarshalJSON serializes ByteArray to hex
func (*CompiledContract) UnmarshalJSON ¶
func (s *CompiledContract) UnmarshalJSON(data []byte) error
UnmarshalJSON deserializes ByteArray to hex
type EVMConfig ¶
type EVMConfig struct { Params types.Params ChainConfig *params.ChainConfig CoinBase common.Address BaseFee *big.Int }
EVMConfig encapsulates common parameters needed to create an EVM to execute a message It's mainly to reduce the number of method parameters
type EvmHooks ¶
type EvmHooks interface { // Must be called after tx is processed successfully, if return an error, the whole transaction is reverted. PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error }
EvmHooks event hooks for evm tx processing
type FeeMarketKeeper ¶
type FeeMarketKeeper interface { GetBaseFee(ctx sdk.Context) *big.Int GetParams(ctx sdk.Context) feemarkettypes.Params AddTransientGasWanted(ctx sdk.Context, gasWanted uint64) (uint64, error) }
FeeMarketKeeper
type HexString ¶
type HexString []byte
HexString is a byte array that serializes to hex
func (HexString) MarshalJSON ¶
MarshalJSON serializes ByteArray to hex
func (*HexString) UnmarshalJSON ¶
UnmarshalJSON deserializes ByteArray to hex
type NoOpTracer ¶
type NoOpTracer struct{}
NoOpTracer is an empty implementation of vm.Tracer interface
func (NoOpTracer) CaptureEnd ¶
CaptureEnd implements vm.Tracer interface
func (NoOpTracer) CaptureEnter ¶
func (dt NoOpTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int)
CaptureEnter implements vm.Tracer interface
func (NoOpTracer) CaptureExit ¶
func (dt NoOpTracer) CaptureExit(output []byte, gasUsed uint64, err error)
CaptureExit implements vm.Tracer interface
func (NoOpTracer) CaptureFault ¶
func (dt NoOpTracer) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, depth int, err error)
CaptureFault implements vm.Tracer interface
func (NoOpTracer) CaptureStart ¶
func (dt NoOpTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int)
CaptureStart implements vm.Tracer interface
func (NoOpTracer) CaptureState ¶
func (dt NoOpTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error)
CaptureState implements vm.Tracer interface
func (NoOpTracer) CaptureTxEnd ¶
func (dt NoOpTracer) CaptureTxEnd(restGas uint64)
CaptureTxEnd implements vm.Tracer interface
func (NoOpTracer) CaptureTxStart ¶
func (dt NoOpTracer) CaptureTxStart(gasLimit uint64)
CaptureTxStart implements vm.Tracer interface
type StakingKeeper ¶
type StakingKeeper interface { GetHistoricalInfo(ctx sdk.Context, height int64) (stakingtypes.HistoricalInfo, bool) GetValidatorByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) (validator stakingtypes.Validator, found bool) }
StakingKeeper returns the historical headers kept in store.
type TransactionArgs ¶
type TransactionArgs struct { From *common.Address `json:"from"` To *common.Address `json:"to"` Gas *hexutil.Uint64 `json:"gas"` GasPrice *hexutil.Big `json:"gasPrice"` MaxFeePerGas *hexutil.Big `json:"maxFeePerGas"` MaxPriorityFeePerGas *hexutil.Big `json:"maxPriorityFeePerGas"` Value *hexutil.Big `json:"value"` Nonce *hexutil.Uint64 `json:"nonce"` // We accept "data" and "input" for backwards-compatibility reasons. // "input" is the newer name and should be preferred by clients. // Issue detail: https://github.com/ethereum/go-ethereum/issues/15628 Data *hexutil.Bytes `json:"data"` Input *hexutil.Bytes `json:"input"` // Introduced by AccessListTxType transaction. AccessList *ethtypes.AccessList `json:"accessList,omitempty"` ChainID *hexutil.Big `json:"chainId,omitempty"` }
TransactionArgs represents the arguments to construct a new transaction or a message call using JSON-RPC. Duplicate struct definition since geth struct is in internal package Ref: https://github.com/ethereum/go-ethereum/blob/release/1.10.4/internal/ethapi/transaction_args.go#L36
func (*TransactionArgs) GetData ¶
func (args *TransactionArgs) GetData() []byte
GetData retrieves the transaction calldata. Input field is preferred.
func (*TransactionArgs) GetFrom ¶
func (args *TransactionArgs) GetFrom() common.Address
GetFrom retrieves the transaction sender address.
func (*TransactionArgs) String ¶
func (args *TransactionArgs) String() string
String return the struct in a string format
type TxTraceResult ¶
type TxTraceResult struct { Result interface{} `json:"result,omitempty"` // Trace results produced by the tracer Error string `json:"error,omitempty"` // Trace failure produced by the tracer }
TxTraceResult is the result of a single transaction trace during a block trace.