Skip to content

Commit

Permalink
fix: fix cyclic dependency between virtual group and storage module
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgao001 committed Nov 7, 2023
1 parent 1c8ce9f commit 1977eca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,7 @@ func New(
app.AccountKeeper,
app.BankKeeper,
app.PaymentKeeper,
app.StorageKeeper,
)
virtualgroupModule := virtualgroupmodule.NewAppModule(appCodec, app.VirtualgroupKeeper, app.SpKeeper)

app.PermissionmoduleKeeper = *permissionmodulekeeper.NewKeeper(
appCodec,
Expand All @@ -498,6 +496,9 @@ func New(
)
storageModule := storagemodule.NewAppModule(appCodec, app.StorageKeeper, app.AccountKeeper, app.BankKeeper, app.SpKeeper)

app.VirtualgroupKeeper.SetStorageKeeper(&app.StorageKeeper)
virtualgroupModule := virtualgroupmodule.NewAppModule(appCodec, app.VirtualgroupKeeper, app.SpKeeper)

app.ChallengeKeeper = *challengemodulekeeper.NewKeeper(
appCodec,
keys[challengemoduletypes.StoreKey],
Expand Down
6 changes: 4 additions & 2 deletions x/virtualgroup/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func NewKeeper(
accountKeeper types.AccountKeeper,
bankKeeper types.BankKeeper,
paymentKeeper types.PaymentKeeper,
storageKeeper types.StorageKeeper,
) *Keeper {

k := Keeper{
Expand All @@ -57,7 +56,6 @@ func NewKeeper(
accountKeeper: accountKeeper,
bankKeeper: bankKeeper,
paymentKeeper: paymentKeeper,
storageKeeper: storageKeeper,
}

k.gvgSequence = sequence.NewSequence[uint32](types.GVGSequencePrefix)
Expand All @@ -66,6 +64,10 @@ func NewKeeper(
return &k
}

func (k *Keeper) SetStorageKeeper(storageKeeper types.StorageKeeper) {
k.storageKeeper = storageKeeper
}

func (k Keeper) GetAuthority() string {
return k.authority
}
Expand Down

0 comments on commit 1977eca

Please sign in to comment.