types

package
v1.0.2 Latest Latest
Warning

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

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

Documentation

Overview

Package types is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	// ModuleName is the name of the feemarket module.
	ModuleName = "feemarket"
	// StoreKey is the store key string for the feemarket module.
	StoreKey = ModuleName

	// FeeCollectorName the root string for the fee market fee collector account address.
	FeeCollectorName = "feemarket-fee-collector"
)

Variables

View Source
var (
	// DefaultWindow is the default window size for the sliding window
	// used to calculate the base fee. In the base EIP-1559 implementation,
	// only the previous block is considered.
	DefaultWindow uint64 = 1

	// DefaultAlpha is not used in the base EIP-1559 implementation.
	DefaultAlpha = math.LegacyMustNewDecFromStr("0.0")

	// DefaultBeta is not used in the base EIP-1559 implementation.
	DefaultBeta = math.LegacyMustNewDecFromStr("1.0")

	// DefaultGamma is not used in the base EIP-1559 implementation.
	DefaultGamma = math.LegacyMustNewDecFromStr("0.0")

	// DefaultDelta is not used in the base EIP-1559 implementation.
	DefaultDelta = math.LegacyMustNewDecFromStr("0.0")

	// DefaultMaxBlockUtilization is the default maximum block utilization. This is the default
	// on Ethereum. This denominated in units of gas consumed in a block.
	DefaultMaxBlockUtilization uint64 = 30_000_000

	// DefaultMinBaseGasPrice is the default minimum base fee.
	DefaultMinBaseGasPrice = math.LegacyOneDec()

	// DefaultMinLearningRate is not used in the base EIP-1559 implementation.
	DefaultMinLearningRate = math.LegacyMustNewDecFromStr("0.125")

	// DefaultMaxLearningRate is not used in the base EIP-1559 implementation.
	DefaultMaxLearningRate = math.LegacyMustNewDecFromStr("0.125")

	// DefaultFeeDenom is the Cosmos SDK default bond denom.
	DefaultFeeDenom = sdk.DefaultBondDenom
)
View Source
var (
	// DefaultAIMDWindow is the default window size for the sliding window
	// used to calculate the base fee.
	DefaultAIMDWindow uint64 = 8

	// DefaultAIMDAlpha is the default alpha value for the learning
	// rate calculation. This value determines how much we want to additively
	// increase the learning rate when the target block size is exceeded.
	DefaultAIMDAlpha = math.LegacyMustNewDecFromStr("0.025")

	// DefaultAIMDBeta is the default beta value for the learning rate
	// calculation. This value determines how much we want to multiplicatively
	// decrease the learning rate when the target utilization is not met.
	DefaultAIMDBeta = math.LegacyMustNewDecFromStr("0.95")

	// DefaultAIMDGamma is the default threshold for determining whether
	// to increase or decrease the learning rate. In this case, we increase
	// the learning rate if the block utilization within the window is greater
	// than 0.75 or less than 0.25. Otherwise, we multiplicatively decrease
	// the learning rate.
	DefaultAIMDGamma = math.LegacyMustNewDecFromStr("0.25")

	// DefaultAIMDDelta is the default delta value for how much we additively
	// increase or decrease the base fee when the net block utilization within
	// the window is not equal to the target utilization.
	DefaultAIMDDelta = math.LegacyMustNewDecFromStr("0.0")

	// DefaultAIMDMaxBlockSize is the default maximum block utilization.
	// This is the default on Ethereum. This denominated in units of gas
	// consumed in a block.
	DefaultAIMDMaxBlockSize uint64 = 30_000_000

	// DefaultAIMDMinBaseFee is the default minimum base fee.
	DefaultAIMDMinBaseFee = math.LegacyMustNewDecFromStr("1000000000")

	// DefaultAIMDMinLearningRate is the default minimum learning rate.
	DefaultAIMDMinLearningRate = math.LegacyMustNewDecFromStr("0.01")

	// DefaultAIMDMaxLearningRate is the default maximum learning rate.
	DefaultAIMDMaxLearningRate = math.LegacyMustNewDecFromStr("0.50")

	// DefaultAIMDFeeDenom is the Cosmos SDK default bond denom.
	DefaultAIMDFeeDenom = DefaultFeeDenom
)
View Source
var (
	ErrNoFeeCoins      = sdkerrors.New(ModuleName, 1, "no fee coin provided. Must provide one.")
	ErrTooManyFeeCoins = sdkerrors.New(ModuleName, 2, "too many fee coins provided.  Only one fee coin may be provided")
	ErrResolverNotSet  = sdkerrors.New(ModuleName, 3, "denom resolver interface not set.  Only the feemarket base fee denomination can be used")
)
View Source
var (
	ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	// KeyParams is the store key for the feemarket module's parameters.
	KeyParams = []byte{prefixParams}

	// KeyState is the store key for the feemarket module's data.
	KeyState = []byte{prefixState}

	EventTypeFeePay      = "fee_pay"
	EventTypeTipPay      = "tip_pay"
	AttributeKeyTip      = "tip"
	AttributeKeyTipPayer = "tip_payer"
	AttributeKeyTipPayee = "tip_payee"
)
View Source
var (
	ErrInvalidLengthParams        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowParams          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthQuery        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQuery          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthTx        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTx          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)

