399 Commits
Author SHA1 Message Date
Sale Djenic e3216cb82e feat(accounts): unwrap-kek - for developers
Given a profile's wrapped-DEK file and the profile password, prints the DEK.
The secret the profile's databases and keystore files are encrypted with and
the sqlcipher pragmas needed to open the databases manually.
2026-08-21 21:19:21 +02: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
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 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 6b362b339a refactor: move signal to internal/signal
Part of the Go project layout migration. Pure move plus import-path
rewrite; the public API is unchanged.

The "emit signals without global functions" redesign is a behavioural
change that touches the C-binding callback and is deliberately left out
of this PR.

refs #7067
2026-08-20 20:59:45 +02:00
osmaczkoandIgor Sirotin a4fb61bd0d refactor!: simplify signal callbacks (#7277)
Simplify signal callbacks, remove unused endpoins.

Co-authored-by: Igor Sirotin <sirotin@status.im>
2026-08-13 19:08:15 +01:00
Igor SirotinandClaude Fable 5 d715752f53 refactor(messaging): coalescing historic-sync worker instead of drop-throttle (#7608)
Address review findings on the reconcile path:

- A single worker now owns automatic historic syncs: triggers post into a
  buffered(1) channel via asyncRequestAllHistoricMessages, the worker
  serializes runs, enforces historicSyncMinInterval by waiting (never by
  dropping), and retries failures with backoff. The recovery-edge signal
  can no longer be silently swallowed by the 20s time throttle (which
  outlived its cause: it was added for cycle-era resume trigger bursts,
  and #7532 removed that noise source), and a failed recovery fetch is
  retried instead of lost.
- withHistoricSyncInFlight shrinks to a pure in-flight gate protecting
  against a manual RPC sync racing the worker.
- Drop the dead withRetries parameter from RequestAllHistoricMessages
  (retry/failover live in the store client per query).
- Waku reconcile loop: use gocommon.PausableTicker, so no ticker is armed
  while the app is backgrounded and pause-state handling is shared code.
- Transport.OnHistoryReconcileNeeded: nil-guard for the offline-transport
  mode (nil channel = never signals).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 23:54:23 +01:00
Igor SirotinandClaude Opus 4.8 817db7c69e fix: publish numGoroutine expvar directly in status-backend (#7585)
* fix: publish numGoroutine expvar directly in status-backend

The `numGoroutine` metric exposed at /debug/vars was provided implicitly
by github.com/anacrolix/envpprof's init(), pulled in transitively via the
torrent history-archive backend. Since #7486 moved that backend behind the
`use_torrent` build tag (default off), envpprof is no longer linked into the
default status-backend build, so `numGoroutine` disappeared from /debug/vars
and the benchmark harness recorded 0 goroutines from 2026-06-24 onward.

Publish numGoroutine directly next to numThreads so the metric no longer
depends on whether the torrent backend is compiled in.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix: only publish numGoroutine when not already registered

In builds that link github.com/anacrolix/envpprof (e.g. unit tests, and any
build with the torrent history-archive backend enabled), numGoroutine is
already published by envpprof's init(), so an unconditional expvar.Publish
panics with "Reuse of exported var name: numGoroutine". Guard with
expvar.Get so we only register the metric when the dependency isn't linked.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 11:11:22 +01:00
Igor SirotinandClaude Opus 4.8 0bf5bfe420 feat(messaging): resolve fleet + mode inside the Waku node (#7592)
* feat(messaging): resolve fleet + mode inside the Waku node

CoreParams now carries Fleet + Mode instead of a pre-resolved ClusterConfig.
The waku node resolves its peers from the fleet name via the fleets registry
and derives the peer-exchange / discv5 policy from the mode (Core = full/relay,
Edge = light) — moving peer management into the Waku object and giving the
messaging API its Start(fleet, mode) shape.

- New wakuv2.Mode (Core = relay, the default; Edge = light). It is the single
  internal source of truth for the light-vs-full distinction and fully replaces
  the former wakuv2.Config.LightClient flag (Config.IsLightClient() derives from
  Mode). Unknown mode values are rejected by Config.Validate. Re-exported as
  messaging.Mode; the app-facing WakuV2Config.LightClient bool and its DB column
  are kept unchanged for backwards compatibility (bridged via ModeFromLightClient).
- wakuv2.Config gains Fleet + Mode; setDefaults resolves the fleet and derives
  the node-type flags. An empty fleet leaves WakuNodes / DiscV5BootstrapNodes /
  ClusterID as set directly (waku unit tests point at ephemeral nodes).
- services/ext and push-notification-server pass fleet + mode; the app no longer
  pre-resolves node lists for the messaging path.
- Break the pkg/messaging/types -> waku import edge (Shard.PubsubTopic computes
  its pubsub topic directly) so the waku node can own fleet resolution without
  an import cycle.

Behaviour-preserving for the app: named fleets resolve to the same peers /
clusterID, and Core/Edge derives the same flags as the old LightClient path.
Note: DefaultConfig now defaults to Core, so the shared in-process test waku
enables discv5 (idle, no bootnodes) where it previously did not.

Part of pm#380 / status-go#7589 (Phase 2b).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* chore(params): drop dead peer fields from ClusterConfig

Now that the waku node resolves its peers from the fleet name (this PR),
ClusterConfig.WakuNodes / DiscV5BootstrapNodes have no readers and were
never persisted, and ClusterConfig.ClusterID is only written to and
reloaded from the DB, never consumed. Drop all three from the struct
(keeping Enabled + Fleet) and the orphaned DefaultWakuNodes /
DefaultDiscV5Nodes re-exports.

The cluster_id DB column is kept (no migration): it is written from the
selected fleet on save (params.DefaultClusterID) and no longer loaded back
into the struct.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* refactor(messaging): build waku config from fleet+mode in newWaku

newWaku no longer takes the whole params.WakuV2Config. Its wakuParams now
carries only what a caller actually configures — fleet + mode, plus the
port / udpPort / nameserver that some deployments set — and the waku node
builds the rest of its config from fleet+mode (peers, cluster id) and the
waku layer's setDefaults (host, discovery limit, max message size, default
shard topic).

Removed from the config build:
- identity: never read by newWaku (dead wakuParams field).
- Host / DiscoveryLimit / MaxMessageSize: only ever the waku defaults;
  setDefaults fills them.
- DefaultShardPubsubTopic: setDefaults fills it.
- EnableStoreConfirmationForMessagesSent: unconditionally overridden by the
  mode inside gowaku (Core -> true, Edge -> false), so the passed value was
  already a no-op.
- AutoUpdate is now a fixed policy (always true, as every caller set it).

The public CoreParams (WakuConfig) is unchanged; only the messaging-internal
newWaku boundary is slimmed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 09:45:34 +01:00
Igor Sirotin 24d0132145 chore: fix numbered import names (#7416) 2026-04-16 13:22:54 +01:00
Eugene Pavlenko 1d958385bd docs: add API reference for bot developers (#7380) 2026-03-24 23:00:50 +00: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 d484f55fac feat: update goroutine-defer-guard (#7210)
* feat: update goroutine-defer-guard

* fix: add panic handles to cmd

* fix: hashes
2025-12-18 19:33:58 +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
Igor Sirotin 0fcf4ceb8e refactor: project layout (messaging) (#7224)
* refactor: pkg/messaging

* fix: address non-go changes
2025-12-17 19:40:40 +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
osmaczko 0fc843266f feat: introduce opentelemetry tracing (#7172)
* feat: introduce opentelemetry tracing

* chore: return associated message hasheh from segmentation layer

Required to derive trace context when a message has been segmented.

* feat: add basic tracing
2025-12-08 20:31:32 +00:00
osmaczko cb3ff6bd60 refactor: rework message sending and processing (#7038)
- introduced `MessagingStack` which wraps protocol layers into one
  entity
- split `MessageSender` into `sender` and `processor` as those two
  represent different responsibilities
- simplified message sending by unifying send methods, which removes
  error-prone logic duplication
- introduced `controller` that orchestrates interactions between
  `sender` and `processor`
- moved application layer concerns `RawMessage`, `MessageSender`,
  `StatusMessage` back to protocol

iterates: #6854
2025-11-18 18:59:37 +00:00
Igor Sirotin 0191cb47f4 feat: external goroutine defer guard (#7057)
* chore: go get tool goroutine-defer-guard

* chore(Makefile): update goroutine-defer-guard target

* chore: goroutine-defer-guard v0.1.0

* chore: drop cmd/lint-panics

* fix(Makefile): lint-panics depend generate

* chore: make vendor

* chore: goroutine-defer-guard 0.1.1
2025-11-05 16:31:22 +00:00
Igor Sirotin 66466948b1 fix: set non-nil activity center for newsfeed service (#7055)
* fix: set messenger to newsfeed service

* feat(cmd/generate-db): extra flags for migrating an existing db
2025-11-04 09:57:35 +00:00
Igor Sirotin 5de98b900d chore: extract newsfeed from messenger (#7025)
* feat: newsfeed service

* chore: cleanup messenger of newsfeed

* test: newsfeed sqlite persistence

* feat: newsfeed AC provider

* feat: featureflags pkg

* chore: cleanup settings of newsfeed

* feat: setup newsfeed service

* chore: cleanup settings of newsfeed

* fix: update migrations timestamps

* chore: cleanup

* fix: rebase issues

* fix: restore notifications_enabled setting

* chore: move settings api to service

* feat: instantiate newsfeed service

* test: newsfeed settings api

* fix: issues

* chore: make lint

* fix: test
2025-10-28 20:53:44 +00:00
Patryk Osmaczko 09819b6809 refactor: modularize messaging persistence
- make each messaging submodule define its own persistence interface and
  SQLite implementation reference
- separate migration tables for messaging submodules
- move migrations from protocol to relevant messaging submodules

closes: #6792
2025-10-22 20:34:03 +02:00
Igor Sirotin 11a78bea96 fix(cmd/generate-db): run protocol migrations (#7013) 2025-10-20 12:51:18 +01:00
Igor Sirotin b65e462b1d feat(benchmark): threads and goroutines count (#7006)
* feat: added numThreads to expvars

* test: added num of threads and goroutines to benchmarks

* fix: issues
2025-10-16 18:13:15 +01:00
Igor Sirotin 473e38323f feat: local timesource (#7003)
* feat: local timesource

* fix: nwaku

* fix: rebase issues
2025-10-16 17:36:49 +01:00
Igor Sirotin c610e571e1 fix: goimports configuration (#7004)
* fix: goimports only 1 local package

* fix: vscode settings goimports

* fix: un-gitignore IDEA code styles

* feat: goland code styles

* fix: remove generate_handlers nolint comment

* chore: lint-fix all files
2025-10-16 17:07:38 +01:00
Patryk Osmaczko c0f75d6709 refactor: move pubkeys utils from protocol to crypto package
These utils are generic enough to be moved to crypto package.
2025-10-14 18:55:36 +02:00
Igor Sirotin dbadf551ca ci: use go tool (#6926)
* ci: tool mockgen

* chore: update generate instructions

* ci: remove mockgen from nix

* ci: tool go-bindata

* chore: make vendor

* chore: update files

* ci: remove external go-bindata

* ci: tool modvendor

* chore: make vendor

* ci: remove modvendor from nix

* ci: go tool gocovmerge

* chore: make vendor
2025-09-16 16:24:10 +01:00
Igor Sirotin 32943ca339 test: connector service (#6875)
* chore: set id in http requests examples

* test: connector service

wip: eth service

* fix: simplify

* test: cleanup
2025-09-01 21:12:07 +01:00
Jonathan Rainville 7f5c02335b chore(backup): remove waku backup and keep only local backup
Needed for https://github.com/status-im/status-desktop/issues/18123
2025-08-22 14:00:00 -04:00
Patryk Osmaczko f78e935b3f refactor: move encryption layer to messaging facade
closes: #6630
2025-08-19 21:00:12 +02:00
Igor Sirotin 8a4afcc6cd chore_: migrate status-backend to zap logger (#6839)
* chore_: migrate status-backend to zap logger

* chore_: remove geth log from balance_fetcher_test.go

* fix_: make vendor

* fix_: test logger
2025-08-15 12:38:41 +01:00
Patryk Osmaczko a38cbe16b3 refactor_: move waku instantiation to messaging facade
iterates: #6629
2025-08-13 20:58:07 +02:00
Sale Djenic e221047b54 refactor(accounts-management)_: eth-node related packages removed and the code updated accordingly
- Affected code updated based on the previous commit and removal of eth-node packages.
- Updates to the `api`, `protocol`, and `services` packages to streamline functionality and reduce complexity.
- Refactoring of cryptographic operations and types to enhance usability.
- Cleanup of unused code and dependencies to optimize performance.
2025-08-13 16:10:40 +02:00
Igor Sirotin b483280faa feat(cmd)_: empty db generation utility (#6821)
* feat_: utility to generate an empty db

* docs_: added generate-db readme
2025-08-12 18:14:40 +01:00
Patryk Osmaczko 9f22e1f573 chore_: move MessageSender to messaging facade
closes: #6637
2025-08-05 21:53:25 +02:00
Igor Sirotin 0b2eda9cf6 test_: better memory metrics in benchmark (#6790)
* feat_: enable expvar endpoint and enable pprof

* test_: track go memstats

* fix_: properly calculate go metrics

* test_: add FreeOSMemory to the end of benchmarks

* fix_: move freeosmemory method to backend

* test_: better chart

* fix_: metrics json field name

* chore_: minor fixes

* fix_: lint
2025-08-04 13:42:03 +01:00
Patryk Osmaczko 286762792b refactor_: move wakuv2.Shard to messaging facade
iterates: #6629
2025-07-25 09:20:50 +02:00
Patryk Osmaczko 568bdfdab0 refactor_: make integration tests waku unaware
closes: #6735
2025-07-22 16:37:51 +02:00
Patryk Osmaczko ba3b27917d refactor!: drop leagacy telemetry 2025-07-21 22:06:36 +02:00
Igor Sirotin 2d93f45d01 chore_: delete deprecated cmds 2025-07-09 23:34:11 +02:00
vedran 931d849c2f feat(cmd)_: add configurable TCP and UDP ports for push-notification-server
Random port assignment makes infrastructure monitoring and service
discovery difficult. Fixed ports enable proper health checks,
port mapping, and integration with existing monitoring systems.

- https://github.com/status-im/infra-push-notify/issues/11
2025-07-08 13:23:58 +02:00
vedran 60b20d3283 fix(cmd)_: nodekey as env var in pn-server
Ref.: https://github.com/status-im/infra-push-notify/issues/11
2025-07-08 13:23:58 +02:00
Sale Djenic cd78f6a209 chore(accounts-management)_: rename AccountManager to AccountsManager for consistency
This change updates all references from `AccountManager` to `AccountsManager` across the codebase.
2025-07-04 08:47:42 +02:00
Igor Sirotin 7258e73d18 feat(cmd)_: push notification server (#6520)
* chore_: remove PushNotificationsServerEnabled setting

* chore_: remove PushNotificationServerConfig

* chore_: extract push notification server from Messegner

* chore(statusd)_: remove push notification server support from statusd

* feat(cmd)_: status push notification server

* chore_: minor logging improve

* feat_: Makefile push-notification-server target

* chore_: address pr comments

* feat(Dockerfile)_: copy push-notification-server

* test_: push notification server (#6675)

* fix_: append port to pn-server container name

* test_: added register_for_push_notifications

* test_: compressed_public_key getter

* test_: push notification server

* fix_: lint

* fix_: gorush stub listen ip any

* test_: cleaup and refactor

* test_: explicitly check if docker image exists

* fix_: lint

* fix_: set container stop_signal to SIGINT

* fix_: linter
2025-06-24 11:34:16 +01:00
Sale Djenic b208d03bbf refactor(account-management)_: account package renamed to accountsmanagement package 2025-06-23 23:55:23 +02:00
Sale Djenic 7aa0bae415 refactor(account-management)_: enhance keystore integration and account handling
- Updated tests to utilize the new account management.
- Refactored account loading and creation methods to align with the new structure, enhancing maintainability.
- Cleaned up unused code and improved overall readability in the account package.
- This refactor further decouples the account management from direct dependencies on the go-ethereum keystore.
2025-06-23 23:55:23 +02:00
Patryk Osmaczko 7f4e5daa75 chore_: remove status-cli
part of: #6656
2025-06-11 13:53:00 +02:00