diff --git a/proto/cosmos/gashub/v1alpha1/gashub.proto b/proto/cosmos/gashub/v1alpha1/gashub.proto index 1e28f5cfa3..dce47ed3e7 100644 --- a/proto/cosmos/gashub/v1alpha1/gashub.proto +++ b/proto/cosmos/gashub/v1alpha1/gashub.proto @@ -12,9 +12,8 @@ message Params { uint64 max_tx_size = 1 [(gogoproto.customname) = "MaxTxSize"]; uint64 min_gas_per_byte = 2 [(gogoproto.customname) = "MinGasPerByte"]; - string min_gas_price = 3 [(gogoproto.customname) = "MinGasPrice"]; - repeated MsgGasParams msg_gas_params_set = 4 [(gogoproto.customname) = "MsgGasParamsSet"]; + repeated MsgGasParams msg_gas_params_set = 3 [(gogoproto.customname) = "MsgGasParamsSet"]; } // MsgGasParams defines gas for a msg type diff --git a/x/auth/ante/ante.go b/x/auth/ante/ante.go index c2ed116bd3..a562e67ee3 100644 --- a/x/auth/ante/ante.go +++ b/x/auth/ante/ante.go @@ -16,7 +16,6 @@ type HandlerOptions struct { FeegrantKeeper FeegrantKeeper SignModeHandler authsigning.SignModeHandler SigGasConsumer func(meter sdk.GasMeter, sig signing.SignatureV2, params types.Params) error - GashubKeeper GashubKeeper TxFeeChecker TxFeeChecker } @@ -43,7 +42,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { NewTxTimeoutHeightDecorator(), NewValidateMemoDecorator(options.AccountKeeper), NewConsumeGasForTxSizeDecorator(options.AccountKeeper), - NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.GashubKeeper, options.TxFeeChecker), + NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker), NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators NewValidateSigCountDecorator(options.AccountKeeper), NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer), diff --git a/x/auth/ante/fee.go b/x/auth/ante/fee.go index 2f29e64ef4..4ab9dda9ee 100644 --- a/x/auth/ante/fee.go +++ b/x/auth/ante/fee.go @@ -10,7 +10,7 @@ import ( // TxFeeChecker check if the provided fee is enough and returns the effective fee and tx priority, // the effective fee should be deducted later, and the priority should be returned in abci response. -type TxFeeChecker func(ctx sdk.Context, ghk GashubKeeper, tx sdk.Tx) (sdk.Coins, int64, error) +type TxFeeChecker func(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, int64, error) // DeductFeeDecorator deducts fees from the first signer of the tx // If the first signer does not have the funds to pay for the fees, return with InsufficientFunds error @@ -21,10 +21,9 @@ type DeductFeeDecorator struct { bankKeeper types.BankKeeper feegrantKeeper FeegrantKeeper txFeeChecker TxFeeChecker - gashubKeeper GashubKeeper } -func NewDeductFeeDecorator(ak AccountKeeper, bk types.BankKeeper, fk FeegrantKeeper, ghk GashubKeeper, tfc TxFeeChecker) DeductFeeDecorator { +func NewDeductFeeDecorator(ak AccountKeeper, bk types.BankKeeper, fk FeegrantKeeper, tfc TxFeeChecker) DeductFeeDecorator { if tfc == nil { tfc = checkTxFeeWithValidatorMinGasPrices } @@ -34,7 +33,6 @@ func NewDeductFeeDecorator(ak AccountKeeper, bk types.BankKeeper, fk FeegrantKee bankKeeper: bk, feegrantKeeper: fk, txFeeChecker: tfc, - gashubKeeper: ghk, } } @@ -55,7 +53,7 @@ func (dfd DeductFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bo fee := feeTx.GetFee() if !simulate { - fee, priority, err = dfd.txFeeChecker(ctx, dfd.gashubKeeper, tx) + fee, priority, err = dfd.txFeeChecker(ctx, tx) if err != nil { return ctx, err } diff --git a/x/auth/ante/fee_test.go b/x/auth/ante/fee_test.go index d4cb2c1f9d..e1f46db510 100644 --- a/x/auth/ante/fee_test.go +++ b/x/auth/ante/fee_test.go @@ -12,7 +12,7 @@ func (s *AnteTestSuite) TestDeductFeeDecorator_ZeroGas() { s.SetupTest(true) // setup s.txBuilder = s.clientCtx.TxConfig.NewTxBuilder() - mfd := ante.NewDeductFeeDecorator(s.app.AccountKeeper, s.app.BankKeeper, s.app.FeeGrantKeeper, s.app.GashubKeeper, nil) + mfd := ante.NewDeductFeeDecorator(s.app.AccountKeeper, s.app.BankKeeper, s.app.FeeGrantKeeper, nil) antehandler := sdk.ChainAnteDecorators(mfd) // keys and addresses @@ -46,7 +46,7 @@ func (s *AnteTestSuite) TestEnsureMempoolFees() { s.SetupTest(true) // setup s.txBuilder = s.clientCtx.TxConfig.NewTxBuilder() - mfd := ante.NewDeductFeeDecorator(s.app.AccountKeeper, s.app.BankKeeper, s.app.FeeGrantKeeper, s.app.GashubKeeper, nil) + mfd := ante.NewDeductFeeDecorator(s.app.AccountKeeper, s.app.BankKeeper, s.app.FeeGrantKeeper, nil) antehandler := sdk.ChainAnteDecorators(mfd) // keys and addresses @@ -130,7 +130,7 @@ func (s *AnteTestSuite) TestDeductFees() { err = testutil.FundAccount(s.app.BankKeeper, s.ctx, addr1, coins) s.Require().NoError(err) - dfd := ante.NewDeductFeeDecorator(s.app.AccountKeeper, s.app.BankKeeper, nil, s.app.GashubKeeper, nil) + dfd := ante.NewDeductFeeDecorator(s.app.AccountKeeper, s.app.BankKeeper, nil, nil) antehandler := sdk.ChainAnteDecorators(dfd) _, err = antehandler(s.ctx, tx, false) diff --git a/x/auth/ante/feegrant_test.go b/x/auth/ante/feegrant_test.go index 5bdd1c19b7..be1a4f1d29 100644 --- a/x/auth/ante/feegrant_test.go +++ b/x/auth/ante/feegrant_test.go @@ -32,7 +32,7 @@ func (suite *AnteTestSuite) TestDeductFeesNoDelegation() { protoTxCfg := tx.NewTxConfig(codec.NewProtoCodec(app.InterfaceRegistry()), tx.DefaultSignModes) // this just tests our handler - dfd := ante.NewDeductFeeDecorator(app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.GashubKeeper, nil) + dfd := ante.NewDeductFeeDecorator(app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, nil) feeAnteHandler := sdk.ChainAnteDecorators(dfd) // this tests the whole stack diff --git a/x/auth/ante/validator_tx_fee.go b/x/auth/ante/validator_tx_fee.go index 8d49c6fcdd..dbb1398880 100644 --- a/x/auth/ante/validator_tx_fee.go +++ b/x/auth/ante/validator_tx_fee.go @@ -9,7 +9,7 @@ import ( // checkTxFeeWithValidatorMinGasPrices implements the default fee logic, where the minimum price per // unit of gas is fixed and set by each validator, can the tx priority is computed from the gas price. -func checkTxFeeWithValidatorMinGasPrices(ctx sdk.Context, ghk GashubKeeper, tx sdk.Tx) (sdk.Coins, int64, error) { +func checkTxFeeWithValidatorMinGasPrices(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, int64, error) { feeTx, ok := tx.(sdk.FeeTx) if !ok { return nil, 0, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx") @@ -40,15 +40,15 @@ func checkTxFeeWithValidatorMinGasPrices(ctx sdk.Context, ghk GashubKeeper, tx s } } - priority := GetTxPriority(feeCoins, int64(gas)) + priority := getTxPriority(feeCoins, int64(gas)) return feeCoins, priority, nil } -// GetTxPriority returns a naive tx priority based on the amount of the smallest denomination of the gas price +// getTxPriority returns a naive tx priority based on the amount of the smallest denomination of the gas price // provided in a transaction. // NOTE: This implementation should be used with a great consideration as it opens potential attack vectors // where txs with multiple coins could not be prioritize as expected. -func GetTxPriority(fee sdk.Coins, gas int64) int64 { +func getTxPriority(fee sdk.Coins, gas int64) int64 { var priority int64 for _, c := range fee { p := int64(math.MaxInt64) diff --git a/x/gashub/simulation/genesis.go b/x/gashub/simulation/genesis.go index d72766e52d..7312d9da68 100644 --- a/x/gashub/simulation/genesis.go +++ b/x/gashub/simulation/genesis.go @@ -3,7 +3,6 @@ package simulation import ( "fmt" "math/rand" - "strconv" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/types/simulation" @@ -15,7 +14,6 @@ import ( const ( MaxTxSize = "max_tx_size" MinGasPerByte = "min_gas_per_byte" - MinGasPrice = "min_gas_price" MsgGas = "msg_gas" ) @@ -29,12 +27,6 @@ func GenMinGasPerByte(r *rand.Rand) uint64 { return uint64(simulation.RandIntBetween(r, 5, 50)) } -// GenMinGasPrice randomized MinGasPrice -func GenMinGasPrice(r *rand.Rand) string { - amount := simulation.RandIntBetween(r, 1, 10) - return strconv.FormatInt(int64(amount), 10) + "gweibnb" -} - // GenMsgGasParams randomized msg gas consumption func GenMsgGasParams(r *rand.Rand) *types.MsgGasParams { msgTypeUrl := simulation.RandStringOfLength(r, 12) @@ -56,19 +48,13 @@ func RandomizedGenState(simState *module.SimulationState) { func(r *rand.Rand) { minGasPerByte = GenMinGasPerByte(r) }, ) - var minGasPrice string - simState.AppParams.GetOrGenerate( - simState.Cdc, MinGasPrice, &minGasPrice, simState.Rand, - func(r *rand.Rand) { minGasPrice = GenMinGasPrice(r) }, - ) - var msgGasParams *types.MsgGasParams simState.AppParams.GetOrGenerate( simState.Cdc, MsgGas, &msgGasParams, simState.Rand, func(r *rand.Rand) { msgGasParams = GenMsgGasParams(r) }, ) - params := types.NewParams(maxTxSize, minGasPerByte, minGasPrice, []*types.MsgGasParams{msgGasParams}) + params := types.NewParams(maxTxSize, minGasPerByte, []*types.MsgGasParams{msgGasParams}) gashubGenesis := types.NewGenesisState(params) diff --git a/x/gashub/simulation/genesis_test.go b/x/gashub/simulation/genesis_test.go index 6318ee5870..88078bf785 100644 --- a/x/gashub/simulation/genesis_test.go +++ b/x/gashub/simulation/genesis_test.go @@ -42,8 +42,7 @@ func TestRandomizedGenState(t *testing.T) { require.Equal(t, uint64(2540), gashubGenesis.Params.MaxTxSize) require.Equal(t, uint64(36), gashubGenesis.Params.MinGasPerByte) - require.Equal(t, "7gweibnb", gashubGenesis.Params.MinGasPrice) gas := gashubGenesis.Params.MsgGasParamsSet[0].GasParams.(*types.MsgGasParams_FixedType) - require.Equal(t, uint64(4828162), gas.FixedType.FixedGas) + require.Equal(t, uint64(4978511), gas.FixedType.FixedGas) } diff --git a/x/gashub/types/gashub.pb.go b/x/gashub/types/gashub.pb.go index 7f2734ea06..f59f92c25e 100644 --- a/x/gashub/types/gashub.pb.go +++ b/x/gashub/types/gashub.pb.go @@ -27,8 +27,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package 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"` - MinGasPrice string `protobuf:"bytes,3,opt,name=min_gas_price,json=minGasPrice,proto3" json:"min_gas_price,omitempty"` - MsgGasParamsSet []*MsgGasParams `protobuf:"bytes,4,rep,name=msg_gas_params_set,json=msgGasParamsSet,proto3" json:"msg_gas_params_set,omitempty"` + MsgGasParamsSet []*MsgGasParams `protobuf:"bytes,3,rep,name=msg_gas_params_set,json=msgGasParamsSet,proto3" json:"msg_gas_params_set,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -77,13 +76,6 @@ func (m *Params) GetMinGasPerByte() uint64 { return 0 } -func (m *Params) GetMinGasPrice() string { - if m != nil { - return m.MinGasPrice - } - return "" -} - func (m *Params) GetMsgGasParamsSet() []*MsgGasParams { if m != nil { return m.MsgGasParamsSet @@ -298,39 +290,37 @@ func init() { } var fileDescriptor_f79bf23b48853a4a = []byte{ - // 497 bytes of a gzipped FileDescriptorProto + // 472 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0x8e, 0x9b, 0xa8, 0x4a, 0x9e, 0x9d, 0xa6, 0x1c, 0x08, 0x45, 0x19, 0xec, 0xa8, 0x30, 0x04, - 0xa1, 0xda, 0xb4, 0x11, 0x4b, 0x36, 0x2c, 0x7e, 0x0e, 0x91, 0x2a, 0x37, 0x2c, 0x5d, 0xac, 0x4b, - 0x72, 0x71, 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, 0x28, 0x23, 0x33, 0xd5, 0xa3, 0x56, 0xed, + 0x9e, 0x9c, 0xde, 0xe5, 0xb0, 0xee, 0x1b, 0xd9, 0xb6, 0x49, 0xdf, 0x19, 0x41, 0x47, 0x11, 0x49, + 0x62, 0x74, 0x01, 0xd6, 0x2c, 0x5f, 0x62, 0x16, 0x4d, 0x35, 0x6f, 0x4b, 0xf1, 0xbe, 0xb8, 0x13, + 0xef, 0x2b, 0xdd, 0xd8, 0x64, 0xee, 0x56, 0x64, 0x92, 0x7b, 0xf0, 0x12, 0x76, 0x6e, 0x8f, 0x46, + 0x4f, 0x41, 0x8f, 0x96, 0xd2, 0x57, 0x37, 0x6c, 0x95, 0x85, 0xd3, 0xae, 0x61, 0x41, 0x7b, 0x5e, + 0x45, 0xc3, 0x2d, 0xa9, 0xdb, 0x60, 0x05, 0x7b, 0x7f, 0x4f, 0xf9, 0x0f, 0x12, 0xa9, 0x72, 0x6d, + 0x90, 0x48, 0x10, 0x56, 0x19, 0x44, 0xa9, 0xac, 0xed, 0xf0, 0x5e, 0x10, 0x16, 0x00, 0xdd, 0xc4, + 0x7a, 0xac, 0xfe, 0xfa, 0x16, 0xc0, 0x1f, 0x8b, 0xf8, 0xaf, 0xbf, 0x95, 0xb6, 0x79, 0x53, 0xda, + 0xe6, 0x8f, 0xd2, 0x36, 0x3f, 0xaf, 0x6d, 0xe3, 0x66, 0x6d, 0x1b, 0xdf, 0xd7, 0xb6, 0x71, 0xf1, + 0x8c, 0x46, 0x42, 0xaa, 0x34, 0x8d, 0x99, 0x57, 0x3d, 0x11, 0xfd, 0x3b, 0xe2, 0xb3, 0x8f, 0x5e, + 0x56, 0xbf, 0x17, 0xa9, 0x2f, 0x9f, 0x6c, 0x2b, 0xe3, 0x9f, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, + 0x82, 0x64, 0x55, 0x0f, 0x4d, 0x03, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -358,9 +348,6 @@ func (this *Params) Equal(that interface{}) bool { if this.MinGasPerByte != that1.MinGasPerByte { return false } - if this.MinGasPrice != that1.MinGasPrice { - return false - } if len(this.MsgGasParamsSet) != len(that1.MsgGasParamsSet) { return false } @@ -534,16 +521,9 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGashub(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } } - if len(m.MinGasPrice) > 0 { - i -= len(m.MinGasPrice) - copy(dAtA[i:], m.MinGasPrice) - i = encodeVarintGashub(dAtA, i, uint64(len(m.MinGasPrice))) - i-- - dAtA[i] = 0x1a - } if m.MinGasPerByte != 0 { i = encodeVarintGashub(dAtA, i, uint64(m.MinGasPerByte)) i-- @@ -722,10 +702,6 @@ func (m *Params) Size() (n int) { if m.MinGasPerByte != 0 { n += 1 + sovGashub(uint64(m.MinGasPerByte)) } - l = len(m.MinGasPrice) - if l > 0 { - n += 1 + l + sovGashub(uint64(l)) - } if len(m.MsgGasParamsSet) > 0 { for _, e := range m.MsgGasParamsSet { l = e.Size() @@ -876,38 +852,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { } } case 3: - 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 ErrIntOverflowGashub - } - 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 ErrInvalidLengthGashub - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGashub - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MinGasPrice = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MsgGasParamsSet", wireType) } diff --git a/x/gashub/types/params.go b/x/gashub/types/params.go index 92af20bbef..927cef5731 100644 --- a/x/gashub/types/params.go +++ b/x/gashub/types/params.go @@ -6,7 +6,6 @@ import ( "sigs.k8s.io/yaml" codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) @@ -14,14 +13,12 @@ import ( const ( DefaultMaxTxSize uint64 = 1024 DefaultMinGasPerByte uint64 = 5 - DefaultMinGasPrice string = "1gweibnb" ) // Parameter keys var ( KeyMaxTxSize = []byte("MaxTxSize") KeyMinGasPerByte = []byte("MinGasPerByte") - KeyMinGasPrice = []byte("MinGasPrice") KeyMsgGasParamsSet = []byte("MsgGasParamsSet") ) @@ -48,12 +45,11 @@ func NewMsgGasParamsWithDynamicGas(msgTypeUrl string, gasFixed, gasPerItem uint6 // NewParams creates a new Params object func NewParams( - maxTxSize, minGasPerByte uint64, minGasPrice string, msgGasParamsSet []*MsgGasParams, + maxTxSize, minGasPerByte uint64, msgGasParamsSet []*MsgGasParams, ) Params { return Params{ MaxTxSize: maxTxSize, MinGasPerByte: minGasPerByte, - MinGasPrice: minGasPrice, MsgGasParamsSet: msgGasParamsSet, } } @@ -69,7 +65,6 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ paramtypes.NewParamSetPair(KeyMaxTxSize, &p.MaxTxSize, validateMaxTxSize), paramtypes.NewParamSetPair(KeyMinGasPerByte, &p.MinGasPerByte, validateMinGasPerByte), - paramtypes.NewParamSetPair(KeyMinGasPrice, &p.MinGasPrice, validateMinGasPrice), paramtypes.NewParamSetPair(KeyMsgGasParamsSet, &p.MsgGasParamsSet, validateMsgGasParams), } } @@ -121,7 +116,6 @@ func DefaultParams() Params { return Params{ MaxTxSize: DefaultMaxTxSize, MinGasPerByte: DefaultMinGasPerByte, - MinGasPrice: DefaultMinGasPrice, MsgGasParamsSet: defaultMsgGasParamsSet, } } @@ -158,20 +152,6 @@ func validateMinGasPerByte(i interface{}) error { return nil } -func validateMinGasPrice(i interface{}) error { - v, ok := i.(string) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - gp, err := sdk.ParseCoinNormalized(v) - if err != nil || gp.Amount.IsZero() || gp.Amount.IsNil() { - return fmt.Errorf("invalid gas price") - } - - return nil -} - func validateMsgGasParams(i interface{}) error { v, ok := i.([]*MsgGasParams) if !ok { @@ -206,9 +186,6 @@ func (p Params) Validate() error { if err := validateMinGasPerByte(p.MinGasPerByte); err != nil { return err } - if err := validateMinGasPrice(p.MinGasPrice); err != nil { - return err - } if err := validateMsgGasParams(p.MsgGasParamsSet); err != nil { return err }