types

package
v0.4.7-rc6-fix Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
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
)
View Source
const (
	EventTypeEthereumTx = TypeMsgEthereumTx
	EventTypeBlockBloom = "block_bloom"
	EventTypeTxLog      = "tx_log"

	AttributeKeyContractAddress = "contract"
	AttributeKeyRecipient       = "recipient"
	AttributeKeyTxHash          = "txHash"
	AttributeKeyEthereumTxHash  = "ethereumTxHash"
	AttributeKeyTxIndex         = "txIndex"
	AttributeKeyTxGasUsed       = "txGasUsed"
	AttributeKeyTxType          = "txType"
	AttributeKeyTxLog           = "txLog"
	// AttributeKeyEthereumTxFailed txs failed in evm execution
	AttributeKeyEthereumTxFailed = "ethereumTxFailed"
	AttributeValueCategory       = ModuleName
	AttributeKeyEthereumBloom    = "bloom"

	MetricKeyTransitionDB = "transition_db"
	MetricKeyStaticCall   = "static_call"
)

Evm module events

View Source
const (
	// TypeMsgEthereumTx defines the type string of an Ethereum txs
	TypeMsgEthereumTx = "ethereum_tx"
)

message type and route constants

Variables

View Source
var (
	KeyPrefixCode    = []byte{prefixCode}
	KeyPrefixStorage = []byte{prefixStorage}
	KeyPrefixParams  = []byte{prefixParams}
)

KVStore key prefixes

View Source
var (
	KeyPrefixTransientBloom   = []byte{prefixTransientBloom}
	KeyPrefixTransientTxIndex = []byte{prefixTransientTxIndex}
	KeyPrefixTransientLogSize = []byte{prefixTransientLogSize}
	KeyPrefixTransientGasUsed = []byte{prefixTransientGasUsed}
)

Transient Store key prefixes

View Source
var (
	// ErrInvalidState returns an error resulting from an invalid Storage State.
	ErrInvalidState = errorsmod.Register(ModuleName, codeErrInvalidState, "invalid storage states")

	// ErrInvalidChainConfig returns an error resulting from an invalid ChainConfig.
	ErrInvalidChainConfig = errorsmod.Register(ModuleName, codeErrInvalidChainConfig, "invalid chain configuration")

	// ErrZeroAddress returns an error resulting from an zero (empty) ethereum Address.
	ErrZeroAddress = errorsmod.Register(ModuleName, codeErrZeroAddress, "invalid zero address")

	// ErrCreateDisabled returns an error if the EnableCreate parameter is false.
	ErrCreateDisabled = errorsmod.Register(ModuleName, codeErrCreateDisabled, "EVM Create operation is disabled")

	// ErrCallDisabled returns an error if the EnableCall parameter is false.
	ErrCallDisabled = errorsmod.Register(ModuleName, codeErrCallDisabled, "EVM Call operation is disabled")

	// ErrInvalidAmount returns an error if a txs contains an invalid amount.
	ErrInvalidAmount = errorsmod.Register(ModuleName, codeErrInvalidAmount, "invalid txs amount")

	// ErrInvalidGasPrice returns an error if an invalid gas price is provided to the txs.
	ErrInvalidGasPrice = errorsmod.Register(ModuleName, codeErrInvalidGasPrice, "invalid gas price")

	// ErrInvalidGasFee returns an error if the txs gas fee is out of bound.
	ErrInvalidGasFee = errorsmod.Register(ModuleName, codeErrInvalidGasFee, "invalid gas fee")

	// ErrVMExecution returns an error resulting from an error in EVM execution.
	ErrVMExecution = errorsmod.Register(ModuleName, codeErrVMExecution, "evm txs execution failed")

	// ErrInvalidRefund returns an error if the gas refund value is invalid.
	ErrInvalidRefund = errorsmod.Register(ModuleName, codeErrInvalidRefund, "invalid gas refund amount")

	// ErrInvalidGasCap returns an error if a the gas cap value is negative or invalid
	ErrInvalidGasCap = errorsmod.Register(ModuleName, codeErrInvalidGasCap, "invalid gas cap")

	// ErrInvalidBaseFee returns an error if a the base fee cap value is invalid
	ErrInvalidBaseFee = errorsmod.Register(ModuleName, codeErrInvalidBaseFee, "invalid base fee")

	// ErrGasOverflow returns an error if gas computation overlow/underflow
	ErrGasOverflow = errorsmod.Register(ModuleName, codeErrGasOverflow, "gas computation overflow/underflow")

	// ErrInvalidAccount returns an error if the account is not an EVM compatible account
	ErrInvalidAccount = errorsmod.Register(ModuleName, codeErrInvalidAccount, "account type is not a valid ethereum account")

	// ErrInvalidGasLimit returns an error if gas limit value is invalid
	ErrInvalidGasLimit = errorsmod.Register(ModuleName, codeErrInvalidGasLimit, "invalid gas limit")

	ErrCallContract = errorsmod.Register(ModuleName, codeErrCallContract, "call contract error")
)
View Source
var (
	ErrInvalidLengthEvents        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowEvents          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group")
)

