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

feat: introduces a killswitch for the diamond (EmergencyPauseFacet v1.0.0) #715

Merged
merged 44 commits into from
Oct 8, 2024

Conversation

0xDEnYO
Copy link
Contributor

@0xDEnYO 0xDEnYO commented Jul 23, 2024

Which Jira task belongs to this PR?

Why did I implement it this way?

Checklist before requesting a review

  • I have performed a self-review of my code
  • This pull request is as small as possible and only tackles one problem
  • I have added tests that cover the functionality / test the bug
  • I have updated any required documentation
  • If this requires a contract version change, I have updated the version number in the source file

Checklist for reviewer (DO NOT DEPLOY and contracts BEFORE CHECKING THIS!!!)

  • I have checked that any arbitrary calls to external contracts are validated and or restricted
  • I have checked that any privileged calls (i.e. storage modifications) are validated and or restricted
  • I have ensured that any new contracts have had AT A MINIMUM 1 preliminary audit conducted on by <company/auditor>

ezynda3
ezynda3 previously approved these changes Jul 24, 2024
@0xDEnYO 0xDEnYO marked this pull request as draft August 7, 2024 02:45
ezynda3
ezynda3 previously approved these changes Aug 14, 2024
Copy link
Contributor

@ezynda3 ezynda3 left a comment

Choose a reason for hiding this comment

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

Looks good. Has this been audited?

@0xDEnYO
Copy link
Contributor Author

0xDEnYO commented Aug 14, 2024

Looks good. Has this been audited?

no, sujith will check it this or next week

@0xDEnYO 0xDEnYO marked this pull request as ready for review August 21, 2024 05:49
Copy link
Contributor

coderabbitai bot commented Aug 21, 2024

Warning

Rate limit exceeded

@0xDEnYO has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 17 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Files that changed from the base of the PR and between 9e67824 and 3d7dcd2.

Walkthrough

The recent changes introduce an EmergencyPauseFacet contract that allows authorized users to manage contract functionalities by pausing operations during emergencies. Key updates include the implementation of emergency facet management, access control for critical functions, and comprehensive testing to validate the functionality of the emergency pause and unpause mechanisms. Additionally, a GitHub Actions workflow for manual emergency pausing and various deployment updates related to the new facet have been included, enhancing the resilience of the diamond architecture in handling critical situations.

Changes

Files Change Summary
src/Facets/EmergencyPauseFacet.sol Introduced the EmergencyPauseFacet contract, which includes functions for removing facets, pausing and unpausing the diamond, and error handling.
test/solidity/Facets/EmergencyPauseFacet.local.t.sol Added a test suite for EmergencyPauseFacet, validating the pause and unpause functionalities and ensuring access control for authorized users.
.github/workflows/diamondEmergencyPause.yml Created a GitHub Actions workflow for manual emergency pausing of the diamond contract, requiring user confirmation and team membership checks.
audit/auditLog.json Added audit entries for the EmergencyPauseFacet contract and a new audit log entry.
deployments/arbitrum.diamond.staging.json Updated the deployment file to include the EmergencyPauseFacet and other new facets in the LiFiDiamond structure.
deployments/arbitrum.staging.json Added the EmergencyPauseFacet entry with its address.
deployments/optimism.diamond.staging.json Updated to include the EmergencyPauseFacet and new facets in the LiFiDiamond section.
deployments/optimism.staging.json Added the EmergencyPauseFacet entry with its address.
script/helperFunctions.sh Enhanced logging and error handling, added new functions for Discord messaging and user info retrieval.
script/tasks/diamondEMERGENCYPause.sh Introduced a script for managing emergency actions on diamond contracts, allowing pausing, unpausing, or facet removal.
script/utils/diamondEMERGENCYPauseGitHub.sh Created a script for executing the pause action via GitHub actions, including retry mechanisms and network handling.

Possibly related PRs

  • Deploy to Kaia #789: The changes in this PR involve deploying to a new network (Kaia), which may relate to the EmergencyPauseFacet if it includes similar functionalities or integrations with the diamond architecture.
  • Deploy diamond to X Layer #806: This PR also involves deploying to a new layer (X Layer), which could be relevant to the EmergencyPauseFacet if it pertains to managing facets or emergency functionalities in a diamond architecture.
  • Deploy lifi dex aggregator #812: This PR introduces the LiFiDEXAggregator, which may interact with the EmergencyPauseFacet if it involves emergency management or operational functionalities within the diamond architecture.
  • Deploy lifi dex aggregator to remaining networks #819: Similar to Deploy lifi dex aggregator #812, this PR focuses on deploying the LiFiDEXAggregator to additional networks, which could relate to the EmergencyPauseFacet if it involves emergency management across those networks.

Suggested labels

AuditNotRequired

Suggested reviewers

  • 0xDEnYO

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.

CodeRabbit Configuration 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: 14

Outside diff range, codebase verification and nitpick comments (13)
script/deploy/facets/UpdateEmergencyPauseFacet.s.sol (1)

8-16: Consider Adding Comments for Clarity.

Adding comments to describe the purpose and functionality of the DeployScript contract and its run function would improve code readability and maintainability.

+ // DeployScript is responsible for updating the EmergencyPauseFacet.
contract DeployScript is UpdateScriptBase {
    using stdJson for string;

    // The run function updates the EmergencyPauseFacet and returns the updated facets and cutData.
    function run()
        public
        returns (address[] memory facets, bytes memory cutData)
    {
        return update("EmergencyPauseFacet");
    }
}
docs/EmergencyPauseFacet.md (1)

5-5: Clarify the Role of 'PauserWallet'.

Consider adding more details about the 'PauserWallet', such as its intended use and security implications, to provide a clearer understanding of its role.

script/deploy/facets/DeployEmergencyPauseFacet.s.sol (1)

8-31: Consider Adding Comments for Clarity.

Adding comments to describe the purpose and functionality of the DeployScript contract and its methods would improve code readability and maintainability.

+ // DeployScript is responsible for deploying the EmergencyPauseFacet.
contract DeployScript is DeployScriptBase {
    using stdJson for string;

    // Constructor initializes the DeployScriptBase with the EmergencyPauseFacet name.
    constructor() DeployScriptBase("EmergencyPauseFacet") {}

    // The run function deploys the EmergencyPauseFacet and returns the deployed contract and constructor arguments.
    function run()
        public
        returns (EmergencyPauseFacet deployed, bytes memory constructorArgs)
    {
        constructorArgs = getConstructorArgs();

        deployed = EmergencyPauseFacet(
            deploy(type(EmergencyPauseFacet).creationCode)
        );
    }

    // Retrieves constructor arguments from the global configuration file.
    function getConstructorArgs() internal override returns (bytes memory) {
        string memory path = string.concat(root, "/config/global.json");
        string memory json = vm.readFile(path);

        address pauserWallet = json.readAddress(".pauserWallet");

        return abi.encode(pauserWallet);
    }
}
test/solidity/Facets/OwnershipFacet.t.sol (1)

Line range hint 20-20: Ensure Test Coverage for All Scenarios.

Consider adding tests to cover edge cases and potential failure scenarios related to ownership transfer, such as attempting to transfer ownership when the contract is paused.

src/Libraries/LibDiamondLoupe.sol (1)

9-27: Consider adding input validation or comments for clarity.

The facets function retrieves all facets from the diamond storage. While the function appears correct, consider adding comments to explain the purpose of unchecked blocks and any assumptions about the data structure. This can improve readability and maintainability.

test/solidity/Facets/GenericSwapFacet.t.sol (1)

6-6: Consolidate imports for clarity.

The import statement now includes multiple utilities from TestBase.sol. Ensure that all imported modules are necessary for the tests.

test/solidity/Facets/StandardizedCallFacet.t.sol (1)

5-5: Consolidate imports for clarity.

The import statement now includes multiple utilities from TestBase.sol. Ensure all imported modules are necessary for the tests.

script/tasks/diamondEMERGENCYPauseGitHub.sh (3)

19-19: Unused variable: PRIVATE_KEY.

The PRIVATE_KEY variable appears unused. Verify its necessity or remove it if not needed.

Tools
Shellcheck

[warning] 19-19: PRIVATE_KEY appears unused. Verify use (or export if used externally).

(SC2034)


103-103: Unused variable: OWNER.

The OWNER variable appears unused. Verify its necessity or remove it if not needed.

Tools
Shellcheck

[warning] 103-103: OWNER appears unused. Verify use (or export if used externally).

(SC2034)


144-144: Unused variable: RETURN.

The RETURN variable appears unused. Verify its necessity or remove it if not needed.

Tools
Shellcheck

[warning] 144-144: RETURN appears unused. Verify use (or export if used externally).

(SC2034)

test/solidity/Facets/EmergencyPauseFacet.fork.t.sol (1)

1-2: Ensure SPDX license identifier and pragma version are appropriate.

The file includes the SPDX license identifier and specifies Solidity version 0.8.17. Verify that these are consistent with the project's standards and requirements.

test/solidity/Facets/EmergencyPauseFacet.local.t.sol (1)

1-2: Ensure SPDX license identifier and pragma version are appropriate.

The file includes the SPDX license identifier and specifies Solidity version 0.8.17. Verify that these are consistent with the project's standards and requirements.

script/helperFunctions.sh (1)

