Skip to content

Deprecate RelayFacet#1585

Draft
0xDEnYO wants to merge 4 commits intomainfrom
deprecate-relay-facet
Draft

Deprecate RelayFacet#1585
0xDEnYO wants to merge 4 commits intomainfrom
deprecate-relay-facet

Conversation

@0xDEnYO
Copy link
Copy Markdown
Contributor

@0xDEnYO 0xDEnYO commented Jan 14, 2026

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>

@lifi-action-bot lifi-action-bot marked this pull request as draft January 14, 2026 03:12
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 14, 2026

Walkthrough

Removes the RelayFacet implementation, docs, demo, deploy/update scripts, and target-state entries; migrates tests to RelayDepository-based flows with a new MockRelayDepository and test wrappers; adds deprecation command docs and a pre-commit exclusion for command docs.

Changes

Cohort / File(s) Summary
Documentation Additions & Modifications
.cursor/commands/deprecate-contract.md, .cursor/commands/deprecate-network.md
Adds deprecate-contract.md; expands deprecate-network.md with manual Product Target Sheet steps, example output, and execution flow details.
Git Hooks
.husky/pre-commit
Adds .cursor/commands/ to EXCLUDED_PATHS to skip secret checks for command docs.
Relay Configuration & Target State
config/relay.json, script/deploy/_targetState.json, script/deploy/resources/deployRequirements.json
Removes top-level relaySolver and per-chain relayReceiver keys from config/relay.json; removes RelayFacet entries from target state and deploy requirements.
RelayFacet Source & Docs Removed
src/Facets/RelayFacet.sol, docs/RelayFacet.md, script/demoScripts/demoRelay.ts
Deletes RelayFacet contract (state, structs, events, methods, mapping logic), its documentation, and demo script.
RelayFacet Deploy/Update Scripts Removed
script/deploy/facets/DeployRelayFacet.s.sol, script/deploy/facets/UpdateRelayFacet.s.sol, script/deploy/zksync/DeployRelayFacet.zksync.s.sol, script/deploy/zksync/UpdateRelayFacet.zksync.s.sol
Removes all RelayFacet deploy/update Forge scripts across environments.
RelayFacet Tests Deleted
test/solidity/Facets/RelayFacet.t.sol
Removes the entire RelayFacet test suite and supporting test stubs.
RelayDepository-Based Test Migration
test/solidity/Facets/RelayDepositoryFacet.t.sol, test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol, test/solidity/Periphery/Patcher.t.sol
Reworks tests to use RelayDepositoryFacet flows: adds TestRelayDepositoryFacet and Reverter, replaces in-file mocks with MockRelayDepository import, updates diamond facet wiring and whitelist setup, and adds dynamic patch/edge-case tests.
RelayDepository Test Mock
test/solidity/utils/MockRelayDepository.sol
Adds MockRelayDepository implementing IRelayDepository with deposit tracking, allocator, controlled revert behavior, and native/ERC20 deposit APIs.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

AuditRequired

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is substantially incomplete. While the author checked self-review and scope boxes, critical sections from the template are missing: the Jira task reference, the 'Why' explanation, and reviewer security checklists remain unchecked. Documentation and test coverage claims are marked incomplete. Add the Jira task reference, explain the deprecation rationale, confirm test and documentation updates, and address all reviewer security validation points before merging.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Deprecate RelayFacet' is concise and directly aligned with the primary objective of the pull request, which involves removing RelayFacet from the codebase across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch deprecate-relay-facet


📜 Recent review details

Configuration used: Repository 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 2fd5037 and c2a2312.

📒 Files selected for processing (1)
  • .cursor/commands/deprecate-network.md
🧰 Additional context used
📓 Path-based instructions (1)
.cursor/commands/**/*

📄 CodeRabbit inference engine (.cursor/rules/README.md)

Custom commands must be stored in .cursor/commands/ directory

Files:

  • .cursor/commands/deprecate-network.md
🧠 Learnings (8)
📓 Common learnings
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: 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.
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1464
File: src/Facets/DexManagerFacet.sol:44-68
Timestamp: 2025-11-13T06:58:47.547Z
Learning: The DexManagerFacet in src/Facets/DexManagerFacet.sol is planned for deprecation soon and should be kept as-is without further improvements or modifications.
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: 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: 843
File: script/deploy/facets/DeployRelayFacet.s.sol:0-0
Timestamp: 2024-10-31T09:07:36.301Z
Learning: In `script/deploy/facets/DeployRelayFacet.s.sol`, additional validation for the configuration file existence and address validity is unnecessary because the code will already fail appropriately if the configuration file is missing or the addresses are invalid.
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: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/002-architecture.mdc:0-0
Timestamp: 2025-12-17T10:27:21.083Z
Learning: Applies to src/Facets/**/*.sol : Facets should contain thin, integration-specific logic only; do not move logic across layers without clear architectural reason
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/102-facets.mdc:0-0
Timestamp: 2025-12-17T10:28:13.904Z
Learning: Applies to src/Facets/**/*Facet.sol : In Solidity facets with `minAmountOut` or similar bridge parameters, update the bridge's minAmountOut in `swapAndStartBridgeTokensVia{FacetName}` to account for positive slippage from swaps after `_depositAndSwap` updates `_bridgeData.minAmount`, adjusting proportionally for decimal differences if applicable
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/002-architecture.mdc:0-0
Timestamp: 2025-12-17T10:27:21.083Z
Learning: Applies to src/Facets/**/*.sol : Facets provide modular functionality grouped by concern (bridges, swaps, receivers, admin, etc.)
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1196
File: script/helperFunctions.sh:1447-1462
Timestamp: 2025-06-19T06:23:47.848Z
Learning: 0xDEnYO prefers to keep eval usage in local bash scripts when the security risk is acceptable in their controlled environment, prioritizing simplicity over security hardening for local tooling.
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1266
File: script/deploy/safe/execute-pending-timelock-tx.ts:627-628
Timestamp: 2025-07-17T04:21:26.825Z
Learning: In the lifinance/contracts repository, 0xDEnYO prefers to keep '0x0' as a fallback address in gas estimation calls rather than throwing errors when the wallet account address is not available, prioritizing code simplicity over strict validation.
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1325
File: script/tasks/diamondSyncDEXs.sh:116-116
Timestamp: 2025-08-27T08:45:59.606Z
Learning: In script/tasks/diamondSyncDEXs.sh, user 0xDEnYO has chosen to selectively apply ShellCheck fixes, keeping array assignments using $() construct and other patterns as-is in their controlled deployment environment, prioritizing functionality over strict ShellCheck compliance.
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1212
File: .github/workflows/convertForkedPRsToInternal.yml:81-106
Timestamp: 2025-07-16T06:18:02.682Z
Learning: 0xDEnYO prefers to use printf "%q" for shell escaping in GitHub workflows to increase security and protection from potential injections, even when it might cause formatting issues, prioritizing security over convenience.
📚 Learning: 2024-11-21T08:34:30.300Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 861
File: config/global.json:146-146
Timestamp: 2024-11-21T08:34:30.300Z
Learning: The project is deprecating `safeAddresses` and `safeApiUrls` in `global.json` and moving these configurations to `config/networks.json` for network configurations.

