Skip to content

Commit

Permalink
feat: add proof_read to PublicOutput (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimo99 authored Oct 16, 2023
1 parent 2db860a commit ddfaec9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions plonky2x/core/src/backend/circuit/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,23 @@ impl<L: PlonkParameters<D>, const D: usize> PublicOutput<L, D> {
}
}

pub fn proof_read<V: CircuitVariable>(&mut self) -> V::ValueType<L::Field> {
match self {
PublicOutput::Proofs(output) => {
let elements = output.drain(0..V::nb_elements()).collect_vec();
V::from_elements::<L::Field>(&elements)
}
_ => panic!("proofs io is not enabled"),
}
}

pub fn proof_read_all<V: CircuitVariable>(&mut self) -> Vec<L::Field> {
match self {
PublicOutput::Proofs(output) => output.clone(),
_ => panic!("proofs io is not enabled"),
}
}

/// Reads a value from the public circuit output using byte-based serialization.
pub fn evm_read<V: EvmVariable>(&mut self) -> V::ValueType<L::Field> {
match self {
Expand Down

0 comments on commit ddfaec9

Please sign in to comment.