Skip to content

Move AppModule.BeginBlock and AppModule.EndBlock to extension interfaces #12462

Closed
@ValarDragon

Description

Summary

Most modules right now have a no-op for AppModule.BeginBlock and AppModule.EndBlock. We should move these methods off the AppModule interface so we have less deadcode, and instead move them to extension interfaces. This should not be a noticeable client breaking change, as users of the SDK don't really consume the AppModule interface, and thats moreso something for the ModuleManager.

This would mean removing:

	// ABCI
	BeginBlock(sdk.Context, abci.RequestBeginBlock)
	EndBlock(sdk.Context, abci.RequestEndBlock) []abci.ValidatorUpdate

from the AppModule interface, and making two new extension interfaces:

type BeginBlockAppModule interface {
	AppModule
	BeginBlock(sdk.Context, abci.RequestBeginBlock)
}
type EndBlockAppModule interface {
	AppModule
	EndBlock(sdk.Context, abci.RequestEndBlock) []abci.ValidatorUpdate
}

Then we retain having ModuleManager take in AppModules, so there is no client breaking changes. The module manager should type cast internally to get the BeginBlock and EndBlock app module lists. (We may waste some memory in the struct, but this is negligible)

As a secondary feature, (likely for a second PR), its total ordering constraint, can be relaxed to only requiring a specified order for modules that have the relevant method.

Problem Definition

Delete more methods from every module.go, improving the signal to noise ratio of cosmos code, and the accuracy of interfaces we work with.

(From discussion with @aaronc @kocubinski @alexanderbez )


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions