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

LegacyMsg in payment module deprecated in favor of Msg Services #1

Open
mpoke opened this issue Aug 19, 2022 · 0 comments
Open

LegacyMsg in payment module deprecated in favor of Msg Services #1

mpoke opened this issue Aug 19, 2022 · 0 comments
Labels
payment Payment module in celestia-app

Comments

@mpoke
Copy link
Collaborator

mpoke commented Aug 19, 2022

For executing MsgPayForData messages, the payment module implements a handler function, which is added to the application's router via the Route() method. This is deprecated (see https://docs.cosmos.network/v0.45/building-modules/msg-services.html#amino-legacymsgs).

Suggestions:

  • register the message server, i.e.,
func (am AppModule) RegisterServices(cfg module.Configurator) {
	types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
	// ...
}
  • return an empty route in Route()
func (am AppModule) Route() sdk.Route {
	return sdk.Route{}
}
  • delete x/payment/handler.go

Further suggestions for improving code quality:

Note that these changes will make the structure of the module consistent with the SDK.

  • move msgServer methods to x/payment/keeper/msg_server.go, i.e., PayForData method
  • create x/payment/types/msgs.go file that contains the two message types (i.e., MsgWirePayForData, MsgPayForData) together with their functions
@mpoke mpoke added the payment Payment module in celestia-app label Aug 19, 2022
@mpoke mpoke changed the title Payment module: LegacyMsg deprecated in favor of Msg Services LegacyMsg in payment module deprecated in favor of Msg Services Aug 19, 2022
@rootulp rootulp self-assigned this Nov 30, 2022
@rootulp rootulp removed their assignment Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
payment Payment module in celestia-app
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants