Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
tuantran1702 committed Apr 8, 2024
1 parent c864502 commit 83af5f6
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
7 changes: 4 additions & 3 deletions x/feeabs/ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ package ante_test
import (
"testing"

"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"

sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/golang/mock/gomock"

"github.com/osmosis-labs/fee-abstraction/v7/x/feeabs/ante"
"github.com/osmosis-labs/fee-abstraction/v7/x/feeabs/types"
"github.com/stretchr/testify/require"
)

func TestMempoolDecorator(t *testing.T) {
Expand Down Expand Up @@ -120,5 +122,4 @@ func TestMempoolDecorator(t *testing.T) {
}
})
}

}
23 changes: 14 additions & 9 deletions x/feeabs/ante/testutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ package ante_test
import (
"testing"

transferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper"
"github.com/stretchr/testify/require"
ubermock "go.uber.org/mock/gomock"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/tx"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
Expand All @@ -15,20 +19,17 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
xauthsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
"github.com/cosmos/cosmos-sdk/x/auth/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
transferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper"

feeabskeeper "github.com/osmosis-labs/fee-abstraction/v7/x/feeabs/keeper"
feeabstestutil "github.com/osmosis-labs/fee-abstraction/v7/x/feeabs/testutil"
feeabstypes "github.com/osmosis-labs/fee-abstraction/v7/x/feeabs/types"
"github.com/stretchr/testify/require"
ubermock "go.uber.org/mock/gomock"
)

// TestAccount represents an account used in the tests in x/auth/ante.
type TestAccount struct {
acc types.AccountI
acc authtypes.AccountI
priv cryptotypes.PrivKey
}

Expand Down Expand Up @@ -87,7 +88,7 @@ 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, authKey, types.ProtoBaseAccount, maccPerms, sdk.Bech32MainPrefix, types.NewModuleAddress("gov").String(),
suite.encCfg.Codec, authKey, authtypes.ProtoBaseAccount, maccPerms, sdk.Bech32MainPrefix, authtypes.NewModuleAddress("gov").String(),
)
suite.feeabsKeeper = feeabskeeper.NewKeeper(suite.encCfg.Codec, key, subspace, suite.stakingKeeper, suite.accountKeeper, nil, transferkeeper.Keeper{}, suite.channelKeeper, suite.portKeeper, suite.scopedKeeper)
suite.clientCtx = client.Context{}.
Expand All @@ -102,8 +103,8 @@ func SetupTestSuite(t *testing.T, isCheckTx bool) *AnteTestSuite {

// TestCase represents a test case used in test tables.
type TestCase struct {
desc string
malleate func(*AnteTestSuite) TestCaseArgs
_ string
_ func(*AnteTestSuite) TestCaseArgs
simulate bool
expPass bool
expErr error
Expand Down Expand Up @@ -164,13 +165,17 @@ func (suite *AnteTestSuite) RunTestCase(t *testing.T, tc TestCase, args TestCase
}
}
}

func (suite *AnteTestSuite) CreateTestAccounts(numAccs int) []TestAccount {
var accounts []TestAccount

for i := 0; i < numAccs; i++ {
priv, _, addr := testdata.KeyTestPubAddr()
acc := suite.accountKeeper.NewAccountWithAddress(suite.ctx, addr)
acc.SetAccountNumber(uint64(i))
err := acc.SetAccountNumber(uint64(i))
if err != nil {
panic(err)
}
suite.accountKeeper.SetAccount(suite.ctx, acc)
accounts = append(accounts, TestAccount{acc, priv})
}
Expand Down
20 changes: 10 additions & 10 deletions x/feeabs/types/expected_keepers.go
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
package types

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"
channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"

sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
)

// AccountKeeper defines the expected account keeper used for simulations (noalias)
type AccountKeeper interface {
GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI
GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI
GetModuleAddress(moduleName string) sdk.AccAddress
GetModuleAccount(ctx sdk.Context, moduleName string) types.ModuleAccountI
IterateAccounts(ctx sdk.Context, process func(types.AccountI) (stop bool))
SetModuleAccount(sdk.Context, types.ModuleAccountI)
GetParams(ctx sdk.Context) types.Params
SetAccount(ctx sdk.Context, acc types.AccountI)
GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI
IterateAccounts(ctx sdk.Context, process func(authtypes.AccountI) (stop bool))
SetModuleAccount(sdk.Context, authtypes.ModuleAccountI)
GetParams(ctx sdk.Context) authtypes.Params
SetAccount(ctx sdk.Context, acc authtypes.AccountI)
NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI
}

Expand Down

0 comments on commit 83af5f6

Please sign in to comment.