feat: use CCTP v2 for bungee instead of CCTP v1 - #822
Conversation
chore: sync fork with main repo
chore: merge origin main
|
Warning Review limit reached
Next review available in: 57 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThe Bungee bridge provider is updated to support CCTP V2 instead of CCTP. Changes include updating bridge identifiers across type definitions and constants, adding support for optional outputAmount handling in transaction data encoding and decoding, updating configuration examples, and adding comprehensive test coverage for the new functionality. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai review |
📦 GitHub Packages PublishedLast updated: Jul 20, 2026, 10:15:49 AM UTC The following packages have been published to GitHub Packages with pre-release version
InstallationThese packages require authentication to install from GitHub Packages. First, create a # Create .npmrc file in your project root
echo "@cowprotocol:registry=https://npm.pkg.github.com" > .npmrc
echo "//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN" >> .npmrcTo get your GitHub token:
Then install any of the packages above, either by exact version (i.e. # Yarn
yarn add npm:@cowprotocol/cow-sdk@pr-822
# pnpm
pnpm install npm:@cowprotocol/cow-sdk@pr-822
# NPM
npm install npm:@cowprotocol/cow-sdk@pr-822Update to the latest version (only if you used the tag)Every commit will publish a new package. To upgrade to the latest version, run: # Yarn
yarn upgrade @cowprotocol/cow-sdk
# pnpm
pnpm update @cowprotocol/cow-sdk
# NPM
npm update @cowprotocol/cow-sdkView PackagesYou can view the published packages at: https://github.com/cowprotocol/cow-sdk/packages |
chore: merge origin main
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
packages/bridging/src/providers/bungee/types.ts (1)
184-188: Preserve bridge-specific typing for calldata indices.This union lets
cctp-v2entries compile withoutoutputAmount, so a future selector-map edit could silently disable the secondary proportional rewrite. A per-bridge mapping would keep the new Gnosis-native case without losing that safety check.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bridging/src/providers/bungee/types.ts` around lines 184 - 188, The current BungeeTxDataBytesIndicesType uses a union value allowing selectors for any bridge to omit outputAmount, which lets cctp-v2 entries compile without the required outputAmount; change the type from a single union to a per-bridge mapping so each bridge can enforce its own calldata shape. Concretely, replace BungeeTxDataBytesIndicesType with a mapped type that lists each BungeeBridge key explicitly (or uses a conditional mapped helper like BridgeCalldataIndices<K>) and for cctp-v2 require Record<string, InputOutputAmountTxDataBytesIndices> while other bridges keep Record<string, InputAmountTxDataBytesIndices> (or their appropriate shapes); update any usage of BungeeTxDataBytesIndicesType to the new per-bridge type so selector-map edits cannot drop outputAmount for cctp-v2.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/bridging/src/providers/bungee/createBungeeDepositCall.test.ts`:
- Around line 11-12: CCTP_V2_TX_DATA is exported from a .test.ts file which
causes the test module (including describe() and beforeEach()) to be evaluated
when util.test.ts imports it; move the hex fixture into a non-test helper module
(e.g., fixtures.ts or testData.ts), export CCTP_V2_TX_DATA from that new file,
and update both createBungeeDepositCall.test.ts and util.test.ts to import
CCTP_V2_TX_DATA from the fixture module so the test file no longer exposes
exports that trigger the noExportsInTest rule.
In `@packages/bridging/src/providers/bungee/types.ts`:
- Line 3: The public type SupportedBridge was changed to drop the old alias
'cctp', which is a breaking change for callers using includeBridges: ['cctp'];
restore backwards compatibility by re-adding 'cctp' to the SupportedBridge union
in types.ts and keep runtime validation using SUPPORTED_BRIDGES, but normalize
any incoming 'cctp' value to the canonical 'cctp-v2' internally (e.g., in the
code paths that read includeBridges and in the function that builds/validates
SUPPORTED_BRIDGES). Update normalization logic that consumes includeBridges so
both typed callers and runtime configs accept 'cctp' but are treated as
'cctp-v2' downstream.
In `@packages/bridging/src/providers/bungee/util.ts`:
- Around line 223-236: Add explicit bounds checks before slicing calldata so
truncated txData cannot produce silently smaller BigInt values: for both the
optional outputAmount (functionParams.outputAmount.bytesString_startIndex +
functionParams.outputAmount.bytesString_length) and the inputAmount counterpart,
verify that txData has at least that many hex characters (accounting for the
"0x" prefix if present) and throw/reject if not; perform these checks in the
same block that currently reads txData and only call slice() and BigInt() after
the checks pass, referencing functionParams, txData,
outputAmount.bytesString_startIndex/bytesString_length and the analogous
inputAmount fields to locate and protect both decodings.
- Around line 161-164: The JSDoc example for objectToSearchParams shows an
incorrect serialized output; update the example string to match
URLSearchParams.toString() behavior (no leading '?' and commas percent-encoded).
Specifically, change the example result to:
userAddress=0x123&includeBridges=across%2Ccctp-v2 so it accurately reflects the
output of objectToSearchParams/URLSearchParams.
---
Nitpick comments:
In `@packages/bridging/src/providers/bungee/types.ts`:
- Around line 184-188: The current BungeeTxDataBytesIndicesType uses a union
value allowing selectors for any bridge to omit outputAmount, which lets cctp-v2
entries compile without the required outputAmount; change the type from a single
union to a per-bridge mapping so each bridge can enforce its own calldata shape.
Concretely, replace BungeeTxDataBytesIndicesType with a mapped type that lists
each BungeeBridge key explicitly (or uses a conditional mapped helper like
BridgeCalldataIndices<K>) and for cctp-v2 require Record<string,
InputOutputAmountTxDataBytesIndices> while other bridges keep Record<string,
InputAmountTxDataBytesIndices> (or their appropriate shapes); update any usage
of BungeeTxDataBytesIndicesType to the new per-bridge type so selector-map edits
cannot drop outputAmount for cctp-v2.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 38273703-8580-4de1-abab-719e153a9e3e
📒 Files selected for processing (10)
packages/bridging/src/README.mdpackages/bridging/src/providers/bungee/BungeeBridgeProvider.tspackages/bridging/src/providers/bungee/const/misc.tspackages/bridging/src/providers/bungee/consts.tspackages/bridging/src/providers/bungee/createBungeeDepositCall.test.tspackages/bridging/src/providers/bungee/createBungeeDepositCall.tspackages/bridging/src/providers/bungee/getBridgingStatusFromEvents.tspackages/bridging/src/providers/bungee/types.tspackages/bridging/src/providers/bungee/util.test.tspackages/bridging/src/providers/bungee/util.ts
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/bridging/src/providers/bungee/BungeeApi.test.ts (1)
152-164: Add one more case for alias+canonical deduping.You already test normalization; adding
['cctp', 'cctp-v2', 'across']would lock in dedupe behavior too.Suggested test addition
+ it('should normalize and dedupe when both "cctp" and "cctp-v2" are provided', async () => { + const request: BungeeQuoteAPIRequest = { + ...mockQuoteRequest, + includeBridges: ['cctp', 'cctp-v2', 'across'], + } + + await api.getBungeeQuote(request) + + expect(mockFetch).toHaveBeenCalledWith( + expect.stringContaining('includeBridges=cctp-v2%2Cacross'), + expect.any(Object), + ) + })🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bridging/src/providers/bungee/BungeeApi.test.ts` around lines 152 - 164, Add a test that verifies alias+canonical deduping by calling api.getBungeeQuote with a BungeeQuoteAPIRequest whose includeBridges includes both 'cctp' and 'cctp-v2' (e.g., ['cctp', 'cctp-v2', 'across']) and assert mockFetch was called with a URL containing the deduped, normalized parameter 'includeBridges=cctp-v2%2Cacross'; locate this behavior around the existing test that calls getBungeeQuote and uses mockFetch and BungeeQuoteAPIRequest to mirror the normalization case and confirm duplicates are removed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/bridging/src/providers/bungee/BungeeApi.test.ts`:
- Around line 152-164: Add a test that verifies alias+canonical deduping by
calling api.getBungeeQuote with a BungeeQuoteAPIRequest whose includeBridges
includes both 'cctp' and 'cctp-v2' (e.g., ['cctp', 'cctp-v2', 'across']) and
assert mockFetch was called with a URL containing the deduped, normalized
parameter 'includeBridges=cctp-v2%2Cacross'; locate this behavior around the
existing test that calls getBungeeQuote and uses mockFetch and
BungeeQuoteAPIRequest to mirror the normalization case and confirm duplicates
are removed.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 47021732-c92f-4dee-8324-b16c8c29e835
📒 Files selected for processing (9)
packages/bridging/src/providers/bungee/BungeeApi.test.tspackages/bridging/src/providers/bungee/BungeeApi.tspackages/bridging/src/providers/bungee/consts.tspackages/bridging/src/providers/bungee/createBungeeDepositCall.test.tspackages/bridging/src/providers/bungee/createBungeeDepositCall.tspackages/bridging/src/providers/bungee/testData.tspackages/bridging/src/providers/bungee/types.tspackages/bridging/src/providers/bungee/util.test.tspackages/bridging/src/providers/bungee/util.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/bridging/src/providers/bungee/util.ts
9fce3a1 to
9a57584
Compare
…x/bungee-cctp-v2
Summary
Use CCTP v2 for bungee instead of CCTP v1
Merged #824 into this PR
Testing
Summary by CodeRabbit
Updates
New Features
Documentation
Tests