Move AppModule.BeginBlock and AppModule.EndBlock to extension interfaces #12462
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 AppModule
s, 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