package txfees
import (
"github.com/InjectiveLabs/metrics"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/InjectiveLabs/injective-core/injective-chain/modules/txfees/keeper"
)
type BlockHandler struct {
keeper *keeper.Keeper
svcTags metrics.Tags
}
func NewBlockHandler(k *keeper.Keeper) *BlockHandler {
return &BlockHandler{
keeper: k,
svcTags: metrics.Tags{
"svc": "txfees_b",
},
}
}
func (h *BlockHandler) BeginBlocker(ctx sdk.Context) error {
ctx, doneFn := metrics.ReportFuncCallAndTimingSdkCtx(ctx, h.svcTags)
defer doneFn()
h.keeper.RefreshMempool1559Parameters(ctx)
h.keeper.CurFeeState.StartBlock(ctx.Logger(), ctx.BlockHeight())
if err := h.keeper.CheckAndSetTargetGas(ctx); err != nil {
ctx.Logger().Error("txfees: failed to check and set target gas", "error", err)
return err
}
return nil
}
func (h *BlockHandler) EndBlocker(ctx sdk.Context) {
ctx, doneFn := metrics.ReportFuncCallAndTimingSdkCtx(ctx, h.svcTags)
defer doneFn()
h.keeper.CurFeeState.UpdateBaseFee(ctx.Logger(), ctx.BlockHeight())
}
package cli
import (
"context"
"github.com/cosmos/cosmos-sdk/client"
"github.com/spf13/cobra"
"github.com/InjectiveLabs/injective-core/cli"
cliflags "github.com/InjectiveLabs/injective-core/cli/flags"
"github.com/InjectiveLabs/injective-core/injective-chain/modules/txfees/types"
)
// GetQueryCmd returns the cli query commands for this module.
func GetQueryCmd() *cobra.Command {
cmd := cli.ModuleRootCommand(types.ModuleName, true)
cmd.AddCommand(
GetCmdQueryBaseFee(),
)
return cmd
}
// GetCmdQueryBaseFee queries the eip base fee
func GetCmdQueryBaseFee() *cobra.Command {
cmd := &cobra.Command{
Use: "base-fee",
Short: "Query the eip base fee",
Long: "Gets the current EIP base fee",
Args: cobra.MaximumNArgs(0),
RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
req := &types.QueryEipBaseFeeRequest{}
res, err := queryClient.GetEipBaseFee(context.Background(), req)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
cliflags.AddQueryFlagsToCmd(cmd)
return cmd
}
package keeper
import (
errorsmod "cosmossdk.io/errors"
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/InjectiveLabs/injective-core/injective-chain/modules/txfees/types"
chaintypes "github.com/InjectiveLabs/injective-core/injective-chain/types" // as chaintypes
)
// MempoolFeeDecorator will check if the transaction's fee is at least as large
// as the local validator's minimum gasFee (defined in validator config).
// If fee is too low, decorator returns error and tx is rejected from mempool.
// Note this only applies when ctx.CheckTx = true
// If fee is high enough or not CheckTx, then call next AnteHandler
// CONTRACT: Tx must implement FeeTx to use MempoolFeeDecorator.
type MempoolFeeDecorator struct {
TxFeesKeeper *Keeper
}
func NewMempoolFeeDecorator(txFeesKeeper *Keeper) MempoolFeeDecorator {
return MempoolFeeDecorator{
TxFeesKeeper: txFeesKeeper,
}
}
// The complexity is acceptable and we want to keep the function similar to the Osmosis version
//
//nolint:revive // the simulate parameters is a flag parameter, but it is required by the sdk
func (mfd MempoolFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
txfeesParams := mfd.TxFeesKeeper.GetParams(ctx)
if simulate || !txfeesParams.Mempool1559Enabled {
return next(ctx, tx, simulate)
}
// If this is genesis height, don't check the fee.
// This is needed so that gentx's can be created without having to pay a fee (chicken/egg problem).
if ctx.BlockHeight() == 0 {
return next(ctx, tx, simulate)
}
feeTx, err := mfd.getValidatedFeeTx(ctx, tx, txfeesParams)
if err != nil {
return ctx, err
}
// TODO: Is there a better way to do this?
// I want ctx.IsDeliverTx() but that doesn't exist.
if !ctx.IsCheckTx() && !ctx.IsReCheckTx() {
mfd.TxFeesKeeper.CurFeeState.DeliverTxCode(ctx, feeTx)
}
minBaseGasPrice := mfd.GetMinBaseGasPriceForTx(ctx, feeTx)
if minBaseGasPrice.IsZero() {
// If minBaseGasPrice is zero, then we don't need to check the fee. Continue
return next(ctx, tx, simulate)
}
feeCoins := feeTx.GetFee()
if err := mfd.isSufficientFee(minBaseGasPrice, feeTx.GetGas(), feeCoins[0]); err != nil {
return ctx, err
}
return next(ctx, tx, simulate)
}
func (mfd MempoolFeeDecorator) GetMinBaseGasPriceForTx(ctx sdk.Context, feeTx sdk.FeeTx) math.LegacyDec {
txfeesParams := mfd.TxFeesKeeper.GetParams(ctx)
minBaseGasPrice := mfd.TxFeesKeeper.CurFeeState.MinBaseFee
if !ctx.IsCheckTx() && !ctx.IsReCheckTx() {
return minBaseGasPrice
}
// Handle high gas transactions
if feeTx.GetGas() >= txfeesParams.HighGasTxThreshold {
minBaseGasPrice = math.LegacyMaxDec(minBaseGasPrice, txfeesParams.MinGasPriceForHighGasTx)
}
return mfd.getMempool1559GasPrice(ctx, minBaseGasPrice)
}
func (MempoolFeeDecorator) getValidatedFeeTx(ctx sdk.Context, tx sdk.Tx, txfeesParams types.Params) (sdk.FeeTx, error) {
// The SDK currently requires all txs to be FeeTx's in CheckTx, within its mempool fee decorator.
// See: https://github.com/cosmos/cosmos-sdk/blob/f726a2398a26bdaf71d78dbf56a82621e84fd098/x/auth/middleware/fee.go#L34-L37
// So this is not a real restriction at the moment.
feeTx, ok := tx.(sdk.FeeTx)
if !ok {
return nil, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx")
}
// Ensure that the provided gas is less than the maximum gas per tx,
// if this is a CheckTx. This is only for local mempool purposes, and thus
// is only ran on check tx.
if ctx.IsCheckTx() {
if feeTx.GetGas() > txfeesParams.MaxGasWantedPerTx {
msg := "Too much gas wanted: %d, maximum is %d"
return nil, errorsmod.Wrapf(sdkerrors.ErrOutOfGas, msg, feeTx.GetGas(), txfeesParams.MaxGasWantedPerTx)
}
}
feeCoins := feeTx.GetFee()
if len(feeCoins) > 1 {
return nil, types.ErrTooManyFeeCoins
}
// If there is a fee attached to the tx, make sure the fee denom is a denom accepted by the chain
if feeDenom := feeCoins.GetDenomByIndex(0); feeDenom != chaintypes.InjectiveCoin {
return nil, errorsmod.Wrapf(types.ErrInvalidFeeToken, "fee denom is not a valid denom (%s): %s",
chaintypes.InjectiveCoin,
feeDenom,
)
}
return feeTx, nil
}
func (mfd MempoolFeeDecorator) getMempool1559GasPrice(ctx sdk.Context, minBaseGasPrice math.LegacyDec) math.LegacyDec {
if ctx.IsCheckTx() && !ctx.IsReCheckTx() {
return math.LegacyMaxDec(minBaseGasPrice, mfd.TxFeesKeeper.CurFeeState.GetCurBaseFee())
}
if ctx.IsReCheckTx() {
return math.LegacyMaxDec(minBaseGasPrice, mfd.TxFeesKeeper.CurFeeState.GetCurRecheckBaseFee())
}
return minBaseGasPrice
}
// IsSufficientFee checks if the feeCoin provided (in any asset), is worth enough osmo at current spot prices
// to pay the gas cost of this tx.
func (MempoolFeeDecorator) isSufficientFee(minBaseGasPrice math.LegacyDec, gasRequested uint64, feeCoin sdk.Coin) error {
// Determine the required fees by multiplying the required minimum gas
// price by the gas limit, where fee = ceil(minGasPrice * gasLimit).
// note we mutate this one line below, to avoid extra heap allocations.
glDec := math.LegacyNewDec(int64(gasRequested))
baseFeeAmt := glDec.MulMut(minBaseGasPrice).Ceil().RoundInt()
requiredBaseFee := chaintypes.NewInjectiveCoin(baseFeeAmt)
// check to ensure that the convertedFee should always be greater than or equal to the requireBaseFee
if !(feeCoin.IsGTE(requiredBaseFee)) {
return errorsmod.Wrapf(sdkerrors.ErrInsufficientFee, "got: %s required: %s", feeCoin, requiredBaseFee)
}
return nil
}
package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/InjectiveLabs/injective-core/injective-chain/modules/txfees/types"
)
func (k *Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState) {
k.SetParams(ctx, data.Params)
}
func (k *Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
return &types.GenesisState{
Params: k.GetParams(ctx),
}
}
package keeper
import (
"context"
"github.com/InjectiveLabs/metrics"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/InjectiveLabs/injective-core/injective-chain/modules/txfees/types"
)
var _ types.QueryServer = queryServer{}
// queryServer defines a wrapper around the x/txfees keeper providing gRPC method
// handlers.
type queryServer struct {
k *Keeper
svcTags metrics.Tags
}
func NewQueryServer(k *Keeper) types.QueryServer {
return queryServer{
k: k,
svcTags: metrics.Tags{
"svc": "txfees_query",
},
}
}
func (q queryServer) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
c, doneFn := metrics.ReportFuncCallAndTimingCtx(c, q.svcTags)
defer doneFn()
ctx := sdk.UnwrapSDKContext(c)
params := q.k.GetParams(ctx)
res := &types.QueryParamsResponse{
Params: params,
}
return res, nil
}
func (q queryServer) GetEipBaseFee(_ context.Context, _ *types.QueryEipBaseFeeRequest) (*types.QueryEipBaseFeeResponse, error) {
response := q.k.CurFeeState.GetCurBaseFee()
return &types.QueryEipBaseFeeResponse{BaseFee: response}, nil
}
package keeper
import (
"fmt"
"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
"github.com/InjectiveLabs/metrics"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
mempool1559 "github.com/InjectiveLabs/injective-core/injective-chain/modules/txfees/keeper/mempool-1559"
"github.com/InjectiveLabs/injective-core/injective-chain/modules/txfees/types"
)
type Keeper struct {
storeKey storetypes.StoreKey
cdc codec.BinaryCodec
consensusKeeper types.ConsensusKeeper
dataDir string
cachedConsParams cmtproto.ConsensusParams
CurFeeState *mempool1559.FeeState
svcTags metrics.Tags
authority string
}
func NewKeeper(
cdc codec.BinaryCodec,
storeKey storetypes.StoreKey,
consensusKeeper types.ConsensusKeeper,
dataDir string,
authority string,
) Keeper {
return Keeper{
storeKey: storeKey,
cdc: cdc,
consensusKeeper: consensusKeeper,
dataDir: dataDir,
// Initialize the EIP state with the default values. They will be updated in the BeginBlocker.
CurFeeState: mempool1559.DefaultFeeState(),
authority: authority,
svcTags: metrics.Tags{
"svc": "txfees_k",
},
}
}
func (*Keeper) Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName))
}
// GetConsParams returns the current consensus parameters from the consensus params store.
func (k *Keeper) GetConsParams(ctx sdk.Context) (*consensustypes.QueryParamsResponse, error) {
return k.consensusKeeper.Params(ctx, &consensustypes.QueryParamsRequest{})
}
package mempool1559
import (
"encoding/json"
"os"
"sync"
"cosmossdk.io/log"
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
)
/*
This is the logic for EIP-1559 fee market implementation,
the goal of this code is to prevent spam by charging more for transactions when the network is busy.
This logic does two things:
- Maintaining data parsed from chain transaction execution and updating feeState accordingly.
- Resetting feeState to default every ResetInterval (6000) block height intervals to maintain consistency.
Additionally:
- Periodically evaluating CheckTx and RecheckTx for compliance with these parameters.
Note: The reset interval is set to 36000 blocks, which is approximately 8 hours.
Challenges:
- Transactions falling under their gas bounds are currently discarded by nodes.
This behavior can be modified for CheckTx, rather than RecheckTx.
Global variables stored in memory:
- DefaultBaseFee: Default base fee, initialized to 0.005.
- MinBaseFee: Minimum base fee, initialized to 0.0025.
- MaxBaseFee: Maximum base fee, initialized to 5.
- MaxBlockChangeRate: The maximum block change rate, initialized to 1/10.
Global constants:
- TargetGas: Gas wanted per block, initialized to .625 * block_gas_limt = 187.5 million.
- ResetInterval: The interval at which feeState is reset, initialized to 6000 blocks.
- BackupFile: File for backup, set to "fee_state.json".
- RecheckFeeConstant: A constant value for rechecking fees, initialized to 2.25.
*/
const (
BackupFilename = "fee_state.json"
DefaultMinGasPrice = 160000000
)
// FeeState tracks the current base fee and totalGasWantedThisBlock
// this structure is never written to state
type FeeState struct {
currentBlockHeight int64
totalGasWantedThisBlock int64
backupFilePath string
CurBaseFee math.LegacyDec `json:"cur_base_fee"`
MinBaseFee math.LegacyDec `json:"min_base_fee"`
DefaultBaseFee math.LegacyDec `json:"default_base_fee"`
MaxBaseFee math.LegacyDec `json:"max_base_fee"`
ResetInterval int64 `json:"reset_interval"`
MaxBlockChangeRate math.LegacyDec `json:"max_block_change_rate"`
TargetGas int64 `json:"target_gas"`
TargetBlockSpacePercent math.LegacyDec `json:"target_block_space_percent"`
RecheckFeeLowBaseFee math.LegacyDec `json:"recheck_fee_low_base_fee"`
RecheckFeeHighBaseFee math.LegacyDec `json:"recheck_fee_high_base_fee"`
RecheckFeeBaseFeeThreshold math.LegacyDec `json:"recheck_fee_base_fee_threshold"`
}
func DefaultFeeState() *FeeState {
defaultMinBaseFee := math.LegacyNewDec(DefaultMinGasPrice)
return &FeeState{
currentBlockHeight: 0,
totalGasWantedThisBlock: 0,
backupFilePath: "",
CurBaseFee: math.LegacyNewDec(0),
// We expect wallet multiplier * DefaultBaseFee < MinBaseFee * RecheckFeeConstant
// conservatively assume a wallet multiplier of at least 7%.
MinBaseFee: defaultMinBaseFee,
DefaultBaseFee: defaultMinBaseFee.Mul(math.LegacyMustNewDecFromStr("1.5")),
MaxBaseFee: defaultMinBaseFee.Mul(math.LegacyMustNewDecFromStr("1000")),
ResetInterval: 36_000,
// Max increase per block is a factor of 1.06, max decrease is 9/10
// If recovering at ~30M gas per block, decrease is .916
MaxBlockChangeRate: math.LegacyMustNewDecFromStr("0.1"),
TargetGas: 93_750_000,
TargetBlockSpacePercent: math.LegacyMustNewDecFromStr("0.625"),
// N.B. on the reason for having two base fee constants for high and low fees:
//
// At higher base fees, we apply a smaller re-check factor.
// The reason for this is that the recheck factor forces the base fee to get at minimum
// "recheck factor" times higher than the spam rate. This leads to slow recovery
// and a bad UX for user transactions. We aim for spam to start getting evicted from the mempool
// sooner as to avoid more severe UX degradation for user transactions. Therefore,
// we apply a smaller recheck factor at higher base fees.
//
// For low base fees:
// In face of continuous spam, will take ~19 blocks from base fee > spam cost, to mempool eviction
// ceil(log_{1.06}(RecheckFeeLowBaseFee)) (assuming base fee not going over threshold)
// So potentially 1.2 minutes of impaired UX from 1559 nodes on top of time to get to base fee > spam.
RecheckFeeLowBaseFee: math.LegacyNewDec(2),
// For high base fees:
// In face of continuous spam, will take ~15 blocks from base fee > spam cost, to mempool eviction
// ceil(log_{1.06}(RecheckFeeHighBaseFee)) (assuming base fee surpasses threshold)
RecheckFeeHighBaseFee: math.LegacyMustNewDecFromStr("2.3"),
RecheckFeeBaseFeeThreshold: defaultMinBaseFee.Mul(math.LegacyNewDec(4)),
}
}
// SetBackupFilePath sets the backup file path for the fee state
func (e *FeeState) SetBackupFilePath(backupFilePath string) {
e.backupFilePath = backupFilePath
}
// startBlock is executed at the start of each block and is responsible for resetting the state
// of the CurBaseFee when the node reaches the reset interval
func (e *FeeState) StartBlock(logger log.Logger, height int64) {
e.currentBlockHeight = height
e.totalGasWantedThisBlock = 0
if e.CurBaseFee.Equal(math.LegacyNewDec(0)) && e.backupFilePath != "" {
// CurBaseFee has not been initialized yet. This only happens when the node has just started.
// Try to read the previous value from the backup file and if not available, set it to the default.
e.CurBaseFee = e.tryLoad(logger)
}
// we reset the CurBaseFee every ResetInterval
if height%e.ResetInterval == 0 {
e.CurBaseFee = e.DefaultBaseFee.Clone()
}
}
func (e FeeState) Clone() FeeState {
e.CurBaseFee = e.CurBaseFee.Clone()
return e
}
// DeliverTxCode runs on every transaction in the feedecorator ante handler and sums the gas of each transaction
func (e *FeeState) DeliverTxCode(ctx sdk.Context, tx sdk.FeeTx) {
if ctx.BlockHeight() != e.currentBlockHeight {
ctx.Logger().Error(
"mempool-1559: DeliverTxCode unexpected ctxBlockHeight !=currentBlockHeight",
"ctxBlockHeight", ctx.BlockHeight(),
"currentBlockHeight", e.currentBlockHeight,
)
}
e.totalGasWantedThisBlock += int64(tx.GetGas())
}
// UpdateBaseFee updates of a base fee in Osmosis.
// It employs the following equation to calculate the new base fee:
//
// baseFeeMultiplier = 1 + (gasUsed - targetGas) / targetGas * maxChangeRate
// newBaseFee = baseFee * baseFeeMultiplier
//
// UpdateBaseFee runs at the end of every block
func (e *FeeState) UpdateBaseFee(logger log.Logger, height int64) {
if height != e.currentBlockHeight {
logger.Warn(
"mempool-1559: UpdateBaseFee unexpected height != e.currentBlockHeight",
"height", height,
"e.currentBlockHeight", e.currentBlockHeight,
)
}
// N.B. we set the lastBlockHeight to height + 1 to avoid the case where block sdk submits a update proposal
// tx prior to the eip startBlock being called (which is a begin block call).
e.currentBlockHeight = height + 1
gasUsed := e.totalGasWantedThisBlock
gasDiff := gasUsed - e.TargetGas
// (gasUsed - targetGas) / targetGas * maxChangeRate
baseFeeIncrement := math.LegacyNewDec(gasDiff).Quo(math.LegacyNewDec(e.TargetGas)).Mul(e.MaxBlockChangeRate)
baseFeeMultiplier := math.LegacyNewDec(1).Add(baseFeeIncrement)
e.CurBaseFee.MulMut(baseFeeMultiplier)
// Enforce the minimum base fee by resetting the CurBaseFee is it drops below the MinBaseFee
if e.CurBaseFee.LT(e.MinBaseFee) {
e.CurBaseFee = e.MinBaseFee.Clone()
}
// Enforce the maximum base fee by resetting the CurBaseFee is it goes above the MaxBaseFee
if e.CurBaseFee.GT(e.MaxBaseFee) {
e.CurBaseFee = e.MaxBaseFee.Clone()
}
if e.backupFilePath != "" {
go e.Clone().tryPersist(logger)
}
}
// GetCurBaseFee returns a clone of the CurBaseFee to avoid overwriting the initial value in
// the FeeState, we use this in the AnteHandler to Check transactions
func (e *FeeState) GetCurBaseFee() math.LegacyDec {
return e.CurBaseFee.Clone()
}
// GetCurRecheckBaseFee returns a clone of the CurBaseFee / RecheckFeeCto account for
// rechecked transactions in the feedecorator ante handler
func (e *FeeState) GetCurRecheckBaseFee() math.LegacyDec {
baseFee := e.CurBaseFee.Clone()
// At higher base fees, we apply a smaller re-check factor.
// The reason for this is that the recheck factor forces the base fee to get at minimum
// "recheck factor" times higher than the spam rate. This leads to slow recovery
// and a bad UX for user transactions. We aim for spam to start getting evicted from the mempool
// sooner as to avoid more severe UX degradation for user transactions. Therefore,
// we apply a smaller recheck factor at higher base fees.
if baseFee.GT(e.RecheckFeeBaseFeeThreshold) {
return baseFee.QuoMut(e.RecheckFeeHighBaseFee)
}
return baseFee.QuoMut(e.RecheckFeeLowBaseFee)
}
var rwMtx = sync.Mutex{}
// tryPersist persists the eip1559 state to disk in the form of a json file
// we do this in case a node stops and it can continue functioning as normal
func (e FeeState) tryPersist(logger log.Logger) {
defer func() {
if r := recover(); r != nil {
logger.Error("mempool-1559: panic in tryPersist", "err", r)
}
}()
bz, err := json.Marshal(e)
if err != nil {
logger.Info("mempool-1559: error marshalling FeeState", "err", err)
return
}
rwMtx.Lock()
defer rwMtx.Unlock()
err = os.WriteFile(e.backupFilePath, bz, 0o644)
if err != nil {
logger.Info("mempool-1559: error writing FeeState", "err", err)
return
}
}
// tryLoad reads eip1559 state from disk and initializes the CurFeeState to
// the previous state when a node is restarted
func (e *FeeState) tryLoad(logger log.Logger) (curBaseFee math.LegacyDec) {
defer func(out *math.LegacyDec) {
if r := recover(); r != nil {
logger.Error("mempool-1559: panic in tryLoad", "err", r)
logger.Info("mempool-1559: panic in tryLoad, setting to default value",
"MinBaseFee", e.MinBaseFee.String(),
)
curBaseFee = e.MinBaseFee.Clone()
}
}(&curBaseFee)
rwMtx.Lock()
defer rwMtx.Unlock()
bz, err := os.ReadFile(e.backupFilePath)
if err != nil {
logger.Warn("mempool-1559: error reading fee state", "err", err, "backupFilePath", e.backupFilePath)
logger.Info("mempool-1559: setting fee state to default value", "MinBaseFee", e.MinBaseFee.String())
return e.MinBaseFee.Clone()
}
var loaded FeeState
err = json.Unmarshal(bz, &loaded)
if err != nil {
logger.Warn("mempool-1559: error unmarshalling fee state", "err", err, "backupFilePath", e.backupFilePath)
logger.Info("mempool-1559: setting fee state to default value", "MinBaseFee", e.MinBaseFee.String())
return e.MinBaseFee.Clone()
}
if loaded.CurBaseFee.IsZero() {
logger.Info("mempool-1559: loaded FeeState from file with CurBaseFee = 0, setting to default value",
"MinBaseFee", e.MinBaseFee.String(),
)
return e.MinBaseFee.Clone()
}
logger.Info("mempool-1559: loaded FeeState from file",
"backupFilePath", e.backupFilePath,
"CurBaseFee", loaded.CurBaseFee.String(),
)
return loaded.CurBaseFee.Clone()
}
package keeper
import (
"fmt"
"cosmossdk.io/math"
mempool1559 "github.com/InjectiveLabs/injective-core/injective-chain/modules/txfees/keeper/mempool-1559"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)
func (k *Keeper) RefreshMempool1559Parameters(ctx sdk.Context) {
params := k.GetParams(ctx)
if k.CurFeeState == nil {
ctx.Logger().Warn("txfees: mempool1559.CurFeeState is nil, setting to default")
k.CurFeeState = mempool1559.DefaultFeeState()
}
k.CurFeeState.MinBaseFee = params.MinGasPrice
k.CurFeeState.DefaultBaseFee = params.MinGasPrice.Mul(params.DefaultBaseFeeMultiplier)
k.CurFeeState.MaxBaseFee = params.MinGasPrice.Mul(params.MaxBaseFeeMultiplier)
k.CurFeeState.ResetInterval = params.ResetInterval
k.CurFeeState.MaxBlockChangeRate = params.MaxBlockChangeRate
k.CurFeeState.TargetBlockSpacePercent = params.TargetBlockSpacePercentRate
k.CurFeeState.RecheckFeeLowBaseFee = params.RecheckFeeLowBaseFee
k.CurFeeState.RecheckFeeHighBaseFee = params.RecheckFeeHighBaseFee
k.CurFeeState.RecheckFeeBaseFeeThreshold = params.MinGasPrice.Mul(params.RecheckFeeBaseFeeThresholdMultiplier)
}
// On start, we unmarshal the consensus params once and cache them.
// Then, on every block, we check if the current consensus param bytes have changed in comparison to the cached value.
// If they have, we unmarshal the current consensus params, update the target gas, and cache the value.
// This is done to improve performance by not having to fetch and unmarshal the consensus params on every block.
func (k *Keeper) CheckAndSetTargetGas(ctx sdk.Context) error {
// Check if the block gas limit has changed.
// If it has, update the target gas for eip1559.
consParams, err := k.GetConsParams(ctx)
if err != nil {
return fmt.Errorf("txfees: failed to get consensus parameters: %w", err)
}
// If cachedConsParams is empty, set equal to consParams and set the target gas.
if k.cachedConsParams.Equal(cmtproto.ConsensusParams{}) {
k.cachedConsParams = *consParams.Params
// Check if cachedConsParams.Block is nil to prevent panic
if k.cachedConsParams.Block == nil || k.cachedConsParams.Block.MaxGas <= 0 {
return nil
}
k.CurFeeState.TargetGas = k.calculateTargetGas(k.cachedConsParams.Block.MaxGas)
return nil
}
// If the consensus params have changed, check if it was maxGas that changed. If so, update the target gas.
if consParams.Params.Block.MaxGas == k.cachedConsParams.Block.MaxGas || consParams.Params.Block.MaxGas == -1 {
return nil
}
k.CurFeeState.TargetGas = k.calculateTargetGas(consParams.Params.Block.MaxGas)
k.cachedConsParams = *consParams.Params
return nil
}
func (k *Keeper) calculateTargetGas(maxGas int64) int64 {
return k.CurFeeState.TargetBlockSpacePercent.Mul(
math.LegacyNewDec(maxGas),
).TruncateInt().Int64()
}
package keeper
import (
"context"
"cosmossdk.io/errors"
"github.com/InjectiveLabs/metrics"
sdk "github.com/cosmos/cosmos-sdk/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/InjectiveLabs/injective-core/injective-chain/modules/txfees/types"
)
var _ types.MsgServer = msgServer{}
type msgServer struct {
keeper *Keeper
svcTags metrics.Tags
}
// NewMsgServerImpl returns an implementation of the bank MsgServer interface
// for the provided Keeper.
func NewMsgServerImpl(keeper *Keeper) types.MsgServer {
return &msgServer{
keeper: keeper,
svcTags: metrics.Tags{
"svc": "txfees_h",
},
}
}
func (m msgServer) UpdateParams(c context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
c, doneFn := metrics.ReportFuncCallAndTimingCtx(c, m.svcTags)
defer doneFn()
if msg.Authority != m.keeper.authority {
return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority: expected %s, got %s", m.keeper.authority, msg.Authority)
}
if err := msg.Params.Validate(); err != nil {
return nil, err
}
m.keeper.SetParams(sdk.UnwrapSDKContext(c), msg.Params)
return &types.MsgUpdateParamsResponse{}, nil
}
package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/InjectiveLabs/injective-core/injective-chain/modules/txfees/types"
"github.com/InjectiveLabs/metrics"
)
// GetParams returns the total set of oracle parameters.
func (k *Keeper) GetParams(ctx sdk.Context) types.Params {
ctx, doneFn := metrics.ReportFuncCallAndTimingSdkCtx(ctx, k.svcTags)
defer doneFn()
store := ctx.KVStore(k.storeKey)
bz := store.Get(types.ParamsKey)
if bz == nil {
return types.DefaultParams()
}
var params types.Params
k.cdc.MustUnmarshal(bz, ¶ms)
return params
}
// SetParams set the params
func (k *Keeper) SetParams(ctx sdk.Context, params types.Params) {
ctx, doneFn := metrics.ReportFuncCallAndTimingSdkCtx(ctx, k.svcTags)
defer doneFn()
store := ctx.KVStore(k.storeKey)
store.Set(types.ParamsKey, k.cdc.MustMarshal(¶ms))
}
/*
The txfees modules allows nodes to easily support many
tokens for usage as txfees, while letting node operators
only specify their tx fee parameters for a single "base" asset.
- Adds a whitelist of tokens that can be used as fees on the chain.
- Any token not on this list cannot be provided as a tx fee.
- Adds a new SDK message for creating governance proposals for adding new TxFee denoms.
*/
package txfees
import (
"context"
"encoding/json"
"fmt"
"cosmossdk.io/core/appmodule"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"
"github.com/InjectiveLabs/injective-core/injective-chain/modules/txfees/client/cli"
"github.com/InjectiveLabs/injective-core/injective-chain/modules/txfees/keeper"
"github.com/InjectiveLabs/injective-core/injective-chain/modules/txfees/types"
)
var (
_ module.AppModuleBasic = AppModuleBasic{}
_ module.HasGenesisBasics = AppModuleBasic{}
_ appmodule.AppModule = AppModule{}
_ module.HasConsensusVersion = AppModule{}
_ module.HasGenesis = AppModule{}
_ module.HasServices = AppModule{}
)
const ModuleName = types.ModuleName
// ----------------------------------------------------------------------------
// AppModuleBasic
// ----------------------------------------------------------------------------
// AppModuleBasic implements the AppModuleBasic interface for the txfees module.
type AppModuleBasic struct{}
func NewAppModuleBasic() AppModuleBasic {
return AppModuleBasic{}
}
// Name returns the txfees module's name.
func (AppModuleBasic) Name() string {
return types.ModuleName
}
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
types.RegisterLegacyAminoCodec(cdc)
}
// RegisterInterfaces registers the module's interface types.
func (AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) {
types.RegisterInterfaces(reg)
}
// DefaultGenesis returns the txfees module's default genesis state.
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
return cdc.MustMarshalJSON(types.DefaultGenesisState())
}
// ValidateGenesis performs genesis state validation for the txfee module.
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error {
var genesisState types.GenesisState
if err := cdc.UnmarshalJSON(bz, &genesisState); err != nil {
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
}
return genesisState.Validate()
}
// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil {
panic(err)
}
}
// GetTxCmd returns the txfees module's root tx command.
func (AppModuleBasic) GetTxCmd() *cobra.Command {
return nil
}
// GetQueryCmd returns the txfees module's root query command.
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd()
}
// ----------------------------------------------------------------------------
// AppModule
// ----------------------------------------------------------------------------
// AppModule implements the AppModule interface for the txfees module.
type AppModule struct {
AppModuleBasic
keeper keeper.Keeper
blockHandler *BlockHandler
}
func NewAppModule(k keeper.Keeper) AppModule {
return AppModule{
AppModuleBasic: NewAppModuleBasic(),
keeper: k,
blockHandler: NewBlockHandler(&k),
}
}
// IsAppModule implements the appmodule.AppModule interface.
func (AppModule) IsAppModule() {}
// IsOnePerModuleType is a marker function just indicates that this is a one-per-module type.
func (AppModule) IsOnePerModuleType() {}
// Name returns the txfees module's name.
func (am AppModule) Name() string {
return am.AppModuleBasic.Name()
}
// QuerierRoute returns the txfees module's query routing key.
func (AppModule) QuerierRoute() string { return types.QuerierRoute }
// RegisterServices registers a GRPC query service to respond to the
// module-specific GRPC queries.
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(&am.keeper))
types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServer(&am.keeper))
}
// RegisterInvariants registers the txfees module's invariants.
func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
// InitGenesis performs the txfees module's genesis initialization It returns
// no validator updates.
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) {
var genesisState types.GenesisState
cdc.MustUnmarshalJSON(data, &genesisState)
am.keeper.InitGenesis(ctx, genesisState)
}
// ExportGenesis returns the txfees module's exported genesis state as raw JSON bytes.
func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage {
gs := am.keeper.ExportGenesis(ctx)
return cdc.MustMarshalJSON(gs)
}
// BeginBlock executes all ABCI BeginBlock logic respective to the txfees module.
func (am AppModule) BeginBlock(ctx context.Context) error {
return am.blockHandler.BeginBlocker(sdk.UnwrapSDKContext(ctx))
}
// EndBlock executes all ABCI EndBlock logic respective to the txfees module. It
// returns no validator updates.
func (am AppModule) EndBlock(ctx context.Context) error {
am.blockHandler.EndBlocker(sdk.UnwrapSDKContext(ctx))
return nil
}
// ConsensusVersion implements AppModule/ConsensusVersion.
func (AppModule) ConsensusVersion() uint64 { return 1 }
package testtxfees
import (
"testing"
"time"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/cosmos/cosmos-sdk/client/flags"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
simapp "github.com/InjectiveLabs/injective-core/injective-chain/app"
)
type TestSuite struct {
Ctx sdk.Context
App *simapp.InjectiveApp
}
func NewTestSuite(t *testing.T) TestSuite {
t.Helper()
app := simapp.Setup(false, simtestutil.AppOptionsMap{
flags.FlagHome: t.TempDir(), // enables parallel execution of tests (wasm VM)
})
ctx := app.BaseApp.NewContextLegacy(false, tmproto.Header{
Height: 1,
Time: time.Now().UTC(),
})
t.Cleanup(func() {
simapp.Cleanup(app)
})
txfeesParams := app.TxFeesKeeper.GetParams(ctx)
txfeesParams.Mempool1559Enabled = true
app.TxFeesKeeper.SetParams(ctx, txfeesParams)
return TestSuite{
Ctx: ctx,
App: app,
}
}
package types
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authzcdc "github.com/cosmos/cosmos-sdk/x/authz/codec"
)
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgUpdateParams{}, "txfees/MsgUpdateParams", nil)
cdc.RegisterConcrete(&Params{}, "txfees/Params", nil)
}
func RegisterInterfaces(registry types.InterfaceRegistry) {
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgUpdateParams{},
)
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}
var (
ModuleCdc = codec.NewLegacyAmino()
)
func init() {
RegisterLegacyAminoCodec(ModuleCdc)
// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
sdk.RegisterLegacyAminoCodec(ModuleCdc)
RegisterLegacyAminoCodec(authzcdc.Amino)
ModuleCdc.Seal()
}
package types
// DefaultIndex is the default capability global index
const DefaultIndex uint64 = 1
func NewGenesisState() GenesisState {
return GenesisState{}
}
func (gs GenesisState) Validate() error {
return gs.Params.Validate()
}
func DefaultGenesisState() *GenesisState {
return &GenesisState{
Params: DefaultParams(),
}
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: injective/txfees/v1beta1/genesis.proto
package types
import (
fmt "fmt"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/cosmos/gogoproto/proto"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type GenesisState struct {
Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}
func (m *GenesisState) Reset() { *m = GenesisState{} }
func (m *GenesisState) String() string { return proto.CompactTextString(m) }
func (*GenesisState) ProtoMessage() {}
func (*GenesisState) Descriptor() ([]byte, []int) {
return fileDescriptor_6434836fdedde04f, []int{0}
}
func (m *GenesisState) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *GenesisState) XXX_Merge(src proto.Message) {
xxx_messageInfo_GenesisState.Merge(m, src)
}
func (m *GenesisState) XXX_Size() int {
return m.Size()
}
func (m *GenesisState) XXX_DiscardUnknown() {
xxx_messageInfo_GenesisState.DiscardUnknown(m)
}
var xxx_messageInfo_GenesisState proto.InternalMessageInfo
func (m *GenesisState) GetParams() Params {
if m != nil {
return m.Params
}
return Params{}
}
func init() {
proto.RegisterType((*GenesisState)(nil), "injective.txfees.v1beta1.GenesisState")
}
func init() {
proto.RegisterFile("injective/txfees/v1beta1/genesis.proto", fileDescriptor_6434836fdedde04f)
}
var fileDescriptor_6434836fdedde04f = []byte{
// 224 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcb, 0xcc, 0xcb, 0x4a,
0x4d, 0x2e, 0xc9, 0x2c, 0x4b, 0xd5, 0x2f, 0xa9, 0x48, 0x4b, 0x4d, 0x2d, 0xd6, 0x2f, 0x33, 0x4c,
0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca,
0x2f, 0xc9, 0x17, 0x92, 0x80, 0xab, 0xd3, 0x83, 0xa8, 0xd3, 0x83, 0xaa, 0x93, 0x52, 0xc5, 0x69,
0x02, 0x54, 0x21, 0xd8, 0x00, 0x29, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0x30, 0x53, 0x1f, 0xc4, 0x82,
0x88, 0x2a, 0xf9, 0x71, 0xf1, 0xb8, 0x43, 0xec, 0x09, 0x2e, 0x49, 0x2c, 0x49, 0x15, 0xb2, 0xe3,
0x62, 0x2b, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0x96, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x36, 0x52, 0xd0,
0xc3, 0x65, 0xaf, 0x5e, 0x00, 0x58, 0x9d, 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41, 0x50, 0x5d,
0x4e, 0x69, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84,
0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xe5, 0x93, 0x9e, 0x59,
0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0xef, 0x09, 0x33, 0xd3, 0x27, 0x31, 0xa9, 0x58,
0x1f, 0x6e, 0x83, 0x6e, 0x72, 0x7e, 0x51, 0x2a, 0x32, 0x37, 0x23, 0x31, 0x33, 0x4f, 0x3f, 0x37,
0x3f, 0xa5, 0x34, 0x27, 0xb5, 0x18, 0xe6, 0xb9, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0,
0xf3, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x7e, 0xaf, 0xdf, 0x85, 0x3f, 0x01, 0x00, 0x00,
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int {
offset -= sovGenesis(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *GenesisState) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Params.Size()
n += 1 + l + sovGenesis(uint64(l))
return n
}
func sovGenesis(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozGenesis(x uint64) (n int) {
return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *GenesisState) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: GenesisState: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthGenesis
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipGenesis(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenesis
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthGenesis
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupGenesis
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthGenesis
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
package types
import (
"errors"
"cosmossdk.io/math"
mempool1559 "github.com/InjectiveLabs/injective-core/injective-chain/modules/txfees/keeper/mempool-1559"
)
// NewParams creates a new Params instance
func NewParams() Params {
return Params{}
}
// DefaultParams returns a default set of parameters.
func DefaultParams() Params {
return Params{
MaxGasWantedPerTx: uint64(30 * 1000 * 1000),
HighGasTxThreshold: uint64(2.5 * 1000 * 1000),
MinGasPriceForHighGasTx: math.LegacyZeroDec(),
Mempool1559Enabled: false,
MinGasPrice: math.LegacyNewDec(mempool1559.DefaultMinGasPrice),
DefaultBaseFeeMultiplier: math.LegacyMustNewDecFromStr("1.5"),
MaxBaseFeeMultiplier: math.LegacyMustNewDecFromStr("1000"),
ResetInterval: 36_000,
TargetBlockSpacePercentRate: math.LegacyMustNewDecFromStr("0.625"),
RecheckFeeLowBaseFee: math.LegacyMustNewDecFromStr("3"),
RecheckFeeHighBaseFee: math.LegacyMustNewDecFromStr("2.3"),
RecheckFeeBaseFeeThresholdMultiplier: math.LegacyMustNewDecFromStr("4"),
MaxBlockChangeRate: math.LegacyMustNewDecFromStr("0.1"),
}
}
func (p Params) Validate() error {
if err := p.validateGasParameters(); err != nil {
return err
}
if err := p.validateGasPriceParameters(); err != nil {
return err
}
if err := p.validateMultipliers(); err != nil {
return err
}
return p.validateExecutionTimeParameters()
}
func (p Params) validateGasParameters() error {
if p.MaxGasWantedPerTx == 0 {
return errors.New("max_gas_wanted_per_tx must be greater than 0")
}
if p.HighGasTxThreshold == 0 {
return errors.New("high_gas_tx_threshold must be greater than 0")
}
if p.HighGasTxThreshold >= p.MaxGasWantedPerTx {
return errors.New("high_gas_tx_threshold must be less than max_gas_wanted_per_tx")
}
return nil
}
func (p Params) validateGasPriceParameters() error {
if p.MinGasPriceForHighGasTx.IsNegative() {
return errors.New("min_gas_price_for_high_gas_tx must be positive")
}
if p.MinGasPrice.IsNegative() || p.MinGasPrice.IsZero() {
return errors.New("min_gas_price must be greater than 0")
}
return nil
}
func (p Params) validateMultipliers() error {
if p.DefaultBaseFeeMultiplier.IsNegative() || p.DefaultBaseFeeMultiplier.IsZero() {
return errors.New("default_base_fee_multiplier must be greater than 0")
}
if p.DefaultBaseFeeMultiplier.LT(math.LegacyOneDec()) {
return errors.New("default_base_fee_multiplier must be greater than or equal to 1")
}
if p.MaxBaseFeeMultiplier.LT(p.DefaultBaseFeeMultiplier) {
return errors.New("max_base_fee_multiplier must be greater than or equal to default_base_fee_multiplier")
}
if p.RecheckFeeBaseFeeThresholdMultiplier.IsNegative() || p.RecheckFeeBaseFeeThresholdMultiplier.IsZero() {
return errors.New("recheck_fee_base_fee_threshold_multiplier must be greater than 0")
}
return nil
}
func (p Params) validateExecutionTimeParameters() error {
if p.ResetInterval <= 0 {
return errors.New("reset_interval must be greater than 0")
}
if p.TargetBlockSpacePercentRate.IsNegative() || p.TargetBlockSpacePercentRate.GT(math.LegacyOneDec()) {
return errors.New("target_block_space_percent_rate must be between 0 and 1")
}
if p.MaxBlockChangeRate.IsNegative() || p.MaxBlockChangeRate.GT(math.LegacyOneDec()) {
return errors.New("max_block_change_rate must be between 0 and 1")
}
return nil
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: injective/txfees/v1beta1/query.proto
package types
import (
context "context"
cosmossdk_io_math "cosmossdk.io/math"
fmt "fmt"
_ "github.com/cosmos/gogoproto/gogoproto"
grpc1 "github.com/cosmos/gogoproto/grpc"
proto "github.com/cosmos/gogoproto/proto"
_ "google.golang.org/genproto/googleapis/api/annotations"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// QueryParamsRequest is the request type for the Query/Params RPC method.
type QueryParamsRequest struct {
}
func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} }
func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryParamsRequest) ProtoMessage() {}
func (*QueryParamsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_d95f5619ed216c51, []int{0}
}
func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryParamsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryParamsRequest.Merge(m, src)
}
func (m *QueryParamsRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryParamsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo
// QueryParamsResponse is the response type for the Query/Params RPC method.
type QueryParamsResponse struct {
// params defines the parameters of the module.
Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}
func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} }
func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryParamsResponse) ProtoMessage() {}
func (*QueryParamsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_d95f5619ed216c51, []int{1}
}
func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryParamsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryParamsResponse.Merge(m, src)
}
func (m *QueryParamsResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryParamsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo
func (m *QueryParamsResponse) GetParams() Params {
if m != nil {
return m.Params
}
return Params{}
}
type QueryEipBaseFeeRequest struct {
}
func (m *QueryEipBaseFeeRequest) Reset() { *m = QueryEipBaseFeeRequest{} }
func (m *QueryEipBaseFeeRequest) String() string { return proto.CompactTextString(m) }
func (*QueryEipBaseFeeRequest) ProtoMessage() {}
func (*QueryEipBaseFeeRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_d95f5619ed216c51, []int{2}
}
func (m *QueryEipBaseFeeRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryEipBaseFeeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryEipBaseFeeRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryEipBaseFeeRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryEipBaseFeeRequest.Merge(m, src)
}
func (m *QueryEipBaseFeeRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryEipBaseFeeRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryEipBaseFeeRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryEipBaseFeeRequest proto.InternalMessageInfo
type QueryEipBaseFeeResponse struct {
BaseFee cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=base_fee,json=baseFee,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"base_fee" yaml:"base_fee"`
}
func (m *QueryEipBaseFeeResponse) Reset() { *m = QueryEipBaseFeeResponse{} }
func (m *QueryEipBaseFeeResponse) String() string { return proto.CompactTextString(m) }
func (*QueryEipBaseFeeResponse) ProtoMessage() {}
func (*QueryEipBaseFeeResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_d95f5619ed216c51, []int{3}
}
func (m *QueryEipBaseFeeResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryEipBaseFeeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryEipBaseFeeResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryEipBaseFeeResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryEipBaseFeeResponse.Merge(m, src)
}
func (m *QueryEipBaseFeeResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryEipBaseFeeResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryEipBaseFeeResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryEipBaseFeeResponse proto.InternalMessageInfo
func init() {
proto.RegisterType((*QueryParamsRequest)(nil), "injective.txfees.v1beta1.QueryParamsRequest")
proto.RegisterType((*QueryParamsResponse)(nil), "injective.txfees.v1beta1.QueryParamsResponse")
proto.RegisterType((*QueryEipBaseFeeRequest)(nil), "injective.txfees.v1beta1.QueryEipBaseFeeRequest")
proto.RegisterType((*QueryEipBaseFeeResponse)(nil), "injective.txfees.v1beta1.QueryEipBaseFeeResponse")
}
func init() {
proto.RegisterFile("injective/txfees/v1beta1/query.proto", fileDescriptor_d95f5619ed216c51)
}
var fileDescriptor_d95f5619ed216c51 = []byte{
// 447 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x4f, 0x8b, 0xd3, 0x40,
0x18, 0xc6, 0x93, 0x45, 0xab, 0x8e, 0x88, 0x30, 0x2e, 0x5a, 0xa2, 0xa4, 0x25, 0x28, 0x94, 0xc5,
0x9d, 0xb1, 0x2b, 0x78, 0xf0, 0xe0, 0x21, 0xf8, 0x07, 0xa1, 0x07, 0xb7, 0x20, 0xc8, 0x1e, 0x2c,
0x93, 0xec, 0xdb, 0x74, 0x34, 0xc9, 0xa4, 0x99, 0x49, 0x31, 0x57, 0xbf, 0x80, 0x82, 0x5f, 0xaa,
0xc7, 0x82, 0x1e, 0xc4, 0x43, 0x91, 0xd6, 0x0f, 0x20, 0x7e, 0x02, 0xe9, 0x24, 0x69, 0xb5, 0x25,
0xe8, 0xde, 0x92, 0x99, 0xdf, 0xfb, 0x3c, 0xcf, 0xfb, 0x24, 0xe8, 0x36, 0x8f, 0xdf, 0x80, 0xaf,
0xf8, 0x04, 0xa8, 0x7a, 0x37, 0x04, 0x90, 0x74, 0xd2, 0xf5, 0x40, 0xb1, 0x2e, 0x1d, 0x67, 0x90,
0xe6, 0x24, 0x49, 0x85, 0x12, 0xb8, 0xb9, 0xa6, 0x48, 0x41, 0x91, 0x92, 0xb2, 0xf6, 0x03, 0x11,
0x08, 0x0d, 0xd1, 0xd5, 0x53, 0xc1, 0x5b, 0xb7, 0x02, 0x21, 0x82, 0x10, 0x28, 0x4b, 0x38, 0x65,
0x71, 0x2c, 0x14, 0x53, 0x5c, 0xc4, 0xb2, 0xbc, 0xbd, 0x53, 0xeb, 0x59, 0x8a, 0x6b, 0xcc, 0xd9,
0x47, 0xf8, 0x78, 0x95, 0xe1, 0x05, 0x4b, 0x59, 0x24, 0xfb, 0x30, 0xce, 0x40, 0x2a, 0xe7, 0x25,
0xba, 0xf6, 0xd7, 0xa9, 0x4c, 0x44, 0x2c, 0x01, 0x3f, 0x42, 0x8d, 0x44, 0x9f, 0x34, 0xcd, 0xb6,
0xd9, 0xb9, 0x7c, 0xd4, 0x26, 0x75, 0x91, 0x49, 0x31, 0xe9, 0x9e, 0x9b, 0xce, 0x5b, 0x46, 0xbf,
0x9c, 0x72, 0x9a, 0xe8, 0xba, 0x96, 0x7d, 0xc2, 0x13, 0x97, 0x49, 0x78, 0x0a, 0x50, 0x19, 0x86,
0xe8, 0xc6, 0xce, 0x4d, 0x69, 0x7a, 0x8c, 0x2e, 0x7a, 0x4c, 0xc2, 0x60, 0x08, 0xa0, 0x6d, 0x2f,
0xb9, 0x0f, 0x56, 0xa2, 0xdf, 0xe6, 0xad, 0x9b, 0xbe, 0x90, 0x91, 0x90, 0xf2, 0xf4, 0x2d, 0xe1,
0x82, 0x46, 0x4c, 0x8d, 0x48, 0x0f, 0x02, 0xe6, 0xe7, 0x8f, 0xc1, 0xff, 0x35, 0x6f, 0x5d, 0xcd,
0x59, 0x14, 0x3e, 0x74, 0xaa, 0x61, 0xa7, 0x7f, 0xc1, 0x2b, 0xa4, 0x8f, 0x7e, 0xee, 0xa1, 0xf3,
0xda, 0x0e, 0x7f, 0x30, 0x51, 0xa3, 0x88, 0x8a, 0xef, 0xd6, 0x2f, 0xb3, 0xdb, 0x90, 0x75, 0xf8,
0x9f, 0x74, 0xb1, 0x84, 0xd3, 0x79, 0xff, 0xf9, 0xc7, 0xa7, 0x3d, 0x07, 0xb7, 0x69, 0xed, 0x67,
0x29, 0x3a, 0xc2, 0x5f, 0x4c, 0x74, 0xe5, 0x19, 0xa8, 0x4d, 0x11, 0xf8, 0xde, 0x3f, 0xac, 0x76,
0xda, 0xb4, 0xba, 0x67, 0x98, 0x28, 0x03, 0xbe, 0xd6, 0x01, 0x5f, 0x9d, 0x1c, 0xe0, 0x0e, 0xd5,
0xad, 0x72, 0xb9, 0x1d, 0xd0, 0xcf, 0xd2, 0x01, 0xf0, 0x64, 0x50, 0x15, 0x8a, 0x0f, 0xea, 0x97,
0xd9, 0x66, 0xdd, 0xe1, 0x74, 0x61, 0x9b, 0xb3, 0x85, 0x6d, 0x7e, 0x5f, 0xd8, 0xe6, 0xc7, 0xa5,
0x6d, 0xcc, 0x96, 0xb6, 0xf1, 0x75, 0x69, 0x1b, 0x27, 0xbd, 0x80, 0xab, 0x51, 0xe6, 0x11, 0x5f,
0x44, 0xf4, 0x79, 0xa5, 0xd7, 0x63, 0x9e, 0xdc, 0xa8, 0x1f, 0xfa, 0x22, 0x85, 0x3f, 0x5f, 0x47,
0x8c, 0xc7, 0x34, 0x12, 0xa7, 0x59, 0x08, 0xeb, 0x98, 0x2a, 0x4f, 0x40, 0x7a, 0x0d, 0xfd, 0x5b,
0xdf, 0xff, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xf4, 0xc3, 0x42, 0xd5, 0x73, 0x03, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// 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.
type QueryClient interface {
// Params defines a gRPC query method that returns the tokenfactory module's
// parameters.
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
// Returns the current fee market EIP fee.
GetEipBaseFee(ctx context.Context, in *QueryEipBaseFeeRequest, opts ...grpc.CallOption) (*QueryEipBaseFeeResponse, error)
}
type queryClient struct {
cc grpc1.ClientConn
}
func NewQueryClient(cc grpc1.ClientConn) QueryClient {
return &queryClient{cc}
}
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
out := new(QueryParamsResponse)
err := c.cc.Invoke(ctx, "/injective.txfees.v1beta1.Query/Params", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GetEipBaseFee(ctx context.Context, in *QueryEipBaseFeeRequest, opts ...grpc.CallOption) (*QueryEipBaseFeeResponse, error) {
out := new(QueryEipBaseFeeResponse)
err := c.cc.Invoke(ctx, "/injective.txfees.v1beta1.Query/GetEipBaseFee", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service.
type QueryServer interface {
// Params defines a gRPC query method that returns the tokenfactory module's
// parameters.
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
// Returns the current fee market EIP fee.
GetEipBaseFee(context.Context, *QueryEipBaseFeeRequest) (*QueryEipBaseFeeResponse, error)
}
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}
func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
}
func (*UnimplementedQueryServer) GetEipBaseFee(ctx context.Context, req *QueryEipBaseFeeRequest) (*QueryEipBaseFeeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetEipBaseFee not implemented")
}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv)
}
func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryParamsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Params(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/injective.txfees.v1beta1.Query/Params",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GetEipBaseFee_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryEipBaseFeeRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GetEipBaseFee(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/injective.txfees.v1beta1.Query/GetEipBaseFee",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GetEipBaseFee(ctx, req.(*QueryEipBaseFeeRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "injective.txfees.v1beta1.Query",
HandlerType: (*QueryServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Params",
Handler: _Query_Params_Handler,
},
{
MethodName: "GetEipBaseFee",
Handler: _Query_GetEipBaseFee_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "injective/txfees/v1beta1/query.proto",
}
func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func (m *QueryEipBaseFeeRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryEipBaseFeeRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryEipBaseFeeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryEipBaseFeeResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryEipBaseFeeResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryEipBaseFeeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size := m.BaseFee.Size()
i -= size
if _, err := m.BaseFee.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
offset -= sovQuery(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *QueryParamsRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryParamsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.Params.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
func (m *QueryEipBaseFeeRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryEipBaseFeeResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.BaseFee.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozQuery(x uint64) (n int) {
return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryEipBaseFeeRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryEipBaseFeeRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryEipBaseFeeRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryEipBaseFeeResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryEipBaseFeeResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryEipBaseFeeResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BaseFee", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.BaseFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipQuery(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowQuery
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowQuery
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowQuery
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthQuery
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupQuery
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthQuery
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: injective/txfees/v1beta1/query.proto
/*
Package types is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package types
import (
"context"
"io"
"net/http"
"github.com/golang/protobuf/descriptor"
"github.com/golang/protobuf/proto"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/grpc-ecosystem/grpc-gateway/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
)
// Suppress "imported and not used" errors
var _ codes.Code
var _ io.Reader
var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = descriptor.ForMessage
var _ = metadata.Join
func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryParamsRequest
var metadata runtime.ServerMetadata
msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryParamsRequest
var metadata runtime.ServerMetadata
msg, err := server.Params(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_GetEipBaseFee_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryEipBaseFeeRequest
var metadata runtime.ServerMetadata
msg, err := client.GetEipBaseFee(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_GetEipBaseFee_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryEipBaseFeeRequest
var metadata runtime.ServerMetadata
msg, err := server.GetEipBaseFee(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_GetEipBaseFee_1(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryEipBaseFeeRequest
var metadata runtime.ServerMetadata
msg, err := client.GetEipBaseFee(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_GetEipBaseFee_1(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryEipBaseFeeRequest
var metadata runtime.ServerMetadata
msg, err := server.GetEipBaseFee(ctx, &protoReq)
return msg, metadata, err
}
// 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 RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetEipBaseFee_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_GetEipBaseFee_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GetEipBaseFee_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetEipBaseFee_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_GetEipBaseFee_1(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GetEipBaseFee_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.Dial(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterQueryHandler(ctx, mux, conn)
}
// RegisterQueryHandler registers the http handlers for service Query to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn))
}
// 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 RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error {
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetEipBaseFee_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_GetEipBaseFee_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GetEipBaseFee_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_GetEipBaseFee_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_GetEipBaseFee_1(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_GetEipBaseFee_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"injective", "txfees", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_GetEipBaseFee_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"injective", "txfees", "v1beta1", "cur_eip_base_fee"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_GetEipBaseFee_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"osmosis", "txfees", "v1beta1", "cur_eip_base_fee"}, "", runtime.AssumeColonVerbOpt(false)))
)
var (
forward_Query_Params_0 = runtime.ForwardResponseMessage
forward_Query_GetEipBaseFee_0 = runtime.ForwardResponseMessage
forward_Query_GetEipBaseFee_1 = runtime.ForwardResponseMessage
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: injective/txfees/v1beta1/tx.proto
package types
import (
context "context"
fmt "fmt"
_ "github.com/cosmos/cosmos-proto"
_ "github.com/cosmos/cosmos-sdk/types/msgservice"
_ "github.com/cosmos/cosmos-sdk/types/tx/amino"
_ "github.com/cosmos/gogoproto/gogoproto"
grpc1 "github.com/cosmos/gogoproto/grpc"
proto "github.com/cosmos/gogoproto/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type MsgUpdateParams struct {
// authority is the address of the governance account.
Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
// params defines the ocr parameters to update.
//
// NOTE: All parameters must be supplied.
Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"`
}
func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} }
func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateParams) ProtoMessage() {}
func (*MsgUpdateParams) Descriptor() ([]byte, []int) {
return fileDescriptor_b294b9f8d0e0a6fb, []int{0}
}
func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateParams) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateParams.Merge(m, src)
}
func (m *MsgUpdateParams) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateParams) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo
func (m *MsgUpdateParams) GetAuthority() string {
if m != nil {
return m.Authority
}
return ""
}
func (m *MsgUpdateParams) GetParams() Params {
if m != nil {
return m.Params
}
return Params{}
}
type MsgUpdateParamsResponse struct {
}
func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} }
func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateParamsResponse) ProtoMessage() {}
func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_b294b9f8d0e0a6fb, []int{1}
}
func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src)
}
func (m *MsgUpdateParamsResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo
func init() {
proto.RegisterType((*MsgUpdateParams)(nil), "injective.txfees.v1beta1.MsgUpdateParams")
proto.RegisterType((*MsgUpdateParamsResponse)(nil), "injective.txfees.v1beta1.MsgUpdateParamsResponse")
}
func init() { proto.RegisterFile("injective/txfees/v1beta1/tx.proto", fileDescriptor_b294b9f8d0e0a6fb) }
var fileDescriptor_b294b9f8d0e0a6fb = []byte{
// 370 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcc, 0xcc, 0xcb, 0x4a,
0x4d, 0x2e, 0xc9, 0x2c, 0x4b, 0xd5, 0x2f, 0xa9, 0x48, 0x4b, 0x4d, 0x2d, 0xd6, 0x2f, 0x33, 0x4c,
0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x80,
0x2b, 0xd1, 0x83, 0x28, 0xd1, 0x83, 0x2a, 0x91, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, 0xd2,
0x07, 0xb1, 0x20, 0xea, 0xa5, 0xc4, 0x93, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0xf5, 0x73, 0x8b, 0xd3,
0xf5, 0xcb, 0x0c, 0x41, 0x14, 0x54, 0x42, 0x12, 0x22, 0x11, 0x0f, 0xd1, 0x01, 0xe1, 0x40, 0xa5,
0x54, 0xf1, 0x38, 0x03, 0x6c, 0x25, 0x44, 0x99, 0x60, 0x62, 0x6e, 0x66, 0x5e, 0xbe, 0x3e, 0x98,
0x84, 0x08, 0x29, 0x6d, 0x61, 0xe4, 0xe2, 0xf7, 0x2d, 0x4e, 0x0f, 0x2d, 0x48, 0x49, 0x2c, 0x49,
0x0d, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0x16, 0x32, 0xe3, 0xe2, 0x4c, 0x2c, 0x2d, 0xc9, 0xc8, 0x2f,
0xca, 0x2c, 0xa9, 0x94, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x74, 0x92, 0xb8, 0xb4, 0x45, 0x57, 0x04,
0x6a, 0xa5, 0x63, 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0x71, 0x70, 0x49, 0x51, 0x66, 0x5e, 0x7a, 0x10,
0x42, 0xa9, 0x90, 0x1d, 0x17, 0x5b, 0x01, 0xd8, 0x04, 0x09, 0x26, 0x05, 0x46, 0x0d, 0x6e, 0x23,
0x05, 0x3d, 0x5c, 0x5e, 0xd7, 0x83, 0xd8, 0xe4, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x54,
0x97, 0x95, 0x66, 0xd3, 0xf3, 0x0d, 0x5a, 0x08, 0xf3, 0xba, 0x9e, 0x6f, 0xd0, 0x12, 0x83, 0x7a,
0x07, 0xcd, 0x89, 0x4a, 0x92, 0x5c, 0xe2, 0x68, 0x42, 0x41, 0xa9, 0xc5, 0x05, 0xf9, 0x79, 0xc5,
0xa9, 0x46, 0x55, 0x5c, 0xcc, 0xbe, 0xc5, 0xe9, 0x42, 0x39, 0x5c, 0x3c, 0x28, 0x9e, 0xd2, 0xc4,
0xed, 0x18, 0x34, 0x93, 0xa4, 0x0c, 0x89, 0x56, 0x0a, 0xb3, 0x54, 0x8a, 0xb5, 0xe1, 0xf9, 0x06,
0x2d, 0x46, 0xa7, 0xb4, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e,
0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xf2, 0x49,
0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0xf7, 0x84, 0x99, 0xee, 0x93, 0x98,
0x54, 0xac, 0x0f, 0xb7, 0x4b, 0x37, 0x39, 0xbf, 0x28, 0x15, 0x99, 0x9b, 0x91, 0x98, 0x99, 0xa7,
0x9f, 0x9b, 0x9f, 0x52, 0x9a, 0x93, 0x5a, 0x0c, 0x8b, 0xd7, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24,
0x36, 0x70, 0xe4, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x88, 0xec, 0x61, 0xb3, 0x7f, 0x02,
0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// 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.
type MsgClient interface {
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
}
type msgClient struct {
cc grpc1.ClientConn
}
func NewMsgClient(cc grpc1.ClientConn) MsgClient {
return &msgClient{cc}
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, "/injective.txfees.v1beta1.Msg/UpdateParams", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
type MsgServer interface {
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateParams(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/injective.txfees.v1beta1.Msg/UpdateParams",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams))
}
return interceptor(ctx, in, info, handler)
}
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "injective.txfees.v1beta1.Msg",
HandlerType: (*MsgServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "injective/txfees/v1beta1/tx.proto",
}
func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
if len(m.Authority) > 0 {
i -= len(m.Authority)
copy(dAtA[i:], m.Authority)
i = encodeVarintTx(dAtA, i, uint64(len(m.Authority)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *MsgUpdateParams) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Authority)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = m.Params.Size()
n += 1 + l + sovTx(uint64(l))
return n
}
func (m *MsgUpdateParamsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozTx(x uint64) (n int) {
return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Authority = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTx
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthTx
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupTx
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthTx
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowTx = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: injective/txfees/v1beta1/txfees.proto
package types
import (
cosmossdk_io_math "cosmossdk.io/math"
fmt "fmt"
_ "github.com/cosmos/cosmos-sdk/types/tx/amino"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/cosmos/gogoproto/proto"
golang_proto "github.com/golang/protobuf/proto"
_ "google.golang.org/genproto/googleapis/api/annotations"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = golang_proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type Params struct {
MaxGasWantedPerTx uint64 `protobuf:"varint,1,opt,name=max_gas_wanted_per_tx,json=maxGasWantedPerTx,proto3" json:"max_gas_wanted_per_tx,omitempty" yaml:"max_gas_wanted_per_tx"`
HighGasTxThreshold uint64 `protobuf:"varint,2,opt,name=high_gas_tx_threshold,json=highGasTxThreshold,proto3" json:"high_gas_tx_threshold,omitempty" yaml:"high_gas_tx_threshold"`
MinGasPriceForHighGasTx cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=min_gas_price_for_high_gas_tx,json=minGasPriceForHighGasTx,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"min_gas_price_for_high_gas_tx" yaml:"min_gas_price_for_high_gas_tx"`
Mempool1559Enabled bool `protobuf:"varint,4,opt,name=mempool1559_enabled,json=mempool1559Enabled,proto3" json:"mempool1559_enabled,omitempty" yaml:"mempool_1559_enabled"`
MinGasPrice cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=min_gas_price,json=minGasPrice,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"min_gas_price" yaml:"min_gas_price"`
DefaultBaseFeeMultiplier cosmossdk_io_math.LegacyDec `protobuf:"bytes,6,opt,name=default_base_fee_multiplier,json=defaultBaseFeeMultiplier,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"default_base_fee_multiplier" yaml:"default_base_fee_multiplier"`
MaxBaseFeeMultiplier cosmossdk_io_math.LegacyDec `protobuf:"bytes,7,opt,name=max_base_fee_multiplier,json=maxBaseFeeMultiplier,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"max_base_fee_multiplier" yaml:"max_base_fee_multiplier"`
ResetInterval int64 `protobuf:"varint,8,opt,name=reset_interval,json=resetInterval,proto3" json:"reset_interval,omitempty" yaml:"reset_interval"`
MaxBlockChangeRate cosmossdk_io_math.LegacyDec `protobuf:"bytes,9,opt,name=max_block_change_rate,json=maxBlockChangeRate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"max_block_change_rate" yaml:"max_block_change_rate"`
TargetBlockSpacePercentRate cosmossdk_io_math.LegacyDec `protobuf:"bytes,10,opt,name=target_block_space_percent_rate,json=targetBlockSpacePercentRate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"target_block_space_percent_rate" yaml:"target_block_space_percent_rate"`
RecheckFeeLowBaseFee cosmossdk_io_math.LegacyDec `protobuf:"bytes,11,opt,name=recheck_fee_low_base_fee,json=recheckFeeLowBaseFee,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"recheck_fee_low_base_fee" yaml:"recheck_fee_low_base_fee"`
RecheckFeeHighBaseFee cosmossdk_io_math.LegacyDec `protobuf:"bytes,12,opt,name=recheck_fee_high_base_fee,json=recheckFeeHighBaseFee,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"recheck_fee_high_base_fee" yaml:"recheck_fee_high_base_fee"`
RecheckFeeBaseFeeThresholdMultiplier cosmossdk_io_math.LegacyDec `protobuf:"bytes,13,opt,name=recheck_fee_base_fee_threshold_multiplier,json=recheckFeeBaseFeeThresholdMultiplier,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"recheck_fee_base_fee_threshold_multiplier" yaml:"recheck_fee_base_fee_threshold_multiplier"`
}
func (m *Params) Reset() { *m = Params{} }
func (m *Params) String() string { return proto.CompactTextString(m) }
func (*Params) ProtoMessage() {}
func (*Params) Descriptor() ([]byte, []int) {
return fileDescriptor_43abc7238d07d36b, []int{0}
}
func (m *Params) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Params.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Params) XXX_Merge(src proto.Message) {
xxx_messageInfo_Params.Merge(m, src)
}
func (m *Params) XXX_Size() int {
return m.Size()
}
func (m *Params) XXX_DiscardUnknown() {
xxx_messageInfo_Params.DiscardUnknown(m)
}
var xxx_messageInfo_Params proto.InternalMessageInfo
func (m *Params) GetMaxGasWantedPerTx() uint64 {
if m != nil {
return m.MaxGasWantedPerTx
}
return 0
}
func (m *Params) GetHighGasTxThreshold() uint64 {
if m != nil {
return m.HighGasTxThreshold
}
return 0
}
func (m *Params) GetMempool1559Enabled() bool {
if m != nil {
return m.Mempool1559Enabled
}
return false
}
func (m *Params) GetResetInterval() int64 {
if m != nil {
return m.ResetInterval
}
return 0
}
func init() {
proto.RegisterType((*Params)(nil), "injective.txfees.v1beta1.Params")
golang_proto.RegisterType((*Params)(nil), "injective.txfees.v1beta1.Params")
}
func init() {
proto.RegisterFile("injective/txfees/v1beta1/txfees.proto", fileDescriptor_43abc7238d07d36b)
}
func init() {
golang_proto.RegisterFile("injective/txfees/v1beta1/txfees.proto", fileDescriptor_43abc7238d07d36b)
}
var fileDescriptor_43abc7238d07d36b = []byte{
// 790 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x95, 0xb1, 0x6f, 0xfb, 0x44,
0x14, 0xc7, 0x63, 0x7e, 0x3f, 0x4a, 0xeb, 0x36, 0x48, 0x35, 0x09, 0x75, 0x9b, 0x62, 0x47, 0x56,
0x41, 0x01, 0x89, 0x98, 0x0a, 0x75, 0xa0, 0x2c, 0x28, 0xa5, 0x09, 0x15, 0xa9, 0x14, 0xb9, 0x95,
0x2a, 0xb1, 0x9c, 0x2e, 0xce, 0x8b, 0xed, 0xd6, 0xf6, 0x59, 0xbe, 0x4b, 0xea, 0x4a, 0x08, 0x89,
0x0d, 0xc1, 0x82, 0xc4, 0xc6, 0xc4, 0x9f, 0xd0, 0x3f, 0x81, 0xb1, 0x63, 0x47, 0xc4, 0x10, 0xa1,
0x66, 0x80, 0x39, 0x7f, 0x01, 0xf2, 0xd9, 0x71, 0x5c, 0x12, 0x15, 0x2f, 0x51, 0xee, 0xbd, 0xef,
0x7d, 0xef, 0x73, 0xbe, 0x7b, 0xf7, 0xc4, 0xf7, 0x1d, 0xff, 0x1a, 0x4c, 0xe6, 0x8c, 0x41, 0x67,
0xd1, 0x10, 0x80, 0xea, 0xe3, 0xc3, 0x3e, 0x30, 0x7c, 0x98, 0x0e, 0x9b, 0x41, 0x48, 0x18, 0x91,
0xe4, 0x4c, 0xd6, 0x4c, 0xe3, 0xa9, 0x6c, 0xaf, 0x62, 0x11, 0x8b, 0x70, 0x91, 0x1e, 0xff, 0x4b,
0xf4, 0x7b, 0xfb, 0x16, 0x21, 0x96, 0x0b, 0x3a, 0x0e, 0x1c, 0x1d, 0xfb, 0x3e, 0x61, 0x98, 0x39,
0xc4, 0x4f, 0xdd, 0xf6, 0xb6, 0xb1, 0xe7, 0xf8, 0x44, 0xe7, 0xbf, 0x49, 0x48, 0xfb, 0x75, 0x4b,
0x5c, 0xeb, 0xe1, 0x10, 0x7b, 0x54, 0x32, 0xc4, 0xaa, 0x87, 0x23, 0x64, 0x61, 0x8a, 0x6e, 0xb1,
0xcf, 0x60, 0x80, 0x02, 0x08, 0x11, 0x8b, 0x64, 0xa1, 0x2e, 0x34, 0x5e, 0xb7, 0xea, 0xb3, 0x89,
0xba, 0x7f, 0x87, 0x3d, 0xf7, 0x58, 0x5b, 0x29, 0xd3, 0x8c, 0x6d, 0x0f, 0x47, 0x1d, 0x4c, 0xaf,
0x78, 0xb4, 0x07, 0xe1, 0x65, 0x24, 0x5d, 0x88, 0x55, 0xdb, 0xb1, 0x6c, 0xae, 0x66, 0x11, 0x62,
0x76, 0x08, 0xd4, 0x26, 0xee, 0x40, 0x7e, 0xe3, 0xbf, 0x9e, 0x2b, 0x65, 0x9a, 0x21, 0xc5, 0xf1,
0x0e, 0xa6, 0x97, 0xd1, 0xe5, 0x3c, 0x28, 0xfd, 0x24, 0x88, 0xef, 0x79, 0x8e, 0xcf, 0xd5, 0x41,
0xe8, 0x98, 0x80, 0x86, 0x24, 0x44, 0x39, 0x03, 0xf9, 0x55, 0x5d, 0x68, 0x6c, 0xb4, 0xbe, 0x7e,
0x98, 0xa8, 0xa5, 0x3f, 0x27, 0x6a, 0xcd, 0x24, 0xd4, 0x23, 0x94, 0x0e, 0x6e, 0x9a, 0x0e, 0xd1,
0x3d, 0xcc, 0xec, 0x66, 0x17, 0x2c, 0x6c, 0xde, 0x7d, 0x09, 0xe6, 0x6c, 0xa2, 0x1e, 0xa4, 0x9b,
0x7a, 0xc9, 0x51, 0x33, 0x76, 0x3c, 0xc7, 0xef, 0x60, 0xda, 0x8b, 0xb3, 0x6d, 0x12, 0x7e, 0x35,
0xc7, 0x92, 0x7a, 0xe2, 0x3b, 0x1e, 0x78, 0x01, 0x21, 0xee, 0xe1, 0xd1, 0xd1, 0x67, 0x08, 0x7c,
0xdc, 0x77, 0x61, 0x20, 0xbf, 0xae, 0x0b, 0x8d, 0xf5, 0x96, 0x3a, 0x9b, 0xa8, 0xb5, 0xd4, 0x3f,
0x11, 0xa1, 0xbc, 0x4a, 0x33, 0xa4, 0xdc, 0xdc, 0xd3, 0x24, 0x28, 0x21, 0xb1, 0xfc, 0x0c, 0x46,
0x7e, 0x93, 0x6f, 0xe7, 0xf3, 0x62, 0xdb, 0xa9, 0xac, 0xd8, 0x8e, 0x66, 0x6c, 0xe6, 0xf0, 0xa5,
0x1f, 0x04, 0xb1, 0x36, 0x80, 0x21, 0x1e, 0xb9, 0x0c, 0xf5, 0x31, 0x05, 0x34, 0x04, 0x40, 0xde,
0xc8, 0x65, 0x4e, 0xe0, 0x3a, 0x10, 0xca, 0x6b, 0x7c, 0xbd, 0xb3, 0x62, 0xeb, 0x69, 0xc9, 0x7a,
0x2f, 0xf8, 0x69, 0x86, 0x9c, 0x66, 0x5b, 0x98, 0x42, 0x1b, 0xe0, 0x3c, 0x4b, 0x49, 0xdf, 0x8a,
0x3b, 0xf1, 0x6d, 0x5a, 0x45, 0xf1, 0x16, 0xa7, 0x38, 0x2d, 0x46, 0xa1, 0x2c, 0x6e, 0xe6, 0x4a,
0x82, 0x8a, 0x87, 0xa3, 0xe5, 0xd5, 0xbf, 0x10, 0xdf, 0x0e, 0x81, 0x02, 0x43, 0x8e, 0xcf, 0x20,
0x1c, 0x63, 0x57, 0x5e, 0xaf, 0x0b, 0x8d, 0x57, 0xad, 0xdd, 0xd9, 0x44, 0xad, 0x26, 0x8e, 0xcf,
0xf3, 0x9a, 0x51, 0xe6, 0x81, 0xb3, 0x74, 0x2c, 0x8d, 0x93, 0xa2, 0xe9, 0xbb, 0xc4, 0xbc, 0x41,
0xa6, 0x8d, 0x7d, 0x0b, 0x50, 0x88, 0x19, 0xc8, 0x1b, 0x9c, 0xfe, 0xa4, 0x18, 0x7d, 0xae, 0xae,
0x96, 0x9c, 0xe2, 0x3b, 0x82, 0xa3, 0x56, 0x1c, 0x3e, 0xe1, 0x51, 0x03, 0x33, 0x90, 0x7e, 0x11,
0x44, 0x95, 0xe1, 0xd0, 0x02, 0x96, 0xce, 0xa0, 0x01, 0x36, 0x21, 0x2e, 0x45, 0x13, 0x7c, 0x96,
0x20, 0x88, 0x1c, 0xe1, 0xbc, 0x18, 0xc2, 0x07, 0x09, 0xc2, 0xff, 0x78, 0x6a, 0x46, 0x2d, 0x51,
0x70, 0x9e, 0x8b, 0x38, 0xdf, 0x4b, 0xd2, 0x9c, 0xea, 0x3b, 0x51, 0x0e, 0xc1, 0xb4, 0xc1, 0xbc,
0xe1, 0x07, 0xe0, 0x92, 0xdb, 0xec, 0x34, 0xe4, 0x4d, 0x4e, 0xd3, 0x2e, 0x46, 0xa3, 0xce, 0x3f,
0xfe, 0x6a, 0x33, 0xcd, 0xa8, 0xa4, 0xa9, 0x36, 0x40, 0x97, 0xdc, 0xa6, 0x27, 0x2b, 0x7d, 0x2f,
0x88, 0xbb, 0xf9, 0x39, 0xbc, 0x82, 0x33, 0x82, 0x2d, 0x4e, 0xd0, 0x29, 0x46, 0x50, 0x5f, 0x26,
0x78, 0xe6, 0xa6, 0x19, 0xd5, 0x05, 0x42, 0xfc, 0x1a, 0xcc, 0x19, 0xee, 0x05, 0xf1, 0xc3, 0xfc,
0xac, 0xec, 0x3a, 0x66, 0xaf, 0x5a, 0xfe, 0x92, 0x97, 0x39, 0xd3, 0x55, 0x31, 0xa6, 0x4f, 0x96,
0x99, 0x5e, 0x74, 0xd7, 0x8c, 0x83, 0x05, 0x63, 0xca, 0x97, 0x3d, 0xa3, 0x8b, 0x32, 0x38, 0x7e,
0xf7, 0x9f, 0xdf, 0x54, 0xe1, 0xc7, 0xbf, 0xef, 0x3f, 0x2a, 0xa7, 0xbd, 0x28, 0xe9, 0x08, 0xad,
0xeb, 0x87, 0x27, 0x45, 0x78, 0x7c, 0x52, 0x84, 0xbf, 0x9e, 0x14, 0xe1, 0xe7, 0xa9, 0x52, 0xfa,
0x7d, 0xaa, 0x08, 0x8f, 0x53, 0xa5, 0xf4, 0xc7, 0x54, 0x29, 0x7d, 0xd3, 0xb5, 0x1c, 0x66, 0x8f,
0xfa, 0x4d, 0x93, 0x78, 0xfa, 0xd9, 0xbc, 0x4d, 0x75, 0x71, 0x9f, 0xea, 0x59, 0xd3, 0xfa, 0xd8,
0x24, 0x21, 0xe4, 0x87, 0x36, 0x76, 0x7c, 0xdd, 0x23, 0x83, 0x91, 0x0b, 0x74, 0xde, 0xf8, 0xd8,
0x5d, 0x00, 0xb4, 0xbf, 0xc6, 0xfb, 0xd1, 0xa7, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x6e, 0x36,
0xab, 0xee, 0x19, 0x07, 0x00, 0x00,
}
func (this *Params) Equal(that interface{}) bool {
if that == nil {
return this == nil
}
that1, ok := that.(*Params)
if !ok {
that2, ok := that.(Params)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return false
}
if this.MaxGasWantedPerTx != that1.MaxGasWantedPerTx {
return false
}
if this.HighGasTxThreshold != that1.HighGasTxThreshold {
return false
}
if !this.MinGasPriceForHighGasTx.Equal(that1.MinGasPriceForHighGasTx) {
return false
}
if this.Mempool1559Enabled != that1.Mempool1559Enabled {
return false
}
if !this.MinGasPrice.Equal(that1.MinGasPrice) {
return false
}
if !this.DefaultBaseFeeMultiplier.Equal(that1.DefaultBaseFeeMultiplier) {
return false
}
if !this.MaxBaseFeeMultiplier.Equal(that1.MaxBaseFeeMultiplier) {
return false
}
if this.ResetInterval != that1.ResetInterval {
return false
}
if !this.MaxBlockChangeRate.Equal(that1.MaxBlockChangeRate) {
return false
}
if !this.TargetBlockSpacePercentRate.Equal(that1.TargetBlockSpacePercentRate) {
return false
}
if !this.RecheckFeeLowBaseFee.Equal(that1.RecheckFeeLowBaseFee) {
return false
}
if !this.RecheckFeeHighBaseFee.Equal(that1.RecheckFeeHighBaseFee) {
return false
}
if !this.RecheckFeeBaseFeeThresholdMultiplier.Equal(that1.RecheckFeeBaseFeeThresholdMultiplier) {
return false
}
return true
}
func (m *Params) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Params) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size := m.RecheckFeeBaseFeeThresholdMultiplier.Size()
i -= size
if _, err := m.RecheckFeeBaseFeeThresholdMultiplier.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintTxfees(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x6a
{
size := m.RecheckFeeHighBaseFee.Size()
i -= size
if _, err := m.RecheckFeeHighBaseFee.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintTxfees(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x62
{
size := m.RecheckFeeLowBaseFee.Size()
i -= size
if _, err := m.RecheckFeeLowBaseFee.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintTxfees(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x5a
{
size := m.TargetBlockSpacePercentRate.Size()
i -= size
if _, err := m.TargetBlockSpacePercentRate.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintTxfees(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x52
{
size := m.MaxBlockChangeRate.Size()
i -= size
if _, err := m.MaxBlockChangeRate.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintTxfees(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x4a
if m.ResetInterval != 0 {
i = encodeVarintTxfees(dAtA, i, uint64(m.ResetInterval))
i--
dAtA[i] = 0x40
}
{
size := m.MaxBaseFeeMultiplier.Size()
i -= size
if _, err := m.MaxBaseFeeMultiplier.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintTxfees(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x3a
{
size := m.DefaultBaseFeeMultiplier.Size()
i -= size
if _, err := m.DefaultBaseFeeMultiplier.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintTxfees(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
{
size := m.MinGasPrice.Size()
i -= size
if _, err := m.MinGasPrice.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintTxfees(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x2a
if m.Mempool1559Enabled {
i--
if m.Mempool1559Enabled {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x20
}
{
size := m.MinGasPriceForHighGasTx.Size()
i -= size
if _, err := m.MinGasPriceForHighGasTx.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintTxfees(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
if m.HighGasTxThreshold != 0 {
i = encodeVarintTxfees(dAtA, i, uint64(m.HighGasTxThreshold))
i--
dAtA[i] = 0x10
}
if m.MaxGasWantedPerTx != 0 {
i = encodeVarintTxfees(dAtA, i, uint64(m.MaxGasWantedPerTx))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintTxfees(dAtA []byte, offset int, v uint64) int {
offset -= sovTxfees(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *Params) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.MaxGasWantedPerTx != 0 {
n += 1 + sovTxfees(uint64(m.MaxGasWantedPerTx))
}
if m.HighGasTxThreshold != 0 {
n += 1 + sovTxfees(uint64(m.HighGasTxThreshold))
}
l = m.MinGasPriceForHighGasTx.Size()
n += 1 + l + sovTxfees(uint64(l))
if m.Mempool1559Enabled {
n += 2
}
l = m.MinGasPrice.Size()
n += 1 + l + sovTxfees(uint64(l))
l = m.DefaultBaseFeeMultiplier.Size()
n += 1 + l + sovTxfees(uint64(l))
l = m.MaxBaseFeeMultiplier.Size()
n += 1 + l + sovTxfees(uint64(l))
if m.ResetInterval != 0 {
n += 1 + sovTxfees(uint64(m.ResetInterval))
}
l = m.MaxBlockChangeRate.Size()
n += 1 + l + sovTxfees(uint64(l))
l = m.TargetBlockSpacePercentRate.Size()
n += 1 + l + sovTxfees(uint64(l))
l = m.RecheckFeeLowBaseFee.Size()
n += 1 + l + sovTxfees(uint64(l))
l = m.RecheckFeeHighBaseFee.Size()
n += 1 + l + sovTxfees(uint64(l))
l = m.RecheckFeeBaseFeeThresholdMultiplier.Size()
n += 1 + l + sovTxfees(uint64(l))
return n
}
func sovTxfees(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozTxfees(x uint64) (n int) {
return sovTxfees(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Params) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTxfees
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Params: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field MaxGasWantedPerTx", wireType)
}
m.MaxGasWantedPerTx = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTxfees
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.MaxGasWantedPerTx |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field HighGasTxThreshold", wireType)
}
m.HighGasTxThreshold = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTxfees
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.HighGasTxThreshold |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MinGasPriceForHighGasTx", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTxfees
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTxfees
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTxfees
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.MinGasPriceForHighGasTx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Mempool1559Enabled", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTxfees
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Mempool1559Enabled = bool(v != 0)
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MinGasPrice", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTxfees
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTxfees
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTxfees
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.MinGasPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DefaultBaseFeeMultiplier", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTxfees
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTxfees
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTxfees
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.DefaultBaseFeeMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MaxBaseFeeMultiplier", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTxfees
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTxfees
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTxfees
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.MaxBaseFeeMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 8:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ResetInterval", wireType)
}
m.ResetInterval = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTxfees
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ResetInterval |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 9:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MaxBlockChangeRate", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTxfees
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTxfees
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTxfees
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.MaxBlockChangeRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 10:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TargetBlockSpacePercentRate", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTxfees
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTxfees
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTxfees
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.TargetBlockSpacePercentRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 11:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RecheckFeeLowBaseFee", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTxfees
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTxfees
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTxfees
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RecheckFeeLowBaseFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 12:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RecheckFeeHighBaseFee", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTxfees
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTxfees
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTxfees
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RecheckFeeHighBaseFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 13:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RecheckFeeBaseFeeThresholdMultiplier", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTxfees
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTxfees
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTxfees
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.RecheckFeeBaseFeeThresholdMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTxfees(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTxfees
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTxfees(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTxfees
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTxfees
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTxfees
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthTxfees
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupTxfees
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthTxfees
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthTxfees = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowTxfees = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupTxfees = fmt.Errorf("proto: unexpected end of group")
)