3480-3507: LGTM! Consider adding a newline for readability.

The function is well-structured and handles potential errors effectively. For improved readability, consider adding a newline before the return 0 statement.

  echoDebug "Log message sent to Discord"
  
+ echo ""
  return 0
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e8d744a and 77441a0.

Files selected for processing (59)
  • .github/workflows/diamondEmergencyPause.yml (1 hunks)
  • archive/test/DeBridgeDlnFacet.t.sol (1 hunks)
  • archive/test/MakerTeleportFacet.t.sol (1 hunks)
  • archive/test/MultiChainFacet.t.sol (3 hunks)
  • deployments/_deployments_log_file.json (1 hunks)
  • deployments/bsc.diamond.staging.json (1 hunks)
  • deployments/bsc.staging.json (1 hunks)
  • deployments/polygon.diamond.staging.json (1 hunks)
  • deployments/polygon.staging.json (1 hunks)
  • docs/EmergencyPauseFacet.md (1 hunks)
  • docs/README.md (3 hunks)
  • script/deploy/facets/DeployEmergencyPauseFacet.s.sol (1 hunks)
  • script/deploy/facets/UpdateEmergencyPauseFacet.s.sol (1 hunks)
  • script/helperFunctions.sh (3 hunks)
  • script/scriptMaster.sh (5 hunks)
  • script/tasks/diamondEMERGENCYPause.sh (1 hunks)
  • script/tasks/diamondEMERGENCYPauseGitHub.sh (1 hunks)
  • src/Errors/GenericErrors.sol (1 hunks)
  • src/Facets/EmergencyPauseFacet.sol (1 hunks)
  • src/Libraries/LibDiamondLoupe.sol (1 hunks)
  • test/solidity/Facets/AccessManagerFacet.t.sol (3 hunks)
  • test/solidity/Facets/AcrossFacet.t.sol (2 hunks)
  • test/solidity/Facets/AcrossFacetPacked.t.sol (3 hunks)
  • test/solidity/Facets/AmarokFacetPacked.t.sol (2 hunks)
  • test/solidity/Facets/CBridge.t.sol (1 hunks)
  • test/solidity/Facets/CBridgeAndFeeCollection.t.sol (24 hunks)
  • test/solidity/Facets/CBridgeFacetPacked.t.sol (16 hunks)
  • test/solidity/Facets/CBridgeRefund.t.sol (1 hunks)
  • test/solidity/Facets/CelerIMFacet.t.sol (4 hunks)
  • test/solidity/Facets/DexManagerFacet.t.sol (2 hunks)
  • test/solidity/Facets/EmergencyPauseFacet.fork.t.sol (1 hunks)
  • test/solidity/Facets/EmergencyPauseFacet.local.t.sol (1 hunks)
  • test/solidity/Facets/GenericSwapFacet.t.sol (11 hunks)
  • test/solidity/Facets/GenericSwapFacetV3.t.sol (54 hunks)
  • test/solidity/Facets/GnosisBridgeL2Facet.t.sol (1 hunks)
  • test/solidity/Facets/HopFacet.t.sol (3 hunks)
  • test/solidity/Facets/HopFacetOptimizedL2.t.sol (3 hunks)
  • test/solidity/Facets/HopFacetPackedL1.t.sol (21 hunks)
  • test/solidity/Facets/HopFacetPackedL2.t.sol (5 hunks)
  • test/solidity/Facets/MayanFacet.t.sol (3 hunks)
  • test/solidity/Facets/OmniBridgeL2Facet.t.sol (1 hunks)
  • test/solidity/Facets/OptimismBridgeFacet.t.sol (4 hunks)
  • test/solidity/Facets/OwnershipFacet.t.sol (1 hunks)
  • test/solidity/Facets/SquidFacet.t.sol (2 hunks)
  • test/solidity/Facets/StandardizedCallFacet.t.sol (7 hunks)
  • test/solidity/Facets/StargateFacet.t.sol (4 hunks)
  • test/solidity/Facets/StargateFacetV2.t.sol (6 hunks)
  • test/solidity/Facets/SymbiosisFacet.t.sol (1 hunks)
  • test/solidity/Gas/CBridgeFacetPackedARB.gas.t.sol (4 hunks)
  • test/solidity/Gas/CBridgeFacetPackedETH.gas.t.sol (10 hunks)
  • test/solidity/Gas/Hop.t.sol (3 hunks)
  • test/solidity/Gas/HopFacetPackedARB.gas.t.sol (1 hunks)
  • test/solidity/Gas/HopFacetPackedETH.gas.t.sol (1 hunks)
  • test/solidity/Gas/HopFacetPackedPOL.gas.t.sol (1 hunks)
  • test/solidity/Helpers/SwapperV2.t.sol (2 hunks)
  • test/solidity/Periphery/ReceiverStargateV2.t.sol (2 hunks)
  • test/solidity/utils/DiamondTest.sol (4 hunks)
  • test/solidity/utils/TestBase.sol (6 hunks)
  • test/solidity/utils/TestBaseFacet.sol (1 hunks)
Files skipped from review due to trivial changes (5)
  • archive/test/MakerTeleportFacet.t.sol
  • deployments/bsc.diamond.staging.json
  • deployments/polygon.diamond.staging.json
  • test/solidity/Facets/AcrossFacet.t.sol
  • test/solidity/Facets/SquidFacet.t.sol
Additional context used
LanguageTool
docs/EmergencyPauseFacet.md

[uncategorized] ~14-~14: Possible missing comma found.
Context: ...by reactivating all formerly registered facets except for the facets in '_blacklist' ...

(AI_HYDRA_LEO_MISSING_COMMA)

Shellcheck
script/tasks/diamondEMERGENCYPauseGitHub.sh

[warning] 19-19: PRIVATE_KEY appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 103-103: OWNER appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 127-127: Expanding an array without an index only gives the first element.

(SC2128)


[warning] 144-144: RETURN appears unused. Verify use (or export if used externally).

(SC2034)

script/tasks/diamondEMERGENCYPause.sh

[warning] 25-25: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 43-43: Prefer mapfile or read -a to split command output (or quote to avoid splitting).

(SC2207)


[warning] 45-45: Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.

(SC2206)


[warning] 60-60: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 71-71: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 78-78: Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A"B"C"?

(SC2140)


[warning] 78-78: Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A"B"C"?

(SC2140)


[warning] 88-88: Expanding an array without an index only gives the first element.

(SC2128)


[warning] 96-96: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 172-172: Declare and assign separately to avoid masking return values.

(SC2155)

script/helperFunctions.sh

[warning] 3511-3511: Declare and assign separately to avoid masking return values.

(SC2155)

Additional comments not posted (132)
script/deploy/facets/UpdateEmergencyPauseFacet.s.sol (1)

1-2: Ensure SPDX License Identifier is Correct.

The SPDX license identifier is set to UNLICENSED. Ensure this is intentional and complies with your project's licensing requirements.

script/deploy/facets/DeployEmergencyPauseFacet.s.sol (1)

1-2: Ensure SPDX License Identifier is Correct.

The SPDX license identifier is set to UNLICENSED. Ensure this is intentional and complies with your project's licensing requirements.

src/Errors/GenericErrors.sol (1)

10-12: New Error Declarations Enhance Error Handling.

The addition of DiamondIsPaused and FunctionDoesNotExist errors improves the contract's robustness by providing specific feedback for these conditions.

test/solidity/Facets/OwnershipFacet.t.sol (1)

7-12: Refactor Improves Test Modularity.

The refactoring to inherit from TestBase and the use of initTestBase() enhances the modularity and maintainability of the test setup.

src/Libraries/LibDiamondLoupe.sol (3)

29-36: Ensure comprehensive test coverage for facetFunctionSelectors.

The facetFunctionSelectors function retrieves function selectors for a given facet. Ensure that tests cover edge cases, such as when the facet does not exist or has no selectors.


38-45: LGTM! Ensure comprehensive test coverage for facetAddresses.

The facetAddresses function correctly retrieves all facet addresses from the diamond storage.

Ensure that tests cover scenarios where the list of facet addresses is empty or very large.


47-54: LGTM! Ensure comprehensive test coverage for facetAddress.

The facetAddress function retrieves the address of a facet given a function selector. Ensure that tests cover cases where the selector does not exist.

deployments/bsc.staging.json (1)

31-31: Verify the correctness of the EmergencyPauseFacet address.

The new entry for EmergencyPauseFacet has been added. Ensure that the address is correct and corresponds to the intended deployment.

docs/README.md (5)

16-16: Verify the link for Emergency Pause Facet.

Ensure that the link to EmergencyPauseFacet.md is correct and the documentation file exists.


18-18: Verify the link for Generic Swap FacetV3.

Ensure that the link to GenericSwapFacetV3.md is correct and the documentation file exists.


35-35: Verify the link for Stargate FacetV2.

Ensure that the link to StargateFacetV2.md is correct and the documentation file exists.


60-60: Verify the link for LiFuelFeeCollector.

Ensure that the link to LiFuelFeeCollector.md is correct and the documentation file exists.


62-62: Verify the link for ReceiverStargateV2.

Ensure that the link to ReceiverStargateV2.md is correct and the documentation file exists.

test/solidity/Facets/AccessManagerFacet.t.sol (2)

