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

Support multiple Comets using one Configurator #437

Merged
merged 11 commits into from
Jun 27, 2022

Conversation

kevincheng96
Copy link
Contributor

@kevincheng96 kevincheng96 commented Jun 24, 2022

This PR modifies the Configurator implementation to support multiple deployments of Comet so only a single Configurator instance needs to be deployed per chain. Instead of storing a single Configuration and factory address, the Configurator now stores a mapping from Comet proxy addresses to their respective Configuration and factory addresses. Because Configurator.deploy() now takes a Comet proxy address as an argument, a small change is also made to the CometProxyAdmin.deployAndUpgradeTo(...) function to use this new interface. I also removed the logic of setting an initial factory and configuration from the initializer and, instead, added new setters to set these after initialization (more details covered in this comment).

This PR also updates our unit tests, scenarios, deployment logic, and migration scripts to work with the new Configurator implementation.

For scenarios specifically, I added a new flag called upgradeAll to the ModernConstraint that upgrades all contracts. This is needed in scenarios that need to upgrade more than just Comet. For example, we need to upgrade the CometProxyAdmin in a small number of our scenarios that use the Configurator.

TLDR: Contract changes are:

  • Change Configurator storage for factory and configuration to be mappings
  • Move the setting of the initial factory and configuration out of the initializer
  • Modify the CometProxyAdmin to use the new interface for Configurator.deploy(address)

Copy link
Contributor

@jflatow jflatow left a comment

Choose a reason for hiding this comment

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

Still looking but looking pretty good to me

@kevincheng96 kevincheng96 marked this pull request as ready for review June 24, 2022 22:10
contracts/Configurator.sol Outdated Show resolved Hide resolved
Copy link
Contributor

@jflatow jflatow left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for getting this through 💪 👏

@kevincheng96 kevincheng96 merged commit 6d7daf5 into main Jun 27, 2022
@kevincheng96 kevincheng96 deleted the kevin/shared-configurator branch June 27, 2022 20:49
kevincheng96 added a commit that referenced this pull request Jun 28, 2022
This updates the docs to be consistent with the changes introduced to the Configurator in #437.
ajb413 added a commit that referenced this pull request Jun 28, 2022
* cleanup, added total borrows, added notes on reward accrual

* remove web3.js docs examples

* rearrange, collapse code examples, wording changes in liquidation section

* missing italic

* moved functions to liquidation section

* Update docs for Configurator (#443)

This updates the docs to be consistent with the changes introduced to the Configurator in #437.

* added reserve section edits

Co-authored-by: Kevin Cheng <kevincheng96@hotmail.com>
MichaelMorami pushed a commit to Certora/comet that referenced this pull request Jun 29, 2022
This PR modifies the Configurator implementation to support multiple deployments of Comet so only a single Configurator instance needs to be deployed per chain. Instead of storing a single Configuration and factory address, the Configurator now stores a mapping from Comet proxy addresses to their respective Configuration and factory addresses. Because Configurator.deploy() now takes a Comet proxy address as an argument, a small change is also made to the CometProxyAdmin.deployAndUpgradeTo(...) function to use this new interface. I also removed the logic of setting an initial factory and configuration from the initializer and, instead, added new setters to set these after initialization.

This PR also updates our unit tests, scenarios, deployment logic, and migration scripts to work with the new Configurator implementation.

For scenarios specifically, I added a new flag called upgradeAll to the ModernConstraint that upgrades all contracts. This is needed in scenarios that need to upgrade more than just Comet. For example, we need to upgrade the CometProxyAdmin in a small number of our scenarios that use the Configurator.

TLDR: Contract changes are:

Change Configurator storage for factory and configuration to be mappings
Move the setting of the initial factory and configuration out of the initializer
Modify the CometProxyAdmin to use the new interface for Configurator.deploy(address)
MichaelMorami pushed a commit to Certora/comet that referenced this pull request Jun 29, 2022
* cleanup, added total borrows, added notes on reward accrual

* remove web3.js docs examples

* rearrange, collapse code examples, wording changes in liquidation section

* missing italic

* moved functions to liquidation section

* Update docs for Configurator (compound-finance#443)

This updates the docs to be consistent with the changes introduced to the Configurator in compound-finance#437.

* added reserve section edits

Co-authored-by: Kevin Cheng <kevincheng96@hotmail.com>
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