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

Cleanup params in Babylon custom modules. #334

Merged
merged 2 commits into from
Mar 28, 2023

Conversation

KonradStaniec
Copy link
Contributor

A bit of preparation before fixing - #325

A lot of babylon modules used empty Params protos. This makes little sense as it just generate a lot unnecessary code. This pr removes those Params protos and all related code.

Copy link
Member

@SebastianElvis SebastianElvis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the effort and this indeed cuts a lot of code. However, I have some concern that removing boilerplate code for params might make it hard for us to add new parameters to these modules in the future. It could be possible that we want some new parameters in a certain module, and may even want to update their values upon gov prop. Given these reasons I'm inclined to keep the code as is. No strong objection, but would like to hear feedback from more ppl

import "babylon/checkpointing/v1/bls_key.proto";

option go_package = "github.com/babylonchain/babylon/x/checkpointing/types";

// GenesisState defines the checkpointing module's genesis state.
message GenesisState {
// params defines all the paramaters of related to checkpointing
Params params = 1 [ (gogoproto.nullable) = false ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It it worth keeping the Params message and field here in case of any new parameters in the future?

import "babylon/btclightclient/v1/btclightclient.proto";

option go_package = "github.com/babylonchain/babylon/x/btclightclient/types";

// GenesisState defines the btclightclient module's genesis state.
message GenesisState {
Params params = 1 [ (gogoproto.nullable) = false ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, is it worth keeping params?


option go_package = "github.com/babylonchain/babylon/x/monitor/types";

// GenesisState defines the monitor module's genesis state.
message GenesisState { Params params = 1 [ (gogoproto.nullable) = false ]; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here


option go_package = "github.com/babylonchain/babylon/x/zoneconcierge/types";

// GenesisState defines the zoneconcierge module's genesis state.
message GenesisState {
Params params = 1 [ (gogoproto.nullable) = false ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. Notably, a param that can be upgraded by gov prop might be useful when we add support to phase 3 when at phase 2.

Copy link
Member

@vitsalis vitsalis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with @SebastianElvis here. Do we get anything else other than less boilerplate code if we remove them? From what I understand from #325 , we are already compliant with the change (at least with the changes related to this PR), as we store module parameters in the module.

@KonradStaniec
Copy link
Contributor Author

Do we get anything else other than less boilerplate code if we remove them? From what I understand from #325 , we are already compliant with the change (at least with the changes related to this PR), as we store module parameters in the module.

So currently we store params in x/params module which is now deprecated and from cosmos sdk 0.48 will be removed. Given the fact that we are currently always on newest version, I assume we will also want to switch to 0.48, so we will want to make a switch to a new version. It makes sense to do it before mainnet as this way we will avoid any upgrade handlers etc.

however, I have some concern that removing boilerplate code for params might make it hard for us to add new parameters to these modules in the future. It could be possible that we want some new parameters in a certain module, and may even want to update their values upon gov prop. Given these reasons I'm inclined to keep the code as is. No strong objection, but would like to hear feedback from more ppl

So the effort to add params later from scratch versus add new param to params proto will be roughly the same. You will need upgrade handler which will update required proto files or create v2 of proto file, and probably gov proposal to introduce them.

Also current situation is mostly a result of copy/pasting modules at the beginning of our project which is not really good design.

In general carrying code which may/or may not become useful in some not specified time in the future is a smell that something is not right.

In general, we have still some time till mainnet, so we have time to decide if any of those modules will require params. If we happen to decide that this is the case, it will be done in new way which is much different from current one.

So in summary imo it makes sense to:

  • start from deleting old way of handling params from modules which does not need it as a) modules do not use params eitherway, b) current way of handling params is deprecated and will be removed
  • move remaining modules to new way of handling params.
  • decide which of other modules will need params, and if any ,and implement it in new way.

Keeping 4k lines of code just in case just sounds like a bad deal.

Copy link
Member

@vitsalis vitsalis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explanation makes sense for me 🚀

@vitsalis vitsalis mentioned this pull request Mar 27, 2023
@KonradStaniec KonradStaniec merged commit 9dba89a into dev Mar 28, 2023
@KonradStaniec KonradStaniec deleted the cleanup-params-babylon-modules branch March 28, 2023 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants