Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
Simplify WitnessGenerationArtifact enum
Browse files Browse the repository at this point in the history
  • Loading branch information
0xVolosnikov committed Aug 14, 2024
1 parent d7fd754 commit de4b511
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
11 changes: 6 additions & 5 deletions src/tests/complex_tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,12 @@ pub(crate) fn generate_base_layer(
.map(|x| ZkSyncBaseLayerStorage::from_inner(a as u8, x))
.collect(),
)),
WitnessGenerationArtifact::UnsortedMemoryQueueWitness(witnesses) => {
unsorted_memory_queue_witnesses.push(witnesses)
}
WitnessGenerationArtifact::SortedMemoryQueueWitness(witnesses) => {
sorted_memory_queue_witnesses.push(witnesses)
WitnessGenerationArtifact::MemoryQueueWitness((witnesses, sorted)) => {
if sorted {
sorted_memory_queue_witnesses.push(witnesses);
} else {
unsorted_memory_queue_witnesses.push(witnesses);
}
}
};

Expand Down
11 changes: 6 additions & 5 deletions src/tests/run_manually.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,12 @@ pub(crate) fn run_with_options(entry_point_bytecode: Vec<[u8; 32]>, options: Opt

let artifacts_callback = |artifact: WitnessGenerationArtifact| match artifact {
WitnessGenerationArtifact::BaseLayerCircuit(circuit) => basic_block_circuits.push(circuit),
WitnessGenerationArtifact::UnsortedMemoryQueueWitness(witnesses) => {
unsorted_memory_queue_witnesses.push(witnesses)
}
WitnessGenerationArtifact::SortedMemoryQueueWitness(witnesses) => {
sorted_memory_queue_witnesses.push(witnesses)
WitnessGenerationArtifact::MemoryQueueWitness((witnesses, sorted)) => {
if sorted {
sorted_memory_queue_witnesses.push(witnesses)
} else {
unsorted_memory_queue_witnesses.push(witnesses)
}
}
_ => {}
};
Expand Down
13 changes: 7 additions & 6 deletions src/witness/oracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -892,9 +892,10 @@ fn simulate_memory_queue(

// send to storage
channel_sender
.send(WitnessGenerationArtifact::UnsortedMemoryQueueWitness(
.send(WitnessGenerationArtifact::MemoryQueueWitness((
unsorted_witnesses_for_circuit,
))
false, // unsorted
)))
.unwrap();
}

Expand Down Expand Up @@ -1063,9 +1064,10 @@ fn simulate_sorted_memory_queue(

// send to storage
channel_sender
.send(WitnessGenerationArtifact::SortedMemoryQueueWitness(
.send(WitnessGenerationArtifact::MemoryQueueWitness((
sorted_witnesses_for_circuit,
))
true, // sorted
)))
.unwrap();
}
}
Expand Down Expand Up @@ -1398,8 +1400,7 @@ pub enum WitnessGenerationArtifact {
Vec<ClosedFormInputCompactFormWitness<GoldilocksField>>,
),
),
SortedMemoryQueueWitness(MemoryQueueStateWitnesses<GoldilocksField>),
UnsortedMemoryQueueWitness(MemoryQueueStateWitnesses<GoldilocksField>),
MemoryQueueWitness((MemoryQueueStateWitnesses<GoldilocksField>, bool)), // sorted/unsorted
}

/// Make basic circuits instances and witnesses,
Expand Down

0 comments on commit de4b511

Please sign in to comment.