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

feat(network)_: implement deactivatable networks #6315

Merged
merged 7 commits into from
Feb 17, 2025

Conversation

dlipicar
Copy link
Contributor

@dlipicar dlipicar commented Jan 31, 2025

Part of status-im/status-desktop#17091

I swear deactivatable is a real word: https://en.wiktionary.org/wiki/deactivatable

There's basically three parts to this PR:

  1. Add parameters IsActive and IsDeactivatable to each network: f87f53e

IsActive lets the user select which chains are available for use across the app (as opposed to IsEnabled, which simply means whether a chain is considered when displaying balances, collectibles and activity). No provider calls should occur for networks that are not active at a given time (just like what's expected of Testnet chains when the app is in Mainnet mode and viceversa)
IsDeactivatable lets the client know whether a network can be deactivated. Some critical app features require specific networks to always be active (Mainnet and Sepolia).
New API SetChainActive lets the user toggle this setting. Some checks are in place to ensure only Deactivatable chains can be deactivated, and no more than 5 chains are active at a given time.

Since custom chains are not supported for now AddEthereumChain and DeleteEthereumChain are marked as deprecated. Half the app will malfunction if the client uses these endpoints to add new chains, and we've got dedicated endpoints for network user-editable fields.

  1. Implement network events: 05d0f37

This is just a pub-subby way for status-go modules to react to changes in the list of networks.

  1. Use networks events for automatic collectibles ownership refreshes: f3bfddb

Ideally we extend this to other modules which depend on the client to notify about network changes, which is more error-prone. (Separate issues status-im/status-desktop#17182 and status-im/status-desktop#17183)

The rest is just changes to make tests happy.

@status-im-auto
Copy link
Member

status-im-auto commented Feb 1, 2025

Jenkins Builds

Click to see older builds (131)
Commit #️⃣ Finished (UTC) Duration Platform Result
✖️ 3831b4a #1 2025-02-01 00:01:01 ~1 min tests 📄log
✔️ 3831b4a #1 2025-02-01 00:03:05 ~4 min macos 📦zip
✔️ 3831b4a #1 2025-02-01 00:03:24 ~4 min ios 📦zip
✔️ 3831b4a #1 2025-02-01 00:04:30 ~5 min linux 📦zip
✔️ 3831b4a #1 2025-02-01 00:04:45 ~5 min macos 📦zip
✔️ 3831b4a #1 2025-02-01 00:04:54 ~5 min windows 📦zip
✔️ 3831b4a #1 2025-02-01 00:05:11 ~6 min android 📦aar
✔️ 3831b4a #1 2025-02-01 00:06:19 ~7 min tests-rpc 📄log
✔️ 3831b4a #2 2025-02-03 18:31:50 ~6 min tests-rpc 📄log
✖️ be87d05 #2 2025-02-03 18:28:31 ~1 min tests 📄log
✔️ be87d05 #2 2025-02-03 18:30:50 ~4 min windows 📦zip
✔️ be87d05 #2 2025-02-03 18:30:51 ~4 min macos 📦zip
✔️ be87d05 #2 2025-02-03 18:30:59 ~4 min ios 📦zip
✔️ be87d05 #2 2025-02-03 18:32:06 ~5 min linux 📦zip
✔️ be87d05 #2 2025-02-03 18:32:19 ~5 min macos 📦zip
✔️ be87d05 #2 2025-02-03 18:32:45 ~6 min android 📦aar
✔️ be87d05 #3 2025-02-03 18:36:48 ~4 min tests-rpc 📄log
✔️ 2f4a1d5 #3 2025-02-03 20:47:10 ~3 min macos 📦zip
✖️ 2f4a1d5 #3 2025-02-03 20:47:12 ~3 min tests 📄log
✔️ 2f4a1d5 #3 2025-02-03 20:47:14 ~3 min windows 📦zip
✔️ 2f4a1d5 #3 2025-02-03 20:47:20 ~3 min ios 📦zip
✔️ 2f4a1d5 #4 2025-02-03 20:47:52 ~4 min tests-rpc 📄log
✔️ 2f4a1d5 #3 2025-02-03 20:48:42 ~5 min linux 📦zip
✔️ 2f4a1d5 #3 2025-02-03 20:49:10 ~5 min macos 📦zip
✔️ 2f4a1d5 #3 2025-02-03 20:49:22 ~6 min android 📦aar
✖️ 2f4a1d5 #4 2025-02-03 20:49:31 ~2 min tests 📄log
✔️ 2f4a1d5 #4 2025-02-03 20:51:06 ~3 min windows 📦zip
✔️ 2f4a1d5 #4 2025-02-03 20:51:11 ~3 min macos 📦zip
✖️ 2f4a1d5 #5 2025-02-03 20:51:16 ~3 min tests-rpc 📄log
✔️ 2f4a1d5 #4 2025-02-03 20:51:43 ~4 min ios 📦zip
✔️ 2f4a1d5 #4 2025-02-03 20:54:04 ~5 min linux 📦zip
✔️ 2f4a1d5 #4 2025-02-03 20:54:47 ~5 min macos 📦zip
✔️ 2f4a1d5 #4 2025-02-03 20:55:37 ~6 min android 📦aar
✔️ 0494fff #5 2025-02-04 13:41:51 ~3 min macos 📦zip
✔️ 0494fff #5 2025-02-04 13:41:52 ~3 min windows 📦zip
✔️ 0494fff #5 2025-02-04 13:42:30 ~4 min ios 📦zip
✖️ 0494fff #6 2025-02-04 13:42:47 ~4 min tests-rpc 📄log
✔️ 0494fff #5 2025-02-04 13:42:59 ~5 min linux 📦zip
✔️ 0494fff #5 2025-02-04 13:43:14 ~5 min android 📦aar
✔️ 0494fff #5 2025-02-04 13:43:27 ~5 min macos 📦zip
✖️ 0494fff #5 2025-02-04 14:07:22 ~29 min tests 📄log
✔️ 0494fff #7 2025-02-04 14:10:48 ~4 min tests-rpc 📄log
✔️ 72be83f #6 2025-02-04 14:48:40 ~3 min ios 📦zip
✖️ 72be83f #6 2025-02-04 14:48:58 ~4 min tests 📄log
✔️ 72be83f #6 2025-02-04 14:49:35 ~4 min macos 📦zip
✔️ 72be83f #6 2025-02-04 14:49:53 ~5 min linux 📦zip
✔️ 72be83f #8 2025-02-04 14:50:11 ~5 min tests-rpc 📄log
✔️ 72be83f #6 2025-02-04 14:50:23 ~5 min windows 📦zip
✔️ 72be83f #6 2025-02-04 14:50:33 ~5 min macos 📦zip
✔️ 72be83f #6 2025-02-04 14:50:51 ~6 min android 📦aar
✔️ ae1544a #7 2025-02-04 15:24:46 ~3 min macos 📦zip
✔️ ae1544a #7 2025-02-04 15:24:49 ~3 min windows 📦zip
✔️ ae1544a #7 2025-02-04 15:26:05 ~5 min linux 📦zip
✔️ ae1544a #7 2025-02-04 15:26:08 ~5 min ios 📦zip
✔️ ae1544a #9 2025-02-04 15:26:14 ~5 min tests-rpc 📄log
✔️ ae1544a #7 2025-02-04 15:26:24 ~5 min macos 📦zip
✔️ ae1544a #7 2025-02-04 15:26:47 ~6 min android 📦aar
✖️ ae1544a #7 2025-02-04 15:52:11 ~31 min tests 📄log
✔️ 2ee1371 #8 2025-02-04 17:52:28 ~3 min macos 📦zip
✔️ 2ee1371 #8 2025-02-04 17:52:32 ~4 min ios 📦zip
✔️ 2ee1371 #8 2025-02-04 17:52:33 ~3 min windows 📦zip
✔️ 2ee1371 #8 2025-02-04 17:53:46 ~5 min linux 📦zip
✔️ 2ee1371 #8 2025-02-04 17:53:55 ~5 min android 📦aar
✔️ 2ee1371 #10 2025-02-04 17:53:56 ~5 min tests-rpc 📄log
✔️ 2ee1371 #8 2025-02-04 17:54:12 ~5 min macos 📦zip
✔️ 2ee1371 #8 2025-02-04 18:17:54 ~29 min tests 📄log
✔️ e68cd86 #9 2025-02-04 18:38:26 ~3 min windows 📦zip
✔️ e68cd86 #9 2025-02-04 18:38:36 ~3 min macos 📦zip
✔️ e68cd86 #9 2025-02-04 18:38:55 ~4 min ios 📦zip
✔️ e68cd86 #9 2025-02-04 18:39:44 ~5 min linux 📦zip
✔️ e68cd86 #11 2025-02-04 18:39:47 ~5 min tests-rpc 📄log
✔️ e68cd86 #9 2025-02-04 18:40:42 ~6 min macos 📦zip
✔️ e68cd86 #9 2025-02-04 18:40:42 ~6 min android 📦aar
✔️ e68cd86 #9 2025-02-04 19:04:12 ~29 min tests 📄log
✔️ e68cd86 #10 2025-02-04 19:15:14 ~3 min macos 📦zip
✔️ e68cd86 #10 2025-02-04 19:15:21 ~3 min windows 📦zip
✔️ e68cd86 #10 2025-02-04 19:15:22 ~4 min ios 📦zip
✖️ e68cd86 #12 2025-02-04 19:16:11 ~4 min tests-rpc 📄log
✔️ e68cd86 #10 2025-02-04 19:16:20 ~5 min linux 📦zip
✔️ e68cd86 #10 2025-02-04 19:16:56 ~5 min macos 📦zip
✔️ e68cd86 #10 2025-02-04 19:17:46 ~6 min android 📦aar
✔️ e68cd86 #10 2025-02-04 19:40:13 ~28 min tests 📄log
✔️ 668fc27 #11 2025-02-04 19:19:30 ~4 min windows 📦zip
✔️ 668fc27 #11 2025-02-04 19:19:46 ~4 min macos 📦zip
✔️ 668fc27 #11 2025-02-04 19:20:06 ~4 min ios 📦zip
✔️ 668fc27 #13 2025-02-04 19:21:12 ~4 min tests-rpc 📄log
✔️ 668fc27 #11 2025-02-04 19:21:31 ~5 min linux 📦zip
✔️ 668fc27 #11 2025-02-04 19:22:33 ~5 min macos 📦zip
✔️ 668fc27 #11 2025-02-04 19:23:59 ~6 min android 📦aar
✔️ 668fc27 #11 2025-02-04 20:09:54 ~29 min tests 📄log
✔️ d6a67cb #12 2025-02-10 14:31:01 ~3 min macos 📦zip
✔️ d6a67cb #14 2025-02-10 14:32:14 ~5 min tests-rpc 📄log
✔️ d6a67cb #12 2025-02-10 14:32:21 ~5 min windows 📦zip
✔️ d6a67cb #12 2025-02-10 14:32:44 ~5 min linux 📦zip
✔️ d6a67cb #12 2025-02-10 14:33:09 ~6 min android 📦aar
✔️ d6a67cb #12 2025-02-10 14:33:33 ~6 min macos 📦zip
✔️ d6a67cb #12 2025-02-10 14:59:16 ~32 min tests 📄log
✔️ d6a67cb #12 2025-02-10 18:47:35 ~4 hr 20 min ios 📦zip
✔️ 86fa895 #13 2025-02-12 21:16:38 ~3 min macos 📦zip
✔️ 86fa895 #13 2025-02-12 21:16:39 ~4 min ios 📦zip
✔️ 86fa895 #13 2025-02-12 21:17:27 ~4 min windows 📦zip
✔️ 86fa895 #13 2025-02-12 21:18:02 ~5 min linux 📦zip
✔️ 86fa895 #13 2025-02-12 21:18:36 ~5 min macos 📦zip
✔️ 86fa895 #13 2025-02-12 21:18:46 ~6 min android 📦aar
✔️ 86fa895 #15 2025-02-12 21:24:03 ~11 min tests-rpc 📄log
✔️ 86fa895 #13 2025-02-12 21:43:14 ~30 min tests 📄log
✔️ 21ad7f5 #14 2025-02-13 14:47:42 ~4 min macos 📦zip
✔️ 21ad7f5 #14 2025-02-13 14:47:49 ~4 min ios 📦zip
✔️ 21ad7f5 #14 2025-02-13 14:49:01 ~5 min linux 📦zip
✔️ 21ad7f5 #14 2025-02-13 14:49:10 ~5 min windows 📦zip
✔️ 21ad7f5 #14 2025-02-13 14:49:27 ~5 min macos 📦zip
✔️ 21ad7f5 #14 2025-02-13 14:51:08 ~7 min android 📦aar
✔️ 21ad7f5 #16 2025-02-13 14:55:25 ~11 min tests-rpc 📄log
✔️ 21ad7f5 #14 2025-02-13 15:17:02 ~33 min tests 📄log
✖️ 8003c9c #17 2025-02-13 22:52:27 ~3 min tests-rpc 📄log
✔️ 8003c9c #15 2025-02-13 22:52:39 ~3 min macos 📦zip
✔️ 8003c9c #15 2025-02-13 22:52:59 ~4 min windows 📦zip
✔️ 8003c9c #15 2025-02-13 22:53:06 ~4 min ios 📦zip
✔️ 8003c9c #15 2025-02-13 22:53:45 ~5 min linux 📦zip
✔️ 8003c9c #15 2025-02-13 22:54:32 ~5 min macos 📦zip
✔️ 8003c9c #15 2025-02-13 22:54:43 ~6 min android 📦aar
✔️ 8003c9c #15 2025-02-13 23:18:53 ~30 min tests 📄log
✖️ 8003c9c #18 2025-02-14 12:22:32 ~3 min tests-rpc 📄log
✔️ f799561 #16 2025-02-17 12:50:22 ~3 min ios 📦zip
✔️ f799561 #16 2025-02-17 12:50:41 ~4 min windows 📦zip
✔️ f799561 #16 2025-02-17 12:50:49 ~4 min macos 📦zip
✔️ f799561 #16 2025-02-17 12:52:24 ~5 min macos 📦zip
✔️ f799561 #16 2025-02-17 12:58:38 ~12 min android 📦aar
✔️ f799561 #16 2025-02-17 13:00:24 ~13 min linux 📦zip
✔️ f799561 #19 2025-02-17 13:07:35 ~21 min tests-rpc 📄log
✔️ f799561 #16 2025-02-17 13:27:48 ~41 min tests 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
8e57987 #17 2025-02-17 16:07:48 ~32 sec windows 📄log
8e57987 #17 2025-02-17 16:09:14 ~2 min ios 📄log
8e57987 #17 2025-02-17 16:12:12 ~5 min macos 📄log
8e57987 #17 2025-02-17 16:13:17 ~6 min android 📄log
8e57987 #17 2025-02-17 16:14:53 ~7 min macos 📄log
8e57987 #17 2025-02-17 16:15:55 ~8 min linux 📄log
✖️ 8e57987 #20 2025-02-17 16:18:10 ~10 min tests-rpc 📄log
✖️ 8e57987 #17 2025-02-17 16:19:29 ~12 min tests 📄log
✔️ fbb4d4e #18 2025-02-17 16:23:32 ~2 min ios 📦zip
✔️ fbb4d4e #18 2025-02-17 16:26:12 ~5 min windows 📦zip
✔️ fbb4d4e #18 2025-02-17 16:26:37 ~5 min android 📦aar
✔️ fbb4d4e #18 2025-02-17 16:27:42 ~6 min macos 📦zip
✔️ fbb4d4e #18 2025-02-17 16:28:16 ~7 min macos 📦zip
✔️ fbb4d4e #18 2025-02-17 16:29:57 ~9 min linux 📦zip
✖️ fbb4d4e #21 2025-02-17 16:36:48 ~15 min tests-rpc 📄log
✔️ fbb4d4e #18 2025-02-17 16:59:39 ~38 min tests 📄log
✔️ fbb4d4e #22 2025-02-17 17:33:35 ~10 min tests-rpc 📄log

@dlipicar dlipicar changed the title Feat/implement deactiveable networks feat(network)_: implement deactivatable networks Feb 3, 2025
@dlipicar dlipicar force-pushed the feat/implement-deactiveable-networks branch 2 times, most recently from be87d05 to 2f4a1d5 Compare February 3, 2025 20:43
@dlipicar dlipicar changed the base branch from develop to fix/migration-check-script February 3, 2025 20:43
Copy link

codecov bot commented Feb 3, 2025

Codecov Report

Attention: Patch coverage is 78.57143% with 51 lines in your changes missing coverage. Please review.

Project coverage is 59.67%. Comparing base (115fe9f) to head (fbb4d4e).
Report is 7 commits behind head on develop.

Files with missing lines Patch % Lines
rpc/network/network.go 72.30% 14 Missing and 4 partials ⚠️
rpc/network/networksevent/watcher.go 62.85% 12 Missing and 1 partial ⚠️
services/wallet/api.go 0.00% 9 Missing ⚠️
services/wallet/collectibles/controller.go 68.42% 4 Missing and 2 partials ⚠️
rpc/network/db/network_db.go 82.60% 2 Missing and 2 partials ⚠️
api/defaults.go 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #6315      +/-   ##
===========================================
+ Coverage    59.64%   59.67%   +0.02%     
===========================================
  Files          864      865       +1     
  Lines       112866   112981     +115     
===========================================
+ Hits         67324    67417      +93     
- Misses       37717    37743      +26     
+ Partials      7825     7821       -4     
Flag Coverage Δ
functional 0.45% <0.00%> (-0.01%) ⬇️
unit 59.66% <78.57%> (+0.02%) ⬆️

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

Files with missing lines Coverage Δ
api/default_networks.go 99.24% <100.00%> (+0.04%) ⬆️
node/get_status_node.go 50.29% <100.00%> (+0.44%) ⬆️
node/status_node_services.go 71.12% <100.00%> (-0.07%) ⬇️
params/network_config.go 100.00% <ø> (ø)
rpc/client.go 65.29% <100.00%> (+0.81%) ⬆️
rpc/network/testutil/testutil.go 100.00% <100.00%> (ø)
services/connector/commands/test_helpers.go 100.00% <100.00%> (ø)
services/connector/test_helpers.go 100.00% <100.00%> (ø)
services/wallet/collectibles/service.go 14.51% <100.00%> (ø)
services/wallet/service.go 88.68% <100.00%> (ø)
... and 6 more

... and 33 files with indirect coverage changes

@dlipicar dlipicar force-pushed the fix/migration-check-script branch from 7c849a8 to d7d7aa8 Compare February 4, 2025 13:45
@dlipicar dlipicar force-pushed the feat/implement-deactiveable-networks branch 2 times, most recently from ae1544a to 2ee1371 Compare February 4, 2025 17:48
@dlipicar dlipicar requested review from a team, friofry and briansztamfater February 4, 2025 18:33
@dlipicar dlipicar force-pushed the feat/implement-deactiveable-networks branch from 2ee1371 to e68cd86 Compare February 4, 2025 18:34
@dlipicar dlipicar requested review from alaibe and saledjenic February 4, 2025 18:34
@dlipicar dlipicar marked this pull request as ready for review February 4, 2025 18:37
Base automatically changed from fix/migration-check-script to develop February 4, 2025 19:11
@dlipicar dlipicar requested a review from a team as a code owner February 4, 2025 19:11
@dlipicar dlipicar force-pushed the feat/implement-deactiveable-networks branch 2 times, most recently from 668fc27 to d6a67cb Compare February 10, 2025 14:26
Copy link
Contributor

@friofry friofry left a comment

Choose a reason for hiding this comment

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

Great job!

@dlipicar dlipicar force-pushed the feat/implement-deactiveable-networks branch from d6a67cb to 86fa895 Compare February 12, 2025 21:12
Copy link
Member

@briansztamfater briansztamfater left a comment

Choose a reason for hiding this comment

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

Amazing work @dlipicar!

@briansztamfater
Copy link
Member

status-mobile PR: status-im/status-mobile#22117

@dlipicar dlipicar force-pushed the feat/implement-deactiveable-networks branch from 8003c9c to f799561 Compare February 17, 2025 12:46
@dlipicar dlipicar requested a review from friofry February 17, 2025 15:18
@dlipicar dlipicar force-pushed the feat/implement-deactiveable-networks branch from f799561 to 8e57987 Compare February 17, 2025 16:06
@dlipicar dlipicar merged commit b2cd7bd into develop Feb 17, 2025
18 of 19 checks passed
@dlipicar dlipicar deleted the feat/implement-deactiveable-networks branch February 17, 2025 17:38
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.

6 participants