Skip to content

Commit 3364248

Browse files
committed
fix: begin blocker order
1 parent 3e21b5e commit 3364248

File tree

8 files changed

+38
-44
lines changed

8 files changed

+38
-44
lines changed

app/app_config.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ var (
124124
beginBlockers = []string{
125125
// cosmos sdk modules
126126
minttypes.ModuleName,
127+
// NOTE: x/team must be run before x/distribution and after x/mint.
128+
teamtypes.ModuleName,
129+
// NOTE: x/bundles must be run before x/distribution and after x/team.
130+
bundlestypes.ModuleName,
127131
distrtypes.ModuleName,
128132
slashingtypes.ModuleName,
129133
evidencetypes.ModuleName,
@@ -139,13 +143,11 @@ var (
139143
ibcfeetypes.ModuleName,
140144

141145
// KYVE modules
142-
bundlestypes.ModuleName,
143146
delegationtypes.ModuleName,
144147
globaltypes.ModuleName,
145148
pooltypes.ModuleName,
146149
querytypes.ModuleName,
147150
stakerstypes.ModuleName,
148-
teamtypes.ModuleName,
149151
funderstypes.ModuleName,
150152
// this line is used by starport scaffolding # stargate/app/beginBlockers
151153
}
@@ -191,6 +193,8 @@ var (
191193
{Account: stakingtypes.BondedPoolName, Permissions: []string{authtypes.Burner, authtypes.Staking}},
192194
{Account: stakingtypes.NotBondedPoolName, Permissions: []string{authtypes.Burner, authtypes.Staking}},
193195
{Account: govtypes.ModuleName, Permissions: []string{authtypes.Burner}},
196+
197+
// IBC
194198
{Account: ibctransfertypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}},
195199
{Account: ibcfeetypes.ModuleName},
196200
{Account: icatypes.ModuleName},
@@ -212,6 +216,20 @@ var (
212216
minttypes.ModuleName,
213217
stakingtypes.BondedPoolName,
214218
stakingtypes.NotBondedPoolName,
219+
220+
// IBC
221+
ibctransfertypes.ModuleName,
222+
ibcfeetypes.ModuleName,
223+
icatypes.ModuleName,
224+
225+
// KYVE
226+
bundlestypes.ModuleName,
227+
delegationtypes.ModuleName,
228+
pooltypes.ModuleName,
229+
stakerstypes.ModuleName,
230+
teamtypes.ModuleName,
231+
funderstypes.ModuleName,
232+
215233
// We allow the following module accounts to receive funds:
216234
// govtypes.ModuleName
217235
}

testutil/integration/checks.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,10 @@ func (suite *KeeperTestSuite) VerifyBundlesGenesisImportExport() {
317317
// ========================
318318

319319
func (suite *KeeperTestSuite) VerifyDelegationQueries() {
320-
goCtx := sdk.WrapSDKContext(suite.Ctx())
321320
for _, delegator := range suite.App().DelegationKeeper.GetAllDelegators(suite.Ctx()) {
322321

323322
// Query: delegator/{staker}/{delegator}
324-
resD, errD := suite.App().QueryKeeper.Delegator(goCtx, &querytypes.QueryDelegatorRequest{
323+
resD, errD := suite.App().QueryKeeper.Delegator(suite.Ctx(), &querytypes.QueryDelegatorRequest{
325324
Staker: delegator.Staker,
326325
Delegator: delegator.Delegator,
327326
})
@@ -332,7 +331,7 @@ func (suite *KeeperTestSuite) VerifyDelegationQueries() {
332331
Expect(resD.Delegator.CurrentReward).To(Equal(suite.App().DelegationKeeper.GetOutstandingRewards(suite.Ctx(), delegator.Staker, delegator.Delegator)))
333332

334333
// Query: stakers_by_delegator/{delegator}
335-
resSbD, errSbD := suite.App().QueryKeeper.StakersByDelegator(goCtx, &querytypes.QueryStakersByDelegatorRequest{
334+
resSbD, errSbD := suite.App().QueryKeeper.StakersByDelegator(suite.Ctx(), &querytypes.QueryStakersByDelegatorRequest{
336335
Pagination: nil,
337336
Delegator: delegator.Delegator,
338337
})
@@ -355,7 +354,7 @@ func (suite *KeeperTestSuite) VerifyDelegationQueries() {
355354

356355
for _, staker := range suite.App().StakersKeeper.GetAllStakers(suite.Ctx()) {
357356
// Query: delegators_by_staker/{staker}
358-
resDbS, errDbS := suite.App().QueryKeeper.DelegatorsByStaker(goCtx, &querytypes.QueryDelegatorsByStakerRequest{
357+
resDbS, errDbS := suite.App().QueryKeeper.DelegatorsByStaker(suite.Ctx(), &querytypes.QueryDelegatorsByStakerRequest{
359358
Pagination: nil,
360359
Staker: staker.Address,
361360
})

x/delegation/module.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
poolKeeper "github.com/KYVENetwork/chain/x/pool/keeper"
1313
stakersKeeper "github.com/KYVENetwork/chain/x/stakers/keeper"
1414
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
15-
bankKeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
1615
distributionKeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
1716
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
1817
"github.com/grpc-ecosystem/grpc-gateway/runtime"
@@ -195,7 +194,7 @@ type ModuleInputs struct {
195194
Logger log.Logger
196195

197196
AccountKeeper types.AccountKeeper
198-
BankKeeper bankKeeper.Keeper
197+
BankKeeper util.BankKeeper
199198
DistributionKeeper distributionKeeper.Keeper
200199
UpgradeKeeper util.UpgradeKeeper
201200
PoolKeeper *poolKeeper.Keeper

x/funders/module.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"github.com/KYVENetwork/chain/util"
1212
poolKeeper "github.com/KYVENetwork/chain/x/pool/keeper"
1313
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
14-
bankKeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
1514
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
1615

1716
// this line is used by starport scaffolding # 1
@@ -191,7 +190,7 @@ type ModuleInputs struct {
191190
Logger log.Logger
192191

193192
AccountKeeper util.AccountKeeper
194-
BankKeeper bankKeeper.Keeper
193+
BankKeeper util.BankKeeper
195194
UpgradeKeeper util.UpgradeKeeper
196195
PoolKeeper *poolKeeper.Keeper
197196
}

x/stakers/keeper/keeper.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ type (
2020

2121
authority string
2222

23-
accountKeeper types.AccountKeeper
24-
bankKeeper types.BankKeeper
25-
distrkeeper types.DistrKeeper
23+
accountKeeper util.AccountKeeper
24+
bankKeeper util.BankKeeper
25+
distrkeeper util.DistributionKeeper
2626
poolKeeper types.PoolKeeper
2727
upgradeKeeper util.UpgradeKeeper
2828
delegationKeeper delegationKeeper.Keeper
@@ -37,9 +37,9 @@ func NewKeeper(
3737

3838
authority string,
3939

40-
accountKeeper types.AccountKeeper,
41-
bankKeeper types.BankKeeper,
42-
distrkeeper types.DistrKeeper,
40+
accountKeeper util.AccountKeeper,
41+
bankKeeper util.BankKeeper,
42+
distrkeeper util.DistributionKeeper,
4343
poolKeeper types.PoolKeeper,
4444
upgradeKeeper util.UpgradeKeeper,
4545
) *Keeper {

x/stakers/module.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
delegationKeeper "github.com/KYVENetwork/chain/x/delegation/keeper"
1313
poolKeeper "github.com/KYVENetwork/chain/x/pool/keeper"
1414
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
15-
bankKeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
1615
distributionKeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
1716
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
1817
// this line is used by starport scaffolding # 1
@@ -109,15 +108,15 @@ type AppModule struct {
109108
AppModuleBasic
110109

111110
keeper *keeper.Keeper
112-
accountKeeper types.AccountKeeper
113-
bankKeeper types.BankKeeper
111+
accountKeeper util.AccountKeeper
112+
bankKeeper util.BankKeeper
114113
}
115114

116115
func NewAppModule(
117116
cdc codec.Codec,
118117
keeper *keeper.Keeper,
119-
accountKeeper types.AccountKeeper,
120-
bankKeeper types.BankKeeper,
118+
accountKeeper util.AccountKeeper,
119+
bankKeeper util.BankKeeper,
121120
) AppModule {
122121
return AppModule{
123122
AppModuleBasic: NewAppModuleBasic(cdc),
@@ -197,8 +196,8 @@ type ModuleInputs struct {
197196
MemService store.MemoryStoreService
198197
Logger log.Logger
199198

200-
AccountKeeper types.AccountKeeper
201-
BankKeeper bankKeeper.Keeper
199+
AccountKeeper util.AccountKeeper
200+
BankKeeper util.BankKeeper
202201
DistributionKeeper distributionKeeper.Keeper
203202
UpgradeKeeper util.UpgradeKeeper
204203
PoolKeeper *poolKeeper.Keeper

x/stakers/types/expected_keepers.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,10 @@
11
package types
22

33
import (
4-
"context"
54
poolTypes "github.com/KYVENetwork/chain/x/pool/types"
65
sdk "github.com/cosmos/cosmos-sdk/types"
76
)
87

9-
// AccountKeeper defines the expected account keeper used for simulations (noalias)
10-
type AccountKeeper interface {
11-
GetModuleAddress(moduleName string) sdk.AccAddress
12-
}
13-
14-
type DistrKeeper interface {
15-
FundCommunityPool(ctx context.Context, amount sdk.Coins, sender sdk.AccAddress) error
16-
}
17-
18-
// BankKeeper defines the expected interface needed to retrieve account balances.
19-
type BankKeeper interface {
20-
SendCoins(ctx context.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error
21-
SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
22-
SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error
23-
SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
24-
}
25-
268
type PoolKeeper interface {
279
AssertPoolExists(ctx sdk.Context, poolId uint64) error
2810
GetPoolWithError(ctx sdk.Context, poolId uint64) (poolTypes.Pool, error)

x/team/abci.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ package team
33
import (
44
"cosmossdk.io/math"
55
"fmt"
6+
authTypes "github.com/cosmos/cosmos-sdk/x/auth/types"
67

78
"github.com/KYVENetwork/chain/util"
89
sdk "github.com/cosmos/cosmos-sdk/types"
910

10-
// Auth
11-
authTypes "github.com/cosmos/cosmos-sdk/x/auth/types"
12-
1311
// Team
1412
"github.com/KYVENetwork/chain/x/team/keeper"
1513
"github.com/KYVENetwork/chain/x/team/types"

0 commit comments

Comments
 (0)