Skip to content

Conversation

@alfetopito
Copy link
Contributor

@alfetopito alfetopito commented Nov 6, 2025

Description

Add Linea and Plasma by updating SDK to latest version.
It also required some minor adjustments to work with the new multi-pkg sdk

Changes

  • Bump to cow-sdk 7.1.0
  • Added global adapter for ethersv5
  • Adjusted types as needed
  • Added Linea config example

How to test

  • Unit tests
  • Run the service locally with Linea config:
{
  "networks": [
    {
      "name": "linea",
      "rpc": "https://rpc.linea.build",
      "deploymentBlock": 25028604,
      "filterPolicy": {
        "defaultAction": "ACCEPT",
        "conditionalOrderIds": {
          "0x5b3cdb6ffa3c95507cbfc459162609007865c2e87340312d3cd469c4ffbfae81": "DROP"
        },
        "transactions": {
          "0x33ef06af308d1e4f94dd61fa8df43fe52b67e8a485f4e4fff75235080e663bfa": "DROP"
        },
        "handlers": {
          "0xd3338f21c89745e46af56aeaf553cf96ba9bc66f": "DROP"
        },
        "owners": {
          "0xd3338f21c89745e46af56aeaf553cf96ba9bc66f": "DROP"
        }
      }
    }
  ]
}
  • Should start as expected and sync to latest block
  • TWAP should be created
  • Should see log entries in the console similar to:
image

Summary by CodeRabbit

  • New Features

    • Linea network added for protocol operations.
  • Chores

    • Bumped release version and updated core SDKs; added new composable SDK and ethers-v5 adapter.
    • Global blockchain adapter integration to improve provider compatibility and network support.

@alfetopito alfetopito self-assigned this Nov 6, 2025
@alfetopito alfetopito requested a review from a team November 6, 2025 14:49
@coderabbitai
Copy link

coderabbitai bot commented Nov 6, 2025

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

📥 Commits

Reviewing files that changed from the base of the PR and between 20aafc3 and b15277f.

📒 Files selected for processing (1)
  • package.json (2 hunks)
 _________________________________________________________________________________________________________________________________
< For a successful technology, reality must take precedence over public relations, for Nature cannot be fooled. - Richard Feynman >
 ---------------------------------------------------------------------------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).

Tip

CodeRabbit can enforce grammar and style rules using `languagetool`.

Configure languagetool in your project's settings in CodeRabbit enable/disable rules and categories. Refer to the LanguageTool Community to learn more.

Walkthrough

The PR upgrades @cowprotocol/cow-sdk from 6.2.0-RC.0 to ^7.1.0 and introduces two new CoW Protocol SDK packages (sdk-composable and ethers-v5-adapter). The codebase refactors imports to use sdk-composable for composable order types, establishes global adapter configuration in the chain service, and extends network support by adding Linea to config.json.example.

Changes

Cohort / File(s) Summary
Configuration
config.json.example
Added new "linea" network configuration block with RPC, deployment block, and filter policies matching existing network entry structure.
Dependency Management
package.json
Updated @cowprotocol/cow-sdk to ^7.1.0; added @cowprotocol/sdk-composable (^0.1.10) and @cowprotocol/sdk-ethers-v5-adapter (^0.2.0).
SDK Import Migration
src/domain/events/index.ts, src/domain/polling/filtering/policy.ts, src/types/model.ts, src/utils/contracts.ts, src/utils/misc.ts
Migrated imports of ConditionalOrderParams, ConditionalOrderSdk, and PollResult types from @cowprotocol/cow-sdk to @cowprotocol/sdk-composable. Added ChainContext import in events/index.ts.
Polling Logic Updates
src/domain/polling/index.ts
Consolidated SDK imports from sdk-composable; adjusted orderToSubmit construction with string casting for kind, sellTokenBalance, and buyTokenBalance; explicitly included appData.
SupportedChainId Import
src/domain/polling/poll.ts
Changed SupportedChainId import source from @cowprotocol/sdk-composable to @cowprotocol/cow-sdk.
Adapter Configuration
src/services/chain.ts
Added global adapter setup in ChainContext.init using setGlobalAdapter and EthersV5Adapter instantiated with the provider.

Sequence Diagram

sequenceDiagram
    participant ChainContext
    participant setGlobalAdapter
    participant EthersV5Adapter
    participant Provider

    ChainContext->>Provider: obtain provider
    ChainContext->>EthersV5Adapter: new EthersV5Adapter(provider)
    activate EthersV5Adapter
    EthersV5Adapter-->>ChainContext: adapter instance
    deactivate EthersV5Adapter
    ChainContext->>setGlobalAdapter: setGlobalAdapter(adapter)
    setGlobalAdapter-->>ChainContext: global adapter configured
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

  • src/domain/polling/index.ts: Requires careful review of string casting conversions (kindToString(order.kind as string), balanceToString(order.*Balance as string)) and verify alignment with upstream SDK type changes.
  • src/services/chain.ts: Verify adapter setup integrates correctly with existing chain initialization flow and that provider lifecycle is compatible with adapter requirements.
  • Import migration across multiple files: While homogeneous in nature, validate that all type references from sdk-composable are compatible with previous cow-sdk versions to ensure no breaking changes in downstream usage.

Possibly related PRs

  • chore: update cow-sdk #180: Updates cow-sdk dependency version and extends network configurations in config.json.example by adding new networks, mirroring the dependency upgrade and network addition patterns in this PR.

Poem

🐰 New SDKs hop into sight,
Adapters dance with ethers bright,
Imports shuffle, types align,
Linea joins the network line,
Config grows, composables shine!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'add q4 chains' only partially reflects the actual changes, which primarily focus on upgrading the SDK and restructuring multi-package dependencies, with Linea being just one addition. Clarify whether the main objective is adding new chains or upgrading SDK dependencies; consider renaming to 'refactor(sdk): upgrade to cow-sdk 7.1.0 and add Linea support' for greater clarity.
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description includes all required sections with detailed changes and testing instructions, though the 'How to test' section references external resources and screenshots.

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.

@socket-security
Copy link

socket-security bot commented Nov 6, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​cowprotocol/​sdk-ethers-v5-adapter@​0.2.0771009998100
Updated@​cowprotocol/​cow-sdk@​6.2.0-RC.0 ⏵ 7.1.078 -4100100 +399 +1100
Added@​cowprotocol/​sdk-composable@​0.1.10791009998100

View full report

kind: kindToString(order.kind.toString()),
sellTokenBalance: balanceToString(order.sellTokenBalance.toString()),
buyTokenBalance: balanceToString(order.buyTokenBalance.toString()),
appData: order.appData as string,

Choose a reason for hiding this comment

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

nitpick: do we have any guard for this? I've just remembered the case when appData was incorrect and our explorer page was broken

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I hope not. The type is defined in the SDK as Bytes, which is an alias for unknown.
Here I took the shortest path and used a casting.

@limitofzero
Copy link

Nice, it works

@alfetopito alfetopito merged commit 087138c into main Nov 11, 2025
4 of 5 checks passed
@alfetopito alfetopito deleted the feat/q4-chains branch November 11, 2025 11:59
@github-actions github-actions bot locked and limited conversation to collaborators Nov 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants