Skip to content

Conversation

@Mav55
Copy link

@Mav55 Mav55 commented Aug 5, 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>

Mav55 and others added 30 commits August 1, 2025 19:13
- Add test for refundExcessNative modifier to fix surviving mutant on line 139
- Add isBridgeAvailable function with intentionally incomplete test coverage
- This will test both mutation testing detection and resolution
- Add test_swapAndStartBridgeTokensViaOptimismBridge_RefundsExcessETH()
- Tests that excess ETH is refunded when using swapAndStartBridgeTokensViaOptimismBridge
- Will catch if refundExcessNative modifier is removed (mutation on line 139)
- Sends 1 ETH when only 0.1 ETH needed, verifies 0.9 ETH refund
- Simplify the test logic to directly check total ETH spent vs sent
- With refundExcessNative: user loses ~0.1 ETH + gas
- Without refundExcessNative: user loses full 1 ETH + gas
- More reliable detection of missing refund modifier
- Add synchronize, opened, reopened triggers for immediate PR events
- Add workflow_run trigger to run after mutation testing completes
- This ensures PR summary runs both on PR changes and after mutation testing finishes
- Replace gh-find-current-pr with custom PR detection logic
- Handle both pull_request and workflow_run trigger contexts
- Add proper error handling for GitHub API responses
- Add debugging output for API responses
- Use proper jq error handling with '// empty' fallback
- Replace GIT_ACTIONS_BOT_PAT_CLASSIC with built-in GITHUB_TOKEN
- Add security-events: read permission for code scanning API access
- This should resolve the 'Bad credentials' errors in the workflow
- Add logging for both PR-specific and all alerts queries
- Show what tools are available in the alerts
- Fall back to all alerts if PR filter returns no results
- This will help identify why mutation testing results aren't being found
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 5, 2025

Walkthrough

This update introduces two new GitHub Actions workflows for mutation testing and its reporting, adds two external functions to the OptimismBridgeFacet contract for bridge availability checks, and implements a new test in the corresponding test suite to verify refund logic when excess ETH is sent during swaps.

Changes

Cohort / File(s) Change Summary
GitHub Actions: Mutation Testing Workflows
.github/workflows/mutationTestingAlertsReview.yml, .github/workflows/olympixMutationTesting.yml
Added two new workflow files: one to automate running mutation testing on Solidity contracts in batches and upload results to GitHub Code Scanning, and another to generate and post a mutation testing summary comment on pull requests based on code scanning alerts. The workflows include logic for batching, sequential processing, robust error handling, and integration with GitHub APIs for reporting and commenting.
OptimismBridgeFacet Contract
src/Facets/OptimismBridgeFacet.sol
Introduced two new external functions named isBridgeAvailable with different signatures and logic. Both functions check bridge availability for a given token address, handling the zero address case with distinct semantics and mutability (pure and view). No other contract logic was modified.
OptimismBridgeFacet Test
test/solidity/Facets/OptimismBridgeFacet.t.sol
Added a new test function to verify that excess ETH sent during a swap and bridge operation is properly refunded to the user. The test sets up the required data, performs the operation, and asserts that only the necessary amount is spent, confirming the presence and effect of the refundExcessNative modifier.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15–20 minutes

Suggested labels

AuditNotRequired

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

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.
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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 (2)
.github/workflows/olympixMutationTesting.yml (1)

1-111: Fix YAML formatting issues.

The workflow logic is well-structured with proper batching, error handling, and GitHub Code Scanning integration. However, there are several formatting issues that should be addressed:

-          echo "Processing ALL contracts in src/ to maintain consistent mutation testing state"
-          files=$(find src/ -name "*.sol" -type f)
-          
+          echo "Processing ALL contracts in src/ to maintain consistent mutation testing state"
+          files=$(find src/ -name "*.sol" -type f)
+

Apply similar fixes to remove trailing spaces on lines 42, 51, 56, 62, 69, 84 and add a newline at the end of the file.

.github/workflows/mutationTestingAlertsReview.yml (1)

1-347: Fix extensive YAML formatting issues.

The workflow provides comprehensive mutation testing result summarization with proper error handling, API integration, and PR comment management. However, there are numerous trailing spaces throughout the file that should be cleaned up.

