8000 fix(sdk-router): gas.zip block height by ChiTimesChi · Pull Request #3675 · synapsecns/sanguine · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(sdk-router): gas.zip block height #3675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 2, 2025

Conversation

ChiTimesChi
Copy link
Collaborator
@ChiTimesChi ChiTimesChi commented May 2, 2025

Summary by CodeRabbit

  • New Features
    • Added enhanced verification to ensure bridge routes are only provided when both origin and destination chains have recent blockchain data.
    • Introduced mapping of chain IDs to their latest block heights from the Gas.Zip indexer.
  • Chores
    • Improved internal checks for blockchain data freshness to help prevent routing based on outdated information.

Copy link
vercel bot commented May 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sanguine ❌ Failed (Inspect) May 2, 2025 2:05pm

Copy link
Contributor
coderabbitai bot commented May 2, 2025

Walkthrough

A new asynchronous function, getGasZipBlockHeightMap, was introduced to fetch and map the latest block heights for multiple chains from the Gas.Zip API. In the GasZipModuleSet class, logic was added to verify that the block heights for the origin and destination chains are recent before returning bridge routes. This is achieved by checking that the block data is not older than a specified threshold (5 minutes). If the block data is stale or missing, the route methods return no results, ensuring only up-to-date chain data is used for routing.

Changes

File(s) Change Summary
packages/sdk-router/src/gaszip/api.ts Added getGasZipBlockHeightMap function to fetch and map chain IDs to their latest block heights.
packages/sdk-router/src/gaszip/gasZipModuleSet.ts Added block age verification logic with new private methods and a max age constant; integrated checks into route methods to ensure only fresh block data allows routing.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GasZipModuleSet
    participant GasZipAPI
    participant Provider

    User->>GasZipModuleSet: getBridgeRouteV2/getBridgeRoutes(origin, dest)
    par Parallel execution
        GasZipModuleSet->>GasZipAPI: getGasZipBlockHeightMap()
        GasZipModuleSet->>OtherAsyncOps: ... (other async logic)
    end
    GasZipAPI-->>GasZipModuleSet: Map<chain, blockHeight>
    GasZipModuleSet->>Provider: getBlock(blockHeight) for origin/dest
    Provider-->>GasZipModuleSet: block timestamp(s)
    GasZipModuleSet->>GasZipModuleSet: check block age(s)
    alt Block age is fresh for both chains
        GasZipModuleSet-->>User: Return bridge route(s)
    else Block age is stale or missing
        GasZipModuleSet-->>User: Return undefined/empty array
    end
Loading

Poem

Oh hoppy day, the chains are in sync,
No stale old blocks to cause a stink!
With fresh heights checked, our bridges leap,
Across the chains, our data’s deep.
Five minutes young, or routes won’t show—
The rabbit ensures your transfers flow!
🐇✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1762e71 and 3d3901a.

