Documentation
¶
Index ¶
- Constants
- Variables
- func BlockGasLimit(ctx sdk.Context) uint64
- func CosmosDbToCometDb(db sdkdb.DB) cmtdb.DB
- func HasDynamicFeeExtensionOption(any *codectypes.Any) bool
- func IsEmptyHash(hash string) bool
- func IsValidChainID(chainID string) bool
- func IsValidInt256(i *big.Int) bool
- func IsZeroAddress(address string) bool
- func NewBaseCoin(amount sdkmath.Int) sdk.Coin
- func NewBaseCoinDec(amount sdkmath.Int) sdk.DecCoin
- func NewBaseCoinDecInt64(amount int64) sdk.DecCoin
- func NewBaseCoinInt64(amount int64) sdk.Coin
- func NewInfiniteGasMeterWithLimit(limit storetypes.Gas) storetypes.GasMeter
- func ParseChainID(chainID string) (*big.Int, error)
- func RegisterInterfaces(registry codectypes.InterfaceRegistry)
- func SafeInt64(value uint64) (int64, error)
- func SafeNewIntFromBigInt(i *big.Int) (sdkmath.Int, error)
- func ValidateAddress(address string) error
- func ValidateNonZeroAddress(address string) error
- type EVMTxIndexer
- type ErrorGasOverflow
- type ErrorNegativeGasConsumed
- type ExtensionOptionDynamicFeeTx
- func (*ExtensionOptionDynamicFeeTx) Descriptor() ([]byte, []int)
- func (m *ExtensionOptionDynamicFeeTx) Marshal() (dAtA []byte, err error)
- func (m *ExtensionOptionDynamicFeeTx) MarshalTo(dAtA []byte) (int, error)
- func (m *ExtensionOptionDynamicFeeTx) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*ExtensionOptionDynamicFeeTx) ProtoMessage()
- func (m *ExtensionOptionDynamicFeeTx) Reset()
- func (m *ExtensionOptionDynamicFeeTx) Size() (n int)
- func (m *ExtensionOptionDynamicFeeTx) String() string
- func (m *ExtensionOptionDynamicFeeTx) Unmarshal(dAtA []byte) error
- func (m *ExtensionOptionDynamicFeeTx) XXX_DiscardUnknown()
- func (m *ExtensionOptionDynamicFeeTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ExtensionOptionDynamicFeeTx) XXX_Merge(src proto.Message)
- func (m *ExtensionOptionDynamicFeeTx) XXX_Size() int
- func (m *ExtensionOptionDynamicFeeTx) XXX_Unmarshal(b []byte) error
- type HDPathIterator
- type TxResult
- func (*TxResult) Descriptor() ([]byte, []int)
- func (m *TxResult) Marshal() (dAtA []byte, err error)
- func (m *TxResult) MarshalTo(dAtA []byte) (int, error)
- func (m *TxResult) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*TxResult) ProtoMessage()
- func (m *TxResult) Reset()
- func (m *TxResult) Size() (n int)
- func (m *TxResult) String() string
- func (m *TxResult) Unmarshal(dAtA []byte) error
- func (m *TxResult) XXX_DiscardUnknown()
- func (m *TxResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *TxResult) XXX_Merge(src proto.Message)
- func (m *TxResult) XXX_Size() int
- func (m *TxResult) XXX_Unmarshal(b []byte) error
Constants ¶
const (
// DefaultGasPrice is default gas price for evm transactions
DefaultGasPrice = 20
)
const (
// ProtocolVersion is the latest supported version of the eth protocol.
ProtocolVersion = eth65
)
Constants to match up protocol versions and messages
const RootCodespace = constants.ApplicationName
RootCodespace is the codespace for all errors defined in this package
Variables ¶
var ( ErrInvalidLengthDynamicFee = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowDynamicFee = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupDynamicFee = fmt.Errorf("proto: unexpected end of group") )
var ( // Bip44CoinType satisfies EIP84. See https://github.com/ethereum/EIPs/issues/84 for more info. Bip44CoinType uint32 = 60 // BIP44HDPath is the default BIP44 HD path used on Ethereum. BIP44HDPath = ethaccounts.DefaultBaseDerivationPath.String() )
var ( ErrInvalidLengthIndexer = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowIndexer = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupIndexer = fmt.Errorf("proto: unexpected end of group") )
var ErrInvalidChainID = errorsmod.Register(RootCodespace, 3, "invalid chain ID")
ErrInvalidChainID returns an error resulting from an invalid chain ID.
var PowerReduction = sdkmath.NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(constants.BaseDenomExponent), nil))
PowerReduction defines the default power reduction value for staking
Functions ¶
func BlockGasLimit ¶
BlockGasLimit returns the max gas (limit) defined in the block gas meter. If the meter is not set, it returns the max gas from the application consensus params. NOTE: see https://github.com/cosmos/cosmos-sdk/issues/9514 for full reference
func HasDynamicFeeExtensionOption ¶
func HasDynamicFeeExtensionOption(any *codectypes.Any) bool
HasDynamicFeeExtensionOption returns true if the tx implements the `ExtensionOptionDynamicFeeTx` extension option.
func IsEmptyHash ¶
IsEmptyHash returns true if the hash corresponds to an empty ethereum hex hash.
func IsValidChainID ¶
IsValidChainID returns false if the given chain identifier is incorrectly formatted.
func IsValidInt256 ¶
IsValidInt256 check the bound of 256 bit number
func IsZeroAddress ¶
IsZeroAddress returns true if the address corresponds to an empty ethereum hex address.
func NewBaseCoin ¶
NewBaseCoin is a utility function that returns a native coin with the given sdkmath.Int amount. The function will panic if the provided amount is negative.
func NewBaseCoinDec ¶
NewBaseCoinDec is a utility function that returns a decimal native coin with the given sdkmath.Int amount. The function will panic if the provided amount is negative.
func NewBaseCoinDecInt64 ¶
NewBaseCoinDecInt64 is a utility function that returns a decimal native coin with the given int64 amount. The function will panic if the provided amount is negative.
func NewBaseCoinInt64 ¶
NewBaseCoinInt64 is a utility function that returns a native coin with the given int64 amount. The function will panic if the provided amount is negative.
func NewInfiniteGasMeterWithLimit ¶
func NewInfiniteGasMeterWithLimit(limit storetypes.Gas) storetypes.GasMeter
NewInfiniteGasMeterWithLimit returns a reference to a new infiniteGasMeter.
func ParseChainID ¶
ParseChainID parses a string chain identifier's epoch to an Ethereum-compatible chain-id in *big.Int format. The function returns an error if the chain-id has an invalid format
func RegisterInterfaces ¶
func RegisterInterfaces(registry codectypes.InterfaceRegistry)
RegisterInterfaces registers the CometBFT concrete client-related implementations and interfaces.
func SafeNewIntFromBigInt ¶
SafeNewIntFromBigInt constructs Int from big.Int, return error if more than 256bits
func ValidateAddress ¶
ValidateAddress returns an error if the provided string is either not a hex formatted string address
func ValidateNonZeroAddress ¶
ValidateNonZeroAddress returns an error if the provided string is not a hex formatted string address or is equal to zero
Types ¶
type EVMTxIndexer ¶
type EVMTxIndexer interface {
// LastIndexedBlock returns the last block number which was indexed and flushed into database.
// Returns -1 if db is empty.
LastIndexedBlock() (int64, error)
// IndexBlock indexes all ETH Txs of the block.
// Notes: no guarantee data is flushed into database after this function returns, it might be flushed at later point.
IndexBlock(*cmttypes.Block, []*abci.ExecTxResult) error
// Ready is an external trigger that indicates the indexer is ready to serve requests.
Ready()
// IsReady returns true if the indexer is indexed completely and ready to serve requests.
IsReady() bool
// GetByTxHash returns nil if tx not found.
GetByTxHash(common.Hash) (*TxResult, error)
// GetByBlockAndIndex returns nil if tx not found.
GetByBlockAndIndex(int64, int32) (*TxResult, error)
// GetLastRequestIndexedBlock returns the block height of the latest success called to IndexBlock()
GetLastRequestIndexedBlock() (int64, error)
}
EVMTxIndexer defines the interface of the custom ETH-Tx indexer.
type ErrorGasOverflow ¶
type ErrorGasOverflow struct {
Descriptor string
}
ErrorGasOverflow defines an error thrown when an action results gas consumption unsigned integer overflow.
type ErrorNegativeGasConsumed ¶
type ErrorNegativeGasConsumed struct {
Descriptor string
}
ErrorNegativeGasConsumed defines an error thrown when the amount of gas refunded results in a negative gas consumed amount. Copied from cosmos-sdk
type ExtensionOptionDynamicFeeTx ¶
type ExtensionOptionDynamicFeeTx struct {
// max_priority_price is the same as `max_priority_fee_per_gas` in eip-1559 spec
MaxPriorityPrice cosmossdk_io_math.Int `` /* 134-byte string literal not displayed */
}
ExtensionOptionDynamicFeeTx is an extension option that specifies the maxPrioPrice for cosmos tx
func (*ExtensionOptionDynamicFeeTx) Descriptor ¶
func (*ExtensionOptionDynamicFeeTx) Descriptor() ([]byte, []int)
func (*ExtensionOptionDynamicFeeTx) Marshal ¶
func (m *ExtensionOptionDynamicFeeTx) Marshal() (dAtA []byte, err error)
func (*ExtensionOptionDynamicFeeTx) MarshalTo ¶
func (m *ExtensionOptionDynamicFeeTx) MarshalTo(dAtA []byte) (int, error)
func (*ExtensionOptionDynamicFeeTx) MarshalToSizedBuffer ¶
func (m *ExtensionOptionDynamicFeeTx) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*ExtensionOptionDynamicFeeTx) ProtoMessage ¶
func (*ExtensionOptionDynamicFeeTx) ProtoMessage()
func (*ExtensionOptionDynamicFeeTx) Reset ¶
func (m *ExtensionOptionDynamicFeeTx) Reset()
func (*ExtensionOptionDynamicFeeTx) Size ¶
func (m *ExtensionOptionDynamicFeeTx) Size() (n int)
func (*ExtensionOptionDynamicFeeTx) String ¶
func (m *ExtensionOptionDynamicFeeTx) String() string
func (*ExtensionOptionDynamicFeeTx) Unmarshal ¶
func (m *ExtensionOptionDynamicFeeTx) Unmarshal(dAtA []byte) error
func (*ExtensionOptionDynamicFeeTx) XXX_DiscardUnknown ¶
func (m *ExtensionOptionDynamicFeeTx) XXX_DiscardUnknown()
func (*ExtensionOptionDynamicFeeTx) XXX_Marshal ¶
func (m *ExtensionOptionDynamicFeeTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ExtensionOptionDynamicFeeTx) XXX_Merge ¶
func (m *ExtensionOptionDynamicFeeTx) XXX_Merge(src proto.Message)
func (*ExtensionOptionDynamicFeeTx) XXX_Size ¶
func (m *ExtensionOptionDynamicFeeTx) XXX_Size() int
func (*ExtensionOptionDynamicFeeTx) XXX_Unmarshal ¶
func (m *ExtensionOptionDynamicFeeTx) XXX_Unmarshal(b []byte) error
type HDPathIterator ¶
type HDPathIterator func() ethaccounts.DerivationPath
func NewHDPathIterator ¶
func NewHDPathIterator(basePath string, ledgerIter bool) (HDPathIterator, error)
HDPathIterator receives a base path as a string and a boolean for the desired iterator type and returns a function that iterates over the base HD path, returning the string.
type TxResult ¶
type TxResult struct {
// height of the blockchain
Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
// tx_index of the cosmos transaction
TxIndex uint32 `protobuf:"varint,2,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"`
// eth_tx_index is the index in the list of valid eth tx in the block,
// aka. the transaction list returned by eth_getBlock api.
EthTxIndex int32 `protobuf:"varint,3,opt,name=eth_tx_index,json=ethTxIndex,proto3" json:"eth_tx_index,omitempty"`
// failed is true if the eth transaction did not go succeed
Failed bool `protobuf:"varint,4,opt,name=failed,proto3" json:"failed,omitempty"`
}
TxResult is the value stored in eth tx indexer
func (*TxResult) Descriptor ¶
func (*TxResult) MarshalToSizedBuffer ¶
func (*TxResult) ProtoMessage ¶
func (*TxResult) ProtoMessage()
func (*TxResult) XXX_DiscardUnknown ¶
func (m *TxResult) XXX_DiscardUnknown()