types

package
v0.0.1-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 29 Imported by: 2

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"
)
View Source
const MaxBlockUtilizationRatio = 10

MaxBlockUtilizationRatio is the maximum ratio of the max block size to the target block size. This can be trivially understood to be the maximum base fee increase that can occur in between blocks. This is a constant that is used to prevent the base fee from increasing too quickly.

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")

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

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

	// DefaultTargetBlockUtilization is the default target block utilization. This is the default
	// on Ethereum. This denominated in units of gas consumed in a block.
	DefaultTargetBlockUtilization uint64 = 15_000_000

	// 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

	// DefaultMinBaseFee is the default minimum base fee. This is the default
	// on Ethereum. Note that Ethereum is denominated in 1e18 wei. Cosmos chains will
	// likely want to change this to 1e6.
	DefaultMinBaseFee = math.NewInt(1_000_000)

	// 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")

	// DefaultAIMDTheta 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.
	DefaultAIMDTheta = 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")

	// DefaultAIMDTargetBlockSize is the default target block utilization. This
	// is the default on Ethereum. This denominated in units of gas consumed in
	// a block.
	DefaultAIMDTargetBlockSize uint64 = 15_000_000

	// 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. This is the
	// default on Ethereum. Note that ethereum is denominated in 1e18 wei.
	// Cosmos chains will likely want to change this to 1e6.
	DefaultAIMDMinBaseFee = math.NewInt(1_000_000_000)

	// 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 (
	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 sdk.Context, addr sdk.AccAddress) authtypes.AccountI
	GetModuleAddress(name string) sdk.AccAddress
	GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI
}

AccountKeeper defines the expected account keeper (noalias)

type BaseFeeRequest

type BaseFeeRequest struct {
}

BaseFeeRequest is the request type for the Query/BaseFee RPC method.

func (*BaseFeeRequest) Descriptor

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

func (*BaseFeeRequest) Marshal

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

func (*BaseFeeRequest) MarshalTo

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

func (*BaseFeeRequest) MarshalToSizedBuffer

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

func (*BaseFeeRequest) ProtoMessage

func (*BaseFeeRequest) ProtoMessage()

func (*BaseFeeRequest) Reset

func (m *BaseFeeRequest) Reset()

func (*BaseFeeRequest) Size

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

func (*BaseFeeRequest) String

func (m *BaseFeeRequest) String() string

func (*BaseFeeRequest) Unmarshal

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

func (*BaseFeeRequest) XXX_DiscardUnknown

func (m *BaseFeeRequest) XXX_DiscardUnknown()

func (*BaseFeeRequest) XXX_Marshal

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

func (*BaseFeeRequest) XXX_Merge

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

func (*BaseFeeRequest) XXX_Size

func (m *BaseFeeRequest) XXX_Size() int

func (*BaseFeeRequest) XXX_Unmarshal

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

type BaseFeeResponse

type BaseFeeResponse struct {
	Fees github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=fees,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"fees"`
}

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

func (*BaseFeeResponse) Descriptor

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

func (*BaseFeeResponse) GetFees

func (*BaseFeeResponse) Marshal

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

func (*BaseFeeResponse) MarshalTo

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

func (*BaseFeeResponse) MarshalToSizedBuffer

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

func (*BaseFeeResponse) ProtoMessage

func (*BaseFeeResponse) ProtoMessage()

func (*BaseFeeResponse) Reset

func (m *BaseFeeResponse) Reset()

func (*BaseFeeResponse) Size

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

func (*BaseFeeResponse) String

func (m *BaseFeeResponse) String() string

func (*BaseFeeResponse) Unmarshal

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

func (*BaseFeeResponse) XXX_DiscardUnknown

func (m *BaseFeeResponse) XXX_DiscardUnknown()

func (*BaseFeeResponse) XXX_Marshal

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

func (*BaseFeeResponse) XXX_Merge

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

func (*BaseFeeResponse) XXX_Size

func (m *BaseFeeResponse) XXX_Size() int

func (*BaseFeeResponse) XXX_Unmarshal

func (m *BaseFeeResponse) 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.
	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.
	Beta cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=beta,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"beta"`
	// Theta 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.
	Theta cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=theta,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"theta"`
	// 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"`
	// MinBaseFee determines the initial base fee of the module and the global
	// minimum for the network. This is denominated in fee per gas unit.
	MinBaseFee cosmossdk_io_math.Int `protobuf:"bytes,5,opt,name=min_base_fee,json=minBaseFee,proto3,customtype=cosmossdk.io/math.Int" json:"min_base_fee"`
	// 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 */
	// TargetBlockUtilization is the target block utilization.
	TargetBlockUtilization uint64 `` /* 130-byte string literal not displayed */
	// MaxBlockUtilization is the maximum block utilization.
	MaxBlockUtilization uint64 `protobuf:"varint,9,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,10,opt,name=window,proto3" json:"window,omitempty"`
	// FeeDenom is the denom that will be used for all fee payments.
	FeeDenom string `protobuf:"bytes,11,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,12,opt,name=enabled,proto3" json:"enabled,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,
	theta math.LegacyDec,
	delta math.LegacyDec,
	targetBlockSize uint64,
	maxBlockSize uint64,
	minBaseFee math.Int,
	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) GetEnabled

func (m *Params) GetEnabled() bool

func (*Params) GetFeeDenom

func (m *Params) GetFeeDenom() string

func (*Params) GetMaxBlockUtilization

func (m *Params) GetMaxBlockUtilization() uint64

func (*Params) GetTargetBlockUtilization

func (m *Params) GetTargetBlockUtilization() 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) 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)
	// BaseFee returns the current feemarket module base fee.
	BaseFee(ctx context.Context, in *BaseFeeRequest, opts ...grpc.CallOption) (*BaseFeeResponse, 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)
	// BaseFee returns the current feemarket module base fee.
	BaseFee(context.Context, *BaseFeeRequest) (*BaseFeeResponse, error)
}

QueryServer is the server API for Query service.

type State

type State struct {
	// BaseFee is the current base fee. This is denominated in the fee per gas
	// unit.
	BaseFee cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=base_fee,json=baseFee,proto3,customtype=cosmossdk.io/math.Int" json:"base_fee"`
	// 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,
	baseFee math.Int,
	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 fee 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) UpdateBaseFee

func (s *State) UpdateBaseFee(params Params) (fee math.Int)

UpdateBaseFee updates the learning rate and base fee based on the AIMD learning rate adjustment algorithm. The learning rate is updated based on the average utilization of the block window. The base fee 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 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) BaseFee

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