Skip to main content

molpha_verifier/
lib.rs

1//! Molpha DataUpdate aggregate-Schnorr verification.
2//!
3//! A framework-agnostic library (no Anchor / Pinocchio dependency): the downstream program owns the
4//! registry account types and reads them, then passes plain data in. Verify a Molpha [`DataUpdate`]
5//! either from already-resolved signer pubkeys ([`verify_data_update`]) or from parsed registry
6//! entries plus a [`RegistryView`] ([`verify_data_update_resolved`]).
7//!
8//! # Usage
9//! ```ignore
10//! use molpha_verifier::{verify_data_update, DataUpdate};
11//!
12//! // `ordered_signers` are the signing nodes' (x, y) pubkeys in ascending signers_bitmap bit order.
13//! verify_data_update(&payload, node_count, redundancy_buffer, &ordered_signers)?;
14//! ```
15
16pub mod bitmap;
17pub mod coalition;
18pub mod error;
19pub mod message;
20pub mod onchain;
21pub mod payload;
22pub mod scalar;
23pub mod selection;
24pub mod state;
25pub mod verify;
26
27pub use error::DataUpdateError;
28pub use onchain::*;
29pub use payload::DataUpdate;
30pub use state::*;
31
32// High-level verification API.
33pub use verify::{
34    reconstruct_coalition_key, reconstruct_coalition_key_compressed, verify_aggregate_over_hash,
35    verify_data_update, verify_data_update_compressed, SignerXy,
36};
37
38// Primitives commonly composed by on-chain callers.
39pub use bitmap::{
40    bitmap_is_subset_u256, bitmap_load, derive_group_bitmap, effective_selection_size,
41    for_each_set_bit_u256,
42};
43pub use coalition::CoalitionAccumulator;
44pub use message::{compute_message_hash, MESSAGE_PREFIX};
45pub use scalar::{
46    eth_address_from_uncompressed_pubkey, evm_schnorr_ecdsa_inputs,
47    secp256k1_scalar_is_valid_nonzero,
48};
49pub use selection::{derive_selection_bitmap, SELECTION_SEED_PREFIX};