mirror of
https://github.com/ratspeak/rsLXMF
synced 2026-11-22 23:10:35 +00:00
build: raise LXMF host minimum to Rust 1.89
This commit is contained in:
1 parent
284d56fee3
commit
e38d30e02a
19 files changed
+763
-814
No files matched your search
@@ -10,7 +10,7 @@ permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
RSLXMF_RSRETICULUM_COMMIT: 5edb8f22f5d8e6b2bd7392dc06e255ead96576fb
|
||||
RSLXMF_RSRETICULUM_COMMIT: cac8151fd8207ada9775310fe2b3c9c7340a7ecd
|
||||
|
||||
jobs:
|
||||
api-compat:
|
||||
@@ -119,7 +119,7 @@ jobs:
|
||||
working-directory: rsLXMF
|
||||
|
||||
msrv:
|
||||
name: Rust 1.87 MSRV
|
||||
name: Rust 1.89 MSRV
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
@@ -133,7 +133,7 @@ jobs:
|
||||
path: rsReticulum
|
||||
- uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 # master
|
||||
with:
|
||||
toolchain: 1.87.0
|
||||
toolchain: 1.89.0
|
||||
components: clippy
|
||||
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
|
||||
with:
|
||||
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
path: rsReticulum
|
||||
- uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 # master
|
||||
with:
|
||||
toolchain: 1.87.0
|
||||
toolchain: 1.89.0
|
||||
- name: Verify release source and dependency
|
||||
working-directory: rsLXMF
|
||||
run: python3 scripts/ci/check_source_release_contract.py --release-tag "${RELEASE_TAG}"
|
||||
@@ -75,7 +75,7 @@ jobs:
|
||||
path: rsReticulum
|
||||
- uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 # master
|
||||
with:
|
||||
toolchain: 1.87.0
|
||||
toolchain: 1.89.0
|
||||
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
|
||||
with:
|
||||
workspaces: rsLXMF -> target
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
### Build and compatibility
|
||||
|
||||
- Raised the host source-build minimum to Rust 1.89 and qualified the corresponding protocol dependency update.
|
||||
|
||||
- Restricted rsReticulum compatibility to the 1.3 patch line so a later breaking minor release requires an explicit update.
|
||||
- Updated the Python interoperability baseline to Reticulum 1.4.2 and LXMF 1.0.1, with separate LXMF 1.1.0 checks.
|
||||
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ members = [
|
||||
version = "1.2.0"
|
||||
edition = "2024"
|
||||
license = "AGPL-3.0-or-later"
|
||||
rust-version = "1.87"
|
||||
rust-version = "1.89"
|
||||
|
||||
[workspace.dependencies]
|
||||
# Reticulum crates from a sibling rsReticulum checkout during development.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
**Rust LXMF messaging and propagation for Reticulum.**
|
||||
|
||||
[](LICENSE)
|
||||
[](https://www.rust-lang.org)
|
||||
[](https://www.rust-lang.org)
|
||||
[](https://github.com/markqvist/LXMF)
|
||||
[](https://github.com/markqvist/LXMF)
|
||||
[](#feature-status)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
{
|
||||
"name": "lxmf-core",
|
||||
"version": "1.2.0",
|
||||
"rustVersion": "1.87",
|
||||
"rustVersion": "1.89",
|
||||
"edition": "2024",
|
||||
"features": {},
|
||||
"targets": [
|
||||
@@ -239,7 +239,7 @@
|
||||
{
|
||||
"name": "lxmf-tools",
|
||||
"version": "1.2.0",
|
||||
"rustVersion": "1.87",
|
||||
"rustVersion": "1.89",
|
||||
"edition": "2024",
|
||||
"features": {},
|
||||
"targets": [
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
# Keep Clippy suggestions aligned with the public MSRV in Cargo.toml.
|
||||
msrv = "1.87"
|
||||
msrv = "1.89"
|
||||
@@ -159,14 +159,15 @@ impl DeliveryRatchetState {
|
||||
}
|
||||
}
|
||||
|
||||
if control_file_trusted && (!control_existed || control_changed) {
|
||||
if let Err(error) = control.save_verified(&control_path, identity) {
|
||||
tracing::warn!(
|
||||
path = %control_path.display(),
|
||||
%error,
|
||||
"could not persist initial ratchet control state; new announces remain deferred until persistence recovers"
|
||||
);
|
||||
}
|
||||
if control_file_trusted
|
||||
&& (!control_existed || control_changed)
|
||||
&& let Err(error) = control.save_verified(&control_path, identity)
|
||||
{
|
||||
tracing::warn!(
|
||||
path = %control_path.display(),
|
||||
%error,
|
||||
"could not persist initial ratchet control state; new announces remain deferred until persistence recovers"
|
||||
);
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
@@ -210,13 +211,12 @@ impl DeliveryRatchetState {
|
||||
}
|
||||
let announce_time = AnnounceTime::new(wall_now, cache_now)?;
|
||||
|
||||
if let DeliveryAnnounceKind::PathResponse { tag: Some(tag) } = kind {
|
||||
if let Some(packet) = self
|
||||
if let DeliveryAnnounceKind::PathResponse { tag: Some(tag) } = kind
|
||||
&& let Some(packet) = self
|
||||
.destination
|
||||
.cached_path_response_packet(tag, cache_now)?
|
||||
{
|
||||
return Ok(packet);
|
||||
}
|
||||
{
|
||||
return Ok(packet);
|
||||
}
|
||||
|
||||
if !self.control_file_trusted {
|
||||
@@ -292,15 +292,15 @@ impl DeliveryRatchetState {
|
||||
/// Best-effort shutdown checkpoint. Invalid files detected during load are
|
||||
/// never overwritten by this operation.
|
||||
pub fn save(&self, identity: &Identity) {
|
||||
if self.ring_file_trusted {
|
||||
if let Err(error) = self.ring.save_verified(&self.ring_path, identity) {
|
||||
tracing::warn!(%error, "failed to save ratchet ring");
|
||||
}
|
||||
if self.ring_file_trusted
|
||||
&& let Err(error) = self.ring.save_verified(&self.ring_path, identity)
|
||||
{
|
||||
tracing::warn!(%error, "failed to save ratchet ring");
|
||||
}
|
||||
if self.control_file_trusted {
|
||||
if let Err(error) = self.control.save_verified(&self.control_path, identity) {
|
||||
tracing::warn!(%error, "failed to save ratchet control state");
|
||||
}
|
||||
if self.control_file_trusted
|
||||
&& let Err(error) = self.control.save_verified(&self.control_path, identity)
|
||||
{
|
||||
tracing::warn!(%error, "failed to save ratchet control state");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -187,10 +187,10 @@ impl<T> From<oneshot::Receiver<T>> for ReadyReceipt<T> {
|
||||
}
|
||||
impl<T> ReadyReceipt<T> {
|
||||
fn poll_ready(&mut self, cx: &mut Context<'_>) -> bool {
|
||||
if self.ready.is_none() {
|
||||
if let Poll::Ready(result) = Pin::new(&mut self.receiver).poll(cx) {
|
||||
self.ready = Some(result);
|
||||
}
|
||||
if self.ready.is_none()
|
||||
&& let Poll::Ready(result) = Pin::new(&mut self.receiver).poll(cx)
|
||||
{
|
||||
self.ready = Some(result);
|
||||
}
|
||||
self.ready.is_some()
|
||||
}
|
||||
@@ -907,15 +907,15 @@ impl LinkDeliveryManager {
|
||||
/// Use one polling task per manager and retain periodic ticks for protocol
|
||||
/// deadlines. A bounded drain may leave more input ready for the next turn.
|
||||
pub fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<()> {
|
||||
if self.ready_event.is_none() {
|
||||
if let Poll::Ready(event) = self.event_rx.poll_recv(cx) {
|
||||
self.ready_event = event;
|
||||
}
|
||||
if self.ready_event.is_none()
|
||||
&& let Poll::Ready(event) = self.event_rx.poll_recv(cx)
|
||||
{
|
||||
self.ready_event = event;
|
||||
}
|
||||
if self.ready_lifecycle.is_none() {
|
||||
if let Poll::Ready(event) = self.endpoint_lifecycle_rx.poll_recv(cx) {
|
||||
self.ready_lifecycle = event;
|
||||
}
|
||||
if self.ready_lifecycle.is_none()
|
||||
&& let Poll::Ready(event) = self.endpoint_lifecycle_rx.poll_recv(cx)
|
||||
{
|
||||
self.ready_lifecycle = event;
|
||||
}
|
||||
let mut ready = self.ready_event.is_some() || self.ready_lifecycle.is_some();
|
||||
for pending in self.pending_endpoint_binds.values_mut() {
|
||||
@@ -1844,26 +1844,25 @@ impl LinkDeliveryManager {
|
||||
if event.binding.role != LinkEndpointRole::Initiator {
|
||||
continue;
|
||||
}
|
||||
if let Some(delivery) = self.pending.get_mut(&event.binding.link_id) {
|
||||
if delivery.attached_interface == Some(event.binding.interface_id)
|
||||
if let Some(delivery) = self.pending.get_mut(&event.binding.link_id)
|
||||
&& (delivery.attached_interface == Some(event.binding.interface_id)
|
||||
|| self
|
||||
.pending_endpoint_binds
|
||||
.get(&event.binding.link_id)
|
||||
.is_some_and(|pending| pending.interface_id == event.binding.interface_id)
|
||||
{
|
||||
tracing::warn!(
|
||||
link_id = %hex_encode(&event.binding.link_id),
|
||||
interface_id = event.binding.interface_id,
|
||||
reason = ?event.reason,
|
||||
dropped_packets = event.dropped_packets,
|
||||
"Direct Link endpoint terminated"
|
||||
);
|
||||
delivery.attached_interface = None;
|
||||
delivery.state = DeliveryState::Failed;
|
||||
delivery.failure_reason =
|
||||
Some(format!("Link endpoint terminated: {:?}", event.reason));
|
||||
self.pending_endpoint_binds.remove(&event.binding.link_id);
|
||||
}
|
||||
.is_some_and(|pending| pending.interface_id == event.binding.interface_id))
|
||||
{
|
||||
tracing::warn!(
|
||||
link_id = %hex_encode(&event.binding.link_id),
|
||||
interface_id = event.binding.interface_id,
|
||||
reason = ?event.reason,
|
||||
dropped_packets = event.dropped_packets,
|
||||
"Direct Link endpoint terminated"
|
||||
);
|
||||
delivery.attached_interface = None;
|
||||
delivery.state = DeliveryState::Failed;
|
||||
delivery.failure_reason =
|
||||
Some(format!("Link endpoint terminated: {:?}", event.reason));
|
||||
self.pending_endpoint_binds.remove(&event.binding.link_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2109,10 +2108,10 @@ impl LinkDeliveryManager {
|
||||
}
|
||||
rns_wire::context::PacketContext::ResourceHmu => {
|
||||
let plaintext = self.decrypt_resource_control(&link_id, data);
|
||||
if let Some(pt) = plaintext {
|
||||
if !self.handle_inbound_resource_hmu(&link_id, &pt) {
|
||||
self.handle_hmu(&link_id, &pt);
|
||||
}
|
||||
if let Some(pt) = plaintext
|
||||
&& !self.handle_inbound_resource_hmu(&link_id, &pt)
|
||||
{
|
||||
self.handle_hmu(&link_id, &pt);
|
||||
}
|
||||
}
|
||||
rns_wire::context::PacketContext::ResourceReq => {
|
||||
@@ -2852,49 +2851,45 @@ impl LinkDeliveryManager {
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if !delivery.reusable && !delivery.pretransfer_identify_staged {
|
||||
if let (Some(pub_key), Some(sign_key)) =
|
||||
if !delivery.reusable
|
||||
&& !delivery.pretransfer_identify_staged
|
||||
&& let (Some(pub_key), Some(sign_key)) =
|
||||
(&self.identity_pub, &self.identity_key)
|
||||
{
|
||||
if let Ok(identify_data) = delivery.link.identify(pub_key, sign_key)
|
||||
{
|
||||
let id_header = rns_wire::header::PacketHeader {
|
||||
flags: rns_wire::flags::PacketFlags {
|
||||
header_type: rns_wire::flags::HeaderType::Header1,
|
||||
context_flag: false,
|
||||
transport_type:
|
||||
rns_wire::flags::TransportType::Broadcast,
|
||||
destination_type:
|
||||
rns_wire::flags::DestinationType::Link,
|
||||
packet_type: rns_wire::flags::PacketType::Data,
|
||||
},
|
||||
hops: 0,
|
||||
transport_id: None,
|
||||
destination_hash: *link_id,
|
||||
context: rns_wire::context::PacketContext::LinkIdentify,
|
||||
};
|
||||
let mut id_raw = id_header.pack();
|
||||
id_raw.extend_from_slice(&identify_data);
|
||||
if let Err(reason) = stage_link_endpoint_with_success(
|
||||
&self.transport_tx,
|
||||
&mut self.pending_transport,
|
||||
&mut self.pending_endpoint_sends,
|
||||
*link_id,
|
||||
OutboundRequest {
|
||||
raw: Bytes::from(id_raw),
|
||||
destination_hash: *link_id,
|
||||
},
|
||||
EndpointSendSuccess::FinishHandshake,
|
||||
) {
|
||||
delivery.state = DeliveryState::Failed;
|
||||
delivery.failure_reason = Some(reason.to_string());
|
||||
continue;
|
||||
}
|
||||
delivery.pretransfer_identify_staged = true;
|
||||
if delivery.endpoint_dispatch_token.is_some() {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
&& let Ok(identify_data) = delivery.link.identify(pub_key, sign_key)
|
||||
{
|
||||
let id_header = rns_wire::header::PacketHeader {
|
||||
flags: rns_wire::flags::PacketFlags {
|
||||
header_type: rns_wire::flags::HeaderType::Header1,
|
||||
context_flag: false,
|
||||
transport_type: rns_wire::flags::TransportType::Broadcast,
|
||||
destination_type: rns_wire::flags::DestinationType::Link,
|
||||
packet_type: rns_wire::flags::PacketType::Data,
|
||||
},
|
||||
hops: 0,
|
||||
transport_id: None,
|
||||
destination_hash: *link_id,
|
||||
context: rns_wire::context::PacketContext::LinkIdentify,
|
||||
};
|
||||
let mut id_raw = id_header.pack();
|
||||
id_raw.extend_from_slice(&identify_data);
|
||||
if let Err(reason) = stage_link_endpoint_with_success(
|
||||
&self.transport_tx,
|
||||
&mut self.pending_transport,
|
||||
&mut self.pending_endpoint_sends,
|
||||
*link_id,
|
||||
OutboundRequest {
|
||||
raw: Bytes::from(id_raw),
|
||||
destination_hash: *link_id,
|
||||
},
|
||||
EndpointSendSuccess::FinishHandshake,
|
||||
) {
|
||||
delivery.state = DeliveryState::Failed;
|
||||
delivery.failure_reason = Some(reason.to_string());
|
||||
continue;
|
||||
}
|
||||
delivery.pretransfer_identify_staged = true;
|
||||
if delivery.endpoint_dispatch_token.is_some() {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// Reusable Direct links follow upstream LXMF and identify
|
||||
@@ -3375,10 +3370,10 @@ impl LinkDeliveryManager {
|
||||
) {
|
||||
results.push(result);
|
||||
}
|
||||
} else if proof_observed {
|
||||
if let Some(result) = self.complete_backchannel_delivery(key) {
|
||||
results.push(result);
|
||||
}
|
||||
} else if proof_observed
|
||||
&& let Some(result) = self.complete_backchannel_delivery(key)
|
||||
{
|
||||
results.push(result);
|
||||
}
|
||||
}
|
||||
Ok(Err(err)) => {
|
||||
@@ -3527,10 +3522,10 @@ impl LinkDeliveryManager {
|
||||
if let Some(ref mut transfer) = delivery.transfer {
|
||||
transfer.handle_hmu(hmu_data);
|
||||
let progress = delivery_resource_progress(delivery);
|
||||
if let Some(progress) = progress {
|
||||
if should_update_resource_progress(delivery.message.progress, progress) {
|
||||
delivery.message.progress = progress;
|
||||
}
|
||||
if let Some(progress) = progress
|
||||
&& should_update_resource_progress(delivery.message.progress, progress)
|
||||
{
|
||||
delivery.message.progress = progress;
|
||||
}
|
||||
progress.map(|_| {
|
||||
delivery_event(
|
||||
@@ -3610,10 +3605,10 @@ impl LinkDeliveryManager {
|
||||
}
|
||||
}
|
||||
let progress = delivery_resource_progress(delivery);
|
||||
if let Some(progress) = progress {
|
||||
if should_update_resource_progress(delivery.message.progress, progress) {
|
||||
delivery.message.progress = progress;
|
||||
}
|
||||
if let Some(progress) = progress
|
||||
&& should_update_resource_progress(delivery.message.progress, progress)
|
||||
{
|
||||
delivery.message.progress = progress;
|
||||
}
|
||||
progress.map(|_| {
|
||||
delivery_event(
|
||||
@@ -3701,17 +3696,16 @@ impl LinkDeliveryManager {
|
||||
let mut rejected_hash = [0u8; 32];
|
||||
rejected_hash.copy_from_slice(&reject_data[..32]);
|
||||
|
||||
if let Some(delivery) = self.pending.get_mut(link_id) {
|
||||
if let Some(ref mut transfer) = delivery.transfer {
|
||||
if transfer.resource.resource_hash == rejected_hash {
|
||||
transfer.handle_cancel();
|
||||
delivery.remaining_segments = None;
|
||||
delivery.message.mark_rejected();
|
||||
delivery.state = DeliveryState::Rejected;
|
||||
delivery.failure_reason = Some("resource rejected".to_string());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if let Some(delivery) = self.pending.get_mut(link_id)
|
||||
&& let Some(ref mut transfer) = delivery.transfer
|
||||
&& transfer.resource.resource_hash == rejected_hash
|
||||
{
|
||||
transfer.handle_cancel();
|
||||
delivery.remaining_segments = None;
|
||||
delivery.message.mark_rejected();
|
||||
delivery.state = DeliveryState::Rejected;
|
||||
delivery.failure_reason = Some("resource rejected".to_string());
|
||||
return true;
|
||||
}
|
||||
|
||||
false
|
||||
@@ -3762,20 +3756,17 @@ impl LinkDeliveryManager {
|
||||
|
||||
/// Apply an inbound link-packet proof; returns `true` when the packet delivery is complete.
|
||||
pub fn handle_link_packet_proof(&mut self, link_id: &[u8; 16], proof_data: &[u8]) -> bool {
|
||||
if let Some(delivery) = self.pending.get_mut(link_id) {
|
||||
if delivery.state == DeliveryState::AwaitingProof {
|
||||
if let Some(packet_hash) = delivery.packet_proof_hash {
|
||||
if delivery
|
||||
.link
|
||||
.validate_packet_proof(&packet_hash, proof_data)
|
||||
{
|
||||
delivery.link.record_inbound();
|
||||
delivery.link.record_rx(proof_data.len());
|
||||
delivery.state = DeliveryState::Complete;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(delivery) = self.pending.get_mut(link_id)
|
||||
&& delivery.state == DeliveryState::AwaitingProof
|
||||
&& let Some(packet_hash) = delivery.packet_proof_hash
|
||||
&& delivery
|
||||
.link
|
||||
.validate_packet_proof(&packet_hash, proof_data)
|
||||
{
|
||||
delivery.link.record_inbound();
|
||||
delivery.link.record_rx(proof_data.len());
|
||||
delivery.state = DeliveryState::Complete;
|
||||
return true;
|
||||
}
|
||||
false
|
||||
}
|
||||
@@ -4268,39 +4259,39 @@ impl LinkDeliveryManager {
|
||||
.pending_backchannel_deliveries
|
||||
.iter()
|
||||
.find_map(|(key, delivery)| (delivery.message.hash == Some(msg_hash)).then_some(*key));
|
||||
if let Some(key) = pending_key {
|
||||
if let Some(delivery) = self.pending_backchannel_deliveries.remove(&key) {
|
||||
self.remove_backchannel_owner(delivery.dest_hash, delivery.link_id);
|
||||
self.cancel_backchannel_packet_key(key, delivery.packet_cancellation);
|
||||
if let BackchannelProofKey::Resource(link_id, resource_hash) = key {
|
||||
self.pending_backchannel_resource_cancellations.push_back(
|
||||
BackchannelResourceCancelRequest {
|
||||
link_id,
|
||||
resource_hash,
|
||||
},
|
||||
);
|
||||
}
|
||||
self.delivery_events.push_back(backchannel_delivery_event(
|
||||
BackchannelDeliveryEventInput {
|
||||
kind: LxmfDeliveryEventKind::Failed,
|
||||
message: &delivery.message,
|
||||
dest_hash: delivery.dest_hash,
|
||||
link_id: delivery.link_id,
|
||||
representation: delivery.representation,
|
||||
progress: Some(delivery.message.progress),
|
||||
reason: Some(reason.to_string()),
|
||||
link_state: LinkState::Closed,
|
||||
delivery_state: DeliveryState::Failed,
|
||||
if let Some(key) = pending_key
|
||||
&& let Some(delivery) = self.pending_backchannel_deliveries.remove(&key)
|
||||
{
|
||||
self.remove_backchannel_owner(delivery.dest_hash, delivery.link_id);
|
||||
self.cancel_backchannel_packet_key(key, delivery.packet_cancellation);
|
||||
if let BackchannelProofKey::Resource(link_id, resource_hash) = key {
|
||||
self.pending_backchannel_resource_cancellations.push_back(
|
||||
BackchannelResourceCancelRequest {
|
||||
link_id,
|
||||
resource_hash,
|
||||
},
|
||||
));
|
||||
results.push(DeliveryResult::Failed {
|
||||
link_id: delivery.link_id,
|
||||
msg_hash: delivery.message.hash,
|
||||
dest_hash: delivery.dest_hash,
|
||||
message: delivery.message,
|
||||
reason: reason.to_string(),
|
||||
});
|
||||
);
|
||||
}
|
||||
self.delivery_events.push_back(backchannel_delivery_event(
|
||||
BackchannelDeliveryEventInput {
|
||||
kind: LxmfDeliveryEventKind::Failed,
|
||||
message: &delivery.message,
|
||||
dest_hash: delivery.dest_hash,
|
||||
link_id: delivery.link_id,
|
||||
representation: delivery.representation,
|
||||
progress: Some(delivery.message.progress),
|
||||
reason: Some(reason.to_string()),
|
||||
link_state: LinkState::Closed,
|
||||
delivery_state: DeliveryState::Failed,
|
||||
},
|
||||
));
|
||||
results.push(DeliveryResult::Failed {
|
||||
link_id: delivery.link_id,
|
||||
msg_hash: delivery.message.hash,
|
||||
dest_hash: delivery.dest_hash,
|
||||
message: delivery.message,
|
||||
reason: reason.to_string(),
|
||||
});
|
||||
}
|
||||
|
||||
results
|
||||
@@ -4965,18 +4956,18 @@ fn finish_reusable_delivery(
|
||||
link_id: &[u8; 16],
|
||||
delivery: &mut PendingDelivery,
|
||||
) {
|
||||
if !delivery.backchannel_identified {
|
||||
if let (Some(pub_key), Some(sign_key)) = (identity_pub, identity_key) {
|
||||
delivery.backchannel_identified = send_link_identify(
|
||||
transport_tx,
|
||||
pending_transport,
|
||||
pending_endpoint_sends,
|
||||
link_id,
|
||||
&delivery.link,
|
||||
pub_key,
|
||||
sign_key,
|
||||
);
|
||||
}
|
||||
if !delivery.backchannel_identified
|
||||
&& let (Some(pub_key), Some(sign_key)) = (identity_pub, identity_key)
|
||||
{
|
||||
delivery.backchannel_identified = send_link_identify(
|
||||
transport_tx,
|
||||
pending_transport,
|
||||
pending_endpoint_sends,
|
||||
link_id,
|
||||
&delivery.link,
|
||||
pub_key,
|
||||
sign_key,
|
||||
);
|
||||
}
|
||||
|
||||
delivery.transfer = None;
|
||||
|
||||
@@ -606,19 +606,19 @@ impl LxMessage {
|
||||
self.transient_id = Some(tid);
|
||||
|
||||
let mut stamp_value = 0;
|
||||
if let Some(target_cost) = propagation_stamp_cost {
|
||||
if self.propagation_stamp.is_none() {
|
||||
let (stamp, value) = crate::stamper::generate_stamp(
|
||||
&tid,
|
||||
target_cost,
|
||||
crate::constants::STAMP_WORKBLOCK_EXPAND_ROUNDS_PN,
|
||||
)
|
||||
.ok_or_else(|| {
|
||||
MessageError::PackFailed("failed to generate propagation stamp".to_string())
|
||||
})?;
|
||||
self.propagation_stamp = Some(stamp);
|
||||
stamp_value = value;
|
||||
}
|
||||
if let Some(target_cost) = propagation_stamp_cost
|
||||
&& self.propagation_stamp.is_none()
|
||||
{
|
||||
let (stamp, value) = crate::stamper::generate_stamp(
|
||||
&tid,
|
||||
target_cost,
|
||||
crate::constants::STAMP_WORKBLOCK_EXPAND_ROUNDS_PN,
|
||||
)
|
||||
.ok_or_else(|| {
|
||||
MessageError::PackFailed("failed to generate propagation stamp".to_string())
|
||||
})?;
|
||||
self.propagation_stamp = Some(stamp);
|
||||
stamp_value = value;
|
||||
}
|
||||
|
||||
if let Some(ref prop_stamp) = self.propagation_stamp {
|
||||
@@ -1008,14 +1008,13 @@ impl LxMessage {
|
||||
|
||||
// 4. Generate PoW stamp
|
||||
let cost = self.stamp_cost.unwrap();
|
||||
if let Some(message_id) = self.message_id {
|
||||
if let Some((stamp, value)) =
|
||||
if let Some(message_id) = self.message_id
|
||||
&& let Some((stamp, value)) =
|
||||
crate::stamper::generate_stamp(&message_id, cost, STAMP_WORKBLOCK_EXPAND_ROUNDS)
|
||||
{
|
||||
self.stamp_value = Some(value as u16);
|
||||
self.stamp = Some(stamp.to_vec());
|
||||
return Some(stamp.to_vec());
|
||||
}
|
||||
{
|
||||
self.stamp_value = Some(value as u16);
|
||||
self.stamp = Some(stamp.to_vec());
|
||||
return Some(stamp.to_vec());
|
||||
}
|
||||
|
||||
None
|
||||
|
||||
@@ -68,14 +68,15 @@ pub fn write_file_atomic(path: &Path, data: &[u8]) -> io::Result<()> {
|
||||
fs::rename(&tmp, path)
|
||||
})();
|
||||
|
||||
if result.is_err() && tmp.exists() {
|
||||
if let Err(e) = fs::remove_file(&tmp) {
|
||||
tracing::error!(
|
||||
"Error while cleaning temporary file {} for {}: {e}",
|
||||
tmp.display(),
|
||||
path.display()
|
||||
);
|
||||
}
|
||||
if result.is_err()
|
||||
&& tmp.exists()
|
||||
&& let Err(e) = fs::remove_file(&tmp)
|
||||
{
|
||||
tracing::error!(
|
||||
"Error while cleaning temporary file {} for {}: {e}",
|
||||
tmp.display(),
|
||||
path.display()
|
||||
);
|
||||
}
|
||||
|
||||
result
|
||||
|
||||
@@ -620,30 +620,28 @@ impl PropagationClient {
|
||||
continue;
|
||||
}
|
||||
let node_hex = self.outbound_propagation_node.map(|h| hex_encode(&h));
|
||||
if let Some(node_hex) = node_hex {
|
||||
if let Some(pub_key) = known_identities.get(&node_hex) {
|
||||
let ed25519_bytes: [u8; 32] = pub_key[32..64]
|
||||
if let Some(node_hex) = node_hex
|
||||
&& let Some(pub_key) = known_identities.get(&node_hex)
|
||||
{
|
||||
let ed25519_bytes: [u8; 32] = pub_key[32..64]
|
||||
.try_into()
|
||||
.expect("known_identities values are [u8; 64]; slice [32..64] is always 32 bytes");
|
||||
if let Ok(verify_key) =
|
||||
Ed25519PublicKey::from_bytes(&ed25519_bytes)
|
||||
{
|
||||
self.handle_link_proof(
|
||||
data,
|
||||
&verify_key,
|
||||
&ed25519_bytes,
|
||||
interface_id,
|
||||
);
|
||||
}
|
||||
if let Ok(verify_key) = Ed25519PublicKey::from_bytes(&ed25519_bytes)
|
||||
{
|
||||
self.handle_link_proof(
|
||||
data,
|
||||
&verify_key,
|
||||
&ed25519_bytes,
|
||||
interface_id,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
rns_wire::context::PacketContext::Response => {
|
||||
if let Some(ref mut link) = self.link {
|
||||
if let Ok((_request_id, response_data)) = link.handle_response(data)
|
||||
{
|
||||
self.handle_response_data(&response_data);
|
||||
}
|
||||
if let Some(ref mut link) = self.link
|
||||
&& let Ok((_request_id, response_data)) = link.handle_response(data)
|
||||
{
|
||||
self.handle_response_data(&response_data);
|
||||
}
|
||||
}
|
||||
rns_wire::context::PacketContext::ResourceAdv => {
|
||||
@@ -709,47 +707,47 @@ impl PropagationClient {
|
||||
None => return,
|
||||
};
|
||||
|
||||
if let Ok(rtt_data) = link.validate_proof(proof_data, verify_key, ed25519_pub) {
|
||||
if let Some(link_id) = self.link_id {
|
||||
let rtt_header = rns_wire::header::PacketHeader {
|
||||
flags: rns_wire::flags::PacketFlags {
|
||||
header_type: rns_wire::flags::HeaderType::Header1,
|
||||
context_flag: false,
|
||||
transport_type: rns_wire::flags::TransportType::Broadcast,
|
||||
destination_type: rns_wire::flags::DestinationType::Link,
|
||||
packet_type: rns_wire::flags::PacketType::Data,
|
||||
},
|
||||
hops: 0,
|
||||
transport_id: None,
|
||||
destination_hash: link_id,
|
||||
context: rns_wire::context::PacketContext::Lrrtt,
|
||||
};
|
||||
let mut rtt_raw = rtt_header.pack();
|
||||
rtt_raw.extend_from_slice(&rtt_data);
|
||||
if let Ok(rtt_data) = link.validate_proof(proof_data, verify_key, ed25519_pub)
|
||||
&& let Some(link_id) = self.link_id
|
||||
{
|
||||
let rtt_header = rns_wire::header::PacketHeader {
|
||||
flags: rns_wire::flags::PacketFlags {
|
||||
header_type: rns_wire::flags::HeaderType::Header1,
|
||||
context_flag: false,
|
||||
transport_type: rns_wire::flags::TransportType::Broadcast,
|
||||
destination_type: rns_wire::flags::DestinationType::Link,
|
||||
packet_type: rns_wire::flags::PacketType::Data,
|
||||
},
|
||||
hops: 0,
|
||||
transport_id: None,
|
||||
destination_hash: link_id,
|
||||
context: rns_wire::context::PacketContext::Lrrtt,
|
||||
};
|
||||
let mut rtt_raw = rtt_header.pack();
|
||||
rtt_raw.extend_from_slice(&rtt_data);
|
||||
|
||||
let rtt_request = OutboundRequest {
|
||||
raw: Bytes::from(rtt_raw),
|
||||
destination_hash: link_id,
|
||||
};
|
||||
let (result_tx, result_rx) = oneshot::channel();
|
||||
if !self.queue_transport(TransportMessage::BindLinkEndpoint {
|
||||
binding: LinkEndpointBinding {
|
||||
link_id,
|
||||
interface_id,
|
||||
role: LinkEndpointRole::Initiator,
|
||||
},
|
||||
lifecycle_tx: self.endpoint_lifecycle_tx.clone(),
|
||||
result_tx,
|
||||
}) {
|
||||
self.status.state = PropagationClientState::Failed;
|
||||
return;
|
||||
}
|
||||
self.pending_endpoint_bind = Some(PendingEndpointBind {
|
||||
let rtt_request = OutboundRequest {
|
||||
raw: Bytes::from(rtt_raw),
|
||||
destination_hash: link_id,
|
||||
};
|
||||
let (result_tx, result_rx) = oneshot::channel();
|
||||
if !self.queue_transport(TransportMessage::BindLinkEndpoint {
|
||||
binding: LinkEndpointBinding {
|
||||
link_id,
|
||||
interface_id,
|
||||
rtt_request,
|
||||
result_rx,
|
||||
});
|
||||
role: LinkEndpointRole::Initiator,
|
||||
},
|
||||
lifecycle_tx: self.endpoint_lifecycle_tx.clone(),
|
||||
result_tx,
|
||||
}) {
|
||||
self.status.state = PropagationClientState::Failed;
|
||||
return;
|
||||
}
|
||||
self.pending_endpoint_bind = Some(PendingEndpointBind {
|
||||
interface_id,
|
||||
rtt_request,
|
||||
result_rx,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1206,10 +1204,10 @@ impl PropagationClient {
|
||||
if let Some(arr) = value.as_array() {
|
||||
self.available_messages.clear();
|
||||
for item in arr {
|
||||
if let Some(id_bytes) = item.as_slice() {
|
||||
if id_bytes.len() == 32 {
|
||||
self.available_messages.push(id_bytes.to_vec());
|
||||
}
|
||||
if let Some(id_bytes) = item.as_slice()
|
||||
&& id_bytes.len() == 32
|
||||
{
|
||||
self.available_messages.push(id_bytes.to_vec());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1272,20 +1270,19 @@ impl PropagationClient {
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(started) = self.started_at {
|
||||
if started.elapsed() > self.timeout
|
||||
&& matches!(
|
||||
self.status.state,
|
||||
PropagationClientState::LinkEstablishing
|
||||
| PropagationClientState::ListRequested
|
||||
| PropagationClientState::GetRequested
|
||||
| PropagationClientState::PurgeRequested
|
||||
)
|
||||
{
|
||||
self.cleanup();
|
||||
self.status.state = PropagationClientState::Failed;
|
||||
return;
|
||||
}
|
||||
if let Some(started) = self.started_at
|
||||
&& started.elapsed() > self.timeout
|
||||
&& matches!(
|
||||
self.status.state,
|
||||
PropagationClientState::LinkEstablishing
|
||||
| PropagationClientState::ListRequested
|
||||
| PropagationClientState::GetRequested
|
||||
| PropagationClientState::PurgeRequested
|
||||
)
|
||||
{
|
||||
self.cleanup();
|
||||
self.status.state = PropagationClientState::Failed;
|
||||
return;
|
||||
}
|
||||
|
||||
let link_action = self.link.as_mut().map(Link::tick);
|
||||
@@ -1384,10 +1381,10 @@ impl PropagationClient {
|
||||
} else {
|
||||
None
|
||||
};
|
||||
if let Some(outbound) = outbound {
|
||||
if !self.queue_link_endpoint(outbound) {
|
||||
self.status.state = PropagationClientState::Failed;
|
||||
}
|
||||
if let Some(outbound) = outbound
|
||||
&& !self.queue_link_endpoint(outbound)
|
||||
{
|
||||
self.status.state = PropagationClientState::Failed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1539,10 +1536,10 @@ impl PropagationClient {
|
||||
|
||||
fn cleanup(&mut self) {
|
||||
let graceful_release = self.endpoint_release_queued || self.send_teardown();
|
||||
if let Some(link_id) = self.link_id.take() {
|
||||
if !graceful_release {
|
||||
self.queue_endpoint_cleanup(link_id);
|
||||
}
|
||||
if let Some(link_id) = self.link_id.take()
|
||||
&& !graceful_release
|
||||
{
|
||||
self.queue_endpoint_cleanup(link_id);
|
||||
}
|
||||
self.attached_interface = None;
|
||||
self.endpoint_release_queued = false;
|
||||
|
||||
@@ -254,12 +254,11 @@ pub(crate) fn prepare_sync_offer_snapshot(
|
||||
.propagation_sync_limit
|
||||
.map(kilobytes_to_bytes_fail_closed);
|
||||
let mut handled_messages = snapshot.policy.handled_messages.clone();
|
||||
if let Some(path) = snapshot.peer_path.as_ref() {
|
||||
if let Ok(data) = std::fs::read(path) {
|
||||
if let Some(peer) = LxmPeer::from_bytes_with_handled(&data) {
|
||||
handled_messages.extend(peer.handled_messages);
|
||||
}
|
||||
}
|
||||
if let Some(path) = snapshot.peer_path.as_ref()
|
||||
&& let Ok(data) = std::fs::read(path)
|
||||
&& let Some(peer) = LxmPeer::from_bytes_with_handled(&data)
|
||||
{
|
||||
handled_messages.extend(peer.handled_messages);
|
||||
}
|
||||
|
||||
let mut candidates = snapshot.candidates;
|
||||
@@ -792,10 +791,10 @@ impl PropagationNode {
|
||||
self.advance_offer_generation();
|
||||
}
|
||||
|
||||
if before > after {
|
||||
if let Some(ref dir) = self.storage_path {
|
||||
self.cleanup_orphaned_files(dir);
|
||||
}
|
||||
if before > after
|
||||
&& let Some(ref dir) = self.storage_path
|
||||
{
|
||||
self.cleanup_orphaned_files(dir);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -813,10 +812,10 @@ impl PropagationNode {
|
||||
if filename.ends_with(".peer") || filename.ends_with(".msgpack") {
|
||||
continue;
|
||||
}
|
||||
if let Some((tid, _, _)) = PropagationEntry::parse_filename(&filename) {
|
||||
if !self.store.contains(&tid) {
|
||||
let _ = std::fs::remove_file(&path);
|
||||
}
|
||||
if let Some((tid, _, _)) = PropagationEntry::parse_filename(&filename)
|
||||
&& !self.store.contains(&tid)
|
||||
{
|
||||
let _ = std::fs::remove_file(&path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1116,16 +1115,15 @@ impl PropagationNode {
|
||||
for want_val in wants_arr {
|
||||
if let (Some(tid), Some(dir)) =
|
||||
(parse_store_id(want_val), self.storage_path.as_ref())
|
||||
&& let Some(entry) = self.store.get(&tid)
|
||||
{
|
||||
if let Some(entry) = self.store.get(&tid) {
|
||||
// Ownership gate (Python LXMRouter.py:1479): a client
|
||||
// may only download messages addressed to itself.
|
||||
if entry.destination_hash == *client_dest_hash {
|
||||
reads.push(PlannedRead {
|
||||
path: dir.join(entry.filename()),
|
||||
stamped: entry.stamped,
|
||||
});
|
||||
}
|
||||
// Ownership gate (Python LXMRouter.py:1479): a client
|
||||
// may only download messages addressed to itself.
|
||||
if entry.destination_hash == *client_dest_hash {
|
||||
reads.push(PlannedRead {
|
||||
path: dir.join(entry.filename()),
|
||||
stamped: entry.stamped,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1288,11 +1286,10 @@ impl PropagationNode {
|
||||
// Compatibility wrapper: production uses the staged task
|
||||
// path and exposes this delta to the daemon for off-loop
|
||||
// persistence.
|
||||
if !terminal_handled_ids.is_empty() {
|
||||
if let Err(error) = self.persist_peer_handled(policy, &terminal_handled_ids)
|
||||
{
|
||||
tracing::warn!(%error, "failed to persist terminal offer dispositions");
|
||||
}
|
||||
if !terminal_handled_ids.is_empty()
|
||||
&& let Err(error) = self.persist_peer_handled(policy, &terminal_handled_ids)
|
||||
{
|
||||
tracing::warn!(%error, "failed to persist terminal offer dispositions");
|
||||
}
|
||||
return offer;
|
||||
}
|
||||
@@ -1406,13 +1403,12 @@ impl PropagationNode {
|
||||
if let Ok(entries) = std::fs::read_dir(dir) {
|
||||
for entry in entries.flatten() {
|
||||
let path = entry.path();
|
||||
if path.extension().map(|e| e == "peer").unwrap_or(false) {
|
||||
if let Ok(data) = std::fs::read(&path) {
|
||||
if let Some(mut peer) = LxmPeer::from_bytes_with_handled(&data) {
|
||||
self.prune_handled_against_store(&mut peer);
|
||||
peers.push(peer);
|
||||
}
|
||||
}
|
||||
if path.extension().map(|e| e == "peer").unwrap_or(false)
|
||||
&& let Ok(data) = std::fs::read(&path)
|
||||
&& let Some(mut peer) = LxmPeer::from_bytes_with_handled(&data)
|
||||
{
|
||||
self.prune_handled_against_store(&mut peer);
|
||||
peers.push(peer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -718,30 +718,27 @@ impl PropagationSyncTask {
|
||||
continue;
|
||||
}
|
||||
let node_hex = self.node_dest_hash.map(|h| hex_encode(&h));
|
||||
if let Some(node_hex) = node_hex {
|
||||
if let Some(pub_key) = known_identities.get(&node_hex) {
|
||||
let ed25519_bytes: [u8; 32] =
|
||||
pub_key[32..64].try_into().unwrap();
|
||||
if let Ok(verify_key) =
|
||||
Ed25519PublicKey::from_bytes(&ed25519_bytes)
|
||||
{
|
||||
self.handle_link_proof(
|
||||
data,
|
||||
&verify_key,
|
||||
&ed25519_bytes,
|
||||
interface_id,
|
||||
);
|
||||
}
|
||||
if let Some(node_hex) = node_hex
|
||||
&& let Some(pub_key) = known_identities.get(&node_hex)
|
||||
{
|
||||
let ed25519_bytes: [u8; 32] = pub_key[32..64].try_into().unwrap();
|
||||
if let Ok(verify_key) = Ed25519PublicKey::from_bytes(&ed25519_bytes)
|
||||
{
|
||||
self.handle_link_proof(
|
||||
data,
|
||||
&verify_key,
|
||||
&ed25519_bytes,
|
||||
interface_id,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
rns_wire::context::PacketContext::ResourceHmu => {
|
||||
if let Some(ref link) = self.link {
|
||||
if let Ok(plaintext) = link.decrypt(data) {
|
||||
if let Some(ref mut transfer) = self.active_transfer {
|
||||
transfer.handle_hmu(&plaintext);
|
||||
}
|
||||
}
|
||||
if let Some(ref link) = self.link
|
||||
&& let Ok(plaintext) = link.decrypt(data)
|
||||
&& let Some(ref mut transfer) = self.active_transfer
|
||||
{
|
||||
transfer.handle_hmu(&plaintext);
|
||||
}
|
||||
}
|
||||
rns_wire::context::PacketContext::ResourceReq => {
|
||||
@@ -760,16 +757,12 @@ impl PropagationSyncTask {
|
||||
}
|
||||
}
|
||||
rns_wire::context::PacketContext::Response => {
|
||||
if self.state == SyncTaskState::AwaitingResponse {
|
||||
if let Some(ref mut link) = self.link {
|
||||
if let Ok((_request_id, response_data)) =
|
||||
link.handle_response(data)
|
||||
{
|
||||
let offer_response =
|
||||
OfferResponse::from_msgpack(&response_data);
|
||||
self.handle_offer_response(offer_response);
|
||||
}
|
||||
}
|
||||
if self.state == SyncTaskState::AwaitingResponse
|
||||
&& let Some(ref mut link) = self.link
|
||||
&& let Ok((_request_id, response_data)) = link.handle_response(data)
|
||||
{
|
||||
let offer_response = OfferResponse::from_msgpack(&response_data);
|
||||
self.handle_offer_response(offer_response);
|
||||
}
|
||||
}
|
||||
rns_wire::context::PacketContext::ResourceRcl
|
||||
@@ -1039,10 +1032,10 @@ impl PropagationSyncTask {
|
||||
|
||||
fn prepare_transfer_for_ids(&mut self, ids: &[PropagationTransientId]) {
|
||||
if ids.is_empty() {
|
||||
if let Some(node_hash) = self.node_dest_hash {
|
||||
if let Ok(mut node) = self.propagation_node.lock() {
|
||||
node.complete_sync(&node_hash);
|
||||
}
|
||||
if let Some(node_hash) = self.node_dest_hash
|
||||
&& let Ok(mut node) = self.propagation_node.lock()
|
||||
{
|
||||
node.complete_sync(&node_hash);
|
||||
}
|
||||
self.state = SyncTaskState::Complete;
|
||||
return;
|
||||
@@ -1128,13 +1121,12 @@ impl PropagationSyncTask {
|
||||
if self.terminal_result.is_none()
|
||||
&& self.offer_policy.is_none()
|
||||
&& self.last_sync.elapsed() >= self.sync_interval
|
||||
&& let Some(node_hash) = self.node_dest_hash
|
||||
{
|
||||
if let Some(node_hash) = self.node_dest_hash {
|
||||
if self.message_count() > 0 {
|
||||
let _ = self.start_sync(node_hash);
|
||||
} else {
|
||||
self.last_sync = Instant::now();
|
||||
}
|
||||
if self.message_count() > 0 {
|
||||
let _ = self.start_sync(node_hash);
|
||||
} else {
|
||||
self.last_sync = Instant::now();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1146,38 +1138,38 @@ impl PropagationSyncTask {
|
||||
self.drive_transfers();
|
||||
}
|
||||
SyncTaskState::Complete | SyncTaskState::Failed => {
|
||||
if self.terminal_result.is_none() {
|
||||
if let Some(peer_hash) = self.node_dest_hash {
|
||||
let complete = self.state == SyncTaskState::Complete;
|
||||
self.terminal_result = Some(PeerSyncTerminalResult {
|
||||
peer_hash,
|
||||
state: if complete {
|
||||
PeerSyncTerminalState::Complete
|
||||
} else {
|
||||
PeerSyncTerminalState::Failed
|
||||
},
|
||||
offer_generation: complete
|
||||
.then_some(self.active_offer_generation)
|
||||
.flatten(),
|
||||
generation_exhausted: complete && self.generation_exhausted,
|
||||
offered: if complete { self.offered_count } else { 0 },
|
||||
outgoing: if complete { self.outgoing_count } else { 0 },
|
||||
tx_bytes: if complete { self.transfer_data_size } else { 0 },
|
||||
link_establishment_rate: self.link_establishment_rate,
|
||||
sync_transfer_rate: (complete && self.outgoing_count > 0)
|
||||
.then(|| {
|
||||
self.transfer_started.map(|started| {
|
||||
let elapsed = started.elapsed().as_secs_f64();
|
||||
if elapsed > 0.0 {
|
||||
self.transfer_wire_size as f64 * 8.0 / elapsed
|
||||
} else {
|
||||
0.0
|
||||
}
|
||||
})
|
||||
if self.terminal_result.is_none()
|
||||
&& let Some(peer_hash) = self.node_dest_hash
|
||||
{
|
||||
let complete = self.state == SyncTaskState::Complete;
|
||||
self.terminal_result = Some(PeerSyncTerminalResult {
|
||||
peer_hash,
|
||||
state: if complete {
|
||||
PeerSyncTerminalState::Complete
|
||||
} else {
|
||||
PeerSyncTerminalState::Failed
|
||||
},
|
||||
offer_generation: complete
|
||||
.then_some(self.active_offer_generation)
|
||||
.flatten(),
|
||||
generation_exhausted: complete && self.generation_exhausted,
|
||||
offered: if complete { self.offered_count } else { 0 },
|
||||
outgoing: if complete { self.outgoing_count } else { 0 },
|
||||
tx_bytes: if complete { self.transfer_data_size } else { 0 },
|
||||
link_establishment_rate: self.link_establishment_rate,
|
||||
sync_transfer_rate: (complete && self.outgoing_count > 0)
|
||||
.then(|| {
|
||||
self.transfer_started.map(|started| {
|
||||
let elapsed = started.elapsed().as_secs_f64();
|
||||
if elapsed > 0.0 {
|
||||
self.transfer_wire_size as f64 * 8.0 / elapsed
|
||||
} else {
|
||||
0.0
|
||||
}
|
||||
})
|
||||
.flatten(),
|
||||
});
|
||||
}
|
||||
})
|
||||
.flatten(),
|
||||
});
|
||||
}
|
||||
self.cleanup_sync();
|
||||
self.last_sync = Instant::now();
|
||||
@@ -1311,10 +1303,10 @@ impl PropagationSyncTask {
|
||||
self.active_offer_generation = Some(generation);
|
||||
self.generation_exhausted = generation_exhausted;
|
||||
self.record_handled_updates(&terminal_handled_ids);
|
||||
if offer.transient_ids.is_empty() {
|
||||
if let Ok(mut node) = self.propagation_node.lock() {
|
||||
node.complete_sync(&node_hash);
|
||||
}
|
||||
if offer.transient_ids.is_empty()
|
||||
&& let Ok(mut node) = self.propagation_node.lock()
|
||||
{
|
||||
node.complete_sync(&node_hash);
|
||||
}
|
||||
offer
|
||||
}
|
||||
@@ -1589,10 +1581,10 @@ impl PropagationSyncTask {
|
||||
|
||||
let completed_ids = std::mem::take(&mut self.active_transfer_ids);
|
||||
self.record_handled_updates(&completed_ids);
|
||||
if let Some(node_hash) = self.node_dest_hash {
|
||||
if let Ok(mut node) = self.propagation_node.lock() {
|
||||
node.complete_sync(&node_hash);
|
||||
}
|
||||
if let Some(node_hash) = self.node_dest_hash
|
||||
&& let Ok(mut node) = self.propagation_node.lock()
|
||||
{
|
||||
node.complete_sync(&node_hash);
|
||||
}
|
||||
self.state = SyncTaskState::Complete;
|
||||
}
|
||||
@@ -1741,10 +1733,10 @@ impl PropagationSyncTask {
|
||||
peer.link_closed();
|
||||
}
|
||||
|
||||
if let Some(link_id) = self.link_id.take() {
|
||||
if !graceful_release {
|
||||
self.queue_endpoint_cleanup(link_id);
|
||||
}
|
||||
if let Some(link_id) = self.link_id.take()
|
||||
&& !graceful_release
|
||||
{
|
||||
self.queue_endpoint_cleanup(link_id);
|
||||
}
|
||||
self.attached_interface = None;
|
||||
self.pending_endpoint_bind = None;
|
||||
|
||||
@@ -561,16 +561,16 @@ impl LxmRouter {
|
||||
}
|
||||
}
|
||||
|
||||
if message.method == DeliveryMethod::Opportunistic {
|
||||
if let Ok(packed) = message.pack_payload() {
|
||||
let content_size = packed
|
||||
.len()
|
||||
.saturating_sub(TIMESTAMP_SIZE + STRUCT_OVERHEAD);
|
||||
// Approximates ENCRYPTED_PACKET_MAX_CONTENT for default RNS parameters.
|
||||
let max_content = 295;
|
||||
if content_size > max_content {
|
||||
message.method = DeliveryMethod::Direct;
|
||||
}
|
||||
if message.method == DeliveryMethod::Opportunistic
|
||||
&& let Ok(packed) = message.pack_payload()
|
||||
{
|
||||
let content_size = packed
|
||||
.len()
|
||||
.saturating_sub(TIMESTAMP_SIZE + STRUCT_OVERHEAD);
|
||||
// Approximates ENCRYPTED_PACKET_MAX_CONTENT for default RNS parameters.
|
||||
let max_content = 295;
|
||||
if content_size > max_content {
|
||||
message.method = DeliveryMethod::Direct;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -591,13 +591,12 @@ impl LxmRouter {
|
||||
message: &mut LxMessage,
|
||||
) -> Result<(), TicketPreparationError> {
|
||||
let now = now_f64();
|
||||
if message.outbound_ticket.is_none() {
|
||||
if let Some(ticket) = self
|
||||
if message.outbound_ticket.is_none()
|
||||
&& let Some(ticket) = self
|
||||
.ticket_store
|
||||
.find_outbound(&message.destination_hash, now)
|
||||
{
|
||||
message.outbound_ticket = Some(ticket.token);
|
||||
}
|
||||
{
|
||||
message.outbound_ticket = Some(ticket.token);
|
||||
}
|
||||
|
||||
if message.include_ticket && !message.fields.contains_key(&FIELD_TICKET) {
|
||||
@@ -915,10 +914,8 @@ impl LxmRouter {
|
||||
.active_deferred_stamp
|
||||
.as_ref()
|
||||
.is_some_and(|job| job.message_hash == *message_hash);
|
||||
if active_matches {
|
||||
if let Some(job) = self.active_deferred_stamp.take() {
|
||||
job.handle.cancel();
|
||||
}
|
||||
if active_matches && let Some(job) = self.active_deferred_stamp.take() {
|
||||
job.handle.cancel();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -323,15 +323,14 @@ fn apply_propagation_store_commit(
|
||||
for (transient_id, _) in result.committed {
|
||||
peer.add_handled_message(&transient_id);
|
||||
}
|
||||
if let Some(node) = node {
|
||||
if let Ok(node) = node.lock() {
|
||||
if let Err(error) = node.save_peer(peer) {
|
||||
tracing::warn!(
|
||||
peer = %hex::encode(peer_hash),
|
||||
"failed to persist committed peer accounting: {error}"
|
||||
);
|
||||
}
|
||||
}
|
||||
if let Some(node) = node
|
||||
&& let Ok(node) = node.lock()
|
||||
&& let Err(error) = node.save_peer(peer)
|
||||
{
|
||||
tracing::warn!(
|
||||
peer = %hex::encode(peer_hash),
|
||||
"failed to persist committed peer accounting: {error}"
|
||||
);
|
||||
}
|
||||
} else {
|
||||
router.unpeered_propagation_incoming = router
|
||||
@@ -1396,10 +1395,10 @@ impl LxmdRunner {
|
||||
if let Ok(entries) = std::fs::read_dir(&received_dir) {
|
||||
for entry in entries.flatten() {
|
||||
let path = entry.path();
|
||||
if let Some(name) = path.file_stem().and_then(|n| n.to_str()) {
|
||||
if let Ok(rr) = ReceivedRatchet::load(&path) {
|
||||
received_ratchets.insert(name.to_string(), rr);
|
||||
}
|
||||
if let Some(name) = path.file_stem().and_then(|n| n.to_str())
|
||||
&& let Ok(rr) = ReceivedRatchet::load(&path)
|
||||
{
|
||||
received_ratchets.insert(name.to_string(), rr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1407,17 +1406,17 @@ impl LxmdRunner {
|
||||
// known_identities format: concat of [dest_hash:16][pubkey:64]
|
||||
let ki_path = paths.known_identities_path.clone();
|
||||
let mut known_identities: HashMap<String, [u8; 64]> = HashMap::new();
|
||||
if ki_path.exists() {
|
||||
if let Ok(data) = std::fs::read(&ki_path) {
|
||||
let mut pos = 0;
|
||||
while pos + 80 <= data.len() {
|
||||
let mut dh = [0u8; 16];
|
||||
dh.copy_from_slice(&data[pos..pos + 16]);
|
||||
let mut pk = [0u8; 64];
|
||||
pk.copy_from_slice(&data[pos + 16..pos + 80]);
|
||||
known_identities.insert(hex::encode(dh), pk);
|
||||
pos += 80;
|
||||
}
|
||||
if ki_path.exists()
|
||||
&& let Ok(data) = std::fs::read(&ki_path)
|
||||
{
|
||||
let mut pos = 0;
|
||||
while pos + 80 <= data.len() {
|
||||
let mut dh = [0u8; 16];
|
||||
dh.copy_from_slice(&data[pos..pos + 16]);
|
||||
let mut pk = [0u8; 64];
|
||||
pk.copy_from_slice(&data[pos + 16..pos + 80]);
|
||||
known_identities.insert(hex::encode(dh), pk);
|
||||
pos += 80;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2080,10 +2079,10 @@ impl LxmdRunner {
|
||||
match parse_destination_hash(configured) {
|
||||
Ok(hash) => {
|
||||
self.router.prioritise(hash, 1);
|
||||
if let Some(ref node) = self.propagation_node {
|
||||
if let Ok(mut node) = node.lock() {
|
||||
node.prioritise_destination(hash);
|
||||
}
|
||||
if let Some(ref node) = self.propagation_node
|
||||
&& let Ok(mut node) = node.lock()
|
||||
{
|
||||
node.prioritise_destination(hash);
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
@@ -2222,15 +2221,14 @@ impl LxmdRunner {
|
||||
// Upstream control unpeer breaks the live peering without
|
||||
// mutating the operator's configured static-peer set.
|
||||
self.router.remove_peer(&peer_hash);
|
||||
if let Some(ref node) = self.propagation_node {
|
||||
if let Ok(mut node) = node.lock() {
|
||||
if let Err(error) = node.delete_peer(&peer_hash) {
|
||||
tracing::warn!(
|
||||
peer = %hex::encode(peer_hash),
|
||||
"failed to remove persisted propagation peer: {error}"
|
||||
);
|
||||
}
|
||||
}
|
||||
if let Some(ref node) = self.propagation_node
|
||||
&& let Ok(mut node) = node.lock()
|
||||
&& let Err(error) = node.delete_peer(&peer_hash)
|
||||
{
|
||||
tracing::warn!(
|
||||
peer = %hex::encode(peer_hash),
|
||||
"failed to remove persisted propagation peer: {error}"
|
||||
);
|
||||
}
|
||||
if let Err(e) = self.router.save_state(&self.data_dir) {
|
||||
tracing::warn!("Failed to save router state after control unpeer: {e}");
|
||||
@@ -2253,11 +2251,11 @@ impl LxmdRunner {
|
||||
// announce timebase (or a lower current target) does not make
|
||||
// a completed key stale if its measured value is still high
|
||||
// enough for the current policy.
|
||||
if let Some((key, value)) = result.peering_key {
|
||||
if value >= peer.peering_cost as u32 {
|
||||
peer.peering_key = Some((key, value));
|
||||
applied = true;
|
||||
}
|
||||
if let Some((key, value)) = result.peering_key
|
||||
&& value >= peer.peering_cost as u32
|
||||
{
|
||||
peer.peering_key = Some((key, value));
|
||||
applied = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2265,15 +2263,13 @@ impl LxmdRunner {
|
||||
if let (Some(node), Some(peer)) = (
|
||||
self.propagation_node.as_ref(),
|
||||
self.router.peers.get(&result.peer_hash),
|
||||
) {
|
||||
if let Ok(node) = node.lock() {
|
||||
if let Err(error) = node.save_peer(peer) {
|
||||
tracing::warn!(
|
||||
peer = %hex::encode(result.peer_hash),
|
||||
"failed to persist generated peering key: {error}"
|
||||
);
|
||||
}
|
||||
}
|
||||
) && let Ok(node) = node.lock()
|
||||
&& let Err(error) = node.save_peer(peer)
|
||||
{
|
||||
tracing::warn!(
|
||||
peer = %hex::encode(result.peer_hash),
|
||||
"failed to persist generated peering key: {error}"
|
||||
);
|
||||
}
|
||||
} else if current_cost {
|
||||
// A bounded key search can fail for an excessive advertised
|
||||
@@ -2354,14 +2350,14 @@ impl LxmdRunner {
|
||||
.then(|| OutboundOfferPolicy::from(peer))
|
||||
});
|
||||
if let Some(policy) = policy {
|
||||
if let Some(sync) = self.propagation_sync.as_mut() {
|
||||
if sync.request_sync_now_with_policy(policy) {
|
||||
if let Some(peer) = self.router.peers.get_mut(&peer_hash) {
|
||||
peer.begin_sync();
|
||||
}
|
||||
self.pending_peer_syncs.remove(&peer_hash);
|
||||
self.peer_sync_cursor = Some(peer_hash);
|
||||
if let Some(sync) = self.propagation_sync.as_mut()
|
||||
&& sync.request_sync_now_with_policy(policy)
|
||||
{
|
||||
if let Some(peer) = self.router.peers.get_mut(&peer_hash) {
|
||||
peer.begin_sync();
|
||||
}
|
||||
self.pending_peer_syncs.remove(&peer_hash);
|
||||
self.peer_sync_cursor = Some(peer_hash);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -2471,15 +2467,14 @@ impl LxmdRunner {
|
||||
link_id,
|
||||
packet_hash,
|
||||
} => {
|
||||
if let Some(ld) = &mut self.link_delivery {
|
||||
if !ld.abandon_backchannel_packet(link_id, packet_hash) {
|
||||
self.pending_backchannel_abandon =
|
||||
Some(BackchannelSendReceipt::Packet {
|
||||
link_id,
|
||||
packet_hash,
|
||||
});
|
||||
break;
|
||||
}
|
||||
if let Some(ld) = &mut self.link_delivery
|
||||
&& !ld.abandon_backchannel_packet(link_id, packet_hash)
|
||||
{
|
||||
self.pending_backchannel_abandon = Some(BackchannelSendReceipt::Packet {
|
||||
link_id,
|
||||
packet_hash,
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
BackchannelSendReceipt::Resource {
|
||||
@@ -2727,64 +2722,62 @@ impl LxmdRunner {
|
||||
sync.drain_events(&self.known_identities);
|
||||
sync.tick();
|
||||
let updates = sync.take_handled_updates();
|
||||
if !updates.is_empty() {
|
||||
if let Some(peer_hash) = sync.node_dest_hash() {
|
||||
peer_handled_updates = Some((peer_hash, updates));
|
||||
}
|
||||
if !updates.is_empty()
|
||||
&& let Some(peer_hash) = sync.node_dest_hash()
|
||||
{
|
||||
peer_handled_updates = Some((peer_hash, updates));
|
||||
}
|
||||
peer_terminal_result = sync.take_terminal_peer_result();
|
||||
}
|
||||
|
||||
let mut peers_to_persist = HashSet::new();
|
||||
if let Some((peer_hash, updates)) = peer_handled_updates {
|
||||
if let Some(peer) = self.router.peers.get_mut(&peer_hash) {
|
||||
for transient_id in updates {
|
||||
peer.add_handled_message(&transient_id);
|
||||
}
|
||||
peers_to_persist.insert(peer_hash);
|
||||
if let Some((peer_hash, updates)) = peer_handled_updates
|
||||
&& let Some(peer) = self.router.peers.get_mut(&peer_hash)
|
||||
{
|
||||
for transient_id in updates {
|
||||
peer.add_handled_message(&transient_id);
|
||||
}
|
||||
peers_to_persist.insert(peer_hash);
|
||||
}
|
||||
if let Some(result) = peer_terminal_result {
|
||||
if let Some(peer) = self.router.peers.get_mut(&result.peer_hash) {
|
||||
if let Some(rate) = result.link_establishment_rate {
|
||||
peer.link_establishment_rate = rate;
|
||||
peer.heard();
|
||||
}
|
||||
match result.state {
|
||||
lxmf_core::propagation_sync::PeerSyncTerminalState::Complete => {
|
||||
peer.offered = peer.offered.saturating_add(result.offered);
|
||||
peer.outgoing = peer.outgoing.saturating_add(result.outgoing);
|
||||
peer.tx_bytes = peer.tx_bytes.saturating_add(result.tx_bytes);
|
||||
if let Some(rate) = result.sync_transfer_rate {
|
||||
peer.sync_transfer_rate = rate;
|
||||
}
|
||||
peer.sync_complete();
|
||||
if result.generation_exhausted {
|
||||
if let Some(generation) = result.offer_generation {
|
||||
peer.mark_offer_generation_processed(generation);
|
||||
}
|
||||
}
|
||||
}
|
||||
lxmf_core::propagation_sync::PeerSyncTerminalState::Failed => {
|
||||
peer.sync_failed();
|
||||
}
|
||||
}
|
||||
peers_to_persist.insert(result.peer_hash);
|
||||
if let Some(result) = peer_terminal_result
|
||||
&& let Some(peer) = self.router.peers.get_mut(&result.peer_hash)
|
||||
{
|
||||
if let Some(rate) = result.link_establishment_rate {
|
||||
peer.link_establishment_rate = rate;
|
||||
peer.heard();
|
||||
}
|
||||
match result.state {
|
||||
lxmf_core::propagation_sync::PeerSyncTerminalState::Complete => {
|
||||
peer.offered = peer.offered.saturating_add(result.offered);
|
||||
peer.outgoing = peer.outgoing.saturating_add(result.outgoing);
|
||||
peer.tx_bytes = peer.tx_bytes.saturating_add(result.tx_bytes);
|
||||
if let Some(rate) = result.sync_transfer_rate {
|
||||
peer.sync_transfer_rate = rate;
|
||||
}
|
||||
peer.sync_complete();
|
||||
if result.generation_exhausted
|
||||
&& let Some(generation) = result.offer_generation
|
||||
{
|
||||
peer.mark_offer_generation_processed(generation);
|
||||
}
|
||||
}
|
||||
lxmf_core::propagation_sync::PeerSyncTerminalState::Failed => {
|
||||
peer.sync_failed();
|
||||
}
|
||||
}
|
||||
peers_to_persist.insert(result.peer_hash);
|
||||
}
|
||||
for peer_hash in peers_to_persist {
|
||||
if let (Some(node), Some(peer)) = (
|
||||
self.propagation_node.as_ref(),
|
||||
self.router.peers.get(&peer_hash),
|
||||
) {
|
||||
if let Ok(node) = node.lock() {
|
||||
if let Err(error) = node.save_peer(peer) {
|
||||
tracing::warn!(
|
||||
peer = %hex::encode(peer_hash),
|
||||
"failed to persist peer sync state: {error}"
|
||||
);
|
||||
}
|
||||
}
|
||||
) && let Ok(node) = node.lock()
|
||||
&& let Err(error) = node.save_peer(peer)
|
||||
{
|
||||
tracing::warn!(
|
||||
peer = %hex::encode(peer_hash),
|
||||
"failed to persist peer sync state: {error}"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3014,18 +3007,18 @@ impl LxmdRunner {
|
||||
client.start_download();
|
||||
self.last_propagation_check = now;
|
||||
tracing::debug!("auto-triggered propagation download");
|
||||
} else if let Some(node) = self.router.outbound_propagation_node {
|
||||
if queue_unknown_propagation_node_path_request(
|
||||
} else if let Some(node) = self.router.outbound_propagation_node
|
||||
&& queue_unknown_propagation_node_path_request(
|
||||
&self.transport_tx,
|
||||
node,
|
||||
&mut self.last_propagation_check,
|
||||
now,
|
||||
) {
|
||||
tracing::debug!(
|
||||
node = %hex::encode(node),
|
||||
"propagation node identity unknown; requesting path before download"
|
||||
);
|
||||
}
|
||||
)
|
||||
{
|
||||
tracing::debug!(
|
||||
node = %hex::encode(node),
|
||||
"propagation node identity unknown; requesting path before download"
|
||||
);
|
||||
}
|
||||
}
|
||||
let status = client.transfer_status();
|
||||
@@ -3043,65 +3036,56 @@ impl LxmdRunner {
|
||||
for msg_data in downloaded_messages {
|
||||
self.handle_propagation_downloaded_data(&msg_data);
|
||||
}
|
||||
if acknowledge_propagation {
|
||||
if let Some(client) = self.propagation_client.as_mut() {
|
||||
client.acknowledge_transfer();
|
||||
if acknowledge_propagation && let Some(client) = self.propagation_client.as_mut() {
|
||||
client.acknowledge_transfer();
|
||||
}
|
||||
|
||||
if let Some(interval) = self.config.announce_interval
|
||||
&& now - self.last_peer_announce > interval as f64
|
||||
&& let Ok(raw) = self.create_announce_packet()
|
||||
{
|
||||
let dest = self.lxmf_dest_hash;
|
||||
if self.queue_runtime_transport(
|
||||
TransportMessage::Outbound(rns_transport::messages::OutboundRequest {
|
||||
raw: Bytes::from(raw),
|
||||
destination_hash: dest,
|
||||
}),
|
||||
"periodic delivery announce",
|
||||
) {
|
||||
self.last_peer_announce = now;
|
||||
tracing::debug!("periodic peer announce staged");
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(interval) = self.config.announce_interval {
|
||||
if now - self.last_peer_announce > interval as f64 {
|
||||
if let Ok(raw) = self.create_announce_packet() {
|
||||
let dest = self.lxmf_dest_hash;
|
||||
if self.queue_runtime_transport(
|
||||
TransportMessage::Outbound(rns_transport::messages::OutboundRequest {
|
||||
raw: Bytes::from(raw),
|
||||
destination_hash: dest,
|
||||
}),
|
||||
"periodic delivery announce",
|
||||
) {
|
||||
self.last_peer_announce = now;
|
||||
tracing::debug!("periodic peer announce staged");
|
||||
}
|
||||
}
|
||||
if self.config.propagation_enabled
|
||||
&& let Some(interval) = self.config.node_announce_interval
|
||||
&& now - self.last_node_announce > interval as f64
|
||||
&& let Ok(raw) = self.create_propagation_announce_packet()
|
||||
{
|
||||
let dest = self.propagation_dest_hash;
|
||||
let node_staged = self.queue_runtime_transport(
|
||||
TransportMessage::Outbound(rns_transport::messages::OutboundRequest {
|
||||
raw: Bytes::from(raw),
|
||||
destination_hash: dest,
|
||||
}),
|
||||
"periodic propagation announce",
|
||||
);
|
||||
let mut control_staged = true;
|
||||
if self.should_announce_control()
|
||||
&& let Ok(raw) =
|
||||
create_control_announce_packet(&self.identity, self.control_dest_hash)
|
||||
{
|
||||
control_staged = self.queue_runtime_transport(
|
||||
TransportMessage::Outbound(rns_transport::messages::OutboundRequest {
|
||||
raw: Bytes::from(raw),
|
||||
destination_hash: self.control_dest_hash,
|
||||
}),
|
||||
"periodic control announce",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if self.config.propagation_enabled {
|
||||
if let Some(interval) = self.config.node_announce_interval {
|
||||
if now - self.last_node_announce > interval as f64 {
|
||||
if let Ok(raw) = self.create_propagation_announce_packet() {
|
||||
let dest = self.propagation_dest_hash;
|
||||
let node_staged = self.queue_runtime_transport(
|
||||
TransportMessage::Outbound(rns_transport::messages::OutboundRequest {
|
||||
raw: Bytes::from(raw),
|
||||
destination_hash: dest,
|
||||
}),
|
||||
"periodic propagation announce",
|
||||
);
|
||||
let mut control_staged = true;
|
||||
if self.should_announce_control() {
|
||||
if let Ok(raw) = create_control_announce_packet(
|
||||
&self.identity,
|
||||
self.control_dest_hash,
|
||||
) {
|
||||
control_staged = self.queue_runtime_transport(
|
||||
TransportMessage::Outbound(
|
||||
rns_transport::messages::OutboundRequest {
|
||||
raw: Bytes::from(raw),
|
||||
destination_hash: self.control_dest_hash,
|
||||
},
|
||||
),
|
||||
"periodic control announce",
|
||||
);
|
||||
}
|
||||
}
|
||||
if node_staged && control_staged {
|
||||
self.last_node_announce = now;
|
||||
tracing::debug!("periodic propagation node announce staged");
|
||||
}
|
||||
}
|
||||
}
|
||||
if node_staged && control_staged {
|
||||
self.last_node_announce = now;
|
||||
tracing::debug!("periodic propagation node announce staged");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3111,10 +3095,10 @@ impl LxmdRunner {
|
||||
// jobloop cadences. The propagation node's own store (separate
|
||||
// from the router's) ages out expired messages and enforces the
|
||||
// weight cap here — previously this never ran.
|
||||
if let Some(ref pn) = self.propagation_node {
|
||||
if let Ok(mut node) = pn.lock() {
|
||||
node.tick();
|
||||
}
|
||||
if let Some(ref pn) = self.propagation_node
|
||||
&& let Ok(mut node) = pn.lock()
|
||||
{
|
||||
node.tick();
|
||||
}
|
||||
self.last_cull = now;
|
||||
}
|
||||
@@ -3169,21 +3153,20 @@ impl LxmdRunner {
|
||||
.insert(event.destination_hash, event.hops.max(1));
|
||||
|
||||
if event.name_hash == delivery_name_hash {
|
||||
if let Some(ref data) = event.app_data {
|
||||
if let Some((display_name, stamp_cost)) =
|
||||
if let Some(ref data) = event.app_data
|
||||
&& let Some((display_name, stamp_cost)) =
|
||||
lxmf_core::handlers::parse_announce_app_data(data)
|
||||
{
|
||||
if let Some(name) = display_name {
|
||||
tracing::info!(dest = %dest_hex, name = %name, "announce display name");
|
||||
}
|
||||
if let Some(cost) = stamp_cost {
|
||||
self.router.set_stamp_cost(event.destination_hash, cost);
|
||||
tracing::debug!(
|
||||
dest = %dest_hex,
|
||||
stamp_cost = cost,
|
||||
"learned delivery stamp cost from announce"
|
||||
);
|
||||
}
|
||||
{
|
||||
if let Some(name) = display_name {
|
||||
tracing::info!(dest = %dest_hex, name = %name, "announce display name");
|
||||
}
|
||||
if let Some(cost) = stamp_cost {
|
||||
self.router.set_stamp_cost(event.destination_hash, cost);
|
||||
tracing::debug!(
|
||||
dest = %dest_hex,
|
||||
stamp_cost = cost,
|
||||
"learned delivery stamp cost from announce"
|
||||
);
|
||||
}
|
||||
}
|
||||
let triggered = self
|
||||
@@ -3257,15 +3240,14 @@ impl LxmdRunner {
|
||||
if let Some(sync) = self.propagation_sync.as_mut() {
|
||||
sync.cancel_peer_sync(&event.destination_hash);
|
||||
}
|
||||
if let Some(node) = self.propagation_node.as_ref() {
|
||||
if let Ok(mut node) = node.lock() {
|
||||
if let Err(error) = node.delete_peer(&event.destination_hash) {
|
||||
tracing::warn!(
|
||||
peer = %dest_hex,
|
||||
"failed to remove retired propagation peer: {error}"
|
||||
);
|
||||
}
|
||||
}
|
||||
if let Some(node) = self.propagation_node.as_ref()
|
||||
&& let Ok(mut node) = node.lock()
|
||||
&& let Err(error) = node.delete_peer(&event.destination_hash)
|
||||
{
|
||||
tracing::warn!(
|
||||
peer = %dest_hex,
|
||||
"failed to remove retired propagation peer: {error}"
|
||||
);
|
||||
}
|
||||
} else if peer_changed {
|
||||
let offer_constraints_changed =
|
||||
@@ -3290,15 +3272,13 @@ impl LxmdRunner {
|
||||
if let (Some(node), Some(peer)) = (
|
||||
self.propagation_node.as_ref(),
|
||||
self.router.peers.get(&event.destination_hash),
|
||||
) {
|
||||
if let Ok(node) = node.lock() {
|
||||
if let Err(error) = node.save_peer(peer) {
|
||||
tracing::warn!(
|
||||
peer = %dest_hex,
|
||||
"failed to persist propagation peer policy: {error}"
|
||||
);
|
||||
}
|
||||
}
|
||||
) && let Ok(node) = node.lock()
|
||||
&& let Err(error) = node.save_peer(peer)
|
||||
{
|
||||
tracing::warn!(
|
||||
peer = %dest_hex,
|
||||
"failed to persist propagation peer policy: {error}"
|
||||
);
|
||||
}
|
||||
}
|
||||
tracing::debug!(
|
||||
@@ -3317,35 +3297,34 @@ impl LxmdRunner {
|
||||
);
|
||||
}
|
||||
}
|
||||
if let Some(pub_key) = event.public_key {
|
||||
if self.known_identities.get(&dest_hex) != Some(&pub_key) {
|
||||
self.known_identities.insert(dest_hex.clone(), pub_key);
|
||||
tracing::debug!(dest = %dest_hex, "learned identity key from announce");
|
||||
}
|
||||
if let Some(pub_key) = event.public_key
|
||||
&& self.known_identities.get(&dest_hex) != Some(&pub_key)
|
||||
{
|
||||
self.known_identities.insert(dest_hex.clone(), pub_key);
|
||||
tracing::debug!(dest = %dest_hex, "learned identity key from announce");
|
||||
}
|
||||
// Python Identity._remember_ratchet: persist only the single
|
||||
// changed ratchet, off the daemon loop. Identity keys and the
|
||||
// ring stay on the periodic/shutdown saves.
|
||||
if let Some(ratchet_key) = event.ratchet {
|
||||
if self
|
||||
if let Some(ratchet_key) = event.ratchet
|
||||
&& self
|
||||
.received_ratchets
|
||||
.get(&dest_hex)
|
||||
.is_none_or(|rr| rr.ratchet_pub != ratchet_key)
|
||||
{
|
||||
let rr = ReceivedRatchet::new(ratchet_key);
|
||||
self.received_ratchets.insert(dest_hex.clone(), rr);
|
||||
tracing::debug!(dest = %dest_hex, "learned ratchet from announce");
|
||||
let path = self
|
||||
.received_ratchets_dir
|
||||
.join(format!("{dest_hex}.ratchet"));
|
||||
let dir = self.received_ratchets_dir.clone();
|
||||
tokio::task::spawn_blocking(move || {
|
||||
std::fs::create_dir_all(&dir).ok();
|
||||
if let Err(e) = rr.save(&path) {
|
||||
tracing::warn!("Failed to persist received ratchet: {e}");
|
||||
}
|
||||
});
|
||||
}
|
||||
{
|
||||
let rr = ReceivedRatchet::new(ratchet_key);
|
||||
self.received_ratchets.insert(dest_hex.clone(), rr);
|
||||
tracing::debug!(dest = %dest_hex, "learned ratchet from announce");
|
||||
let path = self
|
||||
.received_ratchets_dir
|
||||
.join(format!("{dest_hex}.ratchet"));
|
||||
let dir = self.received_ratchets_dir.clone();
|
||||
tokio::task::spawn_blocking(move || {
|
||||
std::fs::create_dir_all(&dir).ok();
|
||||
if let Err(e) = rr.save(&path) {
|
||||
tracing::warn!("Failed to persist received ratchet: {e}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
seen
|
||||
@@ -3366,10 +3345,9 @@ impl LxmdRunner {
|
||||
direction: LinkResourceDirection::Inbound,
|
||||
..
|
||||
}
|
||||
) {
|
||||
if let Some(event) = delivery_resource_event_from_runtime(event) {
|
||||
self.router.handle_inbound_resource_event(event);
|
||||
}
|
||||
) && let Some(event) = delivery_resource_event_from_runtime(event)
|
||||
{
|
||||
self.router.handle_inbound_resource_event(event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3661,31 +3639,31 @@ impl LxmdRunner {
|
||||
.map(PropagationStoreWriteOrigin::Peer)
|
||||
.unwrap_or(PropagationStoreWriteOrigin::Client);
|
||||
let mut write_plans = Vec::new();
|
||||
if let Some(ref node) = self.propagation_node {
|
||||
if let Ok(mut node) = node.lock() {
|
||||
for entry in &result.entries {
|
||||
let stamp_value = u8::try_from(entry.stamp_value).unwrap_or(u8::MAX);
|
||||
if let Some(plan) = node.plan_accept_stamped_propagated_blob(
|
||||
&entry.lxmf_data,
|
||||
&entry.stamp_data,
|
||||
stamp_value,
|
||||
) {
|
||||
write_plans.push((plan, entry.lxmf_data.len() as u64));
|
||||
}
|
||||
if let Some(ref node) = self.propagation_node
|
||||
&& let Ok(mut node) = node.lock()
|
||||
{
|
||||
for entry in &result.entries {
|
||||
let stamp_value = u8::try_from(entry.stamp_value).unwrap_or(u8::MAX);
|
||||
if let Some(plan) = node.plan_accept_stamped_propagated_blob(
|
||||
&entry.lxmf_data,
|
||||
&entry.stamp_data,
|
||||
stamp_value,
|
||||
) {
|
||||
write_plans.push((plan, entry.lxmf_data.len() as u64));
|
||||
}
|
||||
}
|
||||
}
|
||||
let reserved = write_plans.len();
|
||||
if let Some(node) = self.propagation_node.clone() {
|
||||
if let Some(task) = spawn_propagation_store_writes(
|
||||
if let Some(node) = self.propagation_node.clone()
|
||||
&& let Some(task) = spawn_propagation_store_writes(
|
||||
node,
|
||||
write_plans,
|
||||
write_origin,
|
||||
self.prop_store_commit_tx.clone(),
|
||||
"propagation Resource ingress",
|
||||
) {
|
||||
self.prop_store_write_tasks.push(task);
|
||||
}
|
||||
)
|
||||
{
|
||||
self.prop_store_write_tasks.push(task);
|
||||
}
|
||||
|
||||
tracing::info!(
|
||||
@@ -3696,26 +3674,26 @@ impl LxmdRunner {
|
||||
"processed inbound propagation Resource"
|
||||
);
|
||||
|
||||
if claim.should_close_link() {
|
||||
if let Some(command_tx) = self.prop_link_command_tx.clone() {
|
||||
let link_id = claim.link_id();
|
||||
tokio::spawn(async move {
|
||||
if command_tx
|
||||
.send(rns_runtime::link_manager::LinkManagerCommand::CloseLink {
|
||||
link_id,
|
||||
reason: rns_runtime::prelude::CloseReason::DestinationClosed,
|
||||
send_teardown: true,
|
||||
})
|
||||
.await
|
||||
.is_err()
|
||||
{
|
||||
tracing::debug!(
|
||||
link_id = %hex::encode(link_id),
|
||||
"propagation Link already closed before validation teardown"
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
if claim.should_close_link()
|
||||
&& let Some(command_tx) = self.prop_link_command_tx.clone()
|
||||
{
|
||||
let link_id = claim.link_id();
|
||||
tokio::spawn(async move {
|
||||
if command_tx
|
||||
.send(rns_runtime::link_manager::LinkManagerCommand::CloseLink {
|
||||
link_id,
|
||||
reason: rns_runtime::prelude::CloseReason::DestinationClosed,
|
||||
send_teardown: true,
|
||||
})
|
||||
.await
|
||||
.is_err()
|
||||
{
|
||||
tracing::debug!(
|
||||
link_id = %hex::encode(link_id),
|
||||
"propagation Link already closed before validation teardown"
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3780,30 +3758,30 @@ impl LxmdRunner {
|
||||
result: PnPacketValidationWorkerResult,
|
||||
) {
|
||||
let mut write_plans = Vec::new();
|
||||
if let Some(ref node) = self.propagation_node {
|
||||
if let Ok(mut node) = node.lock() {
|
||||
for entry in &result.entries {
|
||||
if let Some(plan) = node.plan_accept_stamped_propagated_blob(
|
||||
&entry.lxmf_data,
|
||||
&entry.stamp_data,
|
||||
u8::try_from(entry.stamp_value).unwrap_or(u8::MAX),
|
||||
) {
|
||||
write_plans.push((plan, entry.lxmf_data.len() as u64));
|
||||
}
|
||||
if let Some(ref node) = self.propagation_node
|
||||
&& let Ok(mut node) = node.lock()
|
||||
{
|
||||
for entry in &result.entries {
|
||||
if let Some(plan) = node.plan_accept_stamped_propagated_blob(
|
||||
&entry.lxmf_data,
|
||||
&entry.stamp_data,
|
||||
u8::try_from(entry.stamp_value).unwrap_or(u8::MAX),
|
||||
) {
|
||||
write_plans.push((plan, entry.lxmf_data.len() as u64));
|
||||
}
|
||||
}
|
||||
}
|
||||
let reserved = write_plans.len();
|
||||
if let Some(node) = self.propagation_node.clone() {
|
||||
if let Some(task) = spawn_propagation_store_writes(
|
||||
if let Some(node) = self.propagation_node.clone()
|
||||
&& let Some(task) = spawn_propagation_store_writes(
|
||||
node,
|
||||
write_plans,
|
||||
PropagationStoreWriteOrigin::Client,
|
||||
self.prop_store_commit_tx.clone(),
|
||||
"client packet ingress",
|
||||
) {
|
||||
self.prop_store_write_tasks.push(task);
|
||||
}
|
||||
)
|
||||
{
|
||||
self.prop_store_write_tasks.push(task);
|
||||
}
|
||||
|
||||
tracing::info!(
|
||||
@@ -3813,18 +3791,18 @@ impl LxmdRunner {
|
||||
"processed inbound propagation packet"
|
||||
);
|
||||
|
||||
if result.rejected > 0 {
|
||||
if let Some(command_tx) = self.prop_link_command_tx.clone() {
|
||||
tokio::spawn(async move {
|
||||
let _ = command_tx
|
||||
.send(rns_runtime::link_manager::LinkManagerCommand::CloseLink {
|
||||
link_id: result.link_id,
|
||||
reason: rns_runtime::prelude::CloseReason::DestinationClosed,
|
||||
send_teardown: true,
|
||||
})
|
||||
.await;
|
||||
});
|
||||
}
|
||||
if result.rejected > 0
|
||||
&& let Some(command_tx) = self.prop_link_command_tx.clone()
|
||||
{
|
||||
tokio::spawn(async move {
|
||||
let _ = command_tx
|
||||
.send(rns_runtime::link_manager::LinkManagerCommand::CloseLink {
|
||||
link_id: result.link_id,
|
||||
reason: rns_runtime::prelude::CloseReason::DestinationClosed,
|
||||
send_teardown: true,
|
||||
})
|
||||
.await;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4165,25 +4143,24 @@ impl LxmdRunner {
|
||||
}
|
||||
let hops = route_hops_for(&self.route_hops, prop_hash);
|
||||
self.ensure_link_delivery();
|
||||
if let Some(ref mut ld) = self.link_delivery {
|
||||
if let Err(err) = ld
|
||||
if let Some(ref mut ld) = self.link_delivery
|
||||
&& let Err(err) = ld
|
||||
.start_packed_delivery(message, prop_hash, hops, packed, false)
|
||||
{
|
||||
let reason = err.error.to_string();
|
||||
tracing::warn!(
|
||||
error = %reason,
|
||||
prop = %hex::encode(prop_hash),
|
||||
"failed to start propagated link delivery"
|
||||
);
|
||||
requeue_after_path_request(
|
||||
&mut self.router,
|
||||
&self.transport_tx,
|
||||
*err.message,
|
||||
prop_hash,
|
||||
&reason,
|
||||
false,
|
||||
);
|
||||
}
|
||||
{
|
||||
let reason = err.error.to_string();
|
||||
tracing::warn!(
|
||||
error = %reason,
|
||||
prop = %hex::encode(prop_hash),
|
||||
"failed to start propagated link delivery"
|
||||
);
|
||||
requeue_after_path_request(
|
||||
&mut self.router,
|
||||
&self.transport_tx,
|
||||
*err.message,
|
||||
prop_hash,
|
||||
&reason,
|
||||
false,
|
||||
);
|
||||
}
|
||||
}
|
||||
None => {
|
||||
@@ -4218,18 +4195,17 @@ impl LxmdRunner {
|
||||
}
|
||||
};
|
||||
|
||||
if message.stamp.is_none() {
|
||||
if let Some(cost) = self.router.get_stamp_cost(&message.destination_hash) {
|
||||
if cost > 0 {
|
||||
tracing::info!(
|
||||
dest = %hex::encode(message.destination_hash),
|
||||
cost = cost,
|
||||
"generating stamp"
|
||||
);
|
||||
message.stamp_cost = Some(cost);
|
||||
message.get_stamp();
|
||||
}
|
||||
}
|
||||
if message.stamp.is_none()
|
||||
&& let Some(cost) = self.router.get_stamp_cost(&message.destination_hash)
|
||||
&& cost > 0
|
||||
{
|
||||
tracing::info!(
|
||||
dest = %hex::encode(message.destination_hash),
|
||||
cost = cost,
|
||||
"generating stamp"
|
||||
);
|
||||
message.stamp_cost = Some(cost);
|
||||
message.get_stamp();
|
||||
}
|
||||
|
||||
let dest_hex = hex::encode(dest_hash);
|
||||
@@ -4483,23 +4459,23 @@ impl LxmdRunner {
|
||||
}
|
||||
let hops = route_hops_for(&self.route_hops, dest_hash);
|
||||
self.ensure_link_delivery();
|
||||
if let Some(ref mut ld) = self.link_delivery {
|
||||
if let Err(err) = ld.start_delivery(message, dest_hash, hops) {
|
||||
let reason = err.error.to_string();
|
||||
tracing::warn!(
|
||||
error = %reason,
|
||||
dest = %dest_hex,
|
||||
"failed to start oversized direct link delivery"
|
||||
);
|
||||
requeue_after_path_request(
|
||||
&mut self.router,
|
||||
&self.transport_tx,
|
||||
*err.message,
|
||||
dest_hash,
|
||||
&reason,
|
||||
false,
|
||||
);
|
||||
}
|
||||
if let Some(ref mut ld) = self.link_delivery
|
||||
&& let Err(err) = ld.start_delivery(message, dest_hash, hops)
|
||||
{
|
||||
let reason = err.error.to_string();
|
||||
tracing::warn!(
|
||||
error = %reason,
|
||||
dest = %dest_hex,
|
||||
"failed to start oversized direct link delivery"
|
||||
);
|
||||
requeue_after_path_request(
|
||||
&mut self.router,
|
||||
&self.transport_tx,
|
||||
*err.message,
|
||||
dest_hash,
|
||||
&reason,
|
||||
false,
|
||||
);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -4667,11 +4643,11 @@ impl LxmdRunner {
|
||||
let ki_path = ratchet_dir.join("known_identities");
|
||||
let mut data = Vec::with_capacity(self.known_identities.len() * 80);
|
||||
for (hash_hex, pk) in &self.known_identities {
|
||||
if let Ok(hash_bytes) = hex::decode(hash_hex) {
|
||||
if hash_bytes.len() == 16 {
|
||||
data.extend_from_slice(&hash_bytes);
|
||||
data.extend_from_slice(pk);
|
||||
}
|
||||
if let Ok(hash_bytes) = hex::decode(hash_hex)
|
||||
&& hash_bytes.len() == 16
|
||||
{
|
||||
data.extend_from_slice(&hash_bytes);
|
||||
data.extend_from_slice(pk);
|
||||
}
|
||||
}
|
||||
if let Err(e) = rns_identity::persistence::atomic_write(&ki_path, &data) {
|
||||
@@ -4947,10 +4923,10 @@ pub(crate) async fn main() {
|
||||
);
|
||||
for destination in ignored {
|
||||
runner.router.ignore_destination(destination);
|
||||
if let Some(ref node) = runner.propagation_node {
|
||||
if let Ok(mut node) = node.lock() {
|
||||
node.ignore_destination(destination);
|
||||
}
|
||||
if let Some(ref node) = runner.propagation_node
|
||||
&& let Ok(mut node) = node.lock()
|
||||
{
|
||||
node.ignore_destination(destination);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5281,11 +5257,10 @@ pub(crate) async fn main() {
|
||||
direction: LinkResourceDirection::Inbound,
|
||||
..
|
||||
}
|
||||
) {
|
||||
if let Some(event) = delivery_resource_event_from_runtime(event) {
|
||||
)
|
||||
&& let Some(event) = delivery_resource_event_from_runtime(event) {
|
||||
runner.router.handle_inbound_resource_event(event);
|
||||
}
|
||||
}
|
||||
runner.drain_link_packets();
|
||||
}
|
||||
Some((data, link_id)) = runner.prop_link_packet_rx.recv() => {
|
||||
|
||||
@@ -324,17 +324,16 @@ impl DaemonConfig {
|
||||
dc.outbound_propagation_node = Some(trimmed.to_string());
|
||||
}
|
||||
}
|
||||
if get_int(Some(sec), "propagation_stamp_cost_target").is_none() {
|
||||
if let Some(cost) = sec.get_uint("propagation_stamp_cost") {
|
||||
dc.propagation_stamp_cost = cost as u8;
|
||||
}
|
||||
if get_int(Some(sec), "propagation_stamp_cost_target").is_none()
|
||||
&& let Some(cost) = sec.get_uint("propagation_stamp_cost")
|
||||
{
|
||||
dc.propagation_stamp_cost = cost as u8;
|
||||
}
|
||||
if get_float(Some(sec), "propagation_message_max_accepted_size").is_none()
|
||||
&& get_float(Some(sec), "propagation_transfer_max_accepted_size").is_none()
|
||||
&& let Some(limit) = sec.get_uint("propagation_limit")
|
||||
{
|
||||
if let Some(limit) = sec.get_uint("propagation_limit") {
|
||||
dc.propagation_limit_kb = limit as usize;
|
||||
}
|
||||
dc.propagation_limit_kb = limit as usize;
|
||||
}
|
||||
dc.enforce_stamps = sec.get_bool_or("enforce_stamps", false);
|
||||
}
|
||||
@@ -343,14 +342,14 @@ impl DaemonConfig {
|
||||
if !dc.auth_required {
|
||||
dc.auth_required = sec.get_bool_or("auth_required", false);
|
||||
}
|
||||
if dc.control_allowed.is_empty() {
|
||||
if let Some(allowed) = sec.get("allowed") {
|
||||
dc.control_allowed = allowed
|
||||
.split(',')
|
||||
.map(|s| s.trim().to_string())
|
||||
.filter(|s| !s.is_empty())
|
||||
.collect();
|
||||
}
|
||||
if dc.control_allowed.is_empty()
|
||||
&& let Some(allowed) = sec.get("allowed")
|
||||
{
|
||||
dc.control_allowed = allowed
|
||||
.split(',')
|
||||
.map(|s| s.trim().to_string())
|
||||
.filter(|s| !s.is_empty())
|
||||
.collect();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,10 +111,10 @@ pub fn decode_control_response(response: &[u8]) -> ControlResponse {
|
||||
return ControlResponse::Success;
|
||||
};
|
||||
|
||||
if let Some(code) = value.as_u64() {
|
||||
if let Some(error) = peer_error_from_code(code as u8) {
|
||||
return ControlResponse::Error(error);
|
||||
}
|
||||
if let Some(code) = value.as_u64()
|
||||
&& let Some(error) = peer_error_from_code(code as u8)
|
||||
{
|
||||
return ControlResponse::Error(error);
|
||||
}
|
||||
|
||||
if value.is_nil() {
|
||||
|
||||
@@ -11,7 +11,7 @@ from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
EXPECTED_RUST_VERSION = "1.87"
|
||||
EXPECTED_RUST_VERSION = "1.89"
|
||||
SHA_PATTERN = re.compile(r"^[0-9a-f]{40}$")
|
||||
|
||||
|
||||
@@ -94,8 +94,8 @@ def check_workflow_actions() -> None:
|
||||
def check_release_workflow(reticulum_version: str) -> str:
|
||||
workflow = (ROOT / ".github/workflows/release.yml").read_text()
|
||||
|
||||
if not re.search(r"^\s*toolchain:\s*1\.87\.0\s*$", workflow, re.MULTILINE):
|
||||
fail("release workflow does not select Rust 1.87.0")
|
||||
if not re.search(r"^\s*toolchain:\s*1\.89\.0\s*$", workflow, re.MULTILINE):
|
||||
fail("release workflow does not select Rust 1.89.0")
|
||||
if "ref: ${{ env.RELEASE_TAG }}" not in workflow:
|
||||
fail("release workflow does not check out RELEASE_TAG")
|
||||
|
||||
|
||||
Reference in new issue
Block a user