Skip to content

PolymerCCTP add support for more chains [PolymerCCTPFacet v1.1.0]#1630

Open
mirooon wants to merge 9 commits intomainfrom
polymercctp-add-support-for-more-chains-2
Open

PolymerCCTP add support for more chains [PolymerCCTPFacet v1.1.0]#1630
mirooon wants to merge 9 commits intomainfrom
polymercctp-add-support-for-more-chains-2

Conversation

@mirooon
Copy link
Contributor

@mirooon mirooon commented Feb 11, 2026

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!!!)

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

…hainId 143) and Bsc (chainId 56) in bridging logic.
@lifi-action-bot lifi-action-bot marked this pull request as draft February 11, 2026 14:22
@lifi-action-bot lifi-action-bot changed the title PolymerCCTP add support for more chains PolymerCCTP add support for more chains [PolymerCCTPFacet v1.0.1] Feb 11, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 11, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds Solana-specific routing to PolymerCCTP (new solanaReceiverATA field, validation, and recipient selection), updates domain mapping (chainId 143 → domain 15), swaps OZ ReentrancyGuard import for a local helper, adjusts deposit/mint flows to use resolved destinationChainId, updates demos/helpers for Solana, adds an audit entry, updates deployments, and extends tests.

Changes

Cohort / File(s) Summary
Facet: PolymerCCTP contract
src/Facets/PolymerCCTPFacet.sol
Added bytes32 solanaReceiverATA to PolymerCCTPData; added Solana-specific validation and mintRecipient selection; introduced local destinationChainId variable used for domain mapping; replaced OpenZeppelin ReentrancyGuard import with local helper; extended _chainIdToDomainId with 143 → 15; updated events and depositForBurn calls to use destinationChainId.
Tests
test/solidity/Facets/PolymerCCTPFacet.t.sol
Initialized new solanaReceiverATA in test data and added testRevert_SolanaDestWithZeroSolanaReceiverATA to assert invalid Solana ATA reverts; propagated field across existing test scenarios.
Demo scripts
script/demoScripts/demoPolymerCCTP.ts, script/demoScripts/demoAcrossV4.ts
Enabled Solana destination flows in demoPolymerCCTP (wallet derivation, ATA computation, payload solanaReceiverATA, environment-aware deployments); replaced dev wallet constant usage to ADDRESS_DEV_WALLET_V5.
Demo helpers
script/demoScripts/utils/demoScriptHelpers.ts
Added Solana imports and helpers computeSolanaATABytes32 and bytes32ToSolanaAddress; added ADDRESS_DEV_WALLET_SOLANA_BASE58 and ADDRESS_DEV_WALLET_V5; removed ADDRESS_DEV_WALLET_V4.
Audit log
audit/auditLog.json
Added audit20260213 entry and mapped auditedContracts.PolymerCCTPFacet version 1.0.1["audit20260213"] (preserving 1.0.0).
Deployments (staging)
deployments/arbitrum.diamond.staging.json, deployments/arbitrum.staging.json
Updated PolymerCCTPFacet address in arbitrum.staging.json; added new facet entries (PolymerCCTPFacet v2.0.0 and AcrossV4SwapFacet v1.0.0) in arbitrum.diamond.staging.json.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 1 | ❌ 3
❌ Failed checks (3 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description lacks critical details: Jira task ID and implementation rationale are empty, and key review checklists remain unchecked. Most importantly, tests were not added despite significant contract logic changes to PolymerCCTPFacet. Add Jira task reference and explain why Solana destination handling was implemented this way. Provide evidence that tests were added to cover the new solanaReceiverATA validation and Solana-specific chain routing logic before requesting review.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (12 files):

⚔️ audit/auditLog.json (content)
⚔️ config/whitelist.json (content)
⚔️ deployments/arbitrum.diamond.staging.json (content)
⚔️ deployments/arbitrum.staging.json (content)
⚔️ script/demoScripts/demoAcrossV4.ts (content)
⚔️ script/demoScripts/demoPolymerCCTP.ts (content)
⚔️ script/demoScripts/utils/demoScriptHelpers.ts (content)
⚔️ script/deploy/safe/execute-pending-timelock-tx.ts (content)
⚔️ script/deploy/safe/safe-decode-utils.ts (content)
⚔️ script/deploy/safe/safe-utils.ts (content)
⚔️ src/Facets/PolymerCCTPFacet.sol (content)
⚔️ test/solidity/Facets/PolymerCCTPFacet.t.sol (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding Solana-specific destination handling and support for additional chains (Monad/chainId 143) in PolymerCCTPFacet with version bump to 1.1.0.

✏️ 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 polymercctp-add-support-for-more-chains-2

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

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

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

@mirooon mirooon marked this pull request as ready for review February 11, 2026 14:23
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

🤖 Fix all issues with AI agents
In `@src/Facets/PolymerCCTPFacet.sol`:
- Around line 297-305: The code in PolymerCCTPFacet exposes BSC (chainId 56) as
a valid Circle domain while the facet only allows USDC (immutable USDC and
onlyAllowSourceToken), causing USDC→BSC attempts to fail; fix by removing the
BSC branch from the chain->domain mapping (the if (chainId == 56) return 17
block in the function that maps chainId to Circle domain), or alternatively add
an explicit validation in the bridging entrypoint (the function that performs
the CCTP transfer, guarded by onlyAllowSourceToken) to revert when destination
chainId == 56 to reject USDC→BSC routes; if you choose to support BSC, expand
the facet to accept USYC and update onlyAllowSourceToken/USDC handling
accordingly.

@lifi-action-bot
Copy link
Collaborator

lifi-action-bot commented Feb 11, 2026

Test Coverage Report

Line Coverage: 86.79% (2983 / 3437 lines)
Function Coverage: 90.32% ( 476 / 527 functions)
Branch Coverage: 65.54% ( 485 / 740 branches)
Test coverage (86.79%) is above min threshold (83%). Check passed.

0xDEnYO
0xDEnYO previously approved these changes Feb 12, 2026
@lifi-action-bot lifi-action-bot changed the title PolymerCCTP add support for more chains [PolymerCCTPFacet v1.0.1] PolymerCCTP add support for more chains [PolymerCCTPFacet v1.1.0] Feb 13, 2026
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: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
script/demoScripts/demoAcrossV4.ts (1)

13-37: ⚠️ Potential issue | 🟠 Major

Migrate demoAcrossV4.ts from deprecated ethers helpers to viem-based functions.

This script actively uses deprecated ethers-based helpers (getProvider, getWalletFromPrivateKeyInDotEnv, sendTransaction, ensureBalanceAndAllowanceToDiamond) across multiple locations (lines 383–384, 526–534, 701). Replace with viem equivalents already exported from demoScriptHelpers: setupEnvironment() (returns publicClient, walletAccount, lifiDiamondContract), executeTransaction(), ensureBalance(), and ensureAllowance(). See demoUnit.ts for the correct structural pattern.

🤖 Fix all issues with AI agents
In `@audit/auditLog.json`:
- Around line 542-548: The audit log entry "audit20260213" currently records
PolymerCCTPFacet v1.0.1 but the facet's `@custom`:version in the Solidity contract
is v1.1.0, causing the pipeline failure; update the auditedContracts mapping in
auditLog.json to include an entry for PolymerCCTPFacet v1.1.0 (or change the
contract's `@custom`:version to v1.0.1 if that was intended) so the key/value for
PolymerCCTPFacet in auditedContracts matches the contract's `@custom`:version and
the audit report path/commit hash reflect the correct version.

In `@script/demoScripts/demoPolymerCCTP.ts`:
- Around line 68-87: The code currently uses LIFI_AND_POLYMER_CHAIN_ID_SOLANA
(1151111081099710) for DST_CHAIN_ID which incorrectly sends a non-Polymer chain
id to Polymer API calls; define two separate constants (e.g.,
LIFI_SOLANA_CHAIN_ID = 1151111081099710 for on-chain bridgeData and
POLYMER_SOLANA_CHAIN_ID = 2 for Polymer API), update DST_CHAIN_ID or create a
new apiChainId variable so when BRIDGE_TO_SOLANA is true you pass
POLYMER_SOLANA_CHAIN_ID to getPolymerQuote() (and keep using
LIFI_SOLANA_CHAIN_ID where on-chain LiFi bridgeData requires it), and ensure
DST_CHAIN_ID_EVM logic (using LIFI_CHAIN_ID_ARBITRUM / LIFI_CHAIN_ID_OPTIMISM)
remains unchanged.

In `@script/demoScripts/utils/demoScriptHelpers.ts`:
- Around line 4-5: Add explicit Solana address validation before any ATA
derivation: where getAssociatedTokenAddress is called, validate external address
inputs the same way solanaAddressToBytes32 does by attempting to construct a
PublicKey in a try/catch and throw a clear, descriptive error if construction
fails (e.g., "invalid Solana address: <input>"). Update the functions that
accept external addresses (the call sites of getAssociatedTokenAddress) to
perform this validation prior to calling getAssociatedTokenAddress so invalid
base58 inputs are caught and surfaced with a clear message; follow the
solanaAddressToBytes32 validation pattern for exact behavior.

In `@test/solidity/Facets/PolymerCCTPFacet.t.sol`:
- Around line 366-377: Insert a blank line between the
vm.expectRevert(InvalidReceiver.selector); call and the subsequent
initiateBridgeTxWithFacet(false); invocation in the
testRevert_SolanaDestWithZeroSolanaReceiverATA test to follow the test style
guide; locate the vm.expectRevert usage and add a single empty line before the
initiateBridgeTxWithFacet call.
🧹 Nitpick comments (1)
src/Facets/PolymerCCTPFacet.sol (1)

308-310: Add test coverage for Monad (chainId 143 → domain 15) mapping.

The new mapping in _chainIdToDomainId is not reflected in test_ChainIdToDomainId; consider adding a case so this stays covered.

Test update sketch
-ChainMapping[] memory mappings = new ChainMapping[](16);
+ChainMapping[] memory mappings = new ChainMapping[](17);
@@
-        mappings[11] = ChainMapping({ chainId: 1329, domainId: 16 }); // Sei
+        mappings[11] = ChainMapping({ chainId: 143, domainId: 15 }); // Monad
+        mappings[12] = ChainMapping({ chainId: 1329, domainId: 16 }); // Sei
@@
-        mappings[15] = ChainMapping({ chainId: 98866, domainId: 22 }); // Plume
+        mappings[16] = ChainMapping({ chainId: 98866, domainId: 22 }); // Plume

As per coding guidelines, **/*.{test.ts,t.sol}: Prefer adding or updating tests alongside logic changes.

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

🤖 Fix all issues with AI agents
In `@script/demoScripts/utils/demoScriptHelpers.ts`:
- Around line 4-5: Replace the async ATA helper with the sync variant: change
imports of getAssociatedTokenAddress to getAssociatedTokenAddressSync in both
demoScriptHelpers.ts and demoEco.ts, remove any await when calling
getAssociatedTokenAddress (e.g. in functions where ata is derived) and call
getAssociatedTokenAddressSync(mintPublicKey, ownerPublicKey) instead so
derivation is done synchronously and no RPC/await is used.
🧹 Nitpick comments (1)
script/demoScripts/demoPolymerCCTP.ts (1)

431-434: Avoid logging raw balance before validation.

This logs the wallet balance before ensureBalance checks it. It's fine for a demo script, but consider that logging the raw bigint without formatUnits makes it less readable.

Suggested improvement
     consola.info(`Wallet: ${walletAddress}`)
-    consola.info(
-      `Wallet balance: ${await tokenContract.read.balanceOf([walletAddress])}`
-    )
+    const balance = await tokenContract.read.balanceOf([walletAddress])
+    consola.info(`Wallet balance: ${formatUnits(balance, 6)} USDC`)

/// @author LI.FI (https://li.fi)
/// @notice Provides functionality for bridging USDC through Polymer CCTP
/// @custom:version 1.0.0
/// @custom:version 1.1.0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am wondering if 1.1.0 is really the right version here since the contract has breaking changes in the function calls the selectors are different now.

@0xDEnYO What do you think makes more sense. 1.1.0 or 2.0.0?

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