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

contracts-bedrock: move immutables to storage for OptimismPortal #8629

Merged
merged 47 commits into from
Jan 11, 2024

Conversation

@0xfuturistic 0xfuturistic self-assigned this Dec 14, 2023
@0xfuturistic 0xfuturistic requested review from a team as code owners December 14, 2023 21:02
@0xfuturistic 0xfuturistic requested review from refcell and removed request for a team December 14, 2023 21:02
Copy link
Contributor

coderabbitai bot commented Dec 14, 2023

Walkthrough

Walkthrough

The updates reflect significant changes to the OptimismPortal functionality within an Ethereum Layer 2 scaling solution. The changes involve restructuring the initialization process to be more flexible by conditionally including additional parameters. A new L2OutputOracleProxy field is introduced in the configuration, and various contract functions and tests have been updated to accommodate these modifications. Additionally, there's an update to the subproject's commit hash indicating changes in dependencies, and gas cost benchmarks have been adjusted.

Changes

File Path Change Summary
op-chain-ops/upgrades/l1.go
packages/contracts-bedrock/scripts/Deploy.s.sol
Modified OptimismPortal initialization logic to include L2Oracle and SystemConfig checks. Updated calldata packing for initialization. Altered instantiation of OptimismPortal to remove dependency on L2OutputOracle and SystemConfig during deployment. Adjusted abi.encodeCall parameters during upgrade and initialization.
packages/contracts-bedrock/.gas-snapshot Adjusted gas costs for benchmark tests.
packages/contracts-bedrock/scripts/ChainAssertions.sol Modified logic in checkOptimismPortal function to include additional checks when _isProxy is false. Adjusted assertions related to addresses.
packages/contracts-bedrock/src/L1/OptimismPortal.sol Removed L2_ORACLE and SYSTEM_CONFIG public immutable variables, replaced with l2Oracle and systemConfig public variables. Modified initialize function to take three parameters and initialize corresponding variables. Updated getter functions for l2Oracle and systemConfig. Updated comments for clarity. Semantic version updated to "2.4.0."
packages/contracts-bedrock/test/L1/OptimismPortal.t.sol Added Constants import, modified test_constructor_succeeds and test_initialize_succeeds functions. Replaced instances of optimismPortal.L2_ORACLE() with optimismPortal.l2Oracle().
packages/contracts-bedrock/test/Specs.t.sol Modified function call from initialize(address) to initialize(address,address,address).
packages/contracts-bedrock/lib/forge-std Updated the subproject commit hash.

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.

op-chain-ops/upgrades/l1.go Outdated Show resolved Hide resolved
Copy link

codecov bot commented Dec 14, 2023

Codecov Report

Attention: 28 lines in your changes are missing coverage. Please review.

Comparison is base (670f534) 25.72% compared to head (7580960) 25.73%.
Report is 83 commits behind head on feat/mcp-l1.

Additional details and impacted files
@@             Coverage Diff              @@
##           feat/mcp-l1    #8629   +/-   ##
============================================
  Coverage        25.72%   25.73%           
============================================
  Files              117      117           
  Lines             4844     4854   +10     
  Branches          1057     1059    +2     
============================================
+ Hits              1246     1249    +3     
- Misses            3494     3499    +5     
- Partials           104      106    +2     
Flag Coverage Δ
chain-mon-tests 27.14% <ø> (ø)
contracts-bedrock-tests 20.28% <0.00%> (+0.04%) ⬆️
contracts-ts-tests 12.25% <ø> (ø)
sdk-next-tests 42.08% <ø> (ø)
sdk-tests 42.08% <ø> (ø)

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

Files Coverage Δ
...ock/src/universal/OptimismMintableERC20Factory.sol 0.00% <0.00%> (ø)
...ckages/contracts-bedrock/src/L1/OptimismPortal.sol 0.00% <0.00%> (ø)
...ckages/contracts-bedrock/src/L1/L2OutputOracle.sol 0.00% <0.00%> (ø)

... and 3 files with indirect coverage changes

