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

fix(mod/capability): implment appmodule.HasBeginBlocker interface (backport #4557) #4572

Merged
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
8 changes: 6 additions & 2 deletions modules/capability/module.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package capability

import (
"context"
"encoding/json"
"fmt"
"time"
Expand Down Expand Up @@ -29,6 +30,7 @@ var (
_ module.AppModuleBasic = (*AppModuleBasic)(nil)
_ module.AppModuleSimulation = (*AppModule)(nil)
_ appmodule.AppModule = (*AppModule)(nil)
_ appmodule.HasBeginBlocker = (*AppModule)(nil)
)

// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -144,14 +146,16 @@ func (AppModule) ConsensusVersion() uint64 { return 1 }
// BeginBlock executes all ABCI BeginBlock logic respective to the capability module.
// BeginBlocker calls InitMemStore to assert that the memory store is initialized.
// It's safe to run multiple times.
func (am AppModule) BeginBlock(ctx sdk.Context) {
func (am AppModule) BeginBlock(ctx context.Context) error {
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker)

am.keeper.InitMemStore(ctx)
am.keeper.InitMemStore(sdk.UnwrapSDKContext(ctx))

if am.sealKeeper && !am.keeper.IsSealed() {
am.keeper.Seal()
}

return nil
}

// GenerateGenesisState creates a randomized GenState of the capability module.
Expand Down