Skip to content

Conversation

@0xDEnYO
Copy link
Contributor

@0xDEnYO 0xDEnYO commented Jul 16, 2025

Reverts #1275

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 16, 2025

Warning

Rate limit exceeded

@0xDEnYO has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 19 minutes and 19 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

Reviewing files that changed from the base of the PR and between 099230d and 539f209.

📒 Files selected for processing (1)
  • src/Errors/GenericErrors.sol (0 hunks)

Walkthrough

This change removes the LiFiData contract and all its constants, consolidating the NON_EVM_ADDRESS and related address constants into the LibAsset library. All references to NON_EVM_ADDRESS are updated to use LibAsset.NON_EVM_ADDRESS. Related validation logic and tests are removed or updated accordingly, and documentation is revised for accuracy.

Changes

Files / Grouped Files Change Summary
src/Helpers/LiFiData.sol Deleted the LiFiData contract and all internal constants for non-EVM addresses and chain IDs.
src/Libraries/LibAsset.sol Added NULL_ADDRESS, NON_EVM_ADDRESS, and NATIVE_ASSETID constants; updated isNativeAsset logic to use NATIVE_ASSETID. Version annotation changed.
src/Facets/AllBridgeFacet.sol Removed LiFiData inheritance, all chain ID mapping logic, receiver validation, and related error handling. Simplified constructor and variable naming.
src/Facets/ChainflipFacet.sol, src/Facets/RelayFacet.sol Removed LiFiData inheritance and updated all references to NON_EVM_ADDRESS to use LibAsset.NON_EVM_ADDRESS. Updated version annotations and removed some constructor checks.
src/Helpers/SwapperV2.sol, src/Periphery/ReceiverChainflip.sol Changed native asset references from LibAsset.NULL_ADDRESS to LibAsset.NATIVE_ASSETID. Updated version annotations.
src/Errors/GenericErrors.sol Removed the InvalidNonEVMReceiver() error declaration.
docs/ChainflipFacet.md, conventions.md Updated documentation to reference LibAsset.NON_EVM_ADDRESS instead of NON_EVM_ADDRESS from LiFiData.
test/solidity/Facets/AllBridgeFacet.t.sol Removed tests and helpers related to chain ID mapping, receiver validation, and LiFiData. Reactivated and simplified some test functions.
test/solidity/Facets/ChainflipFacet.t.sol, test/solidity/Facets/RelayFacet.t.sol Updated all uses of NON_EVM_ADDRESS to LibAsset.NON_EVM_ADDRESS. Removed unused imports and tests, and updated contract inheritance.
test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol Removed LiFiData inheritance and updated to use LibAsset.NON_EVM_ADDRESS.
test/solidity/Periphery/ReceiverChainflip.t.sol Changed all LibAsset.NULL_ADDRESS references to LibAsset.NATIVE_ASSETID for native asset handling in tests.

Possibly related PRs

Suggested labels

AuditNotRequired

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch revert-1275-add-parameter-validation-to-allbridge-lf-14440

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this 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.

@lifi-action-bot lifi-action-bot marked this pull request as draft July 16, 2025 11:00
@mirooon mirooon marked this pull request as ready for review July 16, 2025 11:00
@lifi-action-bot
Copy link
Collaborator

lifi-action-bot commented Jul 16, 2025

🤖 GitHub Action: Security Alerts Review 🔍

🟢 Dismissed Security Alerts with Comments
The following alerts were dismissed with proper comments:

🟢 View Alert - File: src/Facets/RelayFacet.sol
🔹 Parameters passed to a constructor that are not validated for correct values may lead to contract creation in an undesired state. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/no-parameter-validation-in-constructor
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: will be introduced later

🟢 View Alert - File: src/Facets/RelayFacet.sol
🔹 Parameters passed to a constructor that are not validated for correct values may lead to contract creation in an undesired state. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/no-parameter-validation-in-constructor
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: will be introduced later

🟢 View Alert - File: src/Facets/AllBridgeFacet.sol
🔹 Parameters passed to a constructor that are not validated for correct values may lead to contract creation in an undesired state. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/no-parameter-validation-in-constructor
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: will be introduced later

🟢 View Alert - File: src/Facets/RelayFacet.sol
🔹 Performing a narrowing downcast may result in silent overflow due to bit truncation. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/unsafe-downcast
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: This is intended and is correct as-is

🟢 View Alert - File: src/Facets/RelayFacet.sol
🔹 Performing a narrowing downcast may result in silent overflow due to bit truncation. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/unsafe-downcast
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: This is intended and is correct as-is

🟢 View Alert - File: src/Facets/RelayFacet.sol
🔹 Performing a narrowing downcast may result in silent overflow due to bit truncation. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/unsafe-downcast
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: This is intended and is correct as-is

🟢 View Alert - File: src/Facets/AllBridgeFacet.sol
🔹 Performing a narrowing downcast may result in silent overflow due to bit truncation. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/unsafe-downcast
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: This is intended

🟢 View Alert - File: src/Facets/AllBridgeFacet.sol
🔹 Performing a narrowing downcast may result in silent overflow due to bit truncation. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/unsafe-downcast
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: This is intended

🟢 View Alert - File: src/Facets/AllBridgeFacet.sol
🔹 Unchecked zero values passed as parameters may be in error or an indication of potentially insecure code design. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/zero-as-parameter
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: Backend ensures correct calldata

🟢 View Alert - File: src/Facets/RelayFacet.sol
🔹 Making an external call without a gas budget may consume all of the transaction's gas, causing it to revert. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/call-without-gas-budget
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: We do intentionally want to forward all gas here

🟢 View Alert - File: src/Helpers/SwapperV2.sol
🔹 The value of msg.value is constant in a transaction, and will not be reapplied in a loop. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/msg-value-reuse
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: msg.value is correctly accounted for and using in the loop in this context is intentional.

🟢 View Alert - File: src/Libraries/LibAsset.sol
🔹 Calling transferFrom functionality with a parameterized from value may lead to theft or loss of tokens. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/arbitrary-transfer-from
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: This is a library and it's by design that the function is generic.

🟢 View Alert - File: src/Libraries/LibAsset.sol
🔹 The value of msg.value is constant in a transaction, and will not be reapplied in a loop. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/msg-value-reuse
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: That's fine. We do not expect msg.value to change. Also, if we deposit a native asset we will only do it once so this should be fine.

🟢 View Alert - File: src/Facets/RelayFacet.sol
🔹 Reentrant functions which emit events after making an external call may lead to out-of-order events. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/reentrancy-events
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: All public entry points to this internal functions are secured with reentrancy protection

🟢 View Alert - File: src/Facets/AllBridgeFacet.sol
🔹 Reentrant functions which emit events after making an external call may lead to out-of-order events. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/reentrancy-events
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: the function has reentrancy protection (via all its public entry points)

🟢 View Alert - File: src/Facets/RelayFacet.sol
🔹 Modifying state after making an external call may allow for reentrancy attacks. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/reentrancy
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: All public entry points to this function are reentrancy-protected

🟢 View Alert - File: src/Facets/RelayFacet.sol
🔹 Making an external call without a gas budget may consume all of the transaction's gas, causing it to revert. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/call-without-gas-budget
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: We intentionally want to forward all gas

🟢 View Alert - File: src/Helpers/TransferrableOwnership.sol
🔹 Parameters passed to a constructor that are not validated for correct values may lead to contract creation in an undesired state. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/no-parameter-validation-in-constructor
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: Since it’s a minor issue, we don’t need to validate the owner. Moreover, the contract can be marked as abstract. Newly added facets will generate similar alerts, and we will have the opportunity to validate the value before it reaches the parent contract.

🟢 View Alert - File: src/Helpers/WithdrawablePeriphery.sol
🔹 Parameters passed to a constructor that are not validated for correct values may lead to contract creation in an undesired state. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/no-parameter-validation-in-constructor
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: Since it’s a minor issue, we don’t need to validate the owner. Moreover, the contract can be marked as abstract. Newly added facets will generate similar alerts, and we will have the opportunity to validate the value before it reaches the parent contract.

