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

OPSM: Dedupe some code, switch to getter methods for added safety #11555

Merged
merged 10 commits into from
Aug 22, 2024

Conversation

mds1
Copy link
Contributor

@mds1 mds1 commented Aug 21, 2024

Follow on to #11539

This PR makes the following changes:

  • Refactors some code into a new DeployUtils library. We intentionally use a new library to keep these new deploy scripts separated from the original, to make cleaning up the old scripts simpler.
    • As part of that library, we added a new Solarray library which is based on https://github.com/emo-eth/solarray as described in the comments of our new Solarray.sol. While adding that library is arguably overkill for the changes in this PR, I added it because in the long term I believe we can use it to clean up the test suite by improving solidity array UX.
  • Instead of public variables as getter methods for the input and output contracts, we switch to explicit getter methods. This allows us to make assertions before returning a value, to ensure the data was actually set to a valid value.
    • This is important because our new deploy scripts are modular, with each deploy step being it's own public function. Users can compose these functions, but some of these functions depend on other functions be ran first (for example, you can't deploy MIPS until you deploy PreimageOracle, because the latter is a constructor argument for the former). Therefore this "assert on read" pattern helps prevent footguns where users may end up deploying an invalid or misconfigured system.
    • Tests are added for this new functionality

Edit: commit history is messed up here, the first five commits are from #11539 since this branch was built off that. Since we squash merge I've just left the history alone

@mds1 mds1 requested a review from a team as a code owner August 21, 2024 19:25
@mds1 mds1 requested review from tynes and protolambda and removed request for a team and tynes August 21, 2024 19:25
Base automatically changed from opsm/deploy-implementation-contracts to develop August 22, 2024 15:34
@mds1 mds1 enabled auto-merge August 22, 2024 16:33
@mds1 mds1 added this pull request to the merge queue Aug 22, 2024
Merged via the queue into develop with commit 93361d0 Aug 22, 2024
59 checks passed
@mds1 mds1 deleted the opsm/dedupe-and-safety branch August 22, 2024 17:14
samlaf pushed a commit to samlaf/optimism that referenced this pull request Nov 10, 2024
…hereum-optimism#11555)

* feat: scaffold impl deploy script and test

* add fault proofs support

* appease semgrep

* additional semgrep fix

* refactor: dedupe libraries

* refactor/test: refactor to use getter methods to add assertions on getters, and add corresponding tests

* fix url

* chore: ignore autogenerated lib
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