optimism
optimism copied to clipboard
contracts-bedrock: small fix to cleanup L2 genesis
Description
Adds a run() function to the L2 genesis generation script
so that its possible to run the command without the --sig
argument. Also resolve some linting isssues, semgrep has
a rule that prefers @notice over @dev for natspec comments.
Also use a foundry cheatcode to set the chainid during execution
to ensure that the correct chainid is set to remove the need to
set it as a cli flag.
Walkthrough
Walkthrough
The changes aim to enhance the L2Genesis.s.sol script by improving comment clarity, introducing the run alias function, and adding the runWithOptions function for building the L2 genesis with customizable options. In bedrock-devnet/devnet/__init__.py, the --chain-id argument was removed from the forge script command, simplifying the devnet_l2_allocs function. Additionally, a new public function setFundDevAccounts was added to the DeployConfig contract in DeployConfig.s.sol for overriding configuration.
Changes
| File | Change Summary |
|---|---|
L2Genesis.s.sol |
Improved comments, added run alias function, runWithOptions for L2 genesis build. |
DeployConfig.s.sol |
Added setFundDevAccounts function in DeployConfig contract for configuration override. |
devnet/__init__.py |
Removed --chain-id argument from forge script in devnet_l2_allocs. |
Preinstalls.t.sol |
Updated chainId to 901 and domainSeparator accordingly. |
L2Genesis.t.sol |
Added genesis.cfg().setFundDevAccounts(false); before running genesis setup in _test_allocs_size function. |
Recent Review Details
Configuration used: .coderabbit.yml Review profile: CHILL
Commits
Files that changed from the base of the PR and between 43a70df7167b9e3769f253ba4517a9c3b4f53744 and 980f73bf483973649d81f316bc18e037f05618a4.Files ignored due to path filters (1)
packages/contracts-bedrock/deploy-config/hardhat.jsonis excluded by!**/*.json
Files selected for processing (5)
- bedrock-devnet/devnet/init.py (1 hunks)
- packages/contracts-bedrock/scripts/DeployConfig.s.sol (1 hunks)
- packages/contracts-bedrock/scripts/L2Genesis.s.sol (3 hunks)
- packages/contracts-bedrock/test/L2Genesis.t.sol (1 hunks)
- packages/contracts-bedrock/test/Preinstalls.t.sol (1 hunks)
Files skipped from review as they are similar to previous changes (4)
- packages/contracts-bedrock/scripts/DeployConfig.s.sol
- packages/contracts-bedrock/scripts/L2Genesis.s.sol
- packages/contracts-bedrock/test/L2Genesis.t.sol
- packages/contracts-bedrock/test/Preinstalls.t.sol
Additional Context Used
Ruff (6)
bedrock-devnet/devnet/__init__.py (6)
7-7:
calendarimported but unused; consider removing, adding to__all__, or using a redundant alias
12-12:
gzipimported but unused; consider removing, adding to__all__, or using a redundant alias
18-18:
devnet.log_setupimported but unused; consider removing, adding to__all__, or using a redundant alias
220-220: Avoid equality comparisons to
False; useif not os.path.exists(l2_allocs_path):for false checks
220-220: Avoid equality comparisons to
True; useif DEVNET_FPAC:for truth checks
309-309: Local variable
eis assigned to but never used
Additional comments not posted (1)
bedrock-devnet/devnet/__init__.py (1)
163-163: Ensure that the removal of the--chain-idargument aligns with the intended behavior of the script.
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.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 29.22%. Comparing base (
43a70df) to head (980f73b).
Additional details and impacted files
@@ Coverage Diff @@
## develop #10326 +/- ##
============================================
- Coverage 42.33% 29.22% -13.11%
============================================
Files 73 31 -42
Lines 4845 2898 -1947
Branches 766 614 -152
============================================
- Hits 2051 847 -1204
+ Misses 2684 1976 -708
+ Partials 110 75 -35
| 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.
Maybe we should also override the msg.sender to always be the same account, as part of the L2 genesis script? To not hardcode the private key argument in the script invocation? Similar improvement as with the chain ID
Maybe we should also override the
msg.senderto always be the same account, as part of the L2 genesis script? To not hardcode the private key argument in the script invocation? Similar improvement as with the chain ID
I don't love this idea as there are many contracts that may set msg.sender as an owner
@protolambda I'd like to address in a follow up PR if possible, things aren't getting worse from where they already are