src/net/swarm/ design, resolved-target
dial work, and Cargo activation of existing blake3/kvdb-overlay;
stop for separate supply-chain review if any new dependency, dependency
source, build.rs, or proc-macro is needed.swarm feature and src/net/swarm/ module structure
without enabling existing binaries; verify default, net, and swarm
feature combinations with make check and clean make clippy.make test.make test.SubnetId and the normative darkirc byte/hash golden
vector plus bound-field divergence and patch-equivalence tests; run
make test.OsRng private-secret generation and secret-safe debug/error
behavior; verify overlay-facing values contain only derived IDs with
make test.make test.net::Settings, default empty,
enforcing 10 external addresses, 10 features, 64-byte node ID, 32-byte app
name, 1,024-byte URL, 32-byte feature name, and 32-byte semver
prerelease/build plus duplicate/version checks; add every boundary test and
run make test.VersionMessage without changing compatibility;
check complete outgoing version and verack against their maxima and implement
bounded inbound decoders for both that check every string/vector—including
semver strings—before reservation/allocation while preserving valid wire
bytes. Add golden compatibility, huge declared count/string, overlong
element, roundtrip, and combined-oversize tests. Generate each P2p node ID with
OsRng; test overlay/subnet/restart independence and no persistence/reuse,
then run make test.ValidatedDialTarget path that resolves clearnet once,
rejects prohibited IPv4/IPv6 ranges outside explicit local-test mode, dials
the exact socket without DNS re-resolution, preserves hostname only for TLS,
and rejects arbitrary proxy-remote clearnet DNS. For Tor/I2P, make the exact
socket the trusted locally configured proxy, never ad-selected; pass canonical
hidden names only inside proxy negotiation/TLS and never local DNS. Add a
pre-start ManualSession target API carrying connect URL plus resolved socket
plus a two-phase pre-start plan that cancels verified targets at a monotonic
switch and activates fresh targets without reload. Add API-state/phase-cancel,
IPv4/IPv6 range, cached-no-DNS, rebinding, TLS-name, trusted-proxy socket,
hidden-service no-local-DNS, proxy override/bypass, missing proxy, and
production-lilith policy tests, then run make test and obtain focused
transport/privacy review.unwrap, expect, panic, unchecked indexing, and
unimplemented branches. Budget/classify every DNS answer and select at most
one exact socket per URL. Reject unaudited schemes before dialer construction;
add arbitrary-input and no-unwind tests for every accepted scheme, then run
make test and make clippy and obtain focused transport review.SubnetAd with exact ID, visibility, ad ID,
lifetime, 1..=32 address, 1,024-byte URL, shareable-scheme, and 65,536-byte
message limits plus fixed command/field order and visibility values; add
serialization/golden-command and every-boundary test, then run make test.(last, terminal] windows, exact next-last, unchanged terminal,
and no next cursor on empty pages; deduplicate across pages under item/page
caps. Add roundtrip, golden-command, malformed/key-order/window/terminal/
empty-advance cursor, duplicate-page, invalid error-value, wrong-ID/type,
local timeout/late response, and unsolicited-response tests; run make test.make test.make test.MAX_BYTES and metering for every swarm message, checking
encoded bytes/counts before variable allocation/store work; add metering and
small-message amplification tests, then run make test.unwrap, expect, explicit panic,
unchecked slicing/indexing, or allocation before declared-size validation;
add truncation-at-every-byte, hostile count/length, arbitrary-input,
no-unwind, and bounded-allocation tests for every message, then run
make test.make test.make test.make test.u64 ticks, compare before checked subtraction, expire equality, reject
deltas over 173,400, clamp valid remainder to 172,800, and checked-add the new
Instant deadline. Atomically restore records/new epoch without a full reset.
Add clean restart, equality/underflow/maximum/overflow, sub-checkpoint crash
extension, downtime, repeated restart, corrupt/missing epoch, interrupted
atomic conversion, and paused-clock healthy checkpoint-at-300-seconds tests.
Inject checkpoint delay/failure and prove fresh admission/authoring fail closed
by 600 seconds while bounded reads remain; then run make test.kvdb-overlay trees and atomic address/public/dedup/metadata
updates; fail startup when configured pool/reserve caps cannot hold valid
persisted seen state and rebuild/verify the public index from normalized
records. Add restart, mixed visibility, reduced-cap/reserve failure, stateless
index, checkpoint, rollback-before-ID-commit, and interrupted-write tests,
proving accepted seen/address/index state commits before relay eligibility;
then run make test.make test.make test.ProtocolSwarm on SESSION_DEFAULT only; verify dispatch on
ordinary inbound/outbound/manual/direct channels and absence on seed/refine
channels with make test.make test.make test.swarm-overlay; reject
over-maximum config, delete channel accounting on disconnect, and add each
saturation/strict-penalty test before make test.swarm-ad-store, no feature privilege, durable versus bounded memory, no
transient authoring, and overlay-only persistence scope; add forged-feature
and equal-state response tests, then run make test.make test.swarm-ad-store; never cache ext_send_addr or another
advertised address and persist no feature, ID, ad, query, or mapping. Add
malicious external-address and file-inspection tests, then run make test.P2p with
empty Settings.peers/Settings.seeds and install revalidated cached sockets
through the pre-start manual-target API; on timeout fully stop/discard it,
resolve configured peers once, and install them into a fresh stage. Do not use
P2p::reload() or DNS-resolve a cached hostname.make test.make test.make test.Initializing, Joining, Joined, Serving, and
Stopping ownership with serialized same-ID transitions and concurrent
different-ID operation; add legal/duplicate transition tests, then run
make test.make test.Arc and hook in the registry so caller-handle
drop cannot end app state. Test pre-start ordering, drop ownership, and
initializer failure with make test.make test.make test.make test.P2p and repeated initializer—without
manual/seed reload. Add state-leak, ordering, repeated-initializer,
static-success, and aggregate-failure tests, then run make test.make test.make test.make test.make test.make test.P2p and repeated initializer, never inbound reload; add
success, retained-state, bind failure, and no-partial-author tests, then run
make test.make test.OsRng jitter, fresh OsRng ad IDs, shuffled subnet order, and bounded
two-hour-default/24-hour-maximum lifetime and addresses; add default/clamp,
config-rejection, reserve-capacity, and injected clock/RNG tests, then run
make test.make test.swarm feature with
ordinary peers, separate accept/external addresses, production local-test
egress disabled, strict policy, and bounded limits; add
overlay-only, inbound-only, mixed, prohibited-local-target, malformed, and
omitted tests, then run make test.make test.make test.[ ] 10.4 Keep overlay and legacy instances isolated in settings, policy,
registry, paths, failures, and shutdown; add mixed and independent-failure
tests, then run make test.
[ ] 11.1 Add local cold-start tests for cached ordinary success, fresh
configured fallback, descriptor lookup, app initialization, and ordinary
subnet join without per-subnet overlay configuration; run make test.
[ ] 11.2 Add first-server creation followed by cadence ad, client lookup, and
ordinary join, proving a new subnet requires no preexisting peer; run
make test.
[ ] 11.3 Add poisoned/stale tests proving stores/lilith never dial targets,
two-hour defaults reduce stale retention, CSPRNG ordering defeats lexical
prefix grinding, joining rejects incompatibility fallibly, relays are not
blamed, and static fallback remains usable; run make test.
[ ] 11.4 Add concurrent abuse tests for oversized fields/URLs, query/pending
floods, fresh-ID floods, protected-set saturation, replay loops, relay fanout,
one-subnet/distributed saturation, local-author reserve, terminal-cursor
mutation/duplicate/empty-page churn, durable-write/checkpoint pressure,
candidate reservoir/order/time-budget grinding, dial concurrency/rate, per-
destination repetition, DNS resolution totals, and victim reflection; verify
every bound and strict penalty with make test.
[ ] 11.5 Add lifecycle tests for initializer failure, caller-handle drop,
duplicate joins, seed/refine filtering, cancellation, source reconstruction,
serving recreation, concurrent leave, retained rejoin, isolated delete, and
failing shutdown hooks; run make test.
[ ] 11.6 Add artifact/privacy tests proving no protocol-added stable node/
signing identity across overlay/subnets (excluding disclosed endpoint reuse),
non-public omission, caches/stores free of queries/sources, scoped subnet and
transport persistence, explicit ID-to-endpoint visibility but no source-peer/
authorship mapping; run make test.
make test.make test.swarm.make fmt, make, make clippy, make test, and make check.@anon-security-review on the complete implementation diff,
record the verdict, and treat FAIL as blocking; resolve or escalate findings.src/net, swarm, lilith,
and darkirc changes, explicitly covering attacker-induced dialing, exact
direct/proxy route semantics, complete candidate-pipeline panic
removal, reservoir/time-partition fairness, replay checkpoint arithmetic/
atomicity/rollback limits, local-author partition metadata, source
reconstruction, listener recreation, state ownership, dependency activation,
and test evidence. Broader rollout/deprecation is a separate change.