Functions

func AddressStoragePrefix

func AddressStoragePrefix(address common.Address) []byte

AddressStoragePrefix returns a prefix to iterate over a given account storage.

func KeyPrefix

func KeyPrefix(p string) []byte

func StateKey

func StateKey(address common.Address, key []byte) []byte

StateKey defines the full key under which an account states is stored.

Types

type AccountKeeper

type AccountKeeper interface {
	NewAccountWithAddress(ctx cosmos.Context, addr cosmos.AccAddress) authmodule.AccountI
	GetModuleAddress(moduleName string) cosmos.AccAddress
	GetAllAccounts(ctx cosmos.Context) (accounts []authmodule.AccountI)
	IterateAccounts(ctx cosmos.Context, cb func(account authmodule.AccountI) bool)
	GetSequence(cosmos.Context, cosmos.AccAddress) (uint64, error)
	GetAccount(ctx cosmos.Context, addr cosmos.AccAddress) authmodule.AccountI
	SetAccount(ctx cosmos.Context, account authmodule.AccountI)
	RemoveAccount(ctx cosmos.Context, account authmodule.AccountI)
	GetParams(ctx cosmos.Context) (params authmodule.Params)
}

AccountKeeper defines the expected account keeper interface

type BankKeeper

type BankKeeper interface {
	authmodule.BankKeeper
	GetBalance(ctx cosmos.Context, addr cosmos.AccAddress, denom string) cosmos.Coin
	SendCoinsFromModuleToAccount(ctx cosmos.Context, senderModule string, recipientAddr cosmos.AccAddress, amt cosmos.Coins) error
	MintCoins(ctx cosmos.Context, moduleName string, amt cosmos.Coins) error
	BurnCoins(ctx cosmos.Context, moduleName string, amt cosmos.Coins) error
}

BankKeeper defines the expected interface needed to retrieve account balances.

type EventBlockBloom

type EventBlockBloom struct {
	// bloom is the bloom filter of the block
	Bloom string `protobuf:"bytes,1,opt,name=bloom,proto3" json:"bloom,omitempty"`
}

EventBlockBloom defines an Ethereum block bloom filter event

func (*EventBlockBloom) Descriptor

func (*EventBlockBloom) Descriptor() ([]byte, []int)

func (*EventBlockBloom) GetBloom

func (m *EventBlockBloom) GetBloom() string

func (*EventBlockBloom) Marshal

func (m *EventBlockBloom) Marshal() (dAtA []byte, err error)

func (*EventBlockBloom) MarshalTo

func (m *EventBlockBloom) MarshalTo(dAtA []byte) (int, error)

func (*EventBlockBloom) MarshalToSizedBuffer

func (m *EventBlockBloom) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EventBlockBloom) ProtoMessage

func (*EventBlockBloom) ProtoMessage()

func (*EventBlockBloom) Reset

func (m *EventBlockBloom) Reset()

func (*EventBlockBloom) Size

func (m *EventBlockBloom) Size() (n int)

func (*EventBlockBloom) String

func (m *EventBlockBloom) String() string

func (*EventBlockBloom) Unmarshal

func (m *EventBlockBloom) Unmarshal(dAtA []byte) error

func (*EventBlockBloom) XXX_DiscardUnknown

func (m *EventBlockBloom) XXX_DiscardUnknown()

func (*EventBlockBloom) XXX_Marshal

func (m *EventBlockBloom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EventBlockBloom) XXX_Merge

func (m *EventBlockBloom) XXX_Merge(src proto.Message)

func (*EventBlockBloom) XXX_Size

func (m *EventBlockBloom) XXX_Size() int

func (*EventBlockBloom) XXX_Unmarshal

func (m *EventBlockBloom) XXX_Unmarshal(b []byte) error