🟢 View Alert - File: src/Facets/ChainflipFacet.sol
🔹 Reentrant functions which emit events after making an external call may lead to out-of-order events. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/reentrancy-events
🔹 Dismiss Reason: False positive
🔹 Dismiss Comment: This is an internal function

🟢 View Alert - File: src/Periphery/ReceiverChainflip.sol
🔹 Using a payable fallback (including receive) with no explicit functionality may indicate incomplete contract logic. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/empty-payable-fallback
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: Not gas efficient

No unresolved security alerts! 🎉

@lifi-action-bot lifi-action-bot marked this pull request as draft July 16, 2025 11:01
mirooon
mirooon previously approved these changes Jul 16, 2025
@0xDEnYO 0xDEnYO marked this pull request as ready for review July 16, 2025 11:02
@0xDEnYO 0xDEnYO enabled auto-merge (squash) July 16, 2025 11:02
@lifi-action-bot lifi-action-bot marked this pull request as draft July 16, 2025 11:02
auto-merge was automatically disabled July 16, 2025 11:02

Pull request was converted to draft

@mirooon mirooon marked this pull request as ready for review July 16, 2025 11:02
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: 1

🔭 Outside diff range comments (1)
src/Facets/RelayFacet.sol (1)

105-108: Constructor lacks parameter validation.

The constructor accepts _relayReceiver and _relaySolver parameters but doesn't validate them for zero addresses. This could lead to contract deployment in an undesired state, as flagged by the security analysis.

According to the coding guidelines, constructor inputs should be validated rigorously. Add validation to prevent zero addresses:

 constructor(address _relayReceiver, address _relaySolver) {
+    if (_relayReceiver == address(0) || _relaySolver == address(0)) {
+        revert InvalidConfig();
+    }
     relayReceiver = _relayReceiver;
     relaySolver = _relaySolver;
 }

Note: You'll need to import InvalidConfig from ../Errors/GenericErrors.sol.

@lifi-action-bot
Copy link
Collaborator

Test Coverage Report

Line Coverage: 84.20% (2239 / 2659 lines)
Function Coverage: 88.81% ( 381 / 429 functions)
Branch Coverage: 56.08% ( 304 / 542 branches)
Test coverage (84.20%) is above min threshold (83%). Check passed.

@0xDEnYO 0xDEnYO changed the title Revert "Add parameter validation to allbridge lf 14440" Revert: Add parameter validation to allbridge lf 14440 Jul 16, 2025
@0xDEnYO 0xDEnYO marked this pull request as draft July 16, 2025 11:19
@0xDEnYO 0xDEnYO marked this pull request as ready for review July 16, 2025 11:19
@lifi-action-bot lifi-action-bot changed the title Revert: Add parameter validation to allbridge lf 14440 Revert: Add parameter validation to allbridge lf 14440 [GenericErrors v1.0.2,AllBridgeFacet v2.0.0,ChainflipFacet v1.0.0,RelayFacet v1.0.0,SwapperV2 v1.0.0,LibAsset v2.1.0,ReceiverChainflip v1.0.0] Jul 16, 2025
@0xDEnYO 0xDEnYO enabled auto-merge (squash) July 16, 2025 11:19
@lifi-action-bot lifi-action-bot changed the title Revert: Add parameter validation to allbridge lf 14440 [GenericErrors v1.0.2,AllBridgeFacet v2.0.0,ChainflipFacet v1.0.0,RelayFacet v1.0.0,SwapperV2 v1.0.0,LibAsset v2.1.0,ReceiverChainflip v1.0.0] Revert: Add parameter validation to allbridge lf 14440 [GenericErrors v1.0.0,AllBridgeFacet v2.0.0,ChainflipFacet v1.0.0,RelayFacet v1.0.0,SwapperV2 v1.0.0,LibAsset v2.1.0,ReceiverChainflip v1.0.0] Jul 16, 2025
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.

4 participants