Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion MODERNIZATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,44 @@ exactly that. So consolidation walks the dependency chain from the top:
Verified: whole-tree build, 309/309 tests, standalone chain
(proto-rpc → dht → trackerless-network → proxyclient), lint green
over the module units.
5. C-5 streamr-utils
5. **C-5 streamr-utils** ✅ — plain application of the settled
architecture: the 21 public headers became named sub-modules
(`streamr.utils.X`) under `modules/`, one per former header (git mv,
history preserved); the coarse façade (`streamr.utils` +
`streamr.utils-all`) and the include/ tree deleted; all 45 repo-wide
`import streamr.utils;` consumers flipped to narrow imports; the
package no longer exports an include directory. One 2024 leftover
removed in passing: test/unit/SigninUtilsTest.cpp (typo-named,
byte-identical duplicate of SigningUtilsTest.cpp, never in any CMake
target — surfaced because clangd had been linting it with flags
borrowed from a neighboring file).
**IMPORTANT FINDING — a clang 22.1.8 modules miscompile, and the
rule that avoids it.** The first (script-driven) consumer flip
over-matched names and added spurious imports; among them,
`import streamr.utils.waitForCondition;` in
streamr.protorpc.RpcCommunicatorClientApi — a module unit that
textually includes folly's coroutine Promise/Timeout headers in its
own global module fragment and defines coroutine code. With that one
spurious import added, ALL 17 RpcCommunicator tests hang
deterministically: the response arrives, the promise is resolved,
and the awaiting coroutine never resumes (every thread idle-parked;
confirmed by stack traces). The imported BMI's global module
fragment carries overlapping folly-coroutine declarations
(waitForCondition's GMF also includes folly coro headers), and
merging them with the importer's own textual copies miscompiles the
promise-resumption path. Removing the unused import fixes it;
bisection pinned exactly this import (collect alone is fine, the
waitForCondition import alone hangs). CONSEQUENCE, now a hard rule
(it was already the architecture's intent): **a module unit imports
ONLY the modules whose names its code actually uses — never
speculative or convenience imports.** The flip tooling now prunes
against a curated per-module export-name list, and the compiler's
"declaration of 'X' must be imported from module 'M'" errors are the
ground truth for adding imports back.
Verified: whole-tree build, 309/309 tests (with per-test timeouts),
standalone chain (utils 49/49 → proto-rpc 26/26 → dht 83/83 →
trackerless-network → proxyclient 15/15), lint green in all five
touched packages (utils module units now clangd-tidy-linted).
6. C-6 streamr-logger
7. C-7 streamr-json
8. C-8 streamr-eventemitter (+ final bench.sh metrics and memo closure)
Expand Down
3 changes: 2 additions & 1 deletion packages/streamr-dht/modules/Identifiers.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ module;

export module streamr.dht.Identifiers;

import streamr.utils;
import streamr.utils.BinaryUtils;
import streamr.utils.Branded;

// Hoisted from the former header (file scope, NOT exported);
// fully qualified: relative namespace names resolve differently
Expand Down
3 changes: 2 additions & 1 deletion packages/streamr-dht/modules/connection/Connection.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export module streamr.dht.Connection;

import streamr.eventemitter;
import streamr.logger;
import streamr.utils;
import streamr.utils.Branded;
import streamr.utils.Uuid;

// Hoisted from the former header (file scope, NOT exported);
// fully qualified: relative namespace names resolve differently
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module;

export module streamr.dht.ConnectionLockStates;

import streamr.utils;
import streamr.utils.Branded;
import streamr.dht.Identifiers;
export namespace streamr::dht::connection {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export module streamr.dht.ConnectionManager;
import streamr.protorpc.RpcCommunicator;
import streamr.dht.ConnectionLockStates;
import streamr.logger;
import streamr.utils;
import streamr.utils.waitForEvent;
import streamr.dht.ConnectionLockRpcLocal;
import streamr.dht.ConnectionLockRpcRemote;
import streamr.dht.ConnectionLocker;
Expand Down
3 changes: 2 additions & 1 deletion packages/streamr-dht/modules/connection/Handshaker.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export module streamr.dht.Handshaker;

import streamr.eventemitter;
import streamr.logger;
import streamr.utils;
import streamr.utils.EnableSharedFromThis;
import streamr.utils.Uuid;
import streamr.dht.Connection;
import streamr.dht.Version;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ module;

export module streamr.dht.PendingConnection;

import streamr.utils;
import streamr.utils.AbortController;
import streamr.utils.AbortableTimers;
import streamr.logger;
import streamr.dht.Connection;
import streamr.dht.IPendingConnection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export module streamr.dht.Endpoint;

import streamr.eventemitter;
import streamr.logger;
import streamr.utils;
import streamr.utils.EnableSharedFromThis;
import streamr.dht.ConnectedEndpointState;
import streamr.dht.ConnectingEndpointState;
import streamr.dht.DisconnectedEndpointState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module;
export module streamr.dht.EndpointState;

import streamr.logger;
import streamr.utils;
import streamr.utils.EnableSharedFromThis;
import streamr.dht.Connection;
import streamr.dht.IPendingConnection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export module streamr.dht.WebsocketClientConnection;

import streamr.dht.Connection;
import streamr.logger;
import streamr.utils;
import streamr.utils.waitForEvent;
import streamr.dht.WebsocketConnection;

// Hoisted from the former header (file scope, NOT exported);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export module streamr.dht.WebsocketClientConnector;
import streamr.dht.Handshaker;
import streamr.dht.Connection;
import streamr.logger;
import streamr.utils;
import streamr.utils.AbortController;
import streamr.dht.Connectivity;
import streamr.dht.IPendingConnection;
import streamr.dht.Identifiers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module;
export module streamr.dht.WebsocketClientConnectorRpcLocal;

import streamr.dht.DhtRpcServer;
import streamr.utils;
import streamr.utils.AbortController;
import streamr.dht.DhtCallContext;
import streamr.dht.IPendingConnection;
import streamr.dht.Identifiers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module;
export module streamr.dht.WebsocketConnection;

import streamr.logger;
import streamr.utils;
import streamr.utils.EnableSharedFromThis;
import streamr.dht.Connection;

// Hoisted from the former header (file scope, NOT exported);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import streamr.eventemitter;
import streamr.dht.Connection;
import streamr.dht.WebsocketConnection;
import streamr.logger;
import streamr.utils;
import streamr.utils.Uuid;
import streamr.dht.CertificateHelper;
import streamr.dht.Errors;
import streamr.dht.PortRange;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export module streamr.dht.WebsocketServerConnector;

import streamr.dht.WebsocketServerConnection;
import streamr.logger;
import streamr.utils;
import streamr.utils.AbortController;
import streamr.utils.Ipv4Helper;
import streamr.utils.Uuid;
import streamr.dht.Handshaker;
import streamr.dht.IPendingConnection;
import streamr.dht.Identifiers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export module streamr.dht.RoutingRpcCommunicator;
import streamr.logger;
import streamr.protorpc.RpcCommunicator;
import streamr.protorpc.protos;
import streamr.utils;
import streamr.utils.Uuid;
import streamr.dht.DhtCallContext;
import streamr.dht.Identifiers;
import streamr.dht.Transport;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import streamr.dht.PortRange;
import streamr.dht.Transport;
import streamr.dht.protos;
import streamr.logger;
import streamr.utils;
import streamr.utils.collect;
import streamr.utils.waitForCondition;

using ::dht::ConnectivityResponse;
// using ::dht::Message;
Expand Down
2 changes: 1 addition & 1 deletion packages/streamr-dht/test/unit/PendingConnectionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import streamr.dht.Connection;
import streamr.dht.PendingConnection;
import streamr.dht.Transport;
import streamr.dht.protos;
import streamr.utils;
import streamr.utils.waitForCondition;

using ::dht::PeerDescriptor;
using streamr::dht::connection::Connection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import streamr.dht.Identifiers;
import streamr.dht.PendingConnection;
import streamr.dht.WebsocketClientConnectorRpcLocal;
import streamr.dht.protos;
import streamr.utils;
import streamr.utils.AbortController;

using ::dht::PeerDescriptor;
using streamr::dht::DhtAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ import streamr.dht.Identifiers;
import streamr.dht.protos;
import streamr.logger;
import streamr.trackerlessnetwork.ProxyClient;
import streamr.utils;
import streamr.utils.BinaryUtils;
import streamr.utils.EthereumAddress;
import streamr.utils.SigningUtils;
import streamr.utils.StreamPartID;

namespace streamr::libstreamrproxyclient {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ module;
export module streamr.protorpc.RpcCommunicatorClientApi;

import streamr.logger;
import streamr.utils;
import streamr.utils.Branded;
import streamr.utils.Uuid;
import streamr.protorpc.Errors;

// Hoisted from the former header (file scope, NOT exported);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import streamr.dht.DhtCallContext;
import streamr.dht.Identifiers;
import streamr.dht.ListeningRpcCommunicator;
import streamr.dht.protos;
import streamr.utils;
import streamr.utils.StreamPartID;

// Hoisted from the former header (file scope, NOT exported);
// fully qualified because relative namespace names resolve
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import streamr.dht.DhtCallContext;
import streamr.dht.RpcRemote;
import streamr.dht.protos;
import streamr.logger;
import streamr.utils;
import streamr.utils.StreamPartID;

// Hoisted from the former header (file scope, NOT exported);
// fully qualified because relative namespace names resolve
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module;
export module streamr.trackerlessnetwork.formStreamPartDeliveryServiceId;

import streamr.dht.Identifiers;
import streamr.utils;
import streamr.utils.StreamPartID;

// Hoisted from the former header (file scope, NOT exported);
// fully qualified because relative namespace names resolve
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ import streamr.dht.Transport;
import streamr.dht.protos;
import streamr.eventemitter;
import streamr.logger;
import streamr.utils;
import streamr.utils.AbortController;
import streamr.utils.EthereumAddress;
import streamr.utils.RetryUtils;
import streamr.utils.StreamPartID;
import streamr.trackerlessnetwork.ContentDeliveryRpcLocal;
import streamr.trackerlessnetwork.ContentDeliveryRpcRemote;
import streamr.trackerlessnetwork.DuplicateMessageDetector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import streamr.dht.Identifiers;
import streamr.dht.ListeningRpcCommunicator;
import streamr.dht.protos;
import streamr.eventemitter;
import streamr.utils;
import streamr.utils.BinaryUtils;
import streamr.utils.EthereumAddress;
import streamr.utils.StreamPartID;
import streamr.trackerlessnetwork.ContentDeliveryRpcRemote;

// Hoisted from the former header (file scope, NOT exported);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import streamr.dht.DhtCallContext;
import streamr.dht.RpcRemote;
import streamr.dht.protos;
import streamr.logger;
import streamr.utils;
import streamr.utils.BinaryUtils;
import streamr.utils.EthereumAddress;

// Hoisted from the former header (file scope, NOT exported);
// fully qualified because relative namespace names resolve
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import streamr.dht.protos;
import streamr.logger;
import streamr.trackerlessnetwork.ProxyClient;
import streamr.trackerlessnetwork.protos;
import streamr.utils;
import streamr.utils.BinaryUtils;
import streamr.utils.EthereumAddress;
import streamr.utils.StreamPartID;

using ::dht::ConnectivityMethod;
using ::dht::ConnectivityResponse;
Expand Down
18 changes: 8 additions & 10 deletions packages/streamr-utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,17 @@ endif()
# project() because it inspects the compiler id.
include(${CMAKE_CURRENT_SOURCE_DIR}/StreamrModules.cmake)

# Module façade (MODERNIZATION.md Part 2): the package is now a STATIC
# library whose module interface units re-export the public headers.
# #include consumers are unaffected; import consumers get the BMIs.
# CONSOLIDATED (MODERNIZATION.md Phase 2.6): one named sub-module per
# former public header (settled architecture: no umbrella; consumers and
# tests import the individual sub-modules). The include/ tree is gone —
# the module interface units are the source of truth, so the package no
# longer exports any include directory.
file(GLOB_RECURSE STREAMR_UTILS_MODULE_UNITS CONFIGURE_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/modules/*.cppm)
streamr_add_module_library(streamr-utils
FILES
modules/streamr.utils.cppm
modules/streamr.utils-all.cppm)
FILES ${STREAMR_UTILS_MODULE_UNITS})
add_library(streamr::streamr-utils ALIAS streamr-utils)

target_include_directories(
streamr-utils PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)

find_library(SECP256K1_LIBRARY secp256k1)
# secp256k1 >= 0.7 links the precomputed tables into the main library; the
# separate secp256k1_precomputed archive no longer exists.
Expand Down
19 changes: 0 additions & 19 deletions packages/streamr-utils/include/streamr-utils/Uuid.hpp

This file was deleted.

17 changes: 0 additions & 17 deletions packages/streamr-utils/include/streamr-utils/toCoroTask.hpp

This file was deleted.

This file was deleted.

Loading
Loading