Applied to files:

  • .cursor/commands/deprecate-network.md
📚 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:

  • .cursor/commands/deprecate-network.md
📚 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:

  • .cursor/commands/deprecate-network.md
📚 Learning: 2024-10-08T07:14:52.296Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 825
File: config/networks.json:462-462
Timestamp: 2024-10-08T07:14:52.296Z
Learning: In the `networks.json` file and related configuration files, when updating the `name` property of a network (e.g., from `Scroll` to `zkScroll`), the key of the network object should remain unchanged (e.g., `'scroll'`) to ensure it matches references elsewhere in the codebase.

Applied to files:

  • .cursor/commands/deprecate-network.md
📚 Learning: 2025-12-17T10:27:21.083Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/002-architecture.mdc:0-0
Timestamp: 2025-12-17T10:27:21.083Z
Learning: For any change that could affect selector layout, upgrade flows, or storage layout, cross-check relevant rules and documentation and call out the impact explicitly before editing

Applied to files:

  • .cursor/commands/deprecate-network.md
📚 Learning: 2025-05-27T12:36:26.987Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1168
File: script/deploy/_targetState.json:1564-1589
Timestamp: 2025-05-27T12:36:26.987Z
Learning: When reviewing deployment PRs in the lifinance/contracts repository, target state configuration files (like script/deploy/_targetState.json) may be updated for multiple networks even when the PR is focused on deploying to a specific network. The scope should be determined by the PR title and description, not just by all configuration changes present in the files.

Applied to files:

  • .cursor/commands/deprecate-network.md
📚 Learning: 2024-11-21T08:24:05.881Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 861
File: script/deploy/safe/add-owners-to-safe.ts:8-13
Timestamp: 2024-11-21T08:24:05.881Z
Learning: In `script/deploy/safe/add-owners-to-safe.ts`, validation for network configuration when casting imported JSON data to `NetworksObject` is not required as per the user's preference.

Applied to files:

  • .cursor/commands/deprecate-network.md
🔇 Additional comments (3)
.cursor/commands/deprecate-network.md (3)

110-116: Previous issue properly addressed.

The bare URL has been correctly converted to a proper markdown link with descriptive text. The formatting now follows markdown best practices.


221-229: Previous issue properly addressed.

The bare URL in the "Manual Steps Required" section has been correctly formatted as a markdown link, improving readability and following best practices.


279-289: Previous issue properly addressed.

The duplicate manual step reminder block has been successfully removed. Only one reminder block now appears in the example output section. The bare URL at line 284 is appropriate here since it's part of an example showing actual terminal/console output.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

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.

Copy link
Copy Markdown
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: 3

🤖 Fix all issues with AI agents
In @.cursor/commands/deprecate-network.md:
- Around line 221-229: The bare Google Sheets URL in the "Manual Steps Required"
section is not formatted as a markdown link; edit the
.cursor/commands/deprecate-network.md content and replace the raw URL text with
a markdown-formatted link (e.g., descriptive text in square brackets followed by
the URL in parentheses) so the spreadsheet URL is presented as a clickable link
while keeping the same descriptive text about the spreadsheet.
- Around line 110-116: The bare Google Sheets URL should be turned into a proper
Markdown link to improve readability; replace the raw URL string
"https://docs.google.com/spreadsheets/d/1jX1wfFkSn1s19I_KzMA7vB1kfgGxXUv7kRqwUGJJLF4/edit#gid=0"
with a descriptive Markdown link (e.g., "Product Target State spreadsheet")
using standard link syntax so the sheet text is clickable and clear in the
deprecate-network.md content.
- Around line 279-300: The file contains an identical duplicated reminder block
titled "⚠️  MANUAL STEP REQUIRED: Update Product Target Sheet" (the two
consecutive blocks showing the same spreadsheet URL and actions to move "fantom"
and "harmony"); remove the redundant second block so only one manual-step
reminder remains, ensuring the single remaining block preserves the exact
header, URL and action list.
🧹 Nitpick comments (2)
.cursor/commands/deprecate-contract.md (1)

1-281: Well-structured command documentation.

The deprecate-contract command documentation is comprehensive, covering discovery, reference analysis, test coverage preservation, removal operations, and post-removal verification. The 7-step execution flow is clear and actionable.

One minor improvement: the static analysis tool flagged the code block at line 168 for missing a language specifier. Since this displays console/terminal output, consider adding a language hint like text or console for proper syntax highlighting:

📝 Suggested fix
-```
+```text
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol (1)

366-374: Clarify assertion semantics for bridge flow.

The assertion assertTrue(wstEthBalance > 0) checks that USER_SENDER has wstETH after the bridge operation. In a real bridge flow, the tokens would be transferred to the depository, leaving the user with zero balance. This assertion may pass due to MockRelayDepository not actually transferring tokens, but the test semantics could be misleading.

Consider adding a comment explaining this is mock-specific behavior, or alternatively assert against the mock depository's balance to verify the bridge path was exercised.

📜 Review details

Configuration used: Repository 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 4439bdc and bc23400.

