From 5502c5a8a88b11175c441b8730f3594fe2aad954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Klaehn?= Date: Tue, 30 Apr 2024 16:17:07 +0300 Subject: [PATCH] feat(iroh-base): allow the addr info of tickets to be empty (#2254) ## Description feat(iroh-base): allow the addr info of tickets to be empty Without this, a ticket that does not contain any addresses or relay URL can not be parsed. But we need to allow this if we want to use short tickets. ## Breaking Changes ## Notes & open questions Note: I did not remove the error type Validation. That way we don't have breaking changes, and we might need it again in the future. ## Change checklist - [x] Self-review. - [x] Documentation updates if relevant. - [x] Tests if relevant. - [x] All breaking changes documented. --- iroh-base/src/ticket/blob.rs | 3 --- iroh-base/src/ticket/node.rs | 3 --- 2 files changed, 6 deletions(-) diff --git a/iroh-base/src/ticket/blob.rs b/iroh-base/src/ticket/blob.rs index 02529ac9a5..2f45e1853c 100644 --- a/iroh-base/src/ticket/blob.rs +++ b/iroh-base/src/ticket/blob.rs @@ -45,9 +45,6 @@ impl Ticket for BlobTicket { fn from_bytes(bytes: &[u8]) -> std::result::Result { let res: TicketWireFormat = postcard::from_bytes(bytes).map_err(ticket::Error::Postcard)?; let TicketWireFormat::Variant0(res) = res; - if res.node.info.is_empty() { - return Err(ticket::Error::Verify("addressing info cannot be empty")); - } Ok(res) } } diff --git a/iroh-base/src/ticket/node.rs b/iroh-base/src/ticket/node.rs index 6a0e88421d..a4e8505c68 100644 --- a/iroh-base/src/ticket/node.rs +++ b/iroh-base/src/ticket/node.rs @@ -36,9 +36,6 @@ impl Ticket for NodeTicket { fn from_bytes(bytes: &[u8]) -> std::result::Result { let res: TicketWireFormat = postcard::from_bytes(bytes).map_err(ticket::Error::Postcard)?; let TicketWireFormat::Variant0(res) = res; - if res.node.info.is_empty() { - return Err(ticket::Error::Verify("addressing info cannot be empty")); - } Ok(res) } }