21 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
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 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
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
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
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
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
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 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