📒 Files selected for processing (18)
  • .cursor/commands/deprecate-contract.md
  • .cursor/commands/deprecate-network.md
  • .husky/pre-commit
  • config/relay.json
  • docs/RelayFacet.md
  • script/demoScripts/demoRelay.ts
  • script/deploy/_targetState.json
  • script/deploy/facets/DeployRelayFacet.s.sol
  • script/deploy/facets/UpdateRelayFacet.s.sol
  • script/deploy/resources/deployRequirements.json
  • script/deploy/zksync/DeployRelayFacet.zksync.s.sol
  • script/deploy/zksync/UpdateRelayFacet.zksync.s.sol
  • src/Facets/RelayFacet.sol
  • test/solidity/Facets/RelayDepositoryFacet.t.sol
  • test/solidity/Facets/RelayFacet.t.sol
  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Periphery/Patcher.t.sol
  • test/solidity/utils/MockRelayDepository.sol
💤 Files with no reviewable changes (10)
  • docs/RelayFacet.md
  • script/deploy/resources/deployRequirements.json
  • config/relay.json
  • src/Facets/RelayFacet.sol
  • script/deploy/facets/DeployRelayFacet.s.sol
  • test/solidity/Facets/RelayFacet.t.sol
  • script/deploy/zksync/DeployRelayFacet.zksync.s.sol
  • script/demoScripts/demoRelay.ts
  • script/deploy/facets/UpdateRelayFacet.s.sol
  • script/deploy/zksync/UpdateRelayFacet.zksync.s.sol
🧰 Additional context used
📓 Path-based instructions (7)
.cursor/commands/**/*

📄 CodeRabbit inference engine (.cursor/rules/README.md)

Custom commands must be stored in .cursor/commands/ directory

Files:

  • .cursor/commands/deprecate-contract.md
  • .cursor/commands/deprecate-network.md
test/solidity/**/*.sol

📄 CodeRabbit inference engine (.cursor/rules/001-project-structure.mdc)

Place test files in test/solidity/ mirroring the src/ directory structure for organization

Files:

  • test/solidity/utils/MockRelayDepository.sol
  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Periphery/Patcher.t.sol
  • test/solidity/Facets/RelayDepositoryFacet.t.sol
**/*.sol

📄 CodeRabbit inference engine (.cursor/rules/001-project-structure.mdc)

Use remappings defined in remappings.txt for imports: lifi/src/, test/test/, and external libs like @openzeppelin/, solmate/, solady/, permit2/

**/*.sol: Single Diamond (EIP-2535) as main entrypoint for all protocol interactions
Delegate complex logic to libraries (LibAsset, LibSwap, LibAllowList, SwapperV2, Validatable) and helper contracts

After Solidity changes, run forge test (or note suites remaining)

**/*.sol: Own files must use // SPDX-License-Identifier: LGPL-3.0-only immediately followed by the pragma statement with no blank line in between
All contracts must use pragma solidity ^0.8.17;
Functions and variables use camelCase; constants and immutables are CONSTANT_CASE
Function parameters use leading underscore (e.g., _amount)
Contracts and interfaces must include NatSpec: @title (matching contract/interface name), @author LI.FI (https://li.fi), @notice describing purpose, and @custom:version X.Y.Z
Public and external functions require NatSpec including params and returns documentation
For pure test/script scaffolding keep NatSpec headers minimal but retain SPDX and pragma
Use single blank lines between logical sections and between function declarations
Follow in-function blank-line rules: blank lines before emits/returns; no stray gaps
Use custom errors instead of revert strings; prefer existing errors/helpers before adding new ones
Use generic errors from src/Errors/GenericErrors.sol; bump @custom:version when adding; facet-specific errors stay local
Adhere to rules in .solhint.json
Avoid assembly unless necessary and heavily commented with justification (why assembly is needed); prefer existing helpers over new implementations

Do not mix interface and implementation in the same file

Files:

  • test/solidity/utils/MockRelayDepository.sol
  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Periphery/Patcher.t.sol
  • test/solidity/Facets/RelayDepositoryFacet.t.sol
**/test/**/*.sol

📄 CodeRabbit inference engine (.cursor/rules/103-solidity-interfaces.mdc)

Test interfaces may define inline interfaces as needed for testing purposes

Files:

  • test/solidity/utils/MockRelayDepository.sol
  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Periphery/Patcher.t.sol
  • test/solidity/Facets/RelayDepositoryFacet.t.sol
{src,script,test}/**/*.{sol,ts}

📄 CodeRabbit inference engine (.cursor/rules/105-security.mdc)

Validate all external inputs and configuration (including script/env values) explicitly; prefer existing validation helpers (e.g., Validatable, config readers) over ad-hoc checks

Files:

  • test/solidity/utils/MockRelayDepository.sol
  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Periphery/Patcher.t.sol
  • test/solidity/Facets/RelayDepositoryFacet.t.sol
test/**/*.t.sol

📄 CodeRabbit inference engine (.cursor/rules/400-solidity-tests.mdc)

test/**/*.t.sol: Tests under test/solidity/, mirroring src/ structure; require setUp() function; call initTestBase() when inheriting TestBase directly or indirectly; label actors with vm.label
For facet tests, inherit from TestBaseFacet rather than TestBase, since standard facet functions need to be overridden
Import ordering: system libraries first (e.g., forge-std, ds-test), then project files (e.g., lifi/, test/)
Test function names: test_ prefix for success tests, testRevert_ prefix for failure tests, testBase_ prefix for base tests
Test structure: setup → execute → assert; use vm.startPrank / vm.stopPrank, labels, and base inits
Always assert specific revert reasons; use vm.expectRevert with specific reason
Use vm.expectEmit(true, true, true, true, <addr>) for event assertions
Apply blank line conventions: add gap after vm.expectRevert before the call, and gap before assertions/events
For whitelist flows, inherit TestWhitelistManagerBase and use addToWhitelist / setFunctionWhitelistBySelector helpers
If a facet does not support native tokens, override tests such as testBase_CanSwapAndBridgeNativeTokens and testBase_CanBridgeNativeTokens with public override and include a comment explaining why the test is intentionally skipped

Files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Periphery/Patcher.t.sol
  • test/solidity/Facets/RelayDepositoryFacet.t.sol
**/*.{test.ts,t.sol}

📄 CodeRabbit inference engine (.cursor/rules/401-testing-patterns.mdc)

**/*.{test.ts,t.sol}: Prefer adding or updating tests alongside logic changes
Keep tests structured as setup → execute → assert
Assert specific failure conditions (avoid overly-broad "catch-all" assertions)