Line range hint 20-36: Ensure initTestBase correctly sets up the test environment.

The setUp function now calls initTestBase. Verify that this method initializes the test environment as expected and that all necessary components are correctly configured.


36-36: LGTM! Ensure setFacetAddressInTestBase is correctly implemented.

The setFacetAddressInTestBase method is used to register the AccessManagerFacet. Ensure that this function is correctly implemented and that it registers the facet as intended.

test/solidity/Gas/Hop.t.sol (3)

17-19: Ensure customBlockNumberForForking is set correctly.

The setUp function now sets a custom block number for forking. Verify that this block number is appropriate for the tests being conducted.


32-32: LGTM! Ensure ADDRESS_USDC is correctly defined.

The ADDRESS_USDC constant is used in the configuration. Ensure that it is correctly defined and corresponds to the intended address.


38-39: LGTM! Ensure setFacetAddressInTestBase is correctly implemented.

The setFacetAddressInTestBase method is used to register the HopFacet. Ensure that this function is correctly implemented and that it registers the facet as intended.

deployments/polygon.staging.json (1)

43-43: Addition of EmergencyPauseFacet entry.

The entry for EmergencyPauseFacet has been added successfully, enhancing the deployment configuration with an emergency pause mechanism.

test/solidity/Facets/OmniBridgeL2Facet.t.sol (2)

40-40: Addition of ADDRESS_USDT constant.

The new constant ADDRESS_USDT has been added to the test setup. Ensure that this address is correct and used appropriately in the tests.


42-42: Renaming of ADDRESS_WETH to ADDRESS_WRAPPED_NATIVE.

The constant has been renamed for better clarity. This change improves the semantic understanding of the asset type.

.github/workflows/diamondEmergencyPause.yml (2)

1-1: New workflow for emergency diamond pause.

This workflow is designed to pause production diamonds carefully. Ensure that all steps are thoroughly tested before enabling in production.


17-30: Commented-out authentication code.

The authentication code is currently commented out. Ensure that this is tested and enabled once verified, as it adds an important security layer.

test/solidity/Facets/DexManagerFacet.t.sol (2)

13-14: Introduction of user role constants.

The constants USER_PAUSER and USER_DIAMOND_OWNER have been introduced, improving clarity and configurability in the test setup.


46-46: Use of vm.startPrank for simulating user actions.

The use of vm.startPrank(USER_DIAMOND_OWNER) effectively simulates actions by the diamond owner, enhancing test realism.

test/solidity/utils/DiamondTest.sol (5)

8-8: Import of EmergencyPauseFacet.

The import of EmergencyPauseFacet is a key enhancement, providing emergency management capabilities to the diamond.


16-19: Modification of createDiamond function parameters.

The function now accepts _diamondOwner and _pauserWallet, enhancing configurability and control over diamond operations.


25-27: Instantiation of EmergencyPauseFacet.

The EmergencyPauseFacet is instantiated with _pauserWallet, adding emergency control capabilities to the diamond.


88-100: Addition of EmergencyPauseFacet function selectors.

The function selectors for EmergencyPauseFacet are correctly added, enabling pause and unpause functionalities.


106-106: Use of vm.stopPrank to end ownership simulation.

The use of vm.stopPrank() ensures that the ownership simulation ends correctly, maintaining test integrity.

test/solidity/Gas/CBridgeFacetPackedARB.gas.t.sol (6)

6-6: Consolidate imports for clarity.

The imports have been consolidated into a single line, which improves readability and reduces redundancy. This is a good practice for maintaining clean code.


32-33: Streamline forking setup in setUp.

The integration of customBlockNumberForForking and customRpcUrlForForking into the setUp function simplifies the forking setup process. This change enhances maintainability by centralizing configuration.


87-87: Use of ADDRESS_USDC for consistency.

The replacement of USDC_ADDRESS with ADDRESS_USDC ensures consistency in naming conventions across the codebase. This change improves clarity and reduces potential confusion.


100-104: Set facet address in TestBase.

The addition of setFacetAddressInTestBase ensures that the facet address is correctly configured within the test base. This is a necessary step for maintaining the integrity of the test environment.


8-8: Transition to TestBase for streamlined testing.

The inheritance from TestBase instead of Test and DiamondTest indicates a shift towards a more unified testing framework. Ensure that all necessary functionalities from the previous base contracts are covered by TestBase.

Run the following script to verify the presence of necessary functionalities:

Verification successful

Transition to TestBase is valid and complete.

The TestBase contract inherits from both Test and DiamondTest, ensuring that all necessary functionalities from these base contracts are included. This transition supports a more unified testing framework without missing any essential features.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that `TestBase` includes necessary functionalities from `Test` and `DiamondTest`.

# Test: Search for function definitions in `TestBase` that were previously in `Test` or `DiamondTest`.
ast-grep --lang solidity --pattern 'contract TestBase { $$$ }'

Length of output: 181


Script:

#!/bin/bash
# Search for the definition of the `TestBase` contract and its functions.
rg 'contract TestBase' -A 20 --glob '*.sol'

# Search for the definition of the `Test` contract and its functions.
rg 'contract Test' -A 20 --glob '*.sol'

# Search for the definition of the `DiamondTest` contract and its functions.
rg 'contract DiamondTest' -A 20 --glob '*.sol'

Length of output: 73070


95-99: Ensure proper token approval setup.

The approval process for tokens has been updated to use ADDRESS_USDC. Verify that the usdc variable is correctly initialized and used, as its declaration was removed.

Run the following script to verify the initialization and usage of usdc:

Verification successful

Token approval setup is correct.

The usdc variable is properly initialized as ERC20(ADDRESS_USDC), ensuring that it represents the USDC token correctly. The approval process using ADDRESS_USDC is consistent with this setup.

  • Initialization: usdc = ERC20(ADDRESS_USDC);
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the initialization and usage of `usdc`.

# Test: Search for `usdc` initialization and usage in the codebase.
rg --type solidity 'usdc'

Length of output: 58


Script:

#!/bin/bash
# Find all Solidity files and search for `usdc` initialization and usage
fd -e sol -x rg 'usdc' {}

Length of output: 12092

test/solidity/Facets/GenericSwapFacet.t.sol (3)

19-19: Transition to TestBase is appropriate.

Switching to TestBase likely standardizes test setups. Ensure that all necessary initializations from DSTest and DiamondTest are covered in TestBase.


52-56: Ensure facet address setup is correct.

The facet address is set in TestBase. Verify that this setup aligns with the intended test architecture and doesn't introduce any dependencies on external state.


68-69: Consistent use of address constants is good practice.

The updated address constants (ADDRESS_USDC, ADDRESS_DAI, ADDRESS_WRAPPED_NATIVE) improve readability and maintainability. Ensure these constants are defined correctly in TestBase.

Also applies to: 80-81, 100-101, 124-125, 138-139, 154-155, 164-165, 188-189

test/solidity/Facets/StandardizedCallFacet.t.sol (4)

67-68: Transition to TestBase is appropriate.

Switching to TestBase and renaming diamond to mockDiamond helps clarify the test's intent. Ensure that mockDiamond accurately simulates the diamond contract's behavior.


76-79: Parameterize diamond creation.

The addition of USER_DIAMOND_OWNER and USER_PAUSER parameters in createDiamond enhances test flexibility. Ensure these parameters are correctly set up in the test environment.


109-109: Verify mockDiamond initialization.

Ensure that mockDiamond is correctly initialized and that all necessary facets and functions are added to simulate the diamond's behavior accurately.


115-126: Ensure test coverage for mockDiamond interactions.

The tests simulate various interactions with mockDiamond. Verify that these interactions cover all expected scenarios and edge cases.

Also applies to: 132-143, 149-160, 166-177, 183-187, 193-197, 203-207, 213-217

test/solidity/Gas/HopFacetPackedETH.gas.t.sol (1)

60-60: Parameterize diamond creation for flexibility.

Including USER_DIAMOND_OWNER and USER_PAUSER in createDiamond enhances control over the diamond's setup. Ensure these parameters are correctly defined in the test environment.

script/tasks/diamondEMERGENCYPause.sh (1)

88-88: Array expansion without index only gives the first element.

Ensure you are expanding the array correctly to avoid only getting the first element, as suggested by Shellcheck SC2128.

Please verify that the array expansion is intended to only provide the first element or adjust the expansion to include all elements.

Tools
Shellcheck

[warning] 88-88: Expanding an array without an index only gives the first element.

(SC2128)

test/solidity/Facets/OptimismBridgeFacet.t.sol (4)

6-6: Ensure all necessary imports are included.

The import statement includes several utilities and libraries. Verify that all necessary imports are included and that unused imports are removed to maintain clarity.

Please ensure that all imported modules are required for the tests and remove any that are not used.


20-20: Verify constant values.

Ensure that the constant addresses and values are correct and up-to-date for the intended test environment.

Please verify that these addresses and constants are accurate and reflect the current state of the network being tested.


48-48: Verify custom block number for forking.

The custom block number for forking has been set. Ensure that this block number is appropriate for the tests being conducted.

Please confirm that block number 15876510 is suitable for the intended test scenarios.


104-108: Ensure facet address is correctly set in TestBase.

The setFacetAddressInTestBase function is used to set the facet address. Verify that this is correctly implemented and that it aligns with the new testing framework.

