soft3/bbg/rs/src/signal.rs

// ---
// tags: bbg, rust
// crystal-type: source
// crystal-domain: cyber
// ---
//! Signal and cyberlink types โ€” the single input to BBG state.

use crate::types::{Particle, NeuronId};

/// A cyberlink: the five-field atomic unit of knowledge.
/// โ„“ = (p, q, ฯ„, a, v)
pub struct Cyberlink {
    /// source particle
    pub from: Particle,
    /// target particle
    pub to: Particle,
    /// token denomination
    pub token: Particle,
    /// conviction amount (focus consumed)
    pub amount: u64,
    /// epistemic valence: -1, 0, or +1
    pub valence: i8,
}

/// A box movement: spend a conviction box and optionally create a new one.
pub struct BoxMove {
    /// nullifier of the spent box
    pub nullifier: Particle,
    /// new commitment point (if creating an output)
    pub commitment: Option<(Particle, u64)>,
}

/// A signal: the atomic broadcast unit from a neuron.
/// s = (ฮฝ, โ„“โƒ—, ฮ”ฯ†*, ฯƒ, t)
///
/// cybergraph validates ฯƒ and all semantic constraints before calling bbg.insert.
/// BBG only checks the structural double-spend invariant.
pub struct Signal {
    /// signing neuron
    pub neuron: NeuronId,
    /// one or more cyberlinks
    pub links: Vec<Cyberlink>,
    /// box movements (conviction spends and outputs)
    pub box_moves: Vec<BoxMove>,
    /// block height
    pub height: u64,
}

/// Error returned by bbg.insert โ€” structural check only.
#[derive(Debug, PartialEq)]
pub enum InsertError {
    /// N(nullifier) = 0: this UTXO was already spent.
    DoubleSpend,
}

Homonyms

neural/rs/darwin-sys/src/signal.rs
neural/rs/darwin-sys/src/ffi/signal.rs

Graph