Files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Periphery/Patcher.t.sol
  • test/solidity/Facets/RelayDepositoryFacet.t.sol
🧠 Learnings (81)
📓 Common learnings
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: 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.
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: 1464
File: src/Facets/DexManagerFacet.sol:44-68
Timestamp: 2025-11-13T06:58:47.547Z
Learning: The DexManagerFacet in src/Facets/DexManagerFacet.sol is planned for deprecation soon and should be kept as-is without further improvements or modifications.
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: 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: 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: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/102-facets.mdc:0-0
Timestamp: 2025-12-17T10:28:13.904Z
Learning: Applies to src/Facets/**/*Facet.sol : In Solidity facets with `minAmountOut` or similar bridge parameters, update the bridge's minAmountOut in `swapAndStartBridgeTokensVia{FacetName}` to account for positive slippage from swaps after `_depositAndSwap` updates `_bridgeData.minAmount`, adjusting proportionally for decimal differences if applicable
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.
Learnt from: ezynda3
Repo: lifinance/contracts PR: 843
File: script/deploy/facets/DeployRelayFacet.s.sol:0-0
Timestamp: 2024-10-31T09:07:36.301Z
Learning: In `script/deploy/facets/DeployRelayFacet.s.sol`, additional validation for the configuration file existence and address validity is unnecessary because the code will already fail appropriately if the configuration file is missing or the addresses are invalid.
Learnt from: ezynda3
Repo: lifinance/contracts PR: 861
File: script/deploy/_targetState.json:1364-1390
Timestamp: 2024-11-21T08:25:26.214Z
Learning: For the Cronos network configuration in `script/deploy/_targetState.json`, the absence of bridge facets such as `StargateFacet`, `AcrossFacet`, `HopFacet`, and `SymbiosisFacet` is acceptable and expected.
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/001-project-structure.mdc:0-0
Timestamp: 2025-12-17T10:27:05.481Z
Learning: Applies to script/deploy/**/*.s.sol : Place deployment scripts in `script/deploy/facets/` for facet deployments or `script/deploy/` for other contracts. Use Foundry's `Script` contract pattern.
Learnt from: mirooon
Repo: lifinance/contracts PR: 975
File: test/solidity/Facets/DeBridgeDlnFacet.t.sol:0-0
Timestamp: 2025-02-17T07:59:54.979Z
Learning: In DeBridgeDlnFacet, chain ID mappings are hardcoded and not designed to be dynamically updated, so tests for mapping updates are not needed.
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1196
File: script/helperFunctions.sh:1447-1462
Timestamp: 2025-06-19T06:23:47.848Z
Learning: 0xDEnYO prefers to keep eval usage in local bash scripts when the security risk is acceptable in their controlled environment, prioritizing simplicity over security hardening for local tooling.
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1266
File: script/deploy/safe/execute-pending-timelock-tx.ts:627-628
Timestamp: 2025-07-17T04:21:26.825Z
Learning: In the lifinance/contracts repository, 0xDEnYO prefers to keep '0x0' as a fallback address in gas estimation calls rather than throwing errors when the wallet account address is not available, prioritizing code simplicity over strict validation.
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1325
File: script/tasks/diamondSyncDEXs.sh:116-116
Timestamp: 2025-08-27T08:45:59.606Z
Learning: In script/tasks/diamondSyncDEXs.sh, user 0xDEnYO has chosen to selectively apply ShellCheck fixes, keeping array assignments using $() construct and other patterns as-is in their controlled deployment environment, prioritizing functionality over strict ShellCheck compliance.
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1212
File: .github/workflows/convertForkedPRsToInternal.yml:81-106
Timestamp: 2025-07-16T06:18:02.682Z
Learning: 0xDEnYO prefers to use printf "%q" for shell escaping in GitHub workflows to increase security and protection from potential injections, even when it might cause formatting issues, prioritizing security over convenience.
📚 Learning: 2025-12-17T10:27:05.481Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/001-project-structure.mdc:0-0
Timestamp: 2025-12-17T10:27:05.481Z
Learning: Do not commit generated directories: `broadcast/`, `cache/`, `out/`, `typechain/`, and `node_modules/`. Do not modify `.cursor/` directory unless adding new rules.

Applied to files:

  • .husky/pre-commit
📚 Learning: 2025-12-24T08:52:48.554Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/101-solidity-contracts.mdc:0-0
Timestamp: 2025-12-24T08:52:48.554Z
Learning: When adding a new deployable contract, create a corresponding documentation page in `docs/` (mirroring existing docs conventions for new integrations/contracts).

Applied to files:

  • .cursor/commands/deprecate-contract.md
📚 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:

  • .cursor/commands/deprecate-contract.md
  • .cursor/commands/deprecate-network.md
  • script/deploy/_targetState.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:

  • .cursor/commands/deprecate-contract.md
  • .cursor/commands/deprecate-network.md
  • script/deploy/_targetState.json
📚 Learning: 2024-11-25T06:25:01.232Z
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.

Applied to files:

  • .cursor/commands/deprecate-contract.md
📚 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:

  • .cursor/commands/deprecate-contract.md
  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • script/deploy/_targetState.json
  • test/solidity/Periphery/Patcher.t.sol
  • test/solidity/Facets/RelayDepositoryFacet.t.sol
📚 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:

  • .cursor/commands/deprecate-contract.md
  • test/solidity/utils/MockRelayDepository.sol
  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • script/deploy/_targetState.json
  • test/solidity/Periphery/Patcher.t.sol
  • test/solidity/Facets/RelayDepositoryFacet.t.sol
📚 Learning: 2025-12-17T10:27:05.481Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/001-project-structure.mdc:0-0
Timestamp: 2025-12-17T10:27:05.481Z
Learning: Applies to src/Periphery/**/*.sol : Place new periphery contracts in the `src/Periphery/` directory. These are standalone contracts called by the Diamond but are not facets and can be upgraded independently.

Applied to files:

  • .cursor/commands/deprecate-contract.md
  • test/solidity/Periphery/Patcher.t.sol
📚 Learning: 2025-12-17T10:27:05.481Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/001-project-structure.mdc:0-0
Timestamp: 2025-12-17T10:27:05.481Z
Learning: Applies to script/deploy/**/*.s.sol : Place deployment scripts in `script/deploy/facets/` for facet deployments or `script/deploy/` for other contracts. Use Foundry's `Script` contract pattern.

