Skip to content
Draft
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
9 changes: 3 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,11 @@ cognitive_complexity = "allow"
# Allow non-const functions during initial development (may need runtime features later)
missing_const_for_fn = "allow"

# The swarm's wire types (ant-protocol #50), the send on one named channel
# (saorsa-core #183) and the plain STUN answers (saorsa-transport #231) are on
# these branches until they merge: drop each entry once a release includes its
# branch.
[patch.crates-io]
ant-protocol = { git = "https://github.com/grumbach/ant-protocol", branch = "feat/peer-swarm" }
saorsa-core = { git = "https://github.com/grumbach/saorsa-core", branch = "feat/peer-swarm" }
saorsa-transport = { git = "https://github.com/grumbach/saorsa-transport", branch = "feat/peer-swarm" }
757 changes: 757 additions & 0 deletions docs/adr/ADR-0026-clients-share-records-nodes-introduce-them.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/adr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ See [`TOOLING.md`](./TOOLING.md) for `adrs`, `adr-kit`, and AI harness setup.
- [ADR-0020: Kademlia-style chunk GET: return the chunk or closer peers](./ADR-0020-kademlia-chunk-get-or-closer.md)
- [ADR-0022: Remove the LMDB Chunk Store](./ADR-0022-remove-the-lmdb-chunk-store.md)
- [ADR-0023: Spread hot-record reads across the close group, and refuse full browser sessions explicitly](./ADR-0023-spread-hot-reads-and-refuse-full-browser-sessions.md)
- [ADR-0026: Clients reading the same file share its records; nodes introduce them and stay the last seed](./ADR-0026-clients-share-records-nodes-introduce-them.md)
- [ADR-0027: Map the browser listener's port through UPnP](./ADR-0027-map-the-browser-listener-port-through-upnp.md)
- [ADR-0028: Pressure-gated retention of out-of-range records](./ADR-0028-pressure-gated-retention.md)
7 changes: 6 additions & 1 deletion scripts/third_party_notices/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import time
import tomllib
import urllib.error
import urllib.parse
import urllib.request

LICENCE_FILE = re.compile(
Expand Down Expand Up @@ -152,7 +153,11 @@ def resolve_package(name, version, annotation, by_name_version):
elif annotation.startswith("registry "):
raise Gap(f"{name} {version} comes from {annotation}; only crates.io is supported")
elif "://" in annotation:
matches = [p for p in candidates if (p["source"] or "").startswith("git+" + annotation)]
# cargo tree percent-encodes a git branch's slashes, cargo metadata
# does not: compare both decoded.
wanted = "git+" + urllib.parse.unquote(annotation)
matches = [p for p in candidates
if urllib.parse.unquote(p["source"] or "").startswith(wanted)]
else:
wanted = os.path.realpath(annotation)
matches = [p for p in candidates if p["source"] is None
Expand Down
20 changes: 20 additions & 0 deletions src/devnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ use tokio::time::Instant;
use tokio_util::sync::CancellationToken;
use tokio_util::task::TaskTracker;

use crate::node::NativeSwarmRouter;
#[cfg(feature = "webrtc-direct")]
use crate::swarm::SwarmService;

#[cfg(all(feature = "webrtc-direct", feature = "test-utils"))]
use crate::ant_protocol::{ChunkMessage, ChunkMessageBody, ChunkPutRequest, ChunkPutResponse};
#[cfg(all(feature = "webrtc-direct", feature = "test-utils"))]
Expand Down Expand Up @@ -1294,11 +1298,17 @@ impl Devnet {
node.index
))
})?;
let swarm = node
.ant_protocol
.as_ref()
.map_or_else(SwarmService::new, |protocol| Arc::clone(protocol.swarm()));
swarm.set_node_id(*p2p.peer_id().to_bytes());
let server = crate::web_rtc::spawn(
&webrtc_direct_config,
&node.data_dir,
p2p,
node.ant_protocol.clone(),
swarm,
self.config
.evm_network
.as_ref()
Expand Down Expand Up @@ -1327,8 +1337,18 @@ impl Devnet {
let protocol_clone = Arc::clone(protocol);
let handlers = node.handlers.clone();
let node_index = node.index;
// Native clients' swarm requests, as a node routes them.
let swarm = NativeSwarmRouter::start(
Arc::clone(protocol.swarm()),
Arc::clone(p2p),
TaskTracker::new(),
self.shutdown.clone(),
);
node.protocol_task = Some(tokio::spawn(async move {
while let Ok(event) = events.recv().await {
if swarm.route(&event) {
continue;
}
if let P2PEvent::Message {
topic,
source: Some(source),
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pub mod payment;
pub mod pointer;
pub mod replication;
pub mod storage;
pub mod swarm;
pub mod upgrade;
#[cfg(feature = "webrtc-direct")]
mod web_rtc;
Expand Down
Loading
Loading