Please ensure that the facet address is correctly set and that it integrates seamlessly with the TestBase setup.

test/solidity/Gas/CBridgeFacetPackedETH.gas.t.sol (4)

8-8: Ensure all necessary imports are included.

The import statement includes several utilities and libraries. Verify that all necessary imports are included and that unused imports are removed to maintain clarity.

Please ensure that all imported modules are required for the tests and remove any that are not used.


43-43: Verify custom block number for forking.

The custom block number for forking has been set. Ensure that this block number is appropriate for the tests being conducted.

Please confirm that block number 15588208 is suitable for the intended test scenarios.


109-109: Verify token address changes.

The address for the token has been changed to ADDRESS_USDT. Ensure that this change is intentional and that it aligns with the test objectives.

Please confirm that the use of ADDRESS_USDT is correct and reflects the intended behavior of the tests.


156-156: Verify token approvals.

Ensure that the token approvals are correctly set up and that the tokens being approved are necessary for the tests.

Please verify that the token approvals are accurate and align with the test requirements.

test/solidity/Facets/HopFacetOptimizedL2.t.sol (2)

39-39: Verify custom block number for forking.

The custom block number for forking has been set. Ensure that this block number is appropriate for the tests being conducted.

Please confirm that block number 59534582 is suitable for the intended test scenarios.


249-255: Clarify the impact of reduced checks in OptimizedFacet.

The comment mentions that the OptimizedFacet has fewer checks, allowing transactions with invalid amounts. Ensure that this behavior is intentional and that the implications are well understood.

Please confirm that the reduced checks are intentional and that the implications for security and functionality are fully considered.

src/Facets/EmergencyPauseFacet.sol (3)

37-43: Ensure access control is robust.

The OnlyPauserWalletOrOwner modifier is used for access control. Ensure that this modifier is correctly implemented and that it effectively restricts access to authorized users.

Please verify that the access control logic is robust and that only authorized users can execute the restricted functions.


115-116: Ensure only the owner can unpause the diamond.

The unpauseDiamond function should only be callable by the contract owner. Ensure that the LibDiamond.enforceIsContractOwner function is correctly implemented to enforce this restriction.

Please verify that the owner check is correctly enforced and that unauthorized users cannot unpause the diamond.


229-232: Ensure meaningful error message on pause.

The fallback function reverts with a DiamondIsPaused error. Ensure that this provides a clear and meaningful error message to users when the diamond is paused.

Please confirm that the DiamondIsPaused error message is clear and informative for users attempting to interact with a paused diamond.

test/solidity/Facets/HopFacet.t.sol (2)

231-231: Enhance test setup with explicit role assignment.

The createDiamond function now includes USER_DIAMOND_OWNER and USER_PAUSER, which improves the clarity and specificity of the test setup by explicitly defining roles during diamond creation. Ensure that these roles are correctly set up in the test environment.


275-275: Enhance test setup with explicit role assignment.

The createDiamond function now includes USER_DIAMOND_OWNER and USER_PAUSER, which enhances the test setup by explicitly defining roles during diamond creation. This change improves the clarity and control over the diamond's initialization.

test/solidity/Facets/EmergencyPauseFacet.fork.t.sol (4)

30-87: Comprehensive setup for EmergencyPauseFacet tests.

The setup function initializes the test environment, including deploying the EmergencyPauseFacet and adding it to the diamond. This setup is crucial for ensuring that the tests run in a controlled and consistent environment.


89-98: Verify event emission and revert conditions in pause tests.

The tests for pausing the diamond include checks for event emissions and revert conditions, ensuring that only authorized users can pause the contract. This is a good practice for validating contract behavior.


126-148: Test unpause functionality with blacklist handling.

The tests for unpausing the diamond include scenarios with empty and non-empty blacklists, ensuring that the contract handles these cases correctly. This adds robustness to the test coverage.


206-250: Test facet removal and unpause functionality.

The tests for removing facets and unpausing the diamond ensure that the contract behaves correctly when facets are dynamically managed. This is important for maintaining the modularity and flexibility of the diamond architecture.

test/solidity/Gas/HopFacetPackedARB.gas.t.sol (1)

75-75: Enhance test setup with explicit role assignment.

The createDiamond function now includes USER_DIAMOND_OWNER and USER_PAUSER, enhancing the test setup by explicitly defining roles during diamond creation. This change improves clarity and control over the diamond's initialization.

test/solidity/Gas/HopFacetPackedPOL.gas.t.sol (1)

76-76: Enhance test setup with explicit role assignment.

The createDiamond function now includes USER_DIAMOND_OWNER and USER_PAUSER, enhancing the test setup by explicitly defining roles during diamond creation. This change improves clarity and control over the diamond's initialization.

test/solidity/Facets/EmergencyPauseFacet.local.t.sol (4)

27-41: Comprehensive setup for EmergencyPauseFacet tests.

The setup function initializes the test environment, including setting the emergencyPauseFacet. This setup is crucial for ensuring that the tests run in a controlled and consistent environment.


43-55: Verify event emission and revert conditions in pause tests.

The tests for pausing the diamond include checks for event emissions and revert conditions, ensuring that only authorized users can pause the contract. This is a good practice for validating contract behavior.


83-120: Test unpause functionality with blacklist handling.

The tests for unpausing the diamond include scenarios with empty and non-empty blacklists, ensuring that the contract handles these cases correctly. This adds robustness to the test coverage.


206-250: Test facet removal and unpause functionality.

The tests for removing facets and unpausing the diamond ensure that the contract behaves correctly when facets are dynamically managed. This is important for maintaining the modularity and flexibility of the diamond architecture.

test/solidity/Periphery/ReceiverStargateV2.t.sol (1)

185-185: Ensure Correctness of ADDRESS_WRAPPED_NATIVE Usage.

The change from ADDRESS_WETH to ADDRESS_WRAPPED_NATIVE impacts the token used in the _getValidLzComposeCalldata function. Verify that ADDRESS_WRAPPED_NATIVE is correctly defined and intended for use in these scenarios.

Run the following script to verify the definition and usage of ADDRESS_WRAPPED_NATIVE:

Also applies to: 235-235

Verification successful

Correct Usage of ADDRESS_WRAPPED_NATIVE Verified

The ADDRESS_WRAPPED_NATIVE variable is used across multiple files and is assigned specific addresses in various contexts, indicating its role in representing different wrapped native tokens. Its usage appears consistent and intentional, aligning with the intended scenarios. No issues found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the definition and usage of `ADDRESS_WRAPPED_NATIVE`.

# Test: Search for the definition of `ADDRESS_WRAPPED_NATIVE`. Expect: Correct address assignment.
rg --type solidity 'address\s+constant\s+ADDRESS_WRAPPED_NATIVE\s*='

# Test: Search for all usages of `ADDRESS_WRAPPED_NATIVE`. Expect: Consistent usage across the codebase.
rg --type solidity 'ADDRESS_WRAPPED_NATIVE'

Length of output: 180


Script:

#!/bin/bash
# Description: Verify the definition and usage of `ADDRESS_WRAPPED_NATIVE`.

# Test: Search for the definition of `ADDRESS_WRAPPED_NATIVE`. Expect: Correct address assignment.
rg 'address\s+constant\s+ADDRESS_WRAPPED_NATIVE\s*=' --glob '*.sol'

# Test: Search for all usages of `ADDRESS_WRAPPED_NATIVE`. Expect: Consistent usage across the codebase.
rg 'ADDRESS_WRAPPED_NATIVE' --glob '*.sol'

Length of output: 5128


Script:

#!/bin/bash
# Description: Search for initialization or assignment of `ADDRESS_WRAPPED_NATIVE`.

# Test: Search for any initialization or assignment of `ADDRESS_WRAPPED_NATIVE`.
rg 'ADDRESS_WRAPPED_NATIVE\s*=' --glob '*.sol'

Length of output: 994

archive/test/MultiChainFacet.t.sol (1)

228-228: Verify Ownership and Pauser Parameters in createDiamond.

The addition of owner and pauser parameters to the createDiamond function ensures that the diamond is initialized with specific roles. Verify that these parameters are correctly passed and used in all relevant contexts.

Run the following script to verify the usage of createDiamond with the new parameters:

Also applies to: 282-282, 337-337

Verification successful

Verified Usage of createDiamond Parameters

The createDiamond function consistently uses USER_DIAMOND_OWNER and USER_PAUSER as parameters across multiple calls, ensuring correct initialization of ownership and pauser roles. No issues found with parameter usage.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `createDiamond` with `owner` and `pauser` parameters.

# Test: Search for all calls to `createDiamond`. Expect: Correct parameter passing.
rg --type solidity 'createDiamond\('

Length of output: 71


Script:

#!/bin/bash
# Find all Solidity files and search for `createDiamond` calls within them.
fd --extension sol --exec rg 'createDiamond\('

Length of output: 1228

test/solidity/utils/TestBaseFacet.sol (1)

199-199: Verify the Use of ADDRESS_WRAPPED_NATIVE in Swap Path.

The change from ADDRESS_WETH to ADDRESS_WRAPPED_NATIVE in the swap path affects token swaps. Ensure that ADDRESS_WRAPPED_NATIVE is correctly defined and intended for this use.

