-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
feat(server): Allow calling back into the application struct in PostSetup. #24047
base: release/v0.53.x
Are you sure you want to change the base?
feat(server): Allow calling back into the application struct in PostSetup. #24047
Conversation
that test passed local, weird |
@@ -21,7 +21,7 @@ const FlagAppDBBackend = "app-db-backend" | |||
|
|||
// Cmd prunes the sdk root multi store history versions based on the pruning options | |||
// specified by command flags. | |||
func Cmd(appCreator servertypes.AppCreator, defaultNodeHome string) *cobra.Command { | |||
func Cmd[T servertypes.Application](appCreator servertypes.AppCreator[T], defaultNodeHome string) *cobra.Command { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hoangdv2429 we do not need these uses of generics in here. Can we remove?
@@ -21,7 +21,7 @@ const FlagAppDBBackend = "app-db-backend" | |||
|
|||
// Cmd prunes the sdk root multi store history versions based on the pruning options | |||
// specified by command flags. | |||
func Cmd(appCreator servertypes.AppCreator, defaultNodeHome string) *cobra.Command { | |||
func Cmd[T servertypes.Application](appCreator servertypes.AppCreator[T], defaultNodeHome string) *cobra.Command { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the only diff in this PR is the generics. If that is the case, then we can just close
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean the purpose of this pr is to allow calling back into the application struct in PostSetup. If that something we don't want to support in the future for berachain then we can close this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the PR extends the StartCmdOptions struct here: https://github.com/cosmos/cosmos-sdk/pull/24047/files#diff-97289af2ab66016f168df6fccac70626d125f170e5cf0841fcdc8fa624999608R112-R124
the generics help with type safety i believe - so you cannot pass in an AppCreator for a different type than your application.
PostSetup func(app T, svrCtx *Context, clientCtx client.Context, ctx context.Context, g *errgroup.Group) error | ||
// PostSetupStandalone can be used to setup extra services under the same cancellable context, | ||
PostSetupStandalone func(svrCtx *Context, clientCtx client.Context, ctx context.Context, g *errgroup.Group) error | ||
PostSetupStandalone func(app T, svrCtx *Context, clientCtx client.Context, ctx context.Context, g *errgroup.Group) error | ||
// AddFlags add custom flags to start cmd | ||
AddFlags func(cmd *cobra.Command) | ||
// StartCommandHanlder can be used to customize the start command handler | ||
StartCommandHandler func(svrCtx *Context, clientCtx client.Context, appCreator types.AppCreator, inProcessConsensus bool, opts StartCmdOptions) error | ||
StartCommandHandler func(svrCtx *Context, clientCtx client.Context, appCreator types.AppCreator[T], inProcessConsensus bool, opts StartCmdOptions[T]) error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain what the benefit is for app devs with this? i saw you mentioned berachain, but curious what they/others use it for.
Description
Closes: #23791
Backport
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
in the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.
I have...