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

feat(ctb): Remove setResourceConfig #10501

Merged
merged 2 commits into from May 14, 2024
Merged

Conversation

clabby
Copy link
Member

@clabby clabby commented May 10, 2024

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 clabby requested a review from a team as a code owner May 10, 2024 23:06
@clabby clabby requested review from mds1 and removed request for a team May 10, 2024 23:06
Copy link
Member Author

clabby commented May 10, 2024

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 clabby force-pushed the cl/ctb/sys-cfg-max-gas-limit branch from 8c0574a to 0c717b1 Compare May 10, 2024 23:48
@clabby clabby force-pushed the cl/ctb/sys-cfg-resource-constraint branch from dbe8d82 to 8a640b5 Compare May 10, 2024 23:48
@clabby clabby force-pushed the cl/ctb/sys-cfg-max-gas-limit branch from 0c717b1 to 46217cf Compare May 10, 2024 23:58
@clabby clabby force-pushed the cl/ctb/sys-cfg-resource-constraint branch from 8a640b5 to e0c9bc4 Compare May 10, 2024 23:58
@clabby clabby force-pushed the cl/ctb/sys-cfg-max-gas-limit branch from 46217cf to d90f128 Compare May 11, 2024 00:02
@clabby clabby force-pushed the cl/ctb/sys-cfg-resource-constraint branch 2 times, most recently from dc2ed7d to 4d00fb5 Compare May 11, 2024 00:33
Copy link
Contributor

@maurelian maurelian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will approve once my and @mds1 comments are addressed.

Copy link
Contributor

@maurelian maurelian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once formatted.

@clabby clabby force-pushed the cl/ctb/sys-cfg-max-gas-limit branch from a451ca1 to 348b165 Compare May 13, 2024 14:19
@clabby clabby force-pushed the cl/ctb/sys-cfg-resource-constraint branch from 4d00fb5 to 5192b59 Compare May 13, 2024 14:19
Base automatically changed from cl/ctb/sys-cfg-max-gas-limit to develop May 13, 2024 16:21
Removes the `setResourceConfig` setter from the `SystemConfig`, only
allowing it to be set by the `ProxyAdmin` owner.
@clabby clabby force-pushed the cl/ctb/sys-cfg-resource-constraint branch from 5192b59 to 0c85970 Compare May 13, 2024 16:34
Copy link
Contributor

coderabbitai bot commented May 13, 2024

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 625054c and 0c85970.
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.

Copy link

codecov bot commented May 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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

@clabby clabby enabled auto-merge May 13, 2024 16:44
@clabby clabby added this pull request to the merge queue May 13, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 13, 2024
@tynes tynes added this pull request to the merge queue May 13, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 13, 2024
@tynes tynes added this pull request to the merge queue May 14, 2024
Merged via the queue into develop with commit cafad53 May 14, 2024
72 checks passed
@tynes tynes deleted the cl/ctb/sys-cfg-resource-constraint branch May 14, 2024 08:30
Inphi pushed a commit that referenced this pull request May 14, 2024
* feat(ctb): Remove `setResourceConfig`

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

* fmt
clabby added a commit that referenced this pull request May 14, 2024
* feat(ctb): Remove `setResourceConfig`

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

* fmt
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.

None yet

4 participants