Skip to main content

newton_prover_core/
lib.rs

1//! This crate provides the functionality for the NEWTON Prover.
2//!
3//! This includes:
4//! - Rego policy types and evaluation (always available, zkVM-compatible)
5//! - Auto-generated Solidity contract bindings (only on non-RISC-V targets)
6//! - Core AVS functionality (entity, IO, keys, utils, ZK)
7
8/// ZK module (requires proving feature, not available in zkVM)
9#[cfg(all(feature = "proving", not(feature = "zkvm")))]
10pub mod zk;
11
12/// Utils module (requires rpc for full functionality, not available in zkVM)
13#[cfg(not(feature = "zkvm"))]
14pub mod common;
15
16/// Config module (requires config feature, not available in zkVM)
17#[cfg(all(feature = "config", not(feature = "zkvm")))]
18pub mod config;
19
20/// IPFS caching module (requires ipfs-cache feature)
21#[cfg(feature = "ipfs-cache")]
22pub mod ipfs;
23
24/// Key management module (requires signing feature for full functionality, not available in zkVM)
25#[cfg(not(feature = "zkvm"))]
26pub mod keys;
27
28/// IO module for chain operations and serialization
29#[cfg(not(feature = "zkvm"))]
30pub mod io;
31
32/// Rego policy evaluation module (zkVM-compatible)
33pub mod rego;
34
35/// Database module (requires database feature)
36#[cfg(feature = "database")]
37pub mod database;
38
39/// Privacy-preserving cryptography module (HPKE, Ed25519, SecureEnvelope)
40#[cfg(feature = "privacy")]
41pub mod crypto;
42
43/// Error types module
44pub mod error;
45
46/// Merkle tree module for ELIP-008 operator info verification
47#[cfg(not(feature = "zkvm"))]
48pub mod merkle;
49
50/// Version compatibility module
51#[cfg(not(feature = "zkvm"))]
52pub mod version;
53
54// Bindings are only available on non-RISC-V targets (they require networking)
55#[cfg(not(target_arch = "riscv32"))]
56mod generated;
57
58// Re-export all bindings modules at the top level for API compatibility
59#[cfg(not(target_arch = "riscv32"))]
60pub use generated::{
61    attestation_validator, bn254_certificate_verifier, bn254_table_calculator, challenge_verifier,
62    ecdsa_operator_table_updater, eip712_upgradeable, identity_registry, mock_newton_policy_client,
63    newton_cross_chain_registry, newton_message, newton_policy, newton_policy_client, newton_policy_data,
64    newton_policy_data_factory, newton_policy_factory, newton_prover_dest_task_manager, newton_prover_service_manager,
65    newton_prover_task_manager, operator_registry, operator_table_updater, policy_client_registry, rego_verifier,
66};
67
68pub use rego::evaluate;
69
70/// Task ID
71pub type TaskId = alloy::primitives::B256;
72
73/// Policy ID
74pub type PolicyId = alloy::primitives::B256;
75
76// bn254 certificate digest type for destination chain signature verification
77alloy::sol! {
78    struct BN254Certificate {
79        uint32 referenceTimestamp;
80        bytes32 messageHash;
81    }
82}