rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5 heartwood3c5668edd22ae4b9a085220d6be552f944ccb038
{
"request": "trigger",
"version": 1,
"event_type": "patch",
"repository": {
"id": "rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5",
"name": "heartwood",
"description": "Radicle Heartwood Protocol & Stack",
"private": false,
"default_branch": "master",
"delegates": [
"did:key:z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT",
"did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM",
"did:key:z6MkkPvBfjP4bQmco5Dm7UGsX2ruDBieEHi8n9DVJWX5sTEz"
]
},
"action": "Created",
"patch": {
"id": "2b670a8e593667c3ce872296382d1fe8561937bd",
"author": {
"id": "did:key:z6MkkPvBfjP4bQmco5Dm7UGsX2ruDBieEHi8n9DVJWX5sTEz",
"alias": null
},
"title": "radicle-protocol: A Sans I/O Implementation of the Network Protocol",
"state": {
"status": "merged",
"conflicts": []
},
"before": "408d4f27e7ef6a56ca1998802c4e8feb9da991ac",
"after": "3c5668edd22ae4b9a085220d6be552f944ccb038",
"commits": [
"3c5668edd22ae4b9a085220d6be552f944ccb038",
"1c20f64a26641ecb7777567b9661599d92757e08",
"61c468778a87a3a40acfa3be90107cd98a1451b5",
"b9759c58688a1fe63a09c92c43eef10257f4c9ef"
],
"target": "3fc92f83fe089263c470b328414d923227cf0e4a",
"labels": [],
"assignees": [],
"revisions": [
{
"id": "2b670a8e593667c3ce872296382d1fe8561937bd",
"author": {
"id": "did:key:z6MkkPvBfjP4bQmco5Dm7UGsX2ruDBieEHi8n9DVJWX5sTEz",
"alias": null
},
"description": "As of 2025-06 this is just an early draft.\n\nThe `radicle-protocol` was initialized by moving files out of `radicle-node`, and adjusting `use`s.\n\n`radicle-node` and `radicle-protocol` use `radicle::node::Link` instead of `netservices::LinkDirection`, to remove the dependency on `netservices` for `radicle-protocol`. To allow a \"drop-in\", a few backward compatible extensions were added to `radicle::node::Link`.\n\nThe encoding and decoding layer of `radicle-node` was refactored to use `bytes` without `std::io::Error` instead of `byteorder` and `std::io:Error`.\nThe dependency on `byteorder` was not completely removed from the Cargo workspace, as other crates use it in other ways.",
"base": "af35e6f4d04735c33cc10777d6421a61555db754",
"oid": "5e47e09f965b517e62bb829b7c214cd68472e6f9",
"timestamp": 1750668729
},
{
"id": "693dfca1abfa0f7ad01b366c0347ab10b41df402",
"author": {
"id": "did:key:z6MkkPvBfjP4bQmco5Dm7UGsX2ruDBieEHi8n9DVJWX5sTEz",
"alias": null
},
"description": "Rebase",
"base": "408d4f27e7ef6a56ca1998802c4e8feb9da991ac",
"oid": "3c5668edd22ae4b9a085220d6be552f944ccb038",
"timestamp": 1752693644
},
{
"id": "043301017e5cf82d9e4a4fbe19d547eca5dd189a",
"author": {
"id": "did:key:z6MkkPvBfjP4bQmco5Dm7UGsX2ruDBieEHi8n9DVJWX5sTEz",
"alias": null
},
"description": "Changes:\n- fix `Frame` docstring",
"base": "408d4f27e7ef6a56ca1998802c4e8feb9da991ac",
"oid": "010d5134e8fae35e9e4f179d2929e41a20a93d30",
"timestamp": 1752740111
}
]
}
}
{
"response": "triggered",
"run_id": {
"id": "6d656168-e189-4240-8bd0-8a590cb88420"
},
"info_url": "https://cci.rad.levitte.org//6d656168-e189-4240-8bd0-8a590cb88420.html"
}
Started at: 2026-09-08 09:49:45.844959+02:00
Commands:
$ rad clone rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5 .
✓ Creating checkout in ./...
✓ Remote cloudhead@z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT added
✓ Remote-tracking branch cloudhead@z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT/master created for z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT
✓ Remote fintohaps@z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM added
✓ Remote-tracking branch fintohaps@z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM/master created for z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM
✓ Remote lorenz@z6MkkPvBfjP4bQmco5Dm7UGsX2ruDBieEHi8n9DVJWX5sTEz added
✓ Remote-tracking branch lorenz@z6MkkPvBfjP4bQmco5Dm7UGsX2ruDBieEHi8n9DVJWX5sTEz/master created for z6MkkPvBfjP4bQmco5Dm7UGsX2ruDBieEHi8n9DVJWX5sTEz
✓ Repository successfully cloned under /opt/radcis/ci.rad.levitte.org/cci/state/6d656168-e189-4240-8bd0-8a590cb88420/w/
╭────────────────────────────────────╮
│ heartwood │
│ Radicle Heartwood Protocol & Stack │
│ 189 issues · 38 patches │
╰────────────────────────────────────╯
Run `cd ./.` to go to the repository directory.
Exit code: 0
$ rad patch checkout 2b670a8e593667c3ce872296382d1fe8561937bd
✓ Switched to branch patch/2b670a8 at revision 693dfca
✓ Branch patch/2b670a8 setup to track rad/patches/2b670a8e593667c3ce872296382d1fe8561937bd
Exit code: 0
$ git config advice.detachedHead false
Exit code: 0
$ git checkout 3c5668edd22ae4b9a085220d6be552f944ccb038
HEAD is now at 3c5668ed protocol: Reimplement encoding on top of `bytes`
Exit code: 0
$ rad patch show 2b670a8e593667c3ce872296382d1fe8561937bd -p
╭─────────────────────────────────────────────────────────────────────────────────╮
│ Title radicle-protocol: A Sans I/O Implementation of the Network Protocol │
│ Patch 2b670a8e593667c3ce872296382d1fe8561937bd │
│ Author lorenz z6MkkPv…WX5sTEz │
│ Head 3c5668edd22ae4b9a085220d6be552f944ccb038 │
│ Base 408d4f27e7ef6a56ca1998802c4e8feb9da991ac │
│ Target master │
│ Branches patch/2b670a8 │
│ Commits ahead 0, behind 982 │
│ Status merged │
│ │
│ As of 2025-06 this is just an early draft. │
│ │
│ The `radicle-protocol` was initialized by moving files out of `radicle-node`, │
│ and adjusting `use`s. │
│ │
│ `radicle-node` and `radicle-protocol` use `radicle::node::Link` instead of │
│ `netservices::LinkDirection`, to remove the dependency on `netservices` for │
│ `radicle-protocol`. To allow a "drop-in", a few backward compatible extensions │
│ were added to `radicle::node::Link`. │
│ │
│ The encoding and decoding layer of `radicle-node` was refactored to use `bytes` │
│ without `std::io::Error` instead of `byteorder` and `std::io:Error`. │
│ The dependency on `byteorder` was not completely removed from the Cargo │
│ workspace, as other crates use it in other ways. │
├─────────────────────────────────────────────────────────────────────────────────┤
│ 3c5668e protocol: Reimplement encoding on top of `bytes` │
│ 1c20f64 node, protocol: Refactor │
│ 61c4687 protocol: Create skeleton by moving from radicle-node │
│ b9759c5 radicle: Make `node::Link` copy and add `is_*` │
├─────────────────────────────────────────────────────────────────────────────────┤
│ ● Revision 2b670a8 @ af35e6f..5e47e09 by lorenz z6MkkPv…WX5sTEz 1 year ago │
│ ↑ Revision 693dfca @ 408d4f2..3c5668e by lorenz z6MkkPv…WX5sTEz 1 year ago │
│ ↑ Revision 0433010 @ 408d4f2..010d513 by fintohaps z6Mkire…SQZ3voM 1 year ago │
│ └─ ✓ merged by fintohaps z6Mkire…SQZ3voM │
╰─────────────────────────────────────────────────────────────────────────────────╯
commit 3c5668edd22ae4b9a085220d6be552f944ccb038
Author: Lorenz Leutgeb <lorenz.leutgeb@radicle.xyz>
Date: Sat Jun 21 18:44:14 2025 +0200
protocol: Reimplement encoding on top of `bytes`
diff --git a/Cargo.lock b/Cargo.lock
index b81bb3514..cad838074 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -349,6 +349,12 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
+[[package]]
+name = "bytes"
+version = "1.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
+
[[package]]
name = "bytesize"
version = "2.0.1"
@@ -2643,7 +2649,7 @@ dependencies = [
"amplify",
"anyhow",
"bloomy",
- "byteorder",
+ "bytes",
"chrono",
"colored",
"crossbeam-channel",
@@ -2680,7 +2686,7 @@ name = "radicle-protocol"
version = "0.1.0"
dependencies = [
"bloomy",
- "byteorder",
+ "bytes",
"crossbeam-channel",
"cyphernet",
"fastrand",
diff --git a/Cargo.toml b/Cargo.toml
index 3a3920fd2..ebe959038 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,7 +22,7 @@ rust-version = "1.81.0"
amplify = { version = "4.0.0", default-features = false }
anyhow = "1"
bstr = "1.3"
-byteorder = "1.4"
+bytes = "1"
chrono = { version = "0.4.26", default-features = false }
colored = "2.1.0"
crossbeam-channel = "0.5.6"
diff --git a/crates/radicle-node/Cargo.toml b/crates/radicle-node/Cargo.toml
index ce05ef47a..85e2720aa 100644
--- a/crates/radicle-node/Cargo.toml
+++ b/crates/radicle-node/Cargo.toml
@@ -18,7 +18,7 @@ test = ["radicle/test", "radicle-crypto/test", "radicle-crypto/cyphernet", "radi
amplify = { workspace = true }
anyhow = { workspace = true }
bloomy = "1.2"
-byteorder = { workspace = true }
+bytes = { workspace = true }
chrono = { workspace = true, features = ["clock"] }
colored = { workspace = true }
crossbeam-channel = { workspace = true }
diff --git a/crates/radicle-node/src/tests.rs b/crates/radicle-node/src/tests.rs
index 82e5e83fa..a265bc93c 100644
--- a/crates/radicle-node/src/tests.rs
+++ b/crates/radicle-node/src/tests.rs
@@ -79,8 +79,8 @@ fn test_inventory_decode() {
let timestamp: Timestamp = LocalTime::now().into();
let mut buf = Vec::new();
- inventory.as_slice().encode(&mut buf).unwrap();
- timestamp.encode(&mut buf).unwrap();
+ inventory.as_slice().encode(&mut buf);
+ timestamp.encode(&mut buf);
let m = InventoryAnnouncement::decode(&mut buf.as_slice()).expect("message decodes");
assert_eq!(inventory.as_slice(), m.inventory.as_slice());
diff --git a/crates/radicle-node/src/wire.rs b/crates/radicle-node/src/wire.rs
index 4a3e05537..3033b353a 100644
--- a/crates/radicle-node/src/wire.rs
+++ b/crates/radicle-node/src/wire.rs
@@ -1001,9 +1001,7 @@ where
metrics.sent_gossip_messages += msgs.len();
for msg in msgs {
- Frame::gossip(link, msg)
- .encode(&mut data)
- .expect("in-memory writes never fail");
+ Frame::gossip(link, msg).encode(&mut data);
}
metrics.sent_bytes += data.len();
@@ -1262,18 +1260,16 @@ mod test {
let pong = Message::Pong {
zeroes: ZeroBytes::new(42),
};
- frame::PROTOCOL_VERSION_STRING.encode(&mut stream).unwrap();
- frame::StreamId::gossip(Link::Outbound)
- .encode(&mut stream)
- .unwrap();
+ frame::PROTOCOL_VERSION_STRING.encode(&mut stream);
+ frame::StreamId::gossip(Link::Outbound).encode(&mut stream);
// Serialize gossip message with some extension fields.
let mut gossip = wire::serialize(&pong);
- String::from("extra").encode(&mut gossip).unwrap();
- 48u8.encode(&mut gossip).unwrap();
+ String::from("extra").encode(&mut gossip);
+ 48u8.encode(&mut gossip);
// Encode gossip message using the varint-prefix format into the stream.
- varint::payload::encode(&gossip, &mut stream).unwrap();
+ varint::payload::encode(&gossip, &mut stream);
let mut de = deserializer::Deserializer::<1024, Frame>::new(1024);
de.input(&stream).unwrap();
@@ -1298,16 +1294,14 @@ mod test {
}
impl wire::Encode for MessageWithExt {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- let mut n = self.msg.encode(writer)?;
- n += self.ext.encode(writer)?;
-
- Ok(n)
+ fn encode(&self, writer: &mut impl bytes::BufMut) {
+ self.msg.encode(writer);
+ self.ext.encode(writer);
}
}
impl wire::Decode for MessageWithExt {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, wire::Error> {
+ fn decode(reader: &mut impl bytes::Buf) -> Result<Self, wire::Error> {
let msg = Message::decode(reader)?;
let ext = String::decode(reader).unwrap_or_default();
@@ -1337,12 +1331,9 @@ mod test {
ext: String::from("extra"),
},
)
- .encode(&mut stream)
- .unwrap();
+ .encode(&mut stream);
// Pong message that comes after, without extension.
- frame::Frame::gossip(Link::Outbound, pong.clone())
- .encode(&mut stream)
- .unwrap();
+ frame::Frame::gossip(Link::Outbound, pong.clone()).encode(&mut stream);
// First test deserializing using the message with extension type.
{
diff --git a/crates/radicle-protocol/Cargo.toml b/crates/radicle-protocol/Cargo.toml
index 6a3010731..e96c1221e 100644
--- a/crates/radicle-protocol/Cargo.toml
+++ b/crates/radicle-protocol/Cargo.toml
@@ -13,7 +13,7 @@ test = ["radicle/test", "radicle-crypto/test", "radicle-crypto/cyphernet", "qche
[dependencies]
bloomy = "1.2"
-byteorder = { workspace = true }
+bytes = { workspace = true }
crossbeam-channel = { workspace = true }
cyphernet = { workspace = true, features = ["tor"] }
fastrand = { workspace = true }
diff --git a/crates/radicle-protocol/src/bounded.rs b/crates/radicle-protocol/src/bounded.rs
index e136bc315..1687de4b9 100644
--- a/crates/radicle-protocol/src/bounded.rs
+++ b/crates/radicle-protocol/src/bounded.rs
@@ -28,7 +28,7 @@ impl<T, const N: usize> BoundedVec<T, N> {
/// # Examples
///
/// ```
- /// use radicle_node::bounded;
+ /// use radicle_protocol::bounded;
///
/// let mut iter = (0..4).into_iter();
/// let bounded: bounded::BoundedVec<i32,3> = bounded::BoundedVec::collect_from(&mut iter);
@@ -48,7 +48,7 @@ impl<T, const N: usize> BoundedVec<T, N> {
/// # Examples
///
/// ```
- /// use radicle_node::bounded;
+ /// use radicle_protocol::bounded;
///
/// let mut vec = vec![1, 2, 3];
/// let bounded = bounded::BoundedVec::<_, 2>::truncate(vec);
@@ -64,7 +64,7 @@ impl<T, const N: usize> BoundedVec<T, N> {
/// # Examples
///
/// ```
- /// use radicle_node::bounded;
+ /// use radicle_protocol::bounded;
///
/// let vec = bounded::BoundedVec::<i32, 11>::with_capacity(10).unwrap();
///
@@ -94,7 +94,7 @@ impl<T, const N: usize> BoundedVec<T, N> {
/// # Examples
///
/// ```
- /// use radicle_node::bounded;
+ /// use radicle_protocol::bounded;
///
/// type Inventory = bounded::BoundedVec<(), 10>;
/// assert_eq!(Inventory::max(), 10);
@@ -120,7 +120,7 @@ impl<T, const N: usize> BoundedVec<T, N> {
/// # Examples
///
/// ```
- /// use radicle_node::bounded;
+ /// use radicle_protocol::bounded;
///
/// let mut vec: bounded::BoundedVec<_,3> = vec![1, 2].try_into().unwrap();
/// vec.push(3).expect("within limit");
@@ -147,7 +147,7 @@ impl<T, const N: usize> BoundedVec<T, N> {
/// # Examples
///
/// ```
- /// use radicle_node::bounded;
+ /// use radicle_protocol::bounded;
///
/// let mut bounded: bounded::BoundedVec<_,3> = vec![1, 2, 3].try_into().unwrap();
/// let mut vec = bounded.unbound();
@@ -240,6 +240,51 @@ impl<T: std::fmt::Debug, const N: usize> std::fmt::Debug for BoundedVec<T, N> {
}
}
+unsafe impl<const N: usize> bytes::BufMut for BoundedVec<u8, N> {
+ fn remaining_mut(&self) -> usize {
+ N - self.v.len()
+ }
+
+ unsafe fn advance_mut(&mut self, cnt: usize) {
+ let len = {
+ let len = self.v.len();
+ let remaining = N - len;
+
+ if remaining >= cnt {
+ len + cnt
+ } else {
+ panic!("advance out of bounds: have {remaining} remaining, but advancing by {cnt}",);
+ }
+ };
+
+ debug_assert!(len <= N);
+
+ // Addition will not overflow since the sum is at most the capacity.
+ self.v.set_len(len);
+ }
+
+ fn chunk_mut(&mut self) -> &mut bytes::buf::UninitSlice {
+ let len = self.v.len();
+
+ // If the vector is full, we double its capacity using `reserve`, but not beyond the limit.
+ if self.v.capacity() == len {
+ self.v.reserve(std::cmp::min(len, N - len));
+ }
+
+ let cap = self.v.capacity();
+
+ debug_assert!(cap <= N);
+ debug_assert!(len <= cap);
+
+ let ptr = self.v.as_mut_ptr();
+
+ // SAFETY: Since `ptr` is valid for `cap` bytes, `ptr.add(len)` must be
+ // valid for `cap - len` bytes. The subtraction will not underflow since
+ // `len <= cap`.
+ unsafe { bytes::buf::UninitSlice::from_raw_parts_mut(ptr.add(len), cap - len) }
+ }
+}
+
#[cfg(any(test, feature = "test"))]
impl<T, const N: usize> qcheck::Arbitrary for BoundedVec<T, N>
where
diff --git a/crates/radicle-protocol/src/deserializer.rs b/crates/radicle-protocol/src/deserializer.rs
index e75ddeaa1..3ddec6a83 100644
--- a/crates/radicle-protocol/src/deserializer.rs
+++ b/crates/radicle-protocol/src/deserializer.rs
@@ -58,7 +58,7 @@ impl<const B: usize, D: wire::Decode> Deserializer<B, D> {
Ok(Some(msg))
}
- Err(err) if err.is_eof() => Ok(None),
+ Err(wire::Error::UnexpectedEnd { .. }) => Ok(None),
Err(err) => Err(err),
}
}
@@ -79,6 +79,20 @@ impl<const B: usize, D: wire::Decode> Deserializer<B, D> {
}
}
+unsafe impl<const B: usize, D: wire::Decode> bytes::BufMut for Deserializer<B, D> {
+ fn remaining_mut(&self) -> usize {
+ self.unparsed.remaining_mut()
+ }
+
+ unsafe fn advance_mut(&mut self, cnt: usize) {
+ self.unparsed.advance_mut(cnt);
+ }
+
+ fn chunk_mut(&mut self) -> &mut bytes::buf::UninitSlice {
+ self.unparsed.chunk_mut()
+ }
+}
+
impl<const B: usize, D: wire::Decode> io::Write for Deserializer<B, D> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.input(buf).map_err(|_| io::ErrorKind::OutOfMemory)?;
diff --git a/crates/radicle-protocol/src/service/message.rs b/crates/radicle-protocol/src/service/message.rs
index 5995b7482..282cc6620 100644
--- a/crates/radicle-protocol/src/service/message.rs
+++ b/crates/radicle-protocol/src/service/message.rs
@@ -1,6 +1,8 @@
-use std::{fmt, io, mem};
+use std::{fmt, mem};
+use bytes::{Buf, BufMut};
use nonempty::NonEmpty;
+
use radicle::crypto;
use radicle::git;
use radicle::identity::RepoId;
@@ -117,32 +119,28 @@ impl NodeAnnouncement {
}
impl wire::Encode for NodeAnnouncement {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- let mut n = 0;
-
- n += self.version.encode(writer)?;
- n += self.features.encode(writer)?;
- n += self.timestamp.encode(writer)?;
- n += self.alias.encode(writer)?;
- n += self.addresses.encode(writer)?;
- n += self.nonce.encode(writer)?;
- n += self.agent.encode(writer)?;
-
- Ok(n)
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.version.encode(buf);
+ self.features.encode(buf);
+ self.timestamp.encode(buf);
+ self.alias.encode(buf);
+ self.addresses.encode(buf);
+ self.nonce.encode(buf);
+ self.agent.encode(buf);
}
}
impl wire::Decode for NodeAnnouncement {
- fn decode<R: std::io::Read + ?Sized>(reader: &mut R) -> Result<Self, wire::Error> {
- let version = u8::decode(reader)?;
- let features = node::Features::decode(reader)?;
- let timestamp = Timestamp::decode(reader)?;
- let alias = wire::Decode::decode(reader)?;
- let addresses = BoundedVec::<Address, ADDRESS_LIMIT>::decode(reader)?;
- let nonce = u64::decode(reader)?;
- let agent = match UserAgent::decode(reader) {
+ fn decode(buf: &mut impl Buf) -> Result<Self, wire::Error> {
+ let version = u8::decode(buf)?;
+ let features = node::Features::decode(buf)?;
+ let timestamp = Timestamp::decode(buf)?;
+ let alias = wire::Decode::decode(buf)?;
+ let addresses = BoundedVec::<Address, ADDRESS_LIMIT>::decode(buf)?;
+ let nonce = u64::decode(buf)?;
+ let agent = match UserAgent::decode(buf) {
Ok(ua) => ua,
- Err(e) if e.is_eof() => UserAgent::default(),
+ Err(wire::Error::UnexpectedEnd { .. }) => UserAgent::default(),
Err(e) => return Err(e),
};
@@ -708,8 +706,8 @@ mod tests {
.signed(&Device::mock())
.into();
- let mut buf: Vec<u8> = Vec::new();
- assert!(msg.encode(&mut buf).is_ok());
+ let mut buf = Vec::new();
+ msg.encode(&mut buf);
let decoded = wire::deserialize(buf.as_slice());
assert!(decoded.is_ok());
@@ -728,10 +726,7 @@ mod tests {
&Device::mock(),
);
let mut buf: Vec<u8> = Vec::new();
- assert!(
- msg.encode(&mut buf).is_ok(),
- "INVENTORY_LIMIT is a valid limit for encoding",
- );
+ msg.encode(&mut buf);
let decoded = wire::deserialize(buf.as_slice());
assert!(
diff --git a/crates/radicle-protocol/src/wire.rs b/crates/radicle-protocol/src/wire.rs
index fb696f1d0..d3d9f78e2 100644
--- a/crates/radicle-protocol/src/wire.rs
+++ b/crates/radicle-protocol/src/wire.rs
@@ -7,12 +7,13 @@ pub use message::{AddressType, MessageType};
use std::collections::BTreeMap;
use std::convert::TryFrom;
+use std::mem;
use std::ops::Deref;
use std::str::FromStr;
use std::string::FromUtf8Error;
-use std::{io, mem};
-use byteorder::{NetworkEndian, ReadBytesExt, WriteBytesExt};
+use bytes::{Buf, BufMut};
+
use cyphernet::addr::tor;
use radicle::crypto::{PublicKey, Signature, Unverified};
@@ -41,8 +42,6 @@ pub type Size = u16;
#[derive(thiserror::Error, Debug)]
pub enum Error {
- #[error("i/o: {0}")]
- Io(#[from] io::Error),
#[error("UTF-8 error: {0}")]
FromUtf8(#[from] FromUtf8Error),
#[error("invalid size: expected {expected}, got {actual}")]
@@ -75,24 +74,32 @@ pub enum Error {
UnknownInfoType(u16),
#[error("unexpected bytes")]
UnexpectedBytes,
-}
-
-impl Error {
- /// Whether we've reached the end of file. This will be true when we fail to decode
- /// a message because there's not enough data in the stream.
- pub fn is_eof(&self) -> bool {
- matches!(self, Self::Io(err) if err.kind() == io::ErrorKind::UnexpectedEof)
+ #[error("unexpected end of buffer, requested {requested} more bytes but only {available} are available")]
+ UnexpectedEnd { available: usize, requested: usize },
+}
+
+impl From<bytes::TryGetError> for Error {
+ fn from(
+ bytes::TryGetError {
+ available,
+ requested,
+ }: bytes::TryGetError,
+ ) -> Self {
+ Self::UnexpectedEnd {
+ available,
+ requested,
+ }
}
}
/// Things that can be encoded as binary.
pub trait Encode {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error>;
+ fn encode(&self, buffer: &mut impl BufMut);
}
/// Things that can be decoded from binary.
pub trait Decode: Sized {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error>;
+ fn decode(buffer: &mut impl Buf) -> Result<Self, Error>;
}
/// Encode an object into a byte vector.
@@ -100,79 +107,62 @@ pub trait Decode: Sized {
/// # Panics
///
/// If the encoded object exceeds [`Size::MAX`].
-pub fn serialize<T: Encode + ?Sized>(data: &T) -> Vec<u8> {
- let mut buffer = Vec::new();
- // SAFETY: We expect this to panic if the user passes
- // in data that exceeds the maximum allowed size.
- #[allow(clippy::unwrap_used)]
- let len = data.encode(&mut buffer).unwrap();
-
- debug_assert_eq!(len, buffer.len());
-
- buffer
+pub fn serialize<E: Encode + ?Sized>(data: &E) -> Vec<u8> {
+ let mut buffer = Vec::new().limit(Size::MAX as usize);
+ data.encode(&mut buffer);
+ buffer.into_inner()
}
-/// Decode an object from a vector.
-pub fn deserialize<T: Decode>(data: &[u8]) -> Result<T, Error> {
- let mut cursor = io::Cursor::new(data);
- let obj = T::decode(&mut cursor)?;
+/// Decode an object from a slice.
+pub fn deserialize<T: Decode>(mut data: &[u8]) -> Result<T, Error> {
+ let result = T::decode(&mut data)?;
- if cursor.position() as usize != cursor.get_ref().len() {
- return Err(Error::UnexpectedBytes);
+ if data.is_empty() {
+ Ok(result)
+ } else {
+ Err(Error::UnexpectedBytes)
}
- Ok(obj)
}
impl Encode for u8 {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- writer.write_u8(*self)?;
-
- Ok(mem::size_of::<Self>())
+ fn encode(&self, buf: &mut impl BufMut) {
+ buf.put_u8(*self);
}
}
impl Encode for u16 {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- writer.write_u16::<NetworkEndian>(*self)?;
-
- Ok(mem::size_of::<Self>())
+ fn encode(&self, buf: &mut impl BufMut) {
+ buf.put_u16(*self);
}
}
impl Encode for u32 {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- writer.write_u32::<NetworkEndian>(*self)?;
-
- Ok(mem::size_of::<Self>())
+ fn encode(&self, buf: &mut impl BufMut) {
+ buf.put_u32(*self);
}
}
impl Encode for u64 {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- writer.write_u64::<NetworkEndian>(*self)?;
-
- Ok(mem::size_of::<Self>())
+ fn encode(&self, buf: &mut impl BufMut) {
+ buf.put_u64(*self);
}
}
impl Encode for PublicKey {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- self.deref().encode(writer)
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.deref().encode(buf)
}
}
impl<const T: usize> Encode for &[u8; T] {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- writer.write_all(&**self)?;
- Ok(mem::size_of::<Self>())
+ fn encode(&self, buf: &mut impl BufMut) {
+ buf.put_slice(&**self);
}
}
impl<const T: usize> Encode for [u8; T] {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- writer.write_all(self)?;
-
- Ok(mem::size_of::<Self>())
+ fn encode(&self, buf: &mut impl BufMut) {
+ buf.put_slice(self);
}
}
@@ -180,13 +170,12 @@ impl<T> Encode for &[T]
where
T: Encode,
{
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- let mut n = (self.len() as Size).encode(writer)?;
+ fn encode(&self, buf: &mut impl BufMut) {
+ (self.len() as Size).encode(buf);
for item in self.iter() {
- n += item.encode(writer)?;
+ item.encode(buf);
}
- Ok(n)
}
}
@@ -194,75 +183,72 @@ impl<T, const N: usize> Encode for BoundedVec<T, N>
where
T: Encode,
{
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- self.as_slice().encode(writer)
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.as_slice().encode(buf)
}
}
impl Encode for &str {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
+ fn encode(&self, buf: &mut impl BufMut) {
assert!(self.len() <= u8::MAX as usize);
- let n = (self.len() as u8).encode(writer)?;
+ (self.len() as u8).encode(buf);
let bytes = self.as_bytes();
// Nb. Don't use the [`Encode`] instance here for &[u8], because we are prefixing the
// length ourselves.
- writer.write_all(bytes)?;
-
- Ok(n + bytes.len())
+ buf.put_slice(bytes);
}
}
impl Encode for String {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- self.as_str().encode(writer)
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.as_str().encode(buf)
}
}
impl Encode for git::Url {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- self.to_string().encode(writer)
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.to_string().encode(buf)
}
}
impl Encode for RepoId {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- self.deref().encode(writer)
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.deref().encode(buf)
}
}
impl Encode for Refs {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
+ fn encode(&self, buf: &mut impl BufMut) {
let len: Size = self
.len()
.try_into()
- .map_err(|e| io::Error::new(io::ErrorKind::InvalidInput, e))?;
- let mut n = len.encode(writer)?;
+ .expect("`Refs::len()` must be less than or equal to `Size::MAX`");
+ len.encode(buf);
for (name, oid) in self.iter() {
- n += name.as_str().encode(writer)?;
- n += oid.encode(writer)?;
+ name.as_str().encode(buf);
+ oid.encode(buf);
}
- Ok(n)
}
}
impl Encode for cyphernet::addr::tor::OnionAddrV3 {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- self.into_raw_bytes().encode(writer)
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.into_raw_bytes().encode(buf)
}
}
impl Encode for UserAgent {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- self.as_ref().encode(writer)
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.as_ref().encode(buf)
}
}
impl Encode for Alias {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- self.as_ref().encode(writer)
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.as_ref().encode(buf)
}
}
@@ -271,51 +257,50 @@ where
A: Encode,
B: Encode,
{
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- let mut n = self.0.encode(writer)?;
- n += self.1.encode(writer)?;
- Ok(n)
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.0.encode(buf);
+ self.1.encode(buf);
}
}
impl Encode for git::RefString {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- self.as_str().encode(writer)
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.as_str().encode(buf)
}
}
impl Encode for Signature {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- self.deref().encode(writer)
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.deref().encode(buf)
}
}
impl Encode for git::Oid {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
+ fn encode(&self, buf: &mut impl BufMut) {
// Nb. We use length-encoding here to support future SHA-2 object ids.
- self.as_bytes().encode(writer)
+ self.as_bytes().encode(buf)
}
}
////////////////////////////////////////////////////////////////////////////////
impl Decode for PublicKey {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
- let buf: [u8; 32] = Decode::decode(reader)?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
+ let buf: [u8; 32] = Decode::decode(buf)?;
Ok(PublicKey::from(buf))
}
}
impl Decode for Refs {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
- let len = Size::decode(reader)?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
+ let len = Size::decode(buf)?;
let mut refs = BTreeMap::new();
for _ in 0..len {
- let name = String::decode(reader)?;
+ let name = String::decode(buf)?;
let name = git::RefString::try_from(name).map_err(Error::from)?;
- let oid = git::Oid::decode(reader)?;
+ let oid = git::Oid::decode(buf)?;
refs.insert(name, oid);
}
@@ -324,22 +309,21 @@ impl Decode for Refs {
}
impl Decode for git::RefString {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
- let ref_str = String::decode(reader)?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
+ let ref_str = String::decode(buf)?;
git::RefString::try_from(ref_str).map_err(Error::from)
}
}
impl Decode for UserAgent {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
- String::decode(reader)
- .and_then(|s| UserAgent::from_str(&s).map_err(Error::InvalidUserAgent))
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
+ String::decode(buf).and_then(|s| UserAgent::from_str(&s).map_err(Error::InvalidUserAgent))
}
}
impl Decode for Alias {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
- String::decode(reader).and_then(|s| Alias::from_str(&s).map_err(Error::from))
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
+ String::decode(buf).and_then(|s| Alias::from_str(&s).map_err(Error::from))
}
}
@@ -348,16 +332,16 @@ where
A: Decode,
B: Decode,
{
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
- let a = A::decode(reader)?;
- let b = B::decode(reader)?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
+ let a = A::decode(buf)?;
+ let b = B::decode(buf)?;
Ok((a, b))
}
}
impl Decode for git::Oid {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
- let len = Size::decode(reader)? as usize;
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
+ let len = Size::decode(buf)? as usize;
#[allow(non_upper_case_globals)]
const expected: usize = mem::size_of::<git::raw::Oid>();
@@ -368,7 +352,7 @@ impl Decode for git::Oid {
});
}
- let buf: [u8; expected] = Decode::decode(reader)?;
+ let buf: [u8; expected] = Decode::decode(buf)?;
let oid = git::raw::Oid::from_bytes(&buf).expect("the buffer is exactly the right size");
let oid = git::Oid::from(oid);
@@ -377,41 +361,41 @@ impl Decode for git::Oid {
}
impl Decode for Signature {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
- let bytes: [u8; 64] = Decode::decode(reader)?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
+ let bytes: [u8; 64] = Decode::decode(buf)?;
Ok(Signature::from(bytes))
}
}
impl Decode for u8 {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
- reader.read_u8().map_err(Error::from)
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
+ Ok(buf.try_get_u8()?)
}
}
impl Decode for u16 {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
- reader.read_u16::<NetworkEndian>().map_err(Error::from)
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
+ Ok(buf.try_get_u16()?)
}
}
impl Decode for u32 {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
- reader.read_u32::<NetworkEndian>().map_err(Error::from)
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
+ Ok(buf.try_get_u32()?)
}
}
impl Decode for u64 {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
- reader.read_u64::<NetworkEndian>().map_err(Error::from)
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
+ Ok(buf.try_get_u64()?)
}
}
impl<const N: usize> Decode for [u8; N] {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
let mut ary = [0; N];
- reader.read_exact(&mut ary)?;
+ buf.try_copy_to_slice(&mut ary).map_err(Error::from)?;
Ok(ary)
}
@@ -421,15 +405,15 @@ impl<T, const N: usize> Decode for BoundedVec<T, N>
where
T: Decode,
{
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
- let len: usize = Size::decode(reader)? as usize;
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
+ let len: usize = Size::decode(buf)? as usize;
let mut items = Self::with_capacity(len).map_err(|_| Error::InvalidSize {
expected: Self::max(),
actual: len,
})?;
for _ in 0..items.capacity() {
- let item = T::decode(reader)?;
+ let item = T::decode(buf)?;
items.push(item).ok();
}
Ok(items)
@@ -437,11 +421,11 @@ where
}
impl Decode for String {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
- let len = u8::decode(reader)?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
+ let len = u8::decode(buf)?;
let mut bytes = vec![0; len as usize];
- reader.read_exact(&mut bytes)?;
+ buf.try_copy_to_slice(&mut bytes)?;
let string = String::from_utf8(bytes)?;
@@ -450,32 +434,29 @@ impl Decode for String {
}
impl Decode for RepoId {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
- let oid: git::Oid = Decode::decode(reader)?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
+ let oid: git::Oid = Decode::decode(buf)?;
Ok(Self::from(oid))
}
}
impl Encode for filter::Filter {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- let mut n = 0;
-
- n += self.deref().as_bytes().encode(writer)?;
-
- Ok(n)
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.deref().as_bytes().encode(buf);
}
}
impl Decode for filter::Filter {
- fn decode<R: std::io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
- let size: usize = Size::decode(reader)? as usize;
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
+ let size: usize = Size::decode(buf)? as usize;
if !filter::FILTER_SIZES.contains(&size) {
return Err(Error::InvalidFilterSize(size));
}
let mut bytes = vec![0; size];
- reader.read_exact(&mut bytes[..])?;
+
+ buf.try_copy_to_slice(&mut bytes)?;
let f = filter::BloomFilter::from(bytes);
debug_assert_eq!(f.hashes(), filter::FILTER_HASHES);
@@ -485,63 +466,55 @@ impl Decode for filter::Filter {
}
impl<V> Encode for SignedRefs<V> {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- let mut n = 0;
-
- n += self.id.encode(writer)?;
- n += self.refs.encode(writer)?;
- n += self.signature.encode(writer)?;
-
- Ok(n)
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.id.encode(buf);
+ self.refs.encode(buf);
+ self.signature.encode(buf);
}
}
impl Decode for SignedRefs<Unverified> {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
- let id = NodeId::decode(reader)?;
- let refs = Refs::decode(reader)?;
- let signature = Signature::decode(reader)?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
+ let id = NodeId::decode(buf)?;
+ let refs = Refs::decode(buf)?;
+ let signature = Signature::decode(buf)?;
Ok(Self::new(refs, id, signature))
}
}
impl Encode for RefsAt {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- let mut n = 0;
-
- n += self.remote.encode(writer)?;
- n += self.at.encode(writer)?;
-
- Ok(n)
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.remote.encode(buf);
+ self.at.encode(buf);
}
}
impl Decode for RefsAt {
- fn decode<R: std::io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
- let remote = NodeId::decode(reader)?;
- let at = git::Oid::decode(reader)?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
+ let remote = NodeId::decode(buf)?;
+ let at = git::Oid::decode(buf)?;
Ok(Self { remote, at })
}
}
impl Encode for node::Features {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- self.deref().encode(writer)
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.deref().encode(buf)
}
}
impl Decode for node::Features {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
- let features = u64::decode(reader)?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
+ let features = u64::decode(buf)?;
Ok(Self::from(features))
}
}
impl Decode for tor::OnionAddrV3 {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
- let bytes: [u8; tor::ONION_V3_RAW_LEN] = Decode::decode(reader)?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
+ let bytes: [u8; tor::ONION_V3_RAW_LEN] = Decode::decode(buf)?;
let addr = tor::OnionAddrV3::from_raw_bytes(bytes)?;
Ok(addr)
@@ -549,14 +522,14 @@ impl Decode for tor::OnionAddrV3 {
}
impl Encode for Timestamp {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- self.deref().encode(writer)
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.deref().encode(buf)
}
}
impl Decode for Timestamp {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, Error> {
- let millis = u64::decode(reader)?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, Error> {
+ let millis = u64::decode(buf)?;
let ts = Timestamp::try_from(millis).map_err(Error::InvalidTimestamp)?;
Ok(ts)
diff --git a/crates/radicle-protocol/src/wire/frame.rs b/crates/radicle-protocol/src/wire/frame.rs
index fcd5c30f5..cdf9e3eac 100644
--- a/crates/radicle-protocol/src/wire/frame.rs
+++ b/crates/radicle-protocol/src/wire/frame.rs
@@ -2,9 +2,11 @@
#![warn(clippy::missing_docs_in_private_items)]
use std::{fmt, io};
+use bytes::{Buf, BufMut};
+use radicle::node::Link;
+
use crate::service::Message;
use crate::{wire, wire::varint, wire::varint::VarInt, PROTOCOL_VERSION};
-use radicle::node::Link;
/// Protocol version strings all start with the magic sequence `rad`, followed
/// by a version number.
@@ -29,17 +31,16 @@ impl Version {
}
impl wire::Encode for Version {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- writer.write_all(&PROTOCOL_VERSION_STRING.0)?;
-
- Ok(PROTOCOL_VERSION_STRING.0.len())
+ fn encode(&self, buf: &mut impl BufMut) {
+ buf.put_slice(&PROTOCOL_VERSION_STRING.0);
}
}
impl wire::Decode for Version {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, wire::Error> {
+ fn decode(buf: &mut impl Buf) -> Result<Self, wire::Error> {
let mut version = [0u8; 4];
- reader.read_exact(&mut version[..])?;
+
+ buf.try_copy_to_slice(&mut version[..])?;
if version != PROTOCOL_VERSION_STRING.0 {
return Err(wire::Error::InvalidProtocolVersion(version));
@@ -144,15 +145,15 @@ impl fmt::Display for StreamId {
}
impl wire::Decode for StreamId {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, wire::Error> {
- let id = VarInt::decode(reader)?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, wire::Error> {
+ let id = VarInt::decode(buf)?;
Ok(Self(id))
}
}
impl wire::Encode for StreamId {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- self.0.encode(writer)
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.0.encode(buf)
}
}
@@ -272,19 +273,19 @@ pub enum Control {
}
impl wire::Decode for Control {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, wire::Error> {
- let command = u8::decode(reader)?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, wire::Error> {
+ let command = u8::decode(buf)?;
match command {
CONTROL_OPEN => {
- let stream = StreamId::decode(reader)?;
+ let stream = StreamId::decode(buf)?;
Ok(Control::Open { stream })
}
CONTROL_CLOSE => {
- let stream = StreamId::decode(reader)?;
+ let stream = StreamId::decode(buf)?;
Ok(Control::Close { stream })
}
CONTROL_EOF => {
- let stream = StreamId::decode(reader)?;
+ let stream = StreamId::decode(buf)?;
Ok(Control::Eof { stream })
}
other => Err(wire::Error::InvalidControlMessage(other)),
@@ -293,38 +294,35 @@ impl wire::Decode for Control {
}
impl wire::Encode for Control {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- let mut n = 0;
-
+ fn encode(&self, buf: &mut impl BufMut) {
match self {
Self::Open { stream: id } => {
- n += CONTROL_OPEN.encode(writer)?;
- n += id.encode(writer)?;
+ CONTROL_OPEN.encode(buf);
+ id.encode(buf);
}
Self::Eof { stream: id } => {
- n += CONTROL_EOF.encode(writer)?;
- n += id.encode(writer)?;
+ CONTROL_EOF.encode(buf);
+ id.encode(buf);
}
Self::Close { stream: id } => {
- n += CONTROL_CLOSE.encode(writer)?;
- n += id.encode(writer)?;
+ CONTROL_CLOSE.encode(buf);
+ id.encode(buf);
}
}
- Ok(n)
}
}
impl<M: wire::Decode> wire::Decode for Frame<M> {
- fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Self, wire::Error> {
- let version = Version::decode(reader)?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, wire::Error> {
+ let version = Version::decode(buf)?;
if version.number() != PROTOCOL_VERSION {
return Err(wire::Error::WrongProtocolVersion(version.number()));
}
- let stream = StreamId::decode(reader)?;
+ let stream = StreamId::decode(buf)?;
match stream.kind() {
Ok(StreamKind::Control) => {
- let ctrl = Control::decode(reader)?;
+ let ctrl = Control::decode(buf)?;
let frame = Frame {
version,
stream,
@@ -333,7 +331,7 @@ impl<M: wire::Decode> wire::Decode for Frame<M> {
Ok(frame)
}
Ok(StreamKind::Gossip) => {
- let data = varint::payload::decode(reader)?;
+ let data = varint::payload::decode(buf)?;
let mut cursor = io::Cursor::new(data);
let msg = M::decode(&mut cursor)?;
let frame = Frame {
@@ -348,7 +346,7 @@ impl<M: wire::Decode> wire::Decode for Frame<M> {
Ok(frame)
}
Ok(StreamKind::Git { .. }) => {
- let data = varint::payload::decode(reader)?;
+ let data = varint::payload::decode(buf)?;
Ok(Frame::git(stream, data))
}
Err(n) => Err(wire::Error::InvalidStreamKind(n)),
@@ -357,18 +355,14 @@ impl<M: wire::Decode> wire::Decode for Frame<M> {
}
impl<M: wire::Encode> wire::Encode for Frame<M> {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- let mut n = 0;
-
- n += self.version.encode(writer)?;
- n += self.stream.encode(writer)?;
- n += match &self.data {
- FrameData::Control(ctrl) => ctrl.encode(writer)?,
- FrameData::Git(data) => varint::payload::encode(data, writer)?,
- FrameData::Gossip(msg) => varint::payload::encode(&wire::serialize(msg), writer)?,
- };
-
- Ok(n)
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.version.encode(buf);
+ self.stream.encode(buf);
+ match &self.data {
+ FrameData::Control(ctrl) => ctrl.encode(buf),
+ FrameData::Git(data) => varint::payload::encode(data, buf),
+ FrameData::Gossip(msg) => varint::payload::encode(&wire::serialize(msg), buf),
+ }
}
}
diff --git a/crates/radicle-protocol/src/wire/message.rs b/crates/radicle-protocol/src/wire/message.rs
index bcfc29976..765185b70 100644
--- a/crates/radicle-protocol/src/wire/message.rs
+++ b/crates/radicle-protocol/src/wire/message.rs
@@ -1,6 +1,7 @@
-use std::{io, mem, net};
+use std::{mem, net};
-use byteorder::{NetworkEndian, ReadBytesExt};
+use bytes::Buf;
+use bytes::BufMut;
use cyphernet::addr::{tor, Addr, HostName, NetAddr};
use radicle::crypto::Signature;
use radicle::git::Oid;
@@ -114,32 +115,28 @@ impl TryFrom<u8> for AddressType {
}
impl wire::Encode for AnnouncementMessage {
- fn encode<W: std::io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, std::io::Error> {
+ fn encode(&self, buf: &mut impl BufMut) {
match self {
- Self::Node(ann) => ann.encode(writer),
- Self::Inventory(ann) => ann.encode(writer),
- Self::Refs(ann) => ann.encode(writer),
+ Self::Node(ann) => ann.encode(buf),
+ Self::Inventory(ann) => ann.encode(buf),
+ Self::Refs(ann) => ann.encode(buf),
}
}
}
impl wire::Encode for RefsAnnouncement {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- let mut n = 0;
-
- n += self.rid.encode(writer)?;
- n += self.refs.encode(writer)?;
- n += self.timestamp.encode(writer)?;
-
- Ok(n)
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.rid.encode(buf);
+ self.refs.encode(buf);
+ self.timestamp.encode(buf);
}
}
impl wire::Decode for RefsAnnouncement {
- fn decode<R: std::io::Read + ?Sized>(reader: &mut R) -> Result<Self, wire::Error> {
- let rid = RepoId::decode(reader)?;
- let refs = BoundedVec::<_, REF_REMOTE_LIMIT>::decode(reader)?;
- let timestamp = Timestamp::decode(reader)?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, wire::Error> {
+ let rid = RepoId::decode(buf)?;
+ let refs = BoundedVec::<_, REF_REMOTE_LIMIT>::decode(buf)?;
+ let timestamp = Timestamp::decode(buf)?;
Ok(Self {
rid,
@@ -150,20 +147,16 @@ impl wire::Decode for RefsAnnouncement {
}
impl wire::Encode for InventoryAnnouncement {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- let mut n = 0;
-
- n += self.inventory.encode(writer)?;
- n += self.timestamp.encode(writer)?;
-
- Ok(n)
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.inventory.encode(buf);
+ self.timestamp.encode(buf);
}
}
impl wire::Decode for InventoryAnnouncement {
- fn decode<R: std::io::Read + ?Sized>(reader: &mut R) -> Result<Self, wire::Error> {
- let inventory = BoundedVec::decode(reader)?;
- let timestamp = Timestamp::decode(reader)?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, wire::Error> {
+ let inventory = BoundedVec::decode(buf)?;
+ let timestamp = Timestamp::decode(buf)?;
Ok(Self {
inventory,
@@ -212,28 +205,25 @@ impl From<&Info> for InfoType {
}
impl wire::Encode for Info {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- let mut n = 0;
- n += u16::from(InfoType::from(self)).encode(writer)?;
+ fn encode(&self, buf: &mut impl BufMut) {
+ u16::from(InfoType::from(self)).encode(buf);
match self {
Info::RefsAlreadySynced { rid, at } => {
- n += rid.encode(writer)?;
- n += at.encode(writer)?;
+ rid.encode(buf);
+ at.encode(buf);
}
}
-
- Ok(n)
}
}
impl wire::Decode for Info {
- fn decode<R: std::io::Read + ?Sized>(reader: &mut R) -> Result<Self, wire::Error> {
- let info_type = reader.read_u16::<NetworkEndian>()?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, wire::Error> {
+ let info_type = buf.try_get_u16()?;
match InfoType::try_from(info_type) {
Ok(InfoType::RefsAlreadySynced) => {
- let rid = RepoId::decode(reader)?;
- let at = Oid::decode(reader)?;
+ let rid = RepoId::decode(buf)?;
+ let at = Oid::decode(buf)?;
Ok(Self::RefsAlreadySynced { rid, at })
}
@@ -243,8 +233,8 @@ impl wire::Decode for Info {
}
impl wire::Encode for Message {
- fn encode<W: std::io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, std::io::Error> {
- let mut n = self.type_id().encode(writer)?;
+ fn encode(&self, buf: &mut impl BufMut) {
+ self.type_id().encode(buf);
match self {
Self::Subscribe(Subscribe {
@@ -252,50 +242,42 @@ impl wire::Encode for Message {
since,
until,
}) => {
- n += filter.encode(writer)?;
- n += since.encode(writer)?;
- n += until.encode(writer)?;
+ filter.encode(buf);
+ since.encode(buf);
+ until.encode(buf);
}
Self::Announcement(Announcement {
node,
message,
signature,
}) => {
- n += node.encode(writer)?;
- n += signature.encode(writer)?;
- n += message.encode(writer)?;
+ node.encode(buf);
+ signature.encode(buf);
+ message.encode(buf);
}
Self::Info(info) => {
- n += info.encode(writer)?;
+ info.encode(buf);
}
Self::Ping(Ping { ponglen, zeroes }) => {
- n += ponglen.encode(writer)?;
- n += zeroes.encode(writer)?;
+ ponglen.encode(buf);
+ zeroes.encode(buf);
}
Self::Pong { zeroes } => {
- n += zeroes.encode(writer)?;
+ zeroes.encode(buf);
}
}
-
- if n > wire::Size::MAX as usize {
- return Err(io::Error::new(
- io::ErrorKind::InvalidData,
- "Message exceeds maximum size",
- ));
- }
- Ok(n)
}
}
impl wire::Decode for Message {
- fn decode<R: std::io::Read + ?Sized>(reader: &mut R) -> Result<Self, wire::Error> {
- let type_id = reader.read_u16::<NetworkEndian>()?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, wire::Error> {
+ let type_id = buf.try_get_u16()?;
match MessageType::try_from(type_id) {
Ok(MessageType::Subscribe) => {
- let filter = Filter::decode(reader)?;
- let since = Timestamp::decode(reader)?;
- let until = Timestamp::decode(reader)?;
+ let filter = Filter::decode(buf)?;
+ let since = Timestamp::decode(buf)?;
+ let until = Timestamp::decode(buf)?;
Ok(Self::Subscribe(Subscribe {
filter,
@@ -304,9 +286,9 @@ impl wire::Decode for Message {
}))
}
Ok(MessageType::NodeAnnouncement) => {
- let node = NodeId::decode(reader)?;
- let signature = Signature::decode(reader)?;
- let message = NodeAnnouncement::decode(reader)?.into();
+ let node = NodeId::decode(buf)?;
+ let signature = Signature::decode(buf)?;
+ let message = NodeAnnouncement::decode(buf)?.into();
Ok(Announcement {
node,
@@ -316,9 +298,9 @@ impl wire::Decode for Message {
.into())
}
Ok(MessageType::InventoryAnnouncement) => {
- let node = NodeId::decode(reader)?;
- let signature = Signature::decode(reader)?;
- let message = InventoryAnnouncement::decode(reader)?.into();
+ let node = NodeId::decode(buf)?;
+ let signature = Signature::decode(buf)?;
+ let message = InventoryAnnouncement::decode(buf)?.into();
Ok(Announcement {
node,
@@ -328,9 +310,9 @@ impl wire::Decode for Message {
.into())
}
Ok(MessageType::RefsAnnouncement) => {
- let node = NodeId::decode(reader)?;
- let signature = Signature::decode(reader)?;
- let message = RefsAnnouncement::decode(reader)?.into();
+ let node = NodeId::decode(buf)?;
+ let signature = Signature::decode(buf)?;
+ let message = RefsAnnouncement::decode(buf)?.into();
Ok(Announcement {
node,
@@ -340,16 +322,16 @@ impl wire::Decode for Message {
.into())
}
Ok(MessageType::Info) => {
- let info = Info::decode(reader)?;
+ let info = Info::decode(buf)?;
Ok(Self::Info(info))
}
Ok(MessageType::Ping) => {
- let ponglen = u16::decode(reader)?;
- let zeroes = ZeroBytes::decode(reader)?;
+ let ponglen = u16::decode(buf)?;
+ let zeroes = ZeroBytes::decode(buf)?;
Ok(Self::Ping(Ping { ponglen, zeroes }))
}
Ok(MessageType::Pong) => {
- let zeroes = ZeroBytes::decode(reader)?;
+ let zeroes = ZeroBytes::decode(buf)?;
Ok(Self::Pong { zeroes })
}
Err(other) => Err(wire::Error::UnknownMessageType(other)),
@@ -358,85 +340,82 @@ impl wire::Decode for Message {
}
impl wire::Encode for Address {
- fn encode<W: std::io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, std::io::Error> {
- let mut n = 0;
-
+ fn encode(&self, buf: &mut impl BufMut) {
match self.host {
HostName::Ip(net::IpAddr::V4(ip)) => {
- n += u8::from(AddressType::Ipv4).encode(writer)?;
- n += ip.octets().encode(writer)?;
+ u8::from(AddressType::Ipv4).encode(buf);
+ ip.octets().encode(buf);
}
HostName::Ip(net::IpAddr::V6(ip)) => {
- n += u8::from(AddressType::Ipv6).encode(writer)?;
- n += ip.octets().encode(writer)?;
+ u8::from(AddressType::Ipv6).encode(buf);
+ ip.octets().encode(buf);
}
HostName::Dns(ref dns) => {
- n += u8::from(AddressType::Dns).encode(writer)?;
- n += dns.encode(writer)?;
+ u8::from(AddressType::Dns).encode(buf);
+ dns.encode(buf);
}
HostName::Tor(addr) => {
- n += u8::from(AddressType::Onion).encode(writer)?;
- n += addr.encode(writer)?;
+ u8::from(AddressType::Onion).encode(buf);
+ addr.encode(buf);
}
_ => {
- return Err(io::ErrorKind::Unsupported.into());
+ unimplemented!(
+ "Encoding not defined for addresses of the same type as the following: {:?}",
+ self.host
+ );
}
}
- n += self.port().encode(writer)?;
-
- Ok(n)
+ self.port().encode(buf);
}
}
impl wire::Decode for Address {
- fn decode<R: std::io::Read + ?Sized>(reader: &mut R) -> Result<Self, wire::Error> {
- let addrtype = reader.read_u8()?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, wire::Error> {
+ let addrtype = buf.try_get_u8()?;
+
let host = match AddressType::try_from(addrtype) {
Ok(AddressType::Ipv4) => {
- let octets: [u8; 4] = wire::Decode::decode(reader)?;
+ let octets: [u8; 4] = wire::Decode::decode(buf)?;
let ip = net::Ipv4Addr::from(octets);
HostName::Ip(net::IpAddr::V4(ip))
}
Ok(AddressType::Ipv6) => {
- let octets: [u8; 16] = wire::Decode::decode(reader)?;
+ let octets: [u8; 16] = wire::Decode::decode(buf)?;
let ip = net::Ipv6Addr::from(octets);
HostName::Ip(net::IpAddr::V6(ip))
}
Ok(AddressType::Dns) => {
- let dns: String = wire::Decode::decode(reader)?;
+ let dns: String = wire::Decode::decode(buf)?;
HostName::Dns(dns)
}
Ok(AddressType::Onion) => {
- let onion: tor::OnionAddrV3 = wire::Decode::decode(reader)?;
+ let onion: tor::OnionAddrV3 = wire::Decode::decode(buf)?;
HostName::Tor(onion)
}
Err(other) => return Err(wire::Error::UnknownAddressType(other)),
};
- let port = u16::decode(reader)?;
+ let port = u16::decode(buf)?;
Ok(Self::from(NetAddr { host, port }))
}
}
impl wire::Encode for ZeroBytes {
- fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
- let mut n = (self.len() as u16).encode(writer)?;
- for _ in 0..self.len() {
- n += 0u8.encode(writer)?;
- }
- Ok(n)
+ fn encode(&self, buf: &mut impl BufMut) {
+ (self.len() as u16).encode(buf);
+ buf.put_bytes(0u8, self.len());
}
}
impl wire::Decode for ZeroBytes {
- fn decode<R: std::io::Read + ?Sized>(reader: &mut R) -> Result<Self, wire::Error> {
- let zeroes = u16::decode(reader)?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, wire::Error> {
+ let zeroes = u16::decode(buf)?;
for _ in 0..zeroes {
- _ = u8::decode(reader)?;
+ _ = u8::decode(buf)?;
}
Ok(ZeroBytes::new(zeroes))
}
@@ -508,40 +487,31 @@ mod tests {
#[test]
fn test_pingpong_encode_max_size() {
- let mut buf = Vec::new();
-
- let ping = Message::Ping(Ping {
+ wire::serialize(&Message::Ping(Ping {
ponglen: 0,
zeroes: ZeroBytes::new(Ping::MAX_PING_ZEROES),
- });
- ping.encode(&mut buf)
- .expect("ping should be within max message size");
+ }));
- let pong = Message::Pong {
+ wire::serialize(&Message::Pong {
zeroes: ZeroBytes::new(Ping::MAX_PONG_ZEROES),
- };
- pong.encode(&mut buf)
- .expect("pong should be within max message size");
+ });
}
#[test]
- fn test_pingpong_encode_size_overflow() {
- let ping = Message::Ping(Ping {
+ #[should_panic(expected = "advance out of bounds")]
+ fn test_ping_encode_size_overflow() {
+ wire::serialize(&Message::Ping(Ping {
ponglen: 0,
zeroes: ZeroBytes::new(Ping::MAX_PING_ZEROES + 1),
- });
-
- let mut buf = Vec::new();
- ping.encode(&mut buf)
- .expect_err("ping should exceed max message size");
+ }));
+ }
- let pong = Message::Pong {
+ #[test]
+ #[should_panic(expected = "advance out of bounds")]
+ fn test_pong_encode_size_overflow() {
+ wire::serialize(&Message::Pong {
zeroes: ZeroBytes::new(Ping::MAX_PONG_ZEROES + 1),
- };
-
- let mut buf = Vec::new();
- pong.encode(&mut buf)
- .expect_err("pong should exceed max message size");
+ });
}
#[quickcheck]
@@ -558,7 +528,7 @@ mod tests {
let mut decoder = Deserializer::<1048576, Message>::new(8);
for item in &items {
- item.encode(&mut decoder).unwrap();
+ item.encode(&mut decoder);
}
for item in items {
assert_eq!(decoder.next().unwrap().unwrap(), item);
@@ -570,12 +540,24 @@ mod tests {
.quickcheck(property as fn(items: Vec<Message>));
}
- #[quickcheck]
- fn prop_zero_bytes_encode_decode(zeroes: ZeroBytes) {
- assert_eq!(
- wire::deserialize::<ZeroBytes>(&wire::serialize(&zeroes)).unwrap(),
- zeroes
- );
+ #[test]
+ fn prop_zero_bytes_encode_decode() {
+ fn property(zeroes: wire::Size) {
+ if zeroes > Ping::MAX_PING_ZEROES {
+ return;
+ }
+
+ let zeroes = ZeroBytes::new(zeroes);
+
+ assert_eq!(
+ wire::deserialize::<ZeroBytes>(&wire::serialize(&zeroes)).unwrap(),
+ zeroes
+ );
+ }
+
+ qcheck::QuickCheck::new()
+ .gen(qcheck::Gen::new(16))
+ .quickcheck(property as fn(zeroes: wire::Size));
}
#[quickcheck]
diff --git a/crates/radicle-protocol/src/wire/varint.rs b/crates/radicle-protocol/src/wire/varint.rs
index 0a27e863f..eaf3daa4f 100644
--- a/crates/radicle-protocol/src/wire/varint.rs
+++ b/crates/radicle-protocol/src/wire/varint.rs
@@ -3,9 +3,9 @@
// This implementation is largely based on the `quinn` crate.
// Copyright (c) 2018 The quinn developers.
-use std::{fmt, io, ops};
+use std::{fmt, ops};
-use byteorder::ReadBytesExt;
+use bytes::{Buf, BufMut};
use thiserror::Error;
use crate::wire;
@@ -44,6 +44,10 @@ impl VarInt {
Err(BoundsExceeded)
}
}
+
+ pub fn new_unchecked(x: u64) -> Self {
+ Self(x)
+ }
}
impl ops::Deref for VarInt {
@@ -98,27 +102,27 @@ impl fmt::Display for VarInt {
pub struct BoundsExceeded;
impl Decode for VarInt {
- fn decode<R: io::Read + ?Sized>(r: &mut R) -> Result<Self, wire::Error> {
- let mut buf = [0; 8];
- buf[0] = r.read_u8()?;
+ fn decode(buf: &mut impl Buf) -> Result<Self, wire::Error> {
+ let mut tmp = [0; 8];
+ tmp[0] = buf.try_get_u8()?;
// Integer length.
- let tag = buf[0] >> 6;
- buf[0] &= 0b0011_1111;
+ let tag = tmp[0] >> 6;
+ tmp[0] &= 0b0011_1111;
let x = match tag {
- 0b00 => u64::from(buf[0]),
+ 0b00 => u64::from(tmp[0]),
0b01 => {
- r.read_exact(&mut buf[1..2])?;
- u64::from(u16::from_be_bytes([buf[0], buf[1]]))
+ buf.try_copy_to_slice(&mut tmp[1..2])?;
+ u64::from(u16::from_be_bytes([tmp[0], tmp[1]]))
}
0b10 => {
- r.read_exact(&mut buf[1..4])?;
- u64::from(u32::from_be_bytes([buf[0], buf[1], buf[2], buf[3]]))
+ buf.try_copy_to_slice(&mut tmp[1..4])?;
+ u64::from(u32::from_be_bytes([tmp[0], tmp[1], tmp[2], tmp[3]]))
}
0b11 => {
- r.read_exact(&mut buf[1..8])?;
- u64::from_be_bytes(buf)
+ buf.try_copy_to_slice(&mut tmp[1..8])?;
+ u64::from_be_bytes(tmp)
}
// SAFETY: It should be obvious that we can't have any other bit pattern
// than the above, since all other bits are zeroed.
@@ -129,7 +133,7 @@ impl Decode for VarInt {
}
impl Encode for VarInt {
- fn encode<W: io::Write + ?Sized>(&self, w: &mut W) -> io::Result<usize> {
+ fn encode(&self, w: &mut impl BufMut) {
let x: u64 = self.0;
if x < 2u64.pow(6) {
@@ -151,25 +155,19 @@ pub mod payload {
use super::*;
/// Encode varint-prefixed data payload.
- pub fn encode<W: io::Write + ?Sized>(payload: &[u8], writer: &mut W) -> io::Result<usize> {
- let mut n = 0;
+ pub fn encode(payload: &[u8], buf: &mut impl BufMut) {
let len = payload.len();
- let varint =
- VarInt::new(len as u64).map_err(|_| io::Error::from(io::ErrorKind::InvalidInput))?;
-
- n += varint.encode(writer)?; // The length of the payload length.
- n += len; // The length of the data payload itself.
-
- writer.write_all(payload)?;
+ let varint = VarInt::new_unchecked(len as u64);
- Ok(n)
+ varint.encode(buf); // The length of the payload length.
+ buf.put_slice(payload);
}
/// Decode varint-prefixed data payload.
- pub fn decode<R: io::Read + ?Sized>(reader: &mut R) -> Result<Vec<u8>, wire::Error> {
- let size = VarInt::decode(reader)?;
+ pub fn decode(buf: &mut impl Buf) -> Result<Vec<u8>, wire::Error> {
+ let size = VarInt::decode(buf)?;
let mut data = vec![0; *size as usize];
- reader.read_exact(&mut data[..])?;
+ buf.try_copy_to_slice(&mut data[..])?;
Ok(data)
}
diff --git a/crates/radicle-ssh/Cargo.toml b/crates/radicle-ssh/Cargo.toml
index b16fe4028..a5a9d60fb 100644
--- a/crates/radicle-ssh/Cargo.toml
+++ b/crates/radicle-ssh/Cargo.toml
@@ -14,7 +14,7 @@ edition.workspace = true
rust-version.workspace = true
[dependencies]
-byteorder = { workspace = true }
+byteorder = "1.4"
log = { workspace = true }
thiserror = { workspace = true }
zeroize = { workspace = true }
commit 1c20f64a26641ecb7777567b9661599d92757e08
Author: Lorenz Leutgeb <lorenz.leutgeb@radicle.xyz>
Date: Fri Jun 20 10:01:58 2025 +0200
node, protocol: Refactor
Mostly changes of `use`s and moving components to `radicle-protocol`,
with the goal of just getting `radicle-node` to work on top of the new
`radicle-protocol` crate.
diff --git a/Cargo.lock b/Cargo.lock
index a05294e6e..b81bb3514 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2679,21 +2679,13 @@ dependencies = [
name = "radicle-protocol"
version = "0.1.0"
dependencies = [
- "amplify",
- "anyhow",
"bloomy",
"byteorder",
- "chrono",
- "colored",
"crossbeam-channel",
"cyphernet",
"fastrand",
- "io-reactor",
- "lexopt",
- "libc",
"localtime",
"log",
- "netservices",
"nonempty 0.9.0",
"qcheck",
"qcheck-macros",
@@ -2704,10 +2696,7 @@ dependencies = [
"scrypt",
"serde",
"serde_json",
- "snapbox",
- "socket2",
"sqlite",
- "tempfile",
"thiserror 1.0.69",
]
diff --git a/crates/radicle-cli/tests/commands.rs b/crates/radicle-cli/tests/commands.rs
index 60b13a420..b0ff852fe 100644
--- a/crates/radicle-cli/tests/commands.rs
+++ b/crates/radicle-cli/tests/commands.rs
@@ -7,6 +7,8 @@ use radicle::node;
use radicle::node::address::Store as _;
use radicle::node::config::seeds::RADICLE_NODE_BOOTSTRAP_IRIS;
use radicle::node::config::DefaultSeedingPolicy;
+use radicle::node::events::Event;
+use radicle::node::policy::Scope;
use radicle::node::routing::Store as _;
use radicle::node::UserAgent;
use radicle::node::{Address, Alias, Config, Handle as _, DEFAULT_TIMEOUT};
@@ -16,8 +18,6 @@ use radicle::profile::Home;
use radicle::storage::{ReadStorage, RefUpdate, RemoteRepository};
use radicle::test::fixtures;
-use radicle_node::service::policy::Scope;
-use radicle_node::service::Event;
#[allow(unused_imports)]
use radicle_node::test::logger;
use radicle_node::test::node::Node;
diff --git a/crates/radicle-node/Cargo.toml b/crates/radicle-node/Cargo.toml
index e2e084bf2..ce05ef47a 100644
--- a/crates/radicle-node/Cargo.toml
+++ b/crates/radicle-node/Cargo.toml
@@ -12,7 +12,7 @@ rust-version.workspace = true
[features]
default = ["systemd"]
systemd = ["dep:radicle-systemd"]
-test = ["radicle/test", "radicle-crypto/test", "radicle-crypto/cyphernet", "qcheck", "snapbox"]
+test = ["radicle/test", "radicle-crypto/test", "radicle-crypto/cyphernet", "radicle-protocol/test", "qcheck", "snapbox"]
[dependencies]
amplify = { workspace = true }
diff --git a/crates/radicle-node/src/control.rs b/crates/radicle-node/src/control.rs
index fb7896670..6c79eee0b 100644
--- a/crates/radicle-node/src/control.rs
+++ b/crates/radicle-node/src/control.rs
@@ -246,9 +246,9 @@ mod tests {
use super::*;
use crate::identity::RepoId;
+ use crate::node::policy::Scope;
use crate::node::Handle;
use crate::node::{Alias, Node, NodeId};
- use crate::service::policy::Scope;
use crate::test;
#[test]
diff --git a/crates/radicle-node/src/lib.rs b/crates/radicle-node/src/lib.rs
index 269a63e7d..4e9fbfbe5 100644
--- a/crates/radicle-node/src/lib.rs
+++ b/crates/radicle-node/src/lib.rs
@@ -3,11 +3,12 @@
// suggestions did not make sense.
#![allow(clippy::byte_char_slices)]
-pub mod bounded;
+use std::str::FromStr;
+use std::sync::LazyLock;
+
pub mod control;
-pub mod deserializer;
pub mod runtime;
-pub mod service;
+pub(crate) use radicle_protocol::service;
#[cfg(any(test, feature = "test"))]
pub mod test;
#[cfg(test)]
@@ -18,7 +19,8 @@ pub mod worker;
use radicle::version::Version;
pub use localtime::{LocalDuration, LocalTime};
-pub use netservices::Direction as Link;
+pub use radicle::node::Link;
+pub use radicle::node::UserAgent;
pub use radicle::node::PROTOCOL_VERSION;
pub use radicle::prelude::Timestamp;
pub use radicle::{collections, crypto, git, identity, node, profile, rad, storage};
@@ -32,14 +34,18 @@ pub const VERSION: Version = Version {
timestamp: env!("SOURCE_DATE_EPOCH"),
};
+/// This node's user agent string.
+pub static USER_AGENT: LazyLock<UserAgent> = LazyLock::new(|| {
+ FromStr::from_str(format!("/radicle:{}/", VERSION.version).as_str())
+ .expect("user agent is valid")
+});
+
pub mod prelude {
- pub use crate::bounded::BoundedVec;
pub use crate::crypto::{PublicKey, Signature};
- pub use crate::deserializer::Deserializer;
pub use crate::identity::{Did, RepoId};
- pub use crate::node::Address;
+ pub use crate::node::{config::Network, Address, Event, NodeId};
pub use crate::service::filter::Filter;
- pub use crate::service::{DisconnectReason, Event, Message, Network, NodeId};
+ pub use crate::service::{DisconnectReason, Message};
pub use crate::storage::refs::Refs;
pub use crate::storage::WriteStorage;
pub use crate::{LocalDuration, LocalTime, Timestamp};
diff --git a/crates/radicle-node/src/runtime.rs b/crates/radicle-node/src/runtime.rs
index ad2d5cc18..2aa4c598c 100644
--- a/crates/radicle-node/src/runtime.rs
+++ b/crates/radicle-node/src/runtime.rs
@@ -21,6 +21,8 @@ use radicle::node;
use radicle::node::address;
use radicle::node::address::Store as _;
use radicle::node::notifications;
+use radicle::node::policy::config as policy;
+use radicle::node::Event;
use radicle::node::Handle as _;
use radicle::node::UserAgent;
use radicle::profile::Home;
@@ -29,7 +31,7 @@ use radicle::{cob, git, storage, Storage};
use crate::control;
use crate::node::{routing, NodeId};
use crate::service::message::NodeAnnouncement;
-use crate::service::{gossip, policy, Event, INITIAL_SUBSCRIBE_BACKLOG_DELTA};
+use crate::service::{gossip, INITIAL_SUBSCRIBE_BACKLOG_DELTA};
use crate::wire;
use crate::wire::{Decode, Wire};
use crate::worker;
@@ -117,7 +119,7 @@ impl Runtime {
/// This function spawns threads.
pub fn init<G>(
home: Home,
- config: service::Config,
+ config: radicle::node::Config,
listen: Vec<net::SocketAddr>,
signals: chan::Receiver<Signal>,
signer: Device<G>,
diff --git a/crates/radicle-node/src/runtime/handle.rs b/crates/radicle-node/src/runtime/handle.rs
index 5721a5aa2..cfc94ec00 100644
--- a/crates/radicle-node/src/runtime/handle.rs
+++ b/crates/radicle-node/src/runtime/handle.rs
@@ -5,8 +5,10 @@ use std::sync::Arc;
use std::{fmt, io, time};
use crossbeam_channel as chan;
+use radicle::node::events::{Event, Events};
+use radicle::node::policy;
+use radicle::node::{Config, NodeId};
use radicle::node::{ConnectOptions, ConnectResult, Seeds};
-use radicle::storage::refs::RefsAt;
use reactor::poller::popol::PopolWaker;
use serde_json::json;
use thiserror::Error;
@@ -16,10 +18,8 @@ use crate::node::{Alias, Command, FetchResult};
use crate::profile::Home;
use crate::runtime::Emitter;
use crate::service;
-use crate::service::policy;
-use crate::service::NodeId;
-use crate::service::{CommandError, Config, QueryState};
-use crate::service::{Event, Events};
+use crate::service::{CommandError, QueryState};
+use crate::storage::refs::RefsAt;
use crate::wire;
use crate::wire::StreamId;
use crate::worker::TaskResult;
diff --git a/crates/radicle-node/src/test.rs b/crates/radicle-node/src/test.rs
index e42258317..87500a360 100644
--- a/crates/radicle-node/src/test.rs
+++ b/crates/radicle-node/src/test.rs
@@ -1,4 +1,3 @@
-pub mod arbitrary;
pub mod gossip;
pub mod handle;
pub mod node;
diff --git a/crates/radicle-node/src/test/arbitrary.rs b/crates/radicle-node/src/test/arbitrary.rs
deleted file mode 100644
index 197288958..000000000
--- a/crates/radicle-node/src/test/arbitrary.rs
+++ /dev/null
@@ -1,142 +0,0 @@
-use std::collections::HashSet;
-
-use bloomy::BloomFilter;
-use qcheck::Arbitrary;
-use radicle::node::UserAgent;
-
-use crate::crypto;
-use crate::identity::DocAt;
-use crate::node::Alias;
-use crate::prelude::{BoundedVec, NodeId, RepoId, Timestamp};
-use crate::service::filter::{Filter, FILTER_SIZE_L, FILTER_SIZE_M, FILTER_SIZE_S};
-use crate::service::message::{
- Announcement, Info, InventoryAnnouncement, Message, NodeAnnouncement, Ping, RefsAnnouncement,
- Subscribe, ZeroBytes,
-};
-use crate::wire::MessageType;
-use crate::worker::fetch::FetchResult;
-
-pub use radicle::test::arbitrary::*;
-
-impl Arbitrary for Filter {
- fn arbitrary(g: &mut qcheck::Gen) -> Self {
- let size = *g
- .choose(&[FILTER_SIZE_S, FILTER_SIZE_M, FILTER_SIZE_L])
- .unwrap();
- let mut bytes = vec![0; size];
- for _ in 0..64 {
- let index = usize::arbitrary(g) % bytes.len();
- bytes[index] = u8::arbitrary(g);
- }
- Self::from(BloomFilter::from(bytes))
- }
-}
-
-impl Arbitrary for FetchResult {
- fn arbitrary(g: &mut qcheck::Gen) -> Self {
- FetchResult {
- updated: vec![],
- namespaces: HashSet::arbitrary(g),
- clone: bool::arbitrary(g),
- doc: DocAt::arbitrary(g),
- }
- }
-}
-
-impl Arbitrary for Message {
- fn arbitrary(g: &mut qcheck::Gen) -> Self {
- let type_id = g
- .choose(&[
- MessageType::InventoryAnnouncement,
- MessageType::NodeAnnouncement,
- MessageType::RefsAnnouncement,
- MessageType::Info,
- MessageType::Subscribe,
- MessageType::Ping,
- MessageType::Pong,
- ])
- .unwrap();
-
- match type_id {
- MessageType::InventoryAnnouncement => Announcement {
- node: NodeId::arbitrary(g),
- message: InventoryAnnouncement {
- inventory: BoundedVec::arbitrary(g),
- timestamp: Timestamp::arbitrary(g),
- }
- .into(),
- signature: crypto::Signature::from(<[u8; 64]>::arbitrary(g)),
- }
- .into(),
- MessageType::RefsAnnouncement => Announcement {
- node: NodeId::arbitrary(g),
- message: RefsAnnouncement {
- rid: RepoId::arbitrary(g),
- refs: BoundedVec::arbitrary(g),
- timestamp: Timestamp::arbitrary(g),
- }
- .into(),
- signature: crypto::Signature::from(<[u8; 64]>::arbitrary(g)),
- }
- .into(),
- MessageType::NodeAnnouncement => {
- let message = NodeAnnouncement {
- version: u8::arbitrary(g),
- features: u64::arbitrary(g).into(),
- timestamp: Timestamp::arbitrary(g),
- alias: Alias::arbitrary(g),
- addresses: Arbitrary::arbitrary(g),
- nonce: u64::arbitrary(g),
- agent: UserAgent::arbitrary(g),
- }
- .into();
- let bytes: [u8; 64] = Arbitrary::arbitrary(g);
- let signature = crypto::Signature::from(bytes);
-
- Announcement {
- node: NodeId::arbitrary(g),
- signature,
- message,
- }
- .into()
- }
- MessageType::Info => {
- let message = Info::RefsAlreadySynced {
- rid: RepoId::arbitrary(g),
- at: oid(),
- };
- Self::Info(message)
- }
- MessageType::Subscribe => Self::Subscribe(Subscribe {
- filter: Filter::arbitrary(g),
- since: Timestamp::arbitrary(g),
- until: Timestamp::arbitrary(g),
- }),
- MessageType::Ping => {
- let mut rng = fastrand::Rng::with_seed(u64::arbitrary(g));
-
- Self::Ping(Ping::new(&mut rng))
- }
- MessageType::Pong => Self::Pong {
- zeroes: ZeroBytes::new(u16::arbitrary(g).min(Ping::MAX_PONG_ZEROES)),
- },
- }
- }
-}
-
-impl Arbitrary for ZeroBytes {
- fn arbitrary(g: &mut qcheck::Gen) -> Self {
- ZeroBytes::new(u16::arbitrary(g))
- }
-}
-
-impl<T, const N: usize> Arbitrary for BoundedVec<T, N>
-where
- T: Arbitrary + Eq,
-{
- fn arbitrary(g: &mut qcheck::Gen) -> Self {
- let mut v: Vec<T> = Arbitrary::arbitrary(g);
- v.truncate(N);
- v.try_into().expect("size within bounds")
- }
-}
diff --git a/crates/radicle-node/src/test/environment.rs b/crates/radicle-node/src/test/environment.rs
index a68d11ce3..edf98c134 100644
--- a/crates/radicle-node/src/test/environment.rs
+++ b/crates/radicle-node/src/test/environment.rs
@@ -19,8 +19,10 @@ use radicle::git::refname;
use radicle::identity::{RepoId, Visibility};
use radicle::node::config::ConnectAddress;
use radicle::node::device::Device;
+use radicle::node::events::Event;
use radicle::node::policy::store as policy;
use radicle::node::seed::Store as _;
+pub use radicle::node::Config;
use radicle::node::{Alias, Database, UserAgent, POLICIES_DB_FILE};
use radicle::node::{ConnectOptions, Handle as _};
use radicle::profile;
@@ -34,12 +36,9 @@ use radicle::{cob, explorer};
use radicle::{git, web};
use crate::node::NodeId;
-use crate::service::Event;
use crate::storage::git::transport;
use crate::{runtime, runtime::Handle, service, Runtime};
-pub use service::Config;
-
/// Test environment.
pub struct Environment {
tempdir: tempfile::TempDir,
diff --git a/crates/radicle-node/src/test/handle.rs b/crates/radicle-node/src/test/handle.rs
index e37290c0d..10ff46f8a 100644
--- a/crates/radicle-node/src/test/handle.rs
+++ b/crates/radicle-node/src/test/handle.rs
@@ -9,8 +9,8 @@ use radicle::storage::refs::RefsAt;
use crate::identity::RepoId;
use crate::node::{Alias, Config, ConnectOptions, ConnectResult, Event, FetchResult, Seeds};
use crate::runtime::HandleError;
-use crate::service::policy;
-use crate::service::NodeId;
+use radicle::node::policy;
+use radicle::node::NodeId;
#[derive(Default, Clone)]
pub struct Handle {
diff --git a/crates/radicle-node/src/test/node.rs b/crates/radicle-node/src/test/node.rs
index e583db75d..5de098d31 100644
--- a/crates/radicle-node/src/test/node.rs
+++ b/crates/radicle-node/src/test/node.rs
@@ -22,6 +22,7 @@ use radicle::node::config::ConnectAddress;
use radicle::node::policy::store as policy;
use radicle::node::seed::Store as _;
use radicle::node::Config;
+use radicle::node::Event;
use radicle::node::{self, Alias};
use radicle::node::{ConnectOptions, Handle as _};
use radicle::node::{Database, POLICIES_DB_FILE};
@@ -33,7 +34,6 @@ use radicle::Storage;
use crate::node::device::Device;
use crate::node::NodeId;
-use crate::service::Event;
use crate::storage::git::transport;
use crate::{runtime, runtime::Handle, service, Runtime};
diff --git a/crates/radicle-node/src/test/peer.rs b/crates/radicle-node/src/test/peer.rs
index a1eaf873e..59ffe1e82 100644
--- a/crates/radicle-node/src/test/peer.rs
+++ b/crates/radicle-node/src/test/peer.rs
@@ -28,7 +28,6 @@ use crate::runtime::Emitter;
use crate::service;
use crate::service::io::Io;
use crate::service::message::*;
-use crate::service::policy::{Scope, SeedingPolicy};
use crate::service::*;
use crate::storage::git::transport::remote;
use crate::storage::{RemoteId, WriteStorage};
@@ -36,6 +35,10 @@ use crate::test::storage::MockStorage;
use crate::test::{arbitrary, fixtures, simulator};
use crate::wire::MessageType;
use crate::{Link, LocalDuration, LocalTime, PROTOCOL_VERSION};
+use radicle::node::events::Events;
+use radicle::node::policy::config as policy;
+use radicle::node::policy::{Scope, SeedingPolicy};
+use radicle_protocol::bounded::BoundedVec;
/// Service instantiation used for testing.
pub type Service<S, G> = service::Service<Database, S, G>;
@@ -100,7 +103,7 @@ where
}
pub struct Config<G: crypto::signature::Signer<crypto::Signature> + 'static> {
- pub config: service::Config,
+ pub config: radicle::node::Config,
pub local_time: LocalTime,
pub policy: SeedingPolicy,
pub signer: Device<G>,
@@ -113,7 +116,7 @@ impl Default for Config<MockSigner> {
let mut rng = fastrand::Rng::new();
let signer = Device::mock_rng(&mut rng);
let tmp = tempfile::TempDir::new().unwrap();
- let config = service::Config::test(Alias::from_str("mocky").unwrap());
+ let config = radicle::node::Config::test(Alias::from_str("mocky").unwrap());
Config {
config,
diff --git a/crates/radicle-node/src/test/simulator.rs b/crates/radicle-node/src/test/simulator.rs
index 2f1648f9b..5ee1dff4e 100644
--- a/crates/radicle-node/src/test/simulator.rs
+++ b/crates/radicle-node/src/test/simulator.rs
@@ -13,16 +13,19 @@ use std::{fmt, io, net};
use localtime::{LocalDuration, LocalTime};
use log::*;
+use radicle::node::events::Event;
+use radicle::node::NodeId;
+use radicle_protocol::worker::FetchError;
use crate::crypto;
use crate::prelude::{Address, RepoId};
use crate::service::io::Io;
-use crate::service::{DisconnectReason, Event, Message, Metrics, NodeId};
+use crate::service::{DisconnectReason, Message, Metrics};
use crate::storage::Namespaces;
use crate::storage::{ReadRepository, WriteStorage};
use crate::test::arbitrary;
use crate::test::peer::Service;
-use crate::worker::{fetch, FetchError};
+use crate::worker::fetch;
use crate::Link;
/// Minimum latency between peers.
diff --git a/crates/radicle-node/src/tests.rs b/crates/radicle-node/src/tests.rs
index 1bd4290f1..82e5e83fa 100644
--- a/crates/radicle-node/src/tests.rs
+++ b/crates/radicle-node/src/tests.rs
@@ -9,17 +9,19 @@ use std::sync::LazyLock;
use std::time;
use crossbeam_channel as chan;
-use netservices::Direction as Link;
use radicle::identity::Visibility;
use radicle::node::address::Store as _;
use radicle::node::device::Device;
+use radicle::node::policy;
use radicle::node::refs::Store as _;
use radicle::node::routing::Store as _;
+use radicle::node::Link;
use radicle::node::{ConnectOptions, DEFAULT_TIMEOUT};
use radicle::storage::refs::RefsAt;
use radicle::storage::RefUpdate;
use radicle::test::arbitrary::gen;
use radicle::test::storage::MockRepository;
+use radicle_protocol::bounded::BoundedVec;
use crate::collections::{RandomMap, RandomSet};
use crate::identity::RepoId;
@@ -49,7 +51,6 @@ use crate::test::simulator::{Peer as _, Simulation};
use crate::test::storage::MockStorage;
use crate::wire::Decode;
use crate::wire::Encode;
-use crate::worker;
use crate::worker::fetch;
use crate::LocalTime;
use crate::{git, identity, rad, runtime, service, test};
@@ -1462,7 +1463,7 @@ fn test_fetch_missing_inventory_on_schedule() {
alice.fetched(
rid,
bob.id,
- Err(worker::FetchError::Io(
+ Err(radicle_protocol::worker::FetchError::Io(
io::ErrorKind::ConnectionReset.into(),
)),
);
@@ -1806,7 +1807,7 @@ fn test_init_and_seed() {
.find(|e| {
matches!(
e,
- service::Event::RefsFetched { remote, .. }
+ radicle::node::events::Event::RefsFetched { remote, .. }
if *remote == eve.node_id()
)
})
diff --git a/crates/radicle-node/src/tests/e2e.rs b/crates/radicle-node/src/tests/e2e.rs
index 6b0d17c35..ff25dbb66 100644
--- a/crates/radicle-node/src/tests/e2e.rs
+++ b/crates/radicle-node/src/tests/e2e.rs
@@ -1,6 +1,8 @@
use std::{collections::HashSet, thread, time};
use radicle::node::device::Device;
+use radicle::node::policy::Scope;
+use radicle::node::Event;
use radicle::node::{Alias, ConnectResult, FetchResult, Handle as _, DEFAULT_TIMEOUT};
use radicle::storage::{
ReadRepository, ReadStorage, RefUpdate, RemoteRepository, SignRepository, ValidateRepository,
@@ -13,7 +15,6 @@ use radicle::{git, issue};
use crate::node::config::Limits;
use crate::node::{Config, ConnectOptions};
use crate::service;
-use crate::service::policy::Scope;
use crate::storage::git::transport;
use crate::test::logger;
use crate::test::node::{converge, Node};
@@ -688,8 +689,7 @@ fn test_large_fetch() {
bob_events
.wait(
|e| {
- matches!(e, service::Event::RefsFetched { updated, .. } if !updated.is_empty())
- .then_some(())
+ matches!(e, Event::RefsFetched { updated, .. } if !updated.is_empty()).then_some(())
},
time::Duration::from_secs(9 * scale as u64),
)
@@ -717,7 +717,7 @@ fn test_concurrent_fetches() {
let mut alice_repos = HashSet::new();
let mut alice = Node::init(
tmp.path(),
- service::Config {
+ radicle::node::config::Config {
limits: limits.clone(),
relay: radicle::node::config::Relay::Always,
..config::relay("alice")
@@ -725,7 +725,7 @@ fn test_concurrent_fetches() {
);
let mut bob = Node::init(
tmp.path(),
- service::Config {
+ radicle::node::config::Config {
limits,
relay: radicle::node::config::Relay::Always,
..config::relay("bob")
@@ -766,7 +766,7 @@ fn test_concurrent_fetches() {
while !bob_repos.is_empty() {
match alice_events.recv().unwrap() {
- service::Event::RefsFetched { rid, updated, .. } if !updated.is_empty() => {
+ Event::RefsFetched { rid, updated, .. } if !updated.is_empty() => {
bob_repos.remove(&rid);
log::debug!(target: "test", "{} fetched {rid} ({} left)",alice.id, bob_repos.len());
}
@@ -776,7 +776,7 @@ fn test_concurrent_fetches() {
while !alice_repos.is_empty() {
match bob_events.recv().unwrap() {
- service::Event::RefsFetched { rid, updated, .. } if !updated.is_empty() => {
+ Event::RefsFetched { rid, updated, .. } if !updated.is_empty() => {
alice_repos.remove(&rid);
log::debug!(target: "test", "{} fetched {rid} ({} left)", bob.id, alice_repos.len());
}
@@ -1255,8 +1255,7 @@ fn missing_delegate_default_branch() {
bob_events
.wait(
|e| {
- matches!(e, service::Event::RefsFetched { updated, .. } if !updated.is_empty())
- .then_some(())
+ matches!(e, Event::RefsFetched { updated, .. } if !updated.is_empty()).then_some(())
},
DEFAULT_TIMEOUT,
)
@@ -1416,7 +1415,7 @@ fn test_background_foreground_fetch() {
bob.handle.announce_refs(rid).unwrap();
alice_events
.wait(
- |e| matches!(e, service::Event::RefsAnnounced { .. }).then_some(()),
+ |e| matches!(e, Event::RefsAnnounced { .. }).then_some(()),
DEFAULT_TIMEOUT,
)
.unwrap();
diff --git a/crates/radicle-protocol/src/wire/protocol.rs b/crates/radicle-node/src/wire.rs
similarity index 98%
rename from crates/radicle-protocol/src/wire/protocol.rs
rename to crates/radicle-node/src/wire.rs
index 3b0f93749..4a3e05537 100644
--- a/crates/radicle-protocol/src/wire/protocol.rs
+++ b/crates/radicle-node/src/wire.rs
@@ -24,20 +24,22 @@ use reactor::{ResourceId, ResourceType, Timestamp};
use radicle::collections::RandomMap;
use radicle::crypto;
use radicle::node::config::AddressConfig;
+use radicle::node::Link;
use radicle::node::NodeId;
use radicle::storage::WriteStorage;
+use radicle_protocol::deserializer::Deserializer;
+pub use radicle_protocol::wire::frame;
+pub use radicle_protocol::wire::frame::{Frame, FrameData, StreamId};
+pub use radicle_protocol::wire::*;
+use radicle_protocol::worker::{FetchRequest, FetchResult};
-use crate::prelude::Deserializer;
use crate::service;
use crate::service::io::Io;
use crate::service::FETCH_TIMEOUT;
use crate::service::{session, DisconnectReason, Metrics, Service};
-use crate::wire::frame;
-use crate::wire::frame::{Frame, FrameData, StreamId};
-use crate::wire::Encode;
use crate::worker;
-use crate::worker::{ChannelEvent, ChannelsConfig, FetchRequest, FetchResult, Task, TaskResult};
-use crate::Link;
+use crate::worker::{ChannelEvent, ChannelsConfig};
+use crate::worker::{Task, TaskResult};
/// NoiseXK handshake pattern.
pub const NOISE_XK: HandshakePattern = HandshakePattern {
@@ -573,7 +575,10 @@ where
return;
}
};
- let transport = match NetTransport::with_session(session, Link::Inbound) {
+ let transport = match NetTransport::with_session(
+ session,
+ netservices::Direction::Inbound,
+ ) {
Ok(transport) => transport,
Err(err) => {
log::error!(target: "wire", "Failed to create transport for accepted connection: {err}");
@@ -1024,7 +1029,10 @@ where
self.service.config(),
)
.and_then(|session| {
- NetTransport::<WireSession<G>>::with_session(session, Link::Outbound)
+ NetTransport::<WireSession<G>>::with_session(
+ session,
+ netservices::Direction::Outbound,
+ )
}) {
Ok(transport) => {
self.outbound.insert(
@@ -1134,7 +1142,7 @@ pub fn dial<G: Ecdh<Pk = NodeId>>(
remote_addr: NetAddr<HostName>,
remote_id: <G as EcSk>::Pk,
signer: G,
- config: &service::Config,
+ config: &radicle::node::Config,
) -> io::Result<WireSession<G>> {
// Determine what address to establish a TCP connection with, given the remote peer
// address and our node configuration.
@@ -1248,7 +1256,7 @@ mod test {
#[test]
fn test_pong_message_with_extension() {
- use crate::deserializer;
+ use radicle_protocol::deserializer;
let mut stream = Vec::new();
let pong = Message::Pong {
@@ -1281,7 +1289,7 @@ mod test {
#[test]
fn test_inventory_ann_with_extension() {
- use crate::deserializer;
+ use radicle_protocol::deserializer;
#[derive(Debug)]
struct MessageWithExt {
diff --git a/crates/radicle-node/src/worker.rs b/crates/radicle-node/src/worker.rs
index 2a24bd523..721cc8059 100644
--- a/crates/radicle-node/src/worker.rs
+++ b/crates/radicle-node/src/worker.rs
@@ -5,22 +5,25 @@ mod upload_pack;
pub mod fetch;
pub mod garbage;
-use std::io;
use std::path::PathBuf;
use crossbeam_channel as chan;
use radicle::identity::RepoId;
-use radicle::node::{notifications, Event};
+use radicle::node::notifications;
+use radicle::node::policy::config as policy;
+use radicle::node::policy::config::SeedingPolicy;
use radicle::prelude::NodeId;
use radicle::storage::refs::RefsAt;
use radicle::storage::{ReadRepository, ReadStorage};
use radicle::{cob, crypto, Storage};
use radicle_fetch::FetchLimit;
-use crate::runtime::{thread, Emitter, Handle};
-use crate::service::policy;
-use crate::service::policy::SeedingPolicy;
+pub use radicle_protocol::worker::{
+ AuthorizationError, FetchError, FetchRequest, FetchResult, UploadError,
+};
+
+use crate::runtime::{thread, Handle};
use crate::wire::StreamId;
pub use channels::{ChannelEvent, Channels, ChannelsConfig};
@@ -39,110 +42,6 @@ pub struct Config {
pub policies_db: PathBuf,
}
-/// Error returned by fetch.
-#[derive(thiserror::Error, Debug)]
-pub enum FetchError {
- #[error("the 'git fetch' command failed with exit code '{code}'")]
- CommandFailed { code: i32 },
- #[error(transparent)]
- Io(#[from] io::Error),
- #[error(transparent)]
- Fetch(#[from] fetch::error::Fetch),
- #[error(transparent)]
- Handle(#[from] fetch::error::Handle),
- #[error(transparent)]
- Storage(#[from] radicle::storage::Error),
- #[error(transparent)]
- PolicyStore(#[from] radicle::node::policy::store::Error),
- #[error(transparent)]
- Policy(#[from] radicle_fetch::policy::error::Policy),
- #[error(transparent)]
- Blocked(#[from] radicle_fetch::policy::error::Blocked),
-}
-
-impl FetchError {
- /// Check if it's a timeout error.
- pub fn is_timeout(&self) -> bool {
- matches!(self, FetchError::Io(e) if e.kind() == io::ErrorKind::TimedOut)
- }
-}
-
-/// Error returned by fetch responder.
-#[derive(thiserror::Error, Debug)]
-pub enum UploadError {
- #[error("error parsing git command packet-line: {0}")]
- PacketLine(io::Error),
- #[error("error while performing git upload-pack: {0}")]
- UploadPack(io::Error),
- #[error(transparent)]
- Authorization(#[from] AuthorizationError),
-}
-
-#[derive(thiserror::Error, Debug)]
-pub enum AuthorizationError {
- #[error("{0} is not authorized to fetch {1}")]
- Unauthorized(NodeId, RepoId),
- #[error(transparent)]
- PolicyStore(#[from] radicle::node::policy::store::Error),
- #[error(transparent)]
- Repository(#[from] radicle::storage::RepositoryError),
-}
-
-impl UploadError {
- /// Check if it's an end-of-file error.
- pub fn is_eof(&self) -> bool {
- matches!(self, UploadError::UploadPack(e) if e.kind() == io::ErrorKind::UnexpectedEof)
- }
-}
-
-/// Fetch job sent to worker thread.
-#[derive(Debug, Clone)]
-pub enum FetchRequest {
- /// Client is initiating a fetch for the repository identified by
- /// `rid` from the peer identified by `remote`.
- Initiator {
- /// Repo to fetch.
- rid: RepoId,
- /// Remote peer we are interacting with.
- remote: NodeId,
- /// If this fetch is for a particular set of `rad/sigrefs`.
- refs_at: Option<Vec<RefsAt>>,
- },
- /// Server is responding to a fetch request by uploading the
- /// specified `refspecs` sent by the client.
- Responder {
- /// Remote peer we are interacting with.
- remote: NodeId,
- /// Reporter for upload-pack progress.
- emitter: Emitter<Event>,
- },
-}
-
-impl FetchRequest {
- pub fn remote(&self) -> NodeId {
- match self {
- Self::Initiator { remote, .. } | Self::Responder { remote, .. } => *remote,
- }
- }
-}
-
-/// Fetch result of an upload or fetch.
-#[derive(Debug)]
-pub enum FetchResult {
- Initiator {
- /// Repo fetched.
- rid: RepoId,
- /// Fetch result, including remotes fetched.
- result: Result<fetch::FetchResult, FetchError>,
- },
- Responder {
- /// Repo requested.
- rid: Option<RepoId>,
- /// Upload result.
- result: Result<(), UploadError>,
- },
-}
-
/// Task to be accomplished on a worker thread.
/// This is either going to be an outgoing or incoming fetch.
pub struct Task {
diff --git a/crates/radicle-node/src/worker/fetch.rs b/crates/radicle-node/src/worker/fetch.rs
index f3ae1f442..bd870dc67 100644
--- a/crates/radicle-node/src/worker/fetch.rs
+++ b/crates/radicle-node/src/worker/fetch.rs
@@ -1,6 +1,5 @@
-pub mod error;
+pub(crate) use radicle_protocol::worker::fetch::error;
-use std::collections::HashSet;
use std::str::FromStr;
use localtime::LocalTime;
@@ -8,7 +7,6 @@ use localtime::LocalTime;
use radicle::cob::TypedId;
use radicle::crypto::PublicKey;
use radicle::identity::crefs::GetCanonicalRefs as _;
-use radicle::identity::DocAt;
use radicle::prelude::NodeId;
use radicle::prelude::RepoId;
use radicle::storage::git::Repository;
@@ -20,32 +18,10 @@ use radicle::storage::{
use radicle::{cob, git, node, Storage};
use radicle_fetch::git::refs::Applied;
use radicle_fetch::{Allowed, BlockList, FetchLimit};
+pub use radicle_protocol::worker::fetch::FetchResult;
use super::channels::ChannelsFlush;
-#[derive(Debug, Clone)]
-pub struct FetchResult {
- /// The set of updated references.
- pub updated: Vec<RefUpdate>,
- /// The set of remote namespaces that were updated.
- pub namespaces: HashSet<PublicKey>,
- /// The fetch was a full clone.
- pub clone: bool,
- /// Identity doc of fetched repo.
- pub doc: DocAt,
-}
-
-impl FetchResult {
- pub fn new(doc: DocAt) -> Self {
- Self {
- updated: vec![],
- namespaces: HashSet::new(),
- clone: false,
- doc,
- }
- }
-}
-
pub enum Handle {
Clone {
handle: radicle_fetch::Handle<ChannelsFlush>,
diff --git a/crates/radicle-protocol/Cargo.toml b/crates/radicle-protocol/Cargo.toml
index 8d0f5ecdd..6a3010731 100644
--- a/crates/radicle-protocol/Cargo.toml
+++ b/crates/radicle-protocol/Cargo.toml
@@ -9,24 +9,16 @@ edition.workspace = true
rust-version.workspace = true
[features]
-test = ["radicle/test", "radicle-crypto/test", "radicle-crypto/cyphernet", "qcheck", "snapbox"]
+test = ["radicle/test", "radicle-crypto/test", "radicle-crypto/cyphernet", "qcheck"]
[dependencies]
-amplify = { workspace = true }
-anyhow = { workspace = true }
bloomy = "1.2"
byteorder = { workspace = true }
-chrono = { workspace = true, features = ["clock"] }
-colored = { workspace = true }
crossbeam-channel = { workspace = true }
-cyphernet = { workspace = true, features = ["tor", "dns", "ed25519", "p2p-ed25519"] }
+cyphernet = { workspace = true, features = ["tor"] }
fastrand = { workspace = true }
-io-reactor = { version = "0.5.1", features = ["popol"] }
-lexopt = { workspace = true }
-libc = { workspace = true }
log = { workspace = true, features = ["std"] }
localtime = { workspace = true }
-netservices = { version = "0.8.0", features = ["io-reactor", "socket2"] }
nonempty = { workspace = true, features = ["serialize"] }
qcheck = { workspace = true, optional = true }
radicle = { workspace = true, features = ["logger"] }
@@ -36,9 +28,6 @@ sqlite = { workspace = true, features = ["bundled"] }
scrypt = { version = "0.11.0", default-features = false }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true, features = ["preserve_order"] }
-snapbox = { workspace = true, optional = true }
-socket2 = "0.5.7"
-tempfile = { workspace = true }
thiserror = { workspace = true }
[dev-dependencies]
@@ -46,4 +35,3 @@ qcheck = { workspace = true }
qcheck-macros = { workspace = true }
radicle = { workspace = true, features = ["test"] }
radicle-crypto = { workspace = true, features = ["test", "cyphernet"] }
-snapbox = { workspace = true }
diff --git a/crates/radicle-protocol/src/bounded.rs b/crates/radicle-protocol/src/bounded.rs
index 6b9b3c25d..e136bc315 100644
--- a/crates/radicle-protocol/src/bounded.rs
+++ b/crates/radicle-protocol/src/bounded.rs
@@ -239,3 +239,15 @@ impl<T: std::fmt::Debug, const N: usize> std::fmt::Debug for BoundedVec<T, N> {
self.v.fmt(f)
}
}
+
+#[cfg(any(test, feature = "test"))]
+impl<T, const N: usize> qcheck::Arbitrary for BoundedVec<T, N>
+where
+ T: qcheck::Arbitrary + Eq,
+{
+ fn arbitrary(g: &mut qcheck::Gen) -> Self {
+ let mut v: Vec<T> = qcheck::Arbitrary::arbitrary(g);
+ v.truncate(N);
+ v.try_into().expect("size within bounds")
+ }
+}
diff --git a/crates/radicle-node/src/deserializer.rs b/crates/radicle-protocol/src/deserializer.rs
similarity index 96%
rename from crates/radicle-node/src/deserializer.rs
rename to crates/radicle-protocol/src/deserializer.rs
index 3879a9c29..e75ddeaa1 100644
--- a/crates/radicle-node/src/deserializer.rs
+++ b/crates/radicle-protocol/src/deserializer.rs
@@ -2,7 +2,7 @@ use std::io;
use std::marker::PhantomData;
use crate::bounded;
-use crate::prelude::BoundedVec;
+use crate::bounded::BoundedVec;
use crate::service::message::Message;
use crate::wire;
@@ -104,7 +104,7 @@ mod test {
use super::*;
use qcheck_macros::quickcheck;
- use crate::test::assert_matches;
+ use radicle::assert_matches;
const MSG_HELLO: &[u8] = &[5, b'h', b'e', b'l', b'l', b'o'];
const MSG_BYE: &[u8] = &[3, b'b', b'y', b'e'];
@@ -117,11 +117,11 @@ mod test {
assert_matches!(decoder.deserialize_next(), Ok(None));
assert_eq!(decoder.unparsed.len(), 2);
- decoder.input(&[b'y']).unwrap();
+ decoder.input(b"y").unwrap();
assert_matches!(decoder.deserialize_next(), Ok(None));
assert_eq!(decoder.unparsed.len(), 3);
- decoder.input(&[b'e']).unwrap();
+ decoder.input(b"e").unwrap();
assert_matches!(decoder.deserialize_next(), Ok(Some(s)) if s.as_str() == "bye");
assert_eq!(decoder.unparsed.len(), 0);
assert!(decoder.is_empty());
diff --git a/crates/radicle-protocol/src/lib.rs b/crates/radicle-protocol/src/lib.rs
new file mode 100644
index 000000000..9c20f918e
--- /dev/null
+++ b/crates/radicle-protocol/src/lib.rs
@@ -0,0 +1,8 @@
+pub mod bounded;
+pub mod deserializer;
+pub mod service;
+pub mod wire;
+pub mod worker;
+
+/// Peer-to-peer protocol version.
+pub const PROTOCOL_VERSION: u8 = 1;
diff --git a/crates/radicle-protocol/src/service.rs b/crates/radicle-protocol/src/service.rs
index 663388b53..f2b53c312 100644
--- a/crates/radicle-protocol/src/service.rs
+++ b/crates/radicle-protocol/src/service.rs
@@ -38,32 +38,36 @@ use radicle::storage::refs::SIGREFS_BRANCH;
use radicle::storage::RepositoryError;
use radicle_fetch::policy::SeedingPolicy;
-use crate::identity::RepoId;
-use crate::node::routing;
-use crate::node::routing::InsertResult;
-use crate::node::{
- Address, Alias, Features, FetchResult, HostName, Seed, Seeds, SyncStatus, SyncedAt,
-};
-use crate::prelude::*;
-use crate::runtime::Emitter;
use crate::service::gossip::Store as _;
use crate::service::message::{
Announcement, AnnouncementMessage, Info, NodeAnnouncement, Ping, RefsAnnouncement, RefsStatus,
};
use crate::service::policy::{store::Write, Scope};
-use crate::storage;
-use crate::storage::{refs::RefsAt, Namespaces, ReadStorage};
-use crate::worker::fetch;
-use crate::worker::FetchError;
-use crate::Link;
-use crate::{crypto, PROTOCOL_VERSION};
-
-pub use crate::node::events::{Event, Events};
-pub use crate::node::{config::Network, Config, NodeId};
+use radicle::identity::RepoId;
+use radicle::node::events::Emitter;
+use radicle::node::routing;
+use radicle::node::routing::InsertResult;
+use radicle::node::{
+ Address, Alias, Features, FetchResult, HostName, Seed, Seeds, SyncStatus, SyncedAt,
+};
+use radicle::prelude::*;
+use radicle::storage;
+use radicle::storage::{refs::RefsAt, Namespaces, ReadStorage};
+// use radicle::worker::fetch;
+// use crate::worker::FetchError;
+use radicle::crypto;
+use radicle::node::Link;
+use radicle::node::PROTOCOL_VERSION;
+
+use crate::bounded::BoundedVec;
+use crate::service::filter::Filter;
pub use crate::service::message::{Message, ZeroBytes};
pub use crate::service::session::{QueuedFetch, Session};
+use crate::worker::FetchError;
+use radicle::node::events::{Event, Events};
+use radicle::node::{Config, NodeId};
-pub use radicle::node::policy::config as policy;
+use radicle::node::policy::config as policy;
use self::io::Outbox;
use self::limiter::RateLimiter;
@@ -221,7 +225,7 @@ pub trait Store:
{
}
-impl Store for node::Database {}
+impl Store for radicle::node::Database {}
/// Function used to query internal service state.
pub type QueryState = dyn Fn(&dyn ServiceState) -> Result<(), CommandError> + Send + Sync;
@@ -1133,7 +1137,7 @@ where
&mut self,
rid: RepoId,
remote: NodeId,
- result: Result<fetch::FetchResult, FetchError>,
+ result: Result<crate::worker::fetch::FetchResult, crate::worker::FetchError>,
) {
let Some(fetching) = self.fetching.remove(&rid) else {
error!(target: "service", "Received unexpected fetch result for {rid}, from {remote}");
@@ -1169,7 +1173,7 @@ where
}
match result {
- Ok(fetch::FetchResult {
+ Ok(crate::worker::fetch::FetchResult {
updated,
namespaces,
clone,
diff --git a/crates/radicle-protocol/src/service/filter.rs b/crates/radicle-protocol/src/service/filter.rs
index eae7c3607..c57db7fc6 100644
--- a/crates/radicle-protocol/src/service/filter.rs
+++ b/crates/radicle-protocol/src/service/filter.rs
@@ -3,7 +3,7 @@ use std::ops::{Deref, DerefMut};
pub use bloomy::BloomFilter;
-use crate::identity::RepoId;
+use radicle::identity::RepoId;
/// Size in bytes of *large* bloom filter.
/// It can store about 13'675 items with a false positive rate of 1%.
@@ -90,10 +90,26 @@ impl From<BloomFilter<RepoId>> for Filter {
}
}
+#[allow(clippy::unwrap_used)]
+#[cfg(any(test, feature = "test"))]
+impl qcheck::Arbitrary for Filter {
+ fn arbitrary(g: &mut qcheck::Gen) -> Self {
+ let size = *g
+ .choose(&[FILTER_SIZE_S, FILTER_SIZE_M, FILTER_SIZE_L])
+ .unwrap();
+ let mut bytes = vec![0; size];
+ for _ in 0..64 {
+ let index = usize::arbitrary(g) % bytes.len();
+ bytes[index] = u8::arbitrary(g);
+ }
+ Self::from(BloomFilter::from(bytes))
+ }
+}
+
#[cfg(test)]
mod test {
use super::*;
- use crate::test::arbitrary;
+ use radicle::test::arbitrary;
#[test]
fn test_parameters() {
diff --git a/crates/radicle-protocol/src/service/gossip.rs b/crates/radicle-protocol/src/service/gossip.rs
index 2a6778680..8ba0f16f5 100644
--- a/crates/radicle-protocol/src/service/gossip.rs
+++ b/crates/radicle-protocol/src/service/gossip.rs
@@ -4,14 +4,15 @@ use std::str::FromStr;
use std::sync::LazyLock;
use super::*;
-use crate::{PROTOCOL_VERSION, VERSION};
+use crate::bounded::BoundedVec;
use radicle::node::UserAgent;
+use radicle::node::PROTOCOL_VERSION;
pub use store::{AnnouncementId, Error, RelayStatus, Store};
/// This node's user agent string.
-pub static USER_AGENT: LazyLock<UserAgent> = LazyLock::new(|| {
- FromStr::from_str(format!("/radicle:{}/", VERSION.version).as_str())
+pub static PROTOCOL_VERSION_STRING: LazyLock<UserAgent> = LazyLock::new(|| {
+ FromStr::from_str(format!("/radicle:{}/", PROTOCOL_VERSION).as_str())
.expect("user agent is valid")
});
@@ -23,7 +24,7 @@ pub fn node(config: &Config, timestamp: Timestamp) -> NodeAnnouncement {
.clone()
.try_into()
.expect("external addresses are within the limit");
- let agent = USER_AGENT.clone();
+ let agent = PROTOCOL_VERSION_STRING.clone();
let version = PROTOCOL_VERSION;
NodeAnnouncement {
diff --git a/crates/radicle-protocol/src/service/gossip/store.rs b/crates/radicle-protocol/src/service/gossip/store.rs
index 49d9ba4ef..a7288164b 100644
--- a/crates/radicle-protocol/src/service/gossip/store.rs
+++ b/crates/radicle-protocol/src/service/gossip/store.rs
@@ -5,13 +5,15 @@ use radicle::crypto::Signature;
use sqlite as sql;
use thiserror::Error;
-use crate::node::{Database, NodeId};
-use crate::prelude::{Filter, Timestamp};
+use crate::service::filter::Filter;
use crate::service::message::{
Announcement, AnnouncementMessage, InventoryAnnouncement, NodeAnnouncement, RefsAnnouncement,
};
use crate::wire;
use crate::wire::Decode;
+use radicle::node::Database;
+use radicle::node::NodeId;
+use radicle::prelude::Timestamp;
#[derive(Error, Debug)]
pub enum Error {
@@ -395,11 +397,12 @@ mod parse {
#[allow(clippy::unwrap_used)]
mod test {
use super::*;
- use crate::prelude::{BoundedVec, RepoId};
- use crate::test::arbitrary;
+ use crate::bounded::BoundedVec;
use localtime::LocalTime;
use radicle::assert_matches;
+ use radicle::identity::RepoId;
use radicle::node::device::Device;
+ use radicle::test::arbitrary;
#[test]
fn test_announced() {
diff --git a/crates/radicle-protocol/src/service/io.rs b/crates/radicle-protocol/src/service/io.rs
index 09b05fbb3..f0f8eb1de 100644
--- a/crates/radicle-protocol/src/service/io.rs
+++ b/crates/radicle-protocol/src/service/io.rs
@@ -1,12 +1,17 @@
use std::collections::VecDeque;
use std::time;
+use localtime::LocalDuration;
use log::*;
+use radicle::identity::RepoId;
use radicle::node::config::FetchPackSizeLimit;
+use radicle::node::Address;
+use radicle::node::NodeId;
use radicle::storage::refs::RefsAt;
-use crate::prelude::*;
+use crate::service::message::Message;
use crate::service::session::Session;
+use crate::service::DisconnectReason;
use crate::service::Link;
use super::gossip;
@@ -189,7 +194,7 @@ impl Outbox {
}
#[cfg(any(test, feature = "test"))]
- pub(crate) fn queue(&mut self) -> &mut VecDeque<Io> {
+ pub fn queue(&mut self) -> &mut VecDeque<Io> {
&mut self.io
}
}
diff --git a/crates/radicle-protocol/src/service/message.rs b/crates/radicle-protocol/src/service/message.rs
index 2b92e62d3..5995b7482 100644
--- a/crates/radicle-protocol/src/service/message.rs
+++ b/crates/radicle-protocol/src/service/message.rs
@@ -1,18 +1,18 @@
use std::{fmt, io, mem};
use nonempty::NonEmpty;
+use radicle::crypto;
use radicle::git;
+use radicle::identity::RepoId;
+use radicle::node;
use radicle::node::device::Device;
+use radicle::node::{Address, Alias, UserAgent};
+use radicle::storage;
use radicle::storage::refs::RefsAt;
-use crate::crypto;
-use crate::identity::RepoId;
-use crate::node;
-use crate::node::{Address, Alias, UserAgent};
-use crate::prelude::BoundedVec;
+use crate::bounded::BoundedVec;
use crate::service::filter::Filter;
use crate::service::{Link, NodeId, Timestamp};
-use crate::storage;
use crate::wire;
/// Maximum number of addresses which can be announced to other nodes.
@@ -363,7 +363,7 @@ impl Announcement {
#[cfg(not(debug_assertions))]
pub const POW_PARAMS: (u8, u32, u32) = (15, 8, 1);
/// Salt used for generating PoW.
- pub const POW_SALT: &'static [u8] = &[b'r', b'a', b'd'];
+ pub const POW_SALT: &'static [u8] = b"rad";
/// Verify this announcement's signature.
pub fn verify(&self) -> bool {
@@ -589,6 +589,87 @@ impl ZeroBytes {
}
}
+#[cfg(any(test, feature = "test"))]
+#[allow(clippy::unwrap_used)]
+impl qcheck::Arbitrary for Message {
+ fn arbitrary(g: &mut qcheck::Gen) -> Self {
+ use qcheck::Arbitrary;
+
+ match g.choose(&[1, 2, 3, 4, 5, 6, 7]).unwrap() {
+ 1 => Announcement {
+ node: NodeId::arbitrary(g),
+ message: InventoryAnnouncement {
+ inventory: BoundedVec::arbitrary(g),
+ timestamp: Timestamp::arbitrary(g),
+ }
+ .into(),
+ signature: crypto::Signature::from(<[u8; 64]>::arbitrary(g)),
+ }
+ .into(),
+ 2 => Announcement {
+ node: NodeId::arbitrary(g),
+ message: RefsAnnouncement {
+ rid: RepoId::arbitrary(g),
+ refs: BoundedVec::arbitrary(g),
+ timestamp: Timestamp::arbitrary(g),
+ }
+ .into(),
+ signature: crypto::Signature::from(<[u8; 64]>::arbitrary(g)),
+ }
+ .into(),
+ 3 => {
+ let message = NodeAnnouncement {
+ version: u8::arbitrary(g),
+ features: u64::arbitrary(g).into(),
+ timestamp: Timestamp::arbitrary(g),
+ alias: Alias::arbitrary(g),
+ addresses: Arbitrary::arbitrary(g),
+ nonce: u64::arbitrary(g),
+ agent: UserAgent::arbitrary(g),
+ }
+ .into();
+ let bytes: [u8; 64] = Arbitrary::arbitrary(g);
+ let signature = crypto::Signature::from(bytes);
+
+ Announcement {
+ node: NodeId::arbitrary(g),
+ signature,
+ message,
+ }
+ .into()
+ }
+ 4 => {
+ let message = Info::RefsAlreadySynced {
+ rid: RepoId::arbitrary(g),
+ at: radicle::test::arbitrary::oid(),
+ };
+ Self::Info(message)
+ }
+ 5 => Self::Subscribe(Subscribe {
+ filter: Filter::arbitrary(g),
+ since: Timestamp::arbitrary(g),
+ until: Timestamp::arbitrary(g),
+ }),
+ 6 => {
+ let mut rng = fastrand::Rng::with_seed(u64::arbitrary(g));
+
+ Self::Ping(Ping::new(&mut rng))
+ }
+ 7 => Self::Pong {
+ zeroes: ZeroBytes::new(u16::arbitrary(g).min(Ping::MAX_PONG_ZEROES)),
+ },
+ _ => panic!("Invalid choice for Message::arbitrary"),
+ }
+ }
+}
+
+#[cfg(any(test, feature = "test"))]
+impl qcheck::Arbitrary for ZeroBytes {
+ fn arbitrary(g: &mut qcheck::Gen) -> Self {
+ ZeroBytes::new(u16::arbitrary(g))
+ }
+}
+
#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
@@ -599,9 +680,9 @@ mod tests {
use radicle::git::raw;
use super::*;
- use crate::prelude::*;
- use crate::test::arbitrary;
use crate::wire::Encode;
+ use localtime::LocalTime;
+ use radicle::test::arbitrary;
#[test]
fn test_ref_remote_limit() {
diff --git a/crates/radicle-protocol/src/service/session.rs b/crates/radicle-protocol/src/service/session.rs
index ab8b32b2e..0fc9be0c9 100644
--- a/crates/radicle-protocol/src/service/session.rs
+++ b/crates/radicle-protocol/src/service/session.rs
@@ -2,16 +2,15 @@ use std::collections::{HashSet, VecDeque};
use std::{fmt, time};
use crossbeam_channel as chan;
+use radicle::node::config::Limits;
+use radicle::node::{FetchResult, Severity};
+use radicle::node::{Link, Timestamp};
+pub use radicle::node::{PingState, State};
+use radicle::storage::refs::RefsAt;
-use crate::node::config::Limits;
-use crate::node::{FetchResult, Severity};
use crate::service::message;
use crate::service::message::Message;
use crate::service::{Address, LocalDuration, LocalTime, NodeId, Outbox, RepoId, Rng};
-use crate::storage::refs::RefsAt;
-use crate::{Link, Timestamp};
-
-pub use crate::node::{PingState, State};
/// Time after which a connection is considered stable.
pub const CONNECTION_STABLE_THRESHOLD: LocalDuration = LocalDuration::from_mins(1);
diff --git a/crates/radicle-protocol/src/wire.rs b/crates/radicle-protocol/src/wire.rs
index c400ea0c2..fb696f1d0 100644
--- a/crates/radicle-protocol/src/wire.rs
+++ b/crates/radicle-protocol/src/wire.rs
@@ -1,12 +1,9 @@
-mod frame;
-mod message;
-mod protocol;
-mod varint;
+pub mod frame;
+pub mod message;
+pub mod varint;
pub use frame::StreamId;
pub use message::{AddressType, MessageType};
-pub use protocol::{Control, Wire, WireReader, WireSession, WireWriter};
-use radicle::node::UserAgent;
use std::collections::BTreeMap;
use std::convert::TryFrom;
@@ -18,18 +15,21 @@ use std::{io, mem};
use byteorder::{NetworkEndian, ReadBytesExt, WriteBytesExt};
use cyphernet::addr::tor;
-use crate::crypto::{PublicKey, Signature, Unverified};
-use crate::git;
-use crate::git::fmt;
-use crate::identity::RepoId;
-use crate::node;
-use crate::node::Alias;
-use crate::prelude::*;
+use radicle::crypto::{PublicKey, Signature, Unverified};
+use radicle::git;
+use radicle::git::fmt;
+use radicle::identity::RepoId;
+use radicle::node;
+use radicle::node::Alias;
+use radicle::node::NodeId;
+use radicle::node::Timestamp;
+use radicle::node::UserAgent;
+use radicle::storage::refs::Refs;
+use radicle::storage::refs::RefsAt;
+use radicle::storage::refs::SignedRefs;
+
+use crate::bounded::BoundedVec;
use crate::service::filter;
-use crate::storage::refs::Refs;
-use crate::storage::refs::RefsAt;
-use crate::storage::refs::SignedRefs;
-use crate::Timestamp;
/// The default type we use to represent sizes on the wire.
///
@@ -569,9 +569,9 @@ mod tests {
use qcheck;
use qcheck_macros::quickcheck;
- use crate::crypto::Unverified;
- use crate::storage::refs::SignedRefs;
- use crate::test::assert_matches;
+ use radicle::assert_matches;
+ use radicle::crypto::Unverified;
+ use radicle::storage::refs::SignedRefs;
#[quickcheck]
fn prop_u8(input: u8) {
diff --git a/crates/radicle-protocol/src/wire/frame.rs b/crates/radicle-protocol/src/wire/frame.rs
index 64c874c11..fcd5c30f5 100644
--- a/crates/radicle-protocol/src/wire/frame.rs
+++ b/crates/radicle-protocol/src/wire/frame.rs
@@ -2,7 +2,9 @@
#![warn(clippy::missing_docs_in_private_items)]
use std::{fmt, io};
-use crate::{wire, wire::varint, wire::varint::VarInt, wire::Message, Link, PROTOCOL_VERSION};
+use crate::service::Message;
+use crate::{wire, wire::varint, wire::varint::VarInt, PROTOCOL_VERSION};
+use radicle::node::Link;
/// Protocol version strings all start with the magic sequence `rad`, followed
/// by a version number.
diff --git a/crates/radicle-protocol/src/wire/message.rs b/crates/radicle-protocol/src/wire/message.rs
index 4e8062af7..bcfc29976 100644
--- a/crates/radicle-protocol/src/wire/message.rs
+++ b/crates/radicle-protocol/src/wire/message.rs
@@ -2,13 +2,17 @@ use std::{io, mem, net};
use byteorder::{NetworkEndian, ReadBytesExt};
use cyphernet::addr::{tor, Addr, HostName, NetAddr};
+use radicle::crypto::Signature;
use radicle::git::Oid;
+use radicle::identity::RepoId;
use radicle::node::Address;
+use radicle::node::NodeId;
+use radicle::node::Timestamp;
-use crate::prelude::*;
+use crate::bounded::BoundedVec;
+use crate::service::filter::Filter;
use crate::service::message::*;
use crate::wire;
-use crate::wire::{Decode, Encode};
/// Message type.
#[repr(u16)]
@@ -67,22 +71,6 @@ impl Message {
}
}
-impl netservices::Frame for Message {
- type Error = wire::Error;
-
- fn unmarshall(mut reader: impl io::Read) -> Result<Option<Self>, Self::Error> {
- match Message::decode(&mut reader) {
- Ok(msg) => Ok(Some(msg)),
- Err(wire::Error::Io(_)) => Ok(None),
- Err(err) => Err(err),
- }
- }
-
- fn marshall(&self, mut writer: impl io::Write) -> Result<usize, Self::Error> {
- self.encode(&mut writer).map_err(wire::Error::from)
- }
-}
-
/// Address type.
#[repr(u8)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -463,8 +451,8 @@ mod tests {
use radicle::storage::refs::RefsAt;
use crate::deserializer::Deserializer;
- use crate::test::arbitrary;
use crate::wire::{self, Encode};
+ use radicle::test::arbitrary;
#[test]
fn test_refs_ann_max_size() {
diff --git a/crates/radicle-protocol/src/worker.rs b/crates/radicle-protocol/src/worker.rs
new file mode 100644
index 000000000..7886df93a
--- /dev/null
+++ b/crates/radicle-protocol/src/worker.rs
@@ -0,0 +1,119 @@
+#![allow(clippy::too_many_arguments)]
+pub mod fetch;
+
+use std::io;
+
+use radicle::identity::RepoId;
+use radicle::node::Event;
+use radicle::prelude::NodeId;
+use radicle::storage::refs::RefsAt;
+
+// use crate::runtime::{thread, Emitter, Handle};
+
+use radicle::node::events::Emitter;
+
+// pub use channels::{ChannelEvent, Channels, ChannelsConfig};
+
+/// Error returned by fetch.
+#[derive(thiserror::Error, Debug)]
+pub enum FetchError {
+ #[error("the 'git fetch' command failed with exit code '{code}'")]
+ CommandFailed { code: i32 },
+ #[error(transparent)]
+ Io(#[from] io::Error),
+ #[error(transparent)]
+ Fetch(#[from] fetch::error::Fetch),
+ #[error(transparent)]
+ Handle(#[from] fetch::error::Handle),
+ #[error(transparent)]
+ Storage(#[from] radicle::storage::Error),
+ #[error(transparent)]
+ PolicyStore(#[from] radicle::node::policy::store::Error),
+ #[error(transparent)]
+ Policy(#[from] radicle_fetch::policy::error::Policy),
+ #[error(transparent)]
+ Blocked(#[from] radicle_fetch::policy::error::Blocked),
+}
+
+impl FetchError {
+ /// Check if it's a timeout error.
+ pub fn is_timeout(&self) -> bool {
+ matches!(self, FetchError::Io(e) if e.kind() == io::ErrorKind::TimedOut)
+ }
+}
+
+/// Error returned by fetch responder.
+#[derive(thiserror::Error, Debug)]
+pub enum UploadError {
+ #[error("error parsing git command packet-line: {0}")]
+ PacketLine(io::Error),
+ #[error("error while performing git upload-pack: {0}")]
+ UploadPack(io::Error),
+ #[error(transparent)]
+ Authorization(#[from] AuthorizationError),
+}
+
+impl UploadError {
+ /// Check if it's an end-of-file error.
+ pub fn is_eof(&self) -> bool {
+ matches!(self, UploadError::UploadPack(e) if e.kind() == io::ErrorKind::UnexpectedEof)
+ }
+}
+
+#[derive(thiserror::Error, Debug)]
+pub enum AuthorizationError {
+ #[error("{0} is not authorized to fetch {1}")]
+ Unauthorized(NodeId, RepoId),
+ #[error(transparent)]
+ PolicyStore(#[from] radicle::node::policy::store::Error),
+ #[error(transparent)]
+ Repository(#[from] radicle::storage::RepositoryError),
+}
+
+/// Fetch job sent to worker thread.
+#[derive(Debug, Clone)]
+pub enum FetchRequest {
+ /// Client is initiating a fetch for the repository identified by
+ /// `rid` from the peer identified by `remote`.
+ Initiator {
+ /// Repo to fetch.
+ rid: RepoId,
+ /// Remote peer we are interacting with.
+ remote: NodeId,
+ /// If this fetch is for a particular set of `rad/sigrefs`.
+ refs_at: Option<Vec<RefsAt>>,
+ },
+ /// Server is responding to a fetch request by uploading the
+ /// specified `refspecs` sent by the client.
+ Responder {
+ /// Remote peer we are interacting with.
+ remote: NodeId,
+ /// Reporter for upload-pack progress.
+ emitter: Emitter<Event>,
+ },
+}
+
+impl FetchRequest {
+ pub fn remote(&self) -> NodeId {
+ match self {
+ Self::Initiator { remote, .. } | Self::Responder { remote, .. } => *remote,
+ }
+ }
+}
+
+/// Fetch result of an upload or fetch.
+#[derive(Debug)]
+pub enum FetchResult {
+ Initiator {
+ /// Repo fetched.
+ rid: RepoId,
+ /// Fetch result, including remotes fetched.
+ result: Result<fetch::FetchResult, FetchError>,
+ },
+ Responder {
+ /// Repo requested.
+ rid: Option<RepoId>,
+ /// Upload result.
+ result: Result<(), UploadError>,
+ },
+}
diff --git a/crates/radicle-protocol/src/worker/fetch.rs b/crates/radicle-protocol/src/worker/fetch.rs
new file mode 100644
index 000000000..1ff587aa8
--- /dev/null
+++ b/crates/radicle-protocol/src/worker/fetch.rs
@@ -0,0 +1,41 @@
+pub mod error;
+
+use std::collections::HashSet;
+
+use radicle::crypto::PublicKey;
+use radicle::{identity::DocAt, storage::RefUpdate};
+
+#[derive(Debug, Clone)]
+pub struct FetchResult {
+ /// The set of updated references.
+ pub updated: Vec<RefUpdate>,
+ /// The set of remote namespaces that were updated.
+ pub namespaces: HashSet<PublicKey>,
+ /// The fetch was a full clone.
+ pub clone: bool,
+ /// Identity doc of fetched repo.
+ pub doc: DocAt,
+}
+
+impl FetchResult {
+ pub fn new(doc: DocAt) -> Self {
+ Self {
+ updated: vec![],
+ namespaces: HashSet::new(),
+ clone: false,
+ doc,
+ }
+ }
+}
+
+#[cfg(any(test, feature = "test"))]
+impl qcheck::Arbitrary for FetchResult {
+ fn arbitrary(g: &mut qcheck::Gen) -> Self {
+ FetchResult {
+ updated: vec![],
+ namespaces: HashSet::arbitrary(g),
+ clone: bool::arbitrary(g),
+ doc: DocAt::arbitrary(g),
+ }
+ }
+}
diff --git a/crates/radicle-node/src/worker/fetch/error.rs b/crates/radicle-protocol/src/worker/fetch/error.rs
similarity index 100%
rename from crates/radicle-node/src/worker/fetch/error.rs
rename to crates/radicle-protocol/src/worker/fetch/error.rs
commit 61c468778a87a3a40acfa3be90107cd98a1451b5
Author: Lorenz Leutgeb <lorenz.leutgeb@radicle.xyz>
Date: Fri Jun 20 09:45:58 2025 +0200
protocol: Create skeleton by moving from radicle-node
This commit will not build. If you are reading this while bisecting,
please skip this commit. It is not fixed to build to get clean renames.
diff --git a/Cargo.lock b/Cargo.lock
index 39d0b7149..a05294e6e 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2662,6 +2662,7 @@ dependencies = [
"radicle-crypto",
"radicle-fetch",
"radicle-git-ext",
+ "radicle-protocol",
"radicle-signals",
"radicle-systemd",
"scrypt",
@@ -2674,6 +2675,42 @@ dependencies = [
"thiserror 1.0.69",
]
+[[package]]
+name = "radicle-protocol"
+version = "0.1.0"
+dependencies = [
+ "amplify",
+ "anyhow",
+ "bloomy",
+ "byteorder",
+ "chrono",
+ "colored",
+ "crossbeam-channel",
+ "cyphernet",
+ "fastrand",
+ "io-reactor",
+ "lexopt",
+ "libc",
+ "localtime",
+ "log",
+ "netservices",
+ "nonempty 0.9.0",
+ "qcheck",
+ "qcheck-macros",
+ "radicle",
+ "radicle-crypto",
+ "radicle-fetch",
+ "radicle-git-ext",
+ "scrypt",
+ "serde",
+ "serde_json",
+ "snapbox",
+ "socket2",
+ "sqlite",
+ "tempfile",
+ "thiserror 1.0.69",
+]
+
[[package]]
name = "radicle-remote-helper"
version = "0.11.0"
diff --git a/Cargo.toml b/Cargo.toml
index 306f27ec8..3a3920fd2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -47,6 +47,7 @@ radicle-dag = { version = "0.10", path = "crates/radicle-dag" }
radicle-fetch = { version = "0.12", path = "crates/radicle-fetch" }
radicle-git-ext = { version = "0.8", default-features = false }
radicle-node = { version = "0.12", path = "crates/radicle-node" }
+radicle-protocol = { version = "0.1", path = "crates/radicle-protocol" }
radicle-signals = { version = "0.11", path = "crates/radicle-signals" }
radicle-ssh = { version = "0.9", path = "crates/radicle-ssh", default-features = false }
radicle-systemd = { version = "0.9", path = "crates/radicle-systemd" }
diff --git a/crates/radicle-node/Cargo.toml b/crates/radicle-node/Cargo.toml
index ffa30054c..e2e084bf2 100644
--- a/crates/radicle-node/Cargo.toml
+++ b/crates/radicle-node/Cargo.toml
@@ -37,6 +37,7 @@ radicle-fetch = { workspace = true }
# N.b. this is required to use macros, even though it's re-exported
# through radicle
radicle-git-ext = { workspace = true, features = ["serde"] }
+radicle-protocol = { workspace = true }
radicle-signals = { workspace = true }
radicle-systemd = { workspace = true, optional = true }
sqlite = { workspace = true, features = ["bundled"] }
@@ -53,4 +54,4 @@ qcheck = { workspace = true }
qcheck-macros = { workspace = true }
radicle = { workspace = true, features = ["test"] }
radicle-crypto = { workspace = true, features = ["test", "cyphernet"] }
-snapbox = { workspace = true }
\ No newline at end of file
+snapbox = { workspace = true }
diff --git a/crates/radicle-protocol/Cargo.toml b/crates/radicle-protocol/Cargo.toml
new file mode 100644
index 000000000..8d0f5ecdd
--- /dev/null
+++ b/crates/radicle-protocol/Cargo.toml
@@ -0,0 +1,49 @@
+[package]
+name = "radicle-protocol"
+description = "The Radicle Protocol"
+homepage.workspace = true
+license.workspace = true
+version = "0.1.0"
+authors = ["Radicle Team <team@radicle.xyz>"]
+edition.workspace = true
+rust-version.workspace = true
+
+[features]
+test = ["radicle/test", "radicle-crypto/test", "radicle-crypto/cyphernet", "qcheck", "snapbox"]
+
+[dependencies]
+amplify = { workspace = true }
+anyhow = { workspace = true }
+bloomy = "1.2"
+byteorder = { workspace = true }
+chrono = { workspace = true, features = ["clock"] }
+colored = { workspace = true }
+crossbeam-channel = { workspace = true }
+cyphernet = { workspace = true, features = ["tor", "dns", "ed25519", "p2p-ed25519"] }
+fastrand = { workspace = true }
+io-reactor = { version = "0.5.1", features = ["popol"] }
+lexopt = { workspace = true }
+libc = { workspace = true }
+log = { workspace = true, features = ["std"] }
+localtime = { workspace = true }
+netservices = { version = "0.8.0", features = ["io-reactor", "socket2"] }
+nonempty = { workspace = true, features = ["serialize"] }
+qcheck = { workspace = true, optional = true }
+radicle = { workspace = true, features = ["logger"] }
+radicle-fetch = { workspace = true }
+radicle-git-ext = { workspace = true, features = ["serde"] }
+sqlite = { workspace = true, features = ["bundled"] }
+scrypt = { version = "0.11.0", default-features = false }
+serde = { workspace = true, features = ["derive"] }
+serde_json = { workspace = true, features = ["preserve_order"] }
+snapbox = { workspace = true, optional = true }
+socket2 = "0.5.7"
+tempfile = { workspace = true }
+thiserror = { workspace = true }
+
+[dev-dependencies]
+qcheck = { workspace = true }
+qcheck-macros = { workspace = true }
+radicle = { workspace = true, features = ["test"] }
+radicle-crypto = { workspace = true, features = ["test", "cyphernet"] }
+snapbox = { workspace = true }
diff --git a/crates/radicle-node/src/bounded.rs b/crates/radicle-protocol/src/bounded.rs
similarity index 100%
rename from crates/radicle-node/src/bounded.rs
rename to crates/radicle-protocol/src/bounded.rs
diff --git a/crates/radicle-node/src/service.rs b/crates/radicle-protocol/src/service.rs
similarity index 100%
rename from crates/radicle-node/src/service.rs
rename to crates/radicle-protocol/src/service.rs
diff --git a/crates/radicle-node/src/service/filter.rs b/crates/radicle-protocol/src/service/filter.rs
similarity index 100%
rename from crates/radicle-node/src/service/filter.rs
rename to crates/radicle-protocol/src/service/filter.rs
diff --git a/crates/radicle-node/src/service/gossip.rs b/crates/radicle-protocol/src/service/gossip.rs
similarity index 100%
rename from crates/radicle-node/src/service/gossip.rs
rename to crates/radicle-protocol/src/service/gossip.rs
diff --git a/crates/radicle-node/src/service/gossip/store.rs b/crates/radicle-protocol/src/service/gossip/store.rs
similarity index 100%
rename from crates/radicle-node/src/service/gossip/store.rs
rename to crates/radicle-protocol/src/service/gossip/store.rs
diff --git a/crates/radicle-node/src/service/io.rs b/crates/radicle-protocol/src/service/io.rs
similarity index 100%
rename from crates/radicle-node/src/service/io.rs
rename to crates/radicle-protocol/src/service/io.rs
diff --git a/crates/radicle-node/src/service/limiter.rs b/crates/radicle-protocol/src/service/limiter.rs
similarity index 100%
rename from crates/radicle-node/src/service/limiter.rs
rename to crates/radicle-protocol/src/service/limiter.rs
diff --git a/crates/radicle-node/src/service/message.rs b/crates/radicle-protocol/src/service/message.rs
similarity index 100%
rename from crates/radicle-node/src/service/message.rs
rename to crates/radicle-protocol/src/service/message.rs
diff --git a/crates/radicle-node/src/service/session.rs b/crates/radicle-protocol/src/service/session.rs
similarity index 100%
rename from crates/radicle-node/src/service/session.rs
rename to crates/radicle-protocol/src/service/session.rs
diff --git a/crates/radicle-node/src/wire.rs b/crates/radicle-protocol/src/wire.rs
similarity index 100%
rename from crates/radicle-node/src/wire.rs
rename to crates/radicle-protocol/src/wire.rs
diff --git a/crates/radicle-node/src/wire/frame.rs b/crates/radicle-protocol/src/wire/frame.rs
similarity index 100%
rename from crates/radicle-node/src/wire/frame.rs
rename to crates/radicle-protocol/src/wire/frame.rs
diff --git a/crates/radicle-node/src/wire/message.rs b/crates/radicle-protocol/src/wire/message.rs
similarity index 100%
rename from crates/radicle-node/src/wire/message.rs
rename to crates/radicle-protocol/src/wire/message.rs
diff --git a/crates/radicle-node/src/wire/protocol.rs b/crates/radicle-protocol/src/wire/protocol.rs
similarity index 100%
rename from crates/radicle-node/src/wire/protocol.rs
rename to crates/radicle-protocol/src/wire/protocol.rs
diff --git a/crates/radicle-node/src/wire/varint.rs b/crates/radicle-protocol/src/wire/varint.rs
similarity index 100%
rename from crates/radicle-node/src/wire/varint.rs
rename to crates/radicle-protocol/src/wire/varint.rs
commit b9759c58688a1fe63a09c92c43eef10257f4c9ef
Author: Lorenz Leutgeb <lorenz.leutgeb@radicle.xyz>
Date: Sat Jun 21 10:55:51 2025 +0200
radicle: Make `node::Link` copy and add `is_*`
This will allow us to replace `netservices::LinkDirection` with
`radicle::node::Link` in a drop-in manner.
diff --git a/crates/radicle/src/node.rs b/crates/radicle/src/node.rs
index 3bf4d03c9..52c53a944 100644
--- a/crates/radicle/src/node.rs
+++ b/crates/radicle/src/node.rs
@@ -723,7 +723,7 @@ impl Command {
}
/// Connection link direction.
-#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub enum Link {
@@ -733,6 +733,18 @@ pub enum Link {
Inbound,
}
+impl Link {
+ /// Check if this is an outbound link.
+ pub fn is_outbound(&self) -> bool {
+ matches!(self, Self::Outbound)
+ }
+
+ /// Check if this is an inbound link.
+ pub fn is_inbound(&self) -> bool {
+ matches!(self, Self::Inbound)
+ }
+}
+
/// An established network connection with a peer.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
Exit code: 0
shell: 'cargo --version rustc --version cargo fmt --check cargo clippy --all-targets --workspace -- --deny warnings cargo build --all-targets --workspace cargo doc --workspace --no-deps cargo test --workspace --no-fail-fast '
Commands:
$ podman run --name 6d656168-e189-4240-8bd0-8a590cb88420 -v /opt/radcis/ci.rad.levitte.org/cci/state/6d656168-e189-4240-8bd0-8a590cb88420/s:/6d656168-e189-4240-8bd0-8a590cb88420/s:ro -v /opt/radcis/ci.rad.levitte.org/cci/state/6d656168-e189-4240-8bd0-8a590cb88420/w:/6d656168-e189-4240-8bd0-8a590cb88420/w -w /6d656168-e189-4240-8bd0-8a590cb88420/w -v /opt/radcis/ci.rad.levitte.org/.radicle:/${id}/.radicle:ro -e RAD_HOME=/${id}/.radicle rust:trixie bash /6d656168-e189-4240-8bd0-8a590cb88420/s/script.sh
+ cargo --version
info: syncing channel updates for '1.85-x86_64-unknown-linux-gnu'
info: latest update on 2025-03-18, rust version 1.85.1 (4eb161250 2025-03-15)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-src'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
info: installing component 'rust-src'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
cargo 1.85.1 (d73d2caf9 2024-12-31)
+ rustc --version
rustc 1.85.1 (4eb161250 2025-03-15)
+ cargo fmt --check
+ cargo clippy --all-targets --workspace -- --deny warnings
Updating crates.io index
Downloading crates ...
Downloaded aho-corasick v1.1.3
Downloaded colored v2.1.0
Downloaded parking_lot_core v0.9.9
Downloaded primeorder v0.13.6
Downloaded pbkdf2 v0.12.2
Downloaded rand_core v0.6.4
Downloaded quote v1.0.36
Downloaded getrandom v0.2.15
Downloaded fxhash v0.2.1
Downloaded ed25519 v1.5.3
Downloaded popol v3.0.0
Downloaded siphasher v0.3.11
Downloaded rand v0.8.5
Downloaded ref-cast-impl v1.0.24
Downloaded opaque-debug v0.3.1
Downloaded ssh-cipher v0.2.0
Downloaded signature v1.6.4
Downloaded signal-hook-mio v0.2.4
Downloaded gix-negotiate v0.17.0
Downloaded gix-hashtable v0.6.0
Downloaded jobserver v0.1.31
Downloaded stable_deref_trait v1.2.0
Downloaded inout v0.1.3
Downloaded pkg-config v0.3.30
Downloaded cypheraddr v0.4.0
Downloaded universal-hash v0.5.1
Downloaded scrypt v0.11.0
Downloaded subtle v2.5.0
Downloaded once_cell v1.21.3
Downloaded utf8_iter v1.0.4
Downloaded gix-command v0.4.1
Downloaded home v0.5.9
Downloaded gix-object v0.46.1
Downloaded yoke-derive v0.7.5
Downloaded tinystr v0.7.6
Downloaded iana-time-zone v0.1.60
Downloaded zerofrom-derive v0.1.6
Downloaded zerofrom v0.1.6
Downloaded write16 v1.0.0
Downloaded pkcs8 v0.10.2
Downloaded gix-validate v0.9.4
Downloaded num-cmp v0.1.0
Downloaded num v0.4.3
Downloaded typeid v1.0.3
Downloaded yoke v0.7.5
Downloaded litemap v0.7.5
Downloaded noise-framework v0.4.0
Downloaded git-ref-format-core v0.3.1
Downloaded gix-utils v0.1.14
Downloaded memmap2 v0.9.4
Downloaded vsimd v0.8.0
Downloaded tree-sitter-toml-ng v0.6.0
Downloaded gix-date v0.9.4
Downloaded gix-sec v0.10.12
Downloaded gix-quote v0.4.15
Downloaded gix-revwalk v0.17.0
Downloaded tempfile v3.10.1
Downloaded gix-fs v0.12.1
Downloaded gix-hash v0.15.1
Downloaded git-ref-format-macro v0.3.1
Downloaded gix-revision v0.31.1
Downloaded gix-prompt v0.9.1
Downloaded gix-config-value v0.14.12
Downloaded gix-tempfile v15.0.0
Downloaded icu_collections v1.5.0
Downloaded gix-features v0.39.1
Downloaded hmac v0.12.1
Downloaded gix-packetline v0.18.4
Downloaded gix-transport v0.44.0
Downloaded gix-diff v0.49.0
Downloaded serde v1.0.219
Downloaded mio v0.8.11
Downloaded uuid v1.16.0
Downloaded zerovec v0.10.4
Downloaded idna v1.0.3
Downloaded tree-sitter-python v0.23.4
Downloaded radicle-surf v0.22.0
Downloaded num-bigint v0.4.6
Downloaded vcpkg v0.2.15
Downloaded jsonschema v0.30.0
Downloaded hashbrown v0.14.3
Downloaded tree-sitter v0.24.4
Downloaded serde_json v1.0.140
Downloaded tree-sitter-md v0.3.2
Downloaded git2 v0.19.0
Downloaded regex v1.11.1
Downloaded syn v2.0.89
Downloaded syn v1.0.109
Downloaded num-bigint-dig v0.8.4
Downloaded regex-syntax v0.8.5
Downloaded tree-sitter-rust v0.23.2
Downloaded tree-sitter-c v0.23.2
Downloaded rustix v0.38.34
Downloaded rustix v1.0.7
Downloaded icu_properties_data v1.5.1
Downloaded tree-sitter-bash v0.23.3
Downloaded winnow v0.6.26
Downloaded chrono v0.4.38
Downloaded tree-sitter-ruby v0.23.1
Downloaded zerocopy v0.7.35
Downloaded bloomy v1.2.0
Downloaded ssh-key v0.6.6
Downloaded memchr v2.7.2
Downloaded libc v0.2.174
Downloaded tree-sitter-go v0.23.4
Downloaded rsa v0.9.6
Downloaded prodash v29.0.2
Downloaded gix-traverse v0.43.1
Downloaded jiff v0.2.1
Downloaded url v2.5.4
Downloaded schemars v1.0.4
Downloaded typenum v1.17.0
Downloaded log v0.4.21
Downloaded mio v1.0.4
Downloaded tree-sitter-typescript v0.23.2
Downloaded gix-ref v0.49.1
Downloaded miniz_oxide v0.8.8
Downloaded inquire v0.7.5
Downloaded cyphernet v0.5.2
Downloaded aes-gcm v0.10.3
Downloaded sha3 v0.10.8
Downloaded unicode-normalization v0.1.23
Downloaded signals_receipts v0.2.0
Downloaded regex-automata v0.4.9
Downloaded crossterm v0.29.0
Downloaded cc v1.2.2
Downloaded aes v0.8.4
Downloaded gix-protocol v0.47.0
Downloaded gix-path v0.10.15
Downloaded gix-url v0.28.2
Downloaded group v0.13.0
Downloaded num-traits v0.2.19
Downloaded indexmap v2.2.6
Downloaded emojis v0.6.4
Downloaded gix-credentials v0.26.0
Downloaded lock_api v0.4.11
Downloaded litrs v0.4.1
Downloaded zeroize v1.7.0
Downloaded icu_properties v1.5.1
Downloaded gix-pack v0.56.0
Downloaded crossterm v0.25.0
Downloaded gix-refspec v0.27.0
Downloaded gix-actor v0.33.2
Downloaded uuid-simd v0.8.0
Downloaded zerovec-derive v0.10.3
Downloaded linux-raw-sys v0.4.13
Downloaded tree-sitter-css v0.23.1
Downloaded icu_normalizer_data v1.5.1
Downloaded icu_normalizer v1.5.0
Downloaded gix-chunk v0.4.11
Downloaded gix-shallow v0.1.0
Downloaded num-complex v0.4.6
Downloaded icu_provider v1.5.0
Downloaded unicode-segmentation v1.11.0
Downloaded tar v0.4.40
Downloaded similar v2.5.0
Downloaded serde_derive v1.0.219
Downloaded socket2 v0.5.7
Downloaded libgit2-sys v0.17.0+1.8.1
Downloaded p256 v0.13.2
Downloaded icu_locid v1.5.0
Downloaded signal-hook v0.3.18
Downloaded lazy_static v1.5.0
Downloaded keccak v0.1.5
Downloaded unicode-display-width v0.3.0
Downloaded localtime v1.3.1
Downloaded version_check v0.9.4
Downloaded libm v0.2.8
Downloaded gix-trace v0.1.12
Downloaded utf8parse v0.2.1
Downloaded lexopt v0.3.0
Downloaded tree-sitter-html v0.23.2
Downloaded num-rational v0.4.2
Downloaded num-integer v0.1.46
Downloaded schemars_derive v1.0.4
Downloaded pkcs1 v0.7.5
Downloaded spin v0.9.8
Downloaded ryu v1.0.17
Downloaded crossbeam-channel v0.5.15
Downloaded maybe-async v0.2.10
Downloaded io-reactor v0.5.2
Downloaded icu_locid_transform_data v1.5.1
Downloaded itoa v1.0.11
Downloaded proc-macro2 v1.0.92
Downloaded tree-sitter-highlight v0.24.4
Downloaded num-iter v0.1.45
Downloaded icu_locid_transform v1.5.0
Downloaded thiserror v1.0.69
Downloaded ppv-lite86 v0.2.17
Downloaded walkdir v2.5.0
Downloaded linux-raw-sys v0.9.4
Downloaded tinyvec v1.6.0
Downloaded smallvec v1.13.2
Downloaded phf v0.11.3
Downloaded yansi v0.5.1
Downloaded serde-untagged v0.1.7
Downloaded nonempty v0.9.0
Downloaded tree-sitter-language v0.1.2
Downloaded writeable v0.5.5
Downloaded gix-commitgraph v0.25.1
Downloaded unicode-width v0.1.11
Downloaded nonempty v0.5.0
Downloaded base64 v0.21.7
Downloaded normalize-line-endings v0.3.0
Downloaded tree-sitter-json v0.24.8
Downloaded fraction v0.15.3
Downloaded der v0.7.9
Downloaded netservices v0.8.0
Downloaded sec1 v0.7.3
Downloaded xattr v1.3.1
Downloaded sqlite3-src v0.5.1
Downloaded icu_provider_macros v1.5.0
Downloaded timeago v0.4.2
Downloaded referencing v0.30.0
Downloaded snapbox v0.4.17
Downloaded signal-hook-registry v1.4.5
Downloaded serde_derive_internals v0.29.1
Downloaded sem_safe v0.2.0
Downloaded derive_more-impl v2.0.1
Downloaded bytes v1.10.1
Downloaded idna_adapter v1.2.0
Downloaded gix-odb v0.66.0
Downloaded unicode-ident v1.0.12
Downloaded thiserror-impl v2.0.12
Downloaded streaming-iterator v0.1.9
Downloaded spki v0.7.3
Downloaded shlex v1.3.0
Downloaded sha2 v0.10.8
Downloaded polyval v0.6.2
Downloaded synstructure v0.13.1
Downloaded poly1305 v0.8.0
Downloaded thiserror-impl v1.0.69
Downloaded thiserror v2.0.12
Downloaded arc-swap v1.7.1
Downloaded base64 v0.13.1
Downloaded utf16_iter v1.0.5
Downloaded outref v0.5.2
Downloaded sha1_smol v1.0.0
Downloaded sqlite v0.32.0
Downloaded snapbox-macros v0.3.8
Downloaded flate2 v1.1.1
Downloaded crossbeam-utils v0.8.19
Downloaded bitflags v2.9.1
Downloaded fluent-uri v0.3.2
Downloaded amplify_derive v4.0.0
Downloaded crc32fast v1.4.0
Downloaded newline-converter v0.3.0
Downloaded same-file v1.0.6
Downloaded base64ct v1.6.0
Downloaded ahash v0.8.11
Downloaded siphasher v1.0.1
Downloaded shell-words v1.1.0
Downloaded erased-serde v0.4.6
Downloaded ssh-encoding v0.2.0
Downloaded sqlite3-sys v0.15.2
Downloaded signature v2.2.0
Downloaded salsa20 v0.10.2
Downloaded elliptic-curve v0.13.8
Downloaded anstyle-parse v0.2.3
Downloaded ff v0.13.0
Downloaded aead v0.5.2
Downloaded gix-lock v15.0.1
Downloaded socks5-client v0.4.1
Downloaded scopeguard v1.2.0
Downloaded diff v0.1.13
Downloaded rfc6979 v0.4.0
Downloaded multibase v0.9.1
Downloaded tinyvec_macros v0.1.1
Downloaded radicle-git-ext v0.8.1
Downloaded qcheck-macros v1.0.0
Downloaded phf_shared v0.11.3
Downloaded percent-encoding v2.3.1
Downloaded filetime v0.2.23
Downloaded escargot v0.5.10
Downloaded errno v0.3.13
Downloaded ecdsa v0.16.9
Downloaded ct-codecs v1.1.1
Downloaded chacha20 v0.9.1
Downloaded ref-cast v1.0.24
Downloaded qcheck v1.0.0
Downloaded form_urlencoded v1.2.1
Downloaded faster-hex v0.9.0
Downloaded email_address v0.2.9
Downloaded either v1.11.0
Downloaded displaydoc v0.2.5
Downloaded data-encoding v2.5.0
Downloaded crypto-bigint v0.5.5
Downloaded cpufeatures v0.2.12
Downloaded convert_case v0.7.1
Downloaded libz-sys v1.1.16
Downloaded cipher v0.4.4
Downloaded byteorder v1.5.0
Downloaded base16ct v0.2.0
Downloaded anstyle-query v1.0.2
Downloaded amplify_num v0.5.2
Downloaded equivalent v1.0.1
Downloaded borrow-or-share v0.2.2
Downloaded block-padding v0.3.3
Downloaded bcrypt-pbkdf v0.10.0
Downloaded rand_chacha v0.3.1
Downloaded proc-macro-error v1.0.4
Downloaded fastrand v2.1.0
Downloaded fast-glob v0.3.3
Downloaded fancy-regex v0.14.0
Downloaded data-encoding-macro v0.1.14
Downloaded bstr v1.9.1
Downloaded blowfish v0.9.1
Downloaded bit-vec v0.8.0
Downloaded base64 v0.22.1
Downloaded anstream v0.6.13
Downloaded amplify_syn v2.0.1
Downloaded ghash v0.5.1
Downloaded generic-array v0.14.7
Downloaded ec25519 v0.1.0
Downloaded dyn-clone v1.0.17
Downloaded document-features v0.2.11
Downloaded digest v0.10.7
Downloaded derive_more v2.0.1
Downloaded ctr v0.9.2
Downloaded crypto-common v0.1.6
Downloaded const-oid v0.9.6
Downloaded colorchoice v1.0.0
Downloaded bytesize v2.0.1
Downloaded bytecount v0.6.8
Downloaded bitflags v1.3.2
Downloaded base-x v0.2.11
Downloaded autocfg v1.2.0
Downloaded cyphergraphy v0.3.0
Downloaded cbc v0.1.2
Downloaded base32 v0.4.0
Downloaded pem-rfc7468 v0.7.0
Downloaded radicle-std-ext v0.1.0
Downloaded proc-macro-error-attr v1.0.4
Downloaded pretty_assertions v1.4.0
Downloaded p384 v0.13.0
Downloaded bit-set v0.8.0
Downloaded anyhow v1.0.82
Downloaded amplify v4.6.0
Downloaded p521 v0.13.3
Downloaded git-ref-format v0.3.1
Downloaded chacha20poly1305 v0.10.1
Downloaded adler2 v2.0.0
Downloaded parking_lot v0.12.3
Downloaded cfg-if v1.0.0
Downloaded block-buffer v0.10.4
Downloaded data-encoding-macro-internal v0.1.12
Downloaded ascii v1.1.0
Downloaded anstyle v1.0.6
Compiling libc v0.2.174
Compiling proc-macro2 v1.0.92
Compiling unicode-ident v1.0.12
Checking cfg-if v1.0.0
Compiling shlex v1.3.0
Compiling version_check v0.9.4
Checking memchr v2.7.2
Compiling serde v1.0.219
Compiling quote v1.0.36
Compiling syn v2.0.89
Compiling jobserver v0.1.31
Compiling autocfg v1.2.0
Checking getrandom v0.2.15
Compiling cc v1.2.2
Checking smallvec v1.13.2
Checking aho-corasick v1.1.3
Checking regex-syntax v0.8.5
Compiling typenum v1.17.0
Compiling generic-array v0.14.7
Checking log v0.4.21
Checking rand_core v0.6.4
Checking fastrand v2.1.0
Compiling lock_api v0.4.11
Checking regex-automata v0.4.9
Checking crypto-common v0.1.6
Compiling parking_lot_core v0.9.9
Checking bitflags v2.9.1
Checking scopeguard v1.2.0
Compiling synstructure v0.13.1
Checking stable_deref_trait v1.2.0
Checking subtle v2.5.0
Checking parking_lot v0.12.3
Checking tinyvec_macros v0.1.1
Checking once_cell v1.21.3
Compiling syn v1.0.109
Checking tinyvec v1.6.0
Checking zeroize v1.7.0
Checking unicode-normalization v0.1.23
Checking cpufeatures v0.2.12
Compiling icu_locid_transform_data v1.5.1
Checking bstr v1.9.1
Compiling serde_derive v1.0.219
Compiling zerofrom-derive v0.1.6
Compiling yoke-derive v0.7.5
Compiling zerovec-derive v0.10.3
Checking zerofrom v0.1.6
Checking yoke v0.7.5
Compiling displaydoc v0.2.5
Compiling thiserror v2.0.12
Checking litemap v0.7.5
Checking writeable v0.5.5
Compiling crc32fast v1.4.0
Checking zerovec v0.10.4
Compiling thiserror-impl v2.0.12
Compiling icu_provider_macros v1.5.0
Checking tinystr v0.7.6
Checking icu_locid v1.5.0
Checking block-padding v0.3.3
Compiling icu_properties_data v1.5.1
Checking icu_provider v1.5.0
Checking inout v0.1.3
Checking block-buffer v0.10.4
Compiling pkg-config v0.3.30
Compiling icu_normalizer_data v1.5.1
Checking itoa v1.0.11
Checking hashbrown v0.14.3
Checking icu_locid_transform v1.5.0
Checking digest v0.10.7
Checking cipher v0.4.4
Checking icu_collections v1.5.0
Compiling thiserror v1.0.69
Checking write16 v1.0.0
Checking utf16_iter v1.0.5
Checking utf8_iter v1.0.4
Checking icu_properties v1.5.1
Compiling thiserror-impl v1.0.69
Checking percent-encoding v2.3.1
Compiling rustix v0.38.34
Checking linux-raw-sys v0.4.13
Checking sha2 v0.10.8
Checking form_urlencoded v1.2.1
Checking universal-hash v0.5.1
Checking opaque-debug v0.3.1
Compiling vcpkg v0.2.15
Checking icu_normalizer v1.5.0
Compiling amplify_syn v2.0.1
Compiling libz-sys v1.1.16
Checking idna_adapter v1.2.0
Checking idna v1.0.3
Compiling data-encoding v2.5.0
Checking gix-trace v0.1.12
Checking byteorder v1.5.0
Checking url v2.5.4
Checking tempfile v3.10.1
Compiling amplify_derive v4.0.0
Checking signature v1.6.4
Checking amplify_num v0.5.2
Compiling data-encoding-macro-internal v0.1.12
Checking ascii v1.1.0
Checking ed25519 v1.5.3
Checking data-encoding-macro v0.1.14
Checking faster-hex v0.9.0
Compiling libgit2-sys v0.17.0+1.8.1
Checking aead v0.5.2
Compiling num-traits v0.2.19
Compiling proc-macro-error-attr v1.0.4
Checking base-x v0.2.11
Checking ct-codecs v1.1.1
Checking ec25519 v0.1.0
Checking multibase v0.9.1
Checking poly1305 v0.8.0
Checking chacha20 v0.9.1
Checking gix-utils v0.1.14
Compiling proc-macro-error v1.0.4
Checking adler2 v2.0.0
Checking miniz_oxide v0.8.8
Checking amplify v4.6.0
Checking cyphergraphy v0.3.0
Checking gix-hash v0.15.1
Checking same-file v1.0.6
Compiling crossbeam-utils v0.8.19
Checking keccak v0.1.5
Checking flate2 v1.1.1
Checking sha3 v0.10.8
Checking walkdir v2.5.0
Compiling git-ref-format-core v0.3.1
Checking polyval v0.6.2
Checking hmac v0.12.1
Compiling sqlite3-src v0.5.1
Checking prodash v29.0.2
Checking sha1_smol v1.0.0
Checking ppv-lite86 v0.2.17
Checking base32 v0.4.0
Compiling serde_json v1.0.140
Checking base64ct v1.6.0
Checking equivalent v1.0.1
Checking rand_chacha v0.3.1
Checking indexmap v2.2.6
Checking pem-rfc7468 v0.7.0
Checking cypheraddr v0.4.0
Checking gix-features v0.39.1
Compiling git-ref-format-macro v0.3.1
Checking pbkdf2 v0.12.2
Checking ghash v0.5.1
Checking chacha20poly1305 v0.10.1
Checking aes v0.8.4
Checking ctr v0.9.2
Checking ryu v1.0.17
Checking aes-gcm v0.10.3
Checking git-ref-format v0.3.1
Checking noise-framework v0.4.0
Checking crossbeam-channel v0.5.15
Checking socks5-client v0.4.1
Checking ssh-encoding v0.2.0
Checking rand v0.8.5
Checking blowfish v0.9.1
Checking cbc v0.1.2
Checking home v0.5.9
Compiling ref-cast v1.0.24
Checking radicle-std-ext v0.1.0
Checking gix-path v0.10.15
Checking ssh-cipher v0.2.0
Checking bcrypt-pbkdf v0.10.0
Checking cyphernet v0.5.2
Compiling ref-cast-impl v1.0.24
Checking signature v2.2.0
Checking ssh-key v0.6.6
Checking qcheck v1.0.0
Checking radicle-ssh v0.9.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-ssh)
Compiling typeid v1.0.3
Checking dyn-clone v1.0.17
Checking lazy_static v1.5.0
Checking siphasher v1.0.1
Checking nonempty v0.9.0
Compiling serde_derive_internals v0.29.1
Checking radicle-dag v0.10.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-dag)
Checking erased-serde v0.4.6
Checking jiff v0.2.1
Compiling schemars_derive v1.0.4
Checking iana-time-zone v0.1.60
Checking chrono v0.4.38
Checking gix-date v0.9.4
Checking schemars v1.0.4
Checking serde-untagged v0.1.7
Checking colored v2.1.0
Checking bytesize v2.0.1
Checking localtime v1.3.1
Checking winnow v0.6.26
Checking base64 v0.21.7
Checking tree-sitter-language v0.1.2
Checking fast-glob v0.3.3
Checking gix-hashtable v0.6.0
Checking gix-validate v0.9.4
Checking memmap2 v0.9.4
Compiling anyhow v1.0.82
Checking gix-chunk v0.4.11
Checking anstyle-query v1.0.2
Checking gix-commitgraph v0.25.1
Checking gix-actor v0.33.2
Checking gix-object v0.46.1
Checking gix-fs v0.12.1
Checking sem_safe v0.2.0
Checking errno v0.3.13
Checking signals_receipts v0.2.0
Checking gix-tempfile v15.0.0
Compiling signal-hook v0.3.18
Checking gix-revwalk v0.17.0
Checking signal-hook-registry v1.4.5
Checking shell-words v1.1.0
Checking gix-command v0.4.1
Checking radicle-signals v0.11.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-signals)
Checking mio v0.8.11
Checking mio v1.0.4
Compiling tree-sitter v0.24.4
Compiling unicode-segmentation v1.11.0
Compiling convert_case v0.7.1
Checking signal-hook-mio v0.2.4
Checking gix-lock v15.0.1
Checking gix-config-value v0.14.12
Checking gix-url v0.28.2
Checking gix-quote v0.4.15
Checking regex v1.11.1
Checking gix-sec v0.10.12
Compiling rustix v1.0.7
Checking gix-prompt v0.9.1
Compiling derive_more-impl v2.0.1
Compiling xattr v1.3.1
Compiling filetime v0.2.23
Checking gix-traverse v0.43.1
Checking gix-revision v0.31.1
Checking gix-diff v0.49.0
Checking gix-packetline v0.18.4
Checking utf8parse v0.2.1
Checking lexopt v0.3.0
Checking linux-raw-sys v0.9.4
Checking bitflags v1.3.2
Compiling litrs v0.4.1
Compiling document-features v0.2.11
Checking crossterm v0.25.0
Checking gix-transport v0.44.0
Checking anstyle-parse v0.2.3
Checking gix-pack v0.56.0
Checking gix-refspec v0.27.0
Checking derive_more v2.0.1
Compiling tar v0.4.40
Checking gix-credentials v0.26.0
Checking newline-converter v0.3.0
Checking gix-ref v0.49.1
Checking gix-shallow v0.1.0
Checking gix-negotiate v0.17.0
Checking fxhash v0.2.1
Compiling maybe-async v0.2.10
Checking unicode-width v0.1.11
Checking arc-swap v1.7.1
Checking anstyle v1.0.6
Checking colorchoice v1.0.0
Checking streaming-iterator v0.1.9
Checking gix-protocol v0.47.0
Checking anstream v0.6.13
Checking gix-odb v0.66.0
Checking inquire v0.7.5
Compiling radicle-surf v0.22.0
Checking crossterm v0.29.0
Checking sqlite3-sys v0.15.2
Checking sqlite v0.32.0
Checking unicode-display-width v0.3.0
Compiling tree-sitter-json v0.24.8
Compiling tree-sitter-md v0.3.2
Compiling tree-sitter-css v0.23.1
Compiling tree-sitter-rust v0.23.2
Compiling tree-sitter-bash v0.23.3
Compiling tree-sitter-typescript v0.23.2
Compiling tree-sitter-html v0.23.2
Compiling tree-sitter-python v0.23.4
Compiling tree-sitter-toml-ng v0.6.0
Compiling tree-sitter-ruby v0.23.1
Compiling tree-sitter-c v0.23.2
Compiling tree-sitter-go v0.23.4
Checking either v1.11.0
Checking snapbox-macros v0.3.8
Checking salsa20 v0.10.2
Checking similar v2.5.0
Checking normalize-line-endings v0.3.0
Checking base64 v0.13.1
Checking nonempty v0.5.0
Compiling radicle-cli v0.14.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-cli)
Checking siphasher v0.3.11
Checking bloomy v1.2.0
Checking snapbox v0.4.17
Checking scrypt v0.11.0
Checking tree-sitter-highlight v0.24.4
Checking popol v3.0.0
Checking bytes v1.10.1
Checking timeago v0.4.2
Checking io-reactor v0.5.2
Checking socket2 v0.5.7
Checking yansi v0.5.1
Checking diff v0.1.13
Compiling radicle-node v0.12.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-node)
Checking pretty_assertions v1.4.0
Checking netservices v0.8.0
Checking num-integer v0.1.46
Compiling escargot v0.5.10
Checking radicle-systemd v0.9.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-systemd)
Compiling qcheck-macros v1.0.0
Checking num-bigint v0.4.6
Compiling ahash v0.8.11
Compiling radicle-remote-helper v0.11.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-remote-helper)
Checking num-iter v0.1.45
Checking num-complex v0.4.6
Checking num-rational v0.4.2
Checking zerocopy v0.7.35
Checking bit-vec v0.8.0
Checking borrow-or-share v0.2.2
Checking fluent-uri v0.3.2
Checking bit-set v0.8.0
Checking num v0.4.3
Checking phf_shared v0.11.3
Checking outref v0.5.2
Checking vsimd v0.8.0
Checking uuid v1.16.0
Checking referencing v0.30.0
Checking phf v0.11.3
Checking uuid-simd v0.8.0
Checking fraction v0.15.3
Checking fancy-regex v0.14.0
Checking email_address v0.2.9
Checking bytecount v0.6.8
Checking num-cmp v0.1.0
Checking base64 v0.22.1
Checking emojis v0.6.4
Checking jsonschema v0.30.0
Checking git2 v0.19.0
Checking radicle-git-ext v0.8.1
Checking radicle-term v0.13.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-term)
Checking radicle-crypto v0.12.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-crypto)
Checking radicle-cob v0.14.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-cob)
Checking radicle v0.16.1 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle)
Checking radicle-fetch v0.12.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-fetch)
Checking radicle-cli-test v0.11.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-cli-test)
Checking radicle-protocol v0.1.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-protocol)
Checking radicle-schemars v0.1.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-schemars)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 47.65s
+ cargo build --all-targets --workspace
Compiling cfg-if v1.0.0
Compiling libc v0.2.174
Compiling shlex v1.3.0
Compiling memchr v2.7.2
Compiling serde v1.0.219
Compiling smallvec v1.13.2
Compiling regex-syntax v0.8.5
Compiling jobserver v0.1.31
Compiling cc v1.2.2
Compiling getrandom v0.2.15
Compiling aho-corasick v1.1.3
Compiling regex-automata v0.4.9
Compiling typenum v1.17.0
Compiling log v0.4.21
Compiling generic-array v0.14.7
Compiling rand_core v0.6.4
Compiling bitflags v2.9.1
Compiling fastrand v2.1.0
Compiling crypto-common v0.1.6
Compiling scopeguard v1.2.0
Compiling lock_api v0.4.11
Compiling zerofrom v0.1.6
Compiling parking_lot_core v0.9.9
Compiling stable_deref_trait v1.2.0
Compiling subtle v2.5.0
Compiling parking_lot v0.12.3
Compiling yoke v0.7.5
Compiling tinyvec_macros v0.1.1
Compiling once_cell v1.21.3
Compiling zerovec v0.10.4
Compiling tinyvec v1.6.0
Compiling zeroize v1.7.0
Compiling cpufeatures v0.2.12
Compiling writeable v0.5.5
Compiling unicode-normalization v0.1.23
Compiling tinystr v0.7.6
Compiling bstr v1.9.1
Compiling litemap v0.7.5
Compiling icu_locid v1.5.0
Compiling block-padding v0.3.3
Compiling thiserror v2.0.12
Compiling inout v0.1.3
Compiling icu_locid_transform_data v1.5.1
Compiling block-buffer v0.10.4
Compiling adler2 v2.0.0
Compiling icu_provider v1.5.0
Compiling itoa v1.0.11
Compiling hashbrown v0.14.3
Compiling icu_locid_transform v1.5.0
Compiling digest v0.10.7
Compiling miniz_oxide v0.8.8
Compiling cipher v0.4.4
Compiling icu_properties_data v1.5.1
Compiling crc32fast v1.4.0
Compiling icu_collections v1.5.0
Compiling icu_normalizer_data v1.5.1
Compiling utf16_iter v1.0.5
Compiling write16 v1.0.0
Compiling utf8_iter v1.0.4
Compiling percent-encoding v2.3.1
Compiling linux-raw-sys v0.4.13
Compiling thiserror v1.0.69
Compiling icu_properties v1.5.1
Compiling rustix v0.38.34
Compiling sha2 v0.10.8
Compiling form_urlencoded v1.2.1
Compiling universal-hash v0.5.1
Compiling opaque-debug v0.3.1
Compiling libz-sys v1.1.16
Compiling gix-trace v0.1.12
Compiling byteorder v1.5.0
Compiling signature v1.6.4
Compiling amplify_num v0.5.2
Compiling data-encoding v2.5.0
Compiling icu_normalizer v1.5.0
Compiling idna_adapter v1.2.0
Compiling idna v1.0.3
Compiling tempfile v3.10.1
Compiling url v2.5.4
Compiling ascii v1.1.0
Compiling data-encoding-macro v0.1.14
Compiling ed25519 v1.5.3
Compiling amplify v4.6.0
Compiling libgit2-sys v0.17.0+1.8.1
Compiling aead v0.5.2
Compiling faster-hex v0.9.0
Compiling ct-codecs v1.1.1
Compiling base-x v0.2.11
Compiling multibase v0.9.1
Compiling ec25519 v0.1.0
Compiling poly1305 v0.8.0
Compiling chacha20 v0.9.1
Compiling gix-utils v0.1.14
Compiling cyphergraphy v0.3.0
Compiling num-traits v0.2.19
Compiling gix-hash v0.15.1
Compiling same-file v1.0.6
Compiling keccak v0.1.5
Compiling walkdir v2.5.0
Compiling sha3 v0.10.8
Compiling polyval v0.6.2
Compiling git-ref-format-core v0.3.1
Compiling flate2 v1.1.1
Compiling hmac v0.12.1
Compiling sqlite3-src v0.5.1
Compiling prodash v29.0.2
Compiling base64ct v1.6.0
Compiling sha1_smol v1.0.0
Compiling equivalent v1.0.1
Compiling base32 v0.4.0
Compiling ppv-lite86 v0.2.17
Compiling cypheraddr v0.4.0
Compiling rand_chacha v0.3.1
Compiling indexmap v2.2.6
Compiling pem-rfc7468 v0.7.0
Compiling gix-features v0.39.1
Compiling git-ref-format-macro v0.3.1
Compiling pbkdf2 v0.12.2
Compiling ghash v0.5.1
Compiling crossbeam-utils v0.8.19
Compiling chacha20poly1305 v0.10.1
Compiling aes v0.8.4
Compiling ctr v0.9.2
Compiling ryu v1.0.17
Compiling aes-gcm v0.10.3
Compiling serde_json v1.0.140
Compiling git-ref-format v0.3.1
Compiling noise-framework v0.4.0
Compiling crossbeam-channel v0.5.15
Compiling ssh-encoding v0.2.0
Compiling rand v0.8.5
Compiling socks5-client v0.4.1
Compiling blowfish v0.9.1
Compiling cbc v0.1.2
Compiling home v0.5.9
Compiling radicle-std-ext v0.1.0
Compiling gix-path v0.10.15
Compiling ssh-cipher v0.2.0
Compiling bcrypt-pbkdf v0.10.0
Compiling cyphernet v0.5.2
Compiling signature v2.2.0
Compiling ref-cast v1.0.24
Compiling ssh-key v0.6.6
Compiling qcheck v1.0.0
Compiling radicle-ssh v0.9.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-ssh)
Compiling dyn-clone v1.0.17
Compiling lazy_static v1.5.0
Compiling siphasher v1.0.1
Compiling typeid v1.0.3
Compiling radicle-dag v0.10.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-dag)
Compiling nonempty v0.9.0
Compiling erased-serde v0.4.6
Compiling iana-time-zone v0.1.60
Compiling jiff v0.2.1
Compiling serde-untagged v0.1.7
Compiling chrono v0.4.38
Compiling schemars v1.0.4
Compiling gix-date v0.9.4
Compiling colored v2.1.0
Compiling localtime v1.3.1
Compiling bytesize v2.0.1
Compiling winnow v0.6.26
Compiling base64 v0.21.7
Compiling tree-sitter-language v0.1.2
Compiling fast-glob v0.3.3
Compiling gix-actor v0.33.2
Compiling gix-hashtable v0.6.0
Compiling gix-validate v0.9.4
Compiling memmap2 v0.9.4
Compiling gix-object v0.46.1
Compiling gix-chunk v0.4.11
Compiling anstyle-query v1.0.2
Compiling gix-commitgraph v0.25.1
Compiling anyhow v1.0.82
Compiling gix-fs v0.12.1
Compiling gix-revwalk v0.17.0
Compiling sem_safe v0.2.0
Compiling errno v0.3.13
Compiling unicode-segmentation v1.11.0
Compiling signals_receipts v0.2.0
Compiling gix-tempfile v15.0.0
Compiling signal-hook-registry v1.4.5
Compiling shell-words v1.1.0
Compiling signal-hook v0.3.18
Compiling gix-command v0.4.1
Compiling radicle-signals v0.11.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-signals)
Compiling mio v1.0.4
Compiling mio v0.8.11
Compiling tree-sitter v0.24.4
Compiling signal-hook-mio v0.2.4
Compiling gix-lock v15.0.1
Compiling convert_case v0.7.1
Compiling gix-config-value v0.14.12
Compiling gix-url v0.28.2
Compiling gix-quote v0.4.15
Compiling regex v1.11.1
Compiling gix-sec v0.10.12
Compiling derive_more-impl v2.0.1
Compiling gix-prompt v0.9.1
Compiling xattr v1.3.1
Compiling gix-traverse v0.43.1
Compiling gix-revision v0.31.1
Compiling gix-diff v0.49.0
Compiling gix-packetline v0.18.4
Compiling filetime v0.2.23
Compiling linux-raw-sys v0.9.4
Compiling bitflags v1.3.2
Compiling utf8parse v0.2.1
Compiling lexopt v0.3.0
Compiling rustix v1.0.7
Compiling anstyle-parse v0.2.3
Compiling crossterm v0.25.0
Compiling sqlite3-sys v0.15.2
Compiling sqlite v0.32.0
Compiling tar v0.4.40
Compiling gix-transport v0.44.0
Compiling gix-pack v0.56.0
Compiling gix-refspec v0.27.0
Compiling derive_more v2.0.1
Compiling gix-credentials v0.26.0
Compiling gix-ref v0.49.1
Compiling gix-shallow v0.1.0
Compiling newline-converter v0.3.0
Compiling gix-negotiate v0.17.0
Compiling fxhash v0.2.1
Compiling anstyle v1.0.6
Compiling arc-swap v1.7.1
Compiling streaming-iterator v0.1.9
Compiling colorchoice v1.0.0
Compiling unicode-width v0.1.11
Compiling anstream v0.6.13
Compiling inquire v0.7.5
Compiling gix-odb v0.66.0
Compiling gix-protocol v0.47.0
Compiling radicle-surf v0.22.0
Compiling crossterm v0.29.0
Compiling unicode-display-width v0.3.0
Compiling tree-sitter-json v0.24.8
Compiling tree-sitter-ruby v0.23.1
Compiling tree-sitter-html v0.23.2
Compiling tree-sitter-toml-ng v0.6.0
Compiling tree-sitter-typescript v0.23.2
Compiling tree-sitter-rust v0.23.2
Compiling tree-sitter-md v0.3.2
Compiling tree-sitter-python v0.23.4
Compiling tree-sitter-css v0.23.1
Compiling tree-sitter-go v0.23.4
Compiling tree-sitter-bash v0.23.3
Compiling tree-sitter-c v0.23.2
Compiling either v1.11.0
Compiling snapbox-macros v0.3.8
Compiling salsa20 v0.10.2
Compiling normalize-line-endings v0.3.0
Compiling nonempty v0.5.0
Compiling radicle-cli v0.14.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-cli)
Compiling siphasher v0.3.11
Compiling similar v2.5.0
Compiling base64 v0.13.1
Compiling snapbox v0.4.17
Compiling bloomy v1.2.0
Compiling scrypt v0.11.0
Compiling tree-sitter-highlight v0.24.4
Compiling popol v3.0.0
Compiling timeago v0.4.2
Compiling bytes v1.10.1
Compiling io-reactor v0.5.2
Compiling socket2 v0.5.7
Compiling diff v0.1.13
Compiling yansi v0.5.1
Compiling radicle-node v0.12.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-node)
Compiling pretty_assertions v1.4.0
Compiling netservices v0.8.0
Compiling num-integer v0.1.46
Compiling radicle-systemd v0.9.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-systemd)
Compiling escargot v0.5.10
Compiling num-bigint v0.4.6
Compiling radicle-remote-helper v0.11.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-remote-helper)
Compiling num-iter v0.1.45
Compiling num-complex v0.4.6
Compiling num-rational v0.4.2
Compiling bit-vec v0.8.0
Compiling borrow-or-share v0.2.2
Compiling zerocopy v0.7.35
Compiling fluent-uri v0.3.2
Compiling bit-set v0.8.0
Compiling ahash v0.8.11
Compiling num v0.4.3
Compiling phf_shared v0.11.3
Compiling uuid v1.16.0
Compiling vsimd v0.8.0
Compiling outref v0.5.2
Compiling referencing v0.30.0
Compiling phf v0.11.3
Compiling uuid-simd v0.8.0
Compiling fraction v0.15.3
Compiling fancy-regex v0.14.0
Compiling email_address v0.2.9
Compiling num-cmp v0.1.0
Compiling base64 v0.22.1
Compiling bytecount v0.6.8
Compiling emojis v0.6.4
Compiling jsonschema v0.30.0
Compiling git2 v0.19.0
Compiling radicle-git-ext v0.8.1
Compiling radicle-term v0.13.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-term)
Compiling radicle-crypto v0.12.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-crypto)
Compiling radicle-cob v0.14.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-cob)
Compiling radicle v0.16.1 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle)
Compiling radicle-fetch v0.12.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-fetch)
Compiling radicle-protocol v0.1.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-protocol)
Compiling radicle-cli-test v0.11.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-cli-test)
Compiling radicle-schemars v0.1.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-schemars)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1m 12s
+ cargo doc --workspace --no-deps
Checking regex-automata v0.4.9
Compiling syn v1.0.109
Checking idna v1.0.3
Checking radicle-ssh v0.9.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-ssh)
Compiling num-traits v0.2.19
Checking url v2.5.4
Checking radicle-dag v0.10.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-dag)
Checking git2 v0.19.0
Checking chrono v0.4.38
Checking bstr v1.9.1
Compiling amplify_syn v2.0.1
Compiling proc-macro-error v1.0.4
Checking gix-path v0.10.15
Checking git-ref-format-core v0.3.1
Compiling amplify_derive v4.0.0
Compiling data-encoding-macro-internal v0.1.12
Compiling git-ref-format-macro v0.3.1
Checking gix-date v0.9.4
Checking gix-actor v0.33.2
Checking gix-validate v0.9.4
Checking gix-object v0.46.1
Checking git-ref-format v0.3.1
Checking data-encoding-macro v0.1.14
Checking radicle-git-ext v0.8.1
Checking multibase v0.9.1
Checking gix-commitgraph v0.25.1
Checking gix-command v0.4.1
Checking radicle-signals v0.11.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-signals)
Checking regex v1.11.1
Checking gix-revwalk v0.17.0
Checking gix-url v0.28.2
Checking gix-config-value v0.14.12
Checking gix-quote v0.4.15
Checking gix-traverse v0.43.1
Checking tree-sitter v0.24.4
Checking gix-prompt v0.9.1
Checking gix-revision v0.31.1
Checking gix-diff v0.49.0
Checking gix-packetline v0.18.4
Checking radicle-surf v0.22.0
Checking gix-refspec v0.27.0
Checking gix-transport v0.44.0
Checking amplify v4.6.0
Compiling radicle-cli v0.14.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-cli)
Checking gix-pack v0.56.0
Checking cyphergraphy v0.3.0
Checking tree-sitter-toml-ng v0.6.0
Checking tree-sitter-highlight v0.24.4
Checking gix-credentials v0.26.0
Checking cypheraddr v0.4.0
Checking noise-framework v0.4.0
Checking gix-negotiate v0.17.0
Checking gix-shallow v0.1.0
Checking socks5-client v0.4.1
Checking cyphernet v0.5.2
Checking gix-ref v0.49.1
Checking radicle-crypto v0.12.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-crypto)
Checking radicle-term v0.13.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-term)
Checking gix-odb v0.66.0
Checking io-reactor v0.5.2
Compiling radicle-node v0.12.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-node)
Checking radicle-cob v0.14.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-cob)
Checking netservices v0.8.0
Checking gix-protocol v0.47.0
Checking radicle-systemd v0.9.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-systemd)
Documenting radicle-cob v0.14.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-cob)
Documenting radicle-crypto v0.12.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-crypto)
Checking radicle v0.16.1 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle)
Documenting radicle v0.16.1 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle)
Documenting radicle-term v0.13.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-term)
Documenting radicle-signals v0.11.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-signals)
Documenting radicle-ssh v0.9.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-ssh)
Documenting radicle-dag v0.10.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-dag)
Documenting radicle-systemd v0.9.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-systemd)
Checking radicle-fetch v0.12.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-fetch)
Documenting radicle-cli v0.14.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-cli)
Documenting radicle-fetch v0.12.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-fetch)
Checking radicle-protocol v0.1.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-protocol)
Documenting radicle-protocol v0.1.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-protocol)
Documenting radicle-node v0.12.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-node)
Documenting radicle-schemars v0.1.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-schemars)
Documenting radicle-remote-helper v0.11.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-remote-helper)
warning: unresolved link to `T`
--> crates/radicle-protocol/src/wire/frame.rs:192:94
|
192 | /// | Stream ID |TTT|I| Stream ID with Stream [T]ype and [I]nitiator bits
| ^ no item named `T` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
warning: unresolved link to `I`
--> crates/radicle-protocol/src/wire/frame.rs:192:105
|
192 | /// | Stream ID |TTT|I| Stream ID with Stream [T]ype and [I]nitiator bits
| ^ no item named `I` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
warning: `radicle-protocol` (lib doc) generated 2 warnings
Checking radicle-remote-helper v0.11.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-remote-helper)
Documenting radicle-cli-test v0.11.0 (/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-cli-test)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 11.32s
Generated /6d656168-e189-4240-8bd0-8a590cb88420/w/target/doc/radicle/index.html and 16 other files
+ cargo test --workspace --no-fail-fast
Finished `test` profile [unoptimized + debuginfo] target(s) in 0.13s
Running unittests src/lib.rs (target/debug/deps/radicle-8d3844ccac8b27e9)
running 205 tests
test canonical::formatter::test::ascii_control_characters ... ok
test canonical::formatter::test::ordered_nested_object ... ok
test canonical::formatter::test::securesystemslib_asserts ... ok
test cob::cache::migrations::_2::tests::test_patch_json_deserialization ... ok
test cob::cache::tests::test_check_version ... ok
test cob::common::test::test_color ... ok
test cob::common::test::test_emojis ... ok
test cob::cache::migrations::_2::tests::test_migration_2 ... ok
test cob::cache::tests::test_migrate_to ... ok
test cob::identity::test::prop_json_eq_str ... ok
test cob::identity::test::test_identity_redact_revision ... ok
test cob::identity::test::test_identity_update_rejected ... ok
test cob::identity::test::test_identity_remove_delegate_concurrent ... ok
test cob::identity::test::test_identity_reject_concurrent ... ok
test cob::identity::test::test_identity_updates ... ok
test cob::issue::cache::tests::test_counts ... ok
test cob::issue::cache::tests::test_get ... ok
test cob::issue::cache::tests::test_is_empty ... ok
test cob::issue::cache::tests::test_list ... ok
test cob::issue::cache::tests::test_list_by_status ... ok
test cob::issue::cache::tests::test_remove ... ok
test cob::identity::test::test_valid_identity ... ok
test cob::issue::test::test_embeds ... ok
test cob::identity::test::test_identity_updates_concurrent ... ok
test cob::issue::test::test_embeds_edit ... ok
test cob::identity::test::test_identity_updates_concurrent_outdated ... ok
test cob::issue::test::test_invalid_actions ... ok
test cob::issue::test::test_invalid_tx_reference ... ok
test cob::issue::test::test_invalid_tx ... ok
test cob::issue::test::test_invalid_cob ... ok
test cob::issue::test::test_concurrency ... ok
test cob::issue::test::test_issue_all ... ok
test cob::issue::test::test_issue_comment ... ok
test cob::issue::test::test_issue_comment_redact ... ok
test cob::issue::test::test_issue_create_and_assign ... ok
test cob::issue::test::test_issue_create_and_change_state ... ok
test cob::issue::test::test_issue_create_and_get ... ok
test cob::issue::test::test_issue_create_and_reassign ... ok
test cob::issue::test::test_issue_create_and_unassign ... ok
test cob::issue::test::test_issue_edit ... ok
test cob::issue::test::test_issue_edit_description ... ok
test cob::issue::test::test_issue_multilines ... ok
test cob::issue::test::test_issue_state_serde ... ok
test cob::issue::test::test_ordering ... ok
test cob::patch::actions::test::test_review_edit ... ok
test cob::issue::test::test_issue_label ... ok
test cob::issue::test::test_issue_react ... ok
test cob::issue::test::test_issue_reply ... ok
test cob::patch::cache::tests::test_is_empty ... ok
test cob::patch::cache::tests::test_get ... ok
test cob::patch::cache::tests::test_list ... ok
test cob::patch::cache::tests::test_remove ... ok
test cob::patch::encoding::review::test::test_review_deserialize_summary_migration_null_summary ... ok
test cob::patch::encoding::review::test::test_review_deserialize_summary_migration_with_summary ... ok
test cob::patch::encoding::review::test::test_review_deserialize_summary_migration_without_summary ... ok
test cob::patch::encoding::review::test::test_review_deserialize_summary_v2 ... ok
test cob::patch::encoding::review::test::test_review_summary ... ok
test cob::patch::test::test_json ... ok
test cob::patch::test::test_json_serialization ... ok
test cob::patch::test::test_patch_create_and_get ... ok
test cob::patch::cache::tests::test_list_by_status ... ok
test cob::patch::cache::tests::test_counts ... ok
test cob::patch::cache::tests::test_find_by_revision ... ok
test cob::patch::test::test_patch_merge ... ok
test cob::patch::test::test_patch_discussion ... ok
test cob::patch::test::test_patch_redact ... ok
test cob::patch::test::test_patch_review_duplicate ... ok
test cob::patch::test::test_patch_review_comment ... ok
test cob::patch::test::test_patch_review ... ok
test cob::patch::test::test_patch_review_edit ... ok
test cob::patch::test::test_patch_review_edit_comment ... ok
test cob::patch::test::test_reactions_json_serialization ... ok
test cob::patch::test::test_patch_review_remove_summary ... ok
test cob::patch::test::test_revision_edit_redact ... ok
test cob::patch::test::test_revision_review_merge_redacted ... ok
test cob::patch::test::test_revision_reaction ... ok
test cob::thread::tests::test_comment_edit_missing ... ok
test cob::thread::tests::test_comment_edit_redacted ... ok
test cob::thread::tests::test_comment_redact_missing ... ok
test cob::thread::tests::test_duplicate_comments ... ok
test cob::thread::tests::test_edit_comment ... ok
test cob::thread::tests::test_redact_comment ... ok
test cob::thread::tests::test_timeline ... ok
test cob::patch::test::test_patch_review_revision_redact ... ok
test git::canonical::rules::tests::test_deserialization ... ok
test git::canonical::rules::tests::test_deserialize_extensions ... ok
test git::canonical::rules::tests::test_order ... ok
test git::canonical::rules::tests::test_roundtrip ... ok
test cob::patch::test::test_patch_update ... ok
test git::canonical::rules::tests::test_rule_validate_success ... ok
test git::canonical::rules::tests::test_special_branches ... ok
test git::canonical::rules::tests::test_canonical ... ok
test git::canonical::tests::test_quorum_merges ... ok
test git::canonical::rules::tests::test_rule_validate_failures ... ok
test git::test::test_version_from_str ... ok
test git::test::test_version_ord ... ok
test identity::did::test::test_did_encode_decode ... ok
test identity::did::test::test_did_vectors ... ok
test identity::doc::id::test::prop_from_str ... ok
test git::canonical::tests::test_quorum ... ok
test identity::doc::test::test_canonical_doc ... ok
test identity::doc::test::test_canonical_example ... ok
test identity::doc::test::test_duplicate_dids ... ok
test identity::doc::test::test_future_version_error ... ok
test identity::doc::test::test_is_valid_version ... ok
test git::canonical::tests::test_quorum_properties ... ok
test identity::doc::test::test_not_found ... ok
test identity::doc::test::test_parse_version ... ok
test identity::doc::test::test_visibility_json ... ok
test identity::doc::update::test::test_can_update_crefs ... ok
test identity::doc::update::test::test_cannot_include_default_branch_rule ... ok
test identity::doc::update::test::test_default_branch_rule_exists_after_verification ... ok
test identity::project::test::test_project_name ... ok
test node::address::store::test::test_alias ... ok
test node::address::store::test::test_disconnected ... ok
test node::address::store::test::test_disconnected_ban ... ok
test identity::doc::test::test_max_delegates ... ok
test node::address::store::test::test_entries ... ok
test node::address::store::test::test_get_none ... ok
test node::address::store::test::test_insert_and_get ... ok
test node::address::store::test::test_empty ... ok
test node::address::store::test::test_insert_and_update ... ok
test node::address::store::test::test_insert_duplicate ... ok
test node::address::store::test::test_node_aliases ... ok
test node::address::store::test::test_insert_and_remove ... ok
test node::address::store::test::test_remove_nothing ... ok
test node::features::test::test_operations ... ok
test node::db::test::test_version ... ok
test node::notifications::store::test::test_branch_notifications ... ok
test node::notifications::store::test::test_clear ... ok
test node::notifications::store::test::test_cob_notifications ... ok
test node::notifications::store::test::test_counts_by_repo ... ok
test node::notifications::store::test::test_duplicate_notifications ... ok
test node::notifications::store::test::test_notification_status ... ok
test node::policy::store::test::test_follow_and_unfollow_node ... ok
test node::policy::store::test::test_node_policies ... ok
test node::policy::store::test::test_node_aliases ... ok
test node::policy::store::test::test_repo_policies ... ok
test node::policy::store::test::test_repo_policy ... ok
test node::policy::store::test::test_node_policy ... ok
test node::policy::store::test::test_seed_and_unseed_repo ... ok
test node::policy::store::test::test_update_scope ... ok
test node::policy::store::test::test_update_alias ... ok
test node::refs::store::test::test_set_and_delete ... ok
test node::refs::store::test::test_count ... ok
test node::routing::test::test_count ... ok
test node::refs::store::test::test_set_and_get ... ok
test node::routing::test::test_entries ... ok
test node::routing::test::test_insert_and_get_resources ... ok
test node::routing::test::test_insert_and_get ... ok
test node::routing::test::test_insert_duplicate ... ok
test node::routing::test::test_insert_existing_updated_time ... ok
test node::routing::test::test_len ... ok
test node::routing::test::test_insert_and_remove ... ok
test node::routing::test::test_remove_many ... ok
test node::routing::test::test_remove_redundant ... ok
test node::routing::test::test_update_existing_multi ... ok
test cob::thread::tests::prop_ordering ... ok
test node::sync::announce::test::announcer_must_reach_preferred_seeds ... ok
test node::sync::announce::test::announcer_reached_max_replication_target ... ok
test node::routing::test::test_prune ... ok
test node::sync::announce::test::announcer_will_minimise_replication_factor ... ok
test node::sync::announce::test::announcer_reached_min_replication_target ... ok
test node::sync::announce::test::announcer_timed_out ... ok
test node::sync::announce::test::cannot_construct_announcer ... ok
test node::sync::fetch::test::could_not_reach_target ... ok
test node::sync::fetch::test::ignores_duplicates_and_local_node ... ok
test node::sync::fetch::test::preferred_seeds_target_returned_over_replicas ... ok
test node::sync::fetch::test::all_nodes_are_candidates ... ok
test node::sync::fetch::test::all_nodes_are_fetchable ... ok
test node::sync::fetch::test::reaches_target_of_preferred_seeds ... ok
test node::sync::fetch::test::reaches_target_of_replicas ... ok
test node::sync::test::ensure_replicas_construction ... ok
test node::sync::fetch::test::reaches_target_of_max_replicas ... ok
test node::sync::test::replicas_constrain_to ... ok
test node::test::test_alias ... ok
test node::test::test_command_result ... ok
test node::test::test_user_agent ... ok
test node::timestamp::tests::test_timestamp_max ... ok
test profile::test::canonicalize_home ... ok
test profile::test::test_config ... ok
test rad::tests::test_checkout ... ok
test rad::tests::test_fork ... ok
test serde_ext::test::test_localtime ... ok
test serde_ext::test::test_localtime_ext ... ok
test storage::git::tests::test_references_of ... ok
test rad::tests::test_init ... ok
test profile::config::test::schema ... ok
test storage::git::transport::local::url::test::test_url_parse ... ok
test storage::git::transport::local::url::test::test_url_to_string ... ok
test storage::git::transport::remote::url::test::test_url_parse ... ok
test storage::refs::tests::prop_canonical_roundtrip ... ok
test storage::git::tests::test_sign_refs ... ok
test storage::tests::test_storage ... ok
test test::assert::test::assert_with_message ... ok
test test::assert::test::test_assert_no_move ... ok
test test::assert::test::test_assert_panic_0 - should panic ... ok
test test::assert::test::test_assert_panic_1 - should panic ... ok
test test::assert::test::test_assert_panic_2 - should panic ... ok
test test::assert::test::test_assert_succeed ... ok
test test::assert::test::test_panic_message ... ok
test version::test::test_version ... ok
test storage::git::tests::test_remote_refs ... ok
test storage::refs::tests::test_rid_verification ... ok
test identity::doc::test::prop_encode_decode ... ok
test result: ok. 205 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.75s
Running unittests src/lib.rs (target/debug/deps/radicle_cli-2df9fe4341e90684)
running 14 tests
test commands::rad_inspect::test::test_tree ... ok
test commands::rad_patch::review::builder::tests::test_review_comments_before ... ok
test commands::rad_patch::review::builder::tests::test_review_comments_split_hunk ... ok
test git::pretty_diff::test::test_pretty ... ignored
test commands::rad_patch::review::builder::tests::test_review_comments_multiline ... ok
test commands::rad_patch::review::builder::tests::test_review_comments_basic ... ok
test git::ddiff::tests::diff_encode_decode_ddiff_hunk ... ok
test git::unified_diff::test::test_diff_encode_decode_diff ... ok
test git::unified_diff::test::test_diff_content_encode_decode_content ... ok
test terminal::format::test::test_strip_comments ... ok
test terminal::format::test::test_bytes ... ok
test terminal::patch::test::test_edit_display_message ... ok
test terminal::patch::test::test_create_display_message ... ok
test terminal::patch::test::test_update_display_message ... ok
test result: ok. 13 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.01s
Running unittests src/main.rs (target/debug/deps/rad-a9a1c94ae52966c6)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running tests/commands.rs (target/debug/deps/commands-f0c84ab586d24d91)
running 98 tests
test framework_home ... ok
test git_push_amend ... ok
test git_push_and_fetch ... ok
test git_push_canonical_tags ... ok
test git_push_diverge ... ok
test git_push_rollback ... ok
test rad_auth_errors ... ok
test rad_block ... ok
test rad_auth ... ok
test rad_checkout ... ok
test git_tag ... ok
test git_push_converge ... ok
test rad_clone ... ok
test rad_clone_connect ... ok
test rad_clean ... ok
test rad_clone_unknown ... ok
test rad_clone_directory ... ok
test rad_clone_all ... ok
test rad_cob_multiset ... ok
test rad_cob_log ... ok
test rad_clone_partial_fail ... ok
test rad_cob_show ... ok
test rad_cob_migrate ... ok
test rad_cob_update ... ok
test rad_config ... ok
test rad_cob_update_identity ... ok
test rad_diff ... ok
test rad_id_collaboration ... ignored, slow
test rad_id ... ok
test rad_id_conflict ... ok
test rad_id_private ... ok
test rad_id_threshold ... ok
test rad_id_multi_delegate ... ok
test rad_id_unknown_field ... ok
test rad_id_update_delete_field ... ok
test rad_id_threshold_soft_fork ... ok
test rad_init ... ignored, part of many other tests
test rad_init_existing ... ok
test rad_init_no_git ... ok
test rad_init_no_seed ... ok
test rad_init_private ... ok
test rad_init_private_clone ... ok
test rad_inbox ... ok
test rad_init_private_no_seed ... ok
test rad_init_private_clone_seed ... ok
test rad_init_private_seed ... ok
test rad_fetch ... ok
test rad_init_sync_not_connected ... ok
test rad_fork ... ok
test rad_init_with_existing_remote ... ok
test rad_inspect ... ok
test rad_init_sync_preferred ... ok
test rad_issue ... ok
test rad_merge_after_update ... ok
test rad_merge_no_ff ... ok
test rad_merge_via_push ... ok
test rad_node_connect ... ok
test rad_node_connect_without_address ... ok
test rad_patch ... ok
test rad_node ... ok
test rad_patch_ahead_behind ... ok
test rad_patch_change_base ... ok
test rad_patch_checkout ... ok
test rad_patch_checkout_revision ... ok
test rad_patch_checkout_force ... ok
test rad_patch_detached_head ... ok
test rad_patch_diff ... ok
test rad_init_sync_and_clone ... ok
test rad_patch_draft ... ok
test rad_patch_edit ... ok
test rad_init_sync_timeout ... ok
test rad_patch_merge_draft ... ok
test rad_patch_fetch_2 ... ok
test rad_patch_delete ... ok
test rad_patch_fetch_1 ... ok
test rad_patch_revert_merge ... ok
test rad_patch_update ... ok
test rad_publish ... ok
test rad_patch_open_explore ... ok
test rad_patch_via_push ... ok
test rad_review_by_hunk ... ok
test rad_seed_and_follow ... ok
test rad_remote ... ok
test rad_self ... ok
test rad_seed_many ... ok
test rad_sync_without_node ... ok
test rad_push_and_pull_patches ... ok
test rad_unseed ... ok
test rad_warn_old_nodes ... FAILED
test rad_unseed_many ... ok
test rad_sync ... ok
test rad_watch ... ok
test test_clone_without_seeds ... ok
test test_cob_deletion ... ok
test test_cob_replication ... ok
test rad_workflow ... ok
test rad_patch_pull_update ... ok
test test_replication_via_seed ... ok
failures:
---- rad_warn_old_nodes stdout ----
1788853998 test: Using PATH ["/6d656168-e189-4240-8bd0-8a590cb88420/w/crates/radicle-cli/target/debug", "/usr/local/cargo/bin", "/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin", "/tmp/radicle-amWzxg/work/alice"]
1788853998 test: rad-warn-old-nodes.md: Running `/6d656168-e189-4240-8bd0-8a590cb88420/w/target/debug/rad` with ["config", "push", "preferredSeeds", "z6MkrLMMsiPWUcNPHcRajuMi9mDfYckSoJyPwwnknocNYPm7@seed.radicle.garden:8776"] in `/tmp/radicle-amWzxg/work/alice`..
1788853998 test: rad-warn-old-nodes.md: Running `/6d656168-e189-4240-8bd0-8a590cb88420/w/target/debug/rad` with ["config", "push", "node.connect", "z6Mkmqogy2qEM2ummccUthFEaaHvyYmYBYh3dbe9W4ebScxo@ash.radicle.garden:8776"] in `/tmp/radicle-amWzxg/work/alice`..
1788853998 test: rad-warn-old-nodes.md: Running `/6d656168-e189-4240-8bd0-8a590cb88420/w/target/debug/rad` with ["debug"] in `/tmp/radicle-amWzxg/work/alice`..
thread 'rad_warn_old_nodes' panicked at crates/radicle-cli-test/src/lib.rs:487:36:
--- Expected
++++ actual: stdout
1 1 | {
2 2 | "radExe": "[..]",
3 3 | "radVersion": "[..]",
4 - "radicleNodeVersion": "radicle-node [..]",
5 - "gitRemoteRadVersion": "git-remote-rad [..]",
6 - "gitVersion": "git version [..]",
7 - "sshVersion": "[..]",
8 - "gitHead": "[..]",
4 + "radicleNodeVersion": "<unknown>",
5 + "gitRemoteRadVersion": "git-remote-rad pre-release (3c5668ed)",
6 + "gitVersion": "git version 2.47.3",
7 + "sshVersion": "OpenSSH_10.0p2 Debian-7, OpenSSL 3.5.4 30 Sep 2025",
8 + "gitHead": "3c5668ed",
9 9 | "log": {
10 10 | "filename": "[..]",
11 11 | "exists": false,
12 12 | "len": null
13 13 | },
⋮
29 29 | "warnings": [
30 30 | "Value of configuration option `node.connect` at index 0 mentions node with address 'ash.radicle.garden:8776', which has been renamed to 'rosa.radicle.xyz:8776'. Please update your configuration.",
31 31 | "Value of configuration option `preferred_seeds` at index 0 mentions node with address 'seed.radicle.garden:8776', which has been renamed to 'iris.radicle.xyz:8776'. Please update your configuration."
32 32 | ]
33 33 | }
Exit status: 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
rad_warn_old_nodes
test result: FAILED. 95 passed; 1 failed; 2 ignored; 0 measured; 0 filtered out; finished in 75.70s
error: test failed, to rerun pass `-p radicle-cli --test commands`
Running unittests src/lib.rs (target/debug/deps/radicle_cli_test-b2420d7bde3a8465)
running 3 tests
test tests::test_parse ... ok
test tests::test_run ... ok
test tests::test_example_spaced_brackets ... ok
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/lib.rs (target/debug/deps/radicle_cob-65db1d3d21109e11)
running 8 tests
test object::tests::test_serde ... ok
test tests::invalid_parse_refstr ... ok
test tests::parse_refstr ... ok
test tests::roundtrip ... ok
test type_name::test::valid_typenames ... ok
test tests::traverse_cobs ... ok
test tests::list_cobs ... ok
test tests::update_cob ... ok
test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
Running unittests src/lib.rs (target/debug/deps/radicle_crypto-0912e5a263b454ad)
running 12 tests
test ssh::fmt::test::test_key ... ok
test ssh::keystore::tests::test_init_no_passphrase ... ok
test ssh::fmt::test::test_fingerprint ... ok
test ssh::test::test_agent_encoding_remove ... ok
test ssh::test::test_agent_encoding_sign ... ok
test ssh::test::prop_encode_decode_sk ... ok
test tests::prop_encode_decode ... ok
test tests::test_e25519_dh ... ok
test tests::test_encode_decode ... ok
test tests::prop_key_equality ... ok
test ssh::keystore::tests::test_signer ... ok
test ssh::keystore::tests::test_init_passphrase ... ok
test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.80s
Running unittests src/lib.rs (target/debug/deps/radicle_dag-20ca1aca3d76c348)
running 20 tests
test tests::test_contains ... ok
test tests::test_cycle ... ok
test tests::test_dependencies ... ok
test tests::test_diamond ... ok
test tests::test_complex ... ok
test tests::test_fold_diamond ... ok
test tests::test_fold_multiple_roots ... ok
test tests::test_fold_reject ... ok
test tests::test_fold_sorting_1 ... ok
test tests::test_fold_sorting_2 ... ok
test tests::test_get ... ok
test tests::test_is_empty ... ok
test tests::test_len ... ok
test tests::test_merge_1 ... ok
test tests::test_merge_2 ... ok
test tests::test_prune_1 ... ok
test tests::test_prune_2 ... ok
test tests::test_prune_by_sorting ... ok
test tests::test_remove ... ok
test tests::test_siblings ... ok
test result: ok. 20 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/lib.rs (target/debug/deps/radicle_fetch-179ad01c416a898c)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/lib.rs (target/debug/deps/radicle_node-19e15eb812f17d76)
running 69 tests
test control::tests::test_control_socket ... ok
test control::tests::test_seed_unseed ... ok
test tests::e2e::missing_default_branch ... ok
test tests::e2e::missing_delegate_default_branch ... ok
test tests::e2e::test_catchup_on_refs_announcements ... ok
test tests::e2e::test_background_foreground_fetch ... ok
test tests::e2e::test_channel_reader_limit ... ok
test tests::e2e::test_clone ... ok
test tests::e2e::test_dont_fetch_owned_refs ... ok
test tests::e2e::test_fetch_followed_remotes ... ok
test tests::e2e::test_connection_crossing ... ok
test tests::e2e::test_fetch_preserve_owned_refs ... ok
test tests::e2e::test_fetch_unseeded ... ok
test tests::e2e::test_concurrent_fetches ... ok
test tests::e2e::test_fetch_up_to_date ... ok
test tests::e2e::test_inventory_sync_basic ... ok
test tests::e2e::test_large_fetch ... ok
test tests::e2e::test_migrated_clone ... ok
test tests::e2e::test_missing_remote ... ok
test tests::e2e::test_multiple_offline_inits ... ok
test tests::e2e::test_non_fastforward_sigrefs ... ok
test tests::e2e::test_outdated_delegate_sigrefs ... ok
test tests::e2e::test_outdated_sigrefs ... ok
test tests::e2e::test_replication ... ok
test tests::e2e::test_replication_invalid ... ok
test tests::e2e::test_replication_ref_in_sigrefs ... ok
test tests::e2e::test_inventory_sync_bridge ... ok
test tests::e2e::test_inventory_sync_ring ... ok
test tests::e2e::test_inventory_sync_star ... ok
test tests::test_announcement_rebroadcast ... ok
test tests::test_announcement_rebroadcast_duplicates ... ok
test tests::test_announcement_relay ... ok
test tests::test_announcement_rebroadcast_timestamp_filtered ... ok
test tests::test_disconnecting_unresponsive_peer ... ok
test tests::test_connection_kept_alive ... ok
test tests::test_fetch_missing_inventory_on_gossip ... ok
test tests::test_fetch_missing_inventory_on_schedule ... ok
test tests::test_inbound_connection ... ok
test tests::test_inventory_decode ... ok
test tests::test_init_and_seed ... ok
test tests::test_inventory_relay ... ok
test tests::test_inventory_relay_bad_timestamp ... ok
test tests::test_inventory_sync ... ok
test tests::test_maintain_connections ... ok
test tests::test_maintain_connections_failed_attempt ... ok
test tests::test_maintain_connections_transient ... ok
test tests::test_outbound_connection ... ok
test tests::test_persistent_peer_connect ... ok
test tests::test_inventory_pruning ... ok
test tests::test_persistent_peer_reconnect_success ... ok
test tests::test_persistent_peer_reconnect_attempt ... ok
test tests::test_ping_response ... ok
test tests::test_queued_fetch_from_ann_same_rid ... ok
test tests::test_queued_fetch_from_command_same_rid ... ok
test tests::test_queued_fetch_max_capacity ... ok
test tests::test_redundant_connect ... ok
test tests::test_refs_announcement_followed ... ok
test tests::test_refs_announcement_fetch_trusted_no_inventory ... ok
test tests::test_refs_announcement_no_subscribe ... ok
test tests::test_refs_announcement_offline ... ok
test tests::test_refs_announcement_relay_private ... ok
test tests::test_refs_announcement_relay_public ... ok
test tests::test_seed_repo_subscribe ... ok
test tests::test_refs_synced_event ... ok
test wire::test::test_inventory_ann_with_extension ... ok
test wire::test::test_pong_message_with_extension ... ok
test tests::test_seeding ... ok
test tests::prop_inventory_exchange_dense ... ok
test tests::test_announcement_message_amplification ... ok
test result: ok. 69 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 16.30s
Running unittests src/main.rs (target/debug/deps/radicle_node-7b6beba2f5bca767)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/lib.rs (target/debug/deps/radicle_protocol-daf6c4016955b6c6)
running 45 tests
test deserializer::test::test_decode_next ... ok
test deserializer::test::test_unparsed ... ok
test service::filter::test::test_parameters ... ok
test deserializer::test::prop_decode_next ... ok
test service::limiter::test::test_limitter_different_rates ... ok
test service::limiter::test::test_limitter_multi ... ok
test service::gossip::store::test::test_announced ... ok
test service::limiter::test::test_limitter_refill ... ok
test service::filter::test::test_sizes ... ok
test service::message::tests::test_inventory_limit ... ok
test wire::frame::test::test_stream_id ... ok
test wire::message::tests::prop_addr ... ok
test service::message::tests::test_ref_remote_limit ... ok
test service::message::tests::prop_refs_announcement_signing ... ok
test wire::message::tests::prop_zero_bytes_encode_decode ... ok
test wire::message::tests::test_inv_ann_max_size ... ok
test wire::message::tests::test_node_ann_max_size ... ok
test wire::message::tests::test_ping_encode_size_overflow - should panic ... ok
test wire::message::tests::test_pingpong_encode_max_size ... ok
test wire::message::tests::test_pong_encode_size_overflow - should panic ... ok
test wire::message::tests::prop_message_encode_decode ... ok
test wire::tests::prop_filter ... ok
test wire::tests::prop_id ... ok
test wire::tests::prop_oid ... ok
test wire::tests::prop_pubkey ... ok
test wire::tests::prop_refs ... ok
test wire::tests::prop_signature ... ok
test wire::tests::prop_signed_refs ... ok
test wire::tests::prop_string ... ok
test wire::tests::prop_tuple ... ok
test wire::tests::prop_u16 ... ok
test wire::tests::prop_u32 ... ok
test wire::tests::prop_u64 ... ok
test wire::tests::prop_u8 ... ok
test wire::tests::prop_vec ... ok
test wire::tests::test_alias ... ok
test wire::tests::test_bounded_vec_limit ... ok
test wire::tests::test_filter_invalid ... ok
test wire::tests::test_string ... ok
test wire::varint::test::prop_encode_decode ... ok
test wire::varint::test::test_encode_overflow - should panic ... ok
test wire::varint::test::test_encoding ... ok
test wire::message::tests::test_refs_ann_max_size ... ok
test wire::message::tests::prop_message_decoder ... ok
test service::message::tests::test_node_announcement_validate ... ok
test result: ok. 45 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.85s
Running unittests src/lib.rs (target/debug/deps/radicle_remote_helper-2ee63acd0f61074b)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/git-remote-rad.rs (target/debug/deps/git_remote_rad-97e1338c53136f9c)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/main.rs (target/debug/deps/radicle_schemars-313d20617a648d26)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/lib.rs (target/debug/deps/radicle_signals-ad41f42c3d3e47ce)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/lib.rs (target/debug/deps/radicle_ssh-02e22359ef9bf046)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/lib.rs (target/debug/deps/radicle_systemd-28e02dc067eac38d)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/lib.rs (target/debug/deps/radicle_term-6894c7dd8f5147a5)
running 20 tests
test ansi::tests::colors_enabled ... ok
test cell::test::test_width ... ok
test ansi::tests::wrapping ... ok
test element::test::test_width ... ok
test ansi::tests::colors_disabled ... ok
test table::test::test_table ... ok
test element::test::test_truncate ... ok
test table::test::test_table_border_truncated ... ok
test table::test::test_table_border ... ok
test table::test::test_table_border_maximized ... ok
test table::test::test_truncate ... ok
test table::test::test_table_truncate ... ok
test table::test::test_table_unicode ... ok
test table::test::test_table_unicode_truncate ... ok
test textarea::test::test_wrapping ... ok
test textarea::test::test_wrapping_fenced_block ... ok
test textarea::test::test_wrapping_paragraphs ... ok
test textarea::test::test_wrapping_code_block ... ok
test vstack::test::test_vstack ... ok
test vstack::test::test_vstack_maximize ... ok
test result: ok. 20 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle
running 1 test
test crates/radicle/src/cob/patch/encoding/review.rs - cob::patch::encoding::review::Review (line 23) ... ignored
test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_cli
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_cli_test
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_cob
running 1 test
test crates/radicle-cob/src/backend/git/stable.rs - backend::git::stable::with_advanced_timestamp (line 56) ... ignored
test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_crypto
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_dag
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_fetch
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_node
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_protocol
running 6 tests
test crates/radicle-protocol/src/bounded.rs - bounded::BoundedVec<T,N>::max (line 96) ... ok
test crates/radicle-protocol/src/bounded.rs - bounded::BoundedVec<T,N>::collect_from (line 30) ... ok
test crates/radicle-protocol/src/bounded.rs - bounded::BoundedVec<T,N>::truncate (line 50) ... ok
test crates/radicle-protocol/src/bounded.rs - bounded::BoundedVec<T,N>::unbound (line 149) ... ok
test crates/radicle-protocol/src/bounded.rs - bounded::BoundedVec<T,N>::push (line 122) ... ok
test crates/radicle-protocol/src/bounded.rs - bounded::BoundedVec<T,N>::with_capacity (line 66) ... ok
test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.48s
Doc-tests radicle_remote_helper
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_signals
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_ssh
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_systemd
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_term
running 1 test
test crates/radicle-term/src/table.rs - table (line 4) ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.43s
error: 1 target failed:
`-p radicle-cli --test commands`
Exit code: 101
{
"response": "finished",
"result": "failure"
}