@0xfuturistic 0xfuturistic force-pushed the ctb/OptimismPortal-immutable branch from 3df6dad to 69415d2 Compare December 17, 2023 22:48
@0xfuturistic 0xfuturistic force-pushed the ctb/OptimismPortal-immutable branch 2 times, most recently from c065d53 to 3ccbf60 Compare December 18, 2023 16:38
Copy link
Contributor

semgrep-app bot commented Dec 18, 2023

Semgrep found 1 iterate-over-empty-map finding:

  • op-batcher/compressor/compressors.go: L12-23

Iteration over a possibly empty map Kinds. This is likely a bug or redundant code

Ignore this finding from iterate-over-empty-map.

@0xfuturistic 0xfuturistic force-pushed the ctb/OptimismPortal-immutable branch from 7933ab3 to f9e00d7 Compare December 18, 2023 21:49
@0xfuturistic 0xfuturistic force-pushed the ctb/OptimismPortal-immutable branch 2 times, most recently from bb5e92e to ce02f65 Compare December 22, 2023 11:57
@0xfuturistic 0xfuturistic force-pushed the ctb/OptimismPortal-immutable branch 2 times, most recently from 92659e4 to 0db3ede Compare December 24, 2023 13:39
op-chain-ops/upgrades/l1.go Outdated Show resolved Hide resolved
op-chain-ops/upgrades/l1.go Show resolved Hide resolved
@0xfuturistic 0xfuturistic force-pushed the ctb/OptimismPortal-immutable branch from 6e0ad2c to 5512983 Compare January 1, 2024 18:10
Copy link
Contributor

semgrep-app bot commented Jan 4, 2024

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

  • packages/contracts-bedrock/src/dispute/interfaces/IOutputBisectionGame.sol: L57, L38, L12
  • packages/contracts-bedrock/src/dispute/interfaces/IBondManager.sol: L48, L41, L36, L28

Prefer @notice over @dev in natspec comments

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

Semgrep found 1 no-printf-in-responsewriter finding:

  • op-exporter/main.go: L83

Detected 'printf' or similar in 'http.ResponseWriter.write()'. This bypasses HTML escaping that prevents cross-site scripting vulnerabilities. Instead, use the 'html/template' package to render data to users.

Ignore this finding from no-printf-in-responsewriter.

Semgrep found 1 no-direct-write-to-responsewriter finding:

  • op-exporter/main.go: L83

Detected directly writing or similar in 'http.ResponseWriter.write()'. This bypasses HTML escaping that prevents cross-site scripting vulnerabilities. Instead, use the 'html/template' package and render data using 'template.Execute()'.

Ignore this finding from no-direct-write-to-responsewriter.

Semgrep found 1 use-tls finding:

  • op-exporter/main.go: L138

Found an HTTP server without TLS. Use 'http.ListenAndServeTLS' instead. See https://golang.org/pkg/net/http/#ListenAndServeTLS for more information.

Ignore this finding from use-tls.

Semgrep found 1 context-todo finding:

  • op-exporter/main.go: L156

Consider to use well-defined context

Ignore this finding from context-todo.

Semgrep found 1 use-fprintf-not-write-fsprint finding:

  • op-exporter/main.go: L83

use fmt.Fprintf(w, { "healthy": "%t", "version": "%s" }, health.healthy, *health.version) instead of fmt.Sprintf and []byte conversion

Ignore this finding from use-fprintf-not-write-fsprint.

0xfuturistic and others added 26 commits January 10, 2024 20:05
additionally improve documentation in file
this is covered in a different PR refactoring Initializable.t.sol
@0xfuturistic 0xfuturistic force-pushed the ctb/OptimismPortal-immutable branch from bfec639 to 7580960 Compare January 11, 2024 01:18
@tynes tynes merged commit b100652 into feat/mcp-l1 Jan 11, 2024
63 of 64 checks passed
@tynes tynes deleted the ctb/OptimismPortal-immutable branch January 11, 2024 01:55
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