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

refactor(contracts-rfq): relax pragmas #3381

Merged
merged 3 commits into from
Nov 11, 2024
Merged

Conversation

ChiTimesChi
Copy link
Collaborator

@ChiTimesChi ChiTimesChi commented Nov 11, 2024

Description
Allows easier external integration + reusing 0.8.17 DefaultRouter template for FastBridgeV2Router later on.

Summary by CodeRabbit

  • New Features

    • Enhanced functionality in the IFastBridgeV2 interface with new structures for improved transaction handling.
  • Bug Fixes

    • Updated Solidity version across multiple contracts and interfaces to improve compatibility and performance.
  • Documentation

    • Comments updated to reflect new parameters and their intended use in the IFastBridgeV2 interface.
  • Chores

    • Solidity version updated from ^0.8.20 to ^0.8.4 across all relevant files for better compiler compatibility.

Copy link
Contributor

coderabbitai bot commented Nov 11, 2024

Walkthrough

The primary change in this pull request involves updating the Solidity version pragma across multiple files from ^0.8.20 to ^0.8.4. This update affects various interfaces and libraries, including IAdmin, IFastBridge, IFastBridgeV2, and others, while maintaining their existing structures, methods, and functionalities. Additionally, new structures and parameters were introduced in IFastBridgeV2, enhancing its capabilities without altering existing method signatures.

Changes

File Path Change Summary
packages/contracts-rfq/contracts/interfaces/IAdmin.sol Updated Solidity version from ^0.8.20 to ^0.8.4.
packages/contracts-rfq/contracts/interfaces/IFastBridge.sol Updated Solidity version from ^0.8.20 to ^0.8.4.
packages/contracts-rfq/contracts/interfaces/IFastBridgeV2.sol Updated Solidity version from ^0.8.20 to ^0.8.4; added BridgeParamsV2 and updated BridgeTransactionV2.
packages/contracts-rfq/contracts/interfaces/IFastBridgeV2Errors.sol Updated Solidity version from ^0.8.20 to ^0.8.4.
packages/contracts-rfq/contracts/interfaces/IMulticallTarget.sol Updated Solidity version from ^0.8.20 to ^0.8.4.
packages/contracts-rfq/contracts/interfaces/IZapRecipient.sol Updated Solidity version from ^0.8.20 to ^0.8.4.
packages/contracts-rfq/contracts/libs/BridgeTransactionV2.sol Updated Solidity version from ^0.8.20 to ^0.8.4.
packages/contracts-rfq/contracts/libs/Errors.sol Updated Solidity version from ^0.8.20 to ^0.8.4.
packages/contracts-rfq/contracts/utils/MulticallTarget.sol Updated Solidity version from ^0.8.20 to ^0.8.4.
packages/contracts-rfq/test/MulticallTarget.t.sol Updated Solidity version from ^0.8.0 to ^0.8.4.
packages/contracts-rfq/test/harnesses/MulticallTargetHarness.sol Updated Solidity version from ^0.8.0 to ^0.8.4.
packages/contracts-rfq/test/mocks/ExcessiveReturnValueRecipient.sol Updated Solidity version from ^0.8.0 to ^0.8.4.
packages/contracts-rfq/test/mocks/IncorrectReturnValueRecipient.sol Updated Solidity version from ^0.8.0 to ^0.8.4.
packages/contracts-rfq/test/mocks/NoOpContract.sol Updated Solidity version from ^0.8.0 to ^0.8.4.
packages/contracts-rfq/test/mocks/NoReturnValueRecipient.sol Updated Solidity version from ^0.8.0 to ^0.8.4.
packages/contracts-rfq/test/mocks/NonPayableRecipient.sol Updated Solidity version from ^0.8.0 to ^0.8.4.
packages/contracts-rfq/test/mocks/RecipientMock.sol Updated Solidity version from ^0.8.0 to ^0.8.4.

Possibly related PRs

Suggested labels

size/xs, needs-go-generate-services/rfq

Suggested reviewers

  • aureliusbtc
  • parodime
  • trajan0x

🐇 In the meadow, we hop and play,
With Solidity updates brightening our day.
From 0.8.20 to 0.8.4,
Our contracts now shine, oh what a score!
New structs and params, we cheer with delight,
In the world of code, everything feels right! 🐇


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 36efe55 and 43cae69.

📒 Files selected for processing (17)
  • packages/contracts-rfq/contracts/interfaces/IAdmin.sol (1 hunks)
  • packages/contracts-rfq/contracts/interfaces/IFastBridge.sol (1 hunks)
  • packages/contracts-rfq/contracts/interfaces/IFastBridgeV2.sol (1 hunks)
  • packages/contracts-rfq/contracts/interfaces/IFastBridgeV2Errors.sol (1 hunks)
  • packages/contracts-rfq/contracts/interfaces/IMulticallTarget.sol (1 hunks)
  • packages/contracts-rfq/contracts/interfaces/IZapRecipient.sol (1 hunks)
  • packages/contracts-rfq/contracts/libs/BridgeTransactionV2.sol (1 hunks)
  • packages/contracts-rfq/contracts/libs/Errors.sol (1 hunks)
  • packages/contracts-rfq/contracts/utils/MulticallTarget.sol (1 hunks)
  • packages/contracts-rfq/test/MulticallTarget.t.sol (1 hunks)
  • packages/contracts-rfq/test/harnesses/MulticallTargetHarness.sol (1 hunks)
  • packages/contracts-rfq/test/mocks/ExcessiveReturnValueRecipient.sol (1 hunks)
  • packages/contracts-rfq/test/mocks/IncorrectReturnValueRecipient.sol (1 hunks)
  • packages/contracts-rfq/test/mocks/NoOpContract.sol (1 hunks)
  • packages/contracts-rfq/test/mocks/NoReturnValueRecipient.sol (1 hunks)
  • packages/contracts-rfq/test/mocks/NonPayableRecipient.sol (1 hunks)
  • packages/contracts-rfq/test/mocks/RecipientMock.sol (1 hunks)
✅ Files skipped from review due to trivial changes (15)
  • packages/contracts-rfq/contracts/interfaces/IFastBridge.sol
  • packages/contracts-rfq/contracts/interfaces/IFastBridgeV2Errors.sol
  • packages/contracts-rfq/contracts/interfaces/IMulticallTarget.sol
  • packages/contracts-rfq/contracts/interfaces/IZapRecipient.sol
  • packages/contracts-rfq/contracts/libs/BridgeTransactionV2.sol
  • packages/contracts-rfq/contracts/libs/Errors.sol
  • packages/contracts-rfq/contracts/utils/MulticallTarget.sol
  • packages/contracts-rfq/test/MulticallTarget.t.sol
  • packages/contracts-rfq/test/harnesses/MulticallTargetHarness.sol
  • packages/contracts-rfq/test/mocks/ExcessiveReturnValueRecipient.sol
  • packages/contracts-rfq/test/mocks/IncorrectReturnValueRecipient.sol
  • packages/contracts-rfq/test/mocks/NoOpContract.sol
  • packages/contracts-rfq/test/mocks/NoReturnValueRecipient.sol
  • packages/contracts-rfq/test/mocks/NonPayableRecipient.sol
  • packages/contracts-rfq/test/mocks/RecipientMock.sol
🧰 Additional context used
📓 Learnings (1)
packages/contracts-rfq/contracts/interfaces/IFastBridgeV2.sol (1)
Learnt from: ChiTimesChi
PR: synapsecns/sanguine#3284
File: packages/contracts-rfq/contracts/FastBridgeV2.sol:100-118
Timestamp: 2024-10-14T14:45:57.214Z
Learning: When reviewing code in `packages/contracts-rfq/contracts/FastBridgeV2.sol` (Solidity), focus on changes introduced in the PR and avoid commenting on existing functions like `refund` if they are not modified by the PR, as such comments are considered out of scope.
🪛 GitHub Check: Slither
packages/contracts-rfq/contracts/interfaces/IAdmin.sol

