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(wallet)_: enrich status changed and tx update signals' payload with tx route data #6050

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

saledjenic
Copy link
Contributor

@saledjenic saledjenic commented Nov 5, 2024

As can be seen, by commits, all but the last commit were necessary to get rid of cyclic dependencies I ran into when I wanted to add route tx data to the payload of the status-changed signal.

What's done:

  • ens resolver type identified and moved out of the ens API, it's used to interact with the network/contracts, while ens API remained as it was, and it's using it and exposes its functions to a client and also has functions to deal with ens storage (save/remove ens from db). This change doesn't introduce any breaking changes, all API endpoints and functionalities are as they were.
  • send type package is simplified in a way that path processor constants are moved to wallet constants (it doesn't use constants from pathprocessors package) and heavy calls that interact with the network (FetchPrices and FindToken) are moved from the sendtype package to the router package
  • transactions/types.go (where we have SendTxArgs type defined and used across many packages) moved to services/wallet/wallettypes
  • route execution related types moved to services/wallet/wallettypes
  • the last commit is what we need to have all necessary info on the client side

These changes depend on the work done here #5970

@status-im-auto
Copy link
Member

status-im-auto commented Nov 5, 2024

Jenkins Builds

Click to see older builds (81)
Commit #️⃣ Finished (UTC) Duration Platform Result
✖️ 1a92352 #1 2024-11-05 22:18:59 ~3 min tests 📄log
✔️ 1a92352 #1 2024-11-05 22:19:42 ~4 min macos 📦zip
✔️ 1a92352 #1 2024-11-05 22:19:48 ~4 min tests-rpc 📄log
✔️ 1a92352 #1 2024-11-05 22:19:59 ~4 min ios 📦zip
✔️ 1a92352 #1 2024-11-05 22:20:37 ~5 min windows 📦zip
✔️ 1a92352 #1 2024-11-05 22:20:44 ~5 min linux 📦zip
✔️ 1a92352 #1 2024-11-05 22:20:45 ~5 min android 📦aar
✔️ 1a92352 #1 2024-11-05 22:22:13 ~7 min macos 📦zip
✖️ 9f0261c #2 2024-11-06 10:18:41 ~2 min tests 📄log
✔️ 9f0261c #2 2024-11-06 10:19:56 ~3 min windows 📦zip
✔️ 9f0261c #2 2024-11-06 10:20:16 ~4 min tests-rpc 📄log
✔️ 9f0261c #2 2024-11-06 10:20:26 ~4 min macos 📦zip
✔️ 9f0261c #2 2024-11-06 10:21:03 ~5 min ios 📦zip
✔️ 9f0261c #2 2024-11-06 10:21:34 ~5 min android 📦aar
✔️ 9f0261c #2 2024-11-06 10:21:40 ~5 min linux 📦zip
✔️ 9f0261c #2 2024-11-06 10:22:47 ~6 min macos 📦zip
✔️ 4a6f483 #3 2024-11-06 12:36:41 ~3 min windows 📦zip
✖️ 4a6f483 #3 2024-11-06 12:37:12 ~4 min tests 📄log
✔️ 4a6f483 #3 2024-11-06 12:37:26 ~4 min macos 📦zip
✔️ 4a6f483 #3 2024-11-06 12:37:35 ~4 min linux 📦zip
✔️ 4a6f483 #3 2024-11-06 12:37:48 ~4 min tests-rpc 📄log
✔️ 4a6f483 #3 2024-11-06 12:37:54 ~5 min android 📦aar
✔️ 4a6f483 #3 2024-11-06 12:37:59 ~5 min ios 📦zip
✔️ 4a6f483 #3 2024-11-06 12:39:56 ~7 min macos 📦zip
✖️ a30cc4c #4 2024-11-07 11:48:55 ~2 min tests 📄log
✔️ a30cc4c #4 2024-11-07 11:50:09 ~3 min windows 📦zip
✔️ a30cc4c #4 2024-11-07 11:50:21 ~4 min tests-rpc 📄log
✔️ a30cc4c #4 2024-11-07 11:51:26 ~5 min linux 📦zip
✔️ a30cc4c #4 2024-11-07 11:51:54 ~5 min android 📦aar
✔️ a30cc4c #4 2024-11-07 11:52:28 ~6 min macos 📦zip
✔️ a30cc4c #4 2024-11-07 11:53:02 ~6 min macos 📦zip
✔️ a30cc4c #4 2024-11-07 11:54:21 ~8 min ios 📦zip
fc6637e #5 2024-11-08 07:09:44 ~1 min ios 📄log
✖️ fc6637e #5 2024-11-08 07:10:14 ~2 min tests 📄log
fc6637e #5 2024-11-08 07:10:21 ~2 min windows 📄log
fc6637e #5 2024-11-08 07:10:24 ~2 min macos 📄log
fc6637e #5 2024-11-08 07:10:26 ~2 min android 📄log
✖️ fc6637e #5 2024-11-08 07:10:30 ~2 min tests-rpc 📄log
fc6637e #5 2024-11-08 07:10:49 ~2 min linux 📄log
fc6637e #5 2024-11-08 07:12:39 ~4 min macos 📄log
✔️ ff68921 #6 2024-11-08 07:49:28 ~4 min windows 📦zip
✔️ ff68921 #6 2024-11-08 07:49:35 ~4 min tests-rpc 📄log
✔️ ff68921 #6 2024-11-08 07:50:52 ~5 min linux 📦zip
✔️ ff68921 #6 2024-11-08 07:50:59 ~5 min android 📦aar
✔️ ff68921 #6 2024-11-08 07:51:29 ~6 min macos 📦zip
✔️ ff68921 #6 2024-11-08 07:52:07 ~6 min macos 📦zip
✔️ ff68921 #6 2024-11-08 07:53:22 ~8 min ios 📦zip
✖️ ff68921 #6 2024-11-08 08:17:57 ~32 min tests 📄log
✖️ ff68921 #7 2024-11-08 10:09:06 ~33 min tests 📄log
✔️ ff68921 #7 2024-11-08 12:07:37 ~3 min windows 📦zip
✔️ ff68921 #7 2024-11-08 12:08:23 ~4 min linux 📦zip
✔️ ff68921 #7 2024-11-08 12:08:48 ~4 min tests-rpc 📄log
✔️ ff68921 #7 2024-11-08 12:09:53 ~6 min android 📦aar
✔️ ff68921 #7 2024-11-08 12:11:01 ~7 min macos 📦zip
✔️ ff68921 #7 2024-11-08 12:12:05 ~8 min macos 📦zip
✔️ ff68921 #7 2024-11-08 12:13:21 ~9 min ios 📦zip
✖️ ff68921 #8 2024-11-08 12:37:59 ~34 min tests 📄log
✔️ 5786466 #8 2024-11-08 13:02:01 ~3 min windows 📦zip
✔️ 5786466 #8 2024-11-08 13:02:47 ~4 min tests-rpc 📄log
✔️ 5786466 #8 2024-11-08 13:03:26 ~5 min linux 📦zip
✔️ 5786466 #8 2024-11-08 13:03:34 ~5 min android 📦aar
✔️ 5786466 #8 2024-11-08 13:05:17 ~7 min macos 📦zip
✔️ 5786466 #8 2024-11-08 13:05:26 ~7 min macos 📦zip
✔️ 5786466 #8 2024-11-08 13:07:49 ~9 min ios 📦zip
✖️ 5786466 #9 2024-11-08 13:30:52 ~32 min tests 📄log
✖️ f19ea27 #9 2024-11-19 07:24:22 ~4 min tests-rpc 📄log
✔️ f19ea27 #9 2024-11-19 07:24:45 ~4 min macos 📦zip
✔️ f19ea27 #9 2024-11-19 07:25:14 ~5 min linux 📦zip
✔️ f19ea27 #9 2024-11-19 07:25:14 ~5 min ios 📦zip
✔️ f19ea27 #9 2024-11-19 07:25:34 ~5 min android 📦aar
✔️ f19ea27 #9 2024-11-19 07:25:39 ~5 min windows 📦zip
✔️ f19ea27 #9 2024-11-19 07:27:06 ~6 min macos 📦zip
✖️ f19ea27 #10 2024-11-19 07:53:23 ~33 min tests 📄log
✔️ 770c03e #10 2024-11-19 09:11:06 ~3 min windows 📦zip
✖️ 770c03e #10 2024-11-19 09:11:28 ~4 min tests-rpc 📄log
✔️ 770c03e #10 2024-11-19 09:11:55 ~4 min macos 📦zip
✔️ 770c03e #10 2024-11-19 09:12:49 ~5 min linux 📦zip
✔️ 770c03e #10 2024-11-19 09:12:57 ~5 min ios 📦zip
✔️ 770c03e #10 2024-11-19 09:13:08 ~6 min android 📦aar
✔️ 770c03e #10 2024-11-19 09:14:24 ~7 min macos 📦zip
✖️ 770c03e #11 2024-11-19 09:26:11 ~18 min tests 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
7d288a7 #11 2024-11-19 13:38:00 ~1 min ios 📄log
✖️ 7d288a7 #12 2024-11-19 13:38:27 ~2 min tests 📄log
7d288a7 #11 2024-11-19 13:38:37 ~2 min android 📄log
7d288a7 #11 2024-11-19 13:38:41 ~2 min macos 📄log
✖️ 7d288a7 #11 2024-11-19 13:38:51 ~2 min tests-rpc 📄log
7d288a7 #11 2024-11-19 13:39:02 ~2 min windows 📄log
7d288a7 #11 2024-11-19 13:39:15 ~2 min linux 📄log
7d288a7 #11 2024-11-19 13:41:00 ~4 min macos 📄log
✖️ 4e537e8 #13 2024-11-19 13:46:21 ~2 min tests 📄log
✔️ 4e537e8 #12 2024-11-19 13:47:35 ~3 min windows 📦zip
✔️ 4e537e8 #12 2024-11-19 13:47:59 ~4 min tests-rpc 📄log
✔️ 4e537e8 #12 2024-11-19 13:48:17 ~4 min macos 📦zip
✔️ 4e537e8 #12 2024-11-19 13:48:57 ~5 min ios 📦zip
✔️ 4e537e8 #12 2024-11-19 13:49:05 ~5 min linux 📦zip
✔️ 4e537e8 #12 2024-11-19 13:49:26 ~5 min android 📦aar
✔️ 4e537e8 #12 2024-11-19 13:50:46 ~7 min macos 📦zip

@saledjenic saledjenic changed the title Fix/tx signals enrich data fix(wallet)_: tx status changed signal with enrich data Nov 6, 2024
@saledjenic saledjenic changed the title fix(wallet)_: tx status changed signal with enrich data fix(wallet)_: enrich status changed and tx update signals' payload with tx route data Nov 6, 2024
@saledjenic saledjenic marked this pull request as ready for review November 6, 2024 10:29
import "github.com/status-im/status-go/errors"

var (
ErrInvalidSignatureDetails = &errors.ErrorResponse{Code: errors.ErrorCode("WT-004"), Details: "invalid signature details"}
Copy link
Contributor

@dlipicar dlipicar Nov 6, 2024

Choose a reason for hiding this comment

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

errors of a given type should all be in the same file IMO, hard to track down which error code I need to use for the next one otherwise. If this was causing a circular dependency we might need a separate errors package under the router dir or wherever this used to be

UsdcSymbol = "USDC"
HopSymbol = "HOP"

ProcessorTransferName = "Transfer"
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm these don't really sound like a "common" thing, it's a very pathprocessor-specific thing. I'd favour doing a new package like pathprocessortypes or something like that if it casuses circular dependency, otherwise the common package will just become a dump of every constant used in more than one place.

@dlipicar dlipicar requested a review from a team November 6, 2024 11:53
@saledjenic
Copy link
Contributor Author

@dlipicar I agree with both things you've stated above, but was very hard to fix all cyclic dependencies, cause there were many, without such changes.

We should think about and work more on sorting out the code organization for the wallet service.

@saledjenic
Copy link
Contributor Author

saledjenic commented Nov 6, 2024

Changes I've done were necessary to have what I need for ephemeral notifications, which is the last commit in this PR. If you can apply the last commit on top of your changes done here #5970 solving all cyclic dependencies with better code organization I am up for that.

We should have a separate PR where we will clean the wallet service and improve its architecture.

Also, because of many things that are potentially used by mobile app, we cannot fully clean them. I hope things will get better once the mobile app starts using a new sending flow and all txs (for ens usernames, collectibles, stickers, other txs) go over the router and new sending flow.

@dlipicar dlipicar force-pushed the feat/store-route-execution-data branch 3 times, most recently from 2b16ad1 to ddfcc79 Compare November 7, 2024 02:46
@saledjenic saledjenic force-pushed the fix/tx-signals-enrich-data branch 2 times, most recently from fc6637e to ff68921 Compare November 8, 2024 07:45
Base automatically changed from feat/store-route-execution-data to develop November 8, 2024 12:03
Copy link

codecov bot commented Nov 8, 2024

Codecov Report

Attention: Patch coverage is 40.14085% with 595 lines in your changes missing coverage. Please review.

Project coverage is 13.33%. Comparing base (f15c64c) to head (ff68921).
Report is 3 commits behind head on develop.

Files with missing lines Patch % Lines
services/ens/ensresolver/resolver.go 4.80% 198 Missing ⚠️
services/wallet/routeexecution/storage/route_db.go 68.00% 43 Missing and 37 partials ⚠️
...vices/wallet/transfer/transaction_manager_route.go 45.97% 40 Missing and 7 partials ⚠️
services/ens/api.go 8.51% 43 Missing ⚠️
services/wallet/common/helpers.go 6.45% 29 Missing ⚠️
transactions/pendingtxtracker_db.go 60.00% 18 Missing and 6 partials ⚠️
services/wallet/router/router_helper.go 37.50% 17 Missing and 3 partials ⚠️
transactions/transactor.go 23.52% 13 Missing ⚠️
services/wallet/routeexecution/manager.go 55.55% 8 Missing and 4 partials ⚠️
services/wallet/router/pathprocessor/errors.go 0.00% 10 Missing ⚠️
... and 31 more

❗ There is a different number of reports uploaded between BASE (f15c64c) and HEAD (ff68921). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (f15c64c) HEAD (ff68921)
unit 1 0
Additional details and impacted files
@@             Coverage Diff              @@
##           develop    #6050       +/-   ##
============================================
- Coverage    60.87%   13.33%   -47.55%     
============================================
  Files          811      800       -11     
  Lines       108894   107756     -1138     
============================================
- Hits         66293    14371    -51922     
- Misses       34843    91533    +56690     
+ Partials      7758     1852     -5906     
Flag Coverage Δ
functional 13.33% <40.14%> (+0.24%) ⬆️
unit ?

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

Files with missing lines Coverage Δ
mobile/response.go 0.00% <ø> (-86.67%) ⬇️
node/status_node_services.go 57.37% <100.00%> (-13.82%) ⬇️
protocol/communities/manager.go 3.66% <ø> (-61.79%) ⬇️
services/connector/commands/rpc_traits.go 0.00% <ø> (-80.00%) ⬇️
services/wallet/common/const.go 59.25% <100.00%> (-20.75%) ⬇️
...wallet/router/pathprocessor/multipath_processor.go 0.00% <ø> (ø)
services/wallet/router/router_test_data.go 0.00% <ø> (-100.00%) ⬇️
services/wallet/service.go 87.74% <100.00%> (-0.18%) ⬇️
services/wallet/wallettypes/route_db_types.go 100.00% <100.00%> (ø)
services/wallet/wallettypes/transaction_details.go 100.00% <100.00%> (ø)
... and 42 more

... and 608 files with indirect coverage changes

Hash eth.Hash `json:"hash"`
ChainID common.ChainID `json:"chainId"`
Hash eth.Hash `json:"hash"`
SendDetails *responses.SendDetails `json:"sendDetails"`
Copy link
Contributor

@dlipicar dlipicar Nov 11, 2024

Choose a reason for hiding this comment

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

Not good. TxIdentity is supposed to be a very generic super light struct used to uniquely identify a transaction (so, chainID and hash). And PendingTxTracker is supposed to be a generic and single-responsibility (though it's more complex than it should be) Tx status tracker. I'd rather keep it that way and not add a bunch of data to the type/dependencies to the tracker.
IMO, if the client needs more data, better add some API endpoint like "GetRouteDetailsForTxIdentity" and have the client fetch it. Otherwise, create some other event type with this chunky payload and emit it separately in a more appropriate place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no use case where TxIdentity was sent as a payload of a signal, but I agree, based on the type name it's too much for that type, that's why I added a new type. Also, wherever we want to update the client about the tx change, we need to provide the full context (not only txHash and chainId) so that the client knows what change occurred actually and what to do.

To avoid confusion, I moved SendDetails and SentTransactions to a new TxDetails type that both PendingTxUpdatePayload and StatusChangedPayload have now.

@dlipicar dlipicar requested a review from a team November 11, 2024 03:31
@saledjenic saledjenic force-pushed the fix/tx-signals-enrich-data branch 2 times, most recently from f19ea27 to 770c03e Compare November 19, 2024 09:06
New EnsResolver type identified and will be responsible for network calls,
while ens api will use it (until mobile app switches to a new sending flow) and
continue managing other (db) interactions.
- path processor constants moved to wallet constants
- FetchPrices and FindToken functions moved from send type package to router package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants