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

Improve Mento/Celo Governance Scripts structure #210

Closed
wants to merge 12 commits into from

Conversation

bowd
Copy link
Contributor

@bowd bowd commented Aug 18, 2024

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 and mento-deployments to reduce duplication and is an extension of forge-std. The tl;dr for responsibilities:

  1. Array helpers.
  2. Lookup contract addresses in different sources.
  3. CeloPrecompilers for tests.
  4. CeloChain helpers in line with the forge-std/StdChains.sol
  5. Provide base Script and Test contracts.

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 the mento-std repo).

At some point we can archive a branch for the v1 and remove older governance proposals and all v1 files for main and just have v2. Because it's not that useful to keep them around forever, but good to keep them accessible. That way we can also manage the amount of lib/mento-core-X-Y-Z submodules we have.

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 as CeloGovernanceScript 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 in utils. And also for the demarcation of mento and celo 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 and TemplateMento 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 and proposal are both used in the repo, I decided to only use proposal everywhere as it's more general
  • Get rid of console2 from everywhere.
  • Get rid of forge-std-next have that as forge-std normal.
  • Have a forge-std-prev that points to the forge-std in celo-precompiles.
  • Rename SimulateUpgrade to SimulateProposal to bring the naming in line.
  • Add simulate function to old Governance proposals to match the interface of the new ones and be able to have a single SimulateProposal 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

  • Fixes #[issue number here]

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

@bowd bowd requested a review from baroooo August 18, 2024 16:31
@bowd bowd changed the title Feat/refactor with shared utils Improve Mento/Celo Governance Scripts structure Aug 18, 2024
@bowd bowd marked this pull request as draft August 19, 2024 09:31
@bowd bowd requested review from nvtaveras and philbow61 and removed request for nvtaveras, baroooo and philbow61 August 26, 2024 13:29
@bowd bowd closed this Oct 25, 2024
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.

1 participant