Skip to content
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

fix_: check if bridge for token exists in ToChainId before returning contract address for FromChainId #6272

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

briansztamfater
Copy link
Member

@briansztamfater briansztamfater commented Jan 21, 2025

Currently, Hop does not support some tokens on Base such as DAI or USDT, but the router returns a valid route for such transactions, ending on failed transactions and gas wasting for such cases.

This PR adds a check for the bridge contract receiving chain ID before returning the bridge contract for the sender chain ID, in that way we return an error if the token is not supported on Hop for the receiving chain ID.

We have an issue in status-mobile which this PR should partially fix it (proper fix would be to prevent the user to select unsupported tokens for selected chain): status-im/status-mobile#21964

@status-im-auto
Copy link
Member

status-im-auto commented Jan 21, 2025

Jenkins Builds

Click to see older builds (33)
Commit #️⃣ Finished (UTC) Duration Platform Result
✖️ fb700ee #1 2025-01-21 16:08:52 ~3 min tests 📄log
✔️ fb700ee #1 2025-01-21 16:08:55 ~3 min macos 📦zip
✔️ fb700ee #1 2025-01-21 16:09:00 ~3 min ios 📦zip
✔️ fb700ee #1 2025-01-21 16:10:17 ~5 min linux 📦zip
✔️ fb700ee #1 2025-01-21 16:10:26 ~5 min macos 📦zip
✔️ fb700ee #1 2025-01-21 16:10:47 ~5 min windows 📦zip
✔️ fb700ee #1 2025-01-21 16:11:20 ~6 min android 📦aar
✔️ fb700ee #1 2025-01-21 16:11:36 ~6 min tests-rpc 📄log
✔️ d33b39e #2 2025-01-21 17:14:53 ~3 min macos 📦zip
✔️ d33b39e #2 2025-01-21 17:15:08 ~3 min ios 📦zip
✔️ d33b39e #2 2025-01-21 17:15:25 ~3 min windows 📦zip
✔️ d33b39e #2 2025-01-21 17:16:30 ~5 min macos 📦zip
✔️ d33b39e #2 2025-01-21 17:16:46 ~5 min linux 📦zip
✔️ d33b39e #2 2025-01-21 17:17:19 ~6 min android 📦aar
✔️ d33b39e #2 2025-01-21 17:17:45 ~6 min tests-rpc 📄log
✖️ d33b39e #2 2025-01-21 17:41:56 ~30 min tests 📄log
✔️ d33b39e #3 2025-01-21 19:01:35 ~30 min tests 📄log
✖️ e69172c #4 2025-01-22 16:09:34 ~2 min tests 📄log
✔️ e69172c #3 2025-01-22 16:10:13 ~3 min macos 📦zip
✔️ e69172c #3 2025-01-22 16:10:29 ~3 min ios 📦zip
✔️ e69172c #3 2025-01-22 16:10:54 ~4 min windows 📦zip
✔️ e69172c #3 2025-01-22 16:12:02 ~5 min linux 📦zip
✔️ e69172c #3 2025-01-22 16:12:50 ~6 min android 📦aar
✔️ e69172c #3 2025-01-22 16:12:57 ~6 min tests-rpc 📄log
✔️ e69172c #3 2025-01-22 16:19:17 ~12 min macos 📦zip
✖️ dd2988e #5 2025-01-22 16:12:57 ~3 min tests 📄log
✔️ dd2988e #4 2025-01-22 16:13:46 ~3 min macos 📦zip
✔️ dd2988e #4 2025-01-22 16:14:36 ~4 min ios 📦zip
✔️ dd2988e #4 2025-01-22 16:14:56 ~3 min windows 📦zip
✔️ dd2988e #4 2025-01-22 16:17:28 ~5 min linux 📦zip
✔️ dd2988e #4 2025-01-22 16:19:06 ~6 min android 📦aar
✔️ dd2988e #4 2025-01-22 16:21:30 ~8 min tests-rpc 📄log
✔️ dd2988e #4 2025-01-22 16:24:27 ~5 min macos 📦zip
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 85f3992 #5 2025-01-22 16:27:07 ~3 min macos 📦zip
✔️ 85f3992 #5 2025-01-22 16:27:16 ~3 min ios 📦zip
✔️ 85f3992 #5 2025-01-22 16:27:40 ~3 min windows 📦zip
✔️ 85f3992 #5 2025-01-22 16:28:57 ~5 min linux 📦zip
✔️ 85f3992 #5 2025-01-22 16:29:39 ~6 min android 📦aar
✔️ 85f3992 #5 2025-01-22 16:29:40 ~5 min macos 📦zip
✔️ 85f3992 #5 2025-01-22 16:35:37 ~12 min tests-rpc 📄log
✔️ 85f3992 #6 2025-01-22 17:04:10 ~40 min tests 📄log
✔️ 661a31b #6 2025-01-23 18:32:41 ~11 min ios 📦zip
✔️ 661a31b #6 2025-01-23 18:59:59 ~6 min android 📦aar
✔️ 661a31b #7 2025-01-23 21:31:35 ~30 min tests 📄log
✔️ 661a31b #6 2025-01-23 23:21:17 ~6 min tests-rpc 📄log

@briansztamfater briansztamfater force-pushed the fix/check-bridge-to-chain-id branch from fb700ee to d33b39e Compare January 21, 2025 17:11
Copy link

codecov bot commented Jan 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.83%. Comparing base (e4d5622) to head (661a31b).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #6272   +/-   ##
========================================
  Coverage    61.82%   61.83%           
========================================
  Files          843      843           
  Lines       111286   111288    +2     
========================================
+ Hits         68807    68815    +8     
- Misses       34506    34507    +1     
+ Partials      7973     7966    -7     
Flag Coverage Δ
functional 21.70% <0.00%> (+0.17%) ⬆️
unit 60.31% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
services/wallet/common/const.go 89.65% <ø> (ø)
...allet/router/pathprocessor/processor_bridge_hop.go 11.54% <100.00%> (+0.36%) ⬆️

... and 36 files with indirect coverage changes

@briansztamfater briansztamfater force-pushed the fix/check-bridge-to-chain-id branch 3 times, most recently from dd2988e to 85f3992 Compare January 22, 2025 16:23
@briansztamfater briansztamfater changed the title fix_: check if bridge for token exists in ToChainId before returnin contract address for FromChainId fix_: check if bridge for token exists in ToChainId before returning contract address for FromChainId Jan 22, 2025
…contract address for FromChainId

Signed-off-by: Brian Sztamfater <[email protected]>
@briansztamfater briansztamfater force-pushed the fix/check-bridge-to-chain-id branch from 85f3992 to 661a31b Compare January 23, 2025 14:11
Copy link
Contributor

@dlipicar dlipicar left a comment

Choose a reason for hiding this comment

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

Looks like a very nice catch! I'd like the expert @saledjenic to chime in before merging, to be sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

3 participants