Applied to files:

  • .cursor/commands/deprecate-contract.md
📚 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:

  • .cursor/commands/deprecate-contract.md
  • script/deploy/_targetState.json
📚 Learning: 2025-09-12T11:48:46.333Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1377
File: deployments/mainnet.json:7-7
Timestamp: 2025-09-12T11:48:46.333Z
Learning: When running verification scripts for contract deployments, ensure the scripts are syntactically correct and thoroughly tested before making claims about contract validity. False negatives from faulty scripts can incorrectly flag valid deployments as problematic.

Applied to files:

  • .cursor/commands/deprecate-contract.md
📚 Learning: 2025-12-24T08:52:48.554Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/101-solidity-contracts.mdc:0-0
Timestamp: 2025-12-24T08:52:48.554Z
Learning: Do not modify production contracts in `src/` unless explicitly requested; changes to production logic could introduce bugs and may be overlooked.

Applied to files:

  • .cursor/commands/deprecate-contract.md
📚 Learning: 2024-11-21T08:34:30.300Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 861
File: config/global.json:146-146
Timestamp: 2024-11-21T08:34:30.300Z
Learning: The project is deprecating `safeAddresses` and `safeApiUrls` in `global.json` and moving these configurations to `config/networks.json` for network configurations.

Applied to files:

  • .cursor/commands/deprecate-network.md
📚 Learning: 2025-05-27T12:36:26.987Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1168
File: script/deploy/_targetState.json:1564-1589
Timestamp: 2025-05-27T12:36:26.987Z
Learning: When reviewing deployment PRs in the lifinance/contracts repository, target state configuration files (like script/deploy/_targetState.json) may be updated for multiple networks even when the PR is focused on deploying to a specific network. The scope should be determined by the PR title and description, not just by all configuration changes present in the files.

Applied to files:

  • .cursor/commands/deprecate-network.md
📚 Learning: 2024-11-21T08:24:05.881Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 861
File: script/deploy/safe/add-owners-to-safe.ts:8-13
Timestamp: 2024-11-21T08:24:05.881Z
Learning: In `script/deploy/safe/add-owners-to-safe.ts`, validation for network configuration when casting imported JSON data to `NetworksObject` is not required as per the user's preference.

Applied to files:

  • .cursor/commands/deprecate-network.md
📚 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/utils/MockRelayDepository.sol
  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • script/deploy/_targetState.json
  • test/solidity/Periphery/Patcher.t.sol
  • test/solidity/Facets/RelayDepositoryFacet.t.sol
📚 Learning: 2025-12-17T10:28:13.904Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/102-facets.mdc:0-0
Timestamp: 2025-12-17T10:28:13.904Z
Learning: Applies to src/Facets/**/*Facet.sol : Facets must use LibAsset, LibSwap, and LibAllowList utilities along with Validatable and SwapperV2 interfaces; reserve native fees via `_depositAndSwap` variants when needed

Applied to files:

  • test/solidity/utils/MockRelayDepository.sol
  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • script/deploy/_targetState.json
  • test/solidity/Facets/RelayDepositoryFacet.t.sol
📚 Learning: 2025-12-17T10:28:34.379Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/104-receiver-contracts.mdc:0-0
Timestamp: 2025-12-17T10:28:34.379Z
Learning: Applies to src/Periphery/Receiver*.sol : Receiver contracts must implement internal `_swapAndCompleteBridgeTokens()` function that handles native vs ERC20 tokens: use `safeApproveWithRetry()` or `safeIncreaseAllowance()` for ERC20 (reset to 0 after), pass `value: amount` for native tokens, call `executor.swapAndCompleteBridgeTokens()` in try-catch block, and on failure send raw tokens to receiver and emit `LiFiTransferRecovered`

Applied to files:

  • test/solidity/utils/MockRelayDepository.sol
  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Periphery/Patcher.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/utils/MockRelayDepository.sol
  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Periphery/Patcher.t.sol
📚 Learning: 2025-12-17T10:29:29.239Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/400-solidity-tests.mdc:0-0
Timestamp: 2025-12-17T10:29:29.239Z
Learning: Applies to test/**/*.t.sol : If a facet does not support native tokens, override tests such as `testBase_CanSwapAndBridgeNativeTokens` and `testBase_CanBridgeNativeTokens` with `public override` and include a comment explaining why the test is intentionally skipped

Applied to files:

  • test/solidity/utils/MockRelayDepository.sol
  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Periphery/Patcher.t.sol
  • test/solidity/Facets/RelayDepositoryFacet.t.sol
📚 Learning: 2025-12-17T10:28:13.904Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/102-facets.mdc:0-0
Timestamp: 2025-12-17T10:28:13.904Z
Learning: Applies to src/Facets/**/*Facet.sol : In Solidity facets with `minAmountOut` or similar bridge parameters, update the bridge's minAmountOut in `swapAndStartBridgeTokensVia{FacetName}` to account for positive slippage from swaps after `_depositAndSwap` updates `_bridgeData.minAmount`, adjusting proportionally for decimal differences if applicable

Applied to files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • script/deploy/_targetState.json
  • test/solidity/Periphery/Patcher.t.sol
  • test/solidity/Facets/RelayDepositoryFacet.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/Periphery/LidoWrapper/LidoWrapper.t.sol
  • script/deploy/_targetState.json
  • test/solidity/Periphery/Patcher.t.sol
📚 Learning: 2025-12-17T10:28:13.904Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/102-facets.mdc:0-0
Timestamp: 2025-12-17T10:28:13.904Z
Learning: Applies to src/Facets/**/*Facet.sol : Facets must implement required functions: `_startBridge` (internal), `swapAndStartBridgeTokensVia{FacetName}`, and `startBridgeTokensVia{FacetName}`

Applied to files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • script/deploy/_targetState.json
  • test/solidity/Periphery/Patcher.t.sol
📚 Learning: 2025-12-17T10:27:21.083Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/002-architecture.mdc:0-0
Timestamp: 2025-12-17T10:27:21.083Z
Learning: Applies to src/Periphery/**/*.sol : Periphery contracts handle specialized flows that don't belong directly in the Diamond

