Improve Mento/Celo Governance Scripts structure #210
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Given we are going to use this repo moving forward for Governance management, we should improve the quality of life a bit. After playing around with the repo a bit I think the
utils/mento
folder can lead to some confusion, especially because of the need to juggle solidity 0.5 and solidity 0.8 between both our core contracts and utility scripts.My proposal is to write all new contracts in 0.8 moving forward, and to transition as much as possible existing scripts to 0.8.
This includes this repo and the
mento-core
repo where ideally we would reach a situation where all tests are written in 0.8, all interfaces for 0.5 contracts are well designed so that we can easily interop between 0.5 and 0.8.This PR is the first step in this. It introduces the mento-std (Mento Standard Library) which will be shared between
mento-core
andmento-deployments
to reduce duplication and is an extension offorge-std
. The tl;dr for responsibilities:forge-std/StdChains.sol
This PR splits the
script/utils
in:v1
where all files used by governance scripts created until this time - as it is too complex and pointless to refactor all old governance proposal to 0.8.v2
new script utils that will be used moving forward (in conjunction with themento-std
repo).The
utils/v2
folder contains:GovernanceScript
: abstract contract of a base Governance proposal, contains some helpers for adding transactions to the proposal and provides the interface for specific governance implementations.CeloGovernanceScript
: abstract contract of a base Celo Governance proposal, handles building, submitting and simulating a Celo governance proposal. It needs a specific proposal contract to extend it and provide the function that creates the proposal transactions.MentoGovernanceScript
: same asCeloGovernanceScript
but for Mento.This PR also introduces a
scripts/bin
folder where Solidity scripts for interacting with proposals live. Feels like a better place for these scripts which used to live inutils
. And also for the demarcation ofmento
andcelo
folders, for governance-specific scripts.This PR also removes the
-g <governance>
flag and simplifies the scripts by detecting the target governance from the .sol file contents, setting the variables.We also introduce
TemplateCelo
andTemplateMento
as template proposals for both governance systems. When we're developing a new upgrade we can just copy and start from the template.Last but not least, it fixes the
description
filed on Mento Governance Proposals which (at least in the UI) is a json object with a title (string) field and a description (markdown) field.Other changes
upgrade
andproposal
are both used in the repo, I decided to only useproposal
everywhere as it's more generalconsole2
from everywhere.forge-std-next
have that asforge-std
normal.forge-std-prev
that points to theforge-std
incelo-precompiles
.SimulateUpgrade
toSimulateProposal
to bring the naming in line.simulate
function to old Governance proposals to match the interface of the new ones and be able to have a singleSimulateProposal
bin contract which works with all governance systems.Tested
An explanation of how the changes were tested or an explanation as to why they don't need to be.
Related issues
Backwards compatibility
All existing governance proposals are backwards compatible.
Documentation
The set of community facing docs that have been added/modified because of this change