Functions

func RegisterInterfaces

func RegisterInterfaces(registry types.InterfaceRegistry)

RegisterInterfaces registers the x/feemarket interfaces (messages + msg server) on the provided InterfaceRegistry.

func RegisterLegacyAminoCodec

func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)

RegisterLegacyAminoCodec registers the necessary x/feemarket interfaces (messages) on the provided LegacyAmino codec.

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

func RegisterQueryHandler

func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterQueryHandlerClient

func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error

RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.

func RegisterQueryHandlerFromEndpoint

func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterQueryHandlerServer

func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error

RegisterQueryHandlerServer registers the http handlers for service Query to "mux". UnaryRPC :call QueryServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.

func RegisterQueryServer

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

Types

type AccountKeeper

type AccountKeeper interface {
	GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI
	GetModuleAddress(name string) sdk.AccAddress
	GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI
}

AccountKeeper defines the expected account keeper (noalias)

type DenomResolver

type DenomResolver interface {
	// ConvertToDenom converts deccoin into the equivalent amount of the token denominated in denom.
	ConvertToDenom(ctx sdk.Context, coin sdk.DecCoin, denom string) (sdk.DecCoin, error)
	// ExtraDenoms returns a list of denoms in addition of `Params.base_denom` it's possible to pay fees with
	ExtraDenoms(ctx sdk.Context) ([]string, error)
}

DenomResolver is an interface to convert a given token to the feemarket's base token.

type ErrorDenomResolver

type ErrorDenomResolver struct{}

ErrorDenomResolver is a test implementation of the DenomResolver interface. It returns an error for all coins that are not the baseDenom. NOTE: DO NOT USE THIS IN PRODUCTION

func (*ErrorDenomResolver) ConvertToDenom

func (r *ErrorDenomResolver) ConvertToDenom(_ sdk.Context, coin sdk.DecCoin, denom string) (sdk.DecCoin, error)

ConvertToDenom returns an error for all coins that are not the denom.

func (*ErrorDenomResolver) ExtraDenoms

func (r *ErrorDenomResolver) ExtraDenoms(_ sdk.Context) ([]string, error)

type GasPriceRequest

type GasPriceRequest struct {
	// denom we are querying gas price in
	Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"`
}

GasPriceRequest is the request type for the Query/GasPrice RPC method.

func (*GasPriceRequest) Descriptor

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

func (*GasPriceRequest) GetDenom

func (m *GasPriceRequest) GetDenom() string

func (*GasPriceRequest) Marshal

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

func (*GasPriceRequest) MarshalTo

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

func (*GasPriceRequest) MarshalToSizedBuffer

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

func (*GasPriceRequest) ProtoMessage

func (*GasPriceRequest) ProtoMessage()

func (*GasPriceRequest) Reset

func (m *GasPriceRequest) Reset()

func (*GasPriceRequest) Size

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

func (*GasPriceRequest) String

func (m *GasPriceRequest) String() string

func (*GasPriceRequest) Unmarshal

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

func (*GasPriceRequest) XXX_DiscardUnknown

func (m *GasPriceRequest) XXX_DiscardUnknown()

func (*GasPriceRequest) XXX_Marshal

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