Applied to files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Periphery/Patcher.t.sol
📚 Learning: 2025-12-15T09:02:38.869Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1530
File: test/solidity/Facets/CelerCircleBridgeFacet.t.sol:1-10
Timestamp: 2025-12-15T09:02:38.869Z
Learning: For test files in test/solidity/Facets/**, the SPDX license identifier should be immediately followed by the pragma statement without a blank line in between, as confirmed by mirooon for test/solidity/Facets/CelerCircleBridgeFacet.t.sol.

Applied to files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Periphery/Patcher.t.sol
📚 Learning: 2025-12-17T10:27:21.083Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/002-architecture.mdc:0-0
Timestamp: 2025-12-17T10:27:21.083Z
Learning: Applies to src/Facets/**/*.sol : Facets provide modular functionality grouped by concern (bridges, swaps, receivers, admin, etc.)

Applied to files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • script/deploy/_targetState.json
  • test/solidity/Facets/RelayDepositoryFacet.t.sol
📚 Learning: 2025-12-17T10:27:21.083Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/002-architecture.mdc:0-0
Timestamp: 2025-12-17T10:27:21.083Z
Learning: Applies to **/*.sol : Delegate complex logic to libraries (LibAsset, LibSwap, LibAllowList, SwapperV2, Validatable) and helper contracts

Applied to files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Facets/RelayDepositoryFacet.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/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Periphery/Patcher.t.sol
📚 Learning: 2025-06-07T04:11:20.100Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1141
File: test/solidity/Periphery/LidoWrapper.t.sol:55-70
Timestamp: 2025-06-07T04:11:20.100Z
Learning: On Layer 2 networks, Lido's stETH contract has inverted function naming compared to expected behavior: `unwrap()` converts stETH → wstETH, and `wrap()` converts wstETH → stETH. This is the opposite of what the function names suggest but is how Lido implemented their L2 contracts.

Applied to files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
📚 Learning: 2025-12-17T10:28:34.379Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/104-receiver-contracts.mdc:0-0
Timestamp: 2025-12-17T10:28:34.379Z
Learning: Applies to src/Periphery/Receiver*.sol : Receiver contracts must use `LibAsset` for asset operations, `LibSwap` for swap data structures, and `SafeTransferLib` from solady for safe transfers

Applied to files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
📚 Learning: 2024-10-10T03:18:20.721Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 782
File: test/solidity/Helpers/WithdrawablePeriphery.t.sol:22-35
Timestamp: 2024-10-10T03:18:20.721Z
Learning: In Solidity tests for withdrawal functions in `test/solidity/Helpers/WithdrawablePeriphery.t.sol`, do not suggest adding tests where the withdrawal amount exceeds the contract's balance, as such tests are unnecessary because any contract will fail in that case.

Applied to files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Periphery/Patcher.t.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:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Periphery/Patcher.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/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Periphery/Patcher.t.sol
  • test/solidity/Facets/RelayDepositoryFacet.t.sol
📚 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:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Periphery/Patcher.t.sol
📚 Learning: 2024-10-31T09:10:16.115Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 843
File: test/solidity/Facets/RelayFacet.t.sol:0-0
Timestamp: 2024-10-31T09:10:16.115Z
Learning: In the `signData` function within `RelayFacetTest` in `test/solidity/Facets/RelayFacet.t.sol`, the use of the EIP-712 standard for hashing and signing is not required.

Applied to files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Periphery/Patcher.t.sol
  • test/solidity/Facets/RelayDepositoryFacet.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/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Periphery/Patcher.t.sol
📚 Learning: 2025-12-17T10:28:13.904Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/102-facets.mdc:0-0
Timestamp: 2025-12-17T10:28:13.904Z
Learning: Applies to src/Facets/**/*Facet.sol : In Solidity facets with `{facetName}Data.receiverAddress` field (e.g., `_glacisData.receiverAddress`), validate that it is not `bytes32(0)` for non-EVM chains and revert with `InvalidNonEVMReceiver()` if zero

Applied to files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
📚 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:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
📚 Learning: 2025-04-22T09:04:44.244Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1112
File: deployments/soneium.diamond.json:81-81
Timestamp: 2025-04-22T09:04:44.244Z
Learning: In the lifinance/contracts repository, it's normal and expected for periphery contracts to have empty address values in deployment files when they are not deployed on a particular network. This applies to all periphery contracts including ReceiverChainflip, ReceiverStargateV2, and others. PRs should not flag empty periphery contract addresses as issues.

Applied to files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
📚 Learning: 2025-08-23T11:07:02.778Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1322
File: src/Facets/MayanFacet.sol:259-272
Timestamp: 2025-08-23T11:07:02.778Z
Learning: In src/Facets/MayanFacet.sol, the offset 0xe4 for parsing receiver addresses from HCDepositInitiator::deposit calldata is correct. The mload operation reads 32-byte words and the address extraction via address(uint160(uint256(receiver))) properly handles ABI padding, so theoretical byte-level offset calculations can be misleading when the actual implementation works correctly with real-world data.

Applied to files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.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:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Periphery/Patcher.t.sol
📚 Learning: 2025-12-24T08:52:48.554Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/101-solidity-contracts.mdc:0-0
Timestamp: 2025-12-24T08:52:48.554Z
Learning: Applies to src/**/*.sol : Apply Diamond patterns with existing libs (LibAsset/LibSwap/LibAllowList, Validatable/SwapperV2); prefer parameters over `msg.sender` for refund addresses.

Applied to files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
📚 Learning: 2025-12-17T10:27:21.083Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/002-architecture.mdc:0-0
Timestamp: 2025-12-17T10:27:21.083Z
Learning: Applies to src/Facets/**/*Bridge*.sol : For non-EVM chains (bridgeData.receiver == NON_EVM_ADDRESS), emit BridgeToNonEVMChainBytes32 with transactionId, destinationChainId, and non-EVM receiver (bytes32)

Applied to files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
📚 Learning: 2025-12-17T10:28:13.904Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/102-facets.mdc:0-0
Timestamp: 2025-12-17T10:28:13.904Z
Learning: Applies to src/Facets/**/*Facet.sol : In Solidity facets, validate `targetChainId` against `bridgeData.destinationChain` for EVM-to-EVM bridges

