Sigil documentation
ReferenceRust referencesigil-anomaly

sigil-anomaly · ruleset

Source declarations, signatures and documentation for ruleset.

Source: sigil/node/sigil-anomaly/src/ruleset.rs. SHA-256: fa019fddbfd44767453ee8fded3e8a51197384d4b6f2b8da601b7ed77f845ac4.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

ruleset::RuleSet

A registered set of anomaly rules.

Cheap to clone (internally Arc-wrapped); safe to share across threads. New rules cannot be added once the set is sealed for an epoch — register returns an error after seal() has been called.

#[derive(Default, Clone)]
pub struct RuleSet {

}

Source line: 32.

ruleset::RuleSetProvenance

Content-addressed provenance for a sealed rule set.

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct RuleSetProvenance {

}

Source line: 38.

ruleset::RuleSetProvenance::content_addressed

pub fn content_addressed(source: impl Into<String>, digest_hex: String) -> Result<Self>;

Source line: 51.

ruleset::RuleSetProvenance::digest_hex

pub fn digest_hex(&self) -> &str;

Source line: 63.

ruleset::RuleSetProvenance::source

pub fn source(&self) -> &str;

Source line: 67.

ruleset::RuleSet::new

pub fn new() -> Self;

Source line: 73.

ruleset::RuleSet::with_provenance

pub fn with_provenance(provenance: RuleSetProvenance) -> Self;

Source line: 77.

ruleset::RuleSet::register

Register a rule. Rejects duplicate ids and rejects registration after seal().

pub fn register(&self, rule: Arc<dyn AnomalyRule>) -> Result<()>;

Source line: 85.

ruleset::RuleSet::seal

Seal the rule set. After sealing, no further rules can be added. The validator-agent runtime should seal at epoch start.

pub fn seal(&self);

Source line: 103.

ruleset::RuleSet::set_provenance

Attach content-addressed provenance before sealing.

pub fn set_provenance(&self, provenance: RuleSetProvenance) -> Result<()>;

Source line: 108.

ruleset::RuleSet::provenance

pub fn provenance(&self) -> Option<RuleSetProvenance>;

Source line: 119.

ruleset::RuleSet::len

Number of registered rules.

pub fn len(&self) -> usize;

Source line: 124.

ruleset::RuleSet::is_empty

pub fn is_empty(&self) -> bool;

Source line: 128.

ruleset::RuleSet::evaluate

Evaluate all registered rules against a transaction.

Rules execute in deterministic order (sorted by RuleId). A rule that returns an error is logged via tracing and converted into a critical invariant flag; other rules continue. A poisoned or buggy rule cannot silently suppress anomaly reporting.

If view.contains_all(rule.metadata().required_snapshot_keys) returns false, the rule is skipped with a MissingSnapshotKey log line.

pub fn evaluate(&self, tx_bytes: &[u8], tx_hash: &[u8; 32], view: &SnapshotView) -> Vec<Flag>;

Source line: 142.

On this page