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

cannon: remove final dep on bindings #10408

Merged
merged 2 commits into from
May 7, 2024
Merged

cannon: remove final dep on bindings #10408

merged 2 commits into from
May 7, 2024

Conversation

tynes
Copy link
Contributor

@tynes tynes commented May 5, 2024

Description

Removes the last dependency that cannon has on op-bindings/bindings.
This is done my creating reusable code for reading foundry artifacts
from disk. This code should be reusable between any service that wants
to read the foundry artifacts from disk. This includes roundtrip
tests for JSON serialization of the foundry artifacts.

Removes the last dependency that cannon has on `op-bindings/bindings`.
This is done my creating reusable code for reading foundry artifacts
from disk. This code should be reusable between any service that wants
to read the foundry artifacts from disk. This includes roundtrip
tests for JSON serialization of the foundry artifacts.
@tynes tynes requested a review from a team as a code owner May 5, 2024 17:15
@tynes tynes requested a review from mslipper May 5, 2024 17:15
Copy link
Contributor

coderabbitai bot commented May 5, 2024

Walkthrough

Walkthrough

The updates involve transitioning from a "contracts" to "artifacts" paradigm, encompassing renaming functions and types, utilizing foundry.Artifact, and introducing enhancements in JSON serialization and data structures.

Changes

File Path Change Summary
.../mipsevm/evm.go Renamed functions/types to "artifacts", updated to use foundry.Artifact.
.../mipsevm/evm_test.go Aligned tests/structs with artifacts paradigm, added fields/parameters.
.../foundry/artifact_test.go Added tests for artifact serialization.
.../solc/types.go Added Members field to StorageLayoutType struct for enhanced data representation.

Recent Review Details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 1ef3fd4 and 3043c4f.
Files selected for processing (1)
  • op-chain-ops/foundry/artifact.go (1 hunks)
Additional comments not posted (3)
op-chain-ops/foundry/artifact.go (3)

25-39: The UnmarshalJSON method is implemented correctly.


42-50: Ensure that the MarshalJSON method does not lead to recursion issues.

The use of an intermediate struct artifactMarshaling in the MarshalJSON method is a good practice to avoid recursion issues that can occur with direct marshaling of structs that implement custom JSON marshaling.


78-87: Enhance the error message in ReadArtifact for better context.

As previously suggested, improving the error message to indicate whether the issue is with file reading or JSON parsing would provide clearer diagnostics:

- return nil, fmt.Errorf("artifact at %s not found: %w", path, err)
+ return nil, fmt.Errorf("failed to read or parse artifact at %s: %w", path, err)

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
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

op-chain-ops/foundry/artifact_test.go Show resolved Hide resolved
op-chain-ops/foundry/artifact.go Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

op-chain-ops/foundry/artifact.go Show resolved Hide resolved
Copy link

codecov bot commented May 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.59%. Comparing base (0f11f2a) to head (3043c4f).

Additional details and impacted files
@@             Coverage Diff              @@
##           develop   #10408       +/-   ##
============================================
+ Coverage    42.30%   81.59%   +39.28%     
============================================
  Files           73       10       -63     
  Lines         4848     1081     -3767     
  Branches       766        0      -766     
============================================
- Hits          2051      882     -1169     
+ Misses        2686      165     -2521     
+ Partials       111       34       -77     
Flag Coverage Δ
cannon-go-tests 81.59% <100.00%> (+0.38%) ⬆️
chain-mon-tests ?
common-ts-tests ?
contracts-ts-tests ?
core-utils-tests ?
sdk-tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
cannon/mipsevm/evm.go 85.91% <100.00%> (+5.66%) ⬆️

... and 63 files with indirect coverage changes

tynes added a commit that referenced this pull request May 5, 2024
Since slither seems to be failing consistently in CI, try bumping the
versions of the tooling.

Bumps to latest slither github action release: https://github.com/crytic/slither-action/releases/tag/v0.4.0

Meant to fix the slither issue seen in #10408

