15 Commits
Author SHA1 Message Date
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
Andrey Bocharnikov 711ed290d9 fix(messaging): don't crash on a queued hash ratchet message that isn't processed
processMessage legitimately returns (nil, nil) when a message is still
segmented-incomplete or gets re-queued because its hash ratchet key has
not arrived yet. processQueuedHashRatchetMessages dereferenced that nil
response (the shadowed r), crashing the whole app with SIGSEGV. Skip
such messages and leave them in the queue.
2026-08-14 13:12:49 +04:00
Andrey Bocharnikov 783a0779cb test(messaging): queued hash ratchet message that can't process yet survives replay
Red on the parent commit: the replay dereferenced the nil response and
crashed. Green with the guard: the stray message stays queued under its
own key and the rest of the replay completes.
2026-08-14 13:12:49 +04:00
Jonathan Rainville b7b5f827a7 fix(sds): fix SDS stayed closed after coming back from offline
Reliability.Stop() destroyed the SDS reliability manager while Start() only
rebuilt the mvds datasync node, so the first offline->online transition (driven
by Core.connectionChanged) left SDS nil for the rest of the process and every
subsequent message — live or fetched from a store node — arrived still
SDS-wrapped, failed to decode at the application layer and surfaced as type
UNKNOWN. Stop() now tears down only the datasync node and preserves SDS, whose bloom filter and causal history are exactly the state needed to detect what was missed while offline; a new Close() releases it on shutdown, and Start()
rebuilds it if it is ever missing. Two related bugs are fixed alongside:
UnwrapPayloadFromSDS now returns ErrSDSManagerUnavailable when the manager is gone instead of silently passing the wrapped payload through (it still passes through, error-free, when a payload is simply not SDS-wrapped), and the
processor propagates that error so the envelope is retried rather than
confirmed as processed. sdsManager is stored in an atomic.Pointer, since the
hot path read it without holding the lock that Start/Stop write under.
2026-08-11 16:24:26 -04:00
Jonathan Rainville 20f8cdafc8 feat(messages): change sending status to use publishing state and delivered uses SDS
Part of https://github.com/status-im/status-app/issues/21598

Updated outgoing message status handling so `sent` is confirmed immediately after successful Waku publishing, eliminating store-node confirmation requests and retaining only MVDS ACKs (1:1/private groups) and SDS `message_sent` callbacks (communities) for `delivered`. Community SDS IDs are now tracked as internal aliases of the UI message ID, preventing alias messages from appearing in the UI while translating SDS delivery callbacks to the existing delivered signal.
2026-08-03 16:01:16 -04:00
Jonathan Rainville d038248622 chore(sds): enable SDS message wrapping
Fixes https://github.com/status-im/status-go/issues/7151
2026-08-03 15:03:38 -04:00
Jonathan Rainville 22b0ebcc34 chore(sds): switch sds wrapping to be per community instead of per chat 2026-08-03 13:48:10 -04:00
Jonathan Rainville daec193d5b chore: add tests to SDS wrapping and unwrapping 2026-08-03 13:48:10 -04:00
Jonathan Rainville 40db5cc35a feat(sds): enable sds wrapping and fetching of retrieval hints
Fixes #7363

Enables the SDS wrapping flag.
Sets up the handler that wraps SDS messages with retrieval hints. Those hints are the envelope IDs of the messages that were sent and received
Sets up the unwrapping and fetching when there are missed messages detected.
Adds a new function that enables fetching per envelope ID instead than per topic.
2026-08-03 13:48:10 -04:00
Igor SirotinandClaude Opus 4.8 312565ee9e refactor(messaging): drop onPeerStats / onHistoricMessagesRequestFailed (#7598)
status-app no longer consumes the peer-stats push or the historic-messages-
request-failed signal, so remove both callback chains from the messaging stack:

- onHistoricMessagesRequestFailed: the signal (SendHistoricMessagesRequestFailed
  + EventHistoryRequestFailed), the messaging config option, the wakuv3.New
  parameter, and the OnRequestFailed hook on the store pager's envelopeProcessor.
- onPeerStats / SendPeerStats: the wakuv2.peerstats signal, the config option,
  and the push from checkForConnectionChanges.

Peer-stats reporting is removed but connection/online detection is preserved:
ConnStatus is slimmed to {IsOnline}, so the SubscribeToConnStatusChanges
subscription now carries only the online flag (used by the messenger for
connection-change detection). The Peers() RPC + PeerStats/WakuV2Peer types are
kept for the Python functional tests. Online detection is unaffected — it comes
from the libp2p peer count, independent of the removed push.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 11:38:04 +01:00
Igor Sirotin 24d0132145 chore: fix numbered import names (#7416) 2026-04-16 13:22:54 +01:00
Igor Sirotin 63fe9e7227 feat: sds unwrapping (#7227)
* feat: Add SDS unwrap process for received messages (#7149)

* feat: enable sds for wrap message

* chore: add sds default flag

* feat: enable sds for public community message

* fix: always set community id

* feat: add message ID for public params

* chore: move sds to reliability

* chore: refactor flags

* chore: add unit test for sds

* chore: fix test

* chore: add test-single helper

* chore: update Makefile

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

* chore: update logs

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

* chore: refactor function name for init sds

* chore: merge upstream

* chore: refactor sds processor

* chore: move sds wrap logic to messaging sender.

* chore: refactor sds manager

* chore: disable sds wrap

* fix: disable Nim signal handler

---------

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

* fix: cleanup sds manager

* feat: set sds logger

* chore: update sds-go-bindings

* test: named loggers

* test: TestSdsFileDescriptors

* chore: vendor hash

* feat: support updating nim-sds

* fix: TestSdsFileDescriptors skip comment

* chore: bump sds-go-bindings

* chore: bump nim-sds

* chore: vendor hash
2025-12-22 19:57:36 +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