Skip to content

feat: Use LayerZeroLib in Foreign Controller (DEV-1142)#231

Merged
lucas-manuel merged 5 commits intodevfrom
dev-1142-fc-use-lzlib
Jan 29, 2026
Merged

feat: Use LayerZeroLib in Foreign Controller (DEV-1142)#231
lucas-manuel merged 5 commits intodevfrom
dev-1142-fc-use-lzlib

Conversation

@supercontracts
Copy link
Collaborator

@supercontracts supercontracts commented Jan 29, 2026

Summary by CodeRabbit

  • Refactor
    • Consolidated LayerZero token transfer logic into a dedicated library for improved code organization and maintainability
    • Streamlined transfer process with simplified error messaging

✏️ Tip: You can customize this high-level summary in your review settings.

@notion-workspace
Copy link

@octane-security-app
Copy link

Summary by Octane

New Contracts

No new contracts were added.

Updated Contracts

  • ForeignController.sol: Integrated LayerZeroLib for LayerZero transfer functionality, centralizing logic and simplifying the contract.
  • LayerZeroLib.sol: Removed "MC/" prefix in error message string for recipient-not-set.

🔗 Commit Hash: 9e972e1

@coderabbitai
Copy link

coderabbitai bot commented Jan 29, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review

Walkthrough

The pull request refactors LayerZero token transfer functionality by consolidating logic from ForeignController into LayerZeroLib. In-contract transfer operations are replaced with a single library call, and the LIMIT_LAYERZERO_TRANSFER constant now references the library's definition. Associated test expectations are updated to reflect simplified error messages.

Changes

Cohort / File(s) Summary
ForeignController refactoring
src/ForeignController.sol
Replaced in-contract LayerZero transfer logic with LayerZeroLib.transferTokenLayerZero call; removed per-call rate-limiting and preparation steps; updated LIMIT_LAYERZERO_TRANSFER to source from library constant.
Library and test updates
src/libraries/LayerZeroLib.sol, test/mainnet-fork/LayerZero.t.sol
Simplified error message from "MC/recipient-not-set" and "FC/recipient-not-set" to generic "recipient-not-set" across library and test expectations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • deluca-mike
  • lucas-manuel

Poem

🐰 Hops through code with glee!
Logic bundled, clean and free,
Library calls sing sweet and clear,
Transfer flows—no more to fear!
✨ Consolidation magic here!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: integrating LayerZeroLib into the ForeignController contract, and includes the JIRA key (DEV-1142) as required.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev-1142-fc-use-lzlib

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • DEV-1142: Entity not found: Issue - Could not find referenced Issue.

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 29, 2026
@octane-security-app
Copy link

Overview

Vulnerabilities found: 2                                                                                

🔗 Commit Hash: 9e972e1
🛡️ Octane Dashboard: All vulnerabilities

);

require(layerZeroRecipient != bytes32(0), "MC/recipient-not-set");
require(layerZeroRecipient != bytes32(0), "recipient-not-set");
Copy link
Contributor

Choose a reason for hiding this comment

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

"LayerZeroLib/recipient-not-set"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changed

@github-actions
Copy link

Coverage after merging dev-1142-fc-use-lzlib into dev will be

99.52%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
deploy
   ControllerDeploy.sol100%100%100%100%
   ForeignControllerInit.sol100%100%100%100%
   MainnetControllerInit.sol97.37%93.33%100%100%152, 90
src
   ALMProxy.sol100%100%100%100%
   ALMProxyFreezable.sol100%100%100%100%
   ForeignController.sol96.08%89.66%95.65%98.02%130–131, 131, 131, 551
   MainnetController.sol99.18%100%98.36%99.24%596–597
   OTCBuffer.sol100%100%100%100%
   RateLimitHelpers.sol100%100%100%100%
   RateLimits.sol100%100%100%100%
   WEETHModule.sol92.86%75%100%100%29, 41
src/libraries
   AaveLib.sol100%100%100%100%
   ApproveLib.sol100%100%100%100%
   CCTPLib.sol100%100%100%100%
   CurveLib.sol100%100%100%100%
   ERC4626Lib.sol97.06%90%100%100%117
   LayerZeroLib.sol100%100%100%100%
   PSMLib.sol100%100%100%100%
   UniswapV4Lib.sol99.32%95.65%100%100%282
   WEETHLib.sol100%100%100%100%

@lucas-manuel lucas-manuel merged commit f7c794f into dev Jan 29, 2026
4 checks passed
@lucas-manuel lucas-manuel deleted the dev-1142-fc-use-lzlib branch January 29, 2026 14:23
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.

2 participants