📒 Files selected for processing (2)
  • packages/sdk-router/src/gaszip/api.ts (1 hunks)
  • packages/sdk-router/src/gaszip/gasZipModuleSet.ts (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/sdk-router/src/gaszip/api.ts
  • packages/sdk-router/src/gaszip/gasZipModuleSet.ts
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: test
  • GitHub Check: lint
  • GitHub Check: changesets-integrity-checker
  • GitHub Check: test
  • GitHub Check: lint
  • GitHub Check: Cloudflare Pages
✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

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 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.

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: 3

♻️ Duplicate comments (2)
packages/sdk-router/src/gaszip/gasZipModuleSet.ts (2)

168-172: Route is built before freshness is known – move the check earlier

If synced is false, the code has already spent cycles computing zapData, applySlippage, etc.
Moving the await as suggested above removes that overhead and keeps this guard redundant.


224-228: Redundant freshness check after heavy work

Same reasoning as above: the method already queried Gas.Zip for a quote and built queries before verifying freshness. Short-circuit earlier to save bandwidth.

🧹 Nitpick comments (3)
packages/sdk-router/src/gaszip/gasZipModuleSet.ts (3)

36-36: Make GAS_ZIP_MAX_BLOCK_AGE_MS configurable

A hard-coded 5-minute threshold may not fit all deployments or test environments.
Consider sourcing it from an environment variable or constructor parameter so integrators can tune freshness requirements without code changes.


135-139: Avoid building expensive artifacts when chains are already stale

checkBlockHeights is kicked off in parallel with the quote request, which is good for latency.
However, the call to getGasZipQuote + getGasZipZapData can still be expensive and will be wasted if freshness later fails.
A quick win is to await syncedPromise immediately and short-circuit when false before the costly calls:

-    const syncedPromise = this.checkBlockHeights(
+    const syncedPromise = this.checkBlockHeights(
       bridgeToken.originChainId,
       bridgeToken.destChainId
     )
+    if (!(await syncedPromise)) {
+      return undefined
+    }

This preserves concurrency while skipping the rest of the pipeline when not needed.


187-188: getBridgeRoutes suffers from the same early-exit optimisation

Kick off checkBlockHeights, await it immediately, and bail out early to save the later quote request when chains are stale.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 579e3fd and 1762e71.

📒 Files selected for processing (2)
  • packages/sdk-router/src/gaszip/api.ts (1 hunks)
  • packages/sdk-router/src/gaszip/gasZipModuleSet.ts (6 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/sdk-router/src/gaszip/gasZipModuleSet.ts (2)
packages/sdk-router/src/gaszip/api.ts (1)
  • getGasZipBlockHeightMap (88-101)
packages/sdk-router/src/utils/logger.ts (1)
  • logger (1-1)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: test
  • GitHub Check: lint
  • GitHub Check: changesets-integrity-checker
  • GitHub Check: test
  • GitHub Check: lint

Comment on lines 88 to 101
export const getGasZipBlockHeightMap = async (): Promise<
Map<number, number>
> => {
const response = await getWithTimeout(
'Gas.Zip API',
`${GAS_ZIP_API_URL}/admin/indexer`,
GAS_ZIP_API_TIMEOUT
)
if (!response) {
return new Map()
}
const data: { chain: number; head: number }[] = await response.json()
return new Map(data.map((chain) => [chain.chain, chain.head]))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add error handling & lightweight caching to harden getGasZipBlockHeightMap

The function assumes that (a) the HTTP status is 2xx, (b) the body is valid JSON, and (c) the head field is a number.
If any of those assumptions breaks the whole bridge will be silently disabled (an empty map always fails the subsequent freshness check).

Additionally, this method is invoked every time a route is requested, which means an extra network round-trip per call. A small in-memory cache with a short TTL (e.g. 30-60 s) would cut latency and load on both your server and Gas.Zip.

+// naive 30-second cache
+let _cachedBlockHeights: { at: number; map: Map<number, number> } | undefined
+
 export const getGasZipBlockHeightMap = async (): Promise<
   Map<number, number>
 > => {
+  if (_cachedBlockHeights && Date.now() - _cachedBlockHeights.at < 30_000) {
+    return _cachedBlockHeights.map
+  }
   const response = await getWithTimeout(
     'Gas.Zip API',
     `${GAS_ZIP_API_URL}/admin/indexer`,
     GAS_ZIP_API_TIMEOUT
   )
   if (!response || !response.ok) {
     return new Map()
   }
-  const data: { chain: number; head: number }[] = await response.json()
-  return new Map(data.map((chain) => [chain.chain, chain.head]))
+  let data: { chain: number; head: number }[]
+  try {
+    data = await response.json()
+  } catch (e) {
+    return new Map()
+  }
+  const map = new Map(
+    data
+      .filter((c) => Number.isFinite(c.head))
+      .map((chain) => [chain.chain, Number(chain.head)])
+  )
+  _cachedBlockHeights = { at: Date.now(), map }
+  return map
 }
🤖 Prompt for AI Agents (early access)
In packages/sdk-router/src/gaszip/api.ts around lines 88 to 101, the function getGasZipBlockHeightMap lacks error handling for non-2xx HTTP responses, JSON parsing errors, and invalid data types, which can cause silent failures. Add try-catch blocks to handle fetch and JSON parsing errors, verify the HTTP status before parsing, and validate that the 'head' field is a number before mapping. Implement a simple in-memory cache with a TTL of 30-60 seconds to store and return cached results to reduce network calls and improve performance.

Comment on lines +319 to +333
/**
* Checks if the latest block heights reported by gas.zip are within the maximum age.
* Both chains must be up to date to enable the bridge.
*/
private async checkBlockHeights(
originChainId: number,
destChainId: number
): Promise<boolean> {
const blockHeightMap = await getGasZipBlockHeightMap()
const [originSynced, destSynced] = await Promise.all([
this.checkBlockHeight(originChainId, blockHeightMap.get(originChainId)),
this.checkBlockHeight(destChainId, blockHeightMap.get(destChainId)),
])
return originSynced && destSynced
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Cache block-height map to cut per-request latency

checkBlockHeights calls getGasZipBlockHeightMap() every time; see the suggestion in api.ts to cache the result for a short TTL and reuse it here.

🤖 Prompt for AI Agents (early access)
In packages/sdk-router/src/gaszip/gasZipModuleSet.ts around lines 319 to 333, the method checkBlockHeights calls getGasZipBlockHeightMap() on every invocation, causing unnecessary latency. To fix this, implement caching for the block height map with a short TTL, similar to the approach suggested in api.ts, and reuse the cached result within checkBlockHeights instead of fetching it each time.

Comment on lines 335 to 360
/**
* Checks if the block height is within the maximum age for a chain.
*/
private async checkBlockHeight(
chainId: number,
blockHeight?: number
): Promise<boolean> {
if (!blockHeight) {
logger.info(`Gas.zip block height not found for chain ${chainId}`)
return false
}
const provider = this.providers[chainId]
if (!provider) {
logger.info(`Provider not found for chain ${chainId}`)
return false
}
const block = await provider.getBlock(blockHeight)
const blockAge = Date.now() - block.timestamp * 1000
const result = 0 <= blockAge && blockAge <= GAS_ZIP_MAX_BLOCK_AGE_MS
if (!result) {
logger.info(
`Block height ${blockHeight} for chain ${chainId} is too old: ${blockAge} ms (allowed: 0 .. ${GAS_ZIP_MAX_BLOCK_AGE_MS} ms)`
)
}
return result
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Handle provider failures & null blocks to prevent crashes

provider.getBlock(blockHeight) can throw or return null (e.g., archival data not available).
Currently that would bubble up and reject the entire bridge call.

-    const block = await provider.getBlock(blockHeight)
-    const blockAge = Date.now() - block.timestamp * 1000
+    let block
+    try {
+      block = await provider.getBlock(blockHeight)
+    } catch (err) {
+      logger.warn(
+        `Failed to fetch block ${blockHeight} for chain ${chainId}: ${err}`
+      )
+      return false
+    }
+    if (!block) {
+      logger.info(
+        `Provider returned null for block ${blockHeight} on chain ${chainId}`
+      )
+      return false
+    }
+    const blockAge = Date.now() - block.timestamp * 1000

Also, if the local clock is behind the chain timestamp, blockAge becomes negative, causing result to be false.
Using Math.abs(blockAge) (or bounding at >= -1_000) may be safer in multi-region deployments.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* Checks if the block height is within the maximum age for a chain.
*/
private async checkBlockHeight(
chainId: number,
blockHeight?: number
): Promise<boolean> {
if (!blockHeight) {
logger.info(`Gas.zip block height not found for chain ${chainId}`)
return false
}
const provider = this.providers[chainId]
if (!provider) {
logger.info(`Provider not found for chain ${chainId}`)
return false
}
const block = await provider.getBlock(blockHeight)
const blockAge = Date.now() - block.timestamp * 1000
const result = 0 <= blockAge && blockAge <= GAS_ZIP_MAX_BLOCK_AGE_MS
if (!result) {
logger.info(
`Block height ${blockHeight} for chain ${chainId} is too old: ${blockAge} ms (allowed: 0 .. ${GAS_ZIP_MAX_BLOCK_AGE_MS} ms)`
)
}
return result
}
/**
* Checks if the block height is within the maximum age for a chain.
*/
private async checkBlockHeight(
chainId: number,
blockHeight?: number
): Promise<boolean> {
if (!blockHeight) {
logger.info(`Gas.zip block height not found for chain ${chainId}`)
return false
}
const provider = this.providers[chainId]
if (!provider) {
logger.info(`Provider not found for chain ${chainId}`)
return false
}
- const block = await provider.getBlock(blockHeight)
- const blockAge = Date.now() - block.timestamp * 1000
+ let block
+ try {
+ block = await provider.getBlock(blockHeight)
+ } catch (err) {
+ logger.warn(
+ `Failed to fetch block ${blockHeight} for chain ${chainId}: ${err}`
+ )
+ return false
+ }
+ if (!block) {
+ logger.info(
+ `Provider returned null for block ${blockHeight} on chain ${chainId}`
+ )
+ return false
+ }
+ const blockAge = Date.now() - block.timestamp * 1000
const result = 0 <= blockAge && blockAge <= GAS_ZIP_MAX_BLOCK_AGE_MS
if (!result) {
logger.info(
`Block height ${blockHeight} for chain ${chainId} is too old: ${blockAge} ms (allowed: 0 .. ${GAS_ZIP_MAX_BLOCK_AGE_MS} ms)`
)
}
return result
}
🤖 Prompt for AI Agents (early access)
In packages/sdk-router/src/gaszip/gasZipModuleSet.ts around lines 335 to 360, the call to provider.getBlock(blockHeight) can throw an error or return null, which is not currently handled and may cause crashes. Wrap the getBlock call in a try-catch block to handle exceptions gracefully and check if the returned block is null before proceeding. Also, adjust the blockAge calculation to handle cases where the local clock is behind the block timestamp by using Math.abs(blockAge) or allowing a small negative threshold to avoid incorrectly marking blocks as too old.

Copy link
cloudflare-workers-and-pages bot commented May 2, 2025

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3d3901a
Status: ✅  Deploy successful!
Preview URL: https://7ec01dee.sanguine-fe.pages.dev
Branch Preview URL: https://fix-gas-zip-check-block-heig.sanguine-fe.pages.dev

View logs

@ChiTimesChi ChiTimesChi merged commit 48d7cc6 into master May 2, 2025
34 of 37 checks passed
@ChiTimesChi ChiTimesChi deleted the fix/gas-zip-check-block-height branch May 2, 2025 15:05
ChiTimesChi added a commit that referenced this pull request May 5, 2025
* Ft/ponder ix hyp evm (#3571)

* add hyperevm to ponder ix

* addtl hypevm chain config

---------

Co-authored-by: parodime <noreply@protochainresearch.com>

* Publish

 - @synapsecns/rfq-indexer-api@1.1.0
 - @synapsecns/rfq-indexer@0.0.7

* ponder ix - set hyperEVM block range to 50

* fix: hyperEVM block range

* ponder ix - alter hype start block

* Fix multi-architecture build for Hyperliquid Node Image (#3574)

* hl docker image

* fix(workflow): move date tag creation to separate step in hyperliquid workflow

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>

* fix(workflow): remove load flag and use local image for tagging in hyperliquid workflow

* fix(workflow): use build-push-action for date tagging in hyperliquid workflow

* feat(workflow): add multi-architecture support and mainnet image build for hyperliquid

* fix(workflow): update hyperliquid workflow to use local Dockerfile for better multi-arch support

* fix(hyperliquid): update binary URL paths to match node documentation

* fix(hyperliquid): temporarily skip GPG verification due to inconsistent path issues

* fix(hyperliquid): always use Testnet binary since Mainnet binary is not publicly accessible

* fix(hyperliquid): use correct URL for Mainnet binary

---------

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* feat: Swap Engines [SYN-29] [SYN-35] (#3563)

* feat: SIR binding, StepParams, ZapData encoding

* feat: engine quote/route structs

* feat: slippage utils

* feat: no-op engine

* feat: add Default Engine

* feat: Kyber, Li.FI engines

* feat: paraSwap module

* feat: SwapEngineSet

* feat: add SwapEngineSet to SDK

* feat: Synapse Intent Router

* feat: expose swapV2

* feat: add swapV2 controller

* feat: add swapV2 route

* fix: null behaviour consistent with bridge route

* fix: remove originUserAddress for swapV2

* feat: swapV2 to use native amounts (wei)

* fix: swap/v2 route

* fix: tests

* feat: add production contracts

* chore: reorder KyberSwap chains, add bnerachain

* feat: expand list of supported chains for /swap/v2

* refactor: use named paramters for swapV2

* fix: set default slippage to 0.5%; stringify tx.value

* chore: generate docs

* Publish

 - @synapsecns/rest-api@1.10.0
 - @synapsecns/sdk-router@0.13.0
 - @synapsecns/synapse-interface@0.42.6
 - @synapsecns/widget@0.9.17
 - @synapsecns/rfq-indexer@0.0.8

* fix: mockCallRevert internal revert (#3575)

* Publish

 - @synapsecns/contracts-rfq@0.16.2

* feat(contracts-rfq): deploy SIR [SYN-29] (#3573)

* fix: adjust comment for #3467

* chore: mainnet -> ethereum

* feat: update deploy scripts, prepare create2 salts

* chore: add deployments from new chains

* chore: add chain IDs to foundry.toml

* chore: add utility scripts

* deploy: SIR and periphery on 12 chains

* deploy: SIR at 0x512000...000512 address

* fix: update SIR address

* Publish

 - @synapsecns/contracts-rfq@0.17.0
 - @synapsecns/rest-api@1.10.1
 - @synapsecns/sdk-router@0.14.0
 - @synapsecns/synapse-interface@0.42.7
 - @synapsecns/widget@0.9.18

* feat: SDK new chains [SYN-45] (#3535)

* feat: add HyperEVM to sdk-router

* feat: use staging RFQ API [REVERT LATER]

* feat: add HYPE-USDC, HYPE-ETHto the bridge map

* fix: add HYPE, HyperEVM to rest-api

* feat: update rest-api bridge map

* chore: add envs for api urls (#3537)

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* chore: make prod RFQ API the default value

* feat: support multiple RFQ APIs

* fix: don't report negative bridge fee for RFQ

* test: adjus the amount of token pairs for USDC

---------

Co-authored-by: trajan0x <83933037+trajan0x@users.noreply.github.com>
Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* Publish

 - @synapsecns/rest-api@1.11.0
 - @synapsecns/sdk-router@0.15.0
 - @synapsecns/synapse-interface@0.43.0
 - @synapsecns/widget@0.9.19

* fix: hide slippage between different type of assets for now [SYN-39] (#3590)

* Publish

 - @synapsecns/synapse-interface@0.43.1

* Support Swap V2 endpoint on Synapse REST client (#3593)

* fix(rest-api): swap v2 errors (#3594)

* fix: check if tx is defined

* chore: correct endpoint name in error

* Publish

 - @synapsecns/rest-api@1.11.1

* feat: sdk/api bridgeV2 for SynapseRFQ [SYN-66] (#3588)

* feat: scaffold bridgeV2

* feat: complete bridgeV2, scaffold module impls

* feat: airdrop amount in bridgeV2

* feat: bridgeV2 for SynapseRFQ

* fix: add more info to SwapEngine quotes, type assertions

* feat: /bridge/v2

* chore: generate docs

* refactor: steps params manipulation

* feat: cap origin slippage

* feat: cache getAllQuotes calls

* fix(rest-api): improve bridge v2 response format

- Replace BigNumber response objects with string values
- Rename maxAmountOutStr to maxAmountOut for cleaner API
- Update swagger documentation to reflect changes

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat(restclient): add bridge v2 endpoint support

- Add GetBridgeV2 and related parameters to REST client
- Update type definitions for bridge v2 response format
- Synchronize with recent bridge v2 API changes

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>

* [DI-48] fix: replace vulnerable tj-actions actions with dorny/paths-filter (#3595)

Replace all tj-actions actions (changed-files, verify-changed-files, branch-names) with
secure alternatives to mitigate the security vulnerability. Used dorny/paths-filter for
file checking and bash scripts for branch name detection.

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* chore(rest-api): edit README to trigger republish (#3597)

* Publish

 - @synapsecns/rest-api@1.12.0

* chore(sdk-router): edit README to trigger republish (#3598)

* Publish

 - @synapsecns/rest-api@1.12.1
 - @synapsecns/sdk-router@0.16.0
 - @synapsecns/synapse-interface@0.43.2
 - @synapsecns/widget@0.9.20

* chore(sdk-router): cleanup types, remove unused utilities (#3600)

* feat: add Prettify utility type for better IDE type display

Adds a Prettify<T> utility type that improves how types are displayed in the IDE:
- Applied to union types to show all properties
- Applied to Partial/Required patterns to show complete property set
- Applied to complex types with optional properties

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* chore(sdk-router): apply Prettify to complex types

- Add Prettify utility type to intersection types and type modifiers
- Create PartialZapDataV1 type for better reusability
- Update function signatures to use new type definitions
- Improve IDE display of complex types

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* chore(sdk-router): remove unused entity files and utils

Removed deprecated entity files and utility functions that are no longer needed in the SDK router package. These files were likely imported from another SDK and are not currently being used.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor(sdk-router): centralize utilities through utils/index.ts

- Modified utils/index.ts to use export * from each utility module
- Updated all imports to reference the centralized utils module instead of individual utility files
- This change makes the codebase more maintainable and easier to refactor

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* chore(sdk-router): enforce alphabetical ordering of imports

- Added alphabetical ordering rule to ESLint configuration
- Auto-fixed imports order in all files to comply with the new rule
- This enforces a consistent import style throughout the codebase

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor(sdk-router): replace BigintIsh with ethers' BigNumberish

Replace all occurrences of custom BigintIsh type with the standard BigNumberish from ethers.js.
This standardizes the codebase by using established types from the core library.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>

* Publish

 - @synapsecns/rest-api@1.12.2
 - @synapsecns/sdk-router@0.16.1
 - @synapsecns/synapse-interface@0.43.3
 - @synapsecns/widget@0.9.21

* fix(rest-api,sdk-router): `/bridge/v2` and `swap/v2` endpoint standardisation [SYN-77] (#3602)

* refactor: consistent params naming in swap/bridge V2

* feat: enrich SwapQuoteV2

* feat: enrich BridgeQuoteV2

* feat: update V2 endpoints in rest-api

* chore: update the swagger docs

* refactor: id ordering

* chore: regenerate restclient

* chore: fix example router address in `/swap/v2` response

* fix: add swap module name, same token swaps

* fix: unify swap/bridge module names in V2 only

* chore: unified "module name" in rest-api

* fix: remove string cast

* fix: SDK tests

* Apply suggestions from code review

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Publish

 - @synapsecns/rest-api@1.12.3
 - @synapsecns/sdk-router@0.16.2
 - @synapsecns/synapse-interface@0.43.4
 - @synapsecns/widget@0.9.22

* chore(sdk-router): cleanup logging, engine priorities (#3610)

* refactor: clean up engine priorities

* chore: remove execution time logging

* fix: adjust engine priorities

* Publish

 - @synapsecns/rest-api@1.12.4
 - @synapsecns/sdk-router@0.16.3
 - @synapsecns/synapse-interface@0.43.5
 - @synapsecns/widget@0.9.23

* feat(rest-api,sdk-router): intent endpoint [SYN-77] (#3613)

* feat: scaffold `intent` function

* feat: scaffold multiple txs in bridgeV2

* feat: optional `tokenOut` in bridge token candidate search

* feat: allow multiple txs in `bridgeV2`

* feat: single-chain swap intents

* feat: cross-chain intents

* feat: expose `/intent` endpoint

* chore: generate swagger

* fix: report all module names within the intent step

* chore: rename into "default pools" engine

* chore: update swagger, regenerate client

* fix: prevent errors on unsupported RFQ routes in V2 endpoints

* fix: block times, supported intent chains

* fix: fromAmount string

* Publish

 - @synapsecns/rest-api@1.13.0
 - @synapsecns/sdk-router@0.17.0
 - @synapsecns/synapse-interface@0.43.6
 - @synapsecns/widget@0.9.24

* fix(sdk-router): export intent types (#3620)

* fix: export intent types

* fix: export bridge types

* fix: export swap types

* fix: imports in tests

* Publish

 - @synapsecns/rest-api@1.13.1
 - @synapsecns/sdk-router@0.17.1
 - @synapsecns/synapse-interface@0.43.7
 - @synapsecns/widget@0.9.25

* upgrading to reference cortex much more

* adding new links etc

* Publish

 - @synapsecns/bridge-docs@0.6.7
 - @synapsecns/explorer-ui@0.5.15
 - @synapsecns/synapse-interface@0.43.8
 - @synapsecns/widget@0.9.26

* fix(sdk-router): exported slippage type (#3634)

* fix: use slippagePercentage in exported types

* fix: use slippage percentage in rest-api

* Publish

 - @synapsecns/rest-api@1.13.2
 - @synapsecns/sdk-router@0.17.2
 - @synapsecns/synapse-interface@0.43.9
 - @synapsecns/widget@0.9.27

* fix(sdk-router, rest-api): stringify BigNumber in exported V2 types [SYN-77] (#3636)

* fix: stringify BigNumber in exported V2 types

* fix: update bridge modules

* fix: update V2 operations

* fix: update rest-api

* Publish

 - @synapsecns/rest-api@1.13.3
 - @synapsecns/sdk-router@0.17.3
 - @synapsecns/synapse-interface@0.43.10
 - @synapsecns/widget@0.9.28

* Update bl

* fix(sdk-router): restrict `fromAmount` to `string` in the exported intent parameters (#3645)

* chore: fix existing documentation

* fix: restrict fromAmount type to string in exported parameters

* Publish

 - @synapsecns/rest-api@1.13.4
 - @synapsecns/sdk-router@0.17.4
 - @synapsecns/synapse-interface@0.43.11
 - @synapsecns/widget@0.9.29

* fix(sdk-router): add decimals to intent steps (#3646)

* refactor: isolate token decimals retrieval

* fix: add decimal metadata to each intent step

* fix: make tokenMetadataFetcher optional

* Publish

 - @synapsecns/rest-api@1.13.5
 - @synapsecns/sdk-router@0.17.5
 - @synapsecns/synapse-interface@0.43.12
 - @synapsecns/widget@0.9.30

* fix(sdk-router): add `HYPEREVM` to intents supported chains

* chore: small change to publish 9abecbe (#3648)

* Publish

 - @synapsecns/rest-api@1.13.6
 - @synapsecns/sdk-router@0.17.6
 - @synapsecns/synapse-interface@0.43.13
 - @synapsecns/widget@0.9.31

* fix(sdk-router): swap engine improvements, remove cap on RFQ origin slippage (#3652)

* fix: exclude RFQ sources on KyberSwap

* fix: paraSwap partner, LiFi timing strategy

* feat: use FBI for Route V2 zap data

* fix: make minToAmount requied in SwapEngineRoute

* fix: don't cap origin slippage

* fix: don't use interceptor without origin swaps

* Publish

 - @synapsecns/rest-api@1.13.7
 - @synapsecns/sdk-router@0.17.7
 - @synapsecns/synapse-interface@0.43.14
 - @synapsecns/widget@0.9.32

* removing old routes and tokens

* Publish

 - @synapsecns/bridge-docs@0.6.8

* Adding hyperevm to the explorer (#3647)

* adding hyperevm [goreleaser]

* updating chart color

* fixing pricing issues [goreleaser]

* fix for native tokens [goreleaser]

* fixing bera weth [goreleaser]

* removing all old fetcher changes

* [goreleaser]

* lint

---------

Co-authored-by: parodime <jordan@protochainresearch.com>

* Publish

 - @synapsecns/explorer-ui@0.5.16

* adding hyperevm to constants

* Publish

 - @synapsecns/bridge-docs@0.6.9
 - @synapsecns/explorer-ui@0.5.17
 - @synapsecns/rest-api@1.13.8
 - @synapsecns/synapse-constants@1.8.10

* Deprecate and remove go restclient module [SYN-88] (#3658)



---------

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* SYN-86 Delete Old exporters and remove unused code (#3656)



Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* SYN-87 Remove SignOz functionality from opbot (#3657)

* SYN-87 Remove SignOz functionality from opbot

- Removed SignOz client and package
- Removed SignOz configuration fields
- Removed traceCommand dependent on SignOz
- Updated README to remove SignOz references
- Added CLAUDE.md for automated operations
- Fixed formatting and ensured code builds correctly

* update go.work.sum

* Fix goimports formatting issues for linting

* [goreleaser]

* nuke signoz example [goreleaser]

---------

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* feat(contracts-rfq): fast bridge interceptor [SYN-84] (#3649)

* feat: scaffold FastBridgeInterceptor

* test: add coverage

* feat: implement interceptor

* test: different decimals ratio

* docs: improve FastBridgeInterceptor documentation

- Add clear NatSpec documentation to both implementation and interface
- Focus user documentation on integration aspects
- Clarify contract behavior and edge cases
- Follow Solidity documentation standards
- Fix typo in interface documentation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* chore: fix lint

* refactor: relabel percentage vars

* build: deploy Interceptor on supported mainnets

---------

Co-authored-by: Claude <noreply@anthropic.com>

* Publish

 - @synapsecns/contracts-rfq@0.18.0

* feat(contracts-rfq): sir new deployments (#3662)

* build: add new chains to config

* chore: deploy on avax and polygon

* Publish

 - @synapsecns/contracts-rfq@0.19.0

* fix(sdk-router): address utils, URLs in constructor, ParaSwap surplus (#3660)

* fix: `handleNativeToken` non-checksummed address, reorganize

* fix: export address utils

* refactor: handleParams

* test: ensure that 0xEE is working with integrations

* feat: pass paraswap surplus to user

* feat: allow passing URLs in SDK constructor

* fix: use Gas.Zip contract deposit

* fix: types

* feat: intents with gas.zip

* build: add sdk:stream script

* feat: add Avax, Ploygon to intents chain ids

* refactor: chainProviders init logic

* fix: enforce gas.zip min/max usd value

* Publish

 - @synapsecns/rest-api@1.13.9
 - @synapsecns/sdk-router@0.17.8
 - @synapsecns/synapse-interface@0.43.15
 - @synapsecns/widget@0.9.33

* fix(sdk-router): faster intent quotes, time logging, Paraswap surplus [SYN-97] (#3672)

* fix: make logExecutionTime more generic

* chore: add execition time logging

* fix: paraswap surplus

* fix: use longer cache for RFQ available tokens, shorter cache for quotes

* feat: getFastestQuote

* chore: remove old getBestQuote

* fix: timeouts

* chore: fix incorrect comments

* fix: make logging work with minimised package

* fix: prevent unhandled rejections in quote processing

- Improve _getFastestQuote to properly handle all promises even when returning early
- Use Promise.allSettled in the background to ensure all rejections are caught
- Maintain fast response time while avoiding unhandled promise rejections

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: ensure timing is logged even when methods throw errors

- Wrap method execution in try/finally to log execution time in all cases
- Ensure original errors are propagated properly
- Simplify code with direct return in try block

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: ensure consistent cache keys in FastBridgeRouterSet

- Fix cache key inconsistency in getAllQuotes method
- Ensure cache keys match between get and set operations
- Use enum values directly in cache key construction

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: variable shadowing

---------

Co-authored-by: Claude <noreply@anthropic.com>

* Publish

 - @synapsecns/rest-api@1.13.10
 - @synapsecns/sdk-router@0.17.9
 - @synapsecns/synapse-interface@0.43.16
 - @synapsecns/widget@0.9.34

* fix(sdk-router): gas.zip block height (#3675)

* feat: add latest block endpoint

* fix: don't use gas.zip quotes for stale chains

* fix: getBlock error cases

* fix: safer API data manipulation

* Publish

 - @synapsecns/rest-api@1.13.11
 - @synapsecns/sdk-router@0.17.10
 - @synapsecns/synapse-interface@0.43.17
 - @synapsecns/widget@0.9.35

---------

Co-authored-by: parodime <jordan@protochainresearch.com>
Co-authored-by: parodime <noreply@protochainresearch.com>
Co-authored-by: parodime <parodime@users.noreply.github.com>
Co-authored-by: trajan0x <83933037+trajan0x@users.noreply.github.com>
Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>
Co-authored-by: ChiTimesChi <ChiTimesChi@users.noreply.github.com>
Co-authored-by: vro <168573323+golangisfun123@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: defi-moses <jakedinero@protonmail.com>
Co-authored-by: Moses <103143573+Defi-Moses@users.noreply.github.com>
Co-authored-by: Defi-Moses <Defi-Moses@users.noreply.github.com>
Co-authored-by: aureliusbtc <82057759+aureliusbtc@users.noreply.github.com>
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.

1 participant
0