Run the following script to verify the definition and usage of ADDRESS_WRAPPED_NATIVE:

test/solidity/Facets/HopFacetPackedL2.t.sol (2)

9-9: Verify Inheritance and Setup Changes.

The switch to inheriting from TestBase and the refactoring of the setup process aim to streamline testing. Ensure that the new inheritance and setup are correctly implemented and do not introduce any issues.

Run the following script to verify the inheritance and setup changes:

Also applies to: 26-26


76-78: Ensure Correct Initialization in setUp.

The initialization of customBlockNumberForForking and customRpcUrlForForking followed by initTestBase() indicates a new setup approach. Verify that these changes are correctly implemented and align with the intended test environment.

Run the following script to verify the initialization in the setUp function:

Also applies to: 223-225

Verification successful

Initialization in setUp Function Verified

The setUp function in HopFacetPackedL2.t.sol correctly initializes customBlockNumberForForking, customRpcUrlForForking, and calls initTestBase(). This setup aligns with the intended test environment setup as described in the review comment.

  • customBlockNumberForForking is set to 58467500.
  • customRpcUrlForForking is set to "ETH_NODE_URI_ARBITRUM".
  • initTestBase() is invoked to initialize the test base.

These changes are consistent with the expected initialization logic.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the initialization in the `setUp` function of `HopFacetPackedL2Test`.

# Test: Search for the `setUp` function implementation. Expect: Correct initialization logic.
rg --type solidity 'function setUp\('

Length of output: 72


Script:

#!/bin/bash
# Find all Solidity files and search for the `setUp` function implementation.
fd --extension sol --exec rg 'function setUp\('

Length of output: 2008


Script:

#!/bin/bash
# Locate the specific file and search for the `setUp` function within it.
fd --type f --name HopFacetPackedL2.t.sol --exec rg 'function setUp\('

Length of output: 323


Script:

#!/bin/bash
# Correctly locate the specific file and search for the `setUp` function within it.
fd 'HopFacetPackedL2.t.sol' --exec rg 'function setUp\('

Length of output: 86


Script:

#!/bin/bash
# Extract the full content of the `setUp` function from the `HopFacetPackedL2.t.sol` file.
fd 'HopFacetPackedL2.t.sol' --exec rg -A 20 'function setUp\('

Length of output: 915

test/solidity/Facets/CBridgeAndFeeCollection.t.sol (2)

12-12: Verify Inheritance and Token Address Renaming.

The switch to inheriting from TestBase and the renaming of token address constants aim to standardize the test structure. Ensure that the new inheritance and constants are correctly implemented and used throughout the file.

Run the following script to verify the inheritance and token address renaming:

Also applies to: 27-27

Verification successful

Inheritance and Token Address Renaming Verified Successfully

The CBridgeAndFeeCollectionTest contract correctly inherits from TestBase, and the renamed token address constants (ADDRESS_USDC, ADDRESS_DAI, ADDRESS_WRAPPED_NATIVE) are consistently used throughout the file. No issues were found with these changes.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the inheritance and token address renaming in `CBridgeAndFeeCollectionTest`.

# Test: Search for the `CBridgeAndFeeCollectionTest` contract definition. Expect: Correct inheritance.
rg --type solidity 'contract CBridgeAndFeeCollectionTest'

# Test: Search for all usages of renamed token address constants. Expect: Consistent usage across the file.
rg --type solidity 'ADDRESS_USDC|ADDRESS_DAI|ADDRESS_WRAPPED_NATIVE'

Length of output: 196


Script:

#!/bin/bash
# Description: Verify the inheritance and token address renaming in `CBridgeAndFeeCollectionTest`.

# Test: Search for the `CBridgeAndFeeCollectionTest` contract definition. Expect: Correct inheritance.
rg 'contract CBridgeAndFeeCollectionTest' --glob '*.sol' -A 5

# Test: Search for all usages of renamed token address constants. Expect: Consistent usage across the file.
rg 'ADDRESS_USDC|ADDRESS_DAI|ADDRESS_WRAPPED_NATIVE' --glob '*.sol'

Length of output: 38572


36-37: Ensure Correct Initialization in setUp.

The initialization of customBlockNumberForForking and the call to initTestBase() indicate a new setup approach. Verify that these changes are correctly implemented and align with the intended test environment.

Run the following script to verify the initialization in the setUp function:

Verification successful

Initialization in setUp is Correctly Implemented

The setUp function in CBridgeAndFeeCollection.t.sol correctly initializes customBlockNumberForForking and calls initTestBase(). This setup aligns with the intended test environment as specified in the review comment.

  • customBlockNumberForForking is set to 14847528.
  • initTestBase() is called immediately after setting the block number.

These changes are consistent with the expected initialization logic for the test setup.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the initialization in the `setUp` function of `CBridgeAndFeeCollectionTest`.

# Test: Search for the `setUp` function implementation. Expect: Correct initialization logic.
rg --type solidity 'function setUp\('

Length of output: 72


Script:

#!/bin/bash
# Description: Verify the initialization in the `setUp` function of `CBridgeAndFeeCollectionTest`.

# Test: Search for the `setUp` function implementation using ast-grep.
ast-grep --lang solidity --pattern 'function setUp() { $$$ }'

Length of output: 180


Script:

#!/bin/bash
# Description: Verify the initialization in the `setUp` function of `CBridgeAndFeeCollectionTest`.

# Find all Solidity files and search for the `setUp` function.
fd --extension sol --exec grep -Hn 'function setUp' {}

Length of output: 5187


Script:

#!/bin/bash
# Description: Extract the contents of the `setUp` function in `CBridgeAndFeeCollection.t.sol`.

# Display the contents of the `setUp` function.
sed -n '35,/^}/p' test/solidity/Facets/CBridgeAndFeeCollection.t.sol

Length of output: 13904

test/solidity/Facets/SymbiosisFacet.t.sol (1)

146-146: Verify the correctness of asset replacement.

The replacement of ADDRESS_WETH with ADDRESS_WRAPPED_NATIVE suggests a change in the asset handling logic. Ensure that this change aligns with the intended functionality and that all related logic is updated accordingly.

Run the following script to verify the usage of ADDRESS_WRAPPED_NATIVE across the codebase:

test/solidity/Facets/CBridgeFacetPacked.t.sol (2)

9-9: Verify refactoring to use TestBase.

The transition to using TestBase instead of Test and DiamondTest streamlines the test setup. Ensure that all necessary functionalities are preserved and that the refactoring aligns with the intended test structure.

Run the following script to verify the usage of TestBase across the codebase:

Verification successful

Refactoring to TestBase Verified Successfully

The refactoring to use TestBase instead of Test and DiamondTest is consistent across the codebase. The transition aligns with the intended test structure, and all necessary functionalities appear to be preserved.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of TestBase across the codebase.

# Test: Search for the usage of TestBase. Expect: Consistent usage across relevant test files.
rg --type solidity -A 5 $'TestBase'

Length of output: 67


Script:

#!/bin/bash
# Description: Verify the usage of TestBase across the codebase.

# Find all Solidity files and search for the usage of TestBase.
fd --extension sol | xargs rg 'TestBase'

Length of output: 21285


115-115: Standardize address variable naming.

The replacement of USDT_ADDRESS and USDC_ADDRESS with ADDRESS_USDT and ADDRESS_USDC improves consistency. Ensure that this naming convention is applied throughout the codebase for clarity.

Run the following script to verify the usage of ADDRESS_USDT and ADDRESS_USDC across the codebase:

Also applies to: 128-128, 136-137

Verification successful

Consistent Naming of Address Variables Verified

The usage of ADDRESS_USDT and ADDRESS_USDC is consistent across the codebase, as indicated by the search results. The naming convention is applied uniformly, ensuring clarity and standardization. No further action is required.

  • Instances of ADDRESS_USDT and ADDRESS_USDC are found across various test files, confirming consistent usage.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of ADDRESS_USDT and ADDRESS_USDC across the codebase.

# Test: Search for the usage of ADDRESS_USDT and ADDRESS_USDC. Expect: Consistent usage across relevant files.
rg --type solidity -A 5 $'ADDRESS_USDT|ADDRESS_USDC'

Length of output: 86


Script:

#!/bin/bash
# Description: Verify the usage of ADDRESS_USDT and ADDRESS_USDC across the codebase.

# Test: Search for the usage of ADDRESS_USDT and ADDRESS_USDC without specifying file type.
rg -A 5 'ADDRESS_USDT|ADDRESS_USDC'

Length of output: 141419

test/solidity/Facets/StargateFacet.t.sol (2)

299-299: Verify asset handling logic update.

The replacement of ADDRESS_WETH with ADDRESS_WRAPPED_NATIVE indicates a change in asset handling. Ensure that this change is consistent with the intended functionality and that all related logic is updated.

Run the following script to verify the usage of ADDRESS_WRAPPED_NATIVE across the codebase:

Verification successful

Asset Handling Logic Update Verified

The update from ADDRESS_WETH to ADDRESS_WRAPPED_NATIVE is consistent across the codebase. The usage of ADDRESS_WRAPPED_NATIVE is widespread in various test files, indicating a comprehensive update to the asset handling logic. No further issues were found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of ADDRESS_WRAPPED_NATIVE across the codebase.

