Skip to main content

uor_addr/composition/e8/
verbs.rs

1//! CS-E8 ψ-chain content-address derivation verbs, one per σ-axis.
2
3#![cfg(feature = "alloc")]
4
5use crate::composition::e8::value::E8Carrier;
6use crate::label::{
7    CompositionLabelE8Blake3, CompositionLabelE8Keccak256, CompositionLabelE8Sha256,
8    CompositionLabelE8Sha3_256, CompositionLabelE8Sha512,
9};
10
11addr_verbs! {
12    input: E8Carrier<'_>,
13    { shape: CompositionLabelE8Sha256, verb: compose_e8_inference },
14    { shape: CompositionLabelE8Blake3, verb: compose_e8_inference_blake3 },
15    { shape: CompositionLabelE8Sha3_256, verb: compose_e8_inference_sha3_256 },
16    { shape: CompositionLabelE8Keccak256, verb: compose_e8_inference_keccak256 },
17    { shape: CompositionLabelE8Sha512, verb: compose_e8_inference_sha512 },
18}
19
20#[cfg(test)]
21mod tests {
22    use super::*;
23    use prism::operation::Term;
24
25    #[test]
26    fn verb_term_arena_is_emitted_and_nonempty() {
27        let arena = compose_e8_inference_term_arena::<{ crate::ADDR_INLINE_BYTES }>();
28        assert!(!arena.is_empty());
29    }
30
31    #[test]
32    fn verb_arena_contains_no_sigma_residuals() {
33        let arena = compose_e8_inference_term_arena::<{ crate::ADDR_INLINE_BYTES }>();
34        assert!(!arena.iter().any(|t| matches!(t, Term::FirstAdmit { .. })));
35        assert!(!arena
36            .iter()
37            .any(|t| matches!(t, Term::AxisInvocation { .. })));
38        assert!(arena.iter().any(|t| matches!(t, Term::Nerve { .. })));
39        assert!(arena.iter().any(|t| matches!(t, Term::KInvariants { .. })));
40    }
41}