Skip to content

Commit

Permalink
refactor: simplify group dependency graph (partial backport #22978) (#…
Browse files Browse the repository at this point in the history
…22982)

Co-authored-by: Julien Robert <[email protected]>
  • Loading branch information
mergify[bot] and julienrbrt authored Dec 18, 2024
1 parent 98acf3a commit d2dd935
Show file tree
Hide file tree
Showing 11 changed files with 151 additions and 182 deletions.
1 change: 0 additions & 1 deletion x/accounts/defaults/lockup/lockup.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@ func (bva *BaseLockup) checkUnbondingEntriesMature(ctx context.Context) error {
if !errorsmod.IsOf(err, stakingtypes.ErrNoUnbondingDelegation) {
return true, err
}

}

found := false
Expand Down
1 change: 0 additions & 1 deletion x/accounts/defaults/lockup/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ func newMockContext(t *testing.T) (context.Context, store.KVStoreService) {
default:
return nil, errors.New("unrecognized request type")
}

},
)
}
Expand Down
13 changes: 10 additions & 3 deletions x/bank/testutil/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,26 @@ package testutil
import (
"context"

bankkeeper "cosmossdk.io/x/bank/keeper"
"cosmossdk.io/x/bank/types"

sdk "github.com/cosmos/cosmos-sdk/types"
)

// minimalBankKeeper is a subset of the bankkeeper.Keeper interface that is used
// for the bank testing utilities.
type minimalBankKeeper interface {
MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error
SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error
}

