34 Commits
Author SHA1 Message Date
Igor Sirotin d1e9ae5225 refactor: extract a networks service (#7748)
The network manager lived in internal/rpc and was constructed, started
and stopped by rpc.Client, which reached back into it to route calls by
chain. It is now a service of its own at pkg/services/networks.

StatusNode owns the manager and hands it to rpc.Client through
ClientConfig, so the client depends on ManagerInterface rather than the
concrete type. The service owns the manager lifecycle.

The four live network RPC methods are registered under the networks_
namespace. The wallet_ ones are left in place so nothing breaks before
the app migrates; they are removed at the end of the stack.
2026-08-26 18:05:03 +01:00
Igor Sirotin fa25c4fc01 refactor: rename walletdatabase to walletdb and split it
Part of the Go project layout migration, item 4.

internal/db/walletdatabase -> internal/db/walletdb, and its one 45-line
file splits along the two jobs it was doing:

  open.go     DbInitializer, InitializeDB, OpenDB
  migrate.go  walletCustomSteps, doMigration, MigrateDB

scripts/migration_check.sh listed this migration directory as
"walletdatabase/migrations/sql" and appdatabase's as
"appdatabase/migrations/sql". Neither path has existed since those
packages moved under internal/db/, so the check has been silently
skipping both. Both are corrected here.

refs #7067
2026-08-21 16:46:09 +01:00
Andrey Bocharnikov ee9336a8ca feat: collect a privacy-safe account load profile on demand
Reproducing a reporter's performance problem currently means guessing the
shape of their account: how many messages they hold, how those spread over
chats, how far behind their sync state is. Guessing that cost days on
status-im/status-app#21605.

Add a storagestats service that answers those questions with numbers a
reporter can paste into a public ticket. `storagestats_collect` starts a
background walk and returns immediately; progress arrives as
storage-stats.progress ("N of M", with M known upfront because the table
list is enumerated first) and the finished profile as storage-stats.result.
Nothing is collected unless a caller asks.

The walk is serial on purpose: COUNT(*) on a sqlcipher table is a full
decrypting scan, so running several at once would only starve the process it
is meant to describe. It must never be driven from a client's UI thread.

Privacy is enforced by construction: time appears only as relative day
counts, no per-entity row is ever read (the per-chat histogram query selects
counts and nothing else), and the only strings in the artifact are table
names from our own schema.

Section one carries curated metrics whose names mirror the seeder harness
knobs so a profile maps onto a harness run; section two is a schema-agnostic
table -> {rows, bytes} dump of both databases, insurance against the next
surprise living in a table nobody predicted. A step that fails names itself
in `incomplete` rather than leaving a zero that reads as "this account has
none".
2026-08-21 14:50:20 +04:00
Igor Sirotin f9cc782a6f refactor: move services to pkg/services
Part of the Go project layout migration, item 31.

Pure move plus import-path rewrite across 687 files. No API or behaviour
change.

The services keep their grouping under pkg/services/<name> rather than
being promoted to pkg/<name>: 27 top-level directories in pkg/ would read
worse than what we have, and the grouping is what makes "an RPC service"
identifiable at a glance.

Paths that follow the move: the logosstorage test target and generate
step, the two wallet token-list tools, the migration-order check (and the
pre-rebase hook symlinked to it), and the storage env helper.

refs #7067
2026-08-21 10:11:05 +02:00
Igor Sirotin f3e4363808 refactor: move protocol to internal/protocol
Part of the Go project layout migration, item 27.

Pure move plus import-path rewrite across 502 files. No API or behaviour
change. `internal/` keeps the messaging application logic unimportable
from outside the module, which is what the issue asks for -- status-go is
consumed through the C-bindings in mobile/, not as a Go library.

Things that had to follow the move, beyond the Go imports:

- tools/generate-handlers/template.txt. messenger_handlers.go is
  generated, and the template hard-codes the imports it emits, so the
  generated file kept importing protocol/common and failed typecheck.
- .gitignore. The ignore rule for that generated file was pinned to the
  old path; without moving it, a 1486-line generated file starts being
  tracked.
- Makefile: the logosstorage and torrent test targets (both the archive
  packages and ./protocol itself), the archive README, migration-protocol.
- scripts/run_unit_tests.sh, which names the protocol package explicitly
  to shard its tests.
- scripts/cleanup_generated_files.sh and .golangci.yml.

scripts/migration_check.sh also needed a fix that is not specific to this
move: it validated every file the branch touched under a migration dir
against the timestamp naming rule, and a directory rename makes every
migration in it look newly added. It now excludes renames, so moving a
migration is not mistaken for adding one.

refs #7067
2026-08-21 10:11:05 +02:00
Igor Sirotin 5029be4631 refactor: dissolve the root server package
`server` was one Go package doing three unrelated jobs. Each moves to
where it belongs:

  server/pairing/         -> services/pairing/
  server_media*.go,
  handlers*.go, testdata/ -> services/media/
  server.go, certs.go,
  ips.go, timeout.go,
  device.go, listen_*.go,
  servertest/             -> internal/httpserver/

MediaServer is renamed to media.Server (and NewMediaServer to
media.NewServer) now that it has a package to be named against.
Deliberately untouched: StatusNode.MediaServer(), which is an accessor
method rather than the type, and the unrelated identifiers that only
share the prefix (MediaServerImageID, MediaServerContactIcon,
MediaServerEnableTLS, ...).

Two identifiers had to be reassigned to make the boundary clean:

- certs.go held both the generic X509/TLS helpers and the media server's
  process-global certificate. Split: the generic half stays in
  internal/httpserver, generateMediaTLSCert and PublicMediaTLSCert move
  to services/media.
- HandlerPatternMap was declared in handlers.go but is a plain HTTP type
  that server.go depends on; it moves to internal/httpserver.

The media server URL tests moved with the type, and reached three
unexported Server fields they could touch while everything shared a
package. internal/httpserver now exposes ListeningAddr() and CachedPort()
(both reasonable API) plus a clearly-marked SetURLStateForTest.

Nothing else crossed the boundary, and the split is one-directional:
services/media and services/pairing import internal/httpserver, never the
reverse.

refs #7067
2026-08-20 20:59:45 +02:00
Igor Sirotin 23febf1645 refactor: dissolve the root common package
`common` was a grab-bag with no domain: the issue's own preamble names
it as the kind of package that must not exist. Every symbol moves to the
package that owns it, and the directory is deleted.

  common/dbsetup            -> internal/db/dbsetup
  common/devices.go         -> internal/platform
  common/pausable*.go       -> internal/pausable
  LogOnPanic                -> internal/panics
  TruncateWithDot(N)        -> internal/logutils
  RecoverKey, ValidateDisplayName, display-name errors -> protocol/common
  IpfsGatewayURL            -> internal/ipfs.GatewayURL
  Archives/TorrentTorrentsRelativePath, MainnetEthereumNetworkURL -> params
  StatusService             -> pkg/backend/node
  ErrBigIntSetFromString    -> services/wallet
  IsNil, Ptr                -> inlined at their call sites
  IsENSName                 -> deleted, it had no callers

Notes:
- LogOnPanic gets its own package rather than living in logutils. It
  reports to Sentry, and logutils is imported by nearly everything: put
  the guard in logutils and the Sentry SDK lands in every dependency
  graph in the tree (213 -> 250 packages). internal/panics imports
  logutils and sentry, which is the direction root `common` had.
- TruncateWithDot is log redaction, not string formatting: every one of
  its 121 call sites is inside a log or error message, so it belongs
  next to the logger.
- Moving RecoverKey and ValidateDisplayName into protocol/common removes
  the common -> protocol layering inversion; all their callers were
  already inside protocol/.
- Makefile lint-panics target follows LogOnPanic to its new path.

refs #7067
2026-08-20 20:59:45 +02:00
Igor Sirotin ab5daa4683 chore: remove unnecessary numeric import aliases (#7711)
* chore: drop redundant numeric import aliases

Refactoring left behind import aliases like `datasync2`/`types3` that
just repeat the package name. Remove them where the plain package name is
unambiguous in the file, and drop three duplicate imports of the same path.

* chore: name colliding type imports after repo convention

Where two packages named `types` (or `rpc`) meet in one file an alias is
unavoidable, so use the descriptive names already dominant in the tree
(cryptotypes, messagingtypes, wakutypes, accsmanagementtypes, wsdktypes,
noderpc) instead of types2/types3/rpc2, and spell the messaging/waku
import wakuv2 everywhere (was wakuv/wakuv2/wakuv3).

* chore: rename package wakuv2 to waku

The package in pkg/messaging/waku still declared itself `wakuv2`, which
forced every import site to carry an alias (goimports re-adds one when the
package name differs from its directory). Rename the package so the import
can stand as-is, and rename the local `waku` variable in transport_test.go
to `wakuNode` to free up the name.

* chore: unalias protocol/contacts import in protocol tests and backup

`contacts2` was only needed because local variables took the package name.
Rename those to what they hold — syncContacts for the sync messages built in
backupContacts, addedContacts/allContacts in the contact request and
verification tests — and import the package as-is.
2026-08-17 14:04:09 +01:00
osmaczkoandIgor Sirotin 67f8720f54 refactor: remove deadcode (#7279)
Remove code reported by golang.org/x/tools/cmd/deadcode.

Co-authored-by: Igor Sirotin <igor@logos.co>
2026-08-14 09:36:13 +01:00
Jonathan Rainville 2d8d585fae chore: code review updates 2026-08-04 11:28:33 -04:00
Jonathan Rainville 8d01427a4a perf(login): speed up login
Part of https://github.com/status-im/status-app/issues/21462

- Open existing app and wallet SQLCipher databases concurrently, while preserving sequential initialization for new or legacy databases.
- Speed up account selection by preloading the profile keypair and decrypting only the chat private key instead of the full extended key.
- Defer token manager startup until after login completes and run it asynchronously outside the critical startup path.
- Load cached leaderboard market data asynchronously, waiting only when the data is accessed or the service stops.

Before: about 2.15 s for the backend login request
After: about 0.47–0.50 s
Improvement: roughly 1.65–1.70 s saved
Relative reduction: about 77–78%
Speed multiplier: approximately 4.3–4.5× faster
2026-08-04 11:28:33 -04:00
Andrey Bocharnikov 3972108504 fix: copilot comments 2026-07-07 22:27:48 +04:00
Andrey Bocharnikov 3385d9cdd0 fix: apply media server port from repeated InitializeApplication
When InitializeApplication is called again after logout, OpenAccounts
returns early and the media server kept a random port. Restart the
media server when SetMediaServerOptions runs on an existing listener,
and stop it on logout so the configured port can be rebound.
2026-07-07 22:27:48 +04:00
Andrey Bocharnikov 0f8ac5b12d chore: remove CryptoCompare market provider
Drop CryptoCompare provider wiring and its tests, and remove market proxy credentials that were only used by the CryptoCompare proxy path.
2026-06-09 18:52:46 +02:00
Jonathan Rainville e9dcef2612 chore: remove go-waku changes and address review comment 2026-06-09 18:52:46 +02:00
AlisherandClaude Sonnet 4.6 0e10213e8f fix(messenger): defer mailserver history sync when app is in background
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 18:52:46 +02:00
6b3f8258a6 chore: cherry-picked commits from 'release/10.34.x' into develop (#7479)
* fix(waku): Avoid peer reconnection storm (#7447)

* fix(waku): Avoid peer reconnection storm

This commit is fixing 2 issues in waku:
1. Unnecesary disconnect/reconnects
2. dns failure at startup will silently give up - no retries

- filter connection changes and forward the signal only when a change happened
- dnsDiscovery: retry on failure with exponential backoff

* chore: bump logos-delivery

Include https://github.com/logos-messaging/logos-delivery-go/pull/1302

* chore: add usds to mandatory tokens (#7455)

* feat(preferences): add secure storage for app settings (#7460)

* Should replace QSettings that are stored in files

refs status-im/status-app#20922

---------

Co-authored-by: Alex Jbanca <47811206+alexjba@users.noreply.github.com>
Co-authored-by: Andrey Bocharnikov <andrey.bocharnikov@gmail.com>
2026-05-26 14:18:15 +02:00
8082fea1d4 chore: merge branch 'release/10.34.x' into develop (#7453)
* chore: remove Polygon zkEVM chain (#7429)

* chore: remove status l2 sepolia (#7431)

* fix(wallet-connect): advertise wallet_switchEthereumChain (#7432)

Fixes #20697

* fix(connector): EIP-5792 methods + trusted-only eth_accounts auto-share on requestPermissions (#7428)

fix(connector): partial permissions revocation
fix(connector): parallel dapp requests races

fixes status-im/status-app#20591

* feat(connector): ephemeral dApp records (#7435)

* feat(connector): ephemeral dapp records

refs status-im/status-app#20676

* fix: copilot comments

* chore: more descriptive logging added to router package

* feat: implemented log file rotation for new sessions

Added functionality to rotate log files when a new session starts, while the logs from previous sessions
are also kept.

* fix: puzzle-auth providers should not depend on the presence/absence of basic-auth credentials (#7437)

* fix: puzzle-auth providers should not depend on the presence/absence of basic-auth credentials

If the same network has puzzle-auth and basic-auth providers an incorrect enable flag might be used
if there is no ethrpc/status proxy credentials set.

* chore: sync balance/activity fetching (#7438)

* chore: trigger activity fetch when balance updated

* chore: trigger balance update when activity fetched

* fix(wc): reconnect broken pipe

fixes status-app/status-im#20767

* fix(wc): recreate ws connection on start

* fixes broken wc after restoring from the background

fixes status-app/status-im#20767

* fix: copilot comments

* fix: shrink tests

* fix: use WCClientGetter

* wcclient is recreated when service is paused

* fix: readability

* fix: pr comments

* fix: flaky test

* fix: push notification migration

If the latest migration ran is not present then remove it

* perf: Enrich community members and contacts with visual identity (#7430)

For each community member and contact Status needs to wire another 4 RPCs to fully resolve the members and contacts. This commit adds the necessary info in the community members and contacts response directly.

Needed for: https://github.com/status-im/status-app/issues/20228

* fix(collectibles): disable ink, katana

fixes status-im/status-app#20717

* fix(collectibles): pr comments

* feat(wallet): skip TANGYUAN and POSI tokens on BSCMainnet

Added token keys for TANGYUAN and POSI to the SkippedTokenKeys list.

Closes #20860

* perf: Interrupt stats ticker and throttle mvds on messenger.pause

The messenger needs to keep only critical infrastructure while paused.
This commit stops the stats retrieval while paused - not used. And throttles the mvds datasync to 5 minutes. This means that the ack is confirmed once every 5 minutes (as opposed to 300ms) while paused.
Message sending is also disabled in this time frame.

---------

Co-authored-by: Anthony Laibe <491074+alaibe@users.noreply.github.com>
Co-authored-by: Andrey Bocharnikov <andrey.bocharnikov@gmail.com>
Co-authored-by: Alex Jbanca <47811206+alexjba@users.noreply.github.com>
Co-authored-by: Alex Jbanca <alexjb@status.im>
2026-05-20 09:54:59 +02:00
Igor Sirotin 24d0132145 chore: fix numbered import names (#7416) 2026-04-16 13:22:54 +01:00
Alex Jbanca 0e8f138c6c feat: wire up ServiceRegistry, expose pause API, remove AppStateChange (#7394)
- Wire ServiceRegistry into StatusNode: populateServiceRegistry() registers
  all Pausable services after startup; Pause()/Resume() delegate to registry.
- Add PausableServices/PauseService/ResumeService/PauseServices/ResumeServices
  to StatusBackend and mobile bindings — clients can now control individual
  services by name.
- Remove AppStateChange/AppStateChangeV2 API entirely — clients call
  PauseServices/ResumeServices directly, keeping app-state logic client-side.
2026-04-09 13:03:36 +03:00
Alex Jbanca bc58856435 feat: add Pausable interface, PausableTicker, and ServiceRegistry (#7387)
* feat: add Pausable interface, PausableTicker, and ServiceRegistry

Introduce the core primitives for lifecycle-aware service control:

- common/pausable.go: Pausable interface (PausableName/Pause/Resume),
  PauseBroadcaster embed (MarkPaused/MarkResumed/IsPaused/Subscribe),
  Subscription interface for goroutine loops.
- common/pausable_ticker.go: PausableTicker — wraps time.Ticker with a
  nil-channel pause trick so loops block cheaply without extra goroutines.
- pkg/backend/node/service_registry.go: ServiceRegistry — central registry
  of Pausable services with Register/Pause/Resume/PauseAll/ResumeAll/List.

* fix: Various fixes for the pausable service, pausable ticker and service registry
2026-04-08 14:00:12 +03:00
saledjenic eba639978d feat: add support for several new chains (#7288)
- Introduced the following mainnet chains with their testnets:
  - Polygon ZkEVM,
  - Unichain,
  - Katana,
  - Ink,
  - Abstract,
  - ZkSync Era,
  - Soneium,
  - Scroll,
  - Blast

Updated the code to accommodate the new chains.
2026-03-26 08:29:40 +01:00
Jonathan Rainville 87e5b834cb chore(connection): bring back connectionChange code (#7350)
Part of https://github.com/status-im/status-app/issues/18388
2026-03-20 10:41:49 -04:00
Andrey Bocharnikov 05ca3e0e57 fix(wc): remove old walletconnect files (#7366)
* fix(wc): remove old walletconnect

* fix(connector): use config.wsenable flag to disable websocket on mobile
2026-03-13 21:01:25 +04:00
Andrey BocharnikovandJonathan Rainville 451464d227 feat: wallet connect API (#7328)
* feat(walletconnect): WC v2 protocol implementation

* feat(walletconnect): integrate WC client into connector service

* refactor(walletconnect): remove legacy WC database layer and API

Fixes #19740

---------

Co-authored-by: Jonathan Rainville <rainville.jonathan@gmail.com>
2026-02-16 13:01:11 -05:00
saledjenic bae83b3505 chore: update go-wallet-sdk dependency and improve on token manager initialisation (#7291)
- Updated go-wallet-sdk version in go.mod and go.sum.
- Improved on token manager initialization to use enabled chains from the network manager.
- Added functionality to watch for changes in active networks and update token manager accordingly.
2026-01-29 10:17:13 +01:00
Igor Sirotin c0dfb3911e fix: reliable messenger cleanup in tests (#7235)
* test: pass t to testing utils

* chore: remove unused code

* fix: update mvds

* fix: push notification client graceful shutdown

* fix: messenger watchExpiredMessages graceful shutdown

* test: log test logger name

* test: automatically start messenger for tests

* feat: use t.Cleanup foe messenger, messaging and databases

* fix: bugs

* test: remove manual messenger teardown

* fix: MessageSender graceful shutdown

* fix: PushNotificatinoServer graceful shutdown

* fix: don't close database from messenger

* fix: graceful shutdown

* test: fixes

* fix: lint

* fix: LogOnPanic ens

* chore: log test logger name on creation

* chore: vendor hash

* chore: mvds master branch
2025-12-19 23:09:39 +00:00
Igor Sirotin 30935148c4 refactor: project layout (crypto, logutils, rpc, accounts-management) (#7226)
* refactor: internal/crypto

* refactor: internal/logutils

* chore: internal/rpc

* refactor: internal/accounts-management
2025-12-18 12:24:40 +00:00
Khushboo-dev-cpp 8d0e9ea9de feat: Dont use ntp servers when Thirdparty services are disabled (#7197) 2025-12-17 21:03:34 +01:00
Igor Sirotin a2ac4a97d0 refactor: project layout (testutils, static, t) (#7223)
* refactor: delete unused files

* refactor: move emojis.txt to protocol/identity/emojihash

* chore: remove t/utils and unused t/config

* refactor: pks/testutils/fake

* refactor: remove unused t/helpers/peers.go

* refactor: move testutils to internal

* refactor: split testutils/fake

* refactor: moved t/helpers to internal/testutils

* fix: fake community
2025-12-17 15:21:08 +00:00
Igor Sirotin 782462f7c9 chore: project layout (tools, ipfs) (#7207)
* chore: internal/ipfs

* chore: tools/generate-db

* chore: tools/generate-handlers

* chore: tools/generate-cbindings

* fix: rebase issues
2025-12-16 12:54:23 +00:00
Igor Sirotin 6c9070fbe9 refactor: project layout (databases, abi-spec, connection) (#7205)
* chore: move databases to internal/db

* chore: move internal/db/sqlite

* chore: internal/abi-spec

* chore: move internal/connection

* chore: internal/circuitbreaker

* chore: internal/transactions

* fix: rebase issues
2025-12-15 12:01:03 +00:00
5f53d31564 test: Token gated communities (#7113)
* test: service functions

* test: test_token_gated_community_membership

* fix: chain id

* test: test_token_gated_community_membership_with_valid_tokens

* fix: skip test because of issue 7114

* fix: refactor setup_backends
- test_admin_token_permissions_with_valid_tokens

* fix: add member permission to admin test
- cleanup and add additional logging

* fix: shutdown backends in parallel

* fix: comment

* fix: skip test for issue 7135

* test: for issue
- test_owner_edits_visible_before_and_after_minting_owner_token

* fix: skip test for issue 7139

* fix: reduce for PR size

* fix: undo parallel container shutdown

* fix: move enums to services wakuext

* fix: stop_messenger removed

* fix: use CommunityTokenPermissionType instead of int

* fix: add CommunityRoles enum

* fix: reduce test names

* fix: remove unnecessary get

* fix: wait times

* fix: enum values serialization

* fix: wrap generate tokens

* fix: log outside helper

* fix: get_erc20_balance method to Foundry

* fix: add assertions to balance

* fix: refactor create_token_gated_community

* fix: remove unnecessary reevaluation

* fix: make it prettier

* fix: remove unnecessary check

* test: refactor to use signals

* fix: add signal
- community.memberReevaluationStatus

* fix: skipp test because of issue 7161

* fix: properly wait for signals

* fix: remove unused self.non_member

Co-authored-by: Igor Sirotin <sirotin@status.im>

* fix: move fake_address

* fix: remove token overrides

* fix: refactor backend creation and token deployment

* feat: python restartWalletReloadTimer

* feat: wakuext community methods

* feat: request_to_join_community takes list of addresses

* feat: request_to_join_with_signatures

* chore: remove test_membership_no_valid_tokens

* fix: working version of test_membership_with_valid_tokens

* fix: linter

* test: improve test_admin_token_permissions_with_valid_tokens

* fix: reintroduce negative test
- test_membership_no_valid_tokens_fake_address

* test: use signed request for admin perm test

* fix: return admin perm test to be skipped

* feat: expose anvil port

* fix: token_overrides, multicall_contract_address

* fix: working test_admin_token_permissions_with_valid_tokens

* fix: request_to_join_community default arguments

* fix: refactor request_to_join_community for older tests

* test: git clone with recursive approach

* fix: snt_deployment once per session

* test: snt_deployment once per class

* test: conditional snt_deployment

* test: shared SNT deployment

* test: make get_erc20_balance call reliable

* fix: cleanup

* fix: undo clone_and_run.sh

* fix: undo docker compose for Anvil

* chore: add support for custom tokens in wallet configuration

Introduced CustomTokens field in WalletConfig to allow registration of custom tokens, mainly necessary for the functional tests.

Fixes #7184

* test: try to unclog the CI

* fix: rebase onto develop

---------

Co-authored-by: Igor Sirotin <sirotin@status.im>
Co-authored-by: Sale Djenic <aleksandardjenic@status.im>
2025-12-15 18:14:10 +08:00
Igor Sirotin ea40003a77 chore: project layout (api, node, multiformat, backup) (#7191)
* chore: delete StatusBackend interface

* chore: rename GethStatusBackend to StatusBackend

* chore: move to pkg/multiformat

* chore: move and rename pkg/backend

* fix(Makefile): lint-fix depends on generate

* chore: move services/pkg

* chore: pkg/backend/node

* chore: testdata/test-0.132.0-account

* fix: rename imports
2025-12-12 21:28:00 +00:00