type EventEthereumTx

type EventEthereumTx struct {
	// amount
	Amount string `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount,omitempty"`
	// eth_hash is the Ethereum hash of the txs
	EthHash string `protobuf:"bytes,2,opt,name=eth_hash,json=ethHash,proto3" json:"eth_hash,omitempty"`
	// index of the txs in the block
	Index string `protobuf:"bytes,3,opt,name=index,proto3" json:"index,omitempty"`
	// gas_used is the amount of gas used by the txs
	GasUsed string `protobuf:"bytes,4,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"`
	// hash is the Tendermint hash of the txs
	Hash string `protobuf:"bytes,5,opt,name=hash,proto3" json:"hash,omitempty"`
	// recipient of the txs
	Recipient string `protobuf:"bytes,6,opt,name=recipient,proto3" json:"recipient,omitempty"`
	// eth_tx_failed contains a VM error should it occur
	EthTxFailed string `protobuf:"bytes,7,opt,name=eth_tx_failed,json=ethTxFailed,proto3" json:"eth_tx_failed,omitempty"`
}

EventEthereumTx defines the event for an Ethereum txs

func (*EventEthereumTx) Descriptor

func (*EventEthereumTx) Descriptor() ([]byte, []int)

func (*EventEthereumTx) GetAmount

func (m *EventEthereumTx) GetAmount() string

func (*EventEthereumTx) GetEthHash

func (m *EventEthereumTx) GetEthHash() string

func (*EventEthereumTx) GetEthTxFailed

func (m *EventEthereumTx) GetEthTxFailed() string

func (*EventEthereumTx) GetGasUsed

func (m *EventEthereumTx) GetGasUsed() string

func (*EventEthereumTx) GetHash

func (m *EventEthereumTx) GetHash() string

func (*EventEthereumTx) GetIndex

func (m *EventEthereumTx) GetIndex() string

func (*EventEthereumTx) GetRecipient

func (m *EventEthereumTx) GetRecipient() string

func (*EventEthereumTx) Marshal

func (m *EventEthereumTx) Marshal() (dAtA []byte, err error)

func (*EventEthereumTx) MarshalTo

func (m *EventEthereumTx) MarshalTo(dAtA []byte) (int, error)

func (*EventEthereumTx) MarshalToSizedBuffer

func (m *EventEthereumTx) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EventEthereumTx) ProtoMessage

func (*EventEthereumTx) ProtoMessage()

func (*EventEthereumTx) Reset

func (m *EventEthereumTx) Reset()

func (*EventEthereumTx) Size

func (m *EventEthereumTx) Size() (n int)

func (*EventEthereumTx) String

func (m *EventEthereumTx) String() string

func (*EventEthereumTx) Unmarshal

func (m *EventEthereumTx) Unmarshal(dAtA []byte) error

func (*EventEthereumTx) XXX_DiscardUnknown

func (m *EventEthereumTx) XXX_DiscardUnknown()

func (*EventEthereumTx) XXX_Marshal

func (m *EventEthereumTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EventEthereumTx) XXX_Merge

func (m *EventEthereumTx) XXX_Merge(src proto.Message)

func (*EventEthereumTx) XXX_Size

func (m *EventEthereumTx) XXX_Size() int

func (*EventEthereumTx) XXX_Unmarshal

func (m *EventEthereumTx) XXX_Unmarshal(b []byte) error

type EventMessage

type EventMessage struct {
	// module which emits the event
	Module string `protobuf:"bytes,1,opt,name=module,proto3" json:"module,omitempty"`
	// sender of the message
	Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"`
	// tx_type is the type of the message
	TxType string `protobuf:"bytes,3,opt,name=tx_type,json=txType,proto3" json:"tx_type,omitempty"`
}

EventMessage

func (*EventMessage) Descriptor

func (*EventMessage) Descriptor() ([]byte, []int)

func (*EventMessage) GetModule

func (m *EventMessage) GetModule() string

func (*EventMessage) GetSender

func (m *EventMessage) GetSender() string

func (*EventMessage) GetTxType

func (m *EventMessage) GetTxType() string

func (*EventMessage) Marshal

func (m *EventMessage) Marshal() (dAtA []byte, err error)

func (*EventMessage) MarshalTo

func (m *EventMessage) MarshalTo(dAtA []byte) (int, error)

func (*EventMessage) MarshalToSizedBuffer

func (m *EventMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EventMessage) ProtoMessage

