custom-gas-token: add e2e tests for activating custom gas token on exising chain and bridging tokens to l2
Needs some work to tidy up, but raising this early to get some early feedback.
Towards https://github.com/ethereum-optimism/client-pod/issues/766
Semgrep found 2 sol-style-return-arg-fmt findings:
Named return arguments to functions must be appended with an underscore (_)
Semgrep found 1 sol-style-input-arg-fmt finding:
Inputs to functions must be prepended with an underscore (_)
Semgrep found 6 golang_fmt_errorf_no_params findings:
- op-plasma/cmd/daserver/flags.go
- op-chain-ops/state/encoding.go
- op-bindings/bindgen/remote_handlers.go
No fmt.Errorf invocations without fmt arguments allowed
Semgrep found 2 import-text-template findings:
- op-bindings/bindgen/remote_handlers.go
- op-bindings/bindgen/generator_local.go
When working with web applications that involve rendering user-generated content, it's important to properly escape any HTML content to prevent Cross-Site Scripting (XSS) attacks. In Go, the text/template package does not automatically escape HTML content, which can leave your application vulnerable to these types of attacks. To mitigate this risk, it's recommended to use the html/template package instead, which provides built-in functionality for HTML escaping. By using html/template to render your HTML content, you can help to ensure that your web application is more secure and less susceptible to XSS vulnerabilities.
Question: I think I may need to edit the circle config to trigger the new test to run in CI?
Question: I think I may need to edit the circle config to trigger the new test to run in CI?
Edit: no, this is not necessary. Test is running and passing on CI.
We do have a test failure on the op-e2e-HTTP-tests-fault-proof job. From what I can tell, the custom gas token feature is not currently compatible with FPAC. Only the OptimismPortal has been updated to enable custom gas tokens, whereas on an FPAC chain we use OptimismPortal2.
This all looks sane to me
Walkthrough
Walkthrough
The recent updates involve renaming constants and addresses related to WETH, introducing a custom gas token feature, updating gas benchmarks, and enhancing the testing environment for simulating new functionalities.
Changes
| File Path | Change Summary |
|---|---|
op-bindings/predeploys/addresses.go |
Renamed WETH9 to WETH, updated related addresses and references. |
op-chain-ops/genesis/config.go |
Added UseCustomGasToken flag, CustomGasTokenAddress field, and validation for these configurations. |
op-chain-ops/upgrades/l1.go |
Removed L2OutputOracle address, added GasPayingToken address. |
op-e2e/bridge_test.go |
Adjusted deployment and usage of WETH token from WETH9 to WETH. |
op-e2e/custom_gas_token_bridge_test.go |
Introduced tests for custom gas token functionality, including depositing and bridging ERC20 tokens using a custom gas token. |
packages/contracts-bedrock/.gas-snapshot |
Updated gas benchmarks for various functions. |
op-e2e/custom_gas_token_test.go |
Added test functions related to custom gas token functionality. |
bedrock-devnet/devnet/__init__.py |
Added --sender flag within a specific command function. |
Recent Review Details
Configuration used: .coderabbit.yml Review profile: CHILL
Commits
Files that changed from the base of the PR and between 6ef0e274d4e774d8997e8d6c0a4d99fdb93e7612 and 82cd23aef55b6c536c7eb6fd887973a1a0a62806.Files selected for processing (1)
- op-e2e/custom_gas_token_test.go (1 hunks)
Additional comments not posted (4)
op-e2e/custom_gas_token_test.go (4)
25-304: Ensure proper cleanup and error handling in tests.
25-304: Refactor to improve readability and error handling.
25-304: Optimize contract interaction patterns and improve error handling.
332-444: LGTM! The functionsetCustomGasTokenis well-structured and handles errors appropriately.
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.
Semgrep found 3 sol-style-return-arg-fmt findings:
- packages/contracts-bedrock/scripts/L2Genesis.s.sol
- packages/contracts-bedrock/scripts/Deployer.sol
- packages/contracts-bedrock/scripts/Config.sol
Named return arguments to functions must be appended with an underscore (_)
The op-upgrade tool is breaking due to ABI changes. It shouldn't be your responsibility to handle breaking things from other codebases. The fix for this is simple, we can just delete some code
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is" ./...
op-chain-ops/upgrades/check.go:1: : # github.com/ethereum-optimism/optimism/op-chain-ops/upgrades
op-chain-ops/upgrades/l1.go:760:4: unknown field L2OutputOracle in struct literal of type "github.com/ethereum-optimism/optimism/op-bindings/bindings".SystemConfigAddresses (typecheck)
package upgrades
op-chain-ops/cmd/op-upgrade/main.go:20:2: could not import github.com/ethereum-optimism/optimism/op-chain-ops/upgrades (-: # github.com/ethereum-optimism/optimism/op-chain-ops/upgrades
op-chain-ops/upgrades/l1.go:760:4: unknown field L2OutputOracle in struct literal of type "github.com/ethereum-optimism/optimism/op-bindings/bindings".SystemConfigAddresses) (typecheck)
"github.com/ethereum-optimism/optimism/op-chain-ops/upgrades"
^
op-chain-ops/cmd/op-version-check/main.go:15:2: could not import github.com/ethereum-optimism/optimism/op-chain-ops/upgrades (-: # github.com/ethereum-optimism/optimism/op-chain-ops/upgrades
op-chain-ops/upgrades/l1.go:760:4: unknown field L2OutputOracle in struct literal of type "github.com/ethereum-optimism/optimism/op-bindings/bindings".SystemConfigAddresses) (typecheck)
"github.com/ethereum-optimism/optimism/op-chain-ops/upgrades"
@geoknee I pushed a commit that fixes the build issue in op-chain-ops
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 29.22%. Comparing base (
eba8187) to head (2bc5605). Report is 3 commits behind head on develop.
:exclamation: Current head 2bc5605 differs from pull request most recent head 82cd23a. Consider uploading reports for the commit 82cd23a to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## develop #10310 +/- ##
============================================
- Coverage 42.30% 29.22% -13.08%
============================================
Files 73 31 -42
Lines 4848 2898 -1950
Branches 766 614 -152
============================================
- Hits 2051 847 -1204
+ Misses 2686 1976 -710
+ Partials 111 75 -36
| 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.
In favour of #10440 .