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

Add deployImplementations to ForkLive flow #13573

Open
wants to merge 5 commits into
base: opcm-up/dont-read-addrs-from-disk
Choose a base branch
from

Conversation

maurelian
Copy link
Contributor

@maurelian maurelian commented Jan 3, 2025

TL;DR

Added support for deploying the develop versions of contract implementations alongside implementations from the forked network.

This is necessary because the ForkLive script currently only loads the pre-existing contracts from the production network. So we are now deploying the current implementation contracts so that the Proxies can be upgraded to them.

What changed?

  • Modified Deploy.deployImplementations to:
    • accept a suffix parameter for naming implementations.
    • saving logic now appends the provided suffix to contract names. (ie. save("SystemConfigImpl_NextVersion")).
  • Etching Deploy on the forked network to deploy new implementations.

Copy link
Contributor Author

maurelian commented Jan 3, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@maurelian maurelian force-pushed the opcm-up/deploy-names-match-opcm-names branch from 462d3ab to 8e643a4 Compare January 4, 2025 00:11
@maurelian maurelian force-pushed the opcm-up/add-deployImpls-to-fork-live branch 4 times, most recently from 157879e to f3b007b Compare January 4, 2025 01:53
Copy link

codecov bot commented Jan 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.83%. Comparing base (a7c2ac6) to head (2013c01).

Additional details and impacted files
@@                          Coverage Diff                           @@
##           opcm-up/dont-read-addrs-from-disk   #13573       +/-   ##
======================================================================
+ Coverage                              45.89%   90.83%   +44.94%     
======================================================================
  Files                                    893      109      -784     
  Lines                                  74874     4595    -70279     
  Branches                                 768      768               
======================================================================
- Hits                                   34360     4174    -30186     
+ Misses                                 37820      334    -37486     
+ Partials                                2694       87     -2607     
Flag Coverage Δ
contracts-bedrock-tests 90.83% <ø> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 785 files with indirect coverage changes

@maurelian maurelian marked this pull request as ready for review January 6, 2025 14:32
@maurelian maurelian requested a review from a team as a code owner January 6, 2025 14:32
@maurelian maurelian requested review from clabby, smartcontracts and mds1 and removed request for a team January 6, 2025 14:32
@maurelian maurelian force-pushed the opcm-up/deploy-names-match-opcm-names branch from cbc6606 to 050944f Compare January 6, 2025 15:38
@maurelian maurelian force-pushed the opcm-up/add-deployImpls-to-fork-live branch from c023b16 to 7d1a662 Compare January 6, 2025 15:38
@maurelian maurelian removed the request for review from clabby January 6, 2025 16:46
@maurelian maurelian force-pushed the opcm-up/deploy-names-match-opcm-names branch from 050944f to 3e7d2cd Compare January 7, 2025 01:35
@maurelian maurelian force-pushed the opcm-up/add-deployImpls-to-fork-live branch from 7d1a662 to d6e9629 Compare January 7, 2025 01:36
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you update the PR description to say why we need this feature? From the description I understand the what, but not the why

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this:

This is necessary because the ForkLive script currently only loads the pre-existing contracts from the production network. So we are now deploying the current implementation contracts so that the Proxies can be upgraded to them.

Comment on lines 102 to 117
/// @notice Etches a new Deploy.s.sol contract at a deterministic address, sets up the environment,
/// and deploys new implementations with a "_NextVersion" suffix. This suffix is necessary to avoid
/// naming collisions with the implementations saved above.
function _deployNewImplementations() internal {
Deploy deployNew = Deploy(address(uint160(uint256(keccak256(abi.encode("optimism.deploy.new"))))));
vm.etch(address(deployNew), vm.getDeployedCode("Deploy.s.sol:Deploy"));
vm.label(address(deployNew), "DeployNew");
vm.allowCheatcodes(address(deployNew));
vm.setEnv("CONTRACT_ADDRESSES_PATH", string.concat(vm.projectRoot(), "/deployments/1-deploy.json"));

deployNew.setUp();
deployNew.deployImplementations({ _isInterop: false, _suffix: "_NextVersion" });
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I know we also talked about an approach where deployImplementations is create2 based, so we could have it do something like this:

  • compute address for deploying a contract
  • check if there's code there
  • if code, contract is unchanged, skip deploy
  • if no code, contract changed, execute deploy

Is my interpretation correct that this PR is an alternative solution to that one? The create2 based one feels cleaner and simpler to me though. Here we are further enshrining the save functionality by relying on it and I thought we wanted to move away from that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure I follow.

A move towards create2 would have to happen in the DeployImplementations.s.sol script which deployImplementations just wraps.

While I agree that we should move away from save() if possible, I'm a bit afraid to open up that can of worms at this moment, as its very deeply integrated with the deploy scripts so it's hard to assess the effort required. In my mind it would require ForkLive.run() and Deploy.run() to both return very large structs similar (but not identical) to DeployOpChain Output, so that those values can be used in CommonTest.

@maurelian maurelian force-pushed the opcm-up/deploy-names-match-opcm-names branch from 13c469f to 3a4e011 Compare January 8, 2025 05:16
@maurelian maurelian force-pushed the opcm-up/add-deployImpls-to-fork-live branch from d6e9629 to a2803aa Compare January 8, 2025 05:16
Base automatically changed from opcm-up/deploy-names-match-opcm-names to develop January 8, 2025 05:35
@maurelian maurelian force-pushed the opcm-up/add-deployImpls-to-fork-live branch from 16d54d6 to 2013c01 Compare January 9, 2025 03:03
@maurelian maurelian changed the base branch from develop to opcm-up/dont-read-addrs-from-disk January 9, 2025 03:04
@maurelian maurelian force-pushed the opcm-up/dont-read-addrs-from-disk branch from a30d375 to c02e6b2 Compare January 9, 2025 03:28
@maurelian maurelian force-pushed the opcm-up/add-deployImpls-to-fork-live branch from 2013c01 to 22c3410 Compare January 9, 2025 03:28
@maurelian maurelian force-pushed the opcm-up/dont-read-addrs-from-disk branch from c02e6b2 to c2f094a Compare January 9, 2025 03:38
@maurelian maurelian force-pushed the opcm-up/add-deployImpls-to-fork-live branch from 22c3410 to 1362e01 Compare January 9, 2025 03:38
@maurelian maurelian requested review from mds1 and a team and removed request for smartcontracts January 9, 2025 03:41
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.

2 participants