tendermint / spn

A blockchain to launch blockchains.
Other
112 stars 43 forks source link

Implementing `ChangeParam` request #930

Closed lumtis closed 2 years ago

lumtis commented 2 years ago

Need https://github.com/tendermint/spn/issues/928 to be implemented first

Add in the available requests the ChangeParam request that allows requesting the modification of a module param

Proposed structure:

type ChangeParam stuct {
  Module string
  Param string
  Value []byte // json structure
}

Example:

{
  Module: "staking"
  Param: "max_validators"
  Value: "42"
}

Request to change the max number of validator param of staking module to 42.

This request can only modify parameters value. It can be argued that we eventually want a request to modify any genesis state value. ChangeParam is a simpler implementation as the path to the value is predictable [module]/params/[name], and those represent the value aimed to be changed from community decision

aljo242 commented 2 years ago

Creating the logic to add this request makes sense, but how will we actually apply this request?

We aren't storing any 3rd party chain genesis file or state, so I'm a bit confused about this.

lumtis commented 2 years ago

I consider we will need a map Params

[launch-id]-[module-name]-[param-name] => value ([]byte)

During genesis build, the list of params are iterated and put in the genesis

aljo242 commented 2 years ago

So then the other half of this functionality is implemented by CLI?

The actual building of the chain from genesis?

lumtis commented 2 years ago

Yes, we store on the chain the data that allows to deterministically build the genesis

aljo242 commented 2 years ago

So we will need to set up some kind of verification that the actual params are valid inside the CLI rather than the chain. There's no way to verify them on-chain since we don't have that info there.

I still have some questions:

lumtis commented 2 years ago

From the CLI, we try to initialize the genesis from the applied requests every time the coordinator wants to approve some. Therefore, if the params are invalid, the operation fail. But yeah the verification is fully off-chain

should we also add some way to verify that the params are changed in the proper order?

Params are indexed by the module and param name, stored separately, applying params change to the genesis is idempotent, the order doesn't change the end result

is this only for launched chains (this would make sense to me)?

What do you mean?