func (*GasPriceRequest) XXX_Merge

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

func (*GasPriceRequest) XXX_Size

func (m *GasPriceRequest) XXX_Size() int

func (*GasPriceRequest) XXX_Unmarshal

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

type GasPriceResponse

type GasPriceResponse struct {
	Price types.DecCoin `protobuf:"bytes,1,opt,name=price,proto3" json:"price"`
}

GasPriceResponse is the response type for the Query/GasPrice RPC method. Returns a gas price in specified denom.

func (*GasPriceResponse) Descriptor

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

func (*GasPriceResponse) GetPrice

func (m *GasPriceResponse) GetPrice() types.DecCoin

func (*GasPriceResponse) Marshal

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

func (*GasPriceResponse) MarshalTo

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

func (*GasPriceResponse) MarshalToSizedBuffer

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

func (*GasPriceResponse) ProtoMessage

func (*GasPriceResponse) ProtoMessage()

func (*GasPriceResponse) Reset

func (m *GasPriceResponse) Reset()

func (*GasPriceResponse) Size

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

func (*GasPriceResponse) String

func (m *GasPriceResponse) String() string

func (*GasPriceResponse) Unmarshal

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

func (*GasPriceResponse) XXX_DiscardUnknown

func (m *GasPriceResponse) XXX_DiscardUnknown()

func (*GasPriceResponse) XXX_Marshal

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

func (*GasPriceResponse) XXX_Merge

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

func (*GasPriceResponse) XXX_Size

func (m *GasPriceResponse) XXX_Size() int

func (*GasPriceResponse) XXX_Unmarshal

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

type GasPricesRequest

type GasPricesRequest struct {
}

GasPriceRequest is the request type for the Query/GasPrices RPC method.

func (*GasPricesRequest) Descriptor

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

func (*GasPricesRequest) Marshal

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

func (*GasPricesRequest) MarshalTo

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

func (*GasPricesRequest) MarshalToSizedBuffer

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

func (*GasPricesRequest) ProtoMessage

func (*GasPricesRequest) ProtoMessage()

func (*GasPricesRequest) Reset

func (m *GasPricesRequest) Reset()

func (*GasPricesRequest) Size

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

func (*GasPricesRequest) String

func (m *GasPricesRequest) String() string

func (*GasPricesRequest) Unmarshal

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

func (*GasPricesRequest) XXX_DiscardUnknown

func (m *GasPricesRequest) XXX_DiscardUnknown()

func (*GasPricesRequest) XXX_Marshal

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

func (*GasPricesRequest) XXX_Merge

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

func (*GasPricesRequest) XXX_Size

func (m *GasPricesRequest) XXX_Size() int

func (*GasPricesRequest) XXX_Unmarshal

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

type GasPricesResponse

type GasPricesResponse struct {
	Prices github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=prices,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"prices"`
}

GasPricesResponse is the response type for the Query/GasPrices RPC method. Returns a gas price in all available denoms.

func (*GasPricesResponse) Descriptor

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

func (*GasPricesResponse) GetPrices

func (*GasPricesResponse) Marshal

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

func (*GasPricesResponse) MarshalTo

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

func (*GasPricesResponse) MarshalToSizedBuffer

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

func (*GasPricesResponse) ProtoMessage

func (*GasPricesResponse) ProtoMessage()

func (*GasPricesResponse) Reset

func (m *GasPricesResponse) Reset()

func (*GasPricesResponse) Size

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

func (*GasPricesResponse) String

func (m *GasPricesResponse) String() string

func (*GasPricesResponse) Unmarshal

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

func (*GasPricesResponse) XXX_DiscardUnknown

func (m *GasPricesResponse) XXX_DiscardUnknown()

func (*GasPricesResponse) XXX_Marshal

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

func (*GasPricesResponse) XXX_Merge

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

func (*GasPricesResponse) XXX_Size

func (m *GasPricesResponse) XXX_Size() int

func (*GasPricesResponse) XXX_Unmarshal

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

type GenesisState

type GenesisState struct {
	// Params are the parameters for the feemarket module. These parameters
	// can be utilized to implement both the base EIP-1559 fee market and
	// and the AIMD EIP-1559 fee market.
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
	// State contains the current state of the AIMD fee market.
	State State `protobuf:"bytes,2,opt,name=state,proto3" json:"state"`
}

GenesisState defines the feemarket module's genesis state.

func DefaultAIMDGenesisState

func DefaultAIMDGenesisState() *GenesisState

DefaultAIMDGenesisState returns a default genesis state that implements the AIMD EIP-1559 fee market implementation.

func DefaultGenesisState

func DefaultGenesisState() *GenesisState

DefaultGenesisState returns a default genesis state that implements the EIP-1559 fee market implementation without the AIMD learning rate adjustment algorithm.

func GetGenesisStateFromAppState

func GetGenesisStateFromAppState(cdc codec.Codec, appState map[string]json.RawMessage) GenesisState

GetGenesisStateFromAppState returns x/feemarket GenesisState given raw application genesis state.

func NewGenesisState

func NewGenesisState(
	params Params,
	state State,
) *GenesisState

NewGenesisState returns a new genesis state for the module.

func (*GenesisState) Descriptor

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

func (*GenesisState) GetParams

func (m *GenesisState) GetParams() Params

func (*GenesisState) GetState

func (m *GenesisState) GetState() State

func (*GenesisState) Marshal

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

func (*GenesisState) MarshalTo

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

func (*GenesisState) MarshalToSizedBuffer

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

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset

func (m *GenesisState) Reset()

func (*GenesisState) Size

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

func (*GenesisState) String

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal

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

func (*GenesisState) ValidateBasic

func (gs *GenesisState) ValidateBasic() error

ValidateBasic performs basic validation of the genesis state data returning an error for any failed validation criteria.

func (*GenesisState) XXX_DiscardUnknown

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal

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

func (*GenesisState) XXX_Merge

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

func (*GenesisState) XXX_Size

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal

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

type MsgClient

type MsgClient interface {
	// Params defines a method for updating the feemarket module parameters.
	Params(ctx context.Context, in *MsgParams, opts ...grpc.CallOption) (*MsgParamsResponse, error)
}

MsgClient is the client API for Msg service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewMsgClient

func NewMsgClient(cc grpc1.ClientConn) MsgClient

type MsgParams

type MsgParams struct {
	// Params defines the new parameters for the feemarket module.
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
	// Authority defines the authority that is updating the feemarket module
	// parameters.
	Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"`
}

MsgParams defines the Msg/Params request type. It contains the new parameters for the feemarket module.

func NewMsgParams

func NewMsgParams(authority string, params Params) MsgParams

NewMsgParams returns a new message to update the x/feemarket module's parameters.

func (*MsgParams) Descriptor

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

func (*MsgParams) GetAuthority

func (m *MsgParams) GetAuthority() string

func (*MsgParams) GetParams

func (m *MsgParams) GetParams() Params

func (*MsgParams) GetSigners

func (m *MsgParams) GetSigners() []sdk.AccAddress

GetSigners implements GetSigners for the msg.

func (*MsgParams) Marshal

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

func (*MsgParams) MarshalTo

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

func (*MsgParams) MarshalToSizedBuffer

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

func (*MsgParams) ProtoMessage

func (*MsgParams) ProtoMessage()

func (*MsgParams) Reset

func (m *MsgParams) Reset()

func (*MsgParams) Size

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

func (*MsgParams) String

func (m *MsgParams) String() string

func (*MsgParams) Unmarshal

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

func (*MsgParams) ValidateBasic

func (m *MsgParams) ValidateBasic() error

ValidateBasic determines whether the information in the message is formatted correctly, specifically whether the authority is a valid acc-address.

func (*MsgParams) XXX_DiscardUnknown

func (m *MsgParams) XXX_DiscardUnknown()

func (*MsgParams) XXX_Marshal

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

func (*MsgParams) XXX_Merge

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

func (*MsgParams) XXX_Size

func (m *MsgParams) XXX_Size() int

func (*MsgParams) XXX_Unmarshal

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

type MsgParamsResponse

type MsgParamsResponse struct {
}

MsgParamsResponse defines the Msg/Params response type.

func (*MsgParamsResponse) Descriptor

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

func (*MsgParamsResponse) Marshal

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

func (*MsgParamsResponse) MarshalTo

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

func (*MsgParamsResponse) MarshalToSizedBuffer

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

func (*MsgParamsResponse) ProtoMessage

func (*MsgParamsResponse) ProtoMessage()

func (*MsgParamsResponse) Reset

func (m *MsgParamsResponse) Reset()

func (*MsgParamsResponse) Size

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

func (*MsgParamsResponse) String

func (m *MsgParamsResponse) String() string

func (*MsgParamsResponse) Unmarshal

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

func (*MsgParamsResponse) XXX_DiscardUnknown

func (m *MsgParamsResponse) XXX_DiscardUnknown()

func (*MsgParamsResponse) XXX_Marshal

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

func (*MsgParamsResponse) XXX_Merge

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

func (*MsgParamsResponse) XXX_Size

func (m *MsgParamsResponse) XXX_Size() int

func (*MsgParamsResponse) XXX_Unmarshal

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

type MsgServer

type MsgServer interface {
	// Params defines a method for updating the feemarket module parameters.
	Params(context.Context, *MsgParams) (*MsgParamsResponse, error)
}

MsgServer is the server API for Msg service.

type Params

type Params struct {
	// Alpha is the amount we additively increase the learning rate
	// when it is above or below the target +/- threshold.
	//
	// Must be > 0.
	Alpha cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=alpha,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"alpha"`
	// Beta is the amount we multiplicatively decrease the learning rate
	// when it is within the target +/- threshold.
	//
	// Must be [0, 1].
	Beta cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=beta,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"beta"`
	// Gamma is the threshold for the learning rate. If the learning rate is
	// above or below the target +/- threshold, we additively increase the
	// learning rate by Alpha. Otherwise, we multiplicatively decrease the
	// learning rate by Beta.
	//
	// Must be [0, 0.5].
	Gamma cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=gamma,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"gamma"`
	// Delta is the amount we additively increase/decrease the base fee when the
	// net block utilization difference in the window is above/below the target
	// utilization.
	Delta cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=delta,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"delta"`
	// MinBaseGasPrice determines the initial gas price of the module and the
	// global minimum for the network.
	MinBaseGasPrice cosmossdk_io_math.LegacyDec `` /* 139-byte string literal not displayed */
	// MinLearningRate is the lower bound for the learning rate.
	MinLearningRate cosmossdk_io_math.LegacyDec `` /* 137-byte string literal not displayed */
	// MaxLearningRate is the upper bound for the learning rate.
	MaxLearningRate cosmossdk_io_math.LegacyDec `` /* 137-byte string literal not displayed */
	// MaxBlockUtilization is the maximum block utilization.
	MaxBlockUtilization uint64 `protobuf:"varint,8,opt,name=max_block_utilization,json=maxBlockUtilization,proto3" json:"max_block_utilization,omitempty"`
	// Window defines the window size for calculating an adaptive learning rate
	// over a moving window of blocks.
	Window uint64 `protobuf:"varint,9,opt,name=window,proto3" json:"window,omitempty"`
	// FeeDenom is the denom that will be used for all fee payments.
	FeeDenom string `protobuf:"bytes,10,opt,name=fee_denom,json=feeDenom,proto3" json:"fee_denom,omitempty"`
	// Enabled is a boolean that determines whether the EIP1559 fee market is
	// enabled.
	Enabled bool `protobuf:"varint,11,opt,name=enabled,proto3" json:"enabled,omitempty"`
	// DistributeFees is a boolean that determines whether the fees are burned or
	// distributed to all stakers.
	DistributeFees bool `protobuf:"varint,12,opt,name=distribute_fees,json=distributeFees,proto3" json:"distribute_fees,omitempty"`
}

Params contains the required set of parameters for the EIP1559 fee market plugin implementation.

func DefaultAIMDParams

func DefaultAIMDParams() Params

DefaultAIMDParams returns a default set of parameters that implements the AIMD EIP-1559 fee market implementation. These parameters allow for the learning rate to be dynamically adjusted based on the block utilization within the window.

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters that implements the EIP-1559 fee market implementation without the AIMD learning rate adjustment algorithm.

func NewParams

func NewParams(
	window uint64,
	alpha math.LegacyDec,
	beta math.LegacyDec,
	gamma math.LegacyDec,
	delta math.LegacyDec,
	maxBlockSize uint64,
	minBaseGasPrice math.LegacyDec,
	minLearingRate math.LegacyDec,
	maxLearningRate math.LegacyDec,
	feeDenom string,
	enabled bool,
) Params

NewParams instantiates a new EIP-1559 Params object. This params object is utilized to implement both the base EIP-1559 fee and AIMD EIP-1559 fee market implementations.

func (*Params) Descriptor

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

func (*Params) GetDistributeFees

func (m *Params) GetDistributeFees() bool

func (*Params) GetEnabled

func (m *Params) GetEnabled() bool

func (*Params) GetFeeDenom

func (m *Params) GetFeeDenom() string

func (*Params) GetMaxBlockUtilization

func (m *Params) GetMaxBlockUtilization() uint64

func (*Params) GetWindow

func (m *Params) GetWindow() uint64

func (*Params) Marshal

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

func (*Params) MarshalTo

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

func (*Params) MarshalToSizedBuffer

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

func (*Params) ProtoMessage

func (*Params) ProtoMessage()

func (*Params) Reset

func (m *Params) Reset()

func (*Params) Size

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

func (*Params) String

func (m *Params) String() string

func (*Params) TargetBlockUtilization

func (p *Params) TargetBlockUtilization() uint64

TargetBlockUtilization returns 0.5 * MaxBlockUtilization.

func (*Params) Unmarshal

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

func (*Params) ValidateBasic

func (p *Params) ValidateBasic() error

ValidateBasic performs basic validation on the parameters.

func (*Params) XXX_DiscardUnknown

func (m *Params) XXX_DiscardUnknown()

func (*Params) XXX_Marshal

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

func (*Params) XXX_Merge

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

func (*Params) XXX_Size

func (m *Params) XXX_Size() int

func (*Params) XXX_Unmarshal

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

type ParamsRequest

type ParamsRequest struct {
}

ParamsRequest is the request type for the Query/Params RPC method.

func (*ParamsRequest) Descriptor

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

func (*ParamsRequest) Marshal

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

func (*ParamsRequest) MarshalTo

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

func (*ParamsRequest) MarshalToSizedBuffer

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

func (*ParamsRequest) ProtoMessage

func (*ParamsRequest) ProtoMessage()

func (*ParamsRequest) Reset

func (m *ParamsRequest) Reset()

func (*ParamsRequest) Size

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

func (*ParamsRequest) String

func (m *ParamsRequest) String() string

func (*ParamsRequest) Unmarshal

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

func (*ParamsRequest) XXX_DiscardUnknown

func (m *ParamsRequest) XXX_DiscardUnknown()

func (*ParamsRequest) XXX_Marshal

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

func (*ParamsRequest) XXX_Merge

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

func (*ParamsRequest) XXX_Size

func (m *ParamsRequest) XXX_Size() int

func (*ParamsRequest) XXX_Unmarshal

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

type ParamsResponse

type ParamsResponse struct {
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}

ParamsResponse is the response type for the Query/Params RPC method.

func (*ParamsResponse) Descriptor

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

func (*ParamsResponse) GetParams

func (m *ParamsResponse) GetParams() Params

func (*ParamsResponse) Marshal

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

func (*ParamsResponse) MarshalTo

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

func (*ParamsResponse) MarshalToSizedBuffer

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

func (*ParamsResponse) ProtoMessage

func (*ParamsResponse) ProtoMessage()

func (*ParamsResponse) Reset

func (m *ParamsResponse) Reset()

func (*ParamsResponse) Size

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

func (*ParamsResponse) String

func (m *ParamsResponse) String() string

func (*ParamsResponse) Unmarshal

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

func (*ParamsResponse) XXX_DiscardUnknown

func (m *ParamsResponse) XXX_DiscardUnknown()

func (*ParamsResponse) XXX_Marshal

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

func (*ParamsResponse) XXX_Merge

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

func (*ParamsResponse) XXX_Size

func (m *ParamsResponse) XXX_Size() int

func (*ParamsResponse) XXX_Unmarshal

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

type QueryClient

