IC Relay
A Rust library for durable, ordered delivery between two fixed Internet Computer canisters. Each endpoint retains one outbound and one inbound frame, each up to 4 KiB. An occupied slot applies backpressure.
Open a channel with an exclusive named allocation lease from the host’s admitted ic-storage runtime and the remote ic-platform-types principal. Call enqueue, then send a clone of outbound() to that peer. The receiving update passes the system-authenticated caller and decoded frame to accept. Return its successful sequence to the sender, which calls acknowledge on the channel for the responding peer. On rejection, timeout, or backpressure, retry the retained frame. Duplicate frames acknowledge the same sequence without occupying a second slot. Acknowledge means durably received. Apply each consume() result within the same synchronous canister update, before any await.
The host owns its IC Wire endpoints, ingress size limits, authorization of local producers, scheduling and peer calls. Use one live channel handle per dedicated memory and reopen it on upgrade. Both peers must start fresh together and preserve their sequence history. Reinstalling one side independently can lose or suppress deliveries. Legacy stable images require separate migration.
Development targets Ubuntu 24.04 and macOS 15 (Apple Silicon and Intel). Use Rust 1.100.0 with the wasm32-unknown-unknown target. Run cargo fetch --locked once, then make check for snapshot verification, formatting, Clippy, Rustdoc, native tests and the Wasm build. The integration test simulates two endpoints over stable memory and reopens both after a lost acknowledgement.
Two-canister demo
The qualification/canic.toml fleet declares two permanent services, counter_a and counter_b, built from the same package. Each installation receives its own service name and an explicitly approved workload driver. It can report ready before the other service exists. A channel operation resolves the opposite name from the local Canic directory. Before publication the caller can retry later. Relay retains the resolved peer and delivery sequences across upgrades.
From this repository, generate the two Canic service frames for the same driver. Supply each file to its corresponding ordinary Store-backed child plan with --install-args. Root remains controller of both children. The driver alone can queue, deliver or consume the demo increments.
With Root and Store already installed and the same counter Wasm published under each slot name, create each child plan against its retained publication. In this example the operator has set ROOT_HASH, COUNTER_A_PUBLICATION and IDENTITY for that local fleet. Review and apply the operation printed by the first command before planning the second service. If interrupted, resume the same approved operation.
Repeat with --canister counter_b, the completed publication for counter_b, and /tmp/counter_b.install.
The PocketIC test installs A before B exists and verifies that A refuses a queue operation until publication. The test supplies directory deliveries as the installing canister, exercises the lost acknowledgement, upgrades both services and retries the retained frame. Run it with the prepared simulator:
POCKET_IC_BIN=/absolute/path/to/pocket-ic