Skip to content

Handler refactor and enforcement #check-lint-warning

Asmund THORSec requested to merge asmund/rpc into develop

What originally started as a way to squash a certain class of development bug turned into a broader removal of duplicate code.

All message handlers have a close (but not quite identical) flow that has a Run() method that parses a raw cosmos.Msg into the expected message type, then calls validate() and handle() on it. Both of those functions take the form of version dispatch tables, the updating of which have lead to more than one bug making it into production.

This PR introduces a new structure that removes the handler boilerplate duplication, enforces version ordering at registration time, and includes stricter linting that prevents version stomping/removal.

It changes two message handlers over to the new form as example - the other handlers can be converted in subsequent PRs.

Also note that this will necessarily make the version handler change detector unhappy (#check-lint-warning) but there are no functional changes to handler operations.

Edited by Asmund THORSec

Merge request reports