Skip to content

Conversation

@ezynda3
Copy link
Contributor

@ezynda3 ezynda3 commented Nov 10, 2025

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>

- Extend GlacisData struct with outputToken field for multibridge routing
- Update IGlacisAirlift interface from v1.0.0 to v1.1.0
- Add support for 6-param send() and 7-param quoteSend()
- Update tests to fork from Optimism at block 143581698
- Add documentation for breaking changes and new features

BREAKING CHANGE: GlacisData struct now requires 4th field (outputToken)
@lifi-action-bot lifi-action-bot marked this pull request as draft November 10, 2025 13:52
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 10, 2025

Walkthrough

Adds a new bytes32 outputToken to GlacisData, exposes send(..., bytes32 outputToken) and quoteSend(..., bytes32 outputToken) overloads in IGlacisAirlift, bumps GlacisFacet to v1.2.0, updates docs, demo, tests, deployment manifests, and audit metadata to support multibridge / token-specific routing.

Changes

Cohort / File(s) Change Summary
Core contracts & interface
src/Facets/GlacisFacet.sol, src/Interfaces/IGlacisAirlift.sol
Added bytes32 outputToken to GlacisData; added send(..., bytes32 outputToken) and quoteSend(..., bytes32 outputToken) overloads; bumped GlacisFacet version to 1.2.0 and IGlacisAirlift to 1.1.0; documented routing semantics (zero = default).
Documentation
docs/GlacisFacet.md
Documented Version (1.2.0 / Glacis Airlift 1.1.0), added outputToken semantics, examples (default vs specific-token routing), and a Breaking Change Notice for the extended GlacisData.
Demo script
script/demoScripts/demoGlacis.ts
Switched demo destination to Unichain, added DST/SRC token addresses, pass outputToken via zeroPadAddressToBytes32(DST_TOKEN_ADDRESS); updated logs and calldata/type display to reflect extended calldata.
Tests
test/solidity/Facets/GlacisFacet.t.sol
Added outputToken field to test GlacisData instances, adjusted test setup (addresses, chain IDs, fork blocks, funding) to exercise multibridge routing and updated fuzz bounds/headers.
Deployments / manifests (many)
deployments/_deployments_log_file.json, deployments/*.json, deployments/.../*.diamond*.json
Added v1.2.0 deployment entries to deployment log; updated many per-network GlacisFacet addresses; added/updated facet entries in diamond staging JSONs; minor formatting tweaks.
Audit metadata
audit/auditLog.json
Added audit20251113 and mapped GlacisFacet v1.2.0 and IGlacisAirlift v1.1.0 to that audit (report path and commit hash included).
zksync deploy scripts & utils
script/deploy/zksync/*, script/deploy/zksync/utils/*, script/deploy/*
Added CREATE2 prediction helpers and IContractDeployer interface, migrate contract deployment/prediction flow, new update/migration helpers, approvals for refund/deployer wallets, and refactored bytecode/hash handling.
Shell helpers & task scripts
script/deploy/deploySingleContract.sh, script/helperFunctions.sh, script/tasks/diamondUpdateFacet.sh
Adjusted forge invocation flags (explicit --broadcast --skip-simulation in zk paths), updated zksolc default version constant, and minor whitespace/formatting tweaks.
zksync facet deploy helpers
script/deploy/zksync/DeployWhitelistManagerFacet.zksync.s.sol, script/deploy/zksync/UpdateWhitelistManagerFacet.zksync.s.sol, script/deploy/zksync/utils/DeployScriptBase.sol, script/deploy/zksync/utils/ScriptBase.sol, script/deploy/zksync/utils/UpdateScriptBase.sol
Added CREATE2 migrate contract flow, new prediction/getBytecodeHash helpers, replaced external deployer flow with internal zkSync prediction, introduced numerous helper/parsing functions and approval logic for whitelist/deployer wallets; added new internal functions and error types.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Verify ABI/backwards-compatibility for the extended GlacisData tuple and new overloads (calldata layout, encoding).
  • Confirm tests exercise both default routing (bytes32(0)) and non-zero outputToken multibridge paths.
  • Review zksync CREATE2 prediction/migrate deployment flow and new helpers for correctness.
  • Spot-check bulk deployment JSON updates for intended address/version accuracy.

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description follows the template structure but lacks critical information: the Jira task reference is empty, implementation rationale is missing, and reviewer checklists are incomplete with unchecked security and audit verification items. Complete the PR description by adding the Jira task reference, explaining the implementation approach, and checking/addressing the reviewer security validation and audit completion items before merging.
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately describes the main change: upgrading GlacisFacet to v1.2.0 and IGlacisAirlift to v1.1.0, which aligns with the version bumps and multibridge routing feature additions documented in the changeset.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch upgrade-glacis-facet

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6159db4 and e50e561.

📒 Files selected for processing (9)
  • deployments/_deployments_log_file.json (40 hunks)
  • deployments/berachain.json (1 hunks)
  • deployments/bsc.json (1 hunks)
  • deployments/plasma.json (1 hunks)
  • deployments/ronin.json (1 hunks)
  • deployments/rootstock.json (1 hunks)
  • deployments/sei.json (1 hunks)
  • deployments/swellchain.json (1 hunks)
  • deployments/viction.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • deployments/plasma.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • deployments/rootstock.json
  • deployments/berachain.json
🧰 Additional context used
🧠 Learnings (51)
📓 Common learnings
Learnt from: mirooon
Repo: lifinance/contracts PR: 945
File: src/Facets/GlacisFacet.sol:1-3
Timestamp: 2025-01-28T11:28:16.225Z
Learning: The GlacisFacet contract audit will be conducted and added to the audit log in later stages of development. This is acceptable during the initial development phase.
Learnt from: mirooon
Repo: lifinance/contracts PR: 1283
File: deployments/ronin.diamond.json:65-68
Timestamp: 2025-08-07T10:20:01.383Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) and deployment log files have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1256
File: deployments/zksync.diamond.json:81-87
Timestamp: 2025-07-04T08:59:08.108Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: conventions.md:0-0
Timestamp: 2025-11-25T01:36:33.521Z
Learning: Applies to src/Facets/**/*.sol : Facets must inherit from ILiFi interface, use LibAsset and LibSwap libraries, include ReentrancyGuard and SwapperV2, and implement Validatable interface
Learnt from: mirooon
Repo: lifinance/contracts PR: 945
File: test/solidity/Facets/GlacisFacet.t.sol:214-262
Timestamp: 2025-01-22T12:36:12.699Z
Learning: The GlacisFacet test suite inherits from TestBaseFacet which already covers various failure scenarios including invalid receiver address, invalid amounts, same chain bridging, and insufficient funds, making additional failure scenario tests redundant.
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: conventions.md:0-0
Timestamp: 2025-11-25T01:36:33.521Z
Learning: Applies to src/Facets/**/*.sol : Facets must use nonReentrant, refundExcessNative, validateBridgeData, and swapContainment modifiers
Learnt from: mirooon
Repo: lifinance/contracts PR: 1406
File: src/Facets/UnitFacet.sol:75-81
Timestamp: 2025-10-02T18:10:09.934Z
Learning: In UnitFacet.sol and similar facet contracts in src/Facets/, the LiFiTransferStarted event emission should ALWAYS be at the end of the _startBridge internal function, after all validations and asset transfers have been completed successfully.
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs involving address updates like the RelayFacet to Worldchain, verify the actual presence of entries in files before reporting issues. The RelayFacet exists in the diamond log file and the PR diff already contains the necessary address change.
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 782
File: script/deploy/_targetState.json:49-49
Timestamp: 2024-11-25T09:05:03.917Z
Learning: The `RelayFacet` contract, when missing from the source code but referenced in deployment configurations, should be treated the same way as `OpBNBBridgeFacet` and can be ignored in code reviews.
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: conventions.md:0-0
Timestamp: 2025-11-25T01:36:33.521Z
Learning: Applies to src/Facets/**/*.sol : Facets must implement internal _startBridge function, swapAndStartBridgeTokensVia{FacetName}, and startBridgeTokensVia{FacetName} functions
Learnt from: ezynda3
Repo: lifinance/contracts PR: 1124
File: script/demoScripts/utils/lib/cowShedSdk.ts:0-0
Timestamp: 2025-06-05T14:50:17.275Z
Learning: For demo scripts and example code, ezynda3 prefers to keep the code simple and focused on demonstrating the core functionality rather than adding extensive input validation or defensive programming measures.
📚 Learning: 2025-07-04T08:59:08.108Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1256
File: deployments/zksync.diamond.json:81-87
Timestamp: 2025-07-04T08:59:08.108Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.

Applied to files:

  • deployments/bsc.json
  • deployments/swellchain.json
  • deployments/sei.json
  • deployments/viction.json
  • deployments/_deployments_log_file.json
  • deployments/ronin.json
📚 Learning: 2025-02-12T09:44:10.963Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 985
File: deployments/bsca.json:0-0
Timestamp: 2025-02-12T09:44:10.963Z
Learning: When setting up new network deployments, it's expected that contract addresses in the deployment JSON files (e.g., bsca.json, bscb.json) may not have deployed code initially, as these files serve as target configurations for future deployments.