// FundAccount is a utility function that funds an account by minting and
// sending the coins to the address. This should be used for testing purposes
// only!
//
// TODO: Instead of using the mint module account, which has the
// permission of minting, create a "faucet" account. (@fdymylja)
func FundAccount(ctx context.Context, bankKeeper bankkeeper.Keeper, addr sdk.AccAddress, amounts sdk.Coins) error {
func FundAccount(ctx context.Context, bankKeeper minimalBankKeeper, addr sdk.AccAddress, amounts sdk.Coins) error {
if err := bankKeeper.MintCoins(ctx, types.MintModuleName, amounts); err != nil {
return err
}
Expand All @@ -29,7 +36,7 @@ func FundAccount(ctx context.Context, bankKeeper bankkeeper.Keeper, addr sdk.Acc
//
// TODO: Instead of using the mint module account, which has the
// permission of minting, create a "faucet" account. (@fdymylja)
func FundModuleAccount(ctx context.Context, bankKeeper bankkeeper.Keeper, recipientMod string, amounts sdk.Coins) error {
func FundModuleAccount(ctx context.Context, bankKeeper minimalBankKeeper, recipientMod string, amounts sdk.Coins) error {
if err := bankKeeper.MintCoins(ctx, types.MintModuleName, amounts); err != nil {
return err
}
Expand Down
7 changes: 2 additions & 5 deletions x/group/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@ require (
cosmossdk.io/log v1.5.0
cosmossdk.io/math v1.4.0
cosmossdk.io/store v1.10.0-rc.1.0.20241218084712-ca559989da43
cosmossdk.io/x/accounts v0.0.0-20241218110910-47409028a73d
cosmossdk.io/x/bank v0.0.0-20241218110910-47409028a73d
cosmossdk.io/x/consensus v0.0.0-20241218110910-47409028a73d
cosmossdk.io/x/gov v0.0.0-20241218110910-47409028a73d
cosmossdk.io/x/mint v0.0.0-20241218110910-47409028a73d
cosmossdk.io/x/staking v0.0.0-20241218110910-47409028a73d
github.com/cockroachdb/apd/v3 v3.2.1
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/cosmos-sdk v0.52.0
Expand All @@ -26,6 +22,7 @@ require (
github.com/manifoldco/promptui v0.9.0 // indirect
github.com/spf13/cobra v1.8.1
github.com/stretchr/testify v1.10.0
go.uber.org/mock v0.5.0
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1
google.golang.org/grpc v1.68.1
google.golang.org/protobuf v1.36.0
Expand All @@ -39,7 +36,7 @@ require (
cosmossdk.io/collections v1.0.0-rc.1 // indirect; main
cosmossdk.io/core/testing v0.0.1 // main
cosmossdk.io/schema v1.0.0 // indirect
cosmossdk.io/x/epochs v0.0.0-20241218110910-47409028a73d // indirect
cosmossdk.io/x/staking v0.0.0-20241218110910-47409028a73d // indirect
cosmossdk.io/x/tx v1.0.0-alpha.3 // indirect; main
filippo.io/edwards25519 v1.1.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
Expand Down
8 changes: 0 additions & 8 deletions x/group/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,10 @@ cosmossdk.io/schema v1.0.0 h1:/diH4XJjpV1JQwuIozwr+A4uFuuwanFdnw2kKeiXwwQ=
cosmossdk.io/schema v1.0.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ=
cosmossdk.io/store v1.10.0-rc.1.0.20241218084712-ca559989da43 h1:glZ6MpmD+5AhwJYV4jzx+rn7cgUB2owHgk9o+93luz0=
cosmossdk.io/store v1.10.0-rc.1.0.20241218084712-ca559989da43/go.mod h1:XCWpgfueHSBY+B7Cf2Aq/CcsU+6XoFH+EmseCKglFrU=
cosmossdk.io/x/accounts v0.0.0-20241218110910-47409028a73d h1:CKZrLb3TdsLndtgn/JW9714+yORLZUzMAStoMxO04vA=
cosmossdk.io/x/accounts v0.0.0-20241218110910-47409028a73d/go.mod h1:S3kRYNjtI43SoV8NMWHQURagS6YF6nI/GJavmO3qkZA=
cosmossdk.io/x/bank v0.0.0-20241218110910-47409028a73d h1:8Sw9mmz+P/H0iURZkRHKmpkmr9Lm3eGM2yRZveU2GWs=
cosmossdk.io/x/bank v0.0.0-20241218110910-47409028a73d/go.mod h1:C5yLe3vDDDHcWMSfa1lfgglczjjMGfOc4nYDmk69U2w=
cosmossdk.io/x/consensus v0.0.0-20241218110910-47409028a73d h1:QS4K8VcvPbvX830RYfhUpH+jxf4OPspf18ZGwGY2L7k=
cosmossdk.io/x/consensus v0.0.0-20241218110910-47409028a73d/go.mod h1:cAMIG6gRzZd3paDdXYjQTCK96nEDIgZcc/JDN/0Qf6Y=
cosmossdk.io/x/epochs v0.0.0-20241218110910-47409028a73d h1:EkjwLMsu4nD8c1lfMY7BHdgcrtB0fAI7W7CnwSeHwf4=
cosmossdk.io/x/epochs v0.0.0-20241218110910-47409028a73d/go.mod h1:F8AIIsAqDpWONRkIk6kOOtcTQ8rk/zsLCyaU34LacB8=
cosmossdk.io/x/gov v0.0.0-20241218110910-47409028a73d h1:CCC1PbH/Xn+QI2CDw8+ejt+bYlPisJqecSnFnV8TYKQ=
cosmossdk.io/x/gov v0.0.0-20241218110910-47409028a73d/go.mod h1:vvU5Fl4NY0m6r35xKxctzg4aYmRuEytfQwl1UFCyrlk=
cosmossdk.io/x/mint v0.0.0-20241218110910-47409028a73d h1:oMWZ3namACACVoUJYcHn6sXwKUFrSFGMSE/7yWiCKGs=
cosmossdk.io/x/mint v0.0.0-20241218110910-47409028a73d/go.mod h1:i2nMfOwxslF2o5y+tdbvphNcoIW/EnmY69x9NBpWdtk=
cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 h1:XQJj9Dv9Gtze0l2TF79BU5lkP6MkUveTUuKICmxoz+o=
cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190/go.mod h1:7WUGupOvmlHJoIMBz1JbObQxeo6/TDiuDBxmtod8HRg=
cosmossdk.io/x/staking v0.0.0-20241218110910-47409028a73d h1:Ey5BddfuPEQACiDgeb9SqvHr533RH7rd2GDNIgV45hk=
Expand Down
Loading

0 comments on commit d2dd935

Please sign in to comment.