Repository navigation
FE release 2026-03-12 - #3965
ChiTimesChi wants to merge 45 commits into
Conversation
* feat(sdk-router): pause synapse bridge modules in sdk * test(sdk-router): remove paused bridge module coverage * test(rest-api): remove flaky live route coverage
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds seconds-based time utilities and compact duration formatting, a pending-transaction tracking helper and tests, locale time-unit keys, UI updates to use seconds and compact durations, many new contracts-rfq deployment artifacts (.chainId + JSON ABIs), multiple package version bumps, and large-scale test removals/skips and RFQ/Bridge-V1 stubs in sdk-router modules. Changes
Sequence Diagram(s)sequenceDiagram
participant UI as StateManagedBridge (UI)
participant Hook as TransactionsListener
participant Util as getPendingBridgeTransactionTrackingData
participant Store as Transactions Slice / Dispatcher
rect rgba(100,149,237,0.5)
UI->>Hook: submit bridge tx (tx hash, tx data)
Hook->>Util: compute trackedTransaction(tx, address)
Util-->>Hook: trackedTransaction or null
alt trackedTransaction exists
Hook->>Store: dispatch addTransaction(trackedTransaction)
else no trackedTransaction
Hook->>Store: no-op / wait for tracked timestamp
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/sdk-router/src/sdk.test.ts`:
- Around line 173-175: The test currently only exercises
synapse.fastBridgeRouterSet (moduleSet) and risks regressions for other public
modules; either re-add positive tests that exercise synapseRouterSet and
synapseCCTPRouterSet (so applyBridgeSlippage is called with
synapse.synapseRouterSet.moduleName and synapse.synapseCCTPRouterSet.moduleName
and their expected behaviors are asserted), or add explicit negative tests
asserting that calling applyBridgeSlippage with those module names throws the
expected "Unknown bridge module" (or other configured error); locate tests
referencing moduleSet in sdk.test.ts and align them with the resolution logic in
allModuleSets and the applyBridgeSlippage function so coverage matches the
public exports.
- Around line 176-223: The test only verifies delegation to
moduleSet.applySlippage via a spy; add at least one behavioral assertion that
validates the actual returned object and slippage logic from
synapse.applyBridgeSlippage (i.e., assert the returned { originQuery, destQuery
} shape and expected slippage adjustments), not just that
moduleSet.applySlippage was called. Concretely, in the suite around
synapse.applyBridgeSlippage and moduleSet.applySlippage, either allow
moduleSet.applySlippage to run its real implementation
(remove/mockImplementation) or replace the spy with a mock that returns a
realistic transformed { originQuery, destQuery } so the test can assert on
values (e.g., default denominator 10000 and default slippage 10 bips) and ensure
fastBridgeRouterSet's slippage behavior is preserved. Ensure you reference
synapse.applyBridgeSlippage and moduleSet.applySlippage when changing the test
so the behavioral assertion exercises the non-trivial logic.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: dd38b8ca-2dfe-4fee-9ed1-c354ae3f6e1b
📒 Files selected for processing (11)
docs/bridge/CHANGELOG.mddocs/bridge/package.jsonpackages/explorer-ui/CHANGELOG.mdpackages/explorer-ui/package.jsonpackages/rest-api/src/tests/bridgeRoute.test.tspackages/rest-api/src/tests/bridgeTxInfoRoute.test.tspackages/rest-api/src/tests/synapseTxIdRoute.test.tspackages/sdk-router/src/sdk.test.tspackages/sdk-router/src/sdk.tspackages/synapse-interface/CHANGELOG.mdpackages/synapse-interface/package.json
💤 Files with no reviewable changes (4)
- packages/rest-api/src/tests/bridgeRoute.test.ts
- packages/sdk-router/src/sdk.ts
- packages/rest-api/src/tests/bridgeTxInfoRoute.test.ts
- packages/rest-api/src/tests/synapseTxIdRoute.test.ts
| const moduleSet = synapse.fastBridgeRouterSet | ||
|
|
||
| const createApplySlippageTests = (moduleSet: SynapseModuleSet) => { | ||
| describe(`${moduleSet.moduleName} module`, () => { | ||
| beforeEach(() => { | ||
| jest.spyOn(moduleSet, 'applySlippage').mockImplementation(jest.fn()) | ||
| }) | ||
|
|
||
| it('Applies slippage', () => { | ||
| synapse.applyBridgeSlippage( | ||
| moduleSet.moduleName, | ||
| originQuery, | ||
| destQuery, | ||
| 10, | ||
| 100 | ||
| ) | ||
| expect(moduleSet.applySlippage).toHaveBeenCalledWith( | ||
| originQuery, | ||
| destQuery, | ||
| 10, | ||
| 100 | ||
| ) | ||
| }) | ||
|
|
||
| it('Uses default denominator of 10000', () => { | ||
| synapse.applyBridgeSlippage( | ||
| moduleSet.moduleName, | ||
| originQuery, | ||
| destQuery, | ||
| 10 | ||
| ) | ||
| expect(moduleSet.applySlippage).toHaveBeenCalledWith( | ||
| originQuery, | ||
| destQuery, | ||
| 10, | ||
| 10000 | ||
| ) | ||
| }) | ||
|
|
||
| it('Uses default slippage of 10 bips', () => { | ||
| synapse.applyBridgeSlippage( | ||
| moduleSet.moduleName, | ||
| originQuery, | ||
| destQuery | ||
| ) | ||
| expect(moduleSet.applySlippage).toHaveBeenCalledWith( | ||
| originQuery, | ||
| destQuery, | ||
| 10, | ||
| 10000 | ||
| ) | ||
| }) | ||
| describe(`${moduleSet.moduleName} module`, () => { |
There was a problem hiding this comment.
Re-add coverage for the other public bridge modules, or assert they are intentionally unsupported.
After this change, the suite only exercises applyBridgeSlippage through fastBridgeRouterSet. Cross-file, packages/sdk-router/src/sdk.ts:53-62 still exposes synapseRouterSet and synapseCCTPRouterSet, while packages/sdk-router/src/operations/bridge.ts:580-589 resolves module names only from allModuleSets. That means calls like applyBridgeSlippage(synapse.synapseRouterSet.moduleName, ...) can now regress to Unknown bridge module without any failing test.
If the de-registration is intentional, please add an explicit negative test for those module names; otherwise, keep a positive coverage path for them here.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/sdk-router/src/sdk.test.ts` around lines 173 - 175, The test
currently only exercises synapse.fastBridgeRouterSet (moduleSet) and risks
regressions for other public modules; either re-add positive tests that exercise
synapseRouterSet and synapseCCTPRouterSet (so applyBridgeSlippage is called with
synapse.synapseRouterSet.moduleName and synapse.synapseCCTPRouterSet.moduleName
and their expected behaviors are asserted), or add explicit negative tests
asserting that calling applyBridgeSlippage with those module names throws the
expected "Unknown bridge module" (or other configured error); locate tests
referencing moduleSet in sdk.test.ts and align them with the resolution logic in
allModuleSets and the applyBridgeSlippage function so coverage matches the
public exports.
| beforeEach(() => { | ||
| jest.spyOn(moduleSet, 'applySlippage').mockImplementation(jest.fn()) | ||
| }) | ||
| } | ||
|
|
||
| createApplySlippageTests(synapse.synapseRouterSet) | ||
| it('Applies slippage', () => { | ||
| synapse.applyBridgeSlippage( | ||
| moduleSet.moduleName, | ||
| originQuery, | ||
| destQuery, | ||
| 10, | ||
| 100 | ||
| ) | ||
| expect(moduleSet.applySlippage).toHaveBeenCalledWith( | ||
| originQuery, | ||
| destQuery, | ||
| 10, | ||
| 100 | ||
| ) | ||
| }) | ||
|
|
||
| createApplySlippageTests(synapse.synapseCCTPRouterSet) | ||
| it('Uses default denominator of 10000', () => { | ||
| synapse.applyBridgeSlippage( | ||
| moduleSet.moduleName, | ||
| originQuery, | ||
| destQuery, | ||
| 10 | ||
| ) | ||
| expect(moduleSet.applySlippage).toHaveBeenCalledWith( | ||
| originQuery, | ||
| destQuery, | ||
| 10, | ||
| 10000 | ||
| ) | ||
| }) | ||
|
|
||
| createApplySlippageTests(synapse.fastBridgeRouterSet) | ||
| it('Uses default slippage of 10 bips', () => { | ||
| synapse.applyBridgeSlippage( | ||
| moduleSet.moduleName, | ||
| originQuery, | ||
| destQuery | ||
| ) | ||
| expect(moduleSet.applySlippage).toHaveBeenCalledWith( | ||
| originQuery, | ||
| destQuery, | ||
| 10, | ||
| 10000 | ||
| ) | ||
| }) |
There was a problem hiding this comment.
Keep at least one behavioral assertion here instead of a pure spy.
This block now proves only that SynapseSDK.applyBridgeSlippage forwards arguments/defaults. It no longer verifies the returned { originQuery, destQuery } shape or any of the non-trivial slippage behavior in packages/sdk-router/src/rfq/fastBridgeRouterSet.ts:307-342, so a regression there would still pass.
Example of keeping the delegation check while preserving the public contract
+ const delegatedResult = {
+ originQuery: { ...originQuery, minAmountOut: BigNumber.from(2) },
+ destQuery,
+ }
+
beforeEach(() => {
- jest.spyOn(moduleSet, 'applySlippage').mockImplementation(jest.fn())
+ jest.spyOn(moduleSet, 'applySlippage').mockReturnValue(delegatedResult)
})
it('Applies slippage', () => {
- synapse.applyBridgeSlippage(
+ const result = synapse.applyBridgeSlippage(
moduleSet.moduleName,
originQuery,
destQuery,
10,
100
)
expect(moduleSet.applySlippage).toHaveBeenCalledWith(
originQuery,
destQuery,
10,
100
)
+ expect(result).toEqual(delegatedResult)
})🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/sdk-router/src/sdk.test.ts` around lines 176 - 223, The test only
verifies delegation to moduleSet.applySlippage via a spy; add at least one
behavioral assertion that validates the actual returned object and slippage
logic from synapse.applyBridgeSlippage (i.e., assert the returned { originQuery,
destQuery } shape and expected slippage adjustments), not just that
moduleSet.applySlippage was called. Concretely, in the suite around
synapse.applyBridgeSlippage and moduleSet.applySlippage, either allow
moduleSet.applySlippage to run its real implementation
(remove/mockImplementation) or replace the spy with a mock that returns a
realistic transformed { originQuery, destQuery } so the test can assert on
values (e.g., default denominator 10000 and default slippage 10 bips) and ensure
fastBridgeRouterSet's slippage behavior is preserved. Ensure you reference
synapse.applyBridgeSlippage and moduleSet.applySlippage when changing the test
so the behavioral assertion exercises the non-trivial logic.
Bundle ReportChanges will decrease total bundle size by 50 bytes (-0.0%) ⬇️. This is within the configured threshold ✅ Detailed changes
ℹ️ *Bundle size includes cached data from a previous commit Affected Assets, Files, and Routes:view changes for bundle: docs-bridge-client-array-pushAssets Changed:
view changes for bundle: sdk-router-@synapsecns/sdk-router-esmAssets Changed:
Files in
|
Bundle ReportChanges will increase total bundle size by 727.98kB (2.16%) ⬆️. This is within the configured threshold ✅ Detailed changes
ℹ️ *Bundle size includes cached data from a previous commit Affected Assets, Files, and Routes:view changes for bundle: sdk-router-@synapsecns/sdk-router-cjsAssets Changed:
view changes for bundle: docs-bridge-server-cjsAssets Changed:
Files in
view changes for bundle: docs-bridge-client-array-pushAssets Changed:
Files in
Files in
Files in
view changes for bundle: sdk-router-@synapsecns/sdk-router-esmAssets Changed:
view changes for bundle: synapse-interface-client-array-pushAssets Changed:
view changes for bundle: explorer-ui-client-array-pushAssets Changed:
view changes for bundle: synapse-interface-server-cjsAssets Changed:
|
* docs: add widget quote refresh fix spec * docs: make widget quote refresh spec TDD-first * test(widget): add stale quote refresh coverage * fix(widget): scope stale refresh to active quote lifecycle * test(widget): add quote refresh edge case coverage * test(widget): add quote refresh regression coverage * test(widget): fix lint in quote refresh tests * fix(widget): reset stale quote cycles across busy transitions * test(widget): upgrade testing library react * test(widget): cover out-of-order quote responses * chore: remove widget quote refresh spec * fix(sdk-router): run tests on jest 29 * fix(widget): clean bridge quote updater timers * chore: update yarn lockfile * fix(widget): sync stale quote callback ref before paint * fix(sdk-router): satisfy jest config lint formatting * style(widget): satisfy hook timing test formatting
* fix(sdk-router): use fixed SBA ETA buffer * fix(sdk-router): use fixed USDT OFT ETA buffer * style(sdk-router): fix lint issues
* fix(sdk-router): enable Avax, Base, Polygon for SBA * fix: enable ARB, BNB * fix: Metis, OP * fix(sdk-router): enable metis intents support * fix(sdk-router): update metis block time
* fix(contracts-adapter): refresh DVN config addresses * fix(contracts-adapter): update moonbeam rpc endpoint * fix(contracts-adapter): print multisig wire calldata * fix(contracts-adapter): verify endpoint delegates * fix(contracts-adapter): validate universal DVN addresses * fix(contracts-adapter): address script lint findings * fix(contracts-adapter): use bash test syntax in wire script
* docs: add widget native fee spec * feat(widget): show native bridge fee in receipt * feat(widget): show receipt token symbols * test(widget): cover native fee receipt behavior * fix(widget): track receipt quotes by id * fix(widget): invalidate stale receipt on amount change * fix(widget): resolve receipt lint findings * fix(widget): normalize missing bridge quote ids * test(sdk-router): skip legacy on-chain router suites * test(sdk-router): remove legacy on-chain router suites * docs: remove widget native fee spec
* chore(widget-example): scaffold Next.js workspace * feat(widget-example): add wallet-aware bridge demo * docs(widget-example): add local usage guide * refactor(widget-example): clean up wallet hook globals * fix(widget-example): avoid missing-wallet flash on init * refactor(widget-example): compare window against undefined
Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>
* docs: add widget native safe max spec * widget: extract bridge quote selection helpers * widget: add native safe max hook * widget: wire native safe max into balance control * docs: describe widget native bridgeable balance * widget: refine native max amount fallback display * widget: fix native safe max lint warnings * widget: block bridge actions on native fee shortfall * docs: remove widget native safe max spec * widget: filter invalid native fee quotes * widget: remove redundant quote tx assertions * widget: normalize prefill wording in readme * widget: extract bridge button label logic
|
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
Summary by CodeRabbit
3b48174: docs preview link
3b48174: synapse-interface preview link
3b48174: explorer-ui preview link
28246d6: docs preview link
28246d6: synapse-interface preview link
28246d6: explorer-ui preview link
73abd8a: docs preview link
73abd8a: explorer-ui preview link
73abd8a: synapse-interface preview link
1a590ea: synapse-interface preview link
1a590ea: docs preview link
8604396: docs preview link
8604396: explorer-ui preview link
1a590ea: explorer-ui preview link
8604396: synapse-interface preview link
0b45950: synapse-interface preview link
44049fc: docs preview link
44049fc: synapse-interface preview link
44049fc: explorer-ui preview link
5677100: synapse-interface preview link
5677100: docs preview link
9320fd5: synapse-interface preview link
9320fd5: docs preview link
9320fd5: explorer-ui preview link
751e15c: explorer-ui preview link
751e15c: synapse-interface preview link
751e15c: docs preview link
70a8927: docs preview link
70a8927: explorer-ui preview link
70a8927: synapse-interface preview link
9e39e46: synapse-interface preview link
9e39e46: docs preview link
9e39e46: explorer-ui preview link
0b45950: docs preview link
0b45950: explorer-ui preview link
5677100: explorer-ui preview link
0fb8be3: synapse-interface preview link
0fb8be3: docs preview link
0fb8be3: explorer-ui preview link
022ec16: docs preview link
022ec16: explorer-ui preview link
92aa360: docs preview link
92aa360: synapse-interface preview link
92aa360: explorer-ui preview link
bb4b7bb: docs preview link
bb4b7bb: explorer-ui preview link
68f2d69: explorer-ui preview link
bb4b7bb: synapse-interface preview link
68f2d69: synapse-interface preview link
38f596e: docs preview link
ef914bb: docs preview link
ef914bb: explorer-ui preview link
38f596e: explorer-ui preview link
38f596e: synapse-interface preview link
ef914bb: synapse-interface preview link
189ee6e: docs preview link
7a9b1d4: explorer-ui preview link
7a9b1d4: docs preview link
7a9b1d4: synapse-interface preview link
2c6f917: explorer-ui preview link
2c6f917: docs preview link
189ee6e: synapse-interface preview link
e5068f6: docs preview link
0ff1c16: docs preview link
e5068f6: synapse-interface preview link
0ff1c16: explorer-ui preview link
e5068f6: explorer-ui preview link
0ff1c16: synapse-interface preview link
1a09f09: docs preview link
1a09f09: explorer-ui preview link
1a09f09: synapse-interface preview link
2487d6f: explorer-ui preview link
2487d6f: docs preview link
2487d6f: synapse-interface preview link
e2977e3: docs preview link
e2977e3: explorer-ui preview link
e2977e3: synapse-interface preview link
c7672f1: docs preview link
c7672f1: explorer-ui preview link
c7672f1: synapse-interface preview link