Repository navigation
Conversation
…ngine a gateway daemon runs no engine, so it had no way to check a device's DeclareAddress except by building the 103-byte payload itself, the second copy adr 0022 refuses. verify_gateway_address_proof checks the signature over the sealed crate's payload under rfc 8032's strict rules and that the key derives to the claimed address, and returns that address or throws. pinned by the conformance payloads signed with the rfc 8032 keys their addresses derive from, and in python by a live engine's declaration. all five bindings, the c dispatcher and header, the c# and python local api tables and the local api chapter regenerated.
the sdk shipped the device half of the gateway contract three times and no gateway, so the reticulum slot never became available anywhere. gateway/ is the other half, in python: attach with a challenge minted per connection and spent once, the proof checked by the sdk's verify_gateway_address_proof, exactly one verdict per submission, delivery, presence with watches, the verdict-only grace, per-device and per-peer token buckets and the 1 MiB line bound. a backbone seam carries frames and presence between gateways; an in-process backbone joins gateways in tests. two real engines attach with the sdk's own gatewaymanager, pair over mls and talk through one gateway and across two.
two sdk engines pairing over mls and exchanging one message spend 18 to 20 backbone frames each, and the default burst of 8 refused the pairing's own frames with budget_exceeded, which stalled the message on the retry ladder and failed the cross-gateway test about half the time. the scarce burst is now 24, the per-device backbone budget applies only to a scarce backbone, and the end-to-end test runs both classes with default budgets. verdicts and deliveries are traced at debug level, which is how this was found.
each gateway announces one destination under its own reticulum identity, dials a link to every provisioned peer and serves the peer's link to it. frames cross as link requests, which reticulum carries as resources once they outgrow a packet; presence crosses as a snapshot when a link comes up and coalesced changes after. a link from an unprovisioned gateway is torn down and its requests refused. reticulum's threads hop onto the event loop before touching the daemon. two daemon processes joined by a reticulum tcp interface carry a pairing and a message between two real sdk engines. reticulum 1.6 mints a one-time proof-of-work stamp before a destination's first announce, seconds on a laptop and minutes on a small board, so the log says so at start and the test lowers it. the readme covers flashing an rnode, provisioning peers and what to expect over lora; the examples are an eu868 rnode with duty-cycle caps.
a gateway identifies itself on a link right after it comes up, and a peer refuses every request on a link it cannot attribute. one lost identify packet, which lora makes likely, left a link on which every forward was refused for as long as it stayed up. an unanswered snapshot exchange, or a forward refused as not from a provisioned peer, now tears the link down and the dial loop opens one that identifies again.
adr 0040 records why the gateway is python on the reticulum reference, why a backbone verdict waits for the peer gateway rather than reporting a hand-off, and why the scarce burst is sized from a measured first contact. the reticulum chapter said the sdk ships no gateway and told app bridges to pick a reticulum integration strategy; it now says reticulum runs on the gateway, points at gateway/, and keeps the strategies as ways to build another gateway. the changelog, the contract's provisioning section, the adr index and claude.md point at the daemon.
main renamed ProtocolConfig.app_id to app_label (#769) while this branch was open; the two tests that build a config now use the new name.
reticulum's request timeout marks the receipt failed and leaves the resource the request travels as still transferring, so a frame the device had been told failed kept spending airtime, and its retry ran a second transfer beside the first. the request now cancels an unfinished resource on either timeout, its own or reticulum's.
…t undo an attach reticulum runs each request on a thread of its own, and a snapshot large enough to travel as a resource landed after a one-packet update sent later. applied in arrival order, a snapshot taken before a device attached erased the attach and left an offline claim, and every device behind the receiving gateway was told recipient_unreachable for it until the link dropped. each bind and unbind is now a numbered change, every presence entry carries its number, every snapshot carries the number current when it was taken, and the receiving table keeps a claim unless something newer replaces it. a per-process epoch keeps a restarted gateway's numbering, which starts again, from being ignored.
every connection counted against one cap of 256, and the verdict-only grace kept an idle socket alive indefinitely, so anyone on the venue network could open 256 sockets and every device after them was refused. unbound sessions now have their own pool of 32, and a newcomer evicts the oldest unbound session when that pool or the whole table is full; a bound device is never evicted. one host may hold at most 8 sessions.
…ipped radio the backbone budgets were per device, and nothing capped what every device together sent toward one peer, which is the scarce thing on a lora link. the example radio also allowed 1 % airtime (about 27 packets an hour), so a first contact would take hours where the readme said minutes. a byte budget per peer gateway now applies on the way out, shared by every device and checked with the per-device budget before either is charged; the example moves to the eu sub-band that allows 10 %, with a short airtime cap that lets a frame's packets go out together; the readme, the adr and the changelog give the arithmetic for both duty cycles. per-minute rates are refused when negative, and the inbound per-peer burst covers two first contacts.
the dial loop asked for a path or a link to an absent peer every few seconds forever, each one a packet on a duty-cycled link; it now backs off to ten minutes and resets once the link is up. an inbound link that never identifies was refused every request but never closed; it is closed once it has had as long to identify as a link has to come up. the --config help pointed at a file that does not exist.
…me never goes on air reticulum sends one outgoing resource per link and parks the rest in a loop that never checks whether they were cancelled, so cancelling a parked frame sent a cancel packet and then the whole frame anyway, after the device had been told backbone_timeout and while its retry queued behind it. the verdict clock also ran while the frame sat in reticulum's queue. requests on a link now wait their turn in the daemon. one whose time runs out first, or that would reach the radio with under five seconds left, is answered backbone_timeout without ever being handed over, and the one that is handed over is the only transfer on the link, which a cancel stops.
…t presence the dial loop backed off only when a peer had no path or its link did not come up. a peer that took the link and answered nothing, most often one that had not provisioned this gateway yet, was redialled at once after every failed snapshot exchange, half a dozen packets each time, indefinitely. the backoff now grows after a failed exchange and resets only after one that succeeds. a presence update is usually one packet, which reticulum does not retransmit; lost, an attach stayed unknown to the peer for as long as the link lasted. it is now resent with backoff while that link is up. the numbering makes a duplicate harmless.
… a measured first contact the per-device backbone budget counted frames per address, which one device could spend at twice the rate of the shared per-peer budget, holding it at zero for every other device, and which a host could refresh by minting a new address. it is now bytes per source host, validated to stay below the per-peer budget. measured, a first contact is 18 to 20 frames and about 16 kb each way, the largest frame about 4 kb. the backbone frame bound drops from 16 kib, which could not cross the example radio inside the 45 s verdict timeout, to 6 kib; both bursts now hold a first contact, which the old 16 kib egress burst did not; and the example's short airtime cap rises to 50 % so a 6 kb frame crosses in time. the adr, readme and changelog say what each is sized from.
a backbone forward was a task of the session that sent it, so a device that dropped mid-forward cancelled a transfer already partly on air, throwing its airtime away, and then spent it again on the retry from its outbox. the gateway now holds forwards in flight, so they finish; the verdict has nobody to go to, and the duplicate the retry makes is one the core removes.
…error does not end dialling with max_sessions_per_host at or above max_unbound_sessions, one host could fill the unbound pool alone and, by reconnecting, keep evicting every device partway through its attach; validation now refuses it. an unexpected error from reticulum ended a peer's dial task, and with it every attempt to reach that peer, silently; the dial and announce loops now log it and carry on.
the gateway contract says media MUST NOT cross a scarce backbone, and a gateway sees ciphertext only, so size is its one signal. the device chunked media on the reticulum slot at 4 KiB, a leftover from when the slot meant lora, and every chunk (about 4.8 KB on the wire) slipped under the 6 KiB scarce bound: a 20 KB image crossed. the slot is a stream to a daemon over local IP and the device never sizes frames to the backbone (adr 0026), so it is now chunked like the peer stream, at 64 KiB, and every full chunk is refused frame_too_large by a scarce gateway. testing that found the daemon applied the scarce bound on a broad backbone too, refusing anything over 6 KiB there; the bound is now scarce-only. an end-to-end test sends a real image across both classes. the contract, the reticulum chapter and adr 0040 say a single-frame file under the bound cannot be told from a message and crosses.
every request took the per-link lane, including presence updates, which are one packet that reticulum sends at once and never queues. a lost one held the lane for its whole 90 s timeout and every frame queued behind it came back backbone_timeout. a request that packs into one packet, by the same test reticulum applies, now goes straight out; only a request that will become a resource waits its turn.
…ot when it is submitted both byte budgets were charged in _on_send, before the frame queued for its turn on the link. a frame that then waited out its time, found no link, or lost its claim never transmitted, kept its charge, and its retry was charged again; two pairings at once could drain the budgets on frames that never went on air. the gateway now only checks the budgets at submission and hands the backbone an admit callback, which charges them at the moment the frame is put on the backbone and refuses it, unsent, when there is no room.
…eft out once a peer's claims were forgotten (our link to it dropped), the next snapshot held no record of an address that had left meanwhile, so a resend of that address's old attach, still in flight on the peer's own link, was accepted as a fresh online claim and kept forwards going to a device that was gone. each peer now has a floor at its newest snapshot, and nothing older may create a claim the table does not hold. a snapshot's own entries are exempt, so one that lists a long-attached device still restores it.
…s the backbone was checked against the per-host session cap and backbone budget were keyed by the exact address, and a device on ipv6 may hold as many addresses in its prefix as it likes, so it could be as many hosts as it cared to be. ipv6 hosts are now keyed by their /64, and an ipv4-mapped address by its ipv4. the backbone relies on reticulum 1.6 internals: how a resource parked on a busy link behaves, the resource on a request's receipt, and when a request's response clock starts. rns is now pinned to 1.6.x, and the daemon warns at start when another version is installed.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
reticulumtransport's device half has spoken the gateway contract since 0.25, but nothing in the SDK answered it, so the transport never became available and every mention of LoRa described a path nobody could run. This adds the other half: a reference gateway daemon ingateway/, with a Reticulum backbone between gateways, which is how an RNode's LoRa radio reaches the SDK. No device-side change is needed: enablereticulumand point its daemon address at the gateway.Decisions are recorded in ADR 0040 (Proposed).
What changes
verify_gateway_address_proof(UDL namespace function,offline-protocol-mls::gateway_proof): the gateway half ofgateway_address_declaration. It checks the signature over the sealed crate's payload under RFC 8032's strict rules, and that the key derives to the claimed address. A daemon runs no engine, so without this it would have to build the 103-byte payload itself, the second copy ADR 0022 refuses. All five bindings, the C dispatcher and header, the C# and Python local-API tables and the local-API chapter are regenerated.gateway/, the reference daemon in Python:storednorpushed.gateway/offline_gateway/reticulum.py):backbone_timeoutwithout reaching the radio, and one that times out on air is cancelled. One-packet requests (presence) skip the queue.reticulumslot is chunked at 64 KiB (the peer-stream size) instead of 4 KiB. The slot is a stream to a daemon over local IP, and the device never sizes frames to the backbone (ADR 0026). At 4 KiB every chunk slipped under a scarce gateway's frame bound, so a 20 KB image crossed a LoRa backbone, which the contract says it MUST NOT. Now a scarce gateway refuses every full chunkframe_too_large, and a broad one carries the transfer in fewer frames. A file small enough to be one frame under the bound cannot be told from a message and crosses; the contract now says so.docs/reticulum.md(it said the SDK ships no gateway, and told app bridges to pick a Reticulum integration strategy); the contract's provisioning section; the changelog; CLAUDE.md.Findings from building it
identifypacket would leave a link on which every request is refused. An unanswered snapshot exchange, or a forward refused as not from a peer, now tears the link down for a redial.Test plan
cargo clippy --workspace -- -D warnings,cargo test --workspace --lib(3,794 passed),cargo fmt --all -- --check--check(C dispatcher, C header, Python local-API table,check-binding-generators.sh)bindings/python: full suite, 1,186 passed, 4 skipped, including a live engine's declaration verified across the FFIgateway/: 84 tests. These cover:Open question
rnsis distributed under the Reticulum License: MIT-style terms plus two field-of-use restrictions (not in systems that can purposefully harm people; not in building AI training datasets). Its README also states the author's view that machine-generated code derived from the RNS source or documentation is a void grant.gateway/depends onrnsas an optional extra (not vendored) and calls only its public API. Whether that dependency, and these terms, are acceptable alongside the repository's AGPL-3.0 and commercial licences needs a decision before this leaves draft, and the answer may belong in THIRD-PARTY-NOTICES.Not in this PR
gateway/(a workflow change, left for a separate review)daemonAddresson:, so an IPv6 literal breaks them (documented ingateway/README.md)