Applied to files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
📚 Learning: 2025-11-13T00:53:25.372Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1456
File: test/solidity/Facets/PolymerCCTPFacet.t.sol:325-333
Timestamp: 2025-11-13T00:53:25.372Z
Learning: In src/Facets/PolymerCCTPFacet.sol, the PolymerCCTPFeeSent event must emit the original bridgeData.minAmount (before polymer fee deduction) as the first parameter, not the net bridge amount, because off-chain logic requires this value to properly pick up and process the deposit.

Applied to files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.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:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
📚 Learning: 2025-12-17T10:28:34.379Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/104-receiver-contracts.mdc:0-0
Timestamp: 2025-12-17T10:28:34.379Z
Learning: Applies to src/Periphery/Receiver*.sol : Receiver contracts must implement a bridge-specific external entry point (e.g., `handleV3AcrossMessage`, `lzCompose`, `cfReceive`) protected by authorization modifier that decodes bridge message to extract `bytes32 transactionId`, `LibSwap.SwapData[] memory swapData`, `address receiver`, and calls internal `_swapAndCompleteBridgeTokens()`

Applied to files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
📚 Learning: 2025-12-17T10:28:13.904Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/102-facets.mdc:0-0
Timestamp: 2025-12-17T10:28:13.904Z
Learning: Applies to src/Facets/**/*Facet.sol : For non-EVM flows in Solidity facets, `bridgeData.receiver` must equal `NON_EVM_ADDRESS`

Applied to files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.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:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • test/solidity/Periphery/Patcher.t.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:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.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:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
📚 Learning: 2024-11-01T11:53:57.162Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 846
File: deployments/cronos.diamond.json:28-31
Timestamp: 2024-11-01T11:53:57.162Z
Learning: In `deployments/cronos.diamond.json`, both `GenericSwapFacet` and `GenericSwapFacetV3` are distinct facets that should be included together, as they serve different purposes.

Applied to files:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • script/deploy/_targetState.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:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • script/deploy/_targetState.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:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
  • script/deploy/_targetState.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:

  • test/solidity/Periphery/LidoWrapper/LidoWrapper.t.sol
📚 Learning: 2024-11-21T08:24:53.059Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 861
File: script/deploy/_targetState.json:1453-1483
Timestamp: 2024-11-21T08:24:53.059Z
Learning: In `script/deploy/_targetState.json`, for the `abstract` network configuration, `ReceiverStargateV2` is correctly set to version `1.0.1`.

Applied to files:

  • script/deploy/_targetState.json
📚 Learning: 2025-08-01T05:35:21.121Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1290
File: script/deploy/_targetState.json:20-31
Timestamp: 2025-08-01T05:35:21.121Z
Learning: 0xDEnYO has confirmed that the target state file (script/deploy/_targetState.json) is not important for verification and should not be reviewed in deployment PRs.

Applied to files:

  • script/deploy/_targetState.json
📚 Learning: 2024-11-21T08:25:26.214Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 861
File: script/deploy/_targetState.json:1364-1390
Timestamp: 2024-11-21T08:25:26.214Z
Learning: For the Cronos network configuration in `script/deploy/_targetState.json`, the absence of bridge facets such as `StargateFacet`, `AcrossFacet`, `HopFacet`, and `SymbiosisFacet` is acceptable and expected.

Applied to files:

  • script/deploy/_targetState.json
📚 Learning: 2025-09-01T09:35:29.886Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 1299
File: deployments/arbitrum.staging.json:59-61
Timestamp: 2025-09-01T09:35:29.886Z
Learning: 0xDEnYO has repeatedly emphasized that the target state file (script/deploy/_targetState.json) should NEVER be reviewed, verified, or mentioned in deployment PRs. This instruction has been given multiple times and must be strictly followed without exception.

Applied to files:

  • script/deploy/_targetState.json
📚 Learning: 2024-10-31T09:07:36.301Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 843
File: script/deploy/facets/DeployRelayFacet.s.sol:0-0
Timestamp: 2024-10-31T09:07:36.301Z
Learning: In `script/deploy/facets/DeployRelayFacet.s.sol`, additional validation for the configuration file existence and address validity is unnecessary because the code will already fail appropriately if the configuration file is missing or the addresses are invalid.

Applied to files:

  • script/deploy/_targetState.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:

  • script/deploy/_targetState.json
📚 Learning: 2024-12-03T11:02:14.195Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 807
File: script/deploy/_targetState.json:181-181
Timestamp: 2024-12-03T11:02:14.195Z
Learning: HyphenFacet v1.0.0 is intentionally included in the BSC staging environment and should not be removed even if not present in production environments.

Applied to files:

  • script/deploy/_targetState.json
📚 Learning: 2025-12-17T10:28:13.904Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/102-facets.mdc:0-0
Timestamp: 2025-12-17T10:28:13.904Z
Learning: Applies to src/Facets/**/*Facet.sol : Facets must be located in `src/Facets/` directory with names containing `Facet`

Applied to files:

  • script/deploy/_targetState.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:

  • script/deploy/_targetState.json
📚 Learning: 2025-12-17T10:28:13.904Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/102-facets.mdc:0-0
Timestamp: 2025-12-17T10:28:13.904Z
Learning: Applies to src/Facets/**/*Facet.sol : In Solidity facets, `receiverAddress` must be the first parameter in `{facetName}Data` and must match `bridgeData.receiver` for EVM chains

Applied to files:

  • script/deploy/_targetState.json
📚 Learning: 2025-06-05T14:48:58.816Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 1124
File: src/Periphery/Patcher.sol:160-167
Timestamp: 2025-06-05T14:48:58.816Z
Learning: In src/Periphery/Patcher.sol, the unlimited token approval to finalTarget in depositAndExecuteWithDynamicPatches and depositAndExecuteWithMultiplePatches functions is intentional behavior, as confirmed by ezynda3. This design choice aligns with the contract's stateless/ephemeral architecture.

Applied to files:

  • test/solidity/Periphery/Patcher.t.sol
📚 Learning: 2025-06-05T14:31:33.404Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 1124
File: src/Periphery/Patcher.sol:76-82
Timestamp: 2025-06-05T14:31:33.404Z
Learning: The Patcher contract in src/Periphery/Patcher.sol is designed to be used in conjunction with an API and is never meant to hold user funds or user approvals. This architectural design makes the arbitrary delegatecall functionality less risky as the contract operates in a stateless/ephemeral manner.

