diff --git a/crates/zkevm_circuits/src/ram_permutation/input.rs b/crates/zkevm_circuits/src/ram_permutation/input.rs index c1d1ee1..d000cf0 100644 --- a/crates/zkevm_circuits/src/ram_permutation/input.rs +++ b/crates/zkevm_circuits/src/ram_permutation/input.rs @@ -116,18 +116,8 @@ pub type RamPermutationCycleInputOutputWitness = crate::fsm_input_output::Clo pub struct RamPermutationCircuitInstanceWitness { pub closed_form_input: RamPermutationCycleInputOutputWitness, - pub unsorted_queue_witness: FullStateCircuitQueueRawWitness< - F, - MemoryQuery, - FULL_SPONGE_QUEUE_STATE_WIDTH, - MEMORY_QUERY_PACKED_WIDTH, - >, - pub sorted_queue_witness: FullStateCircuitQueueRawWitness< - F, - MemoryQuery, - FULL_SPONGE_QUEUE_STATE_WIDTH, - MEMORY_QUERY_PACKED_WIDTH, - >, + pub unsorted_queue_witness: Vec< as CSAllocatable>::Witness>, + pub sorted_queue_witness: Vec< as CSAllocatable>::Witness>, } pub type MemoryQueriesQueue = diff --git a/crates/zkevm_circuits/src/ram_permutation/mod.rs b/crates/zkevm_circuits/src/ram_permutation/mod.rs index 249b77d..b546524 100644 --- a/crates/zkevm_circuits/src/ram_permutation/mod.rs +++ b/crates/zkevm_circuits/src/ram_permutation/mod.rs @@ -1,9 +1,12 @@ use super::*; +use base_structures::vm_state::FULL_SPONGE_QUEUE_STATE_WIDTH; use boojum::cs::traits::cs::ConstraintSystem; +use boojum::field::Field; use boojum::field::SmallField; use boojum::gadgets::boolean::Boolean; use boojum::gadgets::num::Num; +use boojum::gadgets::queue::full_state_queue::FullStateCircuitQueueRawWitness; use boojum::gadgets::traits::selectable::Selectable; use boojum::gadgets::u256::UInt256; use boojum::gadgets::u32::UInt32; @@ -78,7 +81,12 @@ where > = MemoryQueriesQueue::from_state(cs, unsorted_queue_state); unsorted_queue.witness = Arc::new(FullStateCircuitQueueWitness::from_inner_witness( - unsorted_queue_witness, + FullStateCircuitQueueRawWitness { + elements: unsorted_queue_witness + .into_iter() + .map(|x| (x, [Field::ZERO; FULL_SPONGE_QUEUE_STATE_WIDTH])) + .collect(), + }, )); // passthrought must be trivial @@ -104,7 +112,12 @@ where > = MemoryQueriesQueue::from_state(cs, sorted_queue_state); sorted_queue.witness = Arc::new(FullStateCircuitQueueWitness::from_inner_witness( - sorted_queue_witness, + FullStateCircuitQueueRawWitness { + elements: sorted_queue_witness + .into_iter() + .map(|x| (x, [Field::ZERO; FULL_SPONGE_QUEUE_STATE_WIDTH])) + .collect(), + }, )); // get challenges for permutation argument diff --git a/crates/zkevm_test_harness/src/witness/individual_circuits/memory_related/ram_permutation.rs b/crates/zkevm_test_harness/src/witness/individual_circuits/memory_related/ram_permutation.rs index 2f25f2d..aa2c38d 100644 --- a/crates/zkevm_test_harness/src/witness/individual_circuits/memory_related/ram_permutation.rs +++ b/crates/zkevm_test_harness/src/witness/individual_circuits/memory_related/ram_permutation.rs @@ -124,6 +124,15 @@ pub(crate) fn compute_ram_circuit_snapshots = all_memory_queries + .par_iter() + .map(|x| x.encoding_witness()) + .collect(); + let rhs_contributions: Vec<_> = all_memory_queries_sorted + .par_iter() + .map(|x| x.encoding_witness()) + .collect(); + let challenges = produce_fs_challenges::< Field, RoundFunction, @@ -138,15 +147,6 @@ pub(crate) fn compute_ram_circuit_snapshots = all_memory_queries - .iter() - .map(|x| x.encoding_witness()) - .collect(); - let rhs_contributions: Vec<_> = all_memory_queries_sorted - .iter() - .map(|x| x.encoding_witness()) - .collect(); - for idx in 0..DEFAULT_NUM_PERMUTATION_ARGUMENT_REPETITIONS { let (lhs_grand_product_chain, rhs_grand_product_chain) = compute_grand_product_chains( &lhs_contributions.iter().collect(), @@ -355,18 +355,14 @@ pub(crate) fn compute_ram_circuit_snapshots