[warning] 2-2: Incorrect versions of Solidity
Version constraint ^0.8.4 contains known severe issues (https://solidity.readthedocs.io/en/latest/bugs.html)
- FullInlinerNonExpressionSplitArgumentEvaluationOrder
- MissingSideEffectsOnSelectorAccess
- AbiReencodingHeadOverflowWithStaticArrayCleanup
- DirtyBytesArrayToStorage
- DataLocationChangeInInternalOverride
- NestedCalldataArrayAbiReencodingSizeValidation
- SignedImmutables.
It is used by:
- ^0.8.4 (contracts/interfaces/IAdmin.sol#2)
- ^0.8.4 (contracts/interfaces/IFastBridge.sol#2)
- ^0.8.4 (contracts/interfaces/IFastBridgeV2.sol#2)
- ^0.8.4 (contracts/interfaces/IFastBridgeV2Errors.sol#2)
- ^0.8.4 (contracts/interfaces/IMulticallTarget.sol#2)
- ^0.8.4 (contracts/interfaces/IZapRecipient.sol#2)
- ^0.8.4 (contracts/libs/BridgeTransactionV2.sol#2)
- ^0.8.4 (contracts/libs/Errors.sol#2)
- ^0.8.4 (contracts/utils/MulticallTarget.sol#2)


[warning] 2-2: Incorrect versions of Solidity
Version constraint ^0.8.4 contains known severe issues (https://solidity.readthedocs.io/en/latest/bugs.html)
- FullInlinerNonExpressionSplitArgumentEvaluationOrder
- MissingSideEffectsOnSelectorAccess
- AbiReencodingHeadOverflowWithStaticArrayCleanup
- DirtyBytesArrayToStorage
- DataLocationChangeInInternalOverride
- NestedCalldataArrayAbiReencodingSizeValidation
- SignedImmutables.
It is used by:
- ^0.8.4 (contracts/interfaces/IAdmin.sol#2)
- ^0.8.4 (contracts/interfaces/IFastBridge.sol#2)
- ^0.8.4 (contracts/interfaces/IMulticallTarget.sol#2)
- ^0.8.4 (contracts/libs/Errors.sol#2)
- ^0.8.4 (contracts/utils/MulticallTarget.sol#2)

🔇 Additional comments (1)
packages/contracts-rfq/contracts/interfaces/IFastBridgeV2.sol (1)

2-2: ⚠️ Potential issue

Potential issues with downgrading Solidity compiler version to ^0.8.4

Changing the pragma from ^0.8.20 to ^0.8.4 downgrades the compiler version, which may omit important security patches, optimizations, and features introduced in later versions. Ensure that the code remains secure and compatible with the older compiler version, and verify that none of the features used in the contracts require a compiler version higher than 0.8.4.

Run the following script to identify any code that may be incompatible with Solidity 0.8.4:

Please review any matches and adjust the code accordingly to ensure compatibility with Solidity 0.8.4.

✅ Verification successful

Solidity version downgrade to ^0.8.4 is safe for this interface file

The verification shows that:

  1. The file is an interface file (IFastBridgeV2.sol) that only contains function signatures and events
  2. Custom errors are supported since Solidity 0.8.4, and all errors are defined in a separate interface file (IFastBridgeV2Errors.sol) which also uses ^0.8.4
  3. No advanced Solidity features introduced after 0.8.4 (like user-defined value types or try-catch with multiple returns) are used
  4. Other interface files in the same directory also use ^0.8.4 pragma, showing consistency in the codebase
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find Solidity code using features introduced after version 0.8.4.

# Search for user-defined value types (introduced in 0.8.8)
ast-grep --pattern $'type $_ is $_;' --lang solidity

# Search for external function calls to private methods (changed in 0.8.6)
ast-grep --pattern $'function $_($_) private' --lang solidity

# Search for try/catch on external function calls returning multiple variables (added in 0.8.10)
ast-grep --pattern $'try $_($_) returns ($_,$_) {} catch {}' --lang solidity

Length of output: 545


Script:

#!/bin/bash
# Let's try a different approach using ripgrep to search for Solidity features

# Search for user-defined value types (introduced in 0.8.8)
echo "=== Searching for user-defined value types ==="
rg "type\s+\w+\s+is\s+\w+" -t sol

# Search for try-catch blocks with multiple returns (added in 0.8.10)
echo -e "\n=== Searching for try-catch with multiple returns ==="
rg "try\s+\w+\s*\([^)]*\)\s+returns\s*\([^)]*,.*\)" -t sol

# Search for custom errors (introduced in 0.8.4)
echo -e "\n=== Searching for custom errors ==="
rg "error\s+\w+\s*\([^)]*\)" -t sol

# Search for push with value (introduced in 0.8.7)
echo -e "\n=== Searching for array push with value ==="
rg "\.push\s*\([^)]+\)" -t sol

# Get all pragma versions in the codebase
echo -e "\n=== All pragma versions in the codebase ==="
rg "pragma solidity" -t sol

Length of output: 856


Script:

#!/bin/bash
# Let's try without file type filtering since 'sol' is not recognized

# Search for user-defined value types (introduced in 0.8.8)
echo "=== Searching for user-defined value types ==="
rg "type\s+\w+\s+is\s+\w+" "packages/contracts-rfq"

# Search for try-catch blocks with multiple returns (added in 0.8.10)
echo -e "\n=== Searching for try-catch with multiple returns ==="
rg "try\s+\w+\s*\([^)]*\)\s+returns\s*\([^)]*,.*\)" "packages/contracts-rfq"

# Search for custom errors (introduced in 0.8.4)
echo -e "\n=== Searching for custom errors ==="
rg "error\s+\w+\s*\([^)]*\)" "packages/contracts-rfq"

# Search for push with value (introduced in 0.8.7)
echo -e "\n=== Searching for array push with value ==="
rg "\.push\s*\([^)]+\)" "packages/contracts-rfq"

# Get all pragma versions in the codebase
echo -e "\n=== All pragma versions in the codebase ==="
rg "pragma solidity" "packages/contracts-rfq"

Length of output: 11555


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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.

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
pragma solidity ^0.8.4;

Check warning

Code scanning / Slither

Incorrect versions of Solidity Warning

Version constraint ^0.8.4 contains known severe issues (https://solidity.readthedocs.io/en/latest/bugs.html)
- FullInlinerNonExpressionSplitArgumentEvaluationOrder
- MissingSideEffectsOnSelectorAccess
- AbiReencodingHeadOverflowWithStaticArrayCleanup
- DirtyBytesArrayToStorage
- DataLocationChangeInInternalOverride
- NestedCalldataArrayAbiReencodingSizeValidation
- SignedImmutables.
It is used by:
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
pragma solidity ^0.8.4;

Check warning

Code scanning / Slither

Incorrect versions of Solidity Warning

Version constraint ^0.8.4 contains known severe issues (https://solidity.readthedocs.io/en/latest/bugs.html)
- FullInlinerNonExpressionSplitArgumentEvaluationOrder
- MissingSideEffectsOnSelectorAccess
- AbiReencodingHeadOverflowWithStaticArrayCleanup
- DirtyBytesArrayToStorage
- DataLocationChangeInInternalOverride
- NestedCalldataArrayAbiReencodingSizeValidation
- SignedImmutables.
It is used by:
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
- ^0.8.4
Copy link

codecov bot commented Nov 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 34.79226%. Comparing base (36efe55) to head (43cae69).
Report is 2 commits behind head on master.

Additional details and impacted files
@@                 Coverage Diff                 @@
##              master       #3381         +/-   ##
===================================================
+ Coverage   33.20876%   34.79226%   +1.58350%     
===================================================
  Files            544         530         -14     
  Lines          34786       33792        -994     
  Branches          82          82                 
===================================================
+ Hits           11552       11757        +205     
+ Misses         22216       21020       -1196     
+ Partials        1018        1015          -3     
Flag Coverage Δ
packages 90.44834% <ø> (ø)
promexporter ?
solidity 98.65320% <ø> (?)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 43cae69
Status: ✅  Deploy successful!
Preview URL: https://e946cb4b.sanguine-fe.pages.dev
Branch Preview URL: https://refactor-fbv2-relax-pragmas.sanguine-fe.pages.dev

View logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant