-
Notifications
You must be signed in to change notification settings - Fork 51
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
Conversation
There was a problem hiding this 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?
no, sujith will check it this or next week |
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 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. WalkthroughThe 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
Possibly related PRs
Suggested labels
Suggested reviewers
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 itsrun
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
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
andFunctionDoesNotExist
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 ofinitTestBase()
enhances the modularity and maintainability of the test setup.src/Libraries/LibDiamondLoupe.sol (3)
29-36
: Ensure comprehensive test coverage forfacetFunctionSelectors
.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 forfacetAddresses
.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 forfacetAddress
.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 theEmergencyPauseFacet
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 forEmergency Pause Facet
.Ensure that the link to
EmergencyPauseFacet.md
is correct and the documentation file exists.
18-18
: Verify the link forGeneric Swap FacetV3
.Ensure that the link to
GenericSwapFacetV3.md
is correct and the documentation file exists.
35-35
: Verify the link forStargate FacetV2
.Ensure that the link to
StargateFacetV2.md
is correct and the documentation file exists.
60-60
: Verify the link forLiFuelFeeCollector
.Ensure that the link to
LiFuelFeeCollector.md
is correct and the documentation file exists.
62-62
: Verify the link forReceiverStargateV2
.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
: EnsureinitTestBase
correctly sets up the test environment.The
setUp
function now callsinitTestBase
. Verify that this method initializes the test environment as expected and that all necessary components are correctly configured.
36-36
: LGTM! EnsuresetFacetAddressInTestBase
is correctly implemented.The
setFacetAddressInTestBase
method is used to register theAccessManagerFacet
. Ensure that this function is correctly implemented and that it registers the facet as intended.test/solidity/Gas/Hop.t.sol (3)
17-19
: EnsurecustomBlockNumberForForking
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! EnsureADDRESS_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! EnsuresetFacetAddressInTestBase
is correctly implemented.The
setFacetAddressInTestBase
method is used to register theHopFacet
. Ensure that this function is correctly implemented and that it registers the facet as intended.deployments/polygon.staging.json (1)
43-43
: Addition ofEmergencyPauseFacet
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 ofADDRESS_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 ofADDRESS_WETH
toADDRESS_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
andUSER_DIAMOND_OWNER
have been introduced, improving clarity and configurability in the test setup.
46-46
: Use ofvm.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 ofEmergencyPauseFacet
.The import of
EmergencyPauseFacet
is a key enhancement, providing emergency management capabilities to the diamond.
16-19
: Modification ofcreateDiamond
function parameters.The function now accepts
_diamondOwner
and_pauserWallet
, enhancing configurability and control over diamond operations.
25-27
: Instantiation ofEmergencyPauseFacet
.The
EmergencyPauseFacet
is instantiated with_pauserWallet
, adding emergency control capabilities to the diamond.
88-100
: Addition ofEmergencyPauseFacet
function selectors.The function selectors for
EmergencyPauseFacet
are correctly added, enabling pause and unpause functionalities.
106-106
: Use ofvm.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 insetUp
.The integration of
customBlockNumberForForking
andcustomRpcUrlForForking
into thesetUp
function simplifies the forking setup process. This change enhances maintainability by centralizing configuration.
87-87
: Use ofADDRESS_USDC
for consistency.The replacement of
USDC_ADDRESS
withADDRESS_USDC
ensures consistency in naming conventions across the codebase. This change improves clarity and reduces potential confusion.
100-104
: Set facet address inTestBase
.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 toTestBase
for streamlined testing.The inheritance from
TestBase
instead ofTest
andDiamondTest
indicates a shift towards a more unified testing framework. Ensure that all necessary functionalities from the previous base contracts are covered byTestBase
.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 bothTest
andDiamondTest
, 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 theusdc
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 asERC20(ADDRESS_USDC)
, ensuring that it represents the USDC token correctly. The approval process usingADDRESS_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 toTestBase
is appropriate.Switching to
TestBase
likely standardizes test setups. Ensure that all necessary initializations fromDSTest
andDiamondTest
are covered inTestBase
.
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 inTestBase
.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 toTestBase
is appropriate.Switching to
TestBase
and renamingdiamond
tomockDiamond
helps clarify the test's intent. Ensure thatmockDiamond
accurately simulates the diamond contract's behavior.
76-79
: Parameterize diamond creation.The addition of
USER_DIAMOND_OWNER
andUSER_PAUSER
parameters increateDiamond
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
andUSER_PAUSER
increateDiamond
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 inOptimizedFacet
.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 theLibDiamond.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 includesUSER_DIAMOND_OWNER
andUSER_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 includesUSER_DIAMOND_OWNER
andUSER_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 includesUSER_DIAMOND_OWNER
andUSER_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 includesUSER_DIAMOND_OWNER
andUSER_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 ofADDRESS_WRAPPED_NATIVE
Usage.The change from
ADDRESS_WETH
toADDRESS_WRAPPED_NATIVE
impacts the token used in the_getValidLzComposeCalldata
function. Verify thatADDRESS_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
VerifiedThe
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 increateDiamond
.The addition of
owner
andpauser
parameters to thecreateDiamond
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
ParametersThe
createDiamond
function consistently usesUSER_DIAMOND_OWNER
andUSER_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 ofADDRESS_WRAPPED_NATIVE
in Swap Path.The change from
ADDRESS_WETH
toADDRESS_WRAPPED_NATIVE
in the swap path affects token swaps. Ensure thatADDRESS_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 insetUp
.The initialization of
customBlockNumberForForking
andcustomRpcUrlForForking
followed byinitTestBase()
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 VerifiedThe
setUp
function inHopFacetPackedL2.t.sol
correctly initializescustomBlockNumberForForking
,customRpcUrlForForking
, and callsinitTestBase()
. This setup aligns with the intended test environment setup as described in the review comment.
customBlockNumberForForking
is set to58467500
.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 fromTestBase
, 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 insetUp
.The initialization of
customBlockNumberForForking
and the call toinitTestBase()
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 ImplementedThe
setUp
function inCBridgeAndFeeCollection.t.sol
correctly initializescustomBlockNumberForForking
and callsinitTestBase()
. This setup aligns with the intended test environment as specified in the review comment.
customBlockNumberForForking
is set to14847528
.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.solLength of output: 13904
test/solidity/Facets/SymbiosisFacet.t.sol (1)
146-146
: Verify the correctness of asset replacement.The replacement of
ADDRESS_WETH
withADDRESS_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 useTestBase
.The transition to using
TestBase
instead ofTest
andDiamondTest
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 SuccessfullyThe refactoring to use
TestBase
instead ofTest
andDiamondTest
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
andUSDC_ADDRESS
withADDRESS_USDT
andADDRESS_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
andADDRESS_USDC
across the codebase:Also applies to: 128-128, 136-137
Verification successful
Consistent Naming of Address Variables Verified
The usage of
ADDRESS_USDT
andADDRESS_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
andADDRESS_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
withADDRESS_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
toADDRESS_WRAPPED_NATIVE
is consistent across the codebase. The usage ofADDRESS_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 5Length of output: 25628
381-381
: Verify removal ofFeeCollector
.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
withADDRESS_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 includeUSER_DIAMOND_OWNER
andUSER_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 ofUSER_DIAMOND_OWNER
andUSER_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 invm.startPrank
, indicating its role in ownership setup.- The
_pauserWallet
is used in theEmergencyPauseFacet
, 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 thedeal
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
replacesADDRESS_WETH
. Verify that this renaming is consistent throughout the codebase to avoid any discrepancies.Verification successful
Consistent Usage of
ADDRESS_WRAPPED_NATIVE
VerifiedThe renaming of
ADDRESS_WETH
toADDRESS_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
replacesADDRESS_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 withADDRESS_USDT
. Ensure that this initialization is correct and consistent with the intended token usage.
281-281
: Verify New USDT Address Integration.The
deal
function usesADDRESS_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 asdeal
,safeApprove
,safeTransfer
, andapprove
. 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 ofLibAccess
.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 thecustomRpcUrlForForking
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 20Length of output: 1767
244-261
: Ensure Proper Initialization ininitTestBase
.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 ConfiguredThe
_overwriteAddressesForNonMainnetForks
function is effectively setting up the environment for non-mainnet forks by adjusting addresses based on thecustomRpcUrlForForking
. 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 10Length of output: 45652
Script:
#!/bin/bash # Search for the definition of the _overwriteAddressesForNonMainnetForks function in Solidity files. rg '_overwriteAddressesForNonMainnetForks' --glob '*.sol' -A 10Length of output: 1905
test/solidity/Facets/HopFacetPackedL1.t.sol (11)
25-25
: Refactor to UseTestBase
.The contract now inherits from
TestBase
. Ensure that all necessary functionalities fromTest
andDiamondTest
are covered byTestBase
.
126-127
: Verify New USDT and USDC Address Integration.The constants
ADDRESS_USDC
andADDRESS_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 setscustomBlockNumberForForking
directly. Ensure that this change correctly initializes the test environment.Verification successful
Setup Logic Verified
The
setUp
function intest/solidity/Facets/HopFacetPackedL1.t.sol
correctly initializescustomBlockNumberForForking
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 5Length of output: 30402
8-8
: Refactor to UseTestBase
.The contract now inherits from
TestBase
. Ensure that all necessary functionalities fromTest
andDiamondTest
are covered byTestBase
.Verification successful
Refactor to Use
TestBase
Verified.The
TestBase
contract inherits fromTest
,DiamondTest
, andILiFi
, 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
: UpdatecreateDiamond
Function Call.The
createDiamond
function now includes parameters forUSER_DIAMOND_OWNER
andUSER_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 theAcrossFacetPacked
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 thatcleanupBackgroundJobs
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
toADDRESS_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
toADDRESS_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! Thesuccess
function enhances user feedback.This function provides a consistent way to display success messages, aligning with other logging functions.
3523-3529
: LGTM! ThecleanupBackgroundJobs
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 forpolygon
.Ensure that the address
0x6DCDA5EEb0eb10D61eB9AAF93C3B89704955dA42
is correct and corresponds to the intended deployment. TheVERIFIED
status is set tofalse
, 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 forbsc
.Ensure that the address
0xf03AFcA857918BE01EBD6C6800Fc2974b8a9eBA2
is correct and corresponds to the intended deployment. TheVERIFIED
status is set tofalse
, 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
: Modifieddiamond
initialization.The
diamond
variable is now initialized withUSER_DIAMOND_OWNER
andUSER_PAUSER
. Ensure these parameters are correctly defined and used throughout the tests.Verify the definitions of
USER_DIAMOND_OWNER
andUSER_PAUSER
using the following script:Verification successful
Definitions of
USER_DIAMOND_OWNER
andUSER_PAUSER
are correct and consistent.The constants
USER_DIAMOND_OWNER
andUSER_PAUSER
are defined and used consistently across the codebase, confirming their correct initialization in thediamond
variable. No issues found with their definitions or usage.
USER_PAUSER
is defined asaddress(0xdeadbeef)
.USER_DIAMOND_OWNER
is defined asaddress(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 toTestBase
.The
SwapperV2Test
contract now inherits fromTestBase
instead ofDSTest
andDiamondTest
. Ensure thatTestBase
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 importsDSTest
and inherits fromDiamondTest
, suggesting it covers the functionalities provided by bothDSTest
andDiamondTest
. Therefore, the change in inheritance forSwapperV2Test
should not result in any loss of functionality.
TestBase
is defined intest/solidity/utils/TestBase.sol
and importsDSTest
.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 toADDRESS_WRAPPED_NATIVE
.The first element of the
path
array has been changed fromADDRESS_WETH
toADDRESS_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 toADDRESS_WRAPPED_NATIVE
.The first element of the
path
array has been changed fromADDRESS_WETH
toADDRESS_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
VerifiedThe change from
ADDRESS_WETH
toADDRESS_WRAPPED_NATIVE
aligns with the intended use of wrapped native tokens in swap operations. The definition and usage ofADDRESS_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 ofADDRESS_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
VerifiedThe 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 address0x4ECaBa5870353805a9F068101A40E0f32ed605C6
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 2Length of output: 19350
39-39
: Renaming toADDRESS_WRAPPED_NATIVE
.The constant
ADDRESS_WETH
has been renamed toADDRESS_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:
There was a problem hiding this 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
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 VersioningThe 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 VariablesThe 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: removeFacetThis 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 theDiamondCutFacet
are well-implemented. Emitting an event after the removal is a good practice for auditability.
227-230
: Fallback Function for Paused StateThe 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
APPROVED!!!!!
Which Jira task belongs to this PR?
Why did I implement it this way?
Checklist before requesting a review
Checklist for reviewer (DO NOT DEPLOY and contracts BEFORE CHECKING THIS!!!)