synapsecns / sanguine

Synapse Monorepo
MIT License
41 stars 30 forks source link

refactor(contracts-rfq): relax pragmas #3381

Closed ChiTimesChi closed 1 week ago

ChiTimesChi commented 1 week ago

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

Summary by CodeRabbit

coderabbitai[bot] commented 1 week ago

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

πŸ‡ 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 36efe55bcd32017637a7817831c0e8893fd9bfe8 and 43cae69ea71173eb5ca4904e02bc0e931af3b2e0.
πŸ“’ 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`: _:warning: 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: ```shell #!/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: ```shell #!/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: ```shell #!/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 - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
πŸͺ§ Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit , 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](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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

Additional details and impacted files ```diff @@ 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](https://app.codecov.io/gh/synapsecns/sanguine/pull/3381/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=synapsecns) | Coverage Ξ” | | |---|---|---| | [packages](https://app.codecov.io/gh/synapsecns/sanguine/pull/3381/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=synapsecns) | `90.44834% <ΓΈ> (ΓΈ)` | | | [promexporter](https://app.codecov.io/gh/synapsecns/sanguine/pull/3381/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=synapsecns) | `?` | | | [solidity](https://app.codecov.io/gh/synapsecns/sanguine/pull/3381/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=synapsecns) | `98.65320% <ΓΈ> (?)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=synapsecns#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

cloudflare-workers-and-pages[bot] commented 1 week ago

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