type QueryClient interface {
	// Params returns the current feemarket module parameters.
	Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error)
	// State returns the current feemarket module state.
	State(ctx context.Context, in *StateRequest, opts ...grpc.CallOption) (*StateResponse, error)
	// GasPrice returns the current feemarket module gas price
	// for specified denom.
	GasPrice(ctx context.Context, in *GasPriceRequest, opts ...grpc.CallOption) (*GasPriceResponse, error)
	// GasPrices returns the current feemarket module list of gas prices
	// in all available denoms.
	GasPrices(ctx context.Context, in *GasPricesRequest, opts ...grpc.CallOption) (*GasPricesResponse, error)
}

QueryClient is the client API for Query service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewQueryClient

func NewQueryClient(cc grpc1.ClientConn) QueryClient

type QueryServer

type QueryServer interface {
	// Params returns the current feemarket module parameters.
	Params(context.Context, *ParamsRequest) (*ParamsResponse, error)
	// State returns the current feemarket module state.
	State(context.Context, *StateRequest) (*StateResponse, error)
	// GasPrice returns the current feemarket module gas price
	// for specified denom.
	GasPrice(context.Context, *GasPriceRequest) (*GasPriceResponse, error)
	// GasPrices returns the current feemarket module list of gas prices
	// in all available denoms.
	GasPrices(context.Context, *GasPricesRequest) (*GasPricesResponse, error)
}

QueryServer is the server API for Query service.

type State

type State struct {
	// BaseGasPrice is the current base fee. This is denominated in the fee per
	// gas unit.
	BaseGasPrice cosmossdk_io_math.LegacyDec `` /* 128-byte string literal not displayed */
	// LearningRate is the current learning rate.
	LearningRate cosmossdk_io_math.LegacyDec `` /* 126-byte string literal not displayed */
	// Window contains a list of the last blocks' utilization values. This is used
	// to calculate the next base fee. This stores the number of units of gas
	// consumed per block.
	Window []uint64 `protobuf:"varint,3,rep,packed,name=window,proto3" json:"window,omitempty"`
	// Index is the index of the current block in the block utilization window.
	Index uint64 `protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"`
}

State is utilized to track the current state of the fee market. This includes the current base fee, learning rate, and block utilization within the specified AIMD window.

func DefaultAIMDState

func DefaultAIMDState() State

DefaultAIMDState returns the default state for the AIMD EIP-1559 fee market implementation. This implementation uses a sliding window to track the block utilization and dynamically adjusts the learning rate based on the utilization within the window.

func DefaultState

func DefaultState() State

DefaultState returns the default state for the EIP-1559 fee market implementation without the AIMD learning rate adjustment algorithm.

func NewState

func NewState(
	windowSize uint64,
	baseGasPrice math.LegacyDec,
	learningRate math.LegacyDec,
) State

NewState instantiates a new fee market state instance. This is utilized to implement both the base EIP-1559 fee market implementation and the AIMD EIP-1559 fee market implementation. Note that on init, you initialize both the minimum and current base gas price to the same value.

func (*State) Descriptor

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

func (*State) GetAverageUtilization

func (s *State) GetAverageUtilization(params Params) math.LegacyDec

GetAverageUtilization returns the average utilization of the block window.

func (*State) GetIndex

func (m *State) GetIndex() uint64

func (*State) GetNetUtilization

func (s *State) GetNetUtilization(params Params) math.Int

GetNetUtilization returns the net utilization of the block window.

func (*State) GetWindow

func (m *State) GetWindow() []uint64

func (*State) IncrementHeight

func (s *State) IncrementHeight()

IncrementHeight increments the current height of the state.

func (*State) Marshal

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

func (*State) MarshalTo

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

func (*State) MarshalToSizedBuffer

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

func (*State) ProtoMessage

func (*State) ProtoMessage()

func (*State) Reset

func (m *State) Reset()

func (*State) Size

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

func (*State) String

func (m *State) String() string

func (*State) Unmarshal

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

func (*State) Update

func (s *State) Update(gas uint64, params Params) error

Update updates the block utilization for the current height with the given transaction utilization i.e. gas limit.

func (*State) UpdateBaseGasPrice

func (s *State) UpdateBaseGasPrice(params Params) (gasPrice math.LegacyDec)

UpdateBaseGasPrice updates the learning rate and base gas price based on the AIMD learning rate adjustment algorithm. The learning rate is updated based on the average utilization of the block window. The base gas price is update using the new learning rate and the delta adjustment. Please see the EIP-1559 specification for more details.

