Skip to main content

Module coverage

Module coverage 

Source
Expand description

Zero-cost-when-disabled IR execution coverage collector.

Indexes every circuit, conditional branch (Statement::If / Expression::If), assertion (Expression::Assert), ledger ADT operation (Expression::AdtOp), and contract event emission (Expression::Emit) inside a MoonIr into dense u32 site tables keyed by the stable address of each IR node.

Because IrExecutable owns its MoonIr inside an Arc, node addresses stay fixed for the executable’s lifetime and require zero unsafe code (std::ptr::from_ref(node) as usize). When coverage is disabled, the interpreter holds coverage: None and skips all tracking with a single branch check.

Structs§

AssertCoverage
Hit counts for one assert site (both passing and reverting executions).
BranchCoverage
Hit counts for one conditional branch (then and else/fallthrough arms).
CircuitIrCoverage
Deep IR coverage counters for a single circuit (exported or internal).
EmitCoverage
Hit count for one contract event emit site.
IrCoverageCollector
Live mutable hit counters accumulated during one or more circuit executions.
IrCoverageMap
Pre-indexed map of coverable IR sites for a single MoonIr.
IrCoverageSnapshot
Serializable deep IR coverage snapshot for one contract.
IrCoverageTotals
Rolled-up numeric totals across one or more IrCoverageSnapshots.
LedgerOpCoverage
Hit count for one ledger ADT operation site.

Enums§

BranchKind
Whether a conditional branch came from a statement or expression if.