diff --git a/.golangci.yml b/.golangci.yml index bea16f24..e0db6fdb 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -9,9 +9,9 @@ run: linters: disable-all: true enable: + - copyloopvar - errcheck - dogsled - - exportloopref - goconst - gocritic - gci diff --git a/app/ante/ante.go b/app/ante/ante.go index 56f7cb02..3167ffea 100644 --- a/app/ante/ante.go +++ b/app/ante/ante.go @@ -32,6 +32,7 @@ type HandlerOptions struct { FeeAbskeeper feeabskeeper.Keeper FeeMarketKeeper feemarketante.FeeMarketKeeper AccountKeeper feemarketante.AccountKeeper + BankKeeper feemarketante.BankKeeper } // NewAnteHandler constructor @@ -63,6 +64,9 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { circuitante.NewCircuitBreakerDecorator(options.CircuitKeeper), ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker), feemarketante.NewFeeMarketCheckDecorator( // fee market check replaces fee deduct decorator + options.AccountKeeper, + options.BankKeeper, + options.FeegrantKeeper, options.FeeMarketKeeper, ante.NewDeductFeeDecorator( options.AccountKeeper, diff --git a/app/ante/ante_test.go b/app/ante/ante_test.go index b21efa9d..26d260a1 100644 --- a/app/ante/ante_test.go +++ b/app/ante/ante_test.go @@ -6,12 +6,14 @@ import ( "github.com/osmosis-labs/fee-abstraction/v8/x/feeabs/types" feemarketante "github.com/skip-mev/feemarket/x/feemarket/ante" feemarkettypes "github.com/skip-mev/feemarket/x/feemarket/types" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" "cosmossdk.io/errors" math "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -45,7 +47,10 @@ func TestMempoolDecorator(t *testing.T) { { "valid native fee, should pass", validFee, - func(suite *AnteTestSuite) {}, + func(suite *AnteTestSuite) { + suite.bankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, mock.Anything, + feemarkettypes.FeeCollectorName, mock.Anything).Return(nil).Once() + }, nil, }, { @@ -56,6 +61,8 @@ func TestMempoolDecorator(t *testing.T) { require.NoError(t, err) suite.feeabsKeeper.SetTwapRate(suite.ctx, "ibcfee", math.LegacyNewDec(1)) suite.stakingKeeper.EXPECT().BondDenom(gomock.Any()).Return("ueve", nil).AnyTimes() + suite.bankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, mock.Anything, + feemarkettypes.FeeCollectorName, mock.Anything).Return(nil).Once() }, nil, }, @@ -93,11 +100,19 @@ func TestMempoolDecorator(t *testing.T) { tc.malleate(suite) suite.txBuilder.SetGasLimit(gasLimit) suite.txBuilder.SetFeeAmount(tc.feeAmount) + accs := suite.CreateTestAccounts(1) + require.NoError(t, suite.txBuilder.SetMsgs([]sdk.Msg{testdata.NewTestMsg(accs[0].acc.GetAddress())}...)) + suite.ctx = suite.ctx.WithMinGasPrices(minGasPrice) // Construct tx and run through mempool decorator tx := suite.txBuilder.GetTx() - feemarketDecorator := feemarketante.NewFeeMarketCheckDecorator(suite.feemarketKeeper, nil) + feemarketDecorator := feemarketante.NewFeeMarketCheckDecorator( + suite.accountKeeper, + suite.bankKeeper, + suite.feeGrantKeeper, + suite.feemarketKeeper, + nil) antehandler := sdk.ChainAnteDecorators(feemarketDecorator) // Run the ante handler diff --git a/app/ante/suite.go b/app/ante/suite.go index 90faa786..1413c21a 100644 --- a/app/ante/suite.go +++ b/app/ante/suite.go @@ -11,6 +11,7 @@ import ( feeabstestutil "github.com/osmosis-labs/fee-abstraction/v8/x/feeabs/testutil" feeabstypes "github.com/osmosis-labs/fee-abstraction/v8/x/feeabs/types" feemarketante "github.com/skip-mev/feemarket/x/feemarket/ante" + feemarketmocks "github.com/skip-mev/feemarket/x/feemarket/ante/mocks" feemarketkeeper "github.com/skip-mev/feemarket/x/feemarket/keeper" feemarkettypes "github.com/skip-mev/feemarket/x/feemarket/types" "github.com/stretchr/testify/require" @@ -45,7 +46,7 @@ type AnteTestSuite struct { clientCtx client.Context txBuilder client.TxBuilder accountKeeper authkeeper.AccountKeeper - bankKeeper *feeabstestutil.MockBankKeeper + bankKeeper *feemarketmocks.BankKeeper feeGrantKeeper *feeabstestutil.MockFeegrantKeeper stakingKeeper *feeabstestutil.MockStakingKeeper feeabsKeeper feeabskeeper.Keeper @@ -65,7 +66,7 @@ func SetupTestSuite(t *testing.T, isCheckTx bool) *AnteTestSuite { govAuthority := authtypes.NewModuleAddress("gov").String() // Setup mock keepers - suite.bankKeeper = feeabstestutil.NewMockBankKeeper(ctrl) + suite.bankKeeper = feemarketmocks.NewBankKeeper(t) suite.stakingKeeper = feeabstestutil.NewMockStakingKeeper(ctrl) suite.feeGrantKeeper = feeabstestutil.NewMockFeegrantKeeper(ctrl) suite.channelKeeper = feeabstestutil.NewMockChannelKeeper(ctrl) @@ -99,7 +100,8 @@ func SetupTestSuite(t *testing.T, isCheckTx bool) *AnteTestSuite { suite.encCfg.Amino.RegisterConcrete(&testdata.TestMsg{}, "testdata.TestMsg", nil) testdata.RegisterInterfaces(suite.encCfg.InterfaceRegistry) suite.accountKeeper = authkeeper.NewAccountKeeper( - suite.encCfg.Codec, runtime.NewKVStoreService(key), authtypes.ProtoBaseAccount, maccPerms, authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), sdk.Bech32MainPrefix, govAuthority, + suite.encCfg.Codec, runtime.NewKVStoreService(authKey), authtypes.ProtoBaseAccount, maccPerms, + authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), sdk.Bech32MainPrefix, govAuthority, ) suite.accountKeeper.SetModuleAccount(suite.ctx, authtypes.NewEmptyModuleAccount(feeabstypes.ModuleName)) // Setup feeabs keeper diff --git a/app/app.go b/app/app.go index 6481807f..f184aabb 100644 --- a/app/app.go +++ b/app/app.go @@ -1114,7 +1114,6 @@ func (app *EveApp) setPostHandler() { postHandler := feemarketapp.PostHandlerOptions{ AccountKeeper: app.AccountKeeper, BankKeeper: app.BankKeeper, - FeeGrantKeeper: app.FeeGrantKeeper, FeeMarketKeeper: app.FeeMarketKeeper, } // Set the PostHandler for the app @@ -1380,7 +1379,6 @@ func NewPostHandler(options feemarketapp.PostHandlerOptions) (sdk.PostHandler, e feemarketpost.NewFeeMarketDeductDecorator( options.AccountKeeper, options.BankKeeper, - options.FeeGrantKeeper, options.FeeMarketKeeper, ), } diff --git a/app/upgrades.go b/app/upgrades.go index 071534cd..18e9f8e9 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -76,7 +76,6 @@ func (app *EveApp) RegisterUpgradeHandlers() { func setupLegacyKeyTables(k *paramskeeper.Keeper) { for _, subspace := range k.GetSubspaces() { - subspace := subspace var keyTable paramstypes.KeyTable switch subspace.Name() { diff --git a/go.mod b/go.mod index e70c0e75..13d1d12f 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module github.com/eve-network/eve -go 1.22.3 +go 1.22.6 -toolchain go1.22.4 +toolchain go1.23.1 require ( github.com/CosmWasm/wasmd v0.53.0 @@ -28,7 +28,7 @@ require ( github.com/stretchr/testify v1.9.0 github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect google.golang.org/genproto v0.0.0-20240401170217-c3f982113cda // indirect - google.golang.org/grpc v1.64.1 // indirect + google.golang.org/grpc v1.65.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) @@ -54,7 +54,7 @@ require ( github.com/cosmos/ibc-go/modules/light-clients/08-wasm v0.2.1-0.20240523101951-4b45d1822fb6 github.com/cosmos/ibc-go/v8 v8.4.0 github.com/osmosis-labs/tokenfactory v0.0.0-20240310155926-981fbeb0fe42 - github.com/skip-mev/feemarket v1.0.4 + github.com/skip-mev/feemarket v1.1.1 github.com/terra-money/alliance v0.4.3 go.uber.org/mock v0.4.0 ) @@ -186,6 +186,7 @@ require ( github.com/shamaton/msgpack/v2 v2.2.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect + github.com/stretchr/objx v0.5.2 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/tendermint/go-amino v0.16.0 // indirect github.com/tidwall/btree v1.7.0 // indirect diff --git a/go.sum b/go.sum index ab22ddff..af12aa9d 100644 --- a/go.sum +++ b/go.sum @@ -1325,8 +1325,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= 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.1 h1:L34K7N2J6o635kzNYRAvQ93+hAFtSiJ2t03jmaNx0zw= +github.com/skip-mev/feemarket v1.1.1/go.mod h1:DUa6djUsTeMOrbrcIZqWSVxU9IZNCXp96ruaojyBNpc= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -1521,8 +1521,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= -golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= +golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1860,8 +1860,8 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= -golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= -golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= +golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= +golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -2148,8 +2148,8 @@ google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5v google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= -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=