func (*State) UpdateLearningRate

func (s *State) UpdateLearningRate(params Params) (lr math.LegacyDec)

UpdateLearningRate updates the learning rate based on the AIMD learning rate adjustment algorithm. The learning rate is updated based on the average utilization of the block window. There are two cases that can occur:

  1. The average utilization is above the target threshold. In this case, the learning rate is increased by the alpha parameter. This occurs when blocks are nearly full or empty.
  2. The average utilization is below the target threshold. In this case, the learning rate is decreased by the beta parameter. This occurs when blocks are relatively close to the target block utilization.

For more details, please see the EIP-1559 specification.

func (*State) ValidateBasic

func (s *State) ValidateBasic() error

ValidateBasic performs basic validation on the state.

func (*State) XXX_DiscardUnknown

func (m *State) XXX_DiscardUnknown()

func (*State) XXX_Marshal

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

func (*State) XXX_Merge

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

func (*State) XXX_Size

func (m *State) XXX_Size() int

func (*State) XXX_Unmarshal

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

type StateRequest

type StateRequest struct {
}

StateRequest is the request type for the Query/State RPC method.

func (*StateRequest) Descriptor

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

func (*StateRequest) Marshal

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

func (*StateRequest) MarshalTo

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

func (*StateRequest) MarshalToSizedBuffer

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

func (*StateRequest) ProtoMessage

func (*StateRequest) ProtoMessage()

func (*StateRequest) Reset

func (m *StateRequest) Reset()

func (*StateRequest) Size

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

func (*StateRequest) String

func (m *StateRequest) String() string

func (*StateRequest) Unmarshal

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

func (*StateRequest) XXX_DiscardUnknown

func (m *StateRequest) XXX_DiscardUnknown()

func (*StateRequest) XXX_Marshal

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

func (*StateRequest) XXX_Merge

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

func (*StateRequest) XXX_Size

func (m *StateRequest) XXX_Size() int

func (*StateRequest) XXX_Unmarshal

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

type StateResponse

type StateResponse struct {
	State State `protobuf:"bytes,1,opt,name=state,proto3" json:"state"`
}

StateResponse is the response type for the Query/State RPC method.

func (*StateResponse) Descriptor

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

func (*StateResponse) GetState

func (m *StateResponse) GetState() State

func (*StateResponse) Marshal

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

func (*StateResponse) MarshalTo

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

func (*StateResponse) MarshalToSizedBuffer

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

func (*StateResponse) ProtoMessage

func (*StateResponse) ProtoMessage()

func (*StateResponse) Reset

func (m *StateResponse) Reset()

func (*StateResponse) Size

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

func (*StateResponse) String

func (m *StateResponse) String() string

func (*StateResponse) Unmarshal

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

func (*StateResponse) XXX_DiscardUnknown

func (m *StateResponse) XXX_DiscardUnknown()

func (*StateResponse) XXX_Marshal

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

func (*StateResponse) XXX_Merge

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

func (*StateResponse) XXX_Size

func (m *StateResponse) XXX_Size() int

func (*StateResponse) XXX_Unmarshal

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

type TestDenomResolver

type TestDenomResolver struct{}

TestDenomResolver is a test implementation of the DenomResolver interface. It returns "feeCoin.Amount baseDenom" for all coins that are not the baseDenom. NOTE: DO NOT USE THIS IN PRODUCTION

func (*TestDenomResolver) ConvertToDenom

func (r *TestDenomResolver) ConvertToDenom(_ sdk.Context, coin sdk.DecCoin, denom string) (sdk.DecCoin, error)

ConvertToDenom returns "coin.Amount denom" for all coins that are not the denom.

func (*TestDenomResolver) ExtraDenoms

func (r *TestDenomResolver) ExtraDenoms(_ sdk.Context) ([]string, error)

type UnimplementedMsgServer

type UnimplementedMsgServer struct {
}

UnimplementedMsgServer can be embedded to have forward compatible implementations.

func (*UnimplementedMsgServer) Params

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) GasPrice

func (*UnimplementedQueryServer) GasPrices

func (*UnimplementedQueryServer) Params

func (*UnimplementedQueryServer) State

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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