risc0_povw/lib.rs
1// Copyright 2026 RISC Zero, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Proof of Verifiable Work (PoVW) implementation.
16//!
17//! This crate provides Merkle tree-based data structures for tracking and proving work
18//! completed during ZK proof generation. The main components include:
19//!
20//! - [`WorkSet`]: Top-level container for multiple work logs
21//! - [`WorkLog`]: Collection of jobs within a single prover's work log
22//! - [`Job`]: Representation of a range of used nonces in a job (i.e. a single continuation)
23//! - [`Bitmap`]: 256-bit bitmap for efficient nonce tracking
24//!
25//! The implementation uses Merkle trees to enable efficient proofs of inclusion and
26//! non-inclusion for nonces, supporting the PoVW system's requirement to prevent
27//! double-counting of work.
28
29#![deny(rustdoc::broken_intra_doc_links)]
30#![deny(missing_docs)]
31#![cfg_attr(docsrs, feature(doc_cfg))]
32
33mod consts;
34mod error;
35/// Log Builder guest program types, for verifying PoVW log updates.
36#[cfg(feature = "guest")]
37pub mod guest;
38/// Prover functionality, for running the work log builder.
39#[cfg(feature = "prover")]
40pub mod prover;
41mod tree;
42
43pub use error::Error;
44pub use tree::{
45 Bitmap, Job, Merkleized, MerkleizedIndex, Opening, SubtreeOpening, WorkLog, WorkSet,
46};
47
48// Re-export key types from risc0_binfmt
49pub use risc0_binfmt::{PovwJobId, PovwLogId, PovwNonce};