From 5aacc03e0709076fc29c62ca572cef6897cc2404 Mon Sep 17 00:00:00 2001 From: Ajaz Ahmed Ansari <53616488+ajansari95@users.noreply.github.com> Date: Fri, 30 Aug 2024 18:06:27 +0530 Subject: [PATCH] fix: `x/feemarket` (#836) ## 1. Overview - v1.0.x had a bug that was not prededucting fees - this fix updates wiring and bumps version - refer [this](https://github.com/cosmos/gaia/commit/92a2a88da512a1d8102817c61bd23cd65dda93c8). --- ante/ante.go | 15 ++++++++++++++- app/app.go | 13 +++++-------- app/post.go | 2 -- go.mod | 6 +++--- go.sum | 8 ++++---- 5 files changed, 26 insertions(+), 18 deletions(-) diff --git a/ante/ante.go b/ante/ante.go index 822f7725d..533fda091 100644 --- a/ante/ante.go +++ b/ante/ante.go @@ -1,17 +1,21 @@ package ante import ( + storetypes "cosmossdk.io/store/types" feemarketante "github.com/skip-mev/feemarket/x/feemarket/ante" feemarketkeeper "github.com/skip-mev/feemarket/x/feemarket/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante" ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" corestoretypes "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" + txsigning "cosmossdk.io/x/tx/signing" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/tx/signing" "github.com/cosmos/cosmos-sdk/x/auth/ante" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" @@ -27,7 +31,13 @@ var UseFeeMarketDecorator = true // HandlerOptions extend the SDK's AnteHandler options by requiring the IBC // channel keeper. type HandlerOptions struct { - ante.HandlerOptions + ExtensionOptionChecker ante.ExtensionOptionChecker + FeegrantKeeper ante.FeegrantKeeper + SignModeHandler *txsigning.HandlerMap + SigGasConsumer func(meter storetypes.GasMeter, sig signing.SignatureV2, params authtypes.Params) error + + AccountKeeper feemarketante.AccountKeeper + BankKeeper feemarketante.BankKeeper Codec codec.BinaryCodec IBCkeeper *ibckeeper.Keeper StakingKeeper *stakingkeeper.Keeper @@ -85,6 +95,9 @@ func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) { if UseFeeMarketDecorator { anteDecorators = append(anteDecorators, feemarketante.NewFeeMarketCheckDecorator( + opts.AccountKeeper, + opts.BankKeeper, + opts.FeegrantKeeper, opts.FeeMarketKeeper, ante.NewDeductFeeDecorator( opts.AccountKeeper, diff --git a/app/app.go b/app/app.go index 361d135fe..a0b5517db 100644 --- a/app/app.go +++ b/app/app.go @@ -315,13 +315,11 @@ func New( anteHandler, err := quasarante.NewAnteHandler( quasarante.HandlerOptions{ - HandlerOptions: ante.HandlerOptions{ - AccountKeeper: app.AccountKeeper, - BankKeeper: app.BankKeeper, - FeegrantKeeper: app.FeeGrantKeeper, - SignModeHandler: txConfig.SignModeHandler(), - SigGasConsumer: ante.DefaultSigVerificationGasConsumer, - }, + AccountKeeper: app.AccountKeeper, + BankKeeper: app.BankKeeper, + FeegrantKeeper: app.FeeGrantKeeper, + SignModeHandler: txConfig.SignModeHandler(), + SigGasConsumer: ante.DefaultSigVerificationGasConsumer, Codec: appCodec, IBCkeeper: app.IBCKeeper, StakingKeeper: app.StakingKeeper, @@ -340,7 +338,6 @@ func New( postHandlerOptions := PostHandlerOptions{ AccountKeeper: app.AccountKeeper, BankKeeper: app.BankKeeper, - FeeGrantKeeper: app.FeeGrantKeeper, FeeMarketKeeper: app.FeeMarketKeeper, } postHandler, err := NewPostHandler(postHandlerOptions) diff --git a/app/post.go b/app/post.go index ab2733a6c..ad6cf8855 100644 --- a/app/post.go +++ b/app/post.go @@ -16,7 +16,6 @@ type PostHandlerOptions struct { AccountKeeper feemarketpost.AccountKeeper BankKeeper feemarketpost.BankKeeper FeeMarketKeeper feemarketpost.FeeMarketKeeper - FeeGrantKeeper feemarketpost.FeeGrantKeeper } // NewPostHandler returns a PostHandler chain with the fee deduct decorator. @@ -41,7 +40,6 @@ func NewPostHandler(options PostHandlerOptions) (sdk.PostHandler, error) { feemarketpost.NewFeeMarketDeductDecorator( options.AccountKeeper, options.BankKeeper, - options.FeeGrantKeeper, options.FeeMarketKeeper, ), } diff --git a/go.mod b/go.mod index 676d50678..652a29da2 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/quasar-finance/quasar -go 1.22.5 +go 1.22.6 require ( cosmossdk.io/api v0.7.5 @@ -34,12 +34,12 @@ require ( github.com/golangci/golangci-lint v1.60.2 github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/skip-mev/feemarket v1.0.4 + github.com/skip-mev/feemarket v1.1.0 github.com/spf13/cast v1.7.0 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 google.golang.org/genproto/googleapis/api v0.0.0-20240725223205-93522f1f2a9f - google.golang.org/grpc v1.64.1 + google.golang.org/grpc v1.65.0 google.golang.org/protobuf v1.34.2 ) diff --git a/go.sum b/go.sum index 07fa5d4e1..712515cde 100644 --- a/go.sum +++ b/go.sum @@ -1248,8 +1248,8 @@ github.com/sivchari/tenv v1.10.0 h1:g/hzMA+dBCKqGXgW8AV/1xIWhAvDrx0zFKNR48NFMg0= github.com/sivchari/tenv v1.10.0/go.mod h1:tdY24masnVoZFxYrHv/nD6Tc8FbkEtAQEEziXpyMgqY= github.com/skip-mev/chaintestutil v0.0.0-20240514161515-056d7ba45610 h1:4JlsiRVt/YZOvrKH525T7sZXgEWUEjqSDMwE6fXNbdo= github.com/skip-mev/chaintestutil v0.0.0-20240514161515-056d7ba45610/go.mod h1:kB8gFZX07CyJnw8q9iEZijI3qJTIe1K/Y++P5VGkrcg= -github.com/skip-mev/feemarket v1.0.4 h1:OPZ9D0tlDUa55n+HIjE2DgL+geMOwcDwUXTYdz4ig9Y= -github.com/skip-mev/feemarket v1.0.4/go.mod h1:lszt7zGEEActbDYq1hOKogQvfCsnLEHH5113LwgmYcE= +github.com/skip-mev/feemarket v1.1.0 h1:3z/3Mplmk4t1C/IjghC+OE361L9n8dR3Xr7bXIcS7ec= +github.com/skip-mev/feemarket v1.1.0/go.mod h1:CVsCaHxJDK4y271c1Dan6Z8G2QaOyWJLoSBnDEPon40= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= @@ -2026,8 +2026,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA= -google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0= +google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= +google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=