# Apply these fixes throughout the file:
# Remove trailing spaces on lines: 44, 48, 53, 56, 60, 63, 69, 84, 88, 92, 96, 113, 118, 124, 128, 133, 147, 150, 155, 158, 163, 166, 171, 173, 187, 200, 204, 207, 211, 213, 237, 243, 261, 263, 288, 299, 301, 306, 313, 314, 331, 347
# Add newline at end of file
+

Consider using a YAML formatter or linter in your IDE to automatically handle these formatting issues.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 08dd996 and d0138ab.

📒 Files selected for processing (4)
  • .github/workflows/mutationTestingAlertsReview.yml (1 hunks)
  • .github/workflows/olympixMutationTesting.yml (1 hunks)
  • src/Facets/OptimismBridgeFacet.sol (2 hunks)
  • test/solidity/Facets/OptimismBridgeFacet.t.sol (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
{src/**/*.sol,test/solidity/**/*.sol,script/**/*.sol}

📄 CodeRabbit Inference Engine (conventions.md)

All our own Solidity files must use the LGPL-3.0 license identifier. This applies to all contracts in src/, all test files in test/solidity/, and all deployment and task scripts in script/.

Files:

  • test/solidity/Facets/OptimismBridgeFacet.t.sol
  • src/Facets/OptimismBridgeFacet.sol
**/*.sol

📄 CodeRabbit Inference Engine (conventions.md)

**/*.sol: Use custom error types rather than generic revert() statements.
Do not define interfaces in the same file as their implementation.
Every contract MUST have the following NatSpec tags in this order: @title, @author, @notice, @Custom:version.
The @author tag MUST always be "LI.FI (https://li.fi)" in contract NatSpec.
The @Custom:version MUST follow semantic versioning (X.Y.Z format) in contract NatSpec.
Every public/external function must have NatSpec comments describing the function, parameters, and return values.
All Solidity files must follow the rules defined in .solhint.json.
All Solidity files must use the EVM and Solidity version defined in foundry.toml unless networks require lower versions.

Files:

  • test/solidity/Facets/OptimismBridgeFacet.t.sol
  • src/Facets/OptimismBridgeFacet.sol
test/solidity/**/*.t.sol

📄 CodeRabbit Inference Engine (conventions.md)

test/solidity/**/*.t.sol: Test files must have a .t.sol extension.
All tests that verify a successful execution must be prefixed with: test_.
All tests that verify a failure case must be prefixed with: testRevert_.
For base or inherited tests, prefix with testBase_.
Every test contract must include a setUp() function.
Any contract inheriting from TestBase.sol must call initTestBase() in setUp().
Use assertEq() for checking equality of values in tests.
Use vm.expectRevert() to verify specific revert reasons in failure test cases.
Use vm.expectEmit(true, true, true, true, <contractAddress>) for event testing.
All Solidity test files must be organized mirroring the src/ structure.
All Solidity test files must use Foundry.

Files:

  • test/solidity/Facets/OptimismBridgeFacet.t.sol
src/Facets/*Facet.sol

📄 CodeRabbit Inference Engine (conventions.md)

Facet contracts must reside in src/Facets/ and names must include "Facet".

Files:

  • src/Facets/OptimismBridgeFacet.sol
.github/workflows/*.yml

📄 CodeRabbit Inference Engine (conventions.md)

.github/workflows/*.yml: Use GitHub Secrets for sensitive data in GitHub workflow files.
Begin GitHub workflow files with a clear description (YAML comments) and include descriptive comments throughout.
Set explicit permissions and include notifications in GitHub workflow files.

Files:

  • .github/workflows/olympixMutationTesting.yml
  • .github/workflows/mutationTestingAlertsReview.yml
🧠 Learnings (28)
📓 Common learnings
Learnt from: 0xDEnYO
PR: lifinance/contracts#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: 0xDEnYO
PR: lifinance/contracts#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.
Learnt from: mirooon
PR: lifinance/contracts#1187
File: .github/workflows/versionControlAndAuditCheck.yml:596-612
Timestamp: 2025-06-05T11:25:43.443Z
Learning: The user mirooon has an internal system for tracking tickets and technical debt. They acknowledged the security concern about disabled commit hash verification in the audit workflow and plan to implement conditional logic to skip verification only for revert PRs in a future update.
Learnt from: 0xDEnYO
PR: lifinance/contracts#1237
File: conventions.md:56-60
Timestamp: 2025-07-03T01:44:43.968Z
Learning: Always consult the conventions.md file for the latest rules and conventions when reviewing PRs or code changes in the lifinance/contracts repository. Make suggestions when code changes do not match the documented conventions in this file.
Learnt from: mirooon
PR: lifinance/contracts#1048
File: script/deploy/safe/safe-decode-utils.ts:0-0
Timestamp: 2025-03-21T13:48:54.006Z
Learning: When reviewing PRs with a specific focused purpose (like migrating between package managers), restrict suggestions to issues directly related to that purpose rather than general code improvements.
Learnt from: 0xDEnYO
PR: lifinance/contracts#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
PR: lifinance/contracts#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.
Learnt from: mirooon
PR: lifinance/contracts#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: ezynda3
PR: lifinance/contracts#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: mirooon
PR: lifinance/contracts#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
Learnt from: 0xDEnYO
PR: lifinance/contracts#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.
Learnt from: 0xDEnYO
PR: lifinance/contracts#807
File: src/Facets/GasZipFacet.sol:53-53
Timestamp: 2024-10-22T03:14:52.578Z
Learning: In `src/Facets/GasZipFacet.sol`, when checking `msg.value`, the team prefers to use strict equality (`msg.value == _bridgeData.minAmount`) to save gas and avoid refunding excess Ether.
Learnt from: mirooon
PR: lifinance/contracts#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.
Learnt from: 0xDEnYO
PR: lifinance/contracts#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.
Learnt from: ezynda3
PR: lifinance/contracts#827
File: src/Facets/DeBridgeDlnFacet.sol:0-0
Timestamp: 2024-12-02T06:33:33.309Z
Learning: In Solidity version 0.8.0 and above, arithmetic underflows and overflows automatically cause a revert; therefore, explicit checks for arithmetic underflows are not necessary in functions like `_startBridge` in `DeBridgeDlnFacet.sol`.
📚 Learning: in solidity tests for withdrawal functions in `test/solidity/helpers/withdrawableperiphery.t.sol`, d...
Learnt from: 0xDEnYO
PR: lifinance/contracts#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/Facets/OptimismBridgeFacet.t.sol
📚 Learning: in the `gaszipfacettest`, for the test case `testbase_revert_swapandbridgewithinvalidswapdata()`, a ...
Learnt from: 0xDEnYO
PR: lifinance/contracts#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/Facets/OptimismBridgeFacet.t.sol
📚 Learning: in the testbase.sol file, the optimism network constants are set correctly with: - address_uniswap_o...
Learnt from: mirooon
PR: lifinance/contracts#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/OptimismBridgeFacet.t.sol
  • src/Facets/OptimismBridgeFacet.sol
📚 Learning: empty test methods with explanatory comments are acceptable in test classes when the feature being t...
Learnt from: mirooon
PR: lifinance/contracts#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/OptimismBridgeFacet.t.sol
📚 Learning: in the `relayfacet` contract (`src/facets/relayfacet.sol`), within the `_startbridge` function, low-...
Learnt from: ezynda3
PR: lifinance/contracts#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/Facets/OptimismBridgeFacet.t.sol
  • src/Facets/OptimismBridgeFacet.sol
📚 Learning: the glacisfacet test suite inherits from testbasefacet which already covers various failure scenario...
Learnt from: mirooon
PR: lifinance/contracts#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/Facets/OptimismBridgeFacet.t.sol
📚 Learning: in solidity version 0.8.0 and above, arithmetic underflows and overflows automatically cause a rever...
Learnt from: ezynda3
PR: lifinance/contracts#827
File: src/Facets/DeBridgeDlnFacet.sol:0-0
Timestamp: 2024-12-02T06:33:33.309Z
Learning: In Solidity version 0.8.0 and above, arithmetic underflows and overflows automatically cause a revert; therefore, explicit checks for arithmetic underflows are not necessary in functions like `_startBridge` in `DeBridgeDlnFacet.sol`.

Applied to files:

  • test/solidity/Facets/OptimismBridgeFacet.t.sol
  • src/Facets/OptimismBridgeFacet.sol
📚 Learning: unit tests are not required for newly added swap callback functions in `lifidexaggregator.sol`....
Learnt from: 0xDEnYO
PR: lifinance/contracts#832
File: src/Periphery/LiFiDEXAggregator.sol:578-697
Timestamp: 2024-12-04T02:05:41.355Z
Learning: Unit tests are not required for newly added swap callback functions in `LiFiDEXAggregator.sol`.

Applied to files:

  • test/solidity/Facets/OptimismBridgeFacet.t.sol
📚 Learning: in src/facets/allbridgefacet.sol, the team has decided that explicit validation for address downcast...
Learnt from: 0xDEnYO
PR: lifinance/contracts#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/Facets/OptimismBridgeFacet.t.sol
  • src/Facets/OptimismBridgeFacet.sol
📚 Learning: in `src/facets/gaszipfacet.sol`, when checking `msg.value`, the team prefers to use strict equality ...
Learnt from: 0xDEnYO
PR: lifinance/contracts#807
File: src/Facets/GasZipFacet.sol:53-53
Timestamp: 2024-10-22T03:14:52.578Z
Learning: In `src/Facets/GasZipFacet.sol`, when checking `msg.value`, the team prefers to use strict equality (`msg.value == _bridgeData.minAmount`) to save gas and avoid refunding excess Ether.

Applied to files:

  • test/solidity/Facets/OptimismBridgeFacet.t.sol
📚 Learning: test utility functions in testbase.sol don't require production-level validations like slippage chec...
Learnt from: mirooon
PR: lifinance/contracts#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/OptimismBridgeFacet.t.sol
📚 Learning: contracts like `opbnbbridgefacet` may be in development and only available in feature branches, resu...
Learnt from: 0xDEnYO
PR: lifinance/contracts#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:

  • src/Facets/OptimismBridgeFacet.sol
📚 Learning: the cbridgefacetpacked and cbridge addresses in addtokenapprovalstocbridgefacetpacked.s.sol must not...
Learnt from: 0xDEnYO
PR: lifinance/contracts#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/Facets/OptimismBridgeFacet.sol
📚 Learning: the `validatebridgedata` modifier in `validatable.sol` validates that the receiver address is not ze...
Learnt from: ezynda3
PR: lifinance/contracts#984
File: src/Facets/ChainflipFacet.sol:127-146
Timestamp: 2025-02-21T09:00:28.226Z
Learning: The `validateBridgeData` modifier in `Validatable.sol` validates that the receiver address is not zero using `LibUtil.isZeroAddress`, making additional zero-address checks redundant in functions using this modifier.

Applied to files:

  • src/Facets/OptimismBridgeFacet.sol
📚 Learning: errors about the missing `opbnbbridgefacet` contract are expected when it is referenced in the targe...
Learnt from: 0xDEnYO
PR: lifinance/contracts#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:

  • src/Facets/OptimismBridgeFacet.sol
📚 Learning: the `validatebridgedata` modifier in `validatable.sol` already validates that the receiver address i...
Learnt from: ezynda3
PR: lifinance/contracts#984
File: src/Facets/ChainflipFacet.sol:127-146
Timestamp: 2025-02-21T09:00:28.226Z
Learning: The `validateBridgeData` modifier in `Validatable.sol` already validates that the receiver address is not zero, making additional zero-address checks redundant in functions using this modifier.

Applied to files:

  • src/Facets/OptimismBridgeFacet.sol
📚 Learning: in `debridgedlnfacet.sol`, direct access to the `debridgechainid` mapping is acceptable, and using t...
Learnt from: ezynda3
PR: lifinance/contracts#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/Facets/OptimismBridgeFacet.sol
📚 Learning: in lifi facet contracts, when public entry point functions have `nonreentrant` modifier protection, ...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1275
File: src/Facets/AllBridgeFacet.sol:186-188
Timestamp: 2025-07-16T01:04:55.857Z
Learning: In LiFi facet contracts, when public entry point functions have `nonReentrant` modifier protection, internal functions like `_startBridge` that they call benefit from this reentrancy protection, making event emission order after external calls acceptable from a security perspective.

Applied to files:

  • src/Facets/OptimismBridgeFacet.sol
📚 Learning: in the `.github/workflows/protectsecurityrelevantcode.yml` file, ensure that any suggested code chan...
Learnt from: 0xDEnYO
PR: lifinance/contracts#853
File: .github/workflows/protectSecurityRelevantCode.yml:78-78
Timestamp: 2024-11-08T03:42:16.803Z
Learning: In the `.github/workflows/protectSecurityRelevantCode.yml` file, ensure that any suggested code changes are secure, thoroughly vetted for potential issues, and do not prompt further modifications to previously recommended code.

Applied to files:

  • .github/workflows/olympixMutationTesting.yml
  • .github/workflows/mutationTestingAlertsReview.yml
📚 Learning: in the `.github/workflows/protectsecurityrelevantcode.yml` file, suggested security improvements for...
Learnt from: 0xDEnYO
PR: lifinance/contracts#853
File: .github/workflows/protectSecurityRelevantCode.yml:67-100
Timestamp: 2024-11-08T03:12:44.309Z
Learning: In the `.github/workflows/protectSecurityRelevantCode.yml` file, suggested security improvements for configuring organization and team names as environment variables, handling API rate limits, addressing potential file permission issues, and mitigating command injection risks are not required.

Applied to files:

  • .github/workflows/olympixMutationTesting.yml
  • .github/workflows/mutationTestingAlertsReview.yml
📚 Learning: applies to .github/workflows/*.yml : set explicit permissions and include notifications in github wo...
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to .github/workflows/*.yml : Set explicit permissions and include notifications in GitHub workflow files.

Applied to files:

  • .github/workflows/olympixMutationTesting.yml
  • .github/workflows/mutationTestingAlertsReview.yml
📚 Learning: applies to .github/workflows/*.yml : begin github workflow files with a clear description (yaml comm...
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to .github/workflows/*.yml : Begin GitHub workflow files with a clear description (YAML comments) and include descriptive comments throughout.

Applied to files:

  • .github/workflows/olympixMutationTesting.yml
  • .github/workflows/mutationTestingAlertsReview.yml
📚 Learning: in the 'enforce min test coverage' github action workflow in the 'lifinance/contracts' repository, t...
Learnt from: 0xDEnYO
PR: lifinance/contracts#859
File: .github/workflows/enforceTestCoverage.yml:27-27
Timestamp: 2024-11-18T07:18:18.415Z
Learning: In the 'Enforce Min Test Coverage' GitHub Action workflow in the 'lifinance/contracts' repository, the action will fail if the `MIN_TEST_COVERAGE` secret is not set, so explicit validation is not required.

Applied to files:

  • .github/workflows/olympixMutationTesting.yml
  • .github/workflows/mutationTestingAlertsReview.yml
📚 Learning: when analyzing deployment prs in the lifinance/contracts repository, carefully verify that target st...
Learnt from: 0xDEnYO
PR: lifinance/contracts#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:

  • .github/workflows/olympixMutationTesting.yml
  • .github/workflows/mutationTestingAlertsReview.yml
📚 Learning: in the `force-merge pr (bypass audit requirement)` github actions workflow (`.github/workflows/force...
Learnt from: 0xDEnYO
PR: lifinance/contracts#902
File: .github/workflows/forceMergePRBypassAudit.yml:31-47
Timestamp: 2024-12-12T02:05:50.929Z
Learning: In the `Force-Merge PR (Bypass Audit Requirement)` GitHub Actions workflow (`.github/workflows/forceMergePRBypassAudit.yml`), since the team members are controlled and the likelihood of regex injection is minimal, additional validation of team members is not necessary.

Applied to files:

  • .github/workflows/olympixMutationTesting.yml
  • .github/workflows/mutationTestingAlertsReview.yml
📚 Learning: in the file `.github/workflows/types.yaml`, additional error handling for file operations is not req...
Learnt from: 0xDEnYO
PR: lifinance/contracts#879
File: .github/workflows/types.yaml:58-62
Timestamp: 2024-11-27T04:28:26.318Z
Learning: In the file `.github/workflows/types.yaml`, additional error handling for file operations is not required in the 'Copy Type Bindings and ABI' step.

Applied to files:

  • .github/workflows/olympixMutationTesting.yml
📚 Learning: when implementing github actions workflows that allow bypassing audit requirements, such as the `for...
Learnt from: 0xDEnYO
PR: lifinance/contracts#902
File: .github/workflows/forceMergePRBypassAudit.yml:68-82
Timestamp: 2024-12-12T02:13:02.343Z
Learning: When implementing GitHub Actions workflows that allow bypassing audit requirements, such as the `Force-Merge PR (Bypass Audit Requirement)` workflow, include a step to send a message to the Discord server to inform the team when this action is executed.

Applied to files:

  • .github/workflows/mutationTestingAlertsReview.yml
🪛 YAMLlint (1.37.1)
.github/workflows/olympixMutationTesting.yml

[error] 42-42: trailing spaces

(trailing-spaces)


[error] 51-51: trailing spaces

(trailing-spaces)


[error] 56-56: trailing spaces

(trailing-spaces)


[error] 62-62: trailing spaces

(trailing-spaces)


[error] 69-69: trailing spaces

(trailing-spaces)


[error] 84-84: trailing spaces

(trailing-spaces)


[error] 111-111: no new line character at the end of file

(new-line-at-end-of-file)


[error] 111-111: trailing spaces

(trailing-spaces)

.github/workflows/mutationTestingAlertsReview.yml

[error] 44-44: trailing spaces

(trailing-spaces)


[error] 48-48: trailing spaces

(trailing-spaces)


[error] 53-53: trailing spaces

(trailing-spaces)


[error] 56-56: trailing spaces

(trailing-spaces)


[error] 60-60: trailing spaces

(trailing-spaces)


[error] 63-63: trailing spaces

(trailing-spaces)


[error] 69-69: trailing spaces

(trailing-spaces)


[error] 84-84: trailing spaces

(trailing-spaces)


[error] 88-88: trailing spaces

(trailing-spaces)


[error] 92-92: trailing spaces

(trailing-spaces)


[error] 96-96: trailing spaces

(trailing-spaces)


[error] 113-113: trailing spaces

(trailing-spaces)


[error] 118-118: trailing spaces

(trailing-spaces)


[error] 124-124: trailing spaces

(trailing-spaces)


[error] 128-128: trailing spaces

(trailing-spaces)


[error] 133-133: trailing spaces

(trailing-spaces)


[error] 147-147: trailing spaces

(trailing-spaces)


[error] 150-150: trailing spaces

(trailing-spaces)


[error] 155-155: trailing spaces

(trailing-spaces)


[error] 158-158: trailing spaces

(trailing-spaces)


[error] 163-163: trailing spaces

(trailing-spaces)


[error] 166-166: trailing spaces

(trailing-spaces)


[error] 171-171: trailing spaces

(trailing-spaces)


[error] 173-173: trailing spaces

(trailing-spaces)


[error] 187-187: trailing spaces

(trailing-spaces)


[error] 200-200: trailing spaces

(trailing-spaces)


[error] 204-204: trailing spaces

(trailing-spaces)


[error] 207-207: trailing spaces

(trailing-spaces)


[error] 211-211: trailing spaces

(trailing-spaces)


[error] 213-213: trailing spaces

(trailing-spaces)


[error] 237-237: trailing spaces

(trailing-spaces)


[error] 243-243: trailing spaces

(trailing-spaces)


[error] 261-261: trailing spaces

(trailing-spaces)


[error] 263-263: trailing spaces

(trailing-spaces)


[error] 288-288: trailing spaces

(trailing-spaces)


[error] 299-299: trailing spaces

(trailing-spaces)


[error] 301-301: trailing spaces

(trailing-spaces)


[error] 306-306: trailing spaces

(trailing-spaces)


[error] 313-313: trailing spaces

(trailing-spaces)


[error] 314-314: trailing spaces

(trailing-spaces)


[error] 331-331: trailing spaces

(trailing-spaces)


[error] 347-347: no new line character at the end of file

(new-line-at-end-of-file)


[error] 347-347: trailing spaces

(trailing-spaces)

🔇 Additional comments (3)
src/Facets/OptimismBridgeFacet.sol (2)

153-162: LGTM - Mutation testing function correctly implemented.

The function is well-documented with clear mutation points and follows the intended design for mutation testing. The logic correctly returns false for the zero address and true for any other address.


213-225: LGTM - Second mutation testing function with different semantics.

This function correctly implements different logic from the first isBridgeAvailable function - returning true for ETH (address(0)) and checking non-zero addresses for ERC20 tokens. The view modifier and mutation testing comments are appropriate.

test/solidity/Facets/OptimismBridgeFacet.t.sol (1)

268-320: LGTM - Well-designed mutation testing focused test.

This test effectively verifies the refundExcessNative modifier functionality by:

  • Sending excess ETH (1 ETH when only 0.1 ETH needed)
  • Verifying the excess is refunded through balance checking
  • Using reasonable bounds for gas cost considerations

The test correctly targets mutant #1128 and would fail if the refund modifier is removed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant