Files
status-rln-prover/prover/src/proof_generation.rs
Sydhds 7525c8c226 Add ProofGenerationData structure (#3)
* Add ProofGenerationData structure
* Use shared merkle tree
* Add unit tests for proof service
2025-06-05 10:03:31 +02:00

44 lines
1.1 KiB
Rust

use std::sync::Arc;
// third-party
use alloy::primitives::Address;
// internal
use rln_proof::{RlnIdentifier, RlnUserIdentity};
#[derive(Debug, Clone)]
pub(crate) struct ProofGenerationData {
pub(crate) user_identity: RlnUserIdentity,
pub(crate) rln_identifier: Arc<RlnIdentifier>,
pub(crate) tx_counter: u64,
pub(crate) tx_sender: Address,
pub(crate) tx_hash: Vec<u8>,
}
impl From<(RlnUserIdentity, Arc<RlnIdentifier>, u64, Address, Vec<u8>)> for ProofGenerationData {
/// Create a new ProofGenerationData - assume tx_hash is 32 bytes long
fn from(
(user_identity, rln_identifier, tx_counter, tx_sender, tx_hash): (
RlnUserIdentity,
Arc<RlnIdentifier>,
u64,
Address,
Vec<u8>,
),
) -> Self {
debug_assert!(tx_hash.len() == 32);
Self {
user_identity,
rln_identifier,
tx_counter,
tx_sender,
tx_hash,
}
}
}
#[derive(Debug, Clone)]
pub(crate) struct ProofSendingData {
pub(crate) tx_hash: Vec<u8>,
pub(crate) tx_sender: Address,
pub(crate) proof: Vec<u8>,
}