mirror of
https://github.com/vacp2p/zerokit.git
synced 2026-01-07 21:04:02 -05:00
# Changes - Unified the `RLN` struct and core protocol types across public, FFI, and WASM so everything works consistently. - Fully refactored `protocol.rs` and `public.rs` to clean up the API surface and make the flow easier to work with. - Added (de)serialization for `RLN_Proof` and `RLN_ProofValues`, and matched all C, Nim, WASM, and Node.js examples. - Aligned FFI and WASM behavior, added missing APIs, and standardized how witness are created and passed around. - Reworked the error types, added clearer verification messages, and simplified the overall error structure. - Updated variable names, README, Rust docs, and examples across the repo, updated outdated RLN RFC link. - Refactored `rln-cli` to use the new public API, removed serialize-based cli example, and dropped the `eyre` crate. - Bumped dependencies, fixed CI, fixed `+atomic` flags for latest nightly Rust and added `Clippy.toml` for better fmt. - Added a `prelude.rs` file for easier use, cleaned up public access for types and types import across zerokit modules. - Separated keygen, proof handling, slashing logic, and witness into protocol folder.
41 lines
2.0 KiB
Rust
41 lines
2.0 KiB
Rust
// This module re-exports the most commonly used types and functions from the RLN library
|
|
|
|
#[cfg(not(feature = "stateless"))]
|
|
pub use utils::{Hasher, ZerokitMerkleProof, ZerokitMerkleTree};
|
|
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
pub use crate::circuit::{graph_from_folder, zkey_from_folder};
|
|
#[cfg(not(feature = "stateless"))]
|
|
pub use crate::pm_tree_adapter::{FrOf, PmTree, PmTreeProof, PmtreeConfig, PmtreeConfigBuilder};
|
|
#[cfg(not(feature = "stateless"))]
|
|
pub use crate::poseidon_tree::{MerkleProof, PoseidonTree};
|
|
#[cfg(not(feature = "stateless"))]
|
|
pub use crate::protocol::compute_tree_root;
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
pub use crate::protocol::{generate_zk_proof, verify_zk_proof};
|
|
pub use crate::{
|
|
circuit::{
|
|
zkey_from_raw, Curve, Fq, Fq2, Fr, G1Affine, G1Projective, G2Affine, G2Projective, Proof,
|
|
VerifyingKey, Zkey, COMPRESS_PROOF_SIZE, DEFAULT_TREE_DEPTH,
|
|
},
|
|
error::{ProtocolError, RLNError, UtilsError, VerifyError},
|
|
hashers::{hash_to_field_be, hash_to_field_le, poseidon_hash, PoseidonHash},
|
|
protocol::{
|
|
bytes_be_to_rln_proof, bytes_be_to_rln_proof_values, bytes_be_to_rln_witness,
|
|
bytes_le_to_rln_proof, bytes_le_to_rln_proof_values, bytes_le_to_rln_witness,
|
|
extended_keygen, extended_seeded_keygen, generate_zk_proof_with_witness, keygen,
|
|
proof_values_from_witness, recover_id_secret, rln_proof_to_bytes_be, rln_proof_to_bytes_le,
|
|
rln_proof_values_to_bytes_be, rln_proof_values_to_bytes_le, rln_witness_to_bigint_json,
|
|
rln_witness_to_bytes_be, rln_witness_to_bytes_le, seeded_keygen, RLNProof, RLNProofValues,
|
|
RLNWitnessInput,
|
|
},
|
|
public::RLN,
|
|
utils::{
|
|
bytes_be_to_fr, bytes_be_to_vec_fr, bytes_be_to_vec_u8, bytes_be_to_vec_usize,
|
|
bytes_le_to_fr, bytes_le_to_vec_fr, bytes_le_to_vec_u8, bytes_le_to_vec_usize,
|
|
fr_to_bytes_be, fr_to_bytes_le, normalize_usize_be, normalize_usize_le, str_to_fr,
|
|
to_bigint, vec_fr_to_bytes_be, vec_fr_to_bytes_le, vec_u8_to_bytes_be, vec_u8_to_bytes_le,
|
|
IdSecret, FR_BYTE_SIZE,
|
|
},
|
|
};
|