Skip to main content

uor_addr/cbor/
verbs.rs

1//! CBOR realization's ψ-chain content-address derivation verbs (wiki
2//! ADR-024 + ADR-035 + ADR-036), one per admissible σ-axis.
3//!
4//! The verb body is **identical at the term-arena level** to every other
5//! UOR-ADDR realization — the canonical k-invariants branch
6//! (ψ₁ → ψ₇ → ψ₈ → ψ₉). Only the input handle type and the per-axis output
7//! shape vary.
8
9use crate::cbor::value::CborCarrier;
10use crate::label::{
11    AddressLabelBlake3, AddressLabelKeccak256, AddressLabelSha256, AddressLabelSha3_256,
12    AddressLabelSha512,
13};
14
15addr_verbs! {
16    input: CborCarrier<'_>,
17    { shape: AddressLabelSha256, verb: address_inference },
18    { shape: AddressLabelBlake3, verb: address_inference_blake3 },
19    { shape: AddressLabelSha3_256, verb: address_inference_sha3_256 },
20    { shape: AddressLabelKeccak256, verb: address_inference_keccak256 },
21    { shape: AddressLabelSha512, verb: address_inference_sha512 },
22}
23
24#[cfg(test)]
25mod tests {
26    use super::*;
27    use prism::operation::Term;
28
29    #[test]
30    fn verb_term_arena_is_emitted_and_nonempty() {
31        let arena = address_inference_term_arena::<{ crate::ADDR_INLINE_BYTES }>();
32        assert!(!arena.is_empty());
33    }
34
35    #[test]
36    fn verb_arena_contains_no_sigma_residuals() {
37        // ADR-035 ψ-residuals discipline: the σ-axis is consumed by the ψ₉
38        // resolver, never by the verb body's term composition.
39        let arena = address_inference_term_arena::<{ crate::ADDR_INLINE_BYTES }>();
40        assert!(!arena.iter().any(|t| matches!(t, Term::FirstAdmit { .. })));
41        assert!(!arena
42            .iter()
43            .any(|t| matches!(t, Term::AxisInvocation { .. })));
44        assert!(arena.iter().any(|t| matches!(t, Term::Nerve { .. })));
45        assert!(arena.iter().any(|t| matches!(t, Term::KInvariants { .. })));
46    }
47}