-
Notifications
You must be signed in to change notification settings - Fork 103
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
Rethink configurator registration #301
Comments
I think for better compatibility between "old" and "new" (ADR 033) modules, we might want to do something like this: type Module interface {
Instantiate(Config) AppModule
}
type Config interface {
ModuleKey() ModuleKey
Codec() codec.Marshaler
}
type AppModule interface {
RegisterMsgServer()
RegisterQueryServer()
InitGenesis()
ExportGenesis()
BeginBlocker()
} Basically the idea is that we drop the idea of moving everything into
|
Related: #270 (comment) and #270 (comment) The issue is not only about forgetting to register on something - but in general - complexifing the data flow and duplicating functionality (module.Manager vs ModuleManager vs Configurator). |
This works. I was also thinking about a declarative approach:
|
That doesn't really work based on the way gRPC server registration works. And a single module may want to register multiple services. The simplest reasonable is I think: type AppModule interface {
RegisterMsgServices(grpc.ServiceRegistrar)
RegisterQueryServices(grpc.ServiceRegistrar) Although I do want to note that a benefit of the current |
We discussed this subject during Regen Architecture Meeting -> notes. Summary
|
@aaronc - after thinking a bit more, I see more need for the module initializer / abstract factory. Main reason for that is test-ability. This would allow to have more options for integration tests. |
Maybe it would be easier for tests to mock clients rather than server? If so, client would need to be a constructor parameter, rather than created in constructor as it's done in the example we were discussing today. |
Yeah I've been thinking about that as well. Rather than an explicit ordering list could a BeginBlocker declare its dependencies and then a dependency graph determines the order deterministically? |
Exactly - there is no reason for disallowing that. |
Actually in some cases its not explicit dependencies I realize. For instance, the x/upgrade BeginBlocker always needs to run before any other BeginBlocker. |
The DI and App Wiring WG is creating a new way for registering module dependencies and it will be more automatic and different than we have now. Closing because the new way is not going to be compatible. |
Is your feature request related to a problem? Please describe.
Modules right now implement this method:
It's easy to forget one
Register*
, and it's not clear what allRegister*
possibilities are.ref: #270 (comment)
Describe the solution you'd like
The "old" SDK had all these inside AppModule. It has the advantage of exposing all configurations on a Module, and the skipped ones were just left empty.
One idea could be:
and then
var _ ModuleConfig = impl{}
. For exampleDescribe alternatives you've considered
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: