Skip to content

Commit

Permalink
chore: move queues to BeginBlocker
Browse files Browse the repository at this point in the history
  • Loading branch information
mbreithecker committed Jun 14, 2024
1 parent f044d94 commit a75127d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
3 changes: 1 addition & 2 deletions app/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ var (

// KYVE modules
delegationtypes.ModuleName,
stakerstypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/beginBlockers
}

Expand All @@ -153,8 +154,6 @@ var (

// KYVE modules
pooltypes.ModuleName,
stakerstypes.ModuleName,
delegationtypes.ModuleName,
bundlestypes.ModuleName,
globaltypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/endBlockers
Expand Down
6 changes: 0 additions & 6 deletions x/delegation/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ var (

_ appmodule.AppModule = (*AppModule)(nil)
_ appmodule.HasBeginBlocker = (*AppModule)(nil)
_ appmodule.HasEndBlocker = (*AppModule)(nil)
)

// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -159,11 +158,6 @@ func (AppModule) ConsensusVersion() uint64 { return 1 }
// BeginBlock contains the logic that is automatically triggered at the beginning of each block
func (am AppModule) BeginBlock(ctx context.Context) error {
am.keeper.InitMemStore(sdk.UnwrapSDKContext(ctx))
return nil
}

// EndBlock contains the logic that is automatically triggered at the end of each block
func (am AppModule) EndBlock(ctx context.Context) error {
am.keeper.ProcessDelegatorUnbondingQueue(sdk.UnwrapSDKContext(ctx))
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions x/stakers/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ var (
_ module.HasInvariants = (*AppModule)(nil)
_ module.HasConsensusVersion = (*AppModule)(nil)

_ appmodule.AppModule = (*AppModule)(nil)
_ appmodule.HasEndBlocker = (*AppModule)(nil)
_ appmodule.AppModule = (*AppModule)(nil)
_ appmodule.HasBeginBlocker = (*AppModule)(nil)
)

// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -156,8 +156,8 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
// ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1
func (AppModule) ConsensusVersion() uint64 { return 1 }

// EndBlock contains the logic that is automatically triggered at the end of each block
func (am AppModule) EndBlock(ctx context.Context) error {
// BeginBlock contains the logic that is automatically triggered at the beginning of each block
func (am AppModule) BeginBlock(ctx context.Context) error {
sdkCtx := sdk.UnwrapSDKContext(ctx)
am.keeper.ProcessCommissionChangeQueue(sdkCtx)
am.keeper.ProcessLeavePoolQueue(sdkCtx)
Expand Down

0 comments on commit a75127d

Please sign in to comment.