func (*EventMessage) ProtoMessage()

func (*EventMessage) Reset

func (m *EventMessage) Reset()

func (*EventMessage) Size

func (m *EventMessage) Size() (n int)

func (*EventMessage) String

func (m *EventMessage) String() string

func (*EventMessage) Unmarshal

func (m *EventMessage) Unmarshal(dAtA []byte) error

func (*EventMessage) XXX_DiscardUnknown

func (m *EventMessage) XXX_DiscardUnknown()

func (*EventMessage) XXX_Marshal

func (m *EventMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EventMessage) XXX_Merge

func (m *EventMessage) XXX_Merge(src proto.Message)

func (*EventMessage) XXX_Size

func (m *EventMessage) XXX_Size() int

func (*EventMessage) XXX_Unmarshal

func (m *EventMessage) XXX_Unmarshal(b []byte) error

type EventTxLog

type EventTxLog struct {
	// tx_logs is an array of txs logs
	TxLogs []string `protobuf:"bytes,1,rep,name=tx_logs,json=txLogs,proto3" json:"tx_logs,omitempty"`
}

EventTxLog defines the event for an Ethereum txs log

func (*EventTxLog) Descriptor

func (*EventTxLog) Descriptor() ([]byte, []int)

func (*EventTxLog) GetTxLogs

func (m *EventTxLog) GetTxLogs() []string

func (*EventTxLog) Marshal

func (m *EventTxLog) Marshal() (dAtA []byte, err error)

func (*EventTxLog) MarshalTo

func (m *EventTxLog) MarshalTo(dAtA []byte) (int, error)

func (*EventTxLog) MarshalToSizedBuffer

func (m *EventTxLog) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EventTxLog) ProtoMessage

func (*EventTxLog) ProtoMessage()

func (*EventTxLog) Reset

func (m *EventTxLog) Reset()

func (*EventTxLog) Size

func (m *EventTxLog) Size() (n int)

func (*EventTxLog) String

func (m *EventTxLog) String() string

func (*EventTxLog) Unmarshal

func (m *EventTxLog) Unmarshal(dAtA []byte) error

func (*EventTxLog) XXX_DiscardUnknown

func (m *EventTxLog) XXX_DiscardUnknown()

func (*EventTxLog) XXX_Marshal

func (m *EventTxLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EventTxLog) XXX_Merge

func (m *EventTxLog) XXX_Merge(src proto.Message)

func (*EventTxLog) XXX_Size

func (m *EventTxLog) XXX_Size() int

func (*EventTxLog) XXX_Unmarshal

func (m *EventTxLog) XXX_Unmarshal(b []byte) error

type FeeKeeper

type FeeKeeper interface {
	GetBaseFee(ctx cosmos.Context) *big.Int
	GetParams(ctx cosmos.Context) feemodule.Params
	AddTransientGasWanted(ctx cosmos.Context, gasWanted uint64) (uint64, error)
}

FeeKeeper

type LegacyParams

type LegacyParams = paramsmodule.ParamSet

type RevertError

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

RevertError is an API error that encompass an EVM revert with JSON error code and a binary data blob.

func NewExecErrorWithReason

func NewExecErrorWithReason(revertReason []byte) *RevertError

NewExecErrorWithReason unpacks the revert return bytes and returns a wrapped error with the return reason.

func (*RevertError) ErrorCode

func (e *RevertError) ErrorCode() int

ErrorCode returns the JSON error code for a revert. See: https://github.com/ethereum/wiki/wiki/JSON-RPC-Error-Codes-Improvement-Proposal

func (*RevertError) ErrorData

func (e *RevertError) ErrorData() interface{}

ErrorData returns the hex encoded revert reason.

type StakingKeeper

type StakingKeeper interface {
	GetHistoricalInfo(ctx cosmos.Context, height int64) (stakingmodule.HistoricalInfo, bool)
	GetValidatorByConsAddr(ctx cosmos.Context, consAddr cosmos.ConsAddress) (validator stakingmodule.Validator, found bool)
}

StakingKeeper returns the historical headers kept in store.

type Subspace

type Subspace interface {
	GetParamSetIfExists(ctx cosmos.Context, ps LegacyParams)
}

Subspace defines an interface that implements the legacy Cosmos SDK x/params Subspace type. NOTE: This is used solely for migration of the Cosmos SDK x/params managed parameters.

Jump to

Keyboard shortcuts

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