# Test: Search for the usage of ADDRESS_WRAPPED_NATIVE. Expect: Consistent usage across relevant files.
rg --type solidity -A 5 $'ADDRESS_WRAPPED_NATIVE'

Length of output: 81


Script:

#!/bin/bash
# Description: Verify the usage of ADDRESS_WRAPPED_NATIVE across the codebase.

# Test: Search for the usage of ADDRESS_WRAPPED_NATIVE in Solidity files.
rg 'ADDRESS_WRAPPED_NATIVE' --glob '*.sol' -A 5

Length of output: 25628


381-381: Verify removal of FeeCollector.

The removal of FeeCollector suggests a refactoring of fee management. Ensure that all necessary functionalities are preserved and that the removal aligns with the intended fee management strategy.

Run the following script to verify the removal of FeeCollector across the codebase:

test/solidity/Facets/CelerIMFacet.t.sol (1)

219-219: Verify asset representation update.

The replacement of ADDRESS_WETH with ADDRESS_WRAPPED_NATIVE indicates a shift in asset representation. Ensure that this change aligns with the intended functionality and that all related logic is updated.

Run the following script to verify the usage of ADDRESS_WRAPPED_NATIVE across the codebase:

Also applies to: 378-378, 422-422

test/solidity/Facets/AmarokFacetPacked.t.sol (1)

45-45: Verify diamond creation update.

The update to createDiamond to include USER_DIAMOND_OWNER and USER_PAUSER enhances control over the diamond's capabilities. Ensure that this change aligns with the intended functionality and that ownership and pausing logic are correctly implemented.

Run the following script to verify the usage of createDiamond with parameters across the codebase:

Verification successful

Diamond creation update verified.

The createDiamond function correctly implements the use of USER_DIAMOND_OWNER and USER_PAUSER parameters, aligning with the intended functionality for ownership and pausing logic. The parameters are used to set up ownership and pausing capabilities within the diamond, confirming the update's correctness.

  • The _diamondOwner is utilized in vm.startPrank, indicating its role in ownership setup.
  • The _pauserWallet is used in the EmergencyPauseFacet, confirming its role in pausing logic.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of createDiamond with parameters across the codebase.

# Test: Search for the usage of createDiamond with parameters. Expect: Consistent usage across relevant files.
rg --type solidity -A 5 $'createDiamond(USER_DIAMOND_OWNER, USER_PAUSER)'

Length of output: 107


Script:

#!/bin/bash
# Description: Verify the usage of createDiamond with parameters across Solidity files.

# Find all Solidity files and search for the usage of createDiamond with the specified parameters.
fd -e sol -x rg 'createDiamond\(USER_DIAMOND_OWNER, USER_PAUSER\)' {}

Length of output: 1177


Script:

#!/bin/bash
# Description: Locate the implementation of createDiamond to verify parameter usage.

# Search for the implementation of the createDiamond function in Solidity files.
fd -e sol -x rg 'function createDiamond' -A 10 {}

Length of output: 571

test/solidity/Facets/MayanFacet.t.sol (5)

226-226: Ensure Consistent Naming for Wrapped Native Address.

The constant ADDRESS_WRAPPED_NATIVE is used here. Ensure that this naming is consistently applied across the entire codebase.


320-320: Ensure Consistent Naming for Wrapped Native Address.

The constant ADDRESS_WRAPPED_NATIVE is used here. Ensure that this naming is consistently applied across the entire codebase.


328-332: Ensure Consistent Naming for Wrapped Native Address.

The constant ADDRESS_WRAPPED_NATIVE is used in the deal function. Ensure that this naming is consistently applied across the entire codebase.


149-149: Ensure Consistent Naming for Wrapped Native Address.

The constant ADDRESS_WRAPPED_NATIVE replaces ADDRESS_WETH. Verify that this renaming is consistent throughout the codebase to avoid any discrepancies.

Verification successful

Consistent Usage of ADDRESS_WRAPPED_NATIVE Verified

The renaming of ADDRESS_WETH to ADDRESS_WRAPPED_NATIVE has been applied consistently across the codebase. There are no discrepancies found in the usage of the new constant.

  • The constant ADDRESS_WRAPPED_NATIVE is used in multiple test files, confirming consistent application.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify consistent usage of ADDRESS_WRAPPED_NATIVE across the codebase.
rg --type solidity 'ADDRESS_WRAPPED_NATIVE'

Length of output: 76


Script:

#!/bin/bash
# Find Solidity files and search for ADDRESS_WRAPPED_NATIVE within them.
fd --extension sol | xargs rg 'ADDRESS_WRAPPED_NATIVE'

Length of output: 5070


317-317: Verify New USDT Address Integration.

The new constant ADDRESS_USDT has been introduced. Ensure that it is correctly integrated and used consistently where applicable.

Verification successful

New USDT Address Integration Verified

The new constant ADDRESS_USDT is correctly integrated and used consistently across the codebase. It appears in various test scenarios, indicating thorough integration.

  • Files with ADDRESS_USDT usage:
    • test/solidity/utils/TestBase.sol
    • test/solidity/Facets/AmarokFacetPacked.t.sol
    • test/solidity/Facets/SquidFacet.t.sol
    • test/solidity/Facets/OmniBridgeL2Facet.t.sol
    • test/solidity/Facets/HopFacetPackedL1.t.sol
    • test/solidity/Facets/GnosisBridgeL2Facet.t.sol
    • test/solidity/Facets/CBridgeFacetPacked.t.sol
    • test/solidity/Facets/MayanFacet.t.sol
    • test/solidity/Gas/CBridgeFacetPackedETH.gas.t.sol
    • test/solidity/Facets/AcrossFacetPacked.t.sol
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify correct integration of ADDRESS_USDT across the codebase.
rg --type solidity 'ADDRESS_USDT'

Length of output: 66


Script:

#!/bin/bash
# Retry searching for ADDRESS_USDT across all files without specifying file type.
rg 'ADDRESS_USDT'

Length of output: 6966

test/solidity/utils/TestBase.sol (10)

137-137: Verify New USDT Address Integration.

The constant ADDRESS_USDT is introduced. Ensure that it is correctly integrated and used consistently where applicable.


140-140: Ensure Consistent Naming for Wrapped Native Address.

The constant ADDRESS_WRAPPED_NATIVE replaces ADDRESS_WETH. Verify that this renaming is consistent throughout the codebase to avoid any discrepancies.


269-269: Addition of USDT Token Variable.

The usdt variable is initialized with ADDRESS_USDT. Ensure that this initialization is correct and consistent with the intended token usage.


281-281: Verify New USDT Address Integration.

The deal function uses ADDRESS_USDT. Ensure that this usage is consistent with the new address integration.


384-384: Ensure Consistent Naming for Wrapped Native Address.

The constant ADDRESS_WRAPPED_NATIVE is used here. Ensure that this naming is consistently applied across the entire codebase.


418-418: Ensure Consistent Naming for Wrapped Native Address.

The constant ADDRESS_WRAPPED_NATIVE is used here. Ensure that this naming is consistently applied across the entire codebase.


93-93: Addition of USDT Token Variable.

The usdt variable is added to handle USDT token interactions. Ensure that it is correctly initialized and used throughout the contract.

Verification successful

USDT Token Variable Initialization and Usage Verified

The usdt variable is correctly initialized and actively used across the codebase for various ERC20 token operations such as deal, safeApprove, safeTransfer, and approve. No issues found with its integration.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify initialization and usage of the usdt variable.
rg --type solidity 'usdt'

Length of output: 58


Script:

#!/bin/bash
# Find all instances of the 'usdt' variable in Solidity files.
fd --extension sol --exec rg 'usdt' {}

Length of output: 1811


15-16: Review Integration of LibAccess.

The LibAccess library is imported. Ensure that it is used appropriately within the contract to enhance access control.


216-240: Review Address Overwriting Logic for Non-Mainnet Forks.

The _overwriteAddressesForNonMainnetForks function updates token addresses based on the RPC URL. Ensure that the logic correctly identifies the network and updates addresses appropriately.

Verification successful

Review Address Overwriting Logic for Non-Mainnet Forks Verified

The _overwriteAddressesForNonMainnetForks function correctly identifies the network based on the customRpcUrlForForking and updates the token addresses appropriately for Arbitrum and Polygon. No issues found with the current implementation.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the logic in _overwriteAddressesForNonMainnetForks function.
rg --type solidity '_overwriteAddressesForNonMainnetForks'

Length of output: 91


Script:

#!/bin/bash
# Use ast-grep to find the _overwriteAddressesForNonMainnetForks function in Solidity files.
ast-grep --lang solidity --pattern 'function _overwriteAddressesForNonMainnetForks() { $$$ }'

Length of output: 212


Script:

#!/bin/bash
# Use rg to find the _overwriteAddressesForNonMainnetForks function in the codebase without specifying a file type.
rg 'function _overwriteAddressesForNonMainnetForks' -A 20

Length of output: 1767


244-261: Ensure Proper Initialization in initTestBase.

The initTestBase function now calls _overwriteAddressesForNonMainnetForks. Verify that this initialization is correctly setting up the environment for tests.

Verification successful

Initialization in initTestBase is Correctly Configured