Applied to files:

  • test/solidity/Periphery/Patcher.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/Periphery/Patcher.t.sol
📚 Learning: 2025-06-15T13:22:56.249Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1193
File: test/solidity/utils/TestWhitelistManagerBase.sol:11-19
Timestamp: 2025-06-15T13:22:56.249Z
Learning: For test utility contracts like TestWhitelistManagerBase, it's acceptable and preferred to have relaxed access controls (external functions without modifiers) to make testing more flexible and convenient, rather than mirroring production access control patterns.

Applied to files:

  • test/solidity/Periphery/Patcher.t.sol
  • test/solidity/Facets/RelayDepositoryFacet.t.sol
📚 Learning: 2025-12-17T10:29:29.239Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/400-solidity-tests.mdc:0-0
Timestamp: 2025-12-17T10:29:29.239Z
Learning: Applies to test/**/*.t.sol : For whitelist flows, inherit `TestWhitelistManagerBase` and use `addToWhitelist` / `setFunctionWhitelistBySelector` helpers

Applied to files:

  • test/solidity/Periphery/Patcher.t.sol
📚 Learning: 2025-12-17T10:29:29.239Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/400-solidity-tests.mdc:0-0
Timestamp: 2025-12-17T10:29:29.239Z
Learning: Applies to test/**/*.t.sol : For facet tests, inherit from `TestBaseFacet` rather than `TestBase`, since standard facet functions need to be overridden

Applied to files:

  • test/solidity/Periphery/Patcher.t.sol
  • test/solidity/Facets/RelayDepositoryFacet.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/Periphery/Patcher.t.sol
📚 Learning: 2024-10-22T03:16:28.754Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 807
File: test/solidity/Facets/GasZipFacet.t.sol:212-213
Timestamp: 2024-10-22T03:16:28.754Z
Learning: In the `GasZipFacetTest`, for the test case `testBase_Revert_SwapAndBridgeWithInvalidSwapData()`, a generic revert is expected, so `vm.expectRevert();` without specifying the expected error is appropriate.

Applied to files:

  • test/solidity/Periphery/Patcher.t.sol
  • test/solidity/Facets/RelayDepositoryFacet.t.sol
📚 Learning: 2024-10-10T03:26:23.793Z
Learnt from: 0xDEnYO
Repo: lifinance/contracts PR: 782
File: test/solidity/Helpers/WithdrawablePeriphery.t.sol:79-80
Timestamp: 2024-10-10T03:26:23.793Z
Learning: In Solidity tests, it's acceptable to use `UnAuthorized.selector` in `vm.expectRevert()`; avoid suggesting changing it to string messages.

Applied to files:

  • test/solidity/Periphery/Patcher.t.sol
📚 Learning: 2025-06-05T14:56:32.603Z
Learnt from: ezynda3
Repo: lifinance/contracts PR: 1124
File: src/Periphery/Patcher.sol:29-38
Timestamp: 2025-06-05T14:56:32.603Z
Learning: In the Patcher contract at src/Periphery/Patcher.sol, the `_getDynamicValue` function intentionally does not validate that return data is at least 32 bytes before using `mload(add(valueData, 32))`. This design choice is intentional and accepted by the team despite the potential for out-of-bounds memory access if external contracts return insufficient data.

Applied to files:

  • test/solidity/Periphery/Patcher.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/Periphery/Patcher.t.sol
📚 Learning: 2025-12-17T10:29:29.239Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/400-solidity-tests.mdc:0-0
Timestamp: 2025-12-17T10:29:29.239Z
Learning: Applies to test/**/*.t.sol : Always assert specific revert reasons; use `vm.expectRevert` with specific reason

Applied to files:

  • test/solidity/Periphery/Patcher.t.sol
📚 Learning: 2025-12-17T10:27:50.916Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/100-solidity-basics.mdc:0-0
Timestamp: 2025-12-17T10:27:50.916Z
Learning: Applies to **/*[Tt]est.sol : In tests: use blank line between `vm.expectRevert()` and function call

Applied to files:

  • test/solidity/Periphery/Patcher.t.sol
📚 Learning: 2025-12-17T10:28:13.904Z
Learnt from: CR
Repo: lifinance/contracts PR: 0
File: .cursor/rules/102-facets.mdc:0-0
Timestamp: 2025-12-17T10:28:13.904Z
Learning: Applies to src/Facets/**/*Facet.sol : Facets must use modifiers: `nonReentrant`, `refundExcessNative`, `validateBridgeData`, `doesNotContainSourceSwaps`/`doesContainSourceSwaps`, `doesNotContainDestinationCalls`/`doesContainDestinationCalls` on applicable functions

Applied to files:

  • test/solidity/Facets/RelayDepositoryFacet.t.sol
📚 Learning: 2025-12-15T09:02:31.300Z
Learnt from: mirooon
Repo: lifinance/contracts PR: 1530
File: test/solidity/Facets/CelerCircleBridgeFacet.t.sol:1-10
Timestamp: 2025-12-15T09:02:31.300Z
Learning: In Solidity test files under test/solidity/Facets (e.g., test/solidity/Facets/CelerCircleBridgeFacet.t.sol), ensure the SPDX license identifier line is immediately followed by the pragma statement with no blank line in between. Apply this formatting to all .sol files in that directory for consistency.

Applied to files:

  • test/solidity/Facets/RelayDepositoryFacet.t.sol
🪛 markdownlint-cli2 (0.18.1)
.cursor/commands/deprecate-contract.md

168-168: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

.cursor/commands/deprecate-network.md

113-113: Bare URL used

(MD034, no-bare-urls)


225-225: Bare URL used

(MD034, no-bare-urls)

⏰ 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

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment thread .cursor/commands/deprecate-network.md
Comment thread .cursor/commands/deprecate-network.md
Comment thread .cursor/commands/deprecate-network.md
@lifi-action-bot
Copy link
Copy Markdown
Collaborator

Test Coverage Report

Line Coverage: 86.70% (2936 / 3386 lines)
Function Coverage: 90.00% ( 468 / 520 functions)
Branch Coverage: 65.56% ( 476 / 726 branches)
Test coverage (86.70%) is above min threshold (83%). Check passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants