Skip to main content

validate_explicit_origin_required

Function validate_explicit_origin_required 

Source
pub fn validate_explicit_origin_required(d: &Descriptor) -> Result<(), Error>
Expand description

Validate that every @N in a non-canonical wrapper has an explicit origin path on the wire — either via OriginPathOverrides[idx] or via a non-empty entry in the path_decl (shared or divergent).

Per spec v0.13 §6.3: when canonical_origin(&d.tree) is None, the wrapper is “non-canonical” and the encoder must emit an explicit origin for every @N. The decoder enforces the same as defense in depth: failure → Error::MissingExplicitOrigin { idx }.

If canonical_origin(&d.tree) is Some(_), this validator is a no-op — any origin spec (elided or explicit) is allowed.