Applied to files:

  • deployments/bsc.json
📚 Learning: 2025-08-07T10:20:01.383Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1283
File: deployments/ronin.diamond.json:65-68
Timestamp: 2025-08-07T10:20:01.383Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) and deployment log files have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.

Applied to files:

  • deployments/bsc.json
  • deployments/swellchain.json
  • deployments/sei.json
  • deployments/viction.json
  • deployments/_deployments_log_file.json
  • deployments/ronin.json
📚 Learning: 2025-04-21T03:17:53.443Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs updating contract addresses (like RelayFacet on Worldchain), verify the presence of entries in all relevant files (worldchain.json, worldchain.diamond.json, _deployments_log_file.json) before reporting inconsistencies. The RelayFacet entry exists in all required deployment files with the correct address.

Applied to files:

  • deployments/bsc.json
  • deployments/swellchain.json
  • deployments/sei.json
  • deployments/viction.json
  • deployments/ronin.json
📚 Learning: 2025-09-09T10:39:26.383Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1357
File: deployments/lens.diamond.json:48-51
Timestamp: 2025-09-09T10:39:26.383Z
Learning: In the lifinance/contracts repository, when deployment JSON files show address changes (like AcrossFacetV3 address updates in deployments/*.diamond.json), the corresponding _deployments_log_file.json updates may be handled in separate PRs rather than the same PR that updates the diamond configuration files.

Applied to files:

  • deployments/bsc.json
  • deployments/swellchain.json
  • deployments/sei.json
  • deployments/viction.json
  • deployments/_deployments_log_file.json
  • deployments/ronin.json
📚 Learning: 2025-04-21T03:17:53.443Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs involving address updates like the RelayFacet to Worldchain, verify the actual presence of entries in files before reporting issues. The RelayFacet exists in the diamond log file and the PR diff already contains the necessary address change.

Applied to files:

  • deployments/bsc.json
  • deployments/swellchain.json
  • deployments/sei.json
  • deployments/viction.json
  • deployments/ronin.json
📚 Learning: 2025-04-21T03:15:12.236Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1109
File: deployments/worldchain.diamond.json:84-85
Timestamp: 2025-04-21T03:15:12.236Z
Learning: In deployment JSON files that contain "diamond" in their filename (located in the deployments folder), periphery contracts may have empty string values for their addresses. This indicates that the contract is not deployed on that particular chain and should not be flagged as an issue during code reviews.

Applied to files:

  • deployments/bsc.json
  • deployments/swellchain.json
  • deployments/sei.json
  • deployments/viction.json
  • deployments/_deployments_log_file.json
  • deployments/ronin.json
📚 Learning: 2024-10-24T06:17:25.211Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 807
File: deployments/bsc.diamond.staging.json:100-101
Timestamp: 2024-10-24T06:17:25.211Z
Learning: In `deployments/bsc.diamond.staging.json`, the trailing comma after the last property in the `Periphery` object is acceptable and should not be flagged as a JSON formatting error.

Applied to files:

  • deployments/bsc.json
📚 Learning: 2025-09-22T00:52:26.172Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1388
File: deployments/hyperevm.diamond.json:72-75
Timestamp: 2025-09-22T00:52:26.172Z
Learning: In diamond configuration files (deployments/*.diamond.json), it's acceptable to have multiple versions of the same facet (e.g., GlacisFacet v1.0.0 and v1.1.0) deployed at different contract addresses. This is intentional design for version coexistence, gradual migration, or backward compatibility purposes.

Applied to files:

  • deployments/bsc.json
  • deployments/swellchain.json
  • deployments/viction.json
  • deployments/ronin.json
📚 Learning: 2024-09-27T07:10:15.586Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 812
File: deployments/polygon.diamond.json:4-11
Timestamp: 2024-09-27T07:10:15.586Z
Learning: In `deployments/polygon.diamond.json`, it's acceptable for certain facets to have empty names and versions when specified by the developer.

Applied to files:

  • deployments/bsc.json
  • deployments/swellchain.json
📚 Learning: 2025-08-29T10:02:09.041Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1299
File: src/Facets/AcrossFacetPackedV4.sol:118-136
Timestamp: 2025-08-29T10:02:09.041Z
Learning: In AcrossFacetPackedV4.sol, the team explicitly chooses to omit calldata length validation in gas-optimized packed functions like startBridgeTokensViaAcrossV4NativePacked to save gas, accepting the trade-off of potential out-of-bounds reverts for better gas efficiency.

Applied to files:

  • deployments/bsc.json
  • deployments/viction.json
📚 Learning: 2025-09-25T07:47:30.735Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 1324
File: src/Facets/EcoFacet.sol:306-336
Timestamp: 2025-09-25T07:47:30.735Z
Learning: In EcoFacet (src/Facets/EcoFacet.sol), the team intentionally uses variable-length validation for nonEVMReceiver addresses (up to 44 bytes) to support cross-ecosystem bridging with different address formats, rather than enforcing fixed 32-byte raw pubkeys.

Applied to files:

  • deployments/bsc.json
  • deployments/swellchain.json
  • deployments/sei.json
📚 Learning: 2025-11-25T01:36:33.521Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: conventions.md:0-0
Timestamp: 2025-11-25T01:36:33.521Z
Learning: Applies to src/Facets/**/*.sol : Facets must implement internal _startBridge function, swapAndStartBridgeTokensVia{FacetName}, and startBridgeTokensVia{FacetName} functions

Applied to files:

  • deployments/bsc.json
  • deployments/swellchain.json
  • deployments/sei.json
  • deployments/viction.json
📚 Learning: 2025-11-25T01:36:33.521Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: conventions.md:0-0
Timestamp: 2025-11-25T01:36:33.521Z
Learning: Applies to src/Facets/**/*.sol : Use receiverAddress as first parameter in {facetName}Data struct and validate against bridgeData.receiver

Applied to files:

  • deployments/bsc.json
📚 Learning: 2025-02-11T10:35:03.536Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 988
File: script/tasks/solidity/AddTokenApprovalsToCBridgeFacetPacked.s.sol:17-21
Timestamp: 2025-02-11T10:35:03.536Z
Learning: The CBridgeFacetPacked and cBridge addresses in AddTokenApprovalsToCBridgeFacetPacked.s.sol must not be zero addresses as they are required for token approvals to function properly.

Applied to files:

  • deployments/bsc.json
  • deployments/swellchain.json
  • deployments/viction.json
📚 Learning: 2024-11-25T09:05:03.917Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 782
File: script/deploy/_targetState.json:49-49
Timestamp: 2024-11-25T09:05:03.917Z
Learning: The `RelayFacet` contract, when missing from the source code but referenced in deployment configurations, should be treated the same way as `OpBNBBridgeFacet` and can be ignored in code reviews.

Applied to files:

  • deployments/bsc.json
  • deployments/swellchain.json
📚 Learning: 2025-07-16T01:03:08.106Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1275
File: src/Facets/AllBridgeFacet.sol:164-164
Timestamp: 2025-07-16T01:03:08.106Z
Learning: In src/Facets/AllBridgeFacet.sol, the team has decided that explicit validation for address downcasting from `_bridgeData.sendingAssetId` to `bytes32(uint256(uint160(_bridgeData.sendingAssetId)))` is not required, accepting the potential risk of silent overflow from unsafe downcasting.

Applied to files:

  • deployments/bsc.json
📚 Learning: 2024-10-31T09:09:38.568Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 843
File: src/Facets/RelayFacet.sol:165-170
Timestamp: 2024-10-31T09:09:38.568Z
Learning: In the `RelayFacet` contract (`src/Facets/RelayFacet.sol`), within the `_startBridge` function, low-level `call` is intentionally used to transfer tokens so that extra bytes can be added to the calldata, as required for integrating with Relay Protocol.

Applied to files:

  • deployments/bsc.json
  • deployments/swellchain.json
📚 Learning: 2025-10-10T10:56:04.861Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1413
File: src/Facets/EverclearFacet.sol:4-13
Timestamp: 2025-10-10T10:56:04.861Z
Learning: LibAllowList is only required for facets that make arbitrary external calls to DEX aggregators (e.g., GenericSwapFacetV3). Bridge facets that call specific protocol contracts (like EverclearFacet calling IEverclearFeeAdapter) do not need to import LibAllowList.

Applied to files:

  • deployments/bsc.json
  • deployments/sei.json
  • deployments/viction.json
📚 Learning: 2025-01-22T12:36:12.699Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 945
File: test/solidity/Facets/GlacisFacet.t.sol:214-262
Timestamp: 2025-01-22T12:36:12.699Z
Learning: The GlacisFacet test suite inherits from TestBaseFacet which already covers various failure scenarios including invalid receiver address, invalid amounts, same chain bridging, and insufficient funds, making additional failure scenario tests redundant.

Applied to files:

  • deployments/bsc.json
  • deployments/swellchain.json
📚 Learning: 2025-09-16T01:39:54.099Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1381
File: deployments/arbitrum.json:65-69
Timestamp: 2025-09-16T01:39:54.099Z
Learning: When verifying facet deployments across .json and .diamond.json files, search by facet name rather than trying to cross-reference addresses between the files, as the same contract can have different addresses in different deployment files.

Applied to files:

  • deployments/swellchain.json
  • deployments/sei.json
  • deployments/viction.json
  • deployments/ronin.json
📚 Learning: 2024-11-26T01:16:27.721Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 782
File: deployments/worldchain.diamond.json:40-43
Timestamp: 2024-11-26T01:16:27.721Z
Learning: Version inconsistencies of 'GenericSwapFacetV3' across deployment configurations are acceptable if they are only due to differences in Solidity pragma directives.

Applied to files:

  • deployments/swellchain.json
📚 Learning: 2025-11-25T01:36:33.521Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: conventions.md:0-0
Timestamp: 2025-11-25T01:36:33.521Z
Learning: Applies to src/Facets/**/*.sol : Facets must inherit from ILiFi interface, use LibAsset and LibSwap libraries, include ReentrancyGuard and SwapperV2, and implement Validatable interface

Applied to files:

  • deployments/swellchain.json
  • deployments/sei.json
  • deployments/ronin.json
📚 Learning: 2025-02-13T08:57:00.095Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 984
File: docs/ChainflipFacet.md:0-0
Timestamp: 2025-02-13T08:57:00.095Z
Learning: The ChainflipData struct in ChainflipFacet has three fields:
1. uint32 dstToken - The destination token identifier in Chainflip
2. bytes32 nonEvmAddress - The non-EVM destination address
3. bytes cfParameters - Additional parameters for Chainflip protocol

Applied to files:

  • deployments/swellchain.json
📚 Learning: 2025-08-27T23:36:40.773Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1328
File: test/solidity/Periphery/GasZipPeriphery.t.sol:223-233
Timestamp: 2025-08-27T23:36:40.773Z
Learning: In bridge facet swap flows with requiresDeposit=false, tokens are already held by the diamond contract from previous swaps. When subsequent contracts like GasZipPeriphery call LibAsset.depositAsset, they pull tokens from msg.sender (the diamond) to themselves via transferFrom, requiring no additional approvals since the diamond already owns the tokens.

Applied to files:

  • deployments/swellchain.json
  • deployments/viction.json
  • deployments/ronin.json
📚 Learning: 2025-08-29T11:12:02.184Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1328
File: src/Periphery/LDA/Facets/SyncSwapV2Facet.sol:33-38
Timestamp: 2025-08-29T11:12:02.184Z
Learning: In LDA facets (src/Periphery/Lda/Facets/**/*.sol), tokenIn parameter validation (checking for address(0)) is intentionally not performed as part of the design architecture.

Applied to files:

  • deployments/swellchain.json
📚 Learning: 2025-08-07T10:20:01.383Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1283
File: deployments/ronin.diamond.json:65-68
Timestamp: 2025-08-07T10:20:01.383Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, understand that _targetState.json tracks contract version numbers (not addresses) and _deployments_log_file.json contains deployment records with addresses that may not be organized in obvious network sections. Always verify the actual file structure before flagging missing entries.

Applied to files:

  • deployments/sei.json
  • deployments/viction.json
  • deployments/ronin.json
📚 Learning: 2024-11-25T09:05:43.045Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 782
File: deployments/base.diamond.json:148-148
Timestamp: 2024-11-25T09:05:43.045Z
Learning: In deployment configuration files (e.g., `deployments/base.diamond.json`), empty addresses for contracts like `Permit2Proxy` may be placeholders and will be updated after approvals are released from the multisig safe.

Applied to files:

  • deployments/sei.json
  • deployments/viction.json
📚 Learning: 2024-12-04T01:59:34.045Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 832
File: deployments/_deployments_log_file.json:23712-23720
Timestamp: 2024-12-04T01:59:34.045Z
Learning: In `deployments/_deployments_log_file.json`, duplicate deployment entries for the same version and address may occur because they correspond to deployments on different networks. These entries are acceptable and should not be flagged as duplicates in future reviews.

Applied to files:

  • deployments/sei.json
  • deployments/_deployments_log_file.json
📚 Learning: 2025-01-28T14:30:06.911Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 924
File: deployments/abstract.json:2-4
Timestamp: 2025-01-28T14:30:06.911Z
Learning: In the LiFi contract architecture, "LiFiDiamond" is the diamond proxy contract that connects all facets into a cohesive system. The facets are individual contracts that provide specific functionality, and the diamond proxy delegates calls to these facets.

Applied to files:

  • deployments/sei.json
  • deployments/ronin.json
📚 Learning: 2025-06-13T08:30:26.220Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1207
File: deployments/_deployments_log_file.json:34037-34080
Timestamp: 2025-06-13T08:30:26.220Z
Learning: LiFiDiamond contains generic withdrawal logic, so individual facet contracts (e.g., PioneerFacet) do not need their own Ether-withdraw functions.

Applied to files:

  • deployments/sei.json
  • deployments/ronin.json
📚 Learning: 2025-10-02T18:10:09.934Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1406
File: src/Facets/UnitFacet.sol:75-81
Timestamp: 2025-10-02T18:10:09.934Z
Learning: In UnitFacet.sol and similar facet contracts in src/Facets/, the LiFiTransferStarted event emission should ALWAYS be at the end of the _startBridge internal function, after all validations and asset transfers have been completed successfully.

Applied to files:

  • deployments/sei.json
📚 Learning: 2025-11-25T01:36:33.521Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: conventions.md:0-0
Timestamp: 2025-11-25T01:36:33.521Z
Learning: Applies to src/Facets/**/*.sol : LiFiTransferStarted event must only be used in Facet contracts and emitted at transaction start before external calls

Applied to files:

  • deployments/sei.json
📚 Learning: 2025-10-13T11:13:48.847Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1413
File: src/Facets/EverclearV2Facet.sol:75-96
Timestamp: 2025-10-13T11:13:48.847Z
Learning: In EverclearV2Facet (and all LiFi facets), the team standard is to use msg.sender as the refund address with the refundExcessNative modifier, not requiring an explicit refund address parameter.

Applied to files:

  • deployments/sei.json
📚 Learning: 2025-02-12T09:44:12.961Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 985
File: script/deploy/_targetState.json:0-0
Timestamp: 2025-02-12T09:44:12.961Z
Learning: The bsca network intentionally maintains different facet versions between staging and production environments, specifically:
1. CalldataVerificationFacet: v1.1.1 in staging vs v1.1.2 in production
2. EmergencyPauseFacet: present only in production
3. Permit2Proxy: present only in production

Applied to files:

  • deployments/sei.json
📚 Learning: 2024-10-09T03:47:21.269Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 806
File: deployments/_deployments_log_file.json:5780-5793
Timestamp: 2024-10-09T03:47:21.269Z
Learning: The owner address `0x11f11121df7256c40339393b0fb045321022ce44` and the `DiamondCutFacet` address `0xd5cf40a2a18b633cfd6a1ae16d1771596498cf83` in the `LiFiDiamond` deployment on `xlayer` are correct and should not be flagged as issues, even if they are not referenced in the Solidity files.

Applied to files:

  • deployments/viction.json
  • deployments/ronin.json
📚 Learning: 2024-10-09T03:47:21.269Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 807
File: src/Periphery/GasZipPeriphery.sol:4-14
Timestamp: 2024-10-09T03:47:21.269Z
Learning: In `GasZipPeriphery.sol`, `LibUtil` and `Validatable` are used, so ensure not to suggest their removal in future reviews.

Applied to files:

  • deployments/viction.json
📚 Learning: 2025-08-26T12:11:21.073Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1328
File: src/Periphery/Lda/Facets/CoreRouteFacet.sol:4-6
Timestamp: 2025-08-26T12:11:21.073Z
Learning: In the lifinance/contracts repository, OpenZeppelin's SafeERC20 library provides safePermit functionality for IERC20Permit tokens. This is confirmed by working implementations in both CoreRouteFacet.sol and LiFiDEXAggregator.sol that use the pattern "using SafeERC20 for IERC20Permit;" and successfully call safePermit with permit parameters.

Applied to files:

  • deployments/viction.json
📚 Learning: 2025-07-15T05:05:28.134Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1140
File: config/permit2Proxy.json:3-3
Timestamp: 2025-07-15T05:05:28.134Z
Learning: In config/permit2Proxy.json, the addresses represent the Permit2 contract addresses on each chain, NOT the Permit2Proxy contract addresses. These Permit2 addresses are used as constructor arguments when deploying the Permit2Proxy contract. The Permit2Proxy acts as a wrapper/proxy that interacts with the underlying Permit2 contract on each network.

Applied to files:

  • deployments/viction.json
📚 Learning: 2025-02-11T10:33:52.791Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 988
File: script/deploy/facets/DeployPermit2Proxy.s.sol:33-37
Timestamp: 2025-02-11T10:33:52.791Z
Learning: The Permit2Proxy contract must not be deployed with zero addresses for its critical dependencies (LiFiDiamond, permit2Address, safeAddress). This is enforced by passing `false` to `_getConfigContractAddress` function.

Applied to files:

  • deployments/viction.json
📚 Learning: 2025-05-28T17:33:33.959Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1170
File: deployments/_deployments_log_file.json:28060-28072
Timestamp: 2025-05-28T17:33:33.959Z
Learning: Deployment log files like `deployments/_deployments_log_file.json` are historical records that document the actual versions deployed at specific times. They should not be updated to match current contract versions - they must accurately reflect what was deployed when the deployment occurred.

Applied to files:

  • deployments/_deployments_log_file.json
📚 Learning: 2025-05-28T17:33:10.529Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1170
File: deployments/_deployments_log_file.json:28706-28717
Timestamp: 2025-05-28T17:33:10.529Z
Learning: Deployment log files (like `_deployments_log_file.json`) are historical records that should not be updated to match current contract versions. They should accurately reflect the versions that were actually deployed at specific timestamps.

Applied to files:

  • deployments/_deployments_log_file.json
📚 Learning: 2025-09-15T12:33:51.069Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1377
File: deployments/_deployments_log_file.json:5607-5619
Timestamp: 2025-09-15T12:33:51.069Z
Learning: The deployments/_deployments_log_file.json is structured as network → environment → version → array of deployment records. Always understand the file hierarchy before attempting validation, and target specific paths rather than trying to validate all objects in the JSON.

Applied to files:

  • deployments/_deployments_log_file.json
📚 Learning: 2024-09-30T03:52:27.281Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 812
File: deployments/_deployments_log_file.json:1914-1927
Timestamp: 2024-09-30T03:52:27.281Z
Learning: Duplicate entries in `deployments/_deployments_log_file.json` that are outdated do not require changes.

Applied to files:

  • deployments/_deployments_log_file.json
📚 Learning: 2025-11-25T01:36:33.521Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: conventions.md:0-0
Timestamp: 2025-11-25T01:36:33.521Z
Learning: Applies to {src,script}/**/*.sol : custom:version in contract NatSpec must follow semantic versioning (X.Y.Z format)

Applied to files:

  • deployments/_deployments_log_file.json
📚 Learning: 2025-01-21T11:07:36.236Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 937
File: script/deploy/facets/DeployLiFiDEXAggregator.s.sol:33-35
Timestamp: 2025-01-21T11:07:36.236Z
Learning: In the LiFiDEXAggregator contract deployment (DeployLiFiDEXAggregator.s.sol), the refundWallet address from global.json is used as the owner parameter in the contract's constructor, which is then passed to the WithdrawablePeriphery base contract.

Applied to files:

  • deployments/ronin.json
📚 Learning: 2024-10-09T03:47:21.269Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 819
File: deployments/fuse.json:24-25
Timestamp: 2024-10-09T03:47:21.269Z
Learning: The `LiFiDEXAggregator.sol` contract is located in `src/Periphery/`.

Applied to files:

  • deployments/ronin.json
📚 Learning: 2025-01-21T11:04:46.116Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 937
File: config/dexs.json:95-99
Timestamp: 2025-01-21T11:04:46.116Z
Learning: In the dexs.json configuration, utility contracts (like FeeCollector, LiFuelFeeCollector, TokenWrapper) can be treated as DEX contracts since they are handled similarly in the system's logic.

Applied to files:

  • deployments/ronin.json
📚 Learning: 2025-05-27T16:19:09.643Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1165
File: test/solidity/Facets/GnosisBridgeFacet.t.sol:32-33
Timestamp: 2025-05-27T16:19:09.643Z
Learning: For the LiFi contracts project, the USDS token address on Ethereum mainnet is 0xdC035D45d973E3EC169d2276DDab16f1e407384F, not 0xA4Bdb11dc0a2bEC88d24A3aa1E6Bb17201112eBe which may be a different USDS token deployment.

Applied to files:

  • deployments/ronin.json
📚 Learning: 2024-11-21T08:39:29.530Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 861
File: config/dexs.json:748-752
Timestamp: 2024-11-21T08:39:29.530Z
Learning: In the 'worldchain' network, the addresses `0x50D5a8aCFAe13Dceb217E9a071F6c6Bd5bDB4155`, `0x8f023b4193a6b18C227B4a755f8e28B3D30Ef9a1`, and `0x603a538477d44064eA5A5d8C345b4Ff6fca1142a` are used as DEXs and should be included in `config/dexs.json`.

Applied to files:

  • deployments/ronin.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: enforce-min-test-coverage
  • GitHub Check: run-unit-tests
🔇 Additional comments (7)
deployments/viction.json (1)

21-21: Address update approved.

GlacisFacet address updated for v1.2.0 deployment on Viction network. Change aligns with the coordinated facet upgrade across networks.

deployments/swellchain.json (1)

22-22: Address update approved.

GlacisFacet address updated for v1.2.0 deployment on SWell Chain network. Change is part of the coordinated upgrade across networks.

deployments/bsc.json (1)

55-55: Address update approved.

GlacisFacet address updated for v1.2.0 deployment on BSC network. Change is consistent with the multi-network upgrade rollout.

deployments/sei.json (1)

28-28: Address update approved.

GlacisFacet address updated for v1.2.0 deployment on Sei network. Change follows the coordinated upgrade pattern across networks.

deployments/ronin.json (1)

22-22: Address update approved.

GlacisFacet address updated for v1.2.0 deployment on Ronin network. Change is part of the coordinated global facet upgrade.

deployments/_deployments_log_file.json (2)

40995-41009: Deployment log entries for GlacisFacet v1.2.0 are properly structured and additive.

The new version entries (hunks 1–39) follow the correct format and hierarchy. Each deployment record includes valid metadata (addresses, timestamps, constructor args, optimizer settings). No existing entries are overwritten.

Please clarify the verification status: several entries show VERIFIED: "false" (e.g., lines 41583, 41655, 41763, 41943, 42051, 42160, 42212). Is this expected for staging environments, or are these pending on-chain verification? Confirm whether these deployments are ready for production.

Also applies to: 41031-41045, 41067-41082, 41116-41131, 41152-41167, 41188-41204, 41224-41239, 41248-41263, 41284-41300, 41320-41335, 41356-41371, 41392-41407, 41428-41443, 41464-41480, 41500-41515, 41536-41551, 41572-41587, 41608-41623, 41644-41660, 41680-41695, 41716-41731, 41752-41767, 41788-41803, 41824-41839, 41860-41875, 41896-41911, 41932-41947, 41968-41983, 42004-42020, 42040-42055, 42076-42091, 42112-42127, 42149-42164, 42175-42191, 42201-42217, 42227-42243, 42253-42269, 42279-42295, 42305-42320


44346-44406: New facet deployments (abstract, lens, sophon, zksync v1.0.0) correctly appended.

The new top-level facet entries maintain consistent structure and metadata formatting. Timestamps and ZK Solidity compiler versions are appropriately populated where applicable (particularly for zkSync deployments with "ZK_SOLC_VERSION": "1.5.15").


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.

@lifi-action-bot lifi-action-bot changed the title Upgrade glacis facet Upgrade glacis facet [GlacisFacet v1.2.0, IGlacisAirlift v1.1.0] Nov 10, 2025
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: 0

🧹 Nitpick comments (1)
test/solidity/Facets/GlacisFacet.t.sol (1)

402-409: Optional: Consider extracting the outputToken conversion logic.

The pattern outputToken == address(0) ? bytes32(0) : bytes32(uint256(uint160(outputToken))) is repeated in many test functions. While this is acceptable for tests, you could optionally extract it to a helper function in the test base to reduce duplication:

function getOutputTokenBytes32() internal view returns (bytes32) {
    return outputToken == address(0) 
        ? bytes32(0) 
        : bytes32(uint256(uint160(outputToken)));
}

Then use: outputToken: getOutputTokenBytes32()

Also applies to: 456-463, 481-488, 512-519, 539-546, 570-577, 603-610, 632-639, 670-677, 708-715, 740-747

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 00a84b8 and cb32847.

📒 Files selected for processing (5)
  • docs/GlacisFacet.md (3 hunks)
  • script/demoScripts/demoGlacis.ts (5 hunks)
  • src/Facets/GlacisFacet.sol (3 hunks)
  • src/Interfaces/IGlacisAirlift.sol (4 hunks)
  • test/solidity/Facets/GlacisFacet.t.sol (16 hunks)
🧰 Additional context used
🧠 Learnings (39)
📓 Common learnings
Learnt from: mirooon
Repo: lifinance/contracts PR: 945
File: src/Facets/GlacisFacet.sol:1-3
Timestamp: 2025-01-28T11:28:16.225Z
Learning: The GlacisFacet contract audit will be conducted and added to the audit log in later stages of development. This is acceptable during the initial development phase.
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1357
File: deployments/lens.diamond.json:48-51
Timestamp: 2025-09-09T10:39:26.383Z
Learning: In the lifinance/contracts repository, when deployment JSON files show address changes (like AcrossFacetV3 address updates in deployments/*.diamond.json), the corresponding _deployments_log_file.json updates may be handled in separate PRs rather than the same PR that updates the diamond configuration files.
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 782
File: script/deploy/_targetState.json:143-143
Timestamp: 2024-11-25T06:25:01.232Z
Learning: Contracts like `OpBNBBridgeFacet` may be in development and only available in feature branches, resulting in missing source files in the main branch. Before flagging such missing contracts, check for open PRs that might include them.
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1256
File: deployments/zksync.diamond.json:81-87
Timestamp: 2025-07-04T08:59:08.108Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Learnt from: mirooon
Repo: lifinance/contracts PR: 1283
File: deployments/ronin.diamond.json:65-68
Timestamp: 2025-08-07T10:20:01.383Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) and deployment log files have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs involving address updates like the RelayFacet to Worldchain, verify the actual presence of entries in files before reporting issues. The RelayFacet exists in the diamond log file and the PR diff already contains the necessary address change.
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1334
File: deployments/mainnet.json:54-54
Timestamp: 2025-08-26T02:20:52.515Z
Learning: For deployment PRs in the lifinance/contracts repository, carefully verify the specific scope mentioned in the PR title and description before suggesting updates to other networks. Not all deployments are cross-network updates - some are targeted to specific chains only.
Learnt from: mirooon
Repo: lifinance/contracts PR: 1328
File: src/Periphery/Lda/Facets/UniV2StyleFacet.sol:0-0
Timestamp: 2025-08-27T13:47:28.646Z
Learning: In src/Periphery/Lda/Facets/UniV2StyleFacet.sol and similar LDA facets, mirooon prefers to rely on backend validation for pool addresses rather than adding contract code-size checks in the smart contract, as pool validation occurs during payload generation and transactions would fail anyway if sent to invalid addresses.
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 782
File: script/deploy/_targetState.json:49-49
Timestamp: 2024-11-25T09:05:03.917Z
Learning: The `RelayFacet` contract, when missing from the source code but referenced in deployment configurations, should be treated the same way as `OpBNBBridgeFacet` and can be ignored in code reviews.
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs updating contract addresses (like RelayFacet on Worldchain), verify the presence of entries in all relevant files (worldchain.json, worldchain.diamond.json, _deployments_log_file.json) before reporting inconsistencies. The RelayFacet entry exists in all required deployment files with the correct address.
Learnt from: ezynda3
Repo: lifinance/contracts PR: 1124
File: script/demoScripts/utils/lib/cowShedSdk.ts:0-0
Timestamp: 2025-06-05T14:50:17.275Z
Learning: For demo scripts and example code, ezynda3 prefers to keep the code simple and focused on demonstrating the core functionality rather than adding extensive input validation or defensive programming measures.
📚 Learning: 2024-10-31T09:09:38.568Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 843
File: src/Facets/RelayFacet.sol:165-170
Timestamp: 2024-10-31T09:09:38.568Z
Learning: In the `RelayFacet` contract (`src/Facets/RelayFacet.sol`), within the `_startBridge` function, low-level `call` is intentionally used to transfer tokens so that extra bytes can be added to the calldata, as required for integrating with Relay Protocol.

Applied to files:

  • docs/GlacisFacet.md
  • src/Facets/GlacisFacet.sol
  • src/Interfaces/IGlacisAirlift.sol
  • script/demoScripts/demoGlacis.ts
  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-09-22T00:52:26.172Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1388
File: deployments/hyperevm.diamond.json:72-75
Timestamp: 2025-09-22T00:52:26.172Z
Learning: In diamond configuration files (deployments/*.diamond.json), it's acceptable to have multiple versions of the same facet (e.g., GlacisFacet v1.0.0 and v1.1.0) deployed at different contract addresses. This is intentional design for version coexistence, gradual migration, or backward compatibility purposes.

Applied to files:

  • docs/GlacisFacet.md
📚 Learning: 2025-01-28T11:28:16.225Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 945
File: src/Facets/GlacisFacet.sol:1-3
Timestamp: 2025-01-28T11:28:16.225Z
Learning: The GlacisFacet contract audit will be conducted and added to the audit log in later stages of development. This is acceptable during the initial development phase.

Applied to files:

  • docs/GlacisFacet.md
  • src/Facets/GlacisFacet.sol
  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-08-27T23:36:40.773Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1328
File: test/solidity/Periphery/GasZipPeriphery.t.sol:223-233
Timestamp: 2025-08-27T23:36:40.773Z
Learning: In bridge facet swap flows with requiresDeposit=false, tokens are already held by the diamond contract from previous swaps. When subsequent contracts like GasZipPeriphery call LibAsset.depositAsset, they pull tokens from msg.sender (the diamond) to themselves via transferFrom, requiring no additional approvals since the diamond already owns the tokens.

Applied to files:

  • docs/GlacisFacet.md
  • src/Facets/GlacisFacet.sol
  • src/Interfaces/IGlacisAirlift.sol
  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-10-10T10:56:04.861Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1413
File: src/Facets/EverclearFacet.sol:4-13
Timestamp: 2025-10-10T10:56:04.861Z
Learning: LibAllowList is only required for facets that make arbitrary external calls to DEX aggregators (e.g., GenericSwapFacetV3). Bridge facets that call specific protocol contracts (like EverclearFacet calling IEverclearFeeAdapter) do not need to import LibAllowList.

Applied to files:

  • docs/GlacisFacet.md
  • src/Facets/GlacisFacet.sol
  • src/Interfaces/IGlacisAirlift.sol
📚 Learning: 2025-01-22T12:36:12.699Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 945
File: test/solidity/Facets/GlacisFacet.t.sol:214-262
Timestamp: 2025-01-22T12:36:12.699Z
Learning: The GlacisFacet test suite inherits from TestBaseFacet which already covers various failure scenarios including invalid receiver address, invalid amounts, same chain bridging, and insufficient funds, making additional failure scenario tests redundant.

Applied to files:

  • docs/GlacisFacet.md
  • src/Facets/GlacisFacet.sol
  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2024-11-25T09:04:55.880Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 782
File: script/deploy/_targetState.json:143-143
Timestamp: 2024-11-25T09:04:55.880Z
Learning: Errors about the missing `OpBNBBridgeFacet` contract are expected when it is referenced in the target state but not yet merged into the main branch.

Applied to files:

  • docs/GlacisFacet.md
  • src/Interfaces/IGlacisAirlift.sol
  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-07-16T01:03:08.106Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1275
File: src/Facets/AllBridgeFacet.sol:164-164
Timestamp: 2025-07-16T01:03:08.106Z
Learning: In src/Facets/AllBridgeFacet.sol, the team has decided that explicit validation for address downcasting from `_bridgeData.sendingAssetId` to `bytes32(uint256(uint160(_bridgeData.sendingAssetId)))` is not required, accepting the potential risk of silent overflow from unsafe downcasting.

Applied to files:

  • docs/GlacisFacet.md
  • src/Facets/GlacisFacet.sol
  • src/Interfaces/IGlacisAirlift.sol
  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-08-27T13:07:58.254Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1328
File: src/Periphery/Lda/Facets/CurveFacet.sol:0-0
Timestamp: 2025-08-27T13:07:58.254Z
Learning: The CurveFacet in src/Periphery/Lda/Facets/CurveFacet.sol has fundamental issues: it imports a non-existent ICurveLegacy interface, and attempts to send ETH to non-payable exchange functions in both ICurve and ICurveV2 interfaces. All current Curve interfaces are non-payable and cannot accept native ETH.

Applied to files:

  • docs/GlacisFacet.md
  • src/Facets/GlacisFacet.sol
📚 Learning: 2025-09-16T07:56:45.093Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 1324
File: test/solidity/Facets/EcoFacet.t.sol:135-141
Timestamp: 2025-09-16T07:56:45.093Z
Learning: In EcoFacet test setup, the isNative parameter in swap-and-bridge flows refers to the bridge token type (output), not the swap input type. The ERC20 branch (isNative=false) can still swap from native ETH to ERC20 tokens, requiring msg.value = swapData[0].fromAmount for the ETH input to the swap.

Applied to files:

  • docs/GlacisFacet.md
  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-02-13T08:57:00.095Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 984
File: docs/ChainflipFacet.md:0-0
Timestamp: 2025-02-13T08:57:00.095Z
Learning: The ChainflipData struct in ChainflipFacet has three fields:
1. uint32 dstToken - The destination token identifier in Chainflip
2. bytes32 nonEvmAddress - The non-EVM destination address
3. bytes cfParameters - Additional parameters for Chainflip protocol

Applied to files:

  • docs/GlacisFacet.md
  • src/Facets/GlacisFacet.sol
  • src/Interfaces/IGlacisAirlift.sol
  • script/demoScripts/demoGlacis.ts
  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-07-16T01:04:11.083Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1275
File: src/Facets/AllBridgeFacet.sol:175-175
Timestamp: 2025-07-16T01:04:11.083Z
Learning: In AllBridgeFacet.sol, zero fee validation is not required at the contract level because the backend system ensures that calldata and msg.value are properly aligned before transactions reach the contract.

Applied to files:

  • docs/GlacisFacet.md
  • src/Interfaces/IGlacisAirlift.sol
📚 Learning: 2025-08-29T10:02:09.041Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1299
File: src/Facets/AcrossFacetPackedV4.sol:118-136
Timestamp: 2025-08-29T10:02:09.041Z
Learning: In AcrossFacetPackedV4.sol, the team explicitly chooses to omit calldata length validation in gas-optimized packed functions like startBridgeTokensViaAcrossV4NativePacked to save gas, accepting the trade-off of potential out-of-bounds reverts for better gas efficiency.

Applied to files:

  • docs/GlacisFacet.md
  • src/Interfaces/IGlacisAirlift.sol
  • script/demoScripts/demoGlacis.ts
  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-08-29T11:07:57.743Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1328
File: src/Periphery/LDA/Facets/CurveFacet.sol:87-91
Timestamp: 2025-08-29T11:07:57.743Z
Learning: In src/Periphery/LDA/Facets/CurveFacet.sol, modern Curve pools (isV2=true, representing V2/NG pools) should reject native tokenIn by adding an early revert check when LibAsset.isNativeAsset(tokenIn) is true, since ICurveV2 exchange functions are non-payable and cannot accept native ETH.

Applied to files:

  • src/Facets/GlacisFacet.sol
  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-06-13T08:30:26.220Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1207
File: deployments/_deployments_log_file.json:34037-34080
Timestamp: 2025-06-13T08:30:26.220Z
Learning: LiFiDiamond contains generic withdrawal logic, so individual facet contracts (e.g., PioneerFacet) do not need their own Ether-withdraw functions.

Applied to files:

  • src/Facets/GlacisFacet.sol
📚 Learning: 2025-08-27T13:07:58.254Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1328
File: src/Periphery/Lda/Facets/CurveFacet.sol:0-0
Timestamp: 2025-08-27T13:07:58.254Z
Learning: The CurveFacet implementation is fundamentally broken: ICurveLegacy interface doesn't exist in the codebase but is imported and used, and the code attempts to send ETH to non-payable exchange functions. The entire native asset handling logic needs to be redesigned.

Applied to files:

  • src/Facets/GlacisFacet.sol
📚 Learning: 2025-10-02T18:10:09.934Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1406
File: src/Facets/UnitFacet.sol:75-81
Timestamp: 2025-10-02T18:10:09.934Z
Learning: In UnitFacet.sol and similar facet contracts in src/Facets/, the LiFiTransferStarted event emission should ALWAYS be at the end of the _startBridge internal function, after all validations and asset transfers have been completed successfully.

Applied to files:

  • src/Facets/GlacisFacet.sol
📚 Learning: 2025-04-28T07:46:24.084Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 1116
File: src/Libraries/LibAsset.sol:102-108
Timestamp: 2025-04-28T07:46:24.084Z
Learning: In the LiFi contracts, the `LibAsset.transferFromERC20` function is intentionally designed to accept arbitrary `from` parameters, with security ensured through a whitelist mechanism that controls which contracts can call this function.

Applied to files:

  • src/Facets/GlacisFacet.sol
📚 Learning: 2025-02-11T10:35:03.536Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 988
File: script/tasks/solidity/AddTokenApprovalsToCBridgeFacetPacked.s.sol:17-21
Timestamp: 2025-02-11T10:35:03.536Z
Learning: The CBridgeFacetPacked and cBridge addresses in AddTokenApprovalsToCBridgeFacetPacked.s.sol must not be zero addresses as they are required for token approvals to function properly.

Applied to files:

  • src/Interfaces/IGlacisAirlift.sol
  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2024-11-22T08:49:35.205Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 827
File: src/Facets/DeBridgeDlnFacet.sol:0-0
Timestamp: 2024-11-22T08:49:35.205Z
Learning: In `DeBridgeDlnFacet.sol`, direct access to the `deBridgeChainId` mapping is acceptable, and using the `getDeBridgeChainId` function is not necessary in these instances.

Applied to files:

  • src/Interfaces/IGlacisAirlift.sol
📚 Learning: 2025-07-17T04:21:55.549Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1266
File: script/deploy/safe/execute-pending-timelock-tx.ts:334-334
Timestamp: 2025-07-17T04:21:55.549Z
Learning: In the lifinance/contracts repository, 0xDEnYO prefers to keep private key processing simple in scripts like execute-pending-timelock-tx.ts without adding format validation, prioritizing code simplicity over strict validation in controlled environments.

Applied to files:

  • script/demoScripts/demoGlacis.ts
📚 Learning: 2025-09-25T00:12:58.536Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1395
File: src/Periphery/FeeForwarder.sol:78-120
Timestamp: 2025-09-25T00:12:58.536Z
Learning: In src/Periphery/FeeForwarder.sol, the team intentionally uses address(this).balance for refunding remaining native tokens because the contract is designed to never hold funds and not collect dust, making it safe to return the entire balance to the caller.

Applied to files:

  • script/demoScripts/demoGlacis.ts
  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-02-21T09:05:22.118Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 984
File: test/solidity/Facets/ChainflipFacet.t.sol:269-269
Timestamp: 2025-02-21T09:05:22.118Z
Learning: Fixed gas amounts in test files (e.g., ChainflipFacet.t.sol) don't require extensive documentation or configuration as they are only used for testing purposes.

Applied to files:

  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-08-29T11:12:02.184Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1328
File: src/Periphery/LDA/Facets/SyncSwapV2Facet.sol:33-38
Timestamp: 2025-08-29T11:12:02.184Z
Learning: In LDA facets (src/Periphery/Lda/Facets/**/*.sol), tokenIn parameter validation (checking for address(0)) is intentionally not performed as part of the design architecture.

Applied to files:

  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-04-21T03:17:53.443Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs involving address updates like the RelayFacet to Worldchain, verify the actual presence of entries in files before reporting issues. The RelayFacet exists in the diamond log file and the PR diff already contains the necessary address change.

Applied to files:

  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-01-28T11:29:09.566Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 945
File: test/solidity/Facets/GlacisFacet.t.sol:0-0
Timestamp: 2025-01-28T11:29:09.566Z
Learning: Empty test methods with explanatory comments are acceptable in test classes when the feature being tested (e.g., native token bridging) is not supported by the implementation.

Applied to files:

  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-08-29T11:53:38.549Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1328
File: test/solidity/Periphery/LDA/BaseCoreRouteTest.t.sol:379-388
Timestamp: 2025-08-29T11:53:38.549Z
Learning: In test/solidity/Periphery/LDA/BaseCoreRouteTest.t.sol, for the revert-testing helper function _executeAndVerifySwap, only the aggregator branch (CommandType.DistributeSelfERC20) should use amountIn-1 to underfund and trigger insufficient balance errors, while user-funded branches should use the full amountIn to test other error conditions.

Applied to files:

  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2024-10-22T03:24:24.705Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 807
File: test/solidity/Facets/GasZipFacet.t.sol:337-339
Timestamp: 2024-10-22T03:24:24.705Z
Learning: In `GasZipFacet` tests, when expecting a failure due to insufficient balance for sending value, the test should expect a generic revert without specifying a specific error.

Applied to files:

  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-01-22T12:38:37.557Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 945
File: test/solidity/utils/TestBase.sol:446-470
Timestamp: 2025-01-22T12:38:37.557Z
Learning: Test utility functions in TestBase.sol don't require production-level validations like slippage checks and input validation since they operate in a controlled test environment.

Applied to files:

  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-08-20T09:56:24.259Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1327
File: docs/OutputValidator.md:23-29
Timestamp: 2025-08-20T09:56:24.259Z
Learning: In src/Periphery/OutputValidator.sol, the ERC20 token flow that uses balanceOf(msg.sender) to compute actualAmount and transfers the excess via safeTransferFrom is intentional behavior, as confirmed by 0xDEnYO. The design choice to potentially include pre-existing ERC20 balances in the excess calculation is by design and should not be flagged as a security concern in future reviews.

Applied to files:

  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-09-19T14:10:55.064Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 1324
File: src/Facets/EcoFacet.sol:68-71
Timestamp: 2025-09-19T14:10:55.064Z
Learning: In src/Facets/EcoFacet.sol, the team prefers to use msg.sender as the refund address for native tokens in the refundExcessNative modifier, contrary to the general guideline of requiring explicit refund parameters.

Applied to files:

  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-08-27T22:23:51.257Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1328
File: src/Periphery/Lda/Facets/NativeWrapperFacet.sol:0-0
Timestamp: 2025-08-27T22:23:51.257Z
Learning: In src/Periphery/Lda/Facets/NativeWrapperFacet.sol, the wrapNative function should not validate msg.value == amountIn because CoreRouteFacet's DistributeNative command (command type 3) overrides the amountIn parameter with address(this).balance, making such validation incorrect and causing false failures.

Applied to files:

  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-10-13T11:13:48.847Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1413
File: src/Facets/EverclearV2Facet.sol:75-96
Timestamp: 2025-10-13T11:13:48.847Z
Learning: In EverclearV2Facet (and all LiFi facets), the team standard is to use msg.sender as the refund address with the refundExcessNative modifier, not requiring an explicit refund address parameter.

Applied to files:

  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-07-11T09:43:22.393Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1193
File: test/solidity/Facets/AllowListMigratorFacet.t.sol:39-52
Timestamp: 2025-07-11T09:43:22.393Z
Learning: For fork-based tests like AllowListMigratorFacet.t.sol that work with existing deployed contracts (mainnet diamond), initTestBase() is intentionally omitted since the standard test initialization is not needed.

Applied to files:

  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-04-04T07:21:52.878Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1086
File: test/solidity/utils/TestBase.sol:195-205
Timestamp: 2025-04-04T07:21:52.878Z
Learning: In the TestBase.sol file, the Optimism network constants are set correctly with:
- ADDRESS_UNISWAP_OPTIMISM: 0x4A7b5Da61326A6379179b40d00F57E5bbDC962c2 (Uniswap V2 Router)
- ADDRESS_USDC_OPTIMISM: 0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85 (Native USDC)
- USDC.e (bridged USDC from Ethereum) on Optimism has address 0x7f5c764cbc14f9669b88837ca1490cca17c31607

Applied to files:

  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-05-06T09:09:38.108Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1117
File: test/solidity/Periphery/LiFiDEXAggregator.t.sol:111-127
Timestamp: 2025-05-06T09:09:38.108Z
Learning: The `setupApechain()` function in LiFiDEXAggregator tests intentionally avoids calling `initTestBase()` to prevent needing to define standard contracts (like ADDRESS_USDC_PROXY and Uniswap) that aren't needed for Apechain-specific tests.

Applied to files:

  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-08-28T02:41:07.505Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1321
File: docs/RelayDepositoryFacet.md:9-10
Timestamp: 2025-08-28T02:41:07.505Z
Learning: Unit tests for RelayDepositoryFacet cannot verify fund forwarding behavior after deposits because the facet delegates to external IRelayDepository contracts. The forwarding logic is implemented in the Relay Protocol V2 Depository contracts, not in the facet itself.

Applied to files:

  • test/solidity/Facets/GlacisFacet.t.sol
📚 Learning: 2025-06-15T08:47:22.079Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1208
File: test/solidity/utils/TestAMM.sol:18-22
Timestamp: 2025-06-15T08:47:22.079Z
Learning: For test contracts in the lifinance/contracts repository, simpler error handling approaches are acceptable and preferred over more complex error bubbling mechanisms, as the focus is on functionality rather than detailed error reporting.

Applied to files:

  • test/solidity/Facets/GlacisFacet.t.sol
🪛 Gitleaks (8.28.0)
test/solidity/Facets/GlacisFacet.t.sol

[high] 774-774: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 775-775: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 793-793: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 794-794: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: run-unit-tests
  • GitHub Check: enforce-min-test-coverage
🔇 Additional comments (11)
docs/GlacisFacet.md (1)

3-88: LGTM! Comprehensive documentation for the multibridge routing feature.

The documentation clearly explains:

  • Version information and compatibility
  • The new outputToken parameter and its behavior
  • Default routing vs. specific token routing with concrete examples
  • Breaking change notice with migration guidance

This will help integrators understand and adopt the new functionality.

src/Facets/GlacisFacet.sol (2)

35-41: LGTM! Struct extension is clean and well-documented.

The new outputToken field is properly documented, and the bytes32 type is appropriate for representing either an address (padded) or the zero value for default routing.


155-168: LGTM! AIRLIFT integration correctly updated.

The 6-parameter send() call properly includes the new outputToken parameter, and the comments clearly explain the routing behavior. Event emission follows the team standard of emitting LiFiTransferStarted at the end of the _startBridge function.

script/demoScripts/demoGlacis.ts (1)

44-46: LGTM! Demo script properly reflects the new API.

The script correctly demonstrates:

  • Using bytes32(0) for default routing in both quoteSend and GlacisData
  • Extended function signature in the calldata output
  • Debug logging for the new parameter

This will help developers understand how to use the multibridge routing feature.

Also applies to: 137-137, 183-183, 220-224, 248-248

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

12-15: LGTM! Test infrastructure properly extended for multibridge routing.

The test base correctly:

  • Documents the new multibridge routing capability
  • Adds outputToken as an address field for test configuration
  • Converts it to bytes32 in GlacisData initialization with proper default handling

The conversion logic outputToken == address(0) ? bytes32(0) : bytes32(uint256(uint160(outputToken))) correctly handles both default routing and specific token scenarios.

Also applies to: 30-30, 139-146


43-60: LGTM! Enhanced test setup for multibridge scenarios.

The setUp now properly funds the diamond and relevant addresses with both tokens and native currency to support multibridge routing tests.


765-801: LGTM! Test configurations for multibridge tokens.

The test contracts for OpenUSDT and USDT0 properly configure:

  • Optimism fork with specific block number for consistency
  • Correct Airlift contract address
  • Source and output token addresses for multibridge routing
  • Destination chain (Unichain)
  • Appropriate fuzzing ranges (1 to 10,000)

Note: The static analysis warnings about "API keys" on lines 774, 775, 793, 794 are false positives—these are legitimate Ethereum contract addresses.

src/Interfaces/IGlacisAirlift.sol (4)

2-2: LGTM! Version bump to 1.1.0 is appropriate.

The minor version increment correctly reflects the addition of new function overloads and data structures.


23-36: LGTM! New data structures support routing functionality.

The TokenFacetConfig and BridgeRoute structs provide the necessary infrastructure for multibridge routing:

  • TokenFacetConfig: Maps entry points and bridge keys to facet configurations
  • BridgeRoute: Defines routing parameters including destination chain, output token, and bridge selection

48-72: LGTM! Function overloads maintain interface compatibility.

The interface extension strategy is sound:

  • Existing send() signature updated to return bytes memory (line 54)
  • New send() overload adds outputToken parameter (lines 65-72)
  • Documentation clearly explains the routing behavior
  • Overload pattern allows callers to choose based on their routing needs

82-108: LGTM! quoteSend overload properly extends the quoting API.

The new quoteSend() overload (lines 100-108) correctly mirrors the send() extension by adding the outputToken parameter, enabling fee estimation for specific routing scenarios. Documentation is clear.

@ezynda3 ezynda3 marked this pull request as ready for review November 10, 2025 14:14
@lifi-action-bot lifi-action-bot marked this pull request as draft November 10, 2025 14:14
@ezynda3 ezynda3 marked this pull request as ready for review November 10, 2025 14:15
@lifi-action-bot lifi-action-bot marked this pull request as draft November 10, 2025 14:15
@lifi-action-bot
Copy link
Collaborator

lifi-action-bot commented Nov 10, 2025

Test Coverage Report

Line Coverage: 85.46% (2828 / 3309 lines)
Function Coverage: 89.08% ( 457 / 513 functions)
Branch Coverage: 63.14% ( 442 / 700 branches)
Test coverage (85.46%) is above min threshold (83%). Check passed.

@ezynda3 ezynda3 marked this pull request as ready for review November 10, 2025 15:12
@lifi-action-bot lifi-action-bot marked this pull request as draft November 10, 2025 15:12
@ezynda3 ezynda3 marked this pull request as ready for review November 11, 2025 12:15
@lifi-action-bot lifi-action-bot marked this pull request as draft November 11, 2025 12:15
@lifinance lifinance deleted a comment from lifi-action-bot Nov 11, 2025
@ezynda3 ezynda3 marked this pull request as ready for review November 11, 2025 12:22
@lifi-action-bot
Copy link
Collaborator

lifi-action-bot commented Nov 11, 2025

🤖 GitHub Action: Security Alerts Review 🔍

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

🟢 View Alert - File: src/Facets/GlacisFacet.sol
🔹 External calls to functions with dynamic return types may possibly run out of gas if calling a malicious function. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/external-call-potential-out-of-gas
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: Not an issue

🟢 View Alert - File: src/Facets/GlacisFacet.sol
🔹 Calling a function without checking the return value may lead to silent failures. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/unused-return-function-call
🔹 Dismiss Reason: Won't fix
🔹 Dismiss Comment: Not an issue

🟢 View Alert - File: src/Facets/GlacisFacet.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: Not an issue

🟢 View Alert - File: src/Facets/GlacisFacet.sol
🔹 Using send() without checking the return value may lead to silent failures of ether transmittal. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/unchecked-send
🔹 Dismiss Reason: False positive
🔹 Dismiss Comment: this is a custom "send" function

No unresolved security alerts! 🎉

@lifi-action-bot lifi-action-bot marked this pull request as draft November 11, 2025 12:22
@ezynda3 ezynda3 marked this pull request as ready for review November 11, 2025 12:24
@lifi-action-bot lifi-action-bot marked this pull request as draft November 11, 2025 12:24
@ezynda3 ezynda3 marked this pull request as ready for review November 11, 2025 12:24
@lifi-action-bot lifi-action-bot marked this pull request as draft November 11, 2025 12:25
@ezynda3 ezynda3 marked this pull request as ready for review November 11, 2025 12:27
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: 0

🧹 Nitpick comments (11)
script/tasks/diamondUpdateFacet.sh (2)

132-138: Inconsistent skip-simulation flag handling between zkEVM and non-zkEVM paths.

Line 134 (zkEVM) hardcodes --skip-simulation while line 137 (non-zkEVM) uses the dynamic $SKIP_SIMULATION_FLAG variable. This inconsistency may be intentional (e.g., zkEVM always requires skip-simulation), but should be clarified via a comment or unified if unintended.

For reference, line 123 sets SKIP_SIMULATION_FLAG based on environment configuration.


174-178: Use consistent private key handling across zkEVM and non-zkEVM STAGING paths.

Line 175 (zkEVM) passes --private-key $(getPrivateKey ...) directly as a flag, while line 177 (non-zkEVM) assigns the private key to an environment variable first (PRIVATE_KEY=$(getPrivateKey ...)). This asymmetry creates maintenance friction and the unquoted command substitution on line 175 triggers ShellCheck SC2046.

For consistency and robustness, refactor line 175 to match line 177's approach:

     if isZkEvmNetwork "$NETWORK"; then
-      RAW_RETURN_DATA=$(FOUNDRY_PROFILE=zksync NETWORK=$NETWORK FILE_SUFFIX=$FILE_SUFFIX USE_DEF_DIAMOND=$USE_MUTABLE_DIAMOND ./foundry-zksync/forge script "$SCRIPT_PATH" -f "$NETWORK" --json --broadcast --skip-simulation --slow --zksync --gas-limit 50000000 --private-key $(getPrivateKey "$NETWORK" "$ENVIRONMENT"))
+      RAW_RETURN_DATA=$(FOUNDRY_PROFILE=zksync NETWORK=$NETWORK FILE_SUFFIX=$FILE_SUFFIX USE_DEF_DIAMOND=$USE_MUTABLE_DIAMOND PRIVATE_KEY=$(getPrivateKey "$NETWORK" "$ENVIRONMENT") ./foundry-zksync/forge script "$SCRIPT_PATH" -f "$NETWORK" --json --broadcast --skip-simulation --slow --zksync --gas-limit 50000000)

This aligns with line 177 and eliminates the ShellCheck quoting warning.

script/deploy/zksync/utils/ScriptBase.sol (1)

1-2: License identifier differs from stated repo guidelines

Guidelines specify SPDX-License-Identifier: LGPL-3.0-only for Solidity files under script/, but this file still uses UNLICENSED. Consider aligning the header here (and elsewhere under script/) with the repo standard, ideally in a small follow‑up PR so it’s applied consistently.

script/helperFunctions.sh (2)

658-660: Make getZkSolcVersion resilient: fallback section + quote-agnostic parsing.

Current grep only reads [profile.default.zksync] and assumes single quotes. Add fallback to [profile.zksync] and support ' or " to avoid breakage across repos.

 function getZkSolcVersion() {
   local NETWORK="$1"
 
   if isZkEvmNetwork "$NETWORK"; then
-    # Extract zksolc version from default.zksync profile section
-    grep -A 10 "^\[profile\.default\.zksync\]" foundry.toml | grep "zksolc" | cut -d "'" -f 2
+    # Try default.zksync first, then legacy [profile.zksync]; accept ' or " quotes
+    local v
+    v=$(awk '
+      BEGIN{section=""}
+      /^\[profile\.default\.zksync\]/{section="default.zksync"; next}
+      /^\[profile\.zksync\]/{if (section=="") section="zksync"; next}
+      /^\[profile\./{if (section!="") exit}
+      section!="" && $0 ~ /zksolc/ {
+        if (match($0, /[\"\047]([^\"\047]+)[\"\047]/, m)) { print m[1]; exit }
+      }' foundry.toml)
+    echo "${v}"
   else
     echo ""
   fi
 }

4643-4643: Respect env override for FOUNDRY_ZKSYNC_VERSION (doc/code mismatch).

Header says env var can specify version, but local var shadows it. Use defaulting to v0.0.32 while allowing override.

-install_foundry_zksync() {
-  # Foundry ZKSync version
-  local FOUNDRY_ZKSYNC_VERSION="v0.0.32"
+install_foundry_zksync() {
+  # Foundry ZKSync version (allow env override, default to v0.0.32)
+  local FOUNDRY_ZKSYNC_VERSION="${FOUNDRY_ZKSYNC_VERSION:-v0.0.32}"

Please confirm v0.0.32 matches the repo’s expected foundry-zksync release; if not, set it via env when calling the function.

script/deploy/zksync/DeployWhitelistManagerFacet.zksync.s.sol (1)

1-1: License identifier should be LGPL-3.0-only per coding guidelines.

As per coding guidelines, Solidity files in script/ directory should use LGPL-3.0-only license identifier. However, this may be intentional for zkSync-specific deployment scripts. Please verify if UNLICENSED is the intended license for this file.

-// SPDX-License-Identifier: UNLICENSED
+// SPDX-License-Identifier: LGPL-3.0-only
script/deploy/zksync/UpdateWhitelistManagerFacet.zksync.s.sol (1)

22-33: Salt computation duplicated across scripts - consider extracting to shared constant.

The salt computation (keccak256(abi.encodePacked("MigrateWhitelistManager"))) is duplicated between this file and DeployWhitelistManagerFacet.zksync.s.sol. While the comment on line 28 acknowledges this must match, consider extracting to a shared constant in a base contract to prevent drift.

That said, the current implementation is correct and the explicit comment helps maintain synchronization.

script/deploy/zksync/utils/UpdateScriptBase.sol (4)

8-24: New AccessManagerFacet import and helper structs look consistent; Approval currently unused

The AccessManagerFacet import and the new FunctionSelector/InvalidHexDigit additions fit the existing patterns and look fine.

Note: Approval is defined but not used within this base contract. If it is only intended for future external use (e.g., as a shared type in other scripts), that’s fine; otherwise, consider removing it or wiring it into actual logic to avoid dead code.


58-117: Clarify and constrain updater semantics for diamondCut _init to avoid silent misconfiguration

The new update(string memory name, address updater) overload and wiring of:

callData.length > 0 ? updater : address(0)

into both the encoded cutData and the actual cutter.diamondCut call cleanly generalize the initializer target beyond facet itself.

However, this makes updater the _init address for the diamondCut delegatecall. If a derived script accidentally passes an EOA or a contract that does not implement the initializer encoded in getCallData(), the diamondCut initializer delegatecall can either:

  • Succeed but do nothing (EOA, no code), leaving state uninitialized, or
  • Revert in a non-obvious way (wrong contract/selector).

To make this harder to misuse, I’d suggest either:

  • Documenting clearly (in a comment/NatSpec) that updater must be the address of the contract containing the initializer function referenced by getCallData(), or
  • Narrowing the API so that common cases call update(name) (current default: updater == facet), and only specialized scripts that truly need a different _init target use the 2‑arg overload with explicit comments at the call sites.

This is mostly about preventing subtle configuration errors rather than changing behavior.


225-232: Minor nit: 0 <= d check is redundant for uint8

d is a uint8, so the 0 <= d part of the first branch is always true:

if (0 <= d && d <= 9) { ... }

This could be simplified to if (d <= 9) for marginally clearer intent:

if (d <= 9) {
    return bytes1(uint8(bytes1("0")) + d);
} else if (d <= 15) {
    return bytes1(uint8(bytes1("a")) + d - 10);
}
revert InvalidHexDigit(d);

The current code is correct; this is just a readability micro‑improvement.


245-321: Ensure approval helpers run within a broadcast context and consider path/json reuse side‑effects

The new approveRefundWallet and approveDeployerWallet helpers are a useful addition: they pull FunctionSelector[] configs from config/global.json and wire per‑selector permissions via AccessManagerFacet(diamond).setCanExecute(bytes4(selector), wallet, true). The use of FunctionSelector.selector as bytes and casting to bytes4 is reasonable given JSON/stdJson constraints.

Two points to double‑check:

  1. Broadcast context for setCanExecute calls

    These helpers do not call vm.startBroadcast/vm.stopBroadcast and they ignore noBroadcast. In this base, only update() manages broadcasting:

    • If typical update scripts only rely on UpdateScriptBase.update(...) for broadcasting (i.e., run() does not wrap everything in its own vm.startBroadcast), then calling approveRefundWallet() / approveDeployerWallet() after update() will execute setCanExecute in a non‑broadcasted context, so no on‑chain state change will occur.
    • To avoid surprises, either:
      • Call these helpers from within a broadcast section in derived scripts (e.g., wrap them in a vm.startBroadcast(deployerPrivateKey) / vm.stopBroadcast() in run()), or
      • Move the broadcast handling into shared helpers that also cover approvals, or
      • Have these helpers themselves respect noBroadcast and optionally manage broadcast similarly to update().

    Please verify how current update scripts are calling these functions so the intended approvals are actually mined.

  2. Mutation of shared path/json state

    Both helpers overwrite the contract‑level path and json to point at config/global.json. If any later logic in the same script expects path/json to still reference the original deployments file, this could lead to confusing behavior. If that’s a concern, consider using local variables here:

    string memory globalPath = string.concat(root, "/config/global.json");
    string memory globalJson = vm.readFile(globalPath);

    and then read from globalJson instead of the shared json field.

Overall structure is solid; the main thing is ensuring these approval calls are executed under the correct broadcast/ownership context.

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