From 8ee9745ea1c72acce1c19c053cf4598d60834b1d Mon Sep 17 00:00:00 2001 From: Roshan Date: Wed, 4 Jan 2023 18:53:52 +0800 Subject: [PATCH] fix review comments --- proto/cosmos/gashub/v1alpha1/gashub.proto | 26 +- x/auth/ante/msg_gas.go | 11 +- x/auth/ante/msg_gas_test.go | 2 +- x/authz/keeper/keeper.go | 10 +- x/feegrant/fees.go | 2 +- x/feegrant/filtered_fee.go | 16 +- x/gashub/simulation/genesis.go | 10 +- x/gashub/simulation/genesis_test.go | 3 +- x/gashub/simulation/params.go | 4 +- x/gashub/types/gas_calculator.go | 285 +++---- x/gashub/types/gashub.pb.go | 878 ++-------------------- x/gashub/types/params.go | 213 +----- x/staking/types/authz.go | 10 +- 13 files changed, 242 insertions(+), 1228 deletions(-) diff --git a/proto/cosmos/gashub/v1alpha1/gashub.proto b/proto/cosmos/gashub/v1alpha1/gashub.proto index 2e739f091d..1a90e609fa 100644 --- a/proto/cosmos/gashub/v1alpha1/gashub.proto +++ b/proto/cosmos/gashub/v1alpha1/gashub.proto @@ -12,26 +12,8 @@ message Params { uint64 max_tx_size = 1 [(gogoproto.customname) = "MaxTxSize"]; uint64 min_gas_per_byte = 2 [(gogoproto.customname) = "MinGasPerByte"]; - uint64 msg_grant_gas = 3 [(gogoproto.customname) = "MsgGrantGas"]; - uint64 msg_revoke_gas = 4 [(gogoproto.customname) = "MsgRevokeGas"]; - uint64 msg_exec_gas = 5 [(gogoproto.customname) = "MsgExecGas"]; - uint64 msg_send_gas = 6 [(gogoproto.customname) = "MsgSendGas"]; - uint64 msg_multi_send_gas = 7 [(gogoproto.customname) = "MsgMultiSendGas"]; - uint64 msg_withdraw_delegator_reward_gas = 8 [(gogoproto.customname) = "MsgWithdrawDelegatorRewardGas"]; - uint64 msg_withdraw_validator_commission_gas = 9 [(gogoproto.customname) = "MsgWithdrawValidatorCommissionGas"]; - uint64 msg_set_withdraw_address_gas = 10 [(gogoproto.customname) = "MsgSetWithdrawAddressGas"]; - uint64 msg_fund_community_pool_gas = 11 [(gogoproto.customname) = "MsgFundCommunityPoolGas"]; - uint64 msg_grant_allowance_gas = 12 [(gogoproto.customname) = "MsgGrantAllowanceGas"]; - uint64 msg_revoke_allowance_gas = 13 [(gogoproto.customname) = "MsgRevokeAllowanceGas"]; - uint64 msg_submit_proposal_gas = 14 [(gogoproto.customname) = "MsgSubmitProposalGas"]; - uint64 msg_vote_gas = 15 [(gogoproto.customname) = "MsgVoteGas"]; - uint64 msg_vote_weighted_gas = 16 [(gogoproto.customname) = "MsgVoteWeightedGas"]; - uint64 msg_deposit_gas = 17 [(gogoproto.customname) = "MsgDepositGas"]; - uint64 msg_unjail_gas = 18 [(gogoproto.customname) = "MsgUnjailGas"]; - uint64 msg_impeach_gas = 19 [(gogoproto.customname) = "MsgImpeachGas"]; - uint64 msg_edit_validator_gas = 20 [(gogoproto.customname) = "MsgEditValidatorGas"]; - uint64 msg_delegate_gas = 21 [(gogoproto.customname) = "MsgDelegateGas"]; - uint64 msg_undelegate_gas = 22 [(gogoproto.customname) = "MsgUndelegateGas"]; - uint64 msg_begin_redelegate_gas = 23 [(gogoproto.customname) = "MsgBeginRedelegateGas"]; - uint64 msg_cancel_unbonding_delegation_gas = 24 [(gogoproto.customname) = "MsgCancelUnbondingDelegationGas"]; + uint64 fixed_msg_gas = 3 [(gogoproto.customname) = "FixedMsgGas"]; + uint64 msg_grant_per_item_gas = 4 [(gogoproto.customname) = "MsgGrantPerItemGas"]; + uint64 msg_multi_send_per_item_gas = 5 [(gogoproto.customname) = "MsgMultiSendPerItemGas"]; + uint64 msg_grant_allowance_per_item_gas = 6 [(gogoproto.customname) = "MsgGrantAllowancePerItemGas"]; } diff --git a/x/auth/ante/msg_gas.go b/x/auth/ante/msg_gas.go index c22ffcae5e..1be8ee335b 100644 --- a/x/auth/ante/msg_gas.go +++ b/x/auth/ante/msg_gas.go @@ -4,7 +4,6 @@ import ( "fmt" "cosmossdk.io/errors" - "github.com/cosmos/cosmos-sdk/codec/legacy" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -113,7 +112,7 @@ func (cmfg ConsumeMsgGasDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula return ctx, err } - if gasByTxSize >= gasByMsgType { + if gasByTxSize > gasByMsgType { ctx.GasMeter().ConsumeGas(gasByTxSize, "tx bytes length") } else { ctx.GasMeter().ConsumeGas(gasByMsgType, "msg type") @@ -124,14 +123,18 @@ func (cmfg ConsumeMsgGasDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula func (cmfg ConsumeMsgGasDecorator) getMsgGas(params types.Params, tx sdk.Tx) (uint64, error) { msgs := tx.GetMsgs() - var totalGas uint64 + totalGas := uint64(0) for _, msg := range msgs { feeCalcGen := types.GetGasCalculatorGen(sdk.MsgTypeURL(msg)) if feeCalcGen == nil { return 0, fmt.Errorf("failed to find fee calculator") } feeCalc := feeCalcGen(params) - totalGas += feeCalc(msg) + gas, err := feeCalc(msg) + if err != nil { + return 0, err + } + totalGas = totalGas + gas } return totalGas, nil } diff --git a/x/auth/ante/msg_gas_test.go b/x/auth/ante/msg_gas_test.go index 2ec534a828..3f2e201500 100644 --- a/x/auth/ante/msg_gas_test.go +++ b/x/auth/ante/msg_gas_test.go @@ -48,7 +48,7 @@ func (suite *AnteTestSuite) TestMsgGas() { } testCases := []testCase{ {"MsgSend", msgSend, 100000}, - {"MsgMultiSend", msgMultiSend, 300000}, + {"MsgMultiSend", msgMultiSend, 400000}, } for _, tc := range testCases { suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder() // Create new txBuilder for each test diff --git a/x/authz/keeper/keeper.go b/x/authz/keeper/keeper.go index c44555f4dc..63f7714b0a 100644 --- a/x/authz/keeper/keeper.go +++ b/x/authz/keeper/keeper.go @@ -19,10 +19,10 @@ import ( "github.com/cosmos/cosmos-sdk/x/authz" ) -// // TODO: Revisit this once we have propoer gas fee framework. -// // Tracking issues https://github.com/cosmos/cosmos-sdk/issues/9054, -// // https://github.com/cosmos/cosmos-sdk/discussions/9072 -// const gasCostPerIteration = uint64(20) +// TODO: Revisit this once we have propoer gas fee framework. +// Tracking issues https://github.com/cosmos/cosmos-sdk/issues/9054, +// https://github.com/cosmos/cosmos-sdk/discussions/9072 +const gasCostPerIteration = uint64(20) type Keeper struct { storeKey storetypes.StoreKey @@ -359,7 +359,7 @@ func (keeper Keeper) removeFromGrantQueue(ctx sdk.Context, grantKey []byte, gran queueItems := queueItem.MsgTypeUrls for index, typeURL := range queueItems { - // ctx.GasMeter().ConsumeGas(gasCostPerIteration, "grant queue") + ctx.GasMeter().ConsumeGas(gasCostPerIteration, "grant queue") if typeURL == msgType { end := len(queueItem.MsgTypeUrls) - 1 diff --git a/x/feegrant/fees.go b/x/feegrant/fees.go index 9b2c033386..6bc9a4a797 100644 --- a/x/feegrant/fees.go +++ b/x/feegrant/fees.go @@ -6,7 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// FeeAllowance implementations are tied to a given fee delegator and delegatee, +// FeeAllowanceI implementations are tied to a given fee delegator and delegatee, // and are used to enforce fee grant limits. type FeeAllowanceI interface { // Accept can use fee payment requested as well as timestamp of the current block diff --git a/x/feegrant/filtered_fee.go b/x/feegrant/filtered_fee.go index 2658f1064f..e03ce820e0 100644 --- a/x/feegrant/filtered_fee.go +++ b/x/feegrant/filtered_fee.go @@ -10,11 +10,11 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -// // TODO: Revisit this once we have propoer gas fee framework. -// // Tracking issues https://github.com/cosmos/cosmos-sdk/issues/9054, https://github.com/cosmos/cosmos-sdk/discussions/9072 -// const ( -// gasCostPerIteration = uint64(10) -// ) +// TODO: Revisit this once we have propoer gas fee framework. +// Tracking issues https://github.com/cosmos/cosmos-sdk/issues/9054, https://github.com/cosmos/cosmos-sdk/discussions/9072 +const ( + gasCostPerIteration = uint64(10) +) var ( _ FeeAllowanceI = (*AllowedMsgAllowance)(nil) @@ -27,7 +27,7 @@ func (a *AllowedMsgAllowance) UnpackInterfaces(unpacker types.AnyUnpacker) error return unpacker.UnpackAny(a.Allowance, &allowance) } -// NewAllowedMsgFeeAllowance creates new filtered fee allowance. +// NewAllowedMsgAllowance creates new filtered fee allowance. func NewAllowedMsgAllowance(allowance FeeAllowanceI, allowedMsgs []string) (*AllowedMsgAllowance, error) { msg, ok := allowance.(proto.Message) if !ok { @@ -88,7 +88,7 @@ func (a *AllowedMsgAllowance) Accept(ctx sdk.Context, fee sdk.Coins, msgs []sdk. func (a *AllowedMsgAllowance) allowedMsgsToMap(ctx sdk.Context) map[string]bool { msgsMap := make(map[string]bool, len(a.AllowedMessages)) for _, msg := range a.AllowedMessages { - // ctx.GasMeter().ConsumeGas(gasCostPerIteration, "check msg") + ctx.GasMeter().ConsumeGas(gasCostPerIteration, "check msg") msgsMap[msg] = true } @@ -99,7 +99,7 @@ func (a *AllowedMsgAllowance) allMsgTypesAllowed(ctx sdk.Context, msgs []sdk.Msg msgsMap := a.allowedMsgsToMap(ctx) for _, msg := range msgs { - // ctx.GasMeter().ConsumeGas(gasCostPerIteration, "check msg") + ctx.GasMeter().ConsumeGas(gasCostPerIteration, "check msg") if !msgsMap[sdk.MsgTypeURL(msg)] { return false } diff --git a/x/gashub/simulation/genesis.go b/x/gashub/simulation/genesis.go index 3432444206..2f5d7c3869 100644 --- a/x/gashub/simulation/genesis.go +++ b/x/gashub/simulation/genesis.go @@ -14,7 +14,7 @@ import ( const ( MaxTxSize = "max_tx_size" MinGasPerByte = "min_gas_per_byte" - MsgGas = "msg_gas" + FixedMsgGas = "fixed_msg_gas" ) // GenMaxTxSize randomized MaxTxSize @@ -46,13 +46,13 @@ func RandomizedGenState(simState *module.SimulationState) { func(r *rand.Rand) { minGasPerByte = GenMinGasPerByte(r) }, ) - var msgGas uint64 + var fixedMsgGas uint64 simState.AppParams.GetOrGenerate( - simState.Cdc, MsgGas, &msgGas, simState.Rand, - func(r *rand.Rand) { msgGas = GenMsgGas(r) }, + simState.Cdc, FixedMsgGas, &fixedMsgGas, simState.Rand, + func(r *rand.Rand) { fixedMsgGas = GenMsgGas(r) }, ) - params := types.NewParams(maxTxSize, minGasPerByte, msgGas, msgGas, msgGas, msgGas, msgGas, msgGas, msgGas, msgGas, msgGas, msgGas, msgGas, msgGas, msgGas, msgGas, msgGas, msgGas, msgGas, msgGas, msgGas, msgGas, msgGas, msgGas) + params := types.NewParams(maxTxSize, minGasPerByte, fixedMsgGas, fixedMsgGas, fixedMsgGas, fixedMsgGas) gashubGenesis := types.NewGenesisState(params) diff --git a/x/gashub/simulation/genesis_test.go b/x/gashub/simulation/genesis_test.go index 1da83d0bef..7a171c0911 100644 --- a/x/gashub/simulation/genesis_test.go +++ b/x/gashub/simulation/genesis_test.go @@ -41,6 +41,5 @@ func TestRandomizedGenState(t *testing.T) { require.Equal(t, uint64(2540), gashubGenesis.Params.MaxTxSize) require.Equal(t, uint64(2956), gashubGenesis.Params.MinGasPerByte) - require.Equal(t, uint64(2803300), gashubGenesis.Params.MsgSendGas) - require.Equal(t, uint64(2803300), gashubGenesis.Params.MsgMultiSendGas) + require.Equal(t, uint64(2803300), gashubGenesis.Params.FixedMsgGas) } diff --git a/x/gashub/simulation/params.go b/x/gashub/simulation/params.go index 03d04e5d52..70a561c639 100644 --- a/x/gashub/simulation/params.go +++ b/x/gashub/simulation/params.go @@ -12,14 +12,14 @@ import ( ) const ( - keyMsgSendGas = "MsgSendGas" + keyFixedMsgGas = "FixedMsgGas" ) // ParamChanges defines the parameters that can be modified by param change proposals // on the simulation func ParamChanges(r *rand.Rand) []simtypes.ParamChange { return []simtypes.ParamChange{ - simulation.NewSimParamChange(types.ModuleName, keyMsgSendGas, + simulation.NewSimParamChange(types.ModuleName, keyFixedMsgGas, func(r *rand.Rand) string { return fmt.Sprintf("%d", GenMsgGas(r)) }, diff --git a/x/gashub/types/gas_calculator.go b/x/gashub/types/gas_calculator.go index bbf2cb39b3..c117f4d496 100644 --- a/x/gashub/types/gas_calculator.go +++ b/x/gashub/types/gas_calculator.go @@ -1,6 +1,10 @@ package types import ( + "fmt" + + "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/authz" bank "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -12,12 +16,14 @@ import ( ) type ( - GasCalculator func(msg types.Msg) uint64 + GasCalculator func(msg types.Msg) (uint64, error) GasCalculatorGenerator func(params Params) GasCalculator ) var calculatorsGen = make(map[string]GasCalculatorGenerator) +var ErrInvalidMsgGas = fmt.Errorf("msg gas param is invalid") + func RegisterCalculatorGen(msgType string, feeCalcGen GasCalculatorGenerator) { calculatorsGen[msgType] = feeCalcGen } @@ -27,221 +33,126 @@ func GetGasCalculatorGen(msgType string) GasCalculatorGenerator { } func FixedGasCalculator(amount uint64) GasCalculator { - return func(msg types.Msg) uint64 { - return amount + return func(msg types.Msg) (uint64, error) { + if amount == 0 { + return 0, errors.Wrapf(ErrInvalidMsgGas, "msg type: %s", types.MsgTypeURL(msg)) + } + return amount, nil } } -func MultiSendCalculator(amount uint64) GasCalculator { - return func(msg types.Msg) uint64 { - msgMultiSend := msg.(*bank.MsgMultiSend) +func GrantCalculator(fixedGas, gasPerItem uint64) GasCalculator { + return func(msg types.Msg) (uint64, error) { + if fixedGas == 0 || gasPerItem == 0 { + return 0, errors.Wrapf(ErrInvalidMsgGas, "msg type: %s", types.MsgTypeURL(msg)) + } + + msgGrant := msg.(*authz.MsgGrant) var num int - if len(msgMultiSend.Inputs) > len(msgMultiSend.Outputs) { - num = len(msgMultiSend.Inputs) - } else { - num = len(msgMultiSend.Outputs) + authorization, err := msgGrant.GetAuthorization() + if err != nil { + return 0, err + } + switch authorization := authorization.(type) { + case *staking.StakeAuthorization: + allowList := authorization.GetAllowList().GetAddress() + denyList := authorization.GetDenyList().GetAddress() + num = len(allowList) + len(denyList) + case *bank.SendAuthorization: + coins := authorization.SpendLimit + num = len(coins) } - return uint64(num) * amount - } -} -var msgGrantGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgGrantGas() - if msgGas == 0 { - return FixedGasCalculator(DefaultMsgGrantGas) + totalGas := fixedGas + uint64(num)*gasPerItem + return totalGas, nil } - return FixedGasCalculator(msgGas) } -var msgRevokeGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgRevokeGas() - if msgGas == 0 { - return FixedGasCalculator(DefaultMsgRevokeGas) - } - return FixedGasCalculator(msgGas) -} +func MultiSendCalculator(fixedGas, gasPerItem uint64) GasCalculator { + return func(msg types.Msg) (uint64, error) { + if fixedGas == 0 || gasPerItem == 0 { + return 0, errors.Wrapf(ErrInvalidMsgGas, "msg type: %s", types.MsgTypeURL(msg)) + } -var msgExecGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgExecGas() - if msgGas == 0 { - return FixedGasCalculator(DefaultMsgExecGas) + msgMultiSend := msg.(*bank.MsgMultiSend) + var num int + if len(msgMultiSend.Inputs) > len(msgMultiSend.Outputs) { + num = len(msgMultiSend.Inputs) + } else { + num = len(msgMultiSend.Outputs) + } + totalGas := fixedGas + uint64(num)*gasPerItem + return totalGas, nil } - return FixedGasCalculator(msgGas) } -var msgSendGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgSendGas() - if msgGas == 0 { - return FixedGasCalculator(DefaultMsgSendGas) - } - return FixedGasCalculator(msgGas) -} +func GrantAllowanceCalculator(fixedGas, gasPerItem uint64) GasCalculator { + return func(msg types.Msg) (uint64, error) { + if fixedGas == 0 || gasPerItem == 0 { + return 0, errors.Wrapf(ErrInvalidMsgGas, "msg type: %s", types.MsgTypeURL(msg)) + } -var msgMultiSendGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgMultiSendGas() - if msgGas == 0 { - return MultiSendCalculator(DefaultMsgSendGas) - } - return MultiSendCalculator(msgGas) -} + msgGrantAllowance := msg.(*feegrant.MsgGrantAllowance) + var num int + feeAllowance, err := msgGrantAllowance.GetFeeAllowanceI() + if err != nil { + return 0, err + } + switch feeAllowance := feeAllowance.(type) { + case *feegrant.AllowedMsgAllowance: + allowedMsg := feeAllowance.AllowedMessages + num = len(allowedMsg) + } -var msgWithdrawDelegatorRewardGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgWithdrawDelegatorRewardGas() - if msgGas == 0 { - return FixedGasCalculator(DefaultMsgWithdrawDelegatorRewardGas) + totalGas := fixedGas + uint64(num)*gasPerItem + return totalGas, nil } - return FixedGasCalculator(msgGas) } -var msgWithdrawValidatorCommissionGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgWithdrawValidatorCommissionGas() - if msgGas == 0 { - return FixedGasCalculator(DefaultMsgWithdrawValidatorCommissionGas) - } - return FixedGasCalculator(msgGas) +var fixedMsgGasCalculatorGen = func(params Params) GasCalculator { + fixedGas := params.GetFixedMsgGas() + return FixedGasCalculator(fixedGas) } -var msgSetWithdrawAddressGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgSetWithdrawAddressGas() - if msgGas == 0 { - return FixedGasCalculator(DefaultMsgSetWithdrawAddressGas) - } - return FixedGasCalculator(msgGas) +var msgGrantGasCalculatorGen = func(params Params) GasCalculator { + fixedGas := params.GetFixedMsgGas() + gasPerItem := params.GetMsgGrantPerItemGas() + return GrantCalculator(fixedGas, gasPerItem) } -var msgFundCommunityPoolGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgFundCommunityPoolGas() - if msgGas == 0 { - return FixedGasCalculator(DefaultMsgFundCommunityPoolGas) - } - return FixedGasCalculator(msgGas) +var msgMultiSendGasCalculatorGen = func(params Params) GasCalculator { + fixedGas := params.GetFixedMsgGas() + gasPerItem := params.GetMsgMultiSendPerItemGas() + return MultiSendCalculator(fixedGas, gasPerItem) } var msgGrantAllowanceGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgGrantAllowanceGas() - if msgGas == 0 { - return FixedGasCalculator(DefaultMsgGrantAllowanceGas) - } - return FixedGasCalculator(msgGas) -} - -var msgRevokeAllowanceGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgRevokeAllowanceGas() - if msgGas == 0 { - return FixedGasCalculator(DefaultMsgRevokeAllowanceGas) - } - return FixedGasCalculator(msgGas) -} - -var msgSubmitProposalGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgSubmitProposalGas() - if msgGas == 0 { - return FixedGasCalculator(DefaultMsgSubmitProposalGas) - } - return FixedGasCalculator(msgGas) -} - -var msgVoteGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgVoteGas() - if msgGas == 0 { - return FixedGasCalculator(DefaultMsgVoteGas) - } - return FixedGasCalculator(msgGas) -} - -var msgVoteWeightedGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgVoteWeightedGas() - if msgGas == 0 { - return FixedGasCalculator(DefaultMsgVoteWeightedGas) - } - return FixedGasCalculator(msgGas) -} - -var msgDepositGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgDepositGas() - if msgGas == 0 { - return FixedGasCalculator(DefaultMsgDepositGas) - } - return FixedGasCalculator(msgGas) -} - -var msgUnjailGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgUnjailGas() - if msgGas == 0 { - return FixedGasCalculator(DefaultMsgUnjailGas) - } - return FixedGasCalculator(msgGas) -} - -var msgImpeachGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgImpeachGas() - if msgGas == 0 { - return FixedGasCalculator(DefaultMsgImpeachGas) - } - return FixedGasCalculator(msgGas) -} - -var msgEditValidatorGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgEditValidatorGas() - if msgGas == 0 { - return FixedGasCalculator(DefaultMsgEditValidatorGas) - } - return FixedGasCalculator(msgGas) -} - -var msgDelegateGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgDelegateGas() - if msgGas == 0 { - return FixedGasCalculator(DefaultMsgDelegateGas) - } - return FixedGasCalculator(msgGas) -} - -var msgUndelegateGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgUndelegateGas() - if msgGas == 0 { - return FixedGasCalculator(DefaultMsgUndelegateGas) - } - return FixedGasCalculator(msgGas) -} - -var msgBeginRedelegateGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgBeginRedelegateGas() - if msgGas == 0 { - return FixedGasCalculator(DefaultMsgBeginRedelegateGas) - } - return FixedGasCalculator(msgGas) -} - -var msgCancelUnbondingDelegationGasCalculatorGen = func(params Params) GasCalculator { - msgGas := params.GetMsgCancelUnbondingDelegationGas() - if msgGas == 0 { - return FixedGasCalculator(DefaultMsgCancelUnbondingDelegationGas) - } - return FixedGasCalculator(msgGas) + fixedGas := params.GetFixedMsgGas() + gasPerItem := params.GetMsgGrantAllowancePerItemGas() + return GrantAllowanceCalculator(fixedGas, gasPerItem) } func init() { RegisterCalculatorGen(types.MsgTypeURL(&authz.MsgGrant{}), msgGrantGasCalculatorGen) - RegisterCalculatorGen(types.MsgTypeURL(&authz.MsgRevoke{}), msgRevokeGasCalculatorGen) - RegisterCalculatorGen(types.MsgTypeURL(&authz.MsgExec{}), msgExecGasCalculatorGen) - RegisterCalculatorGen(types.MsgTypeURL(&bank.MsgSend{}), msgSendGasCalculatorGen) + RegisterCalculatorGen(types.MsgTypeURL(&authz.MsgRevoke{}), fixedMsgGasCalculatorGen) + RegisterCalculatorGen(types.MsgTypeURL(&authz.MsgExec{}), fixedMsgGasCalculatorGen) + RegisterCalculatorGen(types.MsgTypeURL(&bank.MsgSend{}), fixedMsgGasCalculatorGen) RegisterCalculatorGen(types.MsgTypeURL(&bank.MsgMultiSend{}), msgMultiSendGasCalculatorGen) - RegisterCalculatorGen(types.MsgTypeURL(&distribution.MsgWithdrawDelegatorReward{}), msgWithdrawDelegatorRewardGasCalculatorGen) - RegisterCalculatorGen(types.MsgTypeURL(&distribution.MsgWithdrawValidatorCommission{}), msgWithdrawValidatorCommissionGasCalculatorGen) - RegisterCalculatorGen(types.MsgTypeURL(&distribution.MsgSetWithdrawAddress{}), msgSetWithdrawAddressGasCalculatorGen) - RegisterCalculatorGen(types.MsgTypeURL(&distribution.MsgFundCommunityPool{}), msgFundCommunityPoolGasCalculatorGen) + RegisterCalculatorGen(types.MsgTypeURL(&distribution.MsgWithdrawDelegatorReward{}), fixedMsgGasCalculatorGen) + RegisterCalculatorGen(types.MsgTypeURL(&distribution.MsgWithdrawValidatorCommission{}), fixedMsgGasCalculatorGen) + RegisterCalculatorGen(types.MsgTypeURL(&distribution.MsgSetWithdrawAddress{}), fixedMsgGasCalculatorGen) + RegisterCalculatorGen(types.MsgTypeURL(&distribution.MsgFundCommunityPool{}), fixedMsgGasCalculatorGen) RegisterCalculatorGen(types.MsgTypeURL(&feegrant.MsgGrantAllowance{}), msgGrantAllowanceGasCalculatorGen) - RegisterCalculatorGen(types.MsgTypeURL(&feegrant.MsgRevokeAllowance{}), msgRevokeAllowanceGasCalculatorGen) - RegisterCalculatorGen(types.MsgTypeURL(&gov.MsgSubmitProposal{}), msgSubmitProposalGasCalculatorGen) - RegisterCalculatorGen(types.MsgTypeURL(&gov.MsgVote{}), msgVoteGasCalculatorGen) - RegisterCalculatorGen(types.MsgTypeURL(&gov.MsgVoteWeighted{}), msgVoteWeightedGasCalculatorGen) - RegisterCalculatorGen(types.MsgTypeURL(&gov.MsgDeposit{}), msgDepositGasCalculatorGen) - RegisterCalculatorGen(types.MsgTypeURL(&slashing.MsgUnjail{}), msgUnjailGasCalculatorGen) - RegisterCalculatorGen(types.MsgTypeURL(&slashing.MsgImpeach{}), msgImpeachGasCalculatorGen) - RegisterCalculatorGen(types.MsgTypeURL(&staking.MsgEditValidator{}), msgEditValidatorGasCalculatorGen) - RegisterCalculatorGen(types.MsgTypeURL(&staking.MsgDelegate{}), msgDelegateGasCalculatorGen) - RegisterCalculatorGen(types.MsgTypeURL(&staking.MsgUndelegate{}), msgUndelegateGasCalculatorGen) - RegisterCalculatorGen(types.MsgTypeURL(&staking.MsgBeginRedelegate{}), msgBeginRedelegateGasCalculatorGen) - RegisterCalculatorGen(types.MsgTypeURL(&staking.MsgCancelUnbondingDelegation{}), msgCancelUnbondingDelegationGasCalculatorGen) + RegisterCalculatorGen(types.MsgTypeURL(&feegrant.MsgRevokeAllowance{}), fixedMsgGasCalculatorGen) + RegisterCalculatorGen(types.MsgTypeURL(&gov.MsgSubmitProposal{}), fixedMsgGasCalculatorGen) + RegisterCalculatorGen(types.MsgTypeURL(&gov.MsgVote{}), fixedMsgGasCalculatorGen) + RegisterCalculatorGen(types.MsgTypeURL(&gov.MsgVoteWeighted{}), fixedMsgGasCalculatorGen) + RegisterCalculatorGen(types.MsgTypeURL(&gov.MsgDeposit{}), fixedMsgGasCalculatorGen) + RegisterCalculatorGen(types.MsgTypeURL(&slashing.MsgUnjail{}), fixedMsgGasCalculatorGen) + RegisterCalculatorGen(types.MsgTypeURL(&slashing.MsgImpeach{}), fixedMsgGasCalculatorGen) + RegisterCalculatorGen(types.MsgTypeURL(&staking.MsgEditValidator{}), fixedMsgGasCalculatorGen) + RegisterCalculatorGen(types.MsgTypeURL(&staking.MsgDelegate{}), fixedMsgGasCalculatorGen) + RegisterCalculatorGen(types.MsgTypeURL(&staking.MsgUndelegate{}), fixedMsgGasCalculatorGen) + RegisterCalculatorGen(types.MsgTypeURL(&staking.MsgBeginRedelegate{}), fixedMsgGasCalculatorGen) + RegisterCalculatorGen(types.MsgTypeURL(&staking.MsgCancelUnbondingDelegation{}), fixedMsgGasCalculatorGen) } diff --git a/x/gashub/types/gashub.pb.go b/x/gashub/types/gashub.pb.go index 337ee00c6a..b9e207acbe 100644 --- a/x/gashub/types/gashub.pb.go +++ b/x/gashub/types/gashub.pb.go @@ -25,30 +25,12 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the gashub module. type Params struct { - MaxTxSize uint64 `protobuf:"varint,1,opt,name=max_tx_size,json=maxTxSize,proto3" json:"max_tx_size,omitempty"` - MinGasPerByte uint64 `protobuf:"varint,2,opt,name=min_gas_per_byte,json=minGasPerByte,proto3" json:"min_gas_per_byte,omitempty"` - MsgGrantGas uint64 `protobuf:"varint,3,opt,name=msg_grant_gas,json=msgGrantGas,proto3" json:"msg_grant_gas,omitempty"` - MsgRevokeGas uint64 `protobuf:"varint,4,opt,name=msg_revoke_gas,json=msgRevokeGas,proto3" json:"msg_revoke_gas,omitempty"` - MsgExecGas uint64 `protobuf:"varint,5,opt,name=msg_exec_ga,json=msgExecGa,proto3" json:"msg_exec_ga,omitempty"` - MsgSendGas uint64 `protobuf:"varint,6,opt,name=msg_send_gas,json=msgSendGas,proto3" json:"msg_send_gas,omitempty"` - MsgMultiSendGas uint64 `protobuf:"varint,7,opt,name=msg_multi_send_gas,json=msgMultiSendGas,proto3" json:"msg_multi_send_gas,omitempty"` - MsgWithdrawDelegatorRewardGas uint64 `protobuf:"varint,8,opt,name=msg_withdraw_delegator_reward_gas,json=msgWithdrawDelegatorRewardGas,proto3" json:"msg_withdraw_delegator_reward_gas,omitempty"` - MsgWithdrawValidatorCommissionGas uint64 `protobuf:"varint,9,opt,name=msg_withdraw_validator_commission_gas,json=msgWithdrawValidatorCommissionGas,proto3" json:"msg_withdraw_validator_commission_gas,omitempty"` - MsgSetWithdrawAddressGas uint64 `protobuf:"varint,10,opt,name=msg_set_withdraw_address_gas,json=msgSetWithdrawAddressGas,proto3" json:"msg_set_withdraw_address_gas,omitempty"` - MsgFundCommunityPoolGas uint64 `protobuf:"varint,11,opt,name=msg_fund_community_pool_gas,json=msgFundCommunityPoolGas,proto3" json:"msg_fund_community_pool_gas,omitempty"` - MsgGrantAllowanceGas uint64 `protobuf:"varint,12,opt,name=msg_grant_allowance_gas,json=msgGrantAllowanceGas,proto3" json:"msg_grant_allowance_gas,omitempty"` - MsgRevokeAllowanceGas uint64 `protobuf:"varint,13,opt,name=msg_revoke_allowance_gas,json=msgRevokeAllowanceGas,proto3" json:"msg_revoke_allowance_gas,omitempty"` - MsgSubmitProposalGas uint64 `protobuf:"varint,14,opt,name=msg_submit_proposal_gas,json=msgSubmitProposalGas,proto3" json:"msg_submit_proposal_gas,omitempty"` - MsgVoteGas uint64 `protobuf:"varint,15,opt,name=msg_vote_gas,json=msgVoteGas,proto3" json:"msg_vote_gas,omitempty"` - MsgVoteWeightedGas uint64 `protobuf:"varint,16,opt,name=msg_vote_weighted_gas,json=msgVoteWeightedGas,proto3" json:"msg_vote_weighted_gas,omitempty"` - MsgDepositGas uint64 `protobuf:"varint,17,opt,name=msg_deposit_gas,json=msgDepositGas,proto3" json:"msg_deposit_gas,omitempty"` - MsgUnjailGas uint64 `protobuf:"varint,18,opt,name=msg_unjail_gas,json=msgUnjailGas,proto3" json:"msg_unjail_gas,omitempty"` - MsgImpeachGas uint64 `protobuf:"varint,19,opt,name=msg_impeach_gas,json=msgImpeachGas,proto3" json:"msg_impeach_gas,omitempty"` - MsgEditValidatorGas uint64 `protobuf:"varint,20,opt,name=msg_edit_validator_gas,json=msgEditValidatorGas,proto3" json:"msg_edit_validator_gas,omitempty"` - MsgDelegateGas uint64 `protobuf:"varint,21,opt,name=msg_delegate_gas,json=msgDelegateGas,proto3" json:"msg_delegate_gas,omitempty"` - MsgUndelegateGas uint64 `protobuf:"varint,22,opt,name=msg_undelegate_gas,json=msgUndelegateGas,proto3" json:"msg_undelegate_gas,omitempty"` - MsgBeginRedelegateGas uint64 `protobuf:"varint,23,opt,name=msg_begin_redelegate_gas,json=msgBeginRedelegateGas,proto3" json:"msg_begin_redelegate_gas,omitempty"` - MsgCancelUnbondingDelegationGas uint64 `protobuf:"varint,24,opt,name=msg_cancel_unbonding_delegation_gas,json=msgCancelUnbondingDelegationGas,proto3" json:"msg_cancel_unbonding_delegation_gas,omitempty"` + MaxTxSize uint64 `protobuf:"varint,1,opt,name=max_tx_size,json=maxTxSize,proto3" json:"max_tx_size,omitempty"` + MinGasPerByte uint64 `protobuf:"varint,2,opt,name=min_gas_per_byte,json=minGasPerByte,proto3" json:"min_gas_per_byte,omitempty"` + FixedMsgGas uint64 `protobuf:"varint,3,opt,name=fixed_msg_gas,json=fixedMsgGas,proto3" json:"fixed_msg_gas,omitempty"` + MsgGrantPerItemGas uint64 `protobuf:"varint,4,opt,name=msg_grant_per_item_gas,json=msgGrantPerItemGas,proto3" json:"msg_grant_per_item_gas,omitempty"` + MsgMultiSendPerItemGas uint64 `protobuf:"varint,5,opt,name=msg_multi_send_per_item_gas,json=msgMultiSendPerItemGas,proto3" json:"msg_multi_send_per_item_gas,omitempty"` + MsgGrantAllowancePerItemGas uint64 `protobuf:"varint,6,opt,name=msg_grant_allowance_per_item_gas,json=msgGrantAllowancePerItemGas,proto3" json:"msg_grant_allowance_per_item_gas,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -97,156 +79,30 @@ func (m *Params) GetMinGasPerByte() uint64 { return 0 } -func (m *Params) GetMsgGrantGas() uint64 { +func (m *Params) GetFixedMsgGas() uint64 { if m != nil { - return m.MsgGrantGas + return m.FixedMsgGas } return 0 } -func (m *Params) GetMsgRevokeGas() uint64 { +func (m *Params) GetMsgGrantPerItemGas() uint64 { if m != nil { - return m.MsgRevokeGas + return m.MsgGrantPerItemGas } return 0 } -func (m *Params) GetMsgExecGas() uint64 { +func (m *Params) GetMsgMultiSendPerItemGas() uint64 { if m != nil { - return m.MsgExecGas + return m.MsgMultiSendPerItemGas } return 0 } -func (m *Params) GetMsgSendGas() uint64 { +func (m *Params) GetMsgGrantAllowancePerItemGas() uint64 { if m != nil { - return m.MsgSendGas - } - return 0 -} - -func (m *Params) GetMsgMultiSendGas() uint64 { - if m != nil { - return m.MsgMultiSendGas - } - return 0 -} - -func (m *Params) GetMsgWithdrawDelegatorRewardGas() uint64 { - if m != nil { - return m.MsgWithdrawDelegatorRewardGas - } - return 0 -} - -func (m *Params) GetMsgWithdrawValidatorCommissionGas() uint64 { - if m != nil { - return m.MsgWithdrawValidatorCommissionGas - } - return 0 -} - -func (m *Params) GetMsgSetWithdrawAddressGas() uint64 { - if m != nil { - return m.MsgSetWithdrawAddressGas - } - return 0 -} - -func (m *Params) GetMsgFundCommunityPoolGas() uint64 { - if m != nil { - return m.MsgFundCommunityPoolGas - } - return 0 -} - -func (m *Params) GetMsgGrantAllowanceGas() uint64 { - if m != nil { - return m.MsgGrantAllowanceGas - } - return 0 -} - -func (m *Params) GetMsgRevokeAllowanceGas() uint64 { - if m != nil { - return m.MsgRevokeAllowanceGas - } - return 0 -} - -func (m *Params) GetMsgSubmitProposalGas() uint64 { - if m != nil { - return m.MsgSubmitProposalGas - } - return 0 -} - -func (m *Params) GetMsgVoteGas() uint64 { - if m != nil { - return m.MsgVoteGas - } - return 0 -} - -func (m *Params) GetMsgVoteWeightedGas() uint64 { - if m != nil { - return m.MsgVoteWeightedGas - } - return 0 -} - -func (m *Params) GetMsgDepositGas() uint64 { - if m != nil { - return m.MsgDepositGas - } - return 0 -} - -func (m *Params) GetMsgUnjailGas() uint64 { - if m != nil { - return m.MsgUnjailGas - } - return 0 -} - -func (m *Params) GetMsgImpeachGas() uint64 { - if m != nil { - return m.MsgImpeachGas - } - return 0 -} - -func (m *Params) GetMsgEditValidatorGas() uint64 { - if m != nil { - return m.MsgEditValidatorGas - } - return 0 -} - -func (m *Params) GetMsgDelegateGas() uint64 { - if m != nil { - return m.MsgDelegateGas - } - return 0 -} - -func (m *Params) GetMsgUndelegateGas() uint64 { - if m != nil { - return m.MsgUndelegateGas - } - return 0 -} - -func (m *Params) GetMsgBeginRedelegateGas() uint64 { - if m != nil { - return m.MsgBeginRedelegateGas - } - return 0 -} - -func (m *Params) GetMsgCancelUnbondingDelegationGas() uint64 { - if m != nil { - return m.MsgCancelUnbondingDelegationGas + return m.MsgGrantAllowancePerItemGas } return 0 } @@ -260,64 +116,32 @@ func init() { } var fileDescriptor_f79bf23b48853a4a = []byte{ - // 904 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0x5f, 0x6f, 0x5b, 0x35, - 0x14, 0x6f, 0x60, 0x8c, 0xd5, 0x6d, 0xd2, 0xcc, 0x4d, 0x9b, 0x0b, 0xdb, 0x62, 0x4a, 0x35, 0x09, - 0x09, 0xad, 0x61, 0x9a, 0x84, 0xc4, 0xc4, 0x03, 0x4b, 0x3b, 0xaa, 0x49, 0x5c, 0x51, 0xa5, 0x6c, - 0x13, 0x08, 0xe9, 0xca, 0xc9, 0x35, 0x8e, 0x69, 0x7c, 0x1d, 0xae, 0x7d, 0x9b, 0x74, 0x9f, 0x82, - 0x47, 0x1e, 0xf7, 0x71, 0x78, 0xdc, 0x23, 0x4f, 0x57, 0xc8, 0x15, 0x12, 0x1f, 0x03, 0xf9, 0x38, - 0x4e, 0x72, 0x69, 0x19, 0x4f, 0xf1, 0x39, 0xe7, 0xf7, 0xe7, 0xda, 0x39, 0x3e, 0x46, 0xfb, 0x43, - 0xa5, 0xa5, 0xd2, 0x5d, 0x4e, 0xf5, 0xa8, 0x18, 0x74, 0xcf, 0x1f, 0xd2, 0xf1, 0x64, 0x44, 0x1f, - 0xce, 0xe3, 0x83, 0x49, 0xae, 0x8c, 0xc2, 0xbb, 0x1e, 0x74, 0x30, 0x4f, 0x06, 0xd0, 0x87, 0x2d, - 0xae, 0xb8, 0x02, 0x48, 0xd7, 0xad, 0x3c, 0xfa, 0xe3, 0xbf, 0xea, 0xe8, 0xe6, 0x09, 0xcd, 0xa9, - 0xd4, 0xf8, 0x01, 0xda, 0x90, 0x74, 0x96, 0x98, 0x59, 0xa2, 0xc5, 0x2b, 0x16, 0xd5, 0x3e, 0xaa, - 0x7d, 0x72, 0xa3, 0x57, 0xb7, 0x25, 0x59, 0x8f, 0xe9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, 0xff, - 0x4b, 0x5e, 0x5a, 0x11, 0x8a, 0x07, 0x00, 0x00, + // 400 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x41, 0xcb, 0xd3, 0x30, + 0x18, 0xc7, 0x5b, 0xdf, 0xd7, 0xe1, 0x9b, 0x51, 0xd4, 0x20, 0x65, 0xbc, 0x83, 0xe6, 0x45, 0x2f, + 0x82, 0x6c, 0x65, 0xec, 0xb6, 0x9b, 0x03, 0x1d, 0x0a, 0x85, 0xb1, 0x09, 0x82, 0x97, 0x92, 0xad, + 0x59, 0x16, 0x6c, 0x9a, 0xd2, 0x64, 0xda, 0xed, 0x53, 0x78, 0xf4, 0xb8, 0x6f, 0xe2, 0xd5, 0xe3, + 0x8e, 0x9e, 0x8a, 0x64, 0x17, 0x3f, 0x86, 0x24, 0x5b, 0xd9, 0x86, 0xbe, 0xa7, 0xe4, 0x79, 0xf2, + 0x7b, 0x7e, 0x79, 0x0e, 0x7f, 0xf0, 0x62, 0x2e, 0x24, 0x17, 0x32, 0xa4, 0x58, 0x2e, 0x57, 0xb3, + 0xf0, 0x4b, 0x0f, 0xa7, 0xf9, 0x12, 0xf7, 0x8e, 0x75, 0x37, 0x2f, 0x84, 0x12, 0xd0, 0x3f, 0x40, + 0xdd, 0x63, 0xb3, 0x86, 0x6e, 0x9f, 0x51, 0x41, 0x85, 0x45, 0x42, 0x73, 0x3b, 0xd0, 0xcf, 0x7f, + 0x5c, 0x81, 0xc6, 0x18, 0x17, 0x98, 0x4b, 0xd8, 0x01, 0x4d, 0x8e, 0xcb, 0x58, 0x95, 0xb1, 0x64, + 0x1b, 0xd2, 0x72, 0xef, 0xdc, 0x97, 0xd7, 0x43, 0x4f, 0x57, 0xe8, 0x26, 0xc2, 0xe5, 0x87, 0x72, + 0xca, 0x36, 0x64, 0x72, 0xc3, 0xeb, 0x2b, 0x1c, 0x80, 0x27, 0x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d, + 0x3e, 0x70, 0x7e, 0xed, 0x03, 0xe7, 0xd3, 0x2b, 0xca, 0x94, 0x89, 0xc0, 0x5c, 0xf0, 0xf0, 0x98, + 0x9c, 0xc3, 0xd1, 0x91, 0xc9, 0xe7, 0xb0, 0xac, 0x63, 0xa4, 0xd6, 0x39, 0x91, 0xb3, 0x86, 0xcd, + 0x43, 0xff, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x24, 0x68, 0xb2, 0xf5, 0x64, 0x02, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -345,70 +169,16 @@ func (this *Params) Equal(that interface{}) bool { if this.MinGasPerByte != that1.MinGasPerByte { return false } - if this.MsgGrantGas != that1.MsgGrantGas { - return false - } - if this.MsgRevokeGas != that1.MsgRevokeGas { - return false - } - if this.MsgExecGas != that1.MsgExecGas { - return false - } - if this.MsgSendGas != that1.MsgSendGas { - return false - } - if this.MsgMultiSendGas != that1.MsgMultiSendGas { - return false - } - if this.MsgWithdrawDelegatorRewardGas != that1.MsgWithdrawDelegatorRewardGas { - return false - } - if this.MsgWithdrawValidatorCommissionGas != that1.MsgWithdrawValidatorCommissionGas { - return false - } - if this.MsgSetWithdrawAddressGas != that1.MsgSetWithdrawAddressGas { - return false - } - if this.MsgFundCommunityPoolGas != that1.MsgFundCommunityPoolGas { - return false - } - if this.MsgGrantAllowanceGas != that1.MsgGrantAllowanceGas { - return false - } - if this.MsgRevokeAllowanceGas != that1.MsgRevokeAllowanceGas { - return false - } - if this.MsgSubmitProposalGas != that1.MsgSubmitProposalGas { - return false - } - if this.MsgVoteGas != that1.MsgVoteGas { - return false - } - if this.MsgVoteWeightedGas != that1.MsgVoteWeightedGas { - return false - } - if this.MsgDepositGas != that1.MsgDepositGas { - return false - } - if this.MsgUnjailGas != that1.MsgUnjailGas { - return false - } - if this.MsgImpeachGas != that1.MsgImpeachGas { + if this.FixedMsgGas != that1.FixedMsgGas { return false } - if this.MsgEditValidatorGas != that1.MsgEditValidatorGas { + if this.MsgGrantPerItemGas != that1.MsgGrantPerItemGas { return false } - if this.MsgDelegateGas != that1.MsgDelegateGas { + if this.MsgMultiSendPerItemGas != that1.MsgMultiSendPerItemGas { return false } - if this.MsgUndelegateGas != that1.MsgUndelegateGas { - return false - } - if this.MsgBeginRedelegateGas != that1.MsgBeginRedelegateGas { - return false - } - if this.MsgCancelUnbondingDelegationGas != that1.MsgCancelUnbondingDelegationGas { + if this.MsgGrantAllowancePerItemGas != that1.MsgGrantAllowancePerItemGas { return false } return true @@ -433,131 +203,23 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.MsgCancelUnbondingDelegationGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgCancelUnbondingDelegationGas)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xc0 - } - if m.MsgBeginRedelegateGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgBeginRedelegateGas)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xb8 - } - if m.MsgUndelegateGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgUndelegateGas)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xb0 - } - if m.MsgDelegateGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgDelegateGas)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xa8 - } - if m.MsgEditValidatorGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgEditValidatorGas)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xa0 - } - if m.MsgImpeachGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgImpeachGas)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x98 - } - if m.MsgUnjailGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgUnjailGas)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x90 - } - if m.MsgDepositGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgDepositGas)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x88 - } - if m.MsgVoteWeightedGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgVoteWeightedGas)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x80 - } - if m.MsgVoteGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgVoteGas)) - i-- - dAtA[i] = 0x78 - } - if m.MsgSubmitProposalGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgSubmitProposalGas)) - i-- - dAtA[i] = 0x70 - } - if m.MsgRevokeAllowanceGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgRevokeAllowanceGas)) - i-- - dAtA[i] = 0x68 - } - if m.MsgGrantAllowanceGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgGrantAllowanceGas)) - i-- - dAtA[i] = 0x60 - } - if m.MsgFundCommunityPoolGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgFundCommunityPoolGas)) - i-- - dAtA[i] = 0x58 - } - if m.MsgSetWithdrawAddressGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgSetWithdrawAddressGas)) - i-- - dAtA[i] = 0x50 - } - if m.MsgWithdrawValidatorCommissionGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgWithdrawValidatorCommissionGas)) - i-- - dAtA[i] = 0x48 - } - if m.MsgWithdrawDelegatorRewardGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgWithdrawDelegatorRewardGas)) - i-- - dAtA[i] = 0x40 - } - if m.MsgMultiSendGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgMultiSendGas)) - i-- - dAtA[i] = 0x38 - } - if m.MsgSendGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgSendGas)) + if m.MsgGrantAllowancePerItemGas != 0 { + i = encodeVarintGashub(dAtA, i, uint64(m.MsgGrantAllowancePerItemGas)) i-- dAtA[i] = 0x30 } - if m.MsgExecGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgExecGas)) + if m.MsgMultiSendPerItemGas != 0 { + i = encodeVarintGashub(dAtA, i, uint64(m.MsgMultiSendPerItemGas)) i-- dAtA[i] = 0x28 } - if m.MsgRevokeGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgRevokeGas)) + if m.MsgGrantPerItemGas != 0 { + i = encodeVarintGashub(dAtA, i, uint64(m.MsgGrantPerItemGas)) i-- dAtA[i] = 0x20 } - if m.MsgGrantGas != 0 { - i = encodeVarintGashub(dAtA, i, uint64(m.MsgGrantGas)) + if m.FixedMsgGas != 0 { + i = encodeVarintGashub(dAtA, i, uint64(m.FixedMsgGas)) i-- dAtA[i] = 0x18 } @@ -597,71 +259,17 @@ func (m *Params) Size() (n int) { if m.MinGasPerByte != 0 { n += 1 + sovGashub(uint64(m.MinGasPerByte)) } - if m.MsgGrantGas != 0 { - n += 1 + sovGashub(uint64(m.MsgGrantGas)) - } - if m.MsgRevokeGas != 0 { - n += 1 + sovGashub(uint64(m.MsgRevokeGas)) - } - if m.MsgExecGas != 0 { - n += 1 + sovGashub(uint64(m.MsgExecGas)) + if m.FixedMsgGas != 0 { + n += 1 + sovGashub(uint64(m.FixedMsgGas)) } - if m.MsgSendGas != 0 { - n += 1 + sovGashub(uint64(m.MsgSendGas)) + if m.MsgGrantPerItemGas != 0 { + n += 1 + sovGashub(uint64(m.MsgGrantPerItemGas)) } - if m.MsgMultiSendGas != 0 { - n += 1 + sovGashub(uint64(m.MsgMultiSendGas)) + if m.MsgMultiSendPerItemGas != 0 { + n += 1 + sovGashub(uint64(m.MsgMultiSendPerItemGas)) } - if m.MsgWithdrawDelegatorRewardGas != 0 { - n += 1 + sovGashub(uint64(m.MsgWithdrawDelegatorRewardGas)) - } - if m.MsgWithdrawValidatorCommissionGas != 0 { - n += 1 + sovGashub(uint64(m.MsgWithdrawValidatorCommissionGas)) - } - if m.MsgSetWithdrawAddressGas != 0 { - n += 1 + sovGashub(uint64(m.MsgSetWithdrawAddressGas)) - } - if m.MsgFundCommunityPoolGas != 0 { - n += 1 + sovGashub(uint64(m.MsgFundCommunityPoolGas)) - } - if m.MsgGrantAllowanceGas != 0 { - n += 1 + sovGashub(uint64(m.MsgGrantAllowanceGas)) - } - if m.MsgRevokeAllowanceGas != 0 { - n += 1 + sovGashub(uint64(m.MsgRevokeAllowanceGas)) - } - if m.MsgSubmitProposalGas != 0 { - n += 1 + sovGashub(uint64(m.MsgSubmitProposalGas)) - } - if m.MsgVoteGas != 0 { - n += 1 + sovGashub(uint64(m.MsgVoteGas)) - } - if m.MsgVoteWeightedGas != 0 { - n += 2 + sovGashub(uint64(m.MsgVoteWeightedGas)) - } - if m.MsgDepositGas != 0 { - n += 2 + sovGashub(uint64(m.MsgDepositGas)) - } - if m.MsgUnjailGas != 0 { - n += 2 + sovGashub(uint64(m.MsgUnjailGas)) - } - if m.MsgImpeachGas != 0 { - n += 2 + sovGashub(uint64(m.MsgImpeachGas)) - } - if m.MsgEditValidatorGas != 0 { - n += 2 + sovGashub(uint64(m.MsgEditValidatorGas)) - } - if m.MsgDelegateGas != 0 { - n += 2 + sovGashub(uint64(m.MsgDelegateGas)) - } - if m.MsgUndelegateGas != 0 { - n += 2 + sovGashub(uint64(m.MsgUndelegateGas)) - } - if m.MsgBeginRedelegateGas != 0 { - n += 2 + sovGashub(uint64(m.MsgBeginRedelegateGas)) - } - if m.MsgCancelUnbondingDelegationGas != 0 { - n += 2 + sovGashub(uint64(m.MsgCancelUnbondingDelegationGas)) + if m.MsgGrantAllowancePerItemGas != 0 { + n += 1 + sovGashub(uint64(m.MsgGrantAllowancePerItemGas)) } return n } @@ -741,9 +349,9 @@ func (m *Params) Unmarshal(dAtA []byte) error { } case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgGrantGas", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FixedMsgGas", wireType) } - m.MsgGrantGas = 0 + m.FixedMsgGas = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGashub @@ -753,16 +361,16 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MsgGrantGas |= uint64(b&0x7F) << shift + m.FixedMsgGas |= uint64(b&0x7F) << shift if b < 0x80 { break } } case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgRevokeGas", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgGrantPerItemGas", wireType) } - m.MsgRevokeGas = 0 + m.MsgGrantPerItemGas = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGashub @@ -772,16 +380,16 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MsgRevokeGas |= uint64(b&0x7F) << shift + m.MsgGrantPerItemGas |= uint64(b&0x7F) << shift if b < 0x80 { break } } case 5: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgExecGas", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgMultiSendPerItemGas", wireType) } - m.MsgExecGas = 0 + m.MsgMultiSendPerItemGas = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGashub @@ -791,358 +399,16 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MsgExecGas |= uint64(b&0x7F) << shift + m.MsgMultiSendPerItemGas |= uint64(b&0x7F) << shift if b < 0x80 { break } } case 6: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgSendGas", wireType) - } - m.MsgSendGas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGashub - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MsgSendGas |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgMultiSendGas", wireType) - } - m.MsgMultiSendGas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGashub - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MsgMultiSendGas |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgWithdrawDelegatorRewardGas", wireType) - } - m.MsgWithdrawDelegatorRewardGas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGashub - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MsgWithdrawDelegatorRewardGas |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgWithdrawValidatorCommissionGas", wireType) - } - m.MsgWithdrawValidatorCommissionGas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGashub - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MsgWithdrawValidatorCommissionGas |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgSetWithdrawAddressGas", wireType) - } - m.MsgSetWithdrawAddressGas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGashub - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MsgSetWithdrawAddressGas |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 11: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgFundCommunityPoolGas", wireType) - } - m.MsgFundCommunityPoolGas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGashub - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MsgFundCommunityPoolGas |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 12: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgGrantAllowanceGas", wireType) - } - m.MsgGrantAllowanceGas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGashub - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MsgGrantAllowanceGas |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 13: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgRevokeAllowanceGas", wireType) - } - m.MsgRevokeAllowanceGas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGashub - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MsgRevokeAllowanceGas |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 14: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgSubmitProposalGas", wireType) - } - m.MsgSubmitProposalGas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGashub - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MsgSubmitProposalGas |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 15: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgVoteGas", wireType) - } - m.MsgVoteGas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGashub - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MsgVoteGas |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 16: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgVoteWeightedGas", wireType) - } - m.MsgVoteWeightedGas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGashub - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MsgVoteWeightedGas |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 17: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgDepositGas", wireType) - } - m.MsgDepositGas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGashub - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MsgDepositGas |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 18: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgUnjailGas", wireType) - } - m.MsgUnjailGas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGashub - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MsgUnjailGas |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 19: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgImpeachGas", wireType) - } - m.MsgImpeachGas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGashub - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MsgImpeachGas |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 20: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgEditValidatorGas", wireType) - } - m.MsgEditValidatorGas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGashub - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MsgEditValidatorGas |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 21: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgDelegateGas", wireType) - } - m.MsgDelegateGas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGashub - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MsgDelegateGas |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 22: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgUndelegateGas", wireType) - } - m.MsgUndelegateGas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGashub - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MsgUndelegateGas |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 23: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgBeginRedelegateGas", wireType) - } - m.MsgBeginRedelegateGas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGashub - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MsgBeginRedelegateGas |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 24: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgCancelUnbondingDelegationGas", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MsgGrantAllowancePerItemGas", wireType) } - m.MsgCancelUnbondingDelegationGas = 0 + m.MsgGrantAllowancePerItemGas = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGashub @@ -1152,7 +418,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MsgCancelUnbondingDelegationGas |= uint64(b&0x7F) << shift + m.MsgGrantAllowancePerItemGas |= uint64(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/gashub/types/params.go b/x/gashub/types/params.go index 581d84552a..19cf0a7a88 100644 --- a/x/gashub/types/params.go +++ b/x/gashub/types/params.go @@ -10,94 +10,37 @@ import ( // Default parameter values const ( - DefaultMaxTxSize uint64 = 1024 - DefaultMinGasPerByte uint64 = 5 - DefaultMsgGrantGas uint64 = 1e5 - DefaultMsgRevokeGas uint64 = 1e5 - DefaultMsgExecGas uint64 = 1e5 - DefaultMsgSendGas uint64 = 1e5 - DefaultMsgMultiSendGas uint64 = 1e5 - DefaultMsgWithdrawDelegatorRewardGas uint64 = 1e5 - DefaultMsgWithdrawValidatorCommissionGas uint64 = 1e5 - DefaultMsgSetWithdrawAddressGas uint64 = 1e5 - DefaultMsgFundCommunityPoolGas uint64 = 1e5 - DefaultMsgGrantAllowanceGas uint64 = 1e5 - DefaultMsgRevokeAllowanceGas uint64 = 1e5 - DefaultMsgSubmitProposalGas uint64 = 1e5 - DefaultMsgVoteGas uint64 = 1e5 - DefaultMsgVoteWeightedGas uint64 = 1e5 - DefaultMsgDepositGas uint64 = 1e5 - DefaultMsgUnjailGas uint64 = 1e5 - DefaultMsgImpeachGas uint64 = 1e5 - DefaultMsgEditValidatorGas uint64 = 1e5 - DefaultMsgDelegateGas uint64 = 1e5 - DefaultMsgUndelegateGas uint64 = 1e5 - DefaultMsgBeginRedelegateGas uint64 = 1e5 - DefaultMsgCancelUnbondingDelegationGas uint64 = 1e5 + DefaultMaxTxSize uint64 = 1024 + DefaultMinGasPerByte uint64 = 5 + DefaultFixedMsgGas uint64 = 1e5 + DefaultMsgGrantPerItemGas uint64 = 1e5 + DefaultMsgMultiSendPerItemGas uint64 = 1e5 + DefaultMsgGrantAllowancePerItemGas uint64 = 1e5 ) // Parameter keys var ( - KeyMaxTxSize = []byte("MaxTxSize") - KeyMinGasPerByte = []byte("MinGasPerByte") - KeyMsgGrantGas = []byte("MsgGrantGas") - KeyMsgRevokeGas = []byte("MsgRevokeGas") - KeyMsgExecGas = []byte("MsgExecGas") - KeyMsgSendGas = []byte("MsgSendGas") - KeyMsgMultiSendGas = []byte("MsgMultiSendGas") - KeyMsgWithdrawDelegatorRewardGas = []byte("MsgWithdrawDelegatorRewardGas") - KeyMsgWithdrawValidatorCommissionGas = []byte("MsgWithdrawValidatorCommissionGas") - KeyMsgSetWithdrawAddressGas = []byte("MsgSetWithdrawAddressGas") - KeyMsgFundCommunityPoolGas = []byte("MsgFundCommunityPoolGas") - KeyMsgGrantAllowanceGas = []byte("MsgGrantAllowanceGas") - KeyMsgRevokeAllowanceGas = []byte("MsgRevokeAllowanceGas") - KeyMsgSubmitProposalGas = []byte("MsgSubmitProposalGas") - KeyMsgVoteGas = []byte("MsgVoteGas") - KeyMsgVoteWeightedGas = []byte("MsgVoteWeightedGas") - KeyMsgDepositGas = []byte("MsgDepositGas") - KeyMsgUnjailGas = []byte("MsgUnjailGas") - KeyMsgImpeachGas = []byte("MsgImpeachGas") - KeyMsgEditValidatorGas = []byte("MsgEditValidatorGas") - KeyMsgDelegateGas = []byte("MsgDelegateGas") - KeyMsgUndelegateGas = []byte("MsgUndelegateGas") - KeyMsgBeginRedelegateGas = []byte("MsgBeginRedelegateGas") - KeyMsgCancelUnbondingDelegationGas = []byte("MsgCancelUnbondingDelegationGas") + KeyMaxTxSize = []byte("MaxTxSize") + KeyMinGasPerByte = []byte("MinGasPerByte") + KeyFixedMsgGas = []byte("FixedMsgGas") + KeyMsgGrantPerItemGas = []byte("MsgGrantPerItemGas") + KeyMsgMultiSendPerItemGas = []byte("MsgMultiSendPerItemGas") + KeyMsgGrantAllowancePerItemGas = []byte("MsgGrantAllowancePerItemGas") ) var _ paramtypes.ParamSet = &Params{} // NewParams creates a new Params object func NewParams( - maxTxSize, minGasPerByte, msgGrantGas, msgRevokeGas, msgExecGas, msgSendGas, msgMultiSendGas, msgWithdrawDelegatorRewardGas, - msgWithdrawValidatorCommissionGas, msgSetWithdrawAddressGas, msgFundCommunityPoolGas, msgGrantAllowanceGas, msgRevokeAllowanceGas, - msgSubmitProposalGas, msgVoteGas, msgVoteWeightedGas, msgDepositGas, msgUnjailGas, msgImpeachGas, msgEditValidatorGas, - msgDelegateGas, msgUndelegateGas, msgBeginRedelegateGas, msgCancelUnbondingDelegationGas uint64, + maxTxSize, minGasPerByte, fixedMsgGas, msgGrantPerItemGas, msgMultiSendPerItemGas, msgGrantAllowancePerItemGas uint64, ) Params { return Params{ - MaxTxSize: maxTxSize, - MinGasPerByte: minGasPerByte, - MsgGrantGas: msgGrantGas, - MsgRevokeGas: msgRevokeGas, - MsgExecGas: msgExecGas, - MsgSendGas: msgSendGas, - MsgMultiSendGas: msgMultiSendGas, - MsgWithdrawDelegatorRewardGas: msgWithdrawDelegatorRewardGas, - MsgWithdrawValidatorCommissionGas: msgWithdrawValidatorCommissionGas, - MsgSetWithdrawAddressGas: msgSetWithdrawAddressGas, - MsgFundCommunityPoolGas: msgFundCommunityPoolGas, - MsgGrantAllowanceGas: msgGrantAllowanceGas, - MsgRevokeAllowanceGas: msgRevokeAllowanceGas, - MsgSubmitProposalGas: msgSubmitProposalGas, - MsgVoteGas: msgVoteGas, - MsgVoteWeightedGas: msgVoteWeightedGas, - MsgDepositGas: msgDepositGas, - MsgUnjailGas: msgUnjailGas, - MsgImpeachGas: msgImpeachGas, - MsgEditValidatorGas: msgEditValidatorGas, - MsgDelegateGas: msgDelegateGas, - MsgUndelegateGas: msgUndelegateGas, - MsgBeginRedelegateGas: msgBeginRedelegateGas, - MsgCancelUnbondingDelegationGas: msgCancelUnbondingDelegationGas, + MaxTxSize: maxTxSize, + MinGasPerByte: minGasPerByte, + FixedMsgGas: fixedMsgGas, + MsgGrantPerItemGas: msgGrantPerItemGas, + MsgMultiSendPerItemGas: msgMultiSendPerItemGas, + MsgGrantAllowancePerItemGas: msgGrantAllowancePerItemGas, } } @@ -112,58 +55,22 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ paramtypes.NewParamSetPair(KeyMaxTxSize, &p.MaxTxSize, validateMaxTxSize), paramtypes.NewParamSetPair(KeyMinGasPerByte, &p.MinGasPerByte, validateMinGasPerByte), - paramtypes.NewParamSetPair(KeyMsgGrantGas, &p.MsgGrantGas, validateMsgGas), - paramtypes.NewParamSetPair(KeyMsgRevokeGas, &p.MsgRevokeGas, validateMsgGas), - paramtypes.NewParamSetPair(KeyMsgExecGas, &p.MsgExecGas, validateMsgGas), - paramtypes.NewParamSetPair(KeyMsgSendGas, &p.MsgSendGas, validateMsgGas), - paramtypes.NewParamSetPair(KeyMsgMultiSendGas, &p.MsgMultiSendGas, validateMsgGas), - paramtypes.NewParamSetPair(KeyMsgWithdrawDelegatorRewardGas, &p.MsgWithdrawDelegatorRewardGas, validateMsgGas), - paramtypes.NewParamSetPair(KeyMsgWithdrawValidatorCommissionGas, &p.MsgWithdrawValidatorCommissionGas, validateMsgGas), - paramtypes.NewParamSetPair(KeyMsgSetWithdrawAddressGas, &p.MsgSetWithdrawAddressGas, validateMsgGas), - paramtypes.NewParamSetPair(KeyMsgFundCommunityPoolGas, &p.MsgFundCommunityPoolGas, validateMsgGas), - paramtypes.NewParamSetPair(KeyMsgGrantAllowanceGas, &p.MsgGrantAllowanceGas, validateMsgGas), - paramtypes.NewParamSetPair(KeyMsgRevokeAllowanceGas, &p.MsgRevokeAllowanceGas, validateMsgGas), - paramtypes.NewParamSetPair(KeyMsgSubmitProposalGas, &p.MsgSubmitProposalGas, validateMsgGas), - paramtypes.NewParamSetPair(KeyMsgVoteGas, &p.MsgVoteGas, validateMsgGas), - paramtypes.NewParamSetPair(KeyMsgVoteWeightedGas, &p.MsgVoteWeightedGas, validateMsgGas), - paramtypes.NewParamSetPair(KeyMsgDepositGas, &p.MsgDepositGas, validateMsgGas), - paramtypes.NewParamSetPair(KeyMsgUnjailGas, &p.MsgUnjailGas, validateMsgGas), - paramtypes.NewParamSetPair(KeyMsgImpeachGas, &p.MsgImpeachGas, validateMsgGas), - paramtypes.NewParamSetPair(KeyMsgEditValidatorGas, &p.MsgEditValidatorGas, validateMsgGas), - paramtypes.NewParamSetPair(KeyMsgDelegateGas, &p.MsgDelegateGas, validateMsgGas), - paramtypes.NewParamSetPair(KeyMsgUndelegateGas, &p.MsgUndelegateGas, validateMsgGas), - paramtypes.NewParamSetPair(KeyMsgBeginRedelegateGas, &p.MsgBeginRedelegateGas, validateMsgGas), - paramtypes.NewParamSetPair(KeyMsgCancelUnbondingDelegationGas, &p.MsgCancelUnbondingDelegationGas, validateMsgGas), + paramtypes.NewParamSetPair(KeyFixedMsgGas, &p.FixedMsgGas, validateMsgGas), + paramtypes.NewParamSetPair(KeyMsgGrantPerItemGas, &p.MsgGrantPerItemGas, validateMsgGas), + paramtypes.NewParamSetPair(KeyMsgMultiSendPerItemGas, &p.MsgMultiSendPerItemGas, validateMsgGas), + paramtypes.NewParamSetPair(KeyMsgGrantAllowancePerItemGas, &p.MsgGrantAllowancePerItemGas, validateMsgGas), } } // DefaultParams returns a default set of parameters. func DefaultParams() Params { return Params{ - MaxTxSize: DefaultMaxTxSize, - MinGasPerByte: DefaultMinGasPerByte, - MsgGrantGas: DefaultMsgGrantGas, - MsgRevokeGas: DefaultMsgRevokeGas, - MsgExecGas: DefaultMsgExecGas, - MsgSendGas: DefaultMsgSendGas, - MsgMultiSendGas: DefaultMsgMultiSendGas, - MsgWithdrawDelegatorRewardGas: DefaultMsgWithdrawDelegatorRewardGas, - MsgWithdrawValidatorCommissionGas: DefaultMsgWithdrawValidatorCommissionGas, - MsgSetWithdrawAddressGas: DefaultMsgSetWithdrawAddressGas, - MsgFundCommunityPoolGas: DefaultMsgFundCommunityPoolGas, - MsgGrantAllowanceGas: DefaultMsgGrantAllowanceGas, - MsgRevokeAllowanceGas: DefaultMsgRevokeAllowanceGas, - MsgSubmitProposalGas: DefaultMsgSubmitProposalGas, - MsgVoteGas: DefaultMsgVoteGas, - MsgVoteWeightedGas: DefaultMsgVoteWeightedGas, - MsgDepositGas: DefaultMsgDepositGas, - MsgUnjailGas: DefaultMsgUnjailGas, - MsgImpeachGas: DefaultMsgImpeachGas, - MsgEditValidatorGas: DefaultMsgEditValidatorGas, - MsgDelegateGas: DefaultMsgDelegateGas, - MsgUndelegateGas: DefaultMsgUndelegateGas, - MsgBeginRedelegateGas: DefaultMsgBeginRedelegateGas, - MsgCancelUnbondingDelegationGas: DefaultMsgCancelUnbondingDelegationGas, + MaxTxSize: DefaultMaxTxSize, + MinGasPerByte: DefaultMinGasPerByte, + FixedMsgGas: DefaultFixedMsgGas, + MsgGrantPerItemGas: DefaultMsgGrantPerItemGas, + MsgMultiSendPerItemGas: DefaultMsgMultiSendPerItemGas, + MsgGrantAllowancePerItemGas: DefaultMsgGrantAllowancePerItemGas, } } @@ -220,70 +127,16 @@ func (p Params) Validate() error { if err := validateMinGasPerByte(p.MinGasPerByte); err != nil { return err } - if err := validateMsgGas(p.MsgGrantGas); err != nil { + if err := validateMsgGas(p.FixedMsgGas); err != nil { return err } - if err := validateMsgGas(p.MsgRevokeGas); err != nil { + if err := validateMsgGas(p.MsgGrantPerItemGas); err != nil { return err } - if err := validateMsgGas(p.MsgExecGas); err != nil { + if err := validateMsgGas(p.MsgMultiSendPerItemGas); err != nil { return err } - if err := validateMsgGas(p.MsgSendGas); err != nil { - return err - } - if err := validateMsgGas(p.MsgMultiSendGas); err != nil { - return err - } - if err := validateMsgGas(p.MsgWithdrawDelegatorRewardGas); err != nil { - return err - } - if err := validateMsgGas(p.MsgWithdrawValidatorCommissionGas); err != nil { - return err - } - if err := validateMsgGas(p.MsgSetWithdrawAddressGas); err != nil { - return err - } - if err := validateMsgGas(p.MsgFundCommunityPoolGas); err != nil { - return err - } - if err := validateMsgGas(p.MsgGrantAllowanceGas); err != nil { - return err - } - if err := validateMsgGas(p.MsgRevokeAllowanceGas); err != nil { - return err - } - if err := validateMsgGas(p.MsgSubmitProposalGas); err != nil { - return err - } - if err := validateMsgGas(p.MsgVoteGas); err != nil { - return err - } - if err := validateMsgGas(p.MsgVoteWeightedGas); err != nil { - return err - } - if err := validateMsgGas(p.MsgDepositGas); err != nil { - return err - } - if err := validateMsgGas(p.MsgUnjailGas); err != nil { - return err - } - if err := validateMsgGas(p.MsgImpeachGas); err != nil { - return err - } - if err := validateMsgGas(p.MsgEditValidatorGas); err != nil { - return err - } - if err := validateMsgGas(p.MsgDelegateGas); err != nil { - return err - } - if err := validateMsgGas(p.MsgUndelegateGas); err != nil { - return err - } - if err := validateMsgGas(p.MsgBeginRedelegateGas); err != nil { - return err - } - if err := validateMsgGas(p.MsgCancelUnbondingDelegationGas); err != nil { + if err := validateMsgGas(p.MsgGrantAllowancePerItemGas); err != nil { return err } diff --git a/x/staking/types/authz.go b/x/staking/types/authz.go index d60d469c98..1f9016cdbb 100644 --- a/x/staking/types/authz.go +++ b/x/staking/types/authz.go @@ -6,9 +6,9 @@ import ( "github.com/cosmos/cosmos-sdk/x/authz" ) -// // TODO: Revisit this once we have propoer gas fee framework. -// // Tracking issues https://github.com/cosmos/cosmos-sdk/issues/9054, https://github.com/cosmos/cosmos-sdk/discussions/9072 -// const gasCostPerIteration = uint64(10) +// TODO: Revisit this once we have propoer gas fee framework. +// Tracking issues https://github.com/cosmos/cosmos-sdk/issues/9054, https://github.com/cosmos/cosmos-sdk/discussions/9072 +const gasCostPerIteration = uint64(10) var _ authz.Authorization = &StakeAuthorization{} @@ -76,7 +76,7 @@ func (a StakeAuthorization) Accept(ctx sdk.Context, msg sdk.Msg) (authz.AcceptRe isValidatorExists := false allowedList := a.GetAllowList().GetAddress() for _, validator := range allowedList { - // ctx.GasMeter().ConsumeGas(gasCostPerIteration, "stake authorization") + ctx.GasMeter().ConsumeGas(gasCostPerIteration, "stake authorization") if validator == validatorAddress { isValidatorExists = true break @@ -85,7 +85,7 @@ func (a StakeAuthorization) Accept(ctx sdk.Context, msg sdk.Msg) (authz.AcceptRe denyList := a.GetDenyList().GetAddress() for _, validator := range denyList { - // ctx.GasMeter().ConsumeGas(gasCostPerIteration, "stake authorization") + ctx.GasMeter().ConsumeGas(gasCostPerIteration, "stake authorization") if validator == validatorAddress { return authz.AcceptResponse{}, sdkerrors.ErrUnauthorized.Wrapf("cannot delegate/undelegate to %s validator", validator) }