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

refactor: Future-proof init/upgrade libraries for other SubDAOs and releases (SC-888) #76

Merged
merged 35 commits into from
Dec 28, 2024

Conversation

lucas-manuel
Copy link
Contributor

@lucas-manuel lucas-manuel commented Dec 19, 2024

Summary of Changes

  1. Move ForeignControllerInit and MainnetControllerInit into their own files for easier readability/navigation.
  2. Update init libraries to use a standard structure for both foreign and mainnet:
    • initAlmSystem initializes almProxy, rateLimits and controller together, doing all sanity checks and all configuration.
    • upgradeController initializes a controller within an existing ALM system, deprecating an oldController.
    • _initController is shared by both of these functions, performing the necessary checks and configuration for initializing just the controller.
  3. Update init libraries to no longer set rate limits. This is to be done in spells manually as these configurations will become more sophisticated an custom with newer version. The init/upgrade scripts are intended to be base functionality.
  4. Removed sanity checks in init/upgrade libs of values that are either hardcoded or queried from other contracts. Only checking constructor params now.
  5. setRateLimit was moved to the RateLimitHelpers library. The rateLimits param is now address instead of IRateLimits for easier usage.
  6. Staging deployment was refactored to accomodate these changes.
  7. Deployments and init/upgrades are now tested in separate files. NOTE: DeployAndInit.t.sol will be renamed to InitAndUpgrade.t.sol in a later PR, this filename was kept as is to have a better diff.

Testing a Local Staging Deployment

All staging tests are failing, but they can be verified against a local deployment. Set up two anvil nodes forking mainnet and base and do the following commands:

export MAINNET_RPC_URL=http://127.0.0.1:8545
export BASE_RPC_URL=http://127.0.0.1:8546

cast rpc --rpc-url="$MAINNET_RPC_URL" anvil_impersonateAccount 0xD1668fB5F690C59Ab4B0CAbAd0f8C1617895052B
cast rpc --rpc-url="$MAINNET_RPC_URL" anvil_impersonateAccount 0xd207546C41F1B2b2cb3857f1De735eCff0bb5FCf
cast send 0x6b175474e89094c44da98b954eedeac495271d0f 'transfer(address,uint256)' $ETH_FROM 1000000000000000000000 --unlocked --from 0xD1668fB5F690C59Ab4B0CAbAd0f8C1617895052B
cast send 0xdC035D45d973E3EC169d2276DDab16f1e407384F 'transfer(address,uint256)' $ETH_FROM 1000000000000000000000 --unlocked --from 0xd207546C41F1B2b2cb3857f1De735eCff0bb5FCf

Then replace *latest.json files with release-DATE.json and update RELEASE_DATE in the test.

Copy link
Contributor

@hexonaut hexonaut left a comment

Choose a reason for hiding this comment

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

Refactor looks good. Some minor changes. Will deploy.

Copy link
Contributor

@hexonaut hexonaut left a comment

Choose a reason for hiding this comment

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

All changes look good. Just waiting on moving the unlimited back to their original groupings as discussed in Slack.

Copy link

Coverage after merging sc-888-init-lib-refactor into dev will be

99.36%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
deploy
   ControllerDeploy.sol100%100%100%100%
   ForeignControllerInit.sol100%100%100%100%
   MainnetControllerInit.sol97.30%93.75%100%100%136, 78
src
   ALMProxy.sol100%100%100%100%
   ForeignController.sol100%100%100%100%
   MainnetController.sol100%100%100%100%
   RateLimitHelpers.sol75%62.50%75%83.33%21–22, 39, 45, 49
   RateLimits.sol100%100%100%100%

@lucas-manuel lucas-manuel merged commit 2bb6b14 into dev Dec 28, 2024
3 checks passed
@lucas-manuel lucas-manuel deleted the sc-888-init-lib-refactor branch December 28, 2024 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants