Skip to content

Commit cda8019

Browse files
faddataljo242
and
aljo242
authored
fix: Fee market blackberry (#277)
* update mod and fix app * fix testing suite * gofumpt & gci * tidy * lint * lint --------- Co-authored-by: aljo242 <[email protected]>
1 parent 9bcfd79 commit cda8019

File tree

8 files changed

+40
-21
lines changed

8 files changed

+40
-21
lines changed

.golangci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ run:
99
linters:
1010
disable-all: true
1111
enable:
12+
- copyloopvar
1213
- errcheck
1314
- dogsled
14-
- exportloopref
1515
- goconst
1616
- gocritic
1717
- gci

app/ante/ante.go

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ type HandlerOptions struct {
3232
FeeAbskeeper feeabskeeper.Keeper
3333
FeeMarketKeeper feemarketante.FeeMarketKeeper
3434
AccountKeeper feemarketante.AccountKeeper
35+
BankKeeper feemarketante.BankKeeper
3536
}
3637

3738
// NewAnteHandler constructor
@@ -63,6 +64,9 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
6364
circuitante.NewCircuitBreakerDecorator(options.CircuitKeeper),
6465
ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker),
6566
feemarketante.NewFeeMarketCheckDecorator( // fee market check replaces fee deduct decorator
67+
options.AccountKeeper,
68+
options.BankKeeper,
69+
options.FeegrantKeeper,
6670
options.FeeMarketKeeper,
6771
ante.NewDeductFeeDecorator(
6872
options.AccountKeeper,

app/ante/ante_test.go

+17-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ import (
66
"github.com/osmosis-labs/fee-abstraction/v8/x/feeabs/types"
77
feemarketante "github.com/skip-mev/feemarket/x/feemarket/ante"
88
feemarkettypes "github.com/skip-mev/feemarket/x/feemarket/types"
9+
"github.com/stretchr/testify/mock"
910
"github.com/stretchr/testify/require"
1011
"go.uber.org/mock/gomock"
1112

1213
"cosmossdk.io/errors"
1314
math "cosmossdk.io/math"
1415

16+
"github.com/cosmos/cosmos-sdk/testutil/testdata"
1517
sdk "github.com/cosmos/cosmos-sdk/types"
1618
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
1719
)
@@ -45,7 +47,10 @@ func TestMempoolDecorator(t *testing.T) {
4547
{
4648
"valid native fee, should pass",
4749
validFee,
48-
func(suite *AnteTestSuite) {},
50+
func(suite *AnteTestSuite) {
51+
suite.bankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, mock.Anything,
52+
feemarkettypes.FeeCollectorName, mock.Anything).Return(nil).Once()
53+
},
4954
nil,
5055
},
5156
{
@@ -56,6 +61,8 @@ func TestMempoolDecorator(t *testing.T) {
5661
require.NoError(t, err)
5762
suite.feeabsKeeper.SetTwapRate(suite.ctx, "ibcfee", math.LegacyNewDec(1))
5863
suite.stakingKeeper.EXPECT().BondDenom(gomock.Any()).Return("ueve", nil).AnyTimes()
64+
suite.bankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, mock.Anything,
65+
feemarkettypes.FeeCollectorName, mock.Anything).Return(nil).Once()
5966
},
6067
nil,
6168
},
@@ -93,11 +100,19 @@ func TestMempoolDecorator(t *testing.T) {
93100
tc.malleate(suite)
94101
suite.txBuilder.SetGasLimit(gasLimit)
95102
suite.txBuilder.SetFeeAmount(tc.feeAmount)
103+
accs := suite.CreateTestAccounts(1)
104+
require.NoError(t, suite.txBuilder.SetMsgs([]sdk.Msg{testdata.NewTestMsg(accs[0].acc.GetAddress())}...))
105+
96106
suite.ctx = suite.ctx.WithMinGasPrices(minGasPrice)
97107

98108
// Construct tx and run through mempool decorator
99109
tx := suite.txBuilder.GetTx()
100-
feemarketDecorator := feemarketante.NewFeeMarketCheckDecorator(suite.feemarketKeeper, nil)
110+
feemarketDecorator := feemarketante.NewFeeMarketCheckDecorator(
111+
suite.accountKeeper,
112+
suite.bankKeeper,
113+
suite.feeGrantKeeper,
114+
suite.feemarketKeeper,
115+
nil)
101116
antehandler := sdk.ChainAnteDecorators(feemarketDecorator)
102117

103118
// Run the ante handler

app/ante/suite.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
feeabstestutil "github.com/osmosis-labs/fee-abstraction/v8/x/feeabs/testutil"
1212
feeabstypes "github.com/osmosis-labs/fee-abstraction/v8/x/feeabs/types"
1313
feemarketante "github.com/skip-mev/feemarket/x/feemarket/ante"
14+
feemarketmocks "github.com/skip-mev/feemarket/x/feemarket/ante/mocks"
1415
feemarketkeeper "github.com/skip-mev/feemarket/x/feemarket/keeper"
1516
feemarkettypes "github.com/skip-mev/feemarket/x/feemarket/types"
1617
"github.com/stretchr/testify/require"
@@ -45,7 +46,7 @@ type AnteTestSuite struct {
4546
clientCtx client.Context
4647
txBuilder client.TxBuilder
4748
accountKeeper authkeeper.AccountKeeper
48-
bankKeeper *feeabstestutil.MockBankKeeper
49+
bankKeeper *feemarketmocks.BankKeeper
4950
feeGrantKeeper *feeabstestutil.MockFeegrantKeeper
5051
stakingKeeper *feeabstestutil.MockStakingKeeper
5152
feeabsKeeper feeabskeeper.Keeper
@@ -65,7 +66,7 @@ func SetupTestSuite(t *testing.T, isCheckTx bool) *AnteTestSuite {
6566
govAuthority := authtypes.NewModuleAddress("gov").String()
6667

6768
// Setup mock keepers
68-
suite.bankKeeper = feeabstestutil.NewMockBankKeeper(ctrl)
69+
suite.bankKeeper = feemarketmocks.NewBankKeeper(t)
6970
suite.stakingKeeper = feeabstestutil.NewMockStakingKeeper(ctrl)
7071
suite.feeGrantKeeper = feeabstestutil.NewMockFeegrantKeeper(ctrl)
7172
suite.channelKeeper = feeabstestutil.NewMockChannelKeeper(ctrl)
@@ -99,7 +100,8 @@ func SetupTestSuite(t *testing.T, isCheckTx bool) *AnteTestSuite {
99100
suite.encCfg.Amino.RegisterConcrete(&testdata.TestMsg{}, "testdata.TestMsg", nil)
100101
testdata.RegisterInterfaces(suite.encCfg.InterfaceRegistry)
101102
suite.accountKeeper = authkeeper.NewAccountKeeper(
102-
suite.encCfg.Codec, runtime.NewKVStoreService(key), authtypes.ProtoBaseAccount, maccPerms, authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), sdk.Bech32MainPrefix, govAuthority,
103+
suite.encCfg.Codec, runtime.NewKVStoreService(authKey), authtypes.ProtoBaseAccount, maccPerms,
104+
authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), sdk.Bech32MainPrefix, govAuthority,
103105
)
104106
suite.accountKeeper.SetModuleAccount(suite.ctx, authtypes.NewEmptyModuleAccount(feeabstypes.ModuleName))
105107
// Setup feeabs keeper

app/app.go

-2
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,6 @@ func (app *EveApp) setPostHandler() {
11141114
postHandler := feemarketapp.PostHandlerOptions{
11151115
AccountKeeper: app.AccountKeeper,
11161116
BankKeeper: app.BankKeeper,
1117-
FeeGrantKeeper: app.FeeGrantKeeper,
11181117
FeeMarketKeeper: app.FeeMarketKeeper,
11191118
}
11201119
// Set the PostHandler for the app
@@ -1380,7 +1379,6 @@ func NewPostHandler(options feemarketapp.PostHandlerOptions) (sdk.PostHandler, e
13801379
feemarketpost.NewFeeMarketDeductDecorator(
13811380
options.AccountKeeper,
13821381
options.BankKeeper,
1383-
options.FeeGrantKeeper,
13841382
options.FeeMarketKeeper,
13851383
),
13861384
}

app/upgrades.go

-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ func (app *EveApp) RegisterUpgradeHandlers() {
7676

7777
func setupLegacyKeyTables(k *paramskeeper.Keeper) {
7878
for _, subspace := range k.GetSubspaces() {
79-
subspace := subspace
8079

8180
var keyTable paramstypes.KeyTable
8281
switch subspace.Name() {

go.mod

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module github.com/eve-network/eve
22

3-
go 1.22.3
3+
go 1.22.6
44

5-
toolchain go1.22.4
5+
toolchain go1.23.1
66

77
require (
88
github.com/CosmWasm/wasmd v0.53.0
@@ -28,7 +28,7 @@ require (
2828
github.com/stretchr/testify v1.9.0
2929
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
3030
google.golang.org/genproto v0.0.0-20240401170217-c3f982113cda // indirect
31-
google.golang.org/grpc v1.64.1 // indirect
31+
google.golang.org/grpc v1.65.0 // indirect
3232
gopkg.in/yaml.v2 v2.4.0 // indirect
3333
)
3434

@@ -54,7 +54,7 @@ require (
5454
github.com/cosmos/ibc-go/modules/light-clients/08-wasm v0.2.1-0.20240523101951-4b45d1822fb6
5555
github.com/cosmos/ibc-go/v8 v8.4.0
5656
github.com/osmosis-labs/tokenfactory v0.0.0-20240310155926-981fbeb0fe42
57-
github.com/skip-mev/feemarket v1.0.4
57+
github.com/skip-mev/feemarket v1.1.1
5858
github.com/terra-money/alliance v0.4.3
5959
go.uber.org/mock v0.4.0
6060
)
@@ -186,6 +186,7 @@ require (
186186
github.com/shamaton/msgpack/v2 v2.2.0 // indirect
187187
github.com/sourcegraph/conc v0.3.0 // indirect
188188
github.com/spf13/afero v1.11.0 // indirect
189+
github.com/stretchr/objx v0.5.2 // indirect
189190
github.com/subosito/gotenv v1.6.0 // indirect
190191
github.com/tendermint/go-amino v0.16.0 // indirect
191192
github.com/tidwall/btree v1.7.0 // indirect

go.sum

+8-8
Original file line numberDiff line numberDiff line change
@@ -1325,8 +1325,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ
13251325
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
13261326
github.com/skip-mev/chaintestutil v0.0.0-20240514161515-056d7ba45610 h1:4JlsiRVt/YZOvrKH525T7sZXgEWUEjqSDMwE6fXNbdo=
13271327
github.com/skip-mev/chaintestutil v0.0.0-20240514161515-056d7ba45610/go.mod h1:kB8gFZX07CyJnw8q9iEZijI3qJTIe1K/Y++P5VGkrcg=
1328-
github.com/skip-mev/feemarket v1.0.4 h1:OPZ9D0tlDUa55n+HIjE2DgL+geMOwcDwUXTYdz4ig9Y=
1329-
github.com/skip-mev/feemarket v1.0.4/go.mod h1:lszt7zGEEActbDYq1hOKogQvfCsnLEHH5113LwgmYcE=
1328+
github.com/skip-mev/feemarket v1.1.1 h1:L34K7N2J6o635kzNYRAvQ93+hAFtSiJ2t03jmaNx0zw=
1329+
github.com/skip-mev/feemarket v1.1.1/go.mod h1:DUa6djUsTeMOrbrcIZqWSVxU9IZNCXp96ruaojyBNpc=
13301330
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
13311331
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
13321332
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
15211521
golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
15221522
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
15231523
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
1524-
golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
1525-
golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
1524+
golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
1525+
golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
15261526
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
15271527
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
15281528
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
18601860
golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k=
18611861
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
18621862
golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s=
1863-
golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
1864-
golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
1863+
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
1864+
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
18651865
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
18661866
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
18671867
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
21482148
google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw=
21492149
google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g=
21502150
google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8=
2151-
google.golang.org/grpc v1.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA=
2152-
google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0=
2151+
google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc=
2152+
google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ=
21532153
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
21542154
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
21552155
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=

0 commit comments

Comments
 (0)