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

test(ctb): small cleanup and stronger assertions #9404

Merged
merged 7 commits into from
Feb 7, 2024
Merged

Conversation

mds1
Copy link
Contributor

@mds1 mds1 commented Feb 6, 2024

Test changes:

  • Replaces vm.expectRevert() usage (which allows any revert data) with more targeted revert data. We use vm.expectRevert(bytes("")) to specify when we expect no revert data
  • Assert on the previously unused success status of low-level calls
  • Remove unused imports

Source changes:

  • I also removed unused errors in DelayedVetoable. Since this contract is not live yet, this change seemed ok

mds1 added 5 commits February 6, 2024 14:11

Verified

This commit was signed with the committer’s verified signature.
mds1 Matt Solomon

Verified

This commit was signed with the committer’s verified signature.
mds1 Matt Solomon

Verified

This commit was signed with the committer’s verified signature.
mds1 Matt Solomon

Verified

This commit was signed with the committer’s verified signature.
mds1 Matt Solomon

Verified

This commit was signed with the committer’s verified signature.
mds1 Matt Solomon
@mds1 mds1 requested a review from a team as a code owner February 6, 2024 22:39
@mds1 mds1 requested a review from maurelian February 6, 2024 22:39
Copy link
Contributor

coderabbitai bot commented Feb 6, 2024

Walkthrough

Walkthrough

The updates across various contract and test files in the packages/contracts-bedrock directory primarily involve refining error handling, adjusting test expectations, and streamlining imports. Notable changes include the removal of specific error declarations in DelayedVetoable.sol, updates to vm.expectRevert() calls across multiple test files to include an empty bytes argument, and the elimination of unnecessary imports. These modifications enhance clarity, correctness, and testing rigor within the codebase.

Changes

File Path Change Summary
.../L1/DelayedVetoable.sol Removed specific error declarations, focusing on early forwarding and unauthorized calls.
.../test/L1/DelayedVetoable.t.sol Updated vm.expectRevert with abi.encodeWithSelector, ensured assertTrue(success), and adjusted comments. Removed resetting delay in a test function.
.../test/L1/L1ERC721Bridge.t.sol
.../test/L2/L2ERC721Bridge.t.sol
Updated vm.expectRevert() calls by passing bytes("").
.../test/L1/L1StandardBridge.t.sol Removed the import of the Constants library.
.../test/dispute/FaultDisputeGame.t.sol Removed several imports, updated from IBigStepper to IPreimageOracle, fixed typos, and replaced success; with assertTrue(success).
.../test/invariants/CrossDomainMessenger.t.sol Removed the import of Types.
.../test/invariants/FaultDisputeGame.t.sol Added assertTrue(success) to ensure function call success.
.../test/invariants/OptimismPortal.t.sol Removed imports for AddressAliasHelper and SystemConfig.
.../test/invariants/ResourceMetering.t.sol Removed the import of Proxy.
.../test/invariants/SystemConfig.t.sol Removed the import statement for ResourceMetering.
.../test/universal/OptimismMintableERC20Factory.t.sol
.../test/universal/OptimismMintableERC721Factory.t.sol
.../test/universal/Proxy.t.sol
.../test/universal/StandardBridge.t.sol
Replaced vm.expectRevert(); with vm.expectRevert(bytes("")) in various test functions to handle specific scenarios where certain methods should revert.

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-tests for this file.
  • 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 tests 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 from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Verified

This commit was signed with the committer’s verified signature.
mds1 Matt Solomon
@mds1 mds1 force-pushed the test/small-cleanup branch from fb80988 to 4c15d03 Compare February 6, 2024 22:41

Verified

This commit was signed with the committer’s verified signature.
mds1 Matt Solomon
Copy link

codecov bot commented Feb 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fdcd8ff) 16.57% compared to head (8e12222) 29.57%.
Report is 16 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff              @@
##           develop    #9404       +/-   ##
============================================
+ Coverage    16.57%   29.57%   +13.00%     
============================================
  Files          119       31       -88     
  Lines         5098     2806     -2292     
  Branches      1130      594      -536     
============================================
- Hits           845      830       -15     
+ Misses        4178     1901     -2277     
  Partials        75       75               
Flag Coverage Δ
chain-mon-tests 27.14% <ø> (ø)
contracts-bedrock-tests ?
contracts-ts-tests 12.25% <ø> (ø)
sdk-next-tests 41.53% <ø> (ø)
sdk-tests 41.53% <ø> (ø)

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

see 88 files with indirect coverage changes

Copy link
Member

@clabby clabby left a comment

Choose a reason for hiding this comment

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

Nice

@mds1 mds1 added this pull request to the merge queue Feb 7, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 7, 2024
@mds1 mds1 added this pull request to the merge queue Feb 7, 2024
Merged via the queue into develop with commit 92bfc0b Feb 7, 2024
66 checks passed
@mds1 mds1 deleted the test/small-cleanup branch February 7, 2024 20: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.

None yet

4 participants