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

refactor: remove gov dependency from modules and sdk #18424

Merged
merged 3 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 3 additions & 4 deletions baseapp/block_gas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/runtime"
"github.com/cosmos/cosmos-sdk/testutil"
"github.com/cosmos/cosmos-sdk/testutil/configurator"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
Expand All @@ -35,8 +36,6 @@ import (
"github.com/cosmos/cosmos-sdk/types/tx/signing"
)

const mintModuleName = "mint"

var blockMaxGas = uint64(simtestutil.DefaultConsensusParams.Block.MaxGas)

type BlockGasImpl struct {
Expand Down Expand Up @@ -130,9 +129,9 @@ func TestBaseApp_BlockGas(t *testing.T) {

// test account and fund
priv1, _, addr1 := testdata.KeyTestPubAddr()
err = bankKeeper.MintCoins(ctx, mintModuleName, feeAmount)
err = bankKeeper.MintCoins(ctx, testutil.MintModuleName, feeAmount)
require.NoError(t, err)
err = bankKeeper.SendCoinsFromModuleToAccount(ctx, mintModuleName, addr1, feeAmount)
err = bankKeeper.SendCoinsFromModuleToAccount(ctx, testutil.MintModuleName, addr1, feeAmount)
require.NoError(t, err)
require.Equal(t, feeCoin.Amount, bankKeeper.GetBalance(ctx, addr1, feeCoin.Denom).Amount)
seq := accountKeeper.GetAccount(ctx, addr1).GetSequence()
Comment on lines 129 to 137
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constant "mintModuleName" is replaced with "testutil.MintModuleName" correctly. This change improves maintainability by avoiding hard-coded strings.

- err = bankKeeper.MintCoins(ctx, mintModuleName, feeAmount)
+ err = bankKeeper.MintCoins(ctx, testutil.MintModuleName, feeAmount)
- err = bankKeeper.SendCoinsFromModuleToAccount(ctx, mintModuleName, addr1, feeAmount)
+ err = bankKeeper.SendCoinsFromModuleToAccount(ctx, testutil.MintModuleName, addr1, feeAmount)

Commitable suggestion

[!IMPORTANT]
Carefully review the code before committing. Make sure it correctly replaces the highlighted code, has no missing lines and indentaion issues.

Suggested change
// test account and fund
priv1, _, addr1 := testdata.KeyTestPubAddr()
err = bankKeeper.MintCoins(ctx, mintModuleName, feeAmount)
err = bankKeeper.MintCoins(ctx, testutil.MintModuleName, feeAmount)
require.NoError(t, err)
err = bankKeeper.SendCoinsFromModuleToAccount(ctx, mintModuleName, addr1, feeAmount)
err = bankKeeper.SendCoinsFromModuleToAccount(ctx, testutil.MintModuleName, addr1, feeAmount)
require.NoError(t, err)
require.Equal(t, feeCoin.Amount, bankKeeper.GetBalance(ctx, addr1, feeCoin.Denom).Amount)
seq := accountKeeper.GetAccount(ctx, addr1).GetSequence()
// test account and fund
priv1, _, addr1 := testdata.KeyTestPubAddr()
err = bankKeeper.MintCoins(ctx, testutil.MintModuleName, feeAmount)
require.NoError(t, err)
err = bankKeeper.SendCoinsFromModuleToAccount(ctx, testutil.MintModuleName, addr1, feeAmount)
require.NoError(t, err)
require.Equal(t, feeCoin.Amount, bankKeeper.GetBalance(ctx, addr1, feeCoin.Denom).Amount)
seq := accountKeeper.GetAccount(ctx, addr1).GetSequence()

Expand Down
1 change: 0 additions & 1 deletion client/v2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ replace (
cosmossdk.io/x/auth => ./../../x/auth
cosmossdk.io/x/bank => ./../../x/bank
cosmossdk.io/x/distribution => ./../../x/distribution
cosmossdk.io/x/gov => ./../../x/gov
cosmossdk.io/x/mint => ./../../x/mint
cosmossdk.io/x/protocolpool => ./../../x/protocolpool
cosmossdk.io/x/slashing => ./../../x/slashing
Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ require (
cosmossdk.io/store v1.0.0
cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000
cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000
cosmossdk.io/x/gov v0.0.0-20230925135524-a1bc045b3190
cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000
cosmossdk.io/x/tx v0.12.0
github.com/99designs/keyring v1.2.1
Expand Down Expand Up @@ -170,7 +169,6 @@ replace (
cosmossdk.io/x/auth => ./x/auth
cosmossdk.io/x/bank => ./x/bank
cosmossdk.io/x/distribution => ./x/distribution
cosmossdk.io/x/gov => ./x/gov
cosmossdk.io/x/mint => ./x/mint
cosmossdk.io/x/protocolpool => ./x/protocolpool
cosmossdk.io/x/slashing => ./x/slashing
Expand Down
1 change: 1 addition & 0 deletions go.work.example
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use (
./x/feegrant
./x/gov
./x/group
./x/mint
./x/nft
./x/params
./x/protocolpool
Expand Down
Loading
Loading