optimism icon indicating copy to clipboard operation
optimism copied to clipboard

feat(ctb): Remove `setResourceConfig`

Open clabby opened this issue 1 year ago • 1 comments

Overview

[!NOTE] This PR deliberately does not bump the semantic version. This is done in #10500, these changes are just split up for ease of review.

Removes the setResourceConfig setter from the SystemConfig, only allowing it to be set by the ProxyAdmin owner.

clabby avatar May 10 '24 23:05 clabby

  • #10501 Graphite 👈
  • #10500 Graphite
  • develop

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

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

clabby avatar May 10 '24 23:05 clabby

Walkthrough

Walkthrough

This update primarily adjusts gas costs for various benchmark functions, modifies the accessibility and functionality of the setResourceConfig function in the SystemConfig contract, and updates testing protocols related to resource configuration. Additionally, it includes an update to the systemConfigAddress constant in the DeploymentSummary contract.

Changes

Files Change Summary
.../.gas-snapshot Adjusted gas costs for benchmark functions across various modules.
.../src/L1/SystemConfig.sol Changed setResourceConfig from an external to an internal function, enhancing configuration validation.
.../test/L1/SystemConfig.t.sol Added tests for various error scenarios in resource configuration.
.../test/Specs.t.sol Removed specification related to setResourceConfig function.
.../test/kontrol/proofs/utils/DeploymentSummary.sol Updated the systemConfigAddress constant.

Recent Review Details

Configuration used: .coderabbit.yml Review profile: CHILL

Commits Files that changed from the base of the PR and between 625054c384c3eae1559413ad1bca211157ba17f5 and 0c8597095c5d417ea407cb1fb66ce7c6ebba1fe3.
Files ignored due to path filters (2)
  • packages/contracts-bedrock/semver-lock.json is excluded by !**/*.json
  • packages/contracts-bedrock/snapshots/abi/SystemConfig.json is excluded by !**/*.json
Files selected for processing (6)
  • packages/contracts-bedrock/.gas-snapshot (1 hunks)
  • packages/contracts-bedrock/src/L1/SystemConfig.sol (1 hunks)
  • packages/contracts-bedrock/test/L1/SystemConfig.t.sol (3 hunks)
  • packages/contracts-bedrock/test/Specs.t.sol (1 hunks)
  • packages/contracts-bedrock/test/kontrol/proofs/utils/DeploymentSummary.sol (2 hunks)
  • packages/contracts-bedrock/test/kontrol/proofs/utils/DeploymentSummaryCode.sol (1 hunks)
Files not summarized due to errors (1)
  • packages/contracts-bedrock/test/kontrol/proofs/utils/DeploymentSummaryCode.sol: Error: Message exceeds token limit
Files skipped from review due to trivial changes (2)
  • packages/contracts-bedrock/.gas-snapshot
  • packages/contracts-bedrock/test/kontrol/proofs/utils/DeploymentSummary.sol
Additional comments not posted (7)
packages/contracts-bedrock/src/L1/SystemConfig.sol (1)

407-408: Preserve the informative comment about future enhancements.

Consider moving the comment about potential future event emissions to the new _setResourceConfig method to maintain the context and usefulness of this information.

packages/contracts-bedrock/test/L1/SystemConfig.t.sol (4)

212-225: Ensure the new test checks for correct revert conditions.

The test test_setResourceConfig_badMinMax_reverts correctly checks that the function reverts when the minimum base fee is greater than the maximum base fee. This is a crucial check for maintaining the integrity of the resource configuration.


227-239: Ensure the new test checks for correct revert conditions.

The test test_setResourceConfig_zeroDenominator_reverts correctly checks that the function reverts when the baseFeeMaxChangeDenominator is zero, which is an invalid configuration.


241-254: Ensure the new test checks for correct revert conditions.

The test test_setResourceConfig_lowGasLimit_reverts correctly checks that the function reverts when the gas limit is too low to accommodate the specified resource limits and system transaction gas, ensuring system stability.


256-268: Ensure the new test checks for correct revert conditions.

The test test_setResourceConfig_badPrecision_reverts correctly checks for potential precision loss in resource limit calculations, which is important for accurate resource metering.

packages/contracts-bedrock/test/Specs.t.sol (1)

Line range hint 1-1000: The removal of the specification for setResourceConfig in Specs.t.sol is consistent with the changes made in the SystemConfig contract, where the function's accessibility was changed from external to internal. This ensures that the spec accurately reflects the current state of the contract functions and adheres to the principle of least privilege by restricting unnecessary external access.

packages/contracts-bedrock/test/kontrol/proofs/utils/DeploymentSummaryCode.sol (1)

44-44: Update to systemConfigCode byte array aligns with PR changes.

This change reflects the updated address for systemConfigAddress as mentioned in the AI-generated summary, ensuring consistency with the new deployment or configuration of the SystemConfig contract.


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 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 @coderabbitai in 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 @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 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 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.
  • 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.

coderabbitai[bot] avatar May 13 '24 16:05 coderabbitai[bot]

Codecov Report

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

Project coverage is 29.22%. Comparing base (2c63288) to head (0c85970). Report is 7 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff              @@
##           develop   #10501       +/-   ##
============================================
- Coverage    42.35%   29.22%   -13.13%     
============================================
  Files           73       31       -42     
  Lines         4838     2898     -1940     
  Branches       766      614      -152     
============================================
- Hits          2049      847     -1202     
+ Misses        2681     1976      -705     
+ Partials       108       75       -33     
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.

see 42 files with indirect coverage changes

codecov[bot] avatar May 13 '24 16:05 codecov[bot]