The _overwriteAddressesForNonMainnetForks function is effectively setting up the environment for non-mainnet forks by adjusting addresses based on the customRpcUrlForForking. This ensures that tests are correctly configured for different network environments. No issues found with the initialization process.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the initialization process in initTestBase function.
rg --type solidity 'initTestBase'

Length of output: 66


Script:

#!/bin/bash
# Search for the initTestBase function in all Solidity files.
rg 'initTestBase' --glob '*.sol' -A 10

Length of output: 45652


Script:

#!/bin/bash
# Search for the definition of the _overwriteAddressesForNonMainnetForks function in Solidity files.
rg '_overwriteAddressesForNonMainnetForks' --glob '*.sol' -A 10

Length of output: 1905

test/solidity/Facets/HopFacetPackedL1.t.sol (11)

25-25: Refactor to Use TestBase.

The contract now inherits from TestBase. Ensure that all necessary functionalities from Test and DiamondTest are covered by TestBase.


126-127: Verify New USDT and USDC Address Integration.

The constants ADDRESS_USDC and ADDRESS_USDT are used here. Ensure that these addresses are correctly integrated and consistent with the new naming conventions.


178-178: Verify New USDC Address Integration.

The constant ADDRESS_USDC is used here. Ensure that this usage is consistent with the new address integration.


196-196: Verify New USDT Address Integration.

The constant ADDRESS_USDT is used here. Ensure that this usage is consistent with the new address integration.


204-205: Set Facet Address in TestBase.

The setFacetAddressInTestBase function is called to register the facet address. Ensure that this enhances the organization and accessibility of facet addresses during testing.


321-321: Verify New USDC Address Integration.

The constant ADDRESS_USDC is used here. Ensure that this usage is consistent with the new address integration.


338-338: Verify New USDC Address Integration.

The constant ADDRESS_USDC is used here. Ensure that this usage is consistent with the new address integration.


385-385: Verify New USDT Address Integration.

The constant ADDRESS_USDT is used here. Ensure that this usage is consistent with the new address integration.


402-402: Verify New USDT Address Integration.

The constant ADDRESS_USDT is used here. Ensure that this usage is consistent with the new address integration.


65-67: Update Setup Logic.

The setUp function now sets customBlockNumberForForking directly. Ensure that this change correctly initializes the test environment.

Verification successful

Setup Logic Verified

The setUp function in test/solidity/Facets/HopFacetPackedL1.t.sol correctly initializes customBlockNumberForForking as intended. No further issues were found with the setup logic.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the setup logic in the setUp function.
rg --type solidity 'setUp'

Length of output: 59


Script:

#!/bin/bash
# Correctly search for the setUp function in Solidity files with the .sol extension.
rg 'setUp' --glob '*.sol' -A 5

Length of output: 30402


8-8: Refactor to Use TestBase.

The contract now inherits from TestBase. Ensure that all necessary functionalities from Test and DiamondTest are covered by TestBase.

Verification successful

Refactor to Use TestBase Verified.

The TestBase contract inherits from Test, DiamondTest, and ILiFi, ensuring that all necessary functionalities are covered. The refactoring is consistent with the intended design. No issues found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the functionalities covered by TestBase.
rg --type solidity 'contract TestBase'

Length of output: 73


Script:

#!/bin/bash
# Find all Solidity files and search for the contract TestBase definition.
fd -e sol -x rg 'contract TestBase' {}

Length of output: 145

test/solidity/Facets/AcrossFacetPacked.t.sol (2)

72-72: Update createDiamond Function Call.

The createDiamond function now includes parameters for USER_DIAMOND_OWNER and USER_PAUSER. Ensure that these parameters are correctly passed and utilized in the function.


76-81: Verify Use of Wrapped Native Address.

The ADDRESS_WRAPPED_NATIVE is used in the AcrossFacetPacked instantiation. Ensure that this address is correctly integrated and consistent with the new naming conventions.

script/scriptMaster.sh (3)

30-30: Implement Signal Handling for Graceful Termination.

The trap command is added to handle SIGINT, ensuring that cleanupBackgroundJobs is called. Verify that this enhances the script's robustness during interruptions.


103-109: Update Menu Options for User Interaction.

The menu options are updated to include a new emergency option. Ensure that the options are correctly numbered and that the corresponding actions are correctly mapped.


280-289: Implement Emergency Option for Diamond Management.

The new emergency option allows users to remove a facet or pause the whole diamond. Ensure that the diamondEMERGENCYPause function is correctly implemented and enhances emergency management.

test/solidity/Facets/StargateFacetV2.t.sol (2)

Line range hint 345-359: Update asset address references for clarity and consistency.

The change from ADDRESS_WETH to ADDRESS_WRAPPED_NATIVE aligns with the standardization of address references, improving code clarity and reducing potential errors.


Line range hint 583-615: Update asset address references for clarity and consistency.

The change from ADDRESS_WETH to ADDRESS_WRAPPED_NATIVE aligns with the standardization of address references, improving code clarity and reducing potential errors.

test/solidity/Facets/GenericSwapFacetV3.t.sol (3)

10-10: Consolidate imports for improved maintainability.

The consolidation of imports into a single statement from TestBase simplifies the import structure, enhancing maintainability.


43-43: Streamline contract inheritance for better maintainability.

The shift to inherit from TestBase instead of multiple contracts simplifies the testing framework, potentially reducing complexity and improving maintainability.


172-173: Update asset address references for clarity and consistency.

The changes to use standardized address constants (ADDRESS_USDC, ADDRESS_DAI, etc.) improve clarity and reduce the risk of errors related to address management.

Also applies to: 186-187, 223-224, 282-283, 403-404, 444-445, 471-472, 485-485, 520-520, 563-563, 674-674, 724-725, 739-739, 768-768, 802-802, 830-830, 892-892, 932-933, 946-947, 962-963, 972-973, 1008-1009, 1052-1053, 1138-1138, 1190-1190, 1231-1232, 1246-1246, 1260-1261, 1270-1271, 1302-1302, 1337-1337, 1615-1616, 1629-1629, 1659-1659, 1694-1694, 1738-1739, 1755-1756, 1768-1768, 1804-1804, 1841-1841, 1942-1943, 1948-1949, 2010-2011, 2029-2029, 2036-2037, 2042-2043, 2099-2100, 2106-2106, 2157-2158, 2164-2164

script/helperFunctions.sh (3)

2110-2110: LGTM! Local variable declaration improves scope management.

Declaring MESSAGE as a local variable is a good practice to avoid potential conflicts with global variables.


2126-2128: LGTM! The success function enhances user feedback.

This function provides a consistent way to display success messages, aligning with other logging functions.


3523-3529: LGTM! The cleanupBackgroundJobs function is effective.

This function efficiently handles the termination of background jobs and script exit.

deployments/_deployments_log_file.json (2)

22458-22471: Verify the deployment details for polygon.

Ensure that the address 0x6DCDA5EEb0eb10D61eB9AAF93C3B89704955dA42 is correct and corresponds to the intended deployment. The VERIFIED status is set to false, indicating that the deployment has not been verified. Confirm that this status is accurate and update it once verification is complete. The timestamp format appears consistent, but double-check for uniformity across all entries.


22472-22485: Verify the deployment details for bsc.

Ensure that the address 0xf03AFcA857918BE01EBD6C6800Fc2974b8a9eBA2 is correct and corresponds to the intended deployment. The VERIFIED status is set to false, indicating that the deployment has not been verified. Confirm that this status is accurate and update it once verification is complete. The timestamp format appears consistent, but double-check for uniformity across all entries.

test/solidity/Helpers/SwapperV2.t.sol (3)

6-7: Consolidate imports for clarity.

The imports have been consolidated into a single line, which enhances readability and reduces redundancy. Ensure that all imported modules are necessary and used within the file.


43-43: Modified diamond initialization.

The diamond variable is now initialized with USER_DIAMOND_OWNER and USER_PAUSER. Ensure these parameters are correctly defined and used throughout the tests.

Verify the definitions of USER_DIAMOND_OWNER and USER_PAUSER using the following script:

Verification successful

Definitions of USER_DIAMOND_OWNER and USER_PAUSER are correct and consistent.

The constants USER_DIAMOND_OWNER and USER_PAUSER are defined and used consistently across the codebase, confirming their correct initialization in the diamond variable. No issues found with their definitions or usage.

  • USER_PAUSER is defined as address(0xdeadbeef).
  • USER_DIAMOND_OWNER is defined as address(0x123456).
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the definitions of `USER_DIAMOND_OWNER` and `USER_PAUSER`.

# Test: Search for the definitions of `USER_DIAMOND_OWNER` and `USER_PAUSER`.
rg --type solidity 'USER_DIAMOND_OWNER|USER_PAUSER'

Length of output: 86


Script:

#!/bin/bash
# Description: Verify the definitions of `USER_DIAMOND_OWNER` and `USER_PAUSER`.

# Test: Search for the definitions of `USER_DIAMOND_OWNER` and `USER_PAUSER` in all files.
rg 'USER_DIAMOND_OWNER|USER_PAUSER'

Length of output: 6892


38-38: Inheritance change to TestBase.

The SwapperV2Test contract now inherits from TestBase instead of DSTest and DiamondTest. Ensure that TestBase provides all necessary functionalities previously covered by the other two contracts.

Verify the functionalities provided by TestBase using the following script:

