Commit Graph

97 Commits

Author SHA1 Message Date
frank 38308d48f2
feat_: log on panic (#5849)
* feat_: log error and stacktrace when panic in goroutine

* test_: add test TestSafeGo

* chore_: rename logAndCall to call

* chore_: rename SafeGo to Go

* chore_: make lint-fix

* chore_: use t.Cleanup

* chore_: Revert "chore_: use t.Cleanup"

This reverts commit 4eb420d179cc0e208e84c13cb941e6b3d1ed9819.

* chore_: Revert "chore_: make lint-fix"

This reverts commit fcc995f157e671a4229b47419c3a0e4004b5fdab.

* chore_: Revert "chore_: rename SafeGo to Go"

This reverts commit a6d73d6df583f313032d79aac62f66328039cb55.

* chore_: Revert "chore_: rename logAndCall to call"

This reverts commit 8fbe993bedb9fbba67349a44f151e2dd5e3bc4cc.

* chore_: Revert "test_: add test TestSafeGo"

This reverts commit a1fa91839f3960398980c6bf456e6462ec944819.

* chore_: Revert "feat_: log error and stacktrace when panic in goroutine"

This reverts commit f612dd828fa2ce410d0e806fe773ecbe3e86a68a.

* feat_: log error and stacktrace when panic in goroutine

* chore_: make lint-fix

* chore_: rename logAndCall to call

* chore_: renaming LogOnPanic

* chore_: update rest goroutine function calls

* chore_: make lint-fix
2024-09-27 06:37:32 +08:00
Igor Sirotin 77ef8f1fb7
chore_: make lint-fix (#5871) 2024-09-24 14:52:29 +01:00
Sale Djenic 8ddde51445 fix_: browser connect - send transaction command 2024-09-20 15:16:17 +02:00
Sean Hagstrom 385933a60d
feat: fallback to cache for prices and token market values when calling GetWalletToken (#5832)
This change adapts the market manager to cache the token-market-cap, and modifies the existing `GetWalletToken` function to use the token-price and token-market cache data. Additionally, we choose to use the cached price and market data for roughly 60 seconds when calling the `GetWalletToken` function.
2024-09-20 12:24:43 +01:00
dlipicar f165103f66
chore_: migrate to uber's mock fork (#5858)
* chore_: migrate to uber's mock fork

* chore_: make vendor
2024-09-20 10:08:11 +01:00
Khushboo Mehta 4816769506 feat!: Return prices array along with SuggestedRoutes 2024-09-11 17:03:33 +02:00
Sale Djenic 0235889e12 feat_: check for balances after each fees update 2024-09-11 13:51:51 +02:00
Sale Djenic 506a76bf9f feat_: recalculate route fees with every new block 2024-09-11 13:51:51 +02:00
Sale Djenic 1bb9cbc573 chore_: router response moved to wallet responses location
Following the approach we did for keeping requests at the same location, these changes introduce
new location for responses. `SuggestedRoutesResponse` is moved there and renamed to
`RouterSuggestedRoutes` and code is updated accordingly.

New type `Route` defined (since a single route is composed of zero or more paths).

Types `Route`, `Path`, `Graph` and `Node` belong to a new `routs` package now.
2024-09-11 13:51:51 +02:00
Sale Djenic 00559692bc chore!: router code organization improvements
It's a breaking change due to errors' changes, the list of mapped old error codes:
- `"WR-001"` is now `"WRR-001"`
- `"WR-002"` is now `"WRR-002"`
- `"WR-003"` is now `"WRR-003"`
- `"WR-004"` is now `"WRR-004"`
- `"WR-005"` is now `"WRR-005"`
- `"WR-006"` is now `"WRR-006"`
- `"WR-007"` is now `"WRR-007"`
- `"WR-008"` is now `"WRR-008"`
- `"WR-009"` is now `"WRR-009"`
- `"WR-010"` is now `"WRR-010"`
- `"WR-011"` is now `"WRR-011"`
- `"WR-012"` is now `"WRR-012"`
- `"WR-013"` is now `"WRR-013"`
- `"WR-014"` is now `"WRR-014"`
- `"WR-015"` is now `"WRR-015"`
- `"WR-019"` is now `"WRR-016"`
- `"WR-020"` is now `"WRR-017"`
- `"WR-021"` is now `"WRR-018"`
- `"WR-025"` is now `"WRR-019"`

- `"WR-016"` is now `"WR-001"`
- `"WR-017"` is now `"WR-002"`
- `"WR-018"` is now `"WR-003"`
- `"WR-022"` is now `"WR-004"`
- `"WR-023"` is now `"WR-005"`
- `"WR-024"` is now `"WR-006"`
- `"WR-026"` is now `"WR-007"`
- `"WR-027"` is now `"WR-008"`

Other changes:
- `RouteInputParams` type moved to `requests` package and code updated accordingly
- `SuggestedFees` type moved to a new `fees` package and code updated accordingly
- `SendType` type moved to a new `sendtype` package and code updated accordingly
- the following functions moved to `common` package
  - `ArrayContainsElement`
  - `ArraysWithSameElements`
  - `SameSingleChainTransfer`
  - `CopyMapGeneric`
  - `GweiToEth`
  - `WeiToGwei`
- the following consts moved to `common` package
  - `HexAddressLength`
  - `SupportedNetworks`
  - `SupportedTestNetworks`
2024-09-11 13:51:51 +02:00
Sale Djenic d10d492515 chore!: removed v2 mark from api endpoints, structs and files marked as router v2
Breaking change!

Since the old router logic is removed, there is no need to have files and structs marked as v2.

Renamed endpoints:
- `GetSuggestedRoutesV2` to `GetSuggestedRoutes`
- `GetSuggestedRoutesV2Async` to `GetSuggestedRoutesAsync`
- `StopSuggestedRoutesV2AsyncCalcualtion` to `StopSuggestedRoutesAsyncCalcualtion`
2024-09-11 13:51:51 +02:00
Sale Djenic e58787536a chore_: old router logic removed 2024-09-11 13:51:51 +02:00
Igor Sirotin c9b777a218
fix_: clean up tests with ResetMobileSignalHandler (#5793) 2024-09-03 09:41:56 +01:00
Dario Gabriel Lipicar dc7ca3ddb4 fix(wallet)_: fix single chain operation check 2024-08-29 16:14:15 -03:00
Dario Gabriel Lipicar 0809c0b156 feat(wallet)_: upgrade paraswap client to v6.2 2024-08-28 12:53:09 -03:00
Sale Djenic 9b9a91f654 chore_: map insufficient funds error
This commit maps this kind of errors
`status-proxy-0.error: failed with 50011064 gas: insufficient funds for gas * price + value: address 0x4eeB09cf0076F840b38511D808464eE48efD4305 have 0 want 10000000000000`
to this form:
`status-proxy-0.error: failed with 50011064 gas: insufficient funds for gas * price + value: address 0x4eeB09cf0076F840b38511D808464eE48efD4305`

which means that we don't want to display to a user details of how much they have and how much is needed for fees, cause those data are very often
misleading, referring mostly to "how much user has".

New error added in case there is no positive balances across all enabled chains.
2024-08-28 08:23:18 +02:00
Andrea Maria Piana e07182b3f3 fix_: Don't count error rate for circuit breaker on cancel and handle
not found
2024-08-20 15:26:28 +01:00
frank 83aa01c7da
chore_:update route error details (#5749) 2024-08-20 21:14:35 +08:00
Sale Djenic 759034ec7a fix_: crash when selected token cannot be found is fixed 2024-08-19 09:59:18 +02:00
Sale Djenic 2f08c4c6f9 fix_: crash sending collectibles fixed
When mapping `MultipathProcessorTxArgs` to `ProcessorInputParams` setting `FromChain` was missed.
2024-08-19 09:59:18 +02:00
Igor Sirotin 9175e45e61
fix_: block on logout (#5696)
* fix_: check context on processAndPushTelemetry

* fix_: fix waitgroup add/done in Waku

* fix(pendingTracker)_: stop the pending transacitonTracker on logout

* chore_: lint fix

---------

Co-authored-by: Jonathan Rainville <rainville.jonathan@gmail.com>
2024-08-12 22:30:13 +01:00
Sale Djenic 4a78d7c1e9 fix_: when preparing a balance map skip chains where cannot get the balance, instead of returning the error 2024-08-12 17:35:19 +02:00
Sale Djenic db5e5832d1 fix_: calculating route for erc721 checks one more call if the function doesn't exist on the contract
Old ERC721 contracts do not have  `safeTransferFrom` function, because of that we couldn't estimate the gas
and we couldn't resolve the right route. Now we firstly check for `safeTransferFrom` function which is supported
by ERC721A contracts and if the contract doesn't have it then we do `transferFrom` function call.

Example of ERC721A contract:
- https://etherscan.io/address/0x0024bc1035d30ae229a4712189b32131758cb000#code

Example of ERC721 contract:
- https://etherscan.io/address/0x06012c8cf97bead5deae237070f9587f8e7a266d#code
2024-08-12 17:26:56 +02:00
saledjenic 79b1c547d1
Improvements on resolving nonce (#5658)
* chore_: unused `BuildTx` function removed from the processor interface and types that are implement it

Since the `BuildTx` function is not used anywhere, it's removed from the code.

* fix_: resolving nonce improvements

When the app sends more than a single tx from the same account on the same chain, some
chains do not return appropriate nonce (they do not consider pending txs), because of
that we place more tx with the same nonce, where all but the first one fail.

Changes in this PR keep track of nonces being used in the same sending/bridging flow, which means
for the first tx from the multi txs the app asks the chain for the nonce, and every next nonce is resolved
by incrementing the last used nonce by 1.
2024-08-12 08:07:32 -04:00
dlipicar d7fcbd3444
feat(wallet)_: handle paraswap price impact error (#5622) 2024-08-07 23:33:44 +01:00
Sale Djenic cf1a6631f8 fix_: the last known route with positive balance returned if no route without balance/bonder error
The Router algorithm is checking all the routes in order to find one the user has a balance to execute it
even that one is not the cheapest one. But if the user has some balances, but not enough to execute any
of suggested routes, we we're returning the last route which was checked, with the changes from this commit
we will return the last route for which the user has some balance, but not enough.
2024-08-01 15:26:01 +02:00
Ivan Belyakov b74d9e6b4e feat(wallet)_: add status proxy RPC urls for blockchain providers
Replace the status proxy URL for cryptocompare.
2024-08-01 08:19:20 +02:00
Sale Djenic 8787da1b89 feat_: added new error which will be returned in case bonder fee is higher than the amount being sent 2024-07-31 15:12:05 +02:00
IvanBelyakoff 5b34cd9e9f
feat(wallet)_: add basic auth for cryptocompare proxy (#5536)
* feat(wallet)_: add basic auth for cryptocompare proxy

* test(wallet)_: add a test for httpclient used in market clients
2024-07-30 14:48:22 +01:00
Sale Djenic 18885b3663 test_: flaky router tests fixed
Closes https://github.com/status-im/status-go/issues/5601
2024-07-29 16:53:56 +02:00
Sale Djenic 20c1b83b7c chore_: when returning errors, give precedence to custom (network) errors 2024-07-29 10:05:56 +02:00
Sale Djenic 9472e18315 fix_: setting best route only when we have it 2024-07-29 10:05:56 +02:00
Igor Sirotin e76d93d340
chore: skip flaky tests (#5606)
* chore_: skip TestPeerCount

* chore_: skip flaky wallet tests

* chore_: skip flaky TestMemberReceivesPendingRequestToJoinAfterAfterGettingTokenMasterRole
2024-07-27 10:27:26 +01:00
belalshehab 03cb3ad0ab fix(Wallet)_: Add quotes around token symbol in insufficient balance error messages to ensure valid JSON parsing 2024-07-26 13:16:23 +03:00
Igor Sirotin 870ede0829
fix_: tests (#5585)
* fix_: router tests errors sprintf

* chore_: skip flaky tests
2024-07-25 23:27:12 +01:00
saledjenic 2bbdb35f6c
Added improvements in resolving the best route (#5569)
* fix_: filtering out routes which do not match the amount in

* fix_: finding the best route logic updated

* fix_: "to" chains being used in sending bridge tx via hop are more explicit

Using `ChainIDTo` depicts better an intention which chain should be used.

* chore_: checking for required balance improved

An error contains now more details, for which token on which chain there is not enough balance for
executing a tx. Also check for required balance now calculates in fees for all tx that possibly can be
sent from the same chain.
2024-07-25 08:15:30 -04:00
Dario Gabriel Lipicar 7c4b43b4d9 feat(wallet)_: incorporate partner fees for L1 paraswap swaps 2024-07-23 15:27:43 -03:00
Sale Djenic 4d2d20cff4 fix_: allow sending 0 value transactions 2024-07-23 18:19:10 +02:00
Dario Gabriel Lipicar afc6e7bcb9 feat(router)_: return processor error when no routes are found 2024-07-19 17:44:08 +02:00
Emil Sawicki 094d26dc66 fix_: Add pending tx for collectibles 2024-07-15 13:00:21 +01:00
Dario Gabriel Lipicar 21101c9444 feat(wallet)!: return routerV2 suggested routes whenever available, on top of error if the best route doesn't pass all checks 2024-07-12 17:59:41 -03:00
Sale Djenic 378e5741b9 feat_: the router - add candidates, as potential paths, by taking the max amount on enabled chains 2024-07-05 14:51:34 +02:00
Anthony Laibe abb570dd3f fix_: l1 fees at 0 and fix base fees sepolia 2024-07-05 11:04:29 +02:00
Ivan Belyakov 3983114ae5 test(wallet)_: add unit tests for balance fetcher
replace types with interfaces where necessary to allow mocking
implement fake eth scanner and erc20 contracts
2024-07-04 09:29:49 +02:00
Samuel Hawksby-Robinson 5f666e6ad9 test(router_validation)_: blended my validation with latest develop 2024-07-03 11:47:04 +01:00
Samuel Hawksby-Robinson 3c1326be48 test(router_validation)_: Resolved invalid recursive type aliasing
Additionally I've resolved a panic when AmountIn and/or AmountOut is nil
2024-07-03 11:47:04 +01:00
Samuel Hawksby-Robinson 59853fdbe2 test(router_validation)_: integrated the new errors into test loigc 2024-07-03 11:47:04 +01:00
Samuel Hawksby-Robinson e4420533d6 test(router_validation)_: removed error consts, see #5362 2024-07-03 11:47:04 +01:00
Samuel Hawksby-Robinson da2af02049 test(router_validation)_: Added test cases for Sticker and Swaps 2024-07-03 11:47:04 +01:00
Samuel Hawksby-Robinson cdaca322d0 test(router_validation)_: Added Error consts for all tested paths 2024-07-03 11:47:04 +01:00