newton-aggregator 0.4.18

newton prover aggregator utils
//! State-commit aggregation pipeline.
//!
//! Lockstep 120s BLS-aggregated `commitStateRoot` submission per chain. The
//! orchestrator runs as a background task spawned by [`crate::Aggregator`],
//! reading `(currentSequenceNo, currentStateRoot, lastTimestamp)` fresh from
//! `StateCommitRegistry` each tick and rebuilding the proposal from scratch.
//!
//! See `docs/STATE_TREE_ARCHITECTURE.md` and `docs/PRIVATE_DATA_STORAGE.md`
//! §6 (Commit Protocol) for the protocol-level specification.
//!
//! ## Track 1 scope (NEWT-1115)
//!
//! - `Pcr0Provider` trait + `StubPcr0Provider` (dev-only) live in
//!   [`newton_core::pcr0_provider`] so both this crate and the
//!   operator can consume the trait without an `operator → aggregator`
//!   crate cross-edge. Re-exported here for ergonomic call sites.
//! - [`error`] — `StateCommitError` mirroring all typed `IStateRootCommittable`
//!   reverts plus `is_poison()` classification per
//!   `.claude/rules/lessons.md` "State-commit registry reverts classify as
//!   poison." `from_chainio()` translates `ChainIoError` → `StateCommitError`.
//! - [`registry_view`] — `RegistryView` value snapshot and `RegistryReader`
//!   trait. `OnchainRegistryReader<P, N>` is the production impl.
//! - [`proposal`] — `build_state_commit()` constructs a `StateCommit` from a
//!   fresh registry view and applies the same off-chain pre-submit guards the
//!   registry enforces on-chain.
//! - [`aggregator`] — `StateCommitAggregator` collects BLS G2 partial sigs,
//!   checks quorum, and returns an ABI-encoded `BN254Certificate`.
//! - [`operator_client`] — `StateCommitOperatorClient` trait (Prepare/Commit
//!   two-phase RPC surface).
//! - [`operator_client_http`] — `HttpStateCommitOperatorClient` production
//!   JSON-RPC implementation over `reqwest`, sharing wire schemas with the
//!   operator handler via [`newton_core::rpc::state_commit`].
//! - [`orchestrator`] — `StateCommitOrchestrator` drives the 120s tick loop.
//!   Wired into `Aggregator::start()` via `tokio::spawn` in task #131.

pub mod aggregator;
pub mod error;
pub mod operator_client;
pub mod operator_client_http;
pub mod operator_set_reader;
pub mod operator_table;
pub mod operator_table_witness;
pub mod orchestrator;
pub mod proposal;
pub mod registry_view;

pub use aggregator::{AggregateRequest, OperatorRecord, StateCommitAggregator};
pub use error::{from_chainio, StateCommitError};
pub use newton_core::pcr0_provider::{Pcr0Error, Pcr0Provider};
pub use operator_client::{OperatorClientError, OperatorProposal, StateCommitOperatorClient};
pub use operator_client_http::HttpStateCommitOperatorClient;
pub use operator_set_reader::{OperatorSetSnapshot, OperatorSetSnapshotReader};
pub use orchestrator::{AvsWriterCommitter, StateCommitOrchestrator, StateCommitWriter};
pub use proposal::{build_state_commit, STATE_COMMIT_V1};
pub use registry_view::{OnchainRegistryReader, RegistryReader, RegistryView};

#[cfg(any(test, feature = "dev-stub"))]
pub use newton_core::pcr0_provider::StubPcr0Provider;
#[cfg(any(test, feature = "dev-stub"))]
pub use operator_set_reader::StubOperatorSetSnapshotReader;