Verification successful

Inheritance change to TestBase verified.

The TestBase contract imports DSTest and inherits from DiamondTest, suggesting it covers the functionalities provided by both DSTest and DiamondTest. Therefore, the change in inheritance for SwapperV2Test should not result in any loss of functionality.

  • TestBase is defined in test/solidity/utils/TestBase.sol and imports DSTest.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the functionalities provided by `TestBase`.

# Test: Search for the `TestBase` contract definition.
ast-grep --lang solidity --pattern $'contract TestBase { $$$ }'

Length of output: 181


Script:

#!/bin/bash
# Search for the `TestBase` contract definition in Solidity files
rg 'contract TestBase' -A 20 --glob '*.sol'

# Search for any imports or dependencies related to `TestBase`
rg 'import' --glob '*.sol'

Length of output: 127032


Script:

#!/bin/bash
# Search for the `DSTest` contract definition in Solidity files
rg 'contract DSTest' -A 20 --glob '*.sol'

# Check if `TestBase` or its dependencies provide similar functionalities
rg 'DSTest' --glob '*.sol'

Length of output: 2410

archive/test/DeBridgeDlnFacet.t.sol (1)

122-122: Update to ADDRESS_WRAPPED_NATIVE.

The first element of the path array has been changed from ADDRESS_WETH to ADDRESS_WRAPPED_NATIVE. Ensure that this change aligns with the intended use of wrapped native tokens in the swap operation.

Verify the definition of ADDRESS_WRAPPED_NATIVE using the following script:

Verification successful

Change to ADDRESS_WRAPPED_NATIVE is consistent with intended use.

The ADDRESS_WRAPPED_NATIVE is defined and used consistently across the codebase, with specific addresses assigned for different environments. This change aligns with the intended use of wrapped native tokens in the swap operation.

  • test/solidity/utils/TestBase.sol: Definition and usage as an internal address variable.
  • test/solidity/Facets/OmniBridgeL2Facet.t.sol: Example of specific address assignment.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the definition of `ADDRESS_WRAPPED_NATIVE`.

# Test: Search for the definition of `ADDRESS_WRAPPED_NATIVE`.
rg --type solidity 'ADDRESS_WRAPPED_NATIVE'

Length of output: 76


Script:

#!/bin/bash
# Description: Verify the definition of `ADDRESS_WRAPPED_NATIVE`.

# Test: Search for the definition of `ADDRESS_WRAPPED_NATIVE` in all files.
rg 'ADDRESS_WRAPPED_NATIVE'

Length of output: 5043

test/solidity/Facets/CBridge.t.sol (1)

135-135: Update to ADDRESS_WRAPPED_NATIVE.

The first element of the path array has been changed from ADDRESS_WETH to ADDRESS_WRAPPED_NATIVE. Ensure that this change aligns with the intended use of wrapped native tokens in the swap operation.

Verify the definition of ADDRESS_WRAPPED_NATIVE using the following script:

Verification successful

Change to ADDRESS_WRAPPED_NATIVE Verified

The change from ADDRESS_WETH to ADDRESS_WRAPPED_NATIVE aligns with the intended use of wrapped native tokens in swap operations. The definition and usage of ADDRESS_WRAPPED_NATIVE in the codebase confirm its role as a wrapped native token address.

  • ADDRESS_WRAPPED_NATIVE is defined as an internal address and used consistently across the codebase.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the definition of `ADDRESS_WRAPPED_NATIVE`.

# Test: Search for the definition of `ADDRESS_WRAPPED_NATIVE`.
rg --type solidity 'ADDRESS_WRAPPED_NATIVE'

Length of output: 76


Script:

#!/bin/bash
# Description: Verify the definition of `ADDRESS_WRAPPED_NATIVE`.

# Find all Solidity files and search for the definition of `ADDRESS_WRAPPED_NATIVE`.
fd --extension sol --exec rg 'ADDRESS_WRAPPED_NATIVE' {}

Length of output: 2735

test/solidity/Facets/GnosisBridgeL2Facet.t.sol (2)

37-37: Addition of ADDRESS_USDT.

A new constant ADDRESS_USDT has been added. Ensure that this address is correct and used appropriately within the contract.

Verify the usage of ADDRESS_USDT using the following script:

Verification successful

Usage of ADDRESS_USDT Verified

The constant ADDRESS_USDT is used extensively across multiple test files, indicating its role in various test scenarios. The address appears to be used for setting up test conditions, labeling, and interacting with ERC20 contracts. Ensure that the address 0x4ECaBa5870353805a9F068101A40E0f32ed605C6 is correct for the intended network and context.

  • Files where ADDRESS_USDT is used:
    • test/solidity/utils/TestBase.sol
    • test/solidity/Gas/CBridgeFacetPackedETH.gas.t.sol
    • test/solidity/Facets/SquidFacet.t.sol
    • test/solidity/Facets/MayanFacet.t.sol
    • test/solidity/Facets/HopFacetPackedL1.t.sol
    • test/solidity/Facets/CBridgeFacetPacked.t.sol
    • test/solidity/Facets/AcrossFacetPacked.t.sol
    • test/solidity/Facets/AmarokFacetPacked.t.sol
    • test/solidity/Facets/GnosisBridgeL2Facet.t.sol
    • test/solidity/Facets/OmniBridgeL2Facet.t.sol
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `ADDRESS_USDT`.

# Test: Search for the usage of `ADDRESS_USDT`.
rg --type solidity 'ADDRESS_USDT'

Length of output: 66


Script:

#!/bin/bash
# Description: Verify the usage of `ADDRESS_USDT` in Solidity files.

# Test: Search for the usage of `ADDRESS_USDT` in `.sol` files.
rg 'ADDRESS_USDT' --glob '*.sol' -A 2

Length of output: 19350


39-39: Renaming to ADDRESS_WRAPPED_NATIVE.

The constant ADDRESS_WETH has been renamed to ADDRESS_WRAPPED_NATIVE. Ensure that this change aligns with the intended use of wrapped native tokens across the contract.

Verify the usage of ADDRESS_WRAPPED_NATIVE using the following script:

docs/EmergencyPauseFacet.md Outdated Show resolved Hide resolved
test/solidity/Facets/GenericSwapFacet.t.sol Show resolved Hide resolved
script/tasks/diamondEMERGENCYPauseGitHub.sh Outdated Show resolved Hide resolved
script/tasks/diamondEMERGENCYPause.sh Outdated Show resolved Hide resolved
script/tasks/diamondEMERGENCYPause.sh Show resolved Hide resolved
script/tasks/diamondEMERGENCYPause.sh Show resolved Hide resolved
script/tasks/diamondEMERGENCYPause.sh Show resolved Hide resolved
script/tasks/diamondEMERGENCYPause.sh Show resolved Hide resolved
src/Facets/EmergencyPauseFacet.sol Outdated Show resolved Hide resolved
script/helperFunctions.sh Show resolved Hide resolved
@0xDEnYO 0xDEnYO marked this pull request as draft August 27, 2024 04:24
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: 3

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 77441a0 and d5c7244.

Files selected for processing (1)
  • src/Facets/EmergencyPauseFacet.sol (1 hunks)
Additional comments not posted (4)
src/Facets/EmergencyPauseFacet.sol (4)

10-14: Documentation and Versioning

The contract is well-documented with @title, @author, @notice, @custom:version, and @dev annotations. This helps in understanding the purpose and scope of the contract. The versioning is also clearly stated, which is crucial for maintaining contract versions and ensuring compatibility.


25-28: Immutable Storage Variables

The use of immutable for pauserWallet and _emergencyPauseFacetAddress is appropriate as these should not change once the contract is deployed. This is a good practice as it saves gas and ensures contract integrity.


52-75: Critical Function: removeFacet

This function allows the removal of a facet from the diamond, which is a sensitive operation. The function is protected by the OnlyPauserWalletOrOwner modifier, which is appropriate. The checks against empty selectors and the prevention of removing the DiamondCutFacet are well-implemented. Emitting an event after the removal is a good practice for auditability.


227-230: Fallback Function for Paused State

The fallback function is designed to revert with a DiamondIsPaused error when the diamond is paused. This is a critical feature for informing users about the paused state of the contract. The implementation is straightforward and effective.

src/Facets/EmergencyPauseFacet.sol Outdated Show resolved Hide resolved
src/Facets/EmergencyPauseFacet.sol Outdated Show resolved Hide resolved
src/Facets/EmergencyPauseFacet.sol Outdated Show resolved Hide resolved
ezynda3
ezynda3 previously approved these changes Oct 8, 2024
Copy link
Contributor

@ezynda3 ezynda3 left a comment

Choose a reason for hiding this comment

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

All good!

ezynda3
ezynda3 previously approved these changes Oct 8, 2024
Copy link
Contributor

@ezynda3 ezynda3 left a comment

Choose a reason for hiding this comment

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

APPROVED!!!!!

@0xDEnYO 0xDEnYO marked this pull request as draft October 8, 2024 08:43
auto-merge was automatically disabled October 8, 2024 08:43

Pull request was converted to draft

ezynda3
ezynda3 previously approved these changes Oct 8, 2024
@0xDEnYO 0xDEnYO marked this pull request as ready for review October 8, 2024 08:43
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.

3 participants