Skip to main content

Crate proof_stream

Crate proof_stream 

Source
Expand description

proof-stream — real-time 3D streaming visualization of stwo-ml ZK proof sessions.

§Overview

This crate intercepts events emitted during stwo-ml proving (GKR walk, sumcheck rounds, GPU utilization, layer activations) and streams them to a Rerun viewer in real time via a background thread.

§Quick start

# With the `rerun` feature enabled:
cargo run --bin prove-model --features proof-stream-rerun -- \
  --model-dir ./tiny-model --rerun spawn

§Feature flags

  • rerun — enables the RerunSink and its background thread. Without this flag the crate compiles with zero Rerun dependency.

§Architecture

  1. stwo-ml installs a ProofSink via set_proof_sink() (thread-local, RAII).
  2. The prover calls emit_proof_event!(|| ...) at hot points; the closure is never evaluated when no sink is active.
  3. Active sinks (e.g. RerunSink) forward events through a bounded crossbeam channel (8 192 slots, try_send — never blocks).
  4. A background thread drains the channel and calls the Rerun SDK.

Re-exports§

pub use events::ActivationStats;
pub use events::CircuitNodeMeta;
pub use events::GpuSnapshot;
pub use events::LayerKind;
pub use events::LayerProofKind;
pub use events::LogLevel;
pub use events::ProofEvent;
pub use events::RoundPolyDeg3Viz;
pub use events::RoundPolyViz;
pub use events::SecureFieldMirror;
pub use sink::ChannelSink;
pub use sink::CollectingSink;
pub use sink::NullSink;
pub use sink::ProofEventSink;
pub use sink::ProofSink;

Modules§

blueprint
Blueprint sender for the proof-stream visualization.
events
ProofEvent — the central event type streamed from stwo-ml proving sessions.
rerun_sink
RerunSink — streams proof events to a Rerun viewer via a background thread.
sink
ProofEventSink trait + ProofSink wrapper.
viz
Visualization helper sub-modules.