Skip to main content

Module derive_wire_deadlines

Module derive_wire_deadlines 

Source
Expand description

Stamps each wire.Send’s static deadline from the (per_hop_budget_ns × chain_depth) formula, defaulting to chain_depth = 1 when no chain_depth on every target-boundary wire.Send. For each such Send, computes the static deadline as chain_depth * per_hop_budget_ns and stamps it as a deadline_ns: i64 attribute on the NodeProto. The existing super::insert_async_deadlines pass then inserts a DeadlineCheck gate upstream so the deadline is enforced at runtime.

The per-hop budget comes from the crate::Compiler’s per_hop_budget_ns field (default bb_ir::syscall_ids::DEFAULT_PER_HOP_BUDGET_NS). Build-time CI matrices that produce deployment bundles with different latency assumptions can override via Compiler::with_per_hop_budget_ns(ns).

Runtime override note: the runtime side ([crate::node::config::NodeConfig::per_hop_budget_ns]) is the source of truth at delivery time. When chain_depth metadata survives on the NodeProto, the engine can replace the static deadline with chain_depth * NodeConfig.per_hop_budget_ns at dispatch time. The compiler pass exists so single-Node deployments + tests get a sane baseline deadline without requiring runtime fixup; multi-Node deployments with bespoke latency profiles rely on the runtime override.

Functions§

derive_wire_deadlines
Walk every wire.Send NodeProto with chain_depth metadata and stamp a deadline_ns: i64 attribute. Idempotent - re-runs overwrite the previous attribute in place.