Skip to content
Open
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
198 changes: 135 additions & 63 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,10 @@ 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.
[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" }
748 changes: 748 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 @@ -41,3 +41,4 @@ See [`TOOLING.md`](./TOOLING.md) for `adrs`, `adr-kit`, and AI harness setup.
- [ADR-0019: Pointer audits serve the record round 1 bound](./ADR-0019-pointer-audits-serve-the-record-round-one-bound.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)
2 changes: 1 addition & 1 deletion scripts/third_party_notices/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ text_sha256 = "b05785f9f18e6716bab63424b11454513b9943a222595b70411009202fc592b5"
note = "its COPYING, reproduced with its copyright lines, refers to LICENSE-MIT and LICENSE-APACHE files that neither the crate nor its repository contain; the MIT text is reproduced from the SPDX licence list."

[missing.granit-parser]
version = "1.3.0"
version = "2.0.0"
text_url = "https://raw.githubusercontent.com/spdx/license-list-data/v3.29.0/text/MIT.txt"
text_sha256 = "b05785f9f18e6716bab63424b11454513b9943a222595b70411009202fc592b5"
note = "its root LICENSE, reproduced with its notices for Chen Yuheng, Ethiraric and Bourumir Wyngs, refers to licence texts the crate ships under a hidden .licenses directory, which is not searched for licence files; the MIT text is reproduced from the SPDX licence list."
Expand Down
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
21 changes: 21 additions & 0 deletions src/devnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ use tokio::sync::RwLock;
use tokio::task::JoinHandle;
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};
Expand Down Expand Up @@ -1059,11 +1064,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 @@ -1091,8 +1102,18 @@ impl Devnet {
let p2p_clone = Arc::clone(p2p);
let protocol_clone = Arc::clone(protocol);
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