organize files & dirs (mostly backend structure) (#158)

This commit is contained in:
arnaucube 2025-03-24 12:34:45 +01:00 committed by GitHub
parent b93187c9bb
commit 3b2860beeb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 37 additions and 37 deletions

View file

@ -1,7 +1,7 @@
//! Common functionality to build Pod circuits with plonky2
use crate::backends::plonky2::mock_main::Statement;
use crate::backends::plonky2::mock_main::{Operation, OperationArg};
use crate::backends::plonky2::mock::mainpod::Statement;
use crate::backends::plonky2::mock::mainpod::{Operation, OperationArg};
use crate::middleware::{Params, StatementArg, ToFields, Value, F, HASH_SIZE, VALUE_SIZE};
use crate::middleware::{OPERATION_ARG_F_LEN, STATEMENT_ARG_F_LEN};
use anyhow::Result;

View file

@ -1,16 +1,3 @@
use crate::backends::plonky2::basetypes::{Hash, Value, D, EMPTY_HASH, EMPTY_VALUE, F, VALUE_SIZE};
use crate::backends::plonky2::common::{
CircuitBuilderPod, OperationTarget, StatementTarget, ValueTarget,
};
use crate::backends::plonky2::mock_main::Operation;
use crate::backends::plonky2::primitives::merkletree::{MerkleProof, MerkleTree};
use crate::backends::plonky2::primitives::merkletree::{
MerkleProofExistenceGate, MerkleProofExistenceTarget,
};
use crate::middleware::{
hash_str, AnchoredKey, NativeOperation, NativePredicate, Params, PodType, Predicate, Statement,
StatementArg, ToFields, KEY_TYPE, SELF, STATEMENT_ARG_F_LEN,
};
use anyhow::Result;
use itertools::Itertools;
use plonky2::{
@ -28,6 +15,19 @@ use plonky2::{
use std::collections::HashMap;
use std::iter;
use crate::backends::plonky2::basetypes::{Hash, Value, D, EMPTY_HASH, EMPTY_VALUE, F, VALUE_SIZE};
use crate::backends::plonky2::circuits::common::{
CircuitBuilderPod, OperationTarget, StatementTarget, ValueTarget,
};
use crate::backends::plonky2::primitives::merkletree::{MerkleProof, MerkleTree};
use crate::backends::plonky2::primitives::merkletree::{
MerkleProofExistenceGate, MerkleProofExistenceTarget,
};
use crate::middleware::{
hash_str, AnchoredKey, NativeOperation, NativePredicate, Params, PodType, Predicate, Statement,
StatementArg, ToFields, KEY_TYPE, SELF, STATEMENT_ARG_F_LEN,
};
//
// SignedPod verification
//
@ -373,7 +373,7 @@ impl MainPodVerifyCircuit {
mod tests {
use super::*;
use crate::backends::plonky2::basetypes::C;
use crate::backends::plonky2::mock_main;
use crate::backends::plonky2::mock::mainpod;
use crate::middleware::OperationType;
use plonky2::plonk::{circuit_builder::CircuitBuilder, circuit_data::CircuitConfig};
@ -407,9 +407,9 @@ mod tests {
}
fn operation_verify(
st: mock_main::Statement,
op: mock_main::Operation,
prev_statements: Vec<mock_main::Statement>,
st: mainpod::Statement,
op: mainpod::Operation,
prev_statements: Vec<mainpod::Statement>,
) -> Result<()> {
let params = Params::default();
@ -452,8 +452,8 @@ mod tests {
#[test]
fn test_operation_verify() -> Result<()> {
// None
let st: mock_main::Statement = Statement::None.into();
let op = mock_main::Operation(OperationType::Native(NativeOperation::None), vec![]);
let st: mainpod::Statement = Statement::None.into();
let op = mainpod::Operation(OperationType::Native(NativeOperation::None), vec![]);
let prev_statements = vec![Statement::None.into()];
operation_verify(st, op, prev_statements)?;

View file

@ -0,0 +1,2 @@
pub mod common;
pub mod mainpod;

View file

@ -505,7 +505,7 @@ impl Pod for MockMainPod {
#[cfg(test)]
pub mod tests {
use super::*;
use crate::backends::plonky2::mock_signed::MockSigner;
use crate::backends::plonky2::mock::signedpod::MockSigner;
use crate::examples::{
great_boy_pod_full_flow, tickets_pod_full_flow, zu_kyc_pod_builder,
zu_kyc_sign_pod_builders,

View file

@ -0,0 +1,2 @@
pub mod mainpod;
pub mod signedpod;

View file

@ -2,7 +2,7 @@ use anyhow::Result;
use std::any::Any;
use std::collections::HashMap;
use super::primitives::merkletree::MerkleTree;
use crate::backends::plonky2::primitives::merkletree::MerkleTree;
use crate::constants::MAX_DEPTH;
use crate::middleware::{
containers::Dictionary, hash_str, AnchoredKey, Hash, Params, Pod, PodId, PodSigner, PodType,

View file

@ -1,6 +1,4 @@
pub mod basetypes;
pub mod common;
pub mod main;
pub mod mock_main;
pub mod mock_signed;
pub mod circuits;
pub mod mock;
pub mod primitives;

View file

@ -23,10 +23,8 @@ use plonky2::{
};
use std::iter;
use crate::backends::plonky2::basetypes::{Hash, Value, D, EMPTY_HASH, EMPTY_VALUE, F, VALUE_SIZE};
use crate::backends::plonky2::common::{
CircuitBuilderPod, OperationTarget, StatementTarget, ValueTarget,
};
use crate::backends::plonky2::basetypes::{Hash, Value, D, EMPTY_HASH, EMPTY_VALUE, F};
use crate::backends::plonky2::circuits::common::{CircuitBuilderPod, ValueTarget};
use crate::backends::plonky2::primitives::merkletree::MerkleProof;
/// `MerkleProofGate` allows to verify both proofs of existence and proofs