Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fee market blackberry #277

Merged
merged 9 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
FeeAbskeeper feeabskeeper.Keeper
FeeMarketKeeper feemarketante.FeeMarketKeeper
AccountKeeper feemarketante.AccountKeeper
BankKeeper feemarketante.BankKeeper
}

// NewAnteHandler constructor
Expand Down Expand Up @@ -63,6 +64,9 @@
circuitante.NewCircuitBreakerDecorator(options.CircuitKeeper),
ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker),
feemarketante.NewFeeMarketCheckDecorator( // fee market check replaces fee deduct decorator
options.AccountKeeper,
options.BankKeeper,
options.FeegrantKeeper,

Check failure on line 69 in app/ante/ante.go

View workflow job for this annotation

GitHub Actions / run-tests

too many arguments in call to feemarketante.NewFeeMarketCheckDecorator

Check failure on line 69 in app/ante/ante.go

View workflow job for this annotation

GitHub Actions / build

too many arguments in call to feemarketante.NewFeeMarketCheckDecorator

Check failure on line 69 in app/ante/ante.go

View workflow job for this annotation

GitHub Actions / lint

too many arguments in call to feemarketante.NewFeeMarketCheckDecorator

Check failure on line 69 in app/ante/ante.go

View workflow job for this annotation

GitHub Actions / lint

too many arguments in call to feemarketante.NewFeeMarketCheckDecorator
options.FeeMarketKeeper,
ante.NewDeductFeeDecorator(
options.AccountKeeper,
Expand Down
20 changes: 18 additions & 2 deletions app/ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
import (
"testing"


"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"
)
Expand Down Expand Up @@ -45,7 +48,10 @@
{
"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,
},
{
Expand All @@ -56,6 +62,8 @@
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,
},
Expand Down Expand Up @@ -93,11 +101,19 @@
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,

Check failure on line 114 in app/ante/ante_test.go

View workflow job for this annotation

GitHub Actions / lint

too many arguments in call to feemarketante.NewFeeMarketCheckDecorator
suite.feemarketKeeper,
nil)
antehandler := sdk.ChainAnteDecorators(feemarketDecorator)

// Run the ante handler
Expand Down
8 changes: 5 additions & 3 deletions app/ante/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"
"github.com/eve-network/eve/app/ante"

Check failure on line 47 in app/app.go

View workflow job for this annotation

GitHub Actions / lint

could not import github.com/eve-network/eve/app/ante (-: # github.com/eve-network/eve/app/ante
feeabsmodule "github.com/osmosis-labs/fee-abstraction/v8/x/feeabs"
feeabskeeper "github.com/osmosis-labs/fee-abstraction/v8/x/feeabs/keeper"
feeabstypes "github.com/osmosis-labs/fee-abstraction/v8/x/feeabs/types"
Expand Down Expand Up @@ -1114,7 +1114,6 @@
postHandler := feemarketapp.PostHandlerOptions{
AccountKeeper: app.AccountKeeper,
BankKeeper: app.BankKeeper,
FeeGrantKeeper: app.FeeGrantKeeper,
FeeMarketKeeper: app.FeeMarketKeeper,
}
// Set the PostHandler for the app
Expand Down Expand Up @@ -1380,9 +1379,8 @@
feemarketpost.NewFeeMarketDeductDecorator(
options.AccountKeeper,
options.BankKeeper,
options.FeeGrantKeeper,
options.FeeMarketKeeper,
),

Check failure on line 1383 in app/app.go

View workflow job for this annotation

GitHub Actions / lint

not enough arguments in call to feemarketpost.NewFeeMarketDeductDecorator
}

return sdk.ChainPostDecorators(postDecorators...), nil
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,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
Expand Down
Loading