confio / poe-contracts

Tgrade PoE smart contracts
Apache License 2.0
25 stars 11 forks source link

tgrade-valset: Modify distribution list to send funds to tc-payments #182

Open maurolacy opened 2 years ago

maurolacy commented 2 years ago

As the last part of https://github.com/confio/matadores-backlog-collection/issues/27#issuecomment-1245506105, we need to modify the valset distribution list to redirect the funds to the payments contract.

This requires a contract upgrade, because the current UpdateConfig mechanism does not support changing the distribution list.

This can be done in two parts:

  1. Upgrade (migrate) the contract to a new version with an updated UpdateConfig that supports changing the distribution list.
  2. Create a proposal to use UpdateConfig to update the valset distribution list with the new distribution list.

Both parts can be done during contract migration, for simplicity (only one proposal required). But in any case, changing the UpdateConfig handler to support changing the distribution list looks like a good idea. So that it can be used to change / adjust the distribution list in the future if needed.

alpe commented 2 years ago
  1. Create a proposal to use UpdateConfig

Would this be a sudo call via gov? we don't have this in tgrade (yet) https://github.com/confio/tgrade/blob/main/x/twasm/contract/incoming_msgs.go#L61

maurolacy commented 2 years ago

3. Create a proposal to use UpdateConfig

Would this be a sudo call via gov? we don't have this in tgrade (yet) https://github.com/confio/tgrade/blob/main/x/twasm/contract/incoming_msgs.go#L61

Hmm, I don't think this is needed. The OC proposals contract is the (contract, not migrate) admin of the valset contract. The UpdateConfig execution

https://github.com/confio/tgrade-contracts/blob/ef671e954365e1026d6d7ee539f3996d4393d4e1/contracts/tgrade-oc-proposals/src/contract.rs#L163-L178

sends an update config message to the valset contract. No gov proposal support in tgrade needed, AFAIK.

maurolacy commented 2 years ago

The only questions I have would be, if it's possible to create an update config proposal in the OC proposals UI, and if said proposal will be routed / handled properly.

Anyway, despite all that, a valset migration is required, because the current update config message does not support updating the distribution list.

Will work on that next.