optimism icon indicating copy to clipboard operation
optimism copied to clipboard

Refactor L2 genesis generation - Preinstalls

Open spacesailor24 opened this issue 1 year ago • 11 comments

This is the second of several PRs to address L2 Genesis Generation Refactor. This PR handles adding the L2 preinstalls to Foundry's VM state before calling vm.dumpState to generate a genesis outfile

spacesailor24 avatar Feb 02 '24 04:02 spacesailor24

[!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

  • #9328 Graphite
  • #9317 Graphite 👈
  • #9410 Graphite
  • #9557 Graphite
  • #9558 Graphite
  • develop

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

Join @spacesailor24 and the rest of your teammates on Graphite Graphite

spacesailor24 avatar Feb 02 '24 04:02 spacesailor24

Semgrep found 10 sol-style-notice-over-dev-natspec findings:

Prefer @notice over @dev in natspec comments

Ignore this finding from sol-style-notice-over-dev-natspec.

semgrep-app[bot] avatar Feb 02 '24 04:02 semgrep-app[bot]

Semgrep found 8 sol-style-notice-over-dev-natspec findings:

Prefer @notice over @dev in natspec comments

Ignore this finding from sol-style-notice-over-dev-natspec.

semgrep-app[bot] avatar Feb 02 '24 23:02 semgrep-app[bot]

Walkthrough

The updates focus on enhancing the deployment and initialization process for Layer 2 (L2) genesis configurations in the Optimism stack. Key changes include the addition of a constant for developer account funding, improved management and setup of predeploy proxies and preinstalled contracts, and the removal of certain predeploy constants. This overhaul aims to streamline the setup process, optimize the genesis configuration, and ensure a more efficient and cleaner deployment of the L2 system.

Changes

File Path Change Summary
packages/contracts-bedrock/scripts/DeployConfig.s.sol & packages/contracts-bedrock/scripts/L2Genesis.s.sol Introduced DEV_ACCOUNT_FUND_AMT and enhanced deployment scripts with new functions and imports for better genesis setup.
packages/contracts-bedrock/scripts/libraries/L2GenesisHelpers.sol Added helper methods for L2 genesis setup and testing.
packages/contracts-bedrock/src/libraries/Predeploys.sol Removed outdated predeploy constants.
packages/contracts-bedrock/test/Preinstalls.t.sol & packages/contracts-bedrock/test/scripts/L2Genesis.t.sol Added tests for verifying preinstalled contracts and genesis configuration.

Related issues

  • ethereum-optimism/optimism#8616: This PR may indirectly address the issue by optimizing the genesis configuration process, potentially impacting the generation and management of proxies in the genesis.json file. The refactoring and cleanup could lead to a more controlled and efficient approach to proxy generation, addressing the concern of excessive unused proxies.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

coderabbitai[bot] avatar Feb 12 '24 22:02 coderabbitai[bot]

Semgrep found 3 sol-style-notice-over-dev-natspec findings:

  • packages/contracts-bedrock/scripts/L2Genesis.s.sol: L381, L164
  • packages/contracts-bedrock/scripts/libraries/L2GenesisHelpers.sol: L24

Prefer @notice over @dev in natspec comments

Ignore this finding from sol-style-notice-over-dev-natspec.

semgrep-app[bot] avatar Feb 13 '24 01:02 semgrep-app[bot]

Semgrep found 1 sol-style-return-arg-fmt finding:

  • packages/contracts-bedrock/scripts/L2Genesis.s.sol: L59

Named return arguments to functions must be appended with an underscore (_)

Ignore this finding from sol-style-return-arg-fmt.

semgrep-app[bot] avatar Feb 13 '24 02:02 semgrep-app[bot]

This has conflicts and needs a rebase

tynes avatar Feb 13 '24 17:02 tynes

Semgrep found 4 sol-style-notice-over-dev-natspec findings:

  • packages/contracts-bedrock/scripts/L2Genesis.s.sol: L149, L55, L51, L366

Prefer @notice over @dev in natspec comments

Ignore this finding from sol-style-notice-over-dev-natspec.

semgrep-app[bot] avatar Feb 14 '24 07:02 semgrep-app[bot]

Semgrep found 1 sol-style-notice-over-dev-natspec finding:

  • packages/contracts-bedrock/scripts/L2Genesis.s.sol: L60

Prefer @notice over @dev in natspec comments

Ignore this finding from sol-style-notice-over-dev-natspec.

semgrep-app[bot] avatar Feb 14 '24 08:02 semgrep-app[bot]

Semgrep found 2 sol-style-notice-over-dev-natspec findings:

  • packages/contracts-bedrock/scripts/L2Genesis.s.sol: L273, L157

Prefer @notice over @dev in natspec comments

Ignore this finding from sol-style-notice-over-dev-natspec.

Semgrep found 1 sol-style-return-arg-fmt finding:

  • packages/contracts-bedrock/scripts/Artifacts.s.sol: L169

Named return arguments to functions must be appended with an underscore (_)

Ignore this finding from sol-style-return-arg-fmt.

semgrep-app[bot] avatar Feb 15 '24 05:02 semgrep-app[bot]

Semgrep found 1 sol-style-notice-over-dev-natspec finding:

  • packages/contracts-bedrock/scripts/L2Genesis.s.sol: L484

Prefer @notice over @dev in natspec comments

Ignore this finding from sol-style-notice-over-dev-natspec.

semgrep-app[bot] avatar Feb 15 '24 05:02 semgrep-app[bot]

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Mar 17 '24 01:03 github-actions[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 16.56%. Comparing base (28fa280) to head (124412b).

:exclamation: Current head 124412b differs from pull request most recent head e91b3c4. Consider uploading reports for the commit e91b3c4 to get more accurate results

Additional details and impacted files
@@                             Coverage Diff                             @@
##           wyatt/devnet/l2-genesis-predeploy-tests    #9317      +/-   ##
===========================================================================
+ Coverage                                    16.53%   16.56%   +0.02%     
===========================================================================
  Files                                          119      119              
  Lines                                         5110     5101       -9     
  Branches                                      1133     1132       -1     
===========================================================================
  Hits                                           845      845              
+ Misses                                        4190     4181       -9     
  Partials                                        75       75              
Flag Coverage Δ
chain-mon-tests 27.14% <ø> (ø)
contracts-bedrock-tests 0.65% <ø> (+<0.01%) :arrow_up:
contracts-ts-tests 12.25% <ø> (ø)
sdk-next-tests 41.53% <ø> (ø)
sdk-tests 41.53% <ø> (ø)

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

see 1 file with indirect coverage changes

codecov[bot] avatar Mar 17 '24 01:03 codecov[bot]

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Apr 01 '24 01:04 github-actions[bot]

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Apr 16 '24 01:04 github-actions[bot]