```
[-] SARIF output enabled, writing to results.sarif.
[-] Slither config provided: packages/contracts-bedrock/slither.config.json
[-] SLITHERARGS provided. Running slither with extra arguments
'forge clean' running (wd: /github/workspace/packages/contracts-bedrock)
'forge config --json' running
'forge build --build-info --skip */test/** */scripts/** --force' running (wd: /github/workspace/packages/contracts-bedrock)
Traceback (most recent call last):
  File "/opt/slither/bin/slither", line 8, in <module>
    sys.exit(main())
  File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 753, in main
    main_impl(all_detector_classes=detectors, all_printer_classes=printers)
  File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 859, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 107, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 80, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "/opt/slither/lib/python3.9/site-packages/slither/slither.py", line 156, in __init__
    sol_parser.parse_top_level_items(ast, path)
  File "/opt/slither/lib/python3.9/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 326, in parse_top_level_items
    get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
  File "/opt/slither/lib/python3.9/site-packages/slither/core/compilation_unit.py", line 282, in get_scope
    filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
  File "/opt/slither/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 283, in filename_lookup
    raise ValueError(f"{filename} does not exist")
ValueError: lib/openzeppelin-contracts/contracts/utils/Context.sol does not exist
```
@tynes tynes mentioned this pull request May 5, 2024
@tynes tynes enabled auto-merge May 6, 2024 18:41
github-merge-queue bot pushed a commit that referenced this pull request May 6, 2024
Since slither seems to be failing consistently in CI, try bumping the
versions of the tooling.

Bumps to latest slither github action release: https://github.com/crytic/slither-action/releases/tag/v0.4.0

Meant to fix the slither issue seen in #10408

```
[-] SARIF output enabled, writing to results.sarif.
[-] Slither config provided: packages/contracts-bedrock/slither.config.json
[-] SLITHERARGS provided. Running slither with extra arguments
'forge clean' running (wd: /github/workspace/packages/contracts-bedrock)
'forge config --json' running
'forge build --build-info --skip */test/** */scripts/** --force' running (wd: /github/workspace/packages/contracts-bedrock)
Traceback (most recent call last):
  File "/opt/slither/bin/slither", line 8, in <module>
    sys.exit(main())
  File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 753, in main
    main_impl(all_detector_classes=detectors, all_printer_classes=printers)
  File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 859, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 107, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 80, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "/opt/slither/lib/python3.9/site-packages/slither/slither.py", line 156, in __init__
    sol_parser.parse_top_level_items(ast, path)
  File "/opt/slither/lib/python3.9/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 326, in parse_top_level_items
    get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
  File "/opt/slither/lib/python3.9/site-packages/slither/core/compilation_unit.py", line 282, in get_scope
    filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
  File "/opt/slither/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 283, in filename_lookup
    raise ValueError(f"{filename} does not exist")
ValueError: lib/openzeppelin-contracts/contracts/utils/Context.sol does not exist
```
github-merge-queue bot pushed a commit that referenced this pull request May 6, 2024
Since slither seems to be failing consistently in CI, try bumping the
versions of the tooling.

Bumps to latest slither github action release: https://github.com/crytic/slither-action/releases/tag/v0.4.0

Meant to fix the slither issue seen in #10408

```
[-] SARIF output enabled, writing to results.sarif.
[-] Slither config provided: packages/contracts-bedrock/slither.config.json
[-] SLITHERARGS provided. Running slither with extra arguments
'forge clean' running (wd: /github/workspace/packages/contracts-bedrock)
'forge config --json' running
'forge build --build-info --skip */test/** */scripts/** --force' running (wd: /github/workspace/packages/contracts-bedrock)
Traceback (most recent call last):
  File "/opt/slither/bin/slither", line 8, in <module>
    sys.exit(main())
  File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 753, in main
    main_impl(all_detector_classes=detectors, all_printer_classes=printers)
  File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 859, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 107, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "/opt/slither/lib/python3.9/site-packages/slither/__main__.py", line 80, in process_single
    slither = Slither(target, ast_format=ast, **vars(args))
  File "/opt/slither/lib/python3.9/site-packages/slither/slither.py", line 156, in __init__
    sol_parser.parse_top_level_items(ast, path)
  File "/opt/slither/lib/python3.9/site-packages/slither/solc_parsing/slither_compilation_unit_solc.py", line 326, in parse_top_level_items
    get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
  File "/opt/slither/lib/python3.9/site-packages/slither/core/compilation_unit.py", line 282, in get_scope
    filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
  File "/opt/slither/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 283, in filename_lookup
    raise ValueError(f"{filename} does not exist")
ValueError: lib/openzeppelin-contracts/contracts/utils/Context.sol does not exist
```
@tynes tynes added this pull request to the merge queue May 7, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 7, 2024
@tynes tynes added this pull request to the merge queue May 7, 2024
Merged via the queue into develop with commit c0ab34f May 7, 2024
71 of 72 checks passed
@tynes tynes deleted the cannon-bindings-dep branch May 7, 2024 19:44
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.

2 participants