optimism
optimism copied to clipboard
contracts-bedrock: ecotone gas config support
Description
Updates the gas config on the SystemConfig to be ecotone first.
This resolves chain operator ux issues with setting the gas config,
rendering the additional tooling for calculating the encoded
scalar version obsolete. This version of the system config
is technically backwards compatible with pre-ecotone, but it
requires a follow up tx to call the old setGasConfig method.
The old gas config method was updated such that it cannot
be used to set ecotone style config to prevent footguns.
A new method setGasConfigEcotone should be used instead.
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.
Walkthrough
Walkthrough
The recent updates involve significant changes across various files to transition away from deprecated fields GasPriceOracleOverhead and GasPriceOracleScalar towards GasPriceOracleBaseFeeScalar and GasPriceOracleBlobBaseFeeScalar. These changes impact configuration structs, validation logic, test cases, gas benchmarks, and deployment scripts.
Changes
| Files | Change Summary |
|---|---|
op-chain-ops/genesis/config.goop-chain-ops/upgrades/l1.go |
Removed deprecated fields and related checks in DeployConfig and SystemConfig functions. |
op-node/rollup/types.goop-node/rollup/types_test.go |
Eliminated ErrMissingOverhead error handling and related tests. |
packages/contracts-bedrock/.gas-snapshot |
Updated gas benchmarks for various functions. |
packages/contracts-bedrock/scripts/ChainAssertions.sol |
Adjusted comparison requirements for configuration parameters. |
packages/contracts-bedrock/scripts/Deploy.s.solpackages/contracts-bedrock/scripts/DeployConfig.s.sol |
Replaced deprecated fields with new scalar values. |
packages/contracts-bedrock/scripts/go-ffi/differential-testing.go |
Added encoding/decoding cases for scalar values. |
op-e2e/actions/ecotone_fork_test.goop-e2e/custom_gas_token_test.goop-e2e/system_test.goop-e2e/system_tob_test.go |
Updated comparisons and variable names related to gas parameters. |
packages/contracts-bedrock/test/L1/SystemConfig.t.sol |
Added new fields, assertions, and test functions related to scalar values. |
packages/contracts-bedrock/src/L1/SystemConfig.sol |
Added deprecation notice and new declarations for scalar values. |
Recent Review Details
Configuration used: .coderabbit.yml Review profile: CHILL
Commits
Files that changed from the base of the PR and between 2269ae092348ba2c2717676fa3fd0df0699743d4 and fe50b75097cc2001aabe14b8afd31c2dff4ae07f.Files selected for processing (1)
- packages/contracts-bedrock/test/L1/SystemConfig.t.sol (11 hunks)
Additional comments not posted (3)
packages/contracts-bedrock/test/L1/SystemConfig.t.sol (3)
546-562: Validate encoding and decoding logic for new scalar values.Ensure that the encoding and decoding logic for
basefeeScalarandblobbasefeeScalaris correctly implemented and consistent across different parts of the contract.
55-60: Validate the default values forbasefeeScalarandblobbasefeeScalar.Ensure that the default values for
basefeeScalarandblobbasefeeScalarare set correctly in theSystemConfigcontract to match the expected defaults in the test environment.Verification successful
The previous attempts to extract the
initializefunction from theSystemConfigcontract did not yield the necessary details. To ensure we verify the default values forbasefeeScalarandblobbasefeeScalar, we need to refine our approach.Let's directly search for the
basefeeScalarandblobbasefeeScalarwithin theSystemConfigcontract to identify their default values.
The search results indicate that the default values for
basefeeScalarandblobbasefeeScalarare set to0in theSystemConfigcontract. This matches the expected defaults in the test environment.
basefeeScalaris set to0.blobbasefeeScalaris set to0.These values are consistent with the assertions in the test file.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the default values for `basefeeScalar` and `blobbasefeeScalar` are set correctly across different environments. # Test: Search for the default values setting in the contract initialization. rg --type solidity $'SystemConfig.initialize'Length of output: 77
Script:
#!/bin/bash # Description: Verify that the default values for `basefeeScalar` and `blobbasefeeScalar` are set correctly across different environments. # Find all Solidity files and search for the `initialize` function within them. fd -e sol -x rg 'initialize' {}Length of output: 30928
Script:
#!/bin/bash # Description: Verify the default values for `basefeeScalar` and `blobbasefeeScalar` in the `SystemConfig` contract. # Find the `SystemConfig` contract file. fd -e sol -x rg 'contract SystemConfig' {} # Extract the initialization method from the `SystemConfig` contract. fd -e sol -x rg -A 20 'function initialize' {}Length of output: 41688
Script:
#!/bin/bash # Description: Extract the `initialize` function from the `SystemConfig` contract to verify the default values for `basefeeScalar` and `blobbasefeeScalar`. # Find the `SystemConfig` contract file. fd -e sol -x rg 'contract SystemConfig' {} # Extract the `initialize` function from the `SystemConfig` contract. fd -e sol -x rg -A 20 'function initialize' {} | rg 'SystemConfig'Length of output: 1599
Script:
#!/bin/bash # Description: Extract the `initialize` function from the `SystemConfig` contract to verify the default values for `basefeeScalar` and `blobbasefeeScalar`. # Find the `SystemConfig` contract file. fd -e sol -x rg 'contract SystemConfig' {} # Extract the `initialize` function from the `SystemConfig` contract. fd -e sol -x rg -A 50 'function initialize' {} | rg 'SystemConfig'Length of output: 2095
Script:
#!/bin/bash # Description: Extract the `initialize` function from the `SystemConfig` contract to verify the default values for `basefeeScalar` and `blobbasefeeScalar`. # Find the `SystemConfig` contract file. fd -e sol -x rg 'contract SystemConfig' {} # Extract the `initialize` function from the `SystemConfig` contract. fd -e sol -x rg -A 50 'function initialize' {} | rg 'SystemConfig'Length of output: 2095
Script:
#!/bin/bash # Description: Verify the default values for `basefeeScalar` and `blobbasefeeScalar` in the `SystemConfig` contract. # Find the `SystemConfig` contract file. fd -e sol -x rg 'contract SystemConfig' {} # Search for `basefeeScalar` and `blobbasefeeScalar` within the `SystemConfig` contract. fd -e sol -x rg 'basefeeScalar' {} fd -e sol -x rg 'blobbasefeeScalar' {}Length of output: 6544
83-92: Check the initialization logic forbasefeeScalarandblobbasefeeScalar.Ensure that the initialization logic for
basefeeScalarandblobbasefeeScalaris correctly implemented and consistent across different test environments.Verification successful
#!/bin/bash # Description: Extract the initialize function from SystemConfig.sol to verify the initialization logic for basefeeScalar and blobbasefeeScalar. # Step 1: Extract the initialize function from SystemConfig.sol. ast-grep --lang solidity --pattern $'function initialize($_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_, $_ --- The `initialize` function in `SystemConfig.sol` correctly sets the values for `basefeeScalar` and `blobbasefeeScalar` using the `_setGasConfigEcotone` function. This confirms that the initialization logic for these scalar values is implemented. - `basefeeScalar` and `blobbasefeeScalar` are initialized in the `initialize` function. - The values are set using the `_setGasConfigEcotone` function. </details> <details> <summary>Scripts Executed</summary> The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Description: Verify the initialization logic for new scalar values in different test environments. # Test: Search for the initialization logic in the contract. rg --type solidity $'SystemConfig.initialize'Length of output: 77
Script:
#!/bin/bash # Description: Verify the initialization logic for new scalar values in different test environments. # Test: Search for the initialization logic in the contract. rg --type sol $'function initialize'Length of output: 65
Script:
#!/bin/bash # Description: Verify the initialization logic for new scalar values in different test environments. # Step 1: Find all Solidity files. fd -e sol > sol_files.txt # Step 2: Search for the `initialize` function within those files. rg 'function initialize' $(cat sol_files.txt)Length of output: 23070
Script:
#!/bin/bash # Description: Extract the initialize function from SystemConfig.sol to verify the initialization logic for basefeeScalar and blobbasefeeScalar. # Step 1: Extract the initialize function from SystemConfig.sol. ast-grep --lang solidity --pattern $'function initialize($_) { $$$ }' packages/contracts-bedrock/src/L1/SystemConfig.solLength of output: 238
Script:
#!/bin/bash # Description: Extract the initialize function from SystemConfig.sol to verify the initialization logic for basefeeScalar and blobbasefeeScalar. # Step 1: Search for the initialize function in SystemConfig.sol. rg 'function initialize' packages/contracts-bedrock/src/L1/SystemConfig.sol -A 50Length of output: 2537
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?
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 testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin 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 and render them as a table.@coderabbitai show all the console.log statements in this repository.@coderabbitai read src/utils.ts and generate unit testing code.@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 pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger a review. This is useful when automatic reviews are disabled for the repository.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai helpto 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.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- 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/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
@sebastianst I have addressed all open comments on this PR
Seeing failures in the SystemConfig_Initialize_TestFail and SystemConfig_Initialize_Test suites, possible related to the conflict in differential-testing.go?
Seeing failures in the
SystemConfig_Initialize_TestFailandSystemConfig_Initialize_Testsuites, possible related to the conflict in differential-testing.go?
I have rebased
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 29.22%. Comparing base (
7ef1bcf) to head (fe50b75). Report is 4 commits behind head on develop.
Additional details and impacted files
@@ Coverage Diff @@
## develop #10226 +/- ##
============================================
- Coverage 42.36% 29.22% -13.15%
============================================
Files 73 31 -42
Lines 4836 2898 -1938
Branches 766 614 -152
============================================
- Hits 2049 847 -1202
+ Misses 2680 1976 -704
+ Partials 107 75 -32
| Flag | Coverage Δ | |
|---|---|---|
| cannon-go-tests | ? |
|
| chain-mon-tests | 27.14% <ø> (ø) |
|
| common-ts-tests | ? |
|
| contracts-ts-tests | 12.25% <ø> (ø) |
|
| core-utils-tests | ? |
|
| sdk-tests | 40.27% <ø> (ø) |
Flags with carried forward coverage won't be shown. Click here to find out more.
scalarandoverheadremoval lgtm! we can always add back if necessary.
Looks like op-e2e depends on pre-ecotone execution, meaning that we cannot fully get rid of these without a large refactor
Semgrep found 3 golang_fmt_errorf_no_params findings:
No fmt.Errorf invocations without fmt arguments allowed
The legacy setter will need to be called for tests that don't run with ecotone enabled
I have addressed merge conflicts with a rebase