Skip to content

Commit

Permalink
Remove some old prover code for now
Browse files Browse the repository at this point in the history
Seems the structure has too change too much to work with Plonky3's main branch; maybe better off expanding the macro to try a macro-free prover
  • Loading branch information
dlubarov committed Jan 23, 2024
1 parent 4fa4291 commit f23f0c4
Showing 1 changed file with 0 additions and 287 deletions.
287 changes: 0 additions & 287 deletions basic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,290 +310,3 @@ impl<F: PrimeField32 + TwoAdicField> MachineWithRangeChip<F, 256> for BasicMachi
&mut self.range
}
}

// impl<F: PrimeField32 + TwoAdicField> Machine<F> for BasicMachine<F> {
// fn run<Adv: AdviceProvider>(&mut self, program: &ProgramROM<i32>, advice: &mut Adv) {
// loop {
// let pc = self.cpu.pc;
// let instruction = program.get_instruction(pc);
// let opcode = instruction.opcode;
// let ops = instruction.operands;
// match opcode {
// <Load32Instruction as Instruction<Self, F>>::OPCODE => {
// Load32Instruction::execute_with_advice(self, ops, advice);
// }
// <Store32Instruction as Instruction<Self, F>>::OPCODE => {
// Store32Instruction::execute_with_advice(self, ops, advice);
// }
// <JalInstruction as Instruction<Self, F>>::OPCODE => {
// JalInstruction::execute_with_advice(self, ops, advice);
// }
// <JalvInstruction as Instruction<Self, F>>::OPCODE => {
// JalvInstruction::execute_with_advice(self, ops, advice);
// }
// <BeqInstruction as Instruction<Self, F>>::OPCODE => {
// BeqInstruction::execute_with_advice(self, ops, advice);
// }
// <BneInstruction as Instruction<Self, F>>::OPCODE => {
// BneInstruction::execute_with_advice(self, ops, advice);
// }
// <Imm32Instruction as Instruction<Self, F>>::OPCODE => {
// Imm32Instruction::execute_with_advice(self, ops, advice);
// }
// <Add32Instruction as Instruction<Self, F>>::OPCODE => {
// Add32Instruction::execute_with_advice(self, ops, advice);
// }
// <Sub32Instruction as Instruction<Self, F>>::OPCODE => {
// Sub32Instruction::execute_with_advice(self, ops, advice);
// }
// <Mul32Instruction as Instruction<Self, F>>::OPCODE => {
// Mul32Instruction::execute_with_advice(self, ops, advice);
// }
// <Mulhs32Instruction as Instruction<Self, F>>::OPCODE => {
// Mulhs32Instruction::execute_with_advice(self, ops, advice);
// }
// <Mulhu32Instruction as Instruction<Self, F>>::OPCODE => {
// Mulhu32Instruction::execute_with_advice(self, ops, advice);
// }
// <Div32Instruction as Instruction<Self, F>>::OPCODE => {
// Div32Instruction::execute_with_advice(self, ops, advice);
// }
// <SDiv32Instruction as Instruction<Self, F>>::OPCODE => {
// SDiv32Instruction::execute_with_advice(self, ops, advice);
// }
// <Shl32Instruction as Instruction<Self, F>>::OPCODE => {
// Shl32Instruction::execute_with_advice(self, ops, advice);
// }
// <Shr32Instruction as Instruction<Self, F>>::OPCODE => {
// Shr32Instruction::execute_with_advice(self, ops, advice);
// }
// <Sra32Instruction as Instruction<Self, F>>::OPCODE => {
// Sra32Instruction::execute_with_advice(self, ops, advice);
// }
// <Lt32Instruction as Instruction<Self, F>>::OPCODE => {
// Lt32Instruction::execute_with_advice(self, ops, advice);
// }
// <And32Instruction as Instruction<Self, F>>::OPCODE => {
// And32Instruction::execute_with_advice(self, ops, advice);
// }
// <Or32Instruction as Instruction<Self, F>>::OPCODE => {
// Or32Instruction::execute_with_advice(self, ops, advice);
// }
// <Xor32Instruction as Instruction<Self, F>>::OPCODE => {
// Xor32Instruction::execute_with_advice(self, ops, advice);
// }
// <ReadAdviceInstruction as Instruction<Self, F>>::OPCODE => {
// ReadAdviceInstruction::execute_with_advice(self, ops, advice);
// }
// <WriteInstruction as Instruction<Self, F>>::OPCODE => {
// WriteInstruction::execute_with_advice(self, ops, advice);
// }
// <StopInstruction as Instruction<Self, F>>::OPCODE => {
// StopInstruction::execute_with_advice(self, ops, advice);
// }
// _ => {}
// }
//
// self.read_word(pc as usize);
//
// if opcode == <StopInstruction as Instruction<Self, F>>::OPCODE {
// break;
// }
// }
// let n = self.cpu.clock.next_power_of_two() - self.cpu.clock;
// for _ in 0..n {
// self.read_word(self.cpu.pc as usize);
// }
// }
//
// fn add_chip_trace<SC, A>(
// &self,
// config: &SC,
// challenger: &mut SC::Challenger,
// trace_commitments: &mut Vec<ProverData<SC>>,
// quotient_commitments: &mut Vec<ProverData<SC>>,
// log_degrees: &mut Vec<usize>,
// log_quotient_degrees: &mut Vec<usize>,
// chip: &A,
// trace: RowMajorMatrix<<SC as StarkConfig>::Val>,
// ) where
// SC: StarkConfig,
// A: Air<SymbolicAirBuilder<SC::Val>> + for<'a> Air<ProverConstraintFolder<'a, SC>>,
// {
// let (trace_lde, quotient_lde, log_degree, log_quotient_degree) =
// get_trace_and_quotient_ldes(config, trace, chip, challenger);
// trace_commitments.push(trace_lde);
// quotient_commitments.push(quotient_lde);
// log_degrees.push(log_degree);
// log_quotient_degrees.push(log_quotient_degree);
// }
//
// fn prove<SC>(&self, config: &SC, challenger: &mut SC::Challenger) -> MachineProof<SC>
// where
// SC: StarkConfig<Val = F>,
// {
// let mut trace_commitments = Vec::new();
// let mut quotient_commitments = Vec::new();
// let mut log_degrees = Vec::new();
// let mut log_quotient_degrees = Vec::new();
// /*
// let air = &self.cpu();
// assert_eq!(air.operations.len() > 0, true);
// let trace = air.generate_trace(air, self);
// self.add_chip_trace(
// config,
// challenger,
// &mut trace_commitments,
// &mut quotient_commitments,
// &mut log_degrees,
// &mut log_quotient_degrees,
// air,
// trace,
// );
// */
// if self.add_u32.operations.len() > 0 {
// let air = &self.add_u32;
// let trace = <Add32Chip as Chip<BasicMachine<F>, SC>>::generate_trace(air, self);
//
// self.add_chip_trace(
// config,
// challenger,
// &mut trace_commitments,
// &mut quotient_commitments,
// &mut log_degrees,
// &mut log_quotient_degrees,
// air,
// trace,
// );
// }
// if self.sub_u32.operations.len() > 0 {
// let air = &self.sub_u32;
// let trace = <Sub32Chip as Chip<BasicMachine<F>, SC>>::generate_trace(air, self);
//
// self.add_chip_trace(
// config,
// challenger,
// &mut trace_commitments,
// &mut quotient_commitments,
// &mut log_degrees,
// &mut log_quotient_degrees,
// air,
// trace,
// );
// }
// if self.mul_u32.operations.len() > 0 {
// let air = &self.mul_u32;
// let trace = <Mul32Chip as Chip<BasicMachine<F>, SC>>::generate_trace(air, self);
//
// self.add_chip_trace(
// config,
// challenger,
// &mut trace_commitments,
// &mut quotient_commitments,
// &mut log_degrees,
// &mut log_quotient_degrees,
// air,
// trace,
// );
// }
// if self.div_u32.operations.len() > 0 {
// let air = &self.div_u32;
//
// let trace = <Div32Chip as Chip<BasicMachine<F>, SC>>::generate_trace(air, self);
// self.add_chip_trace(
// config,
// challenger,
// &mut trace_commitments,
// &mut quotient_commitments,
// &mut log_degrees,
// &mut log_quotient_degrees,
// air,
// trace,
// );
// }
// if self.shift_u32.operations.len() > 0 {
// let air = &self.shift_u32;
// let trace = <Shift32Chip as Chip<BasicMachine<F>, SC>>::generate_trace(air, self);
//
// self.add_chip_trace(
// config,
// challenger,
// &mut trace_commitments,
// &mut quotient_commitments,
// &mut log_degrees,
// &mut log_quotient_degrees,
// air,
// trace,
// );
// }
// if self.lt_u32.operations.len() > 0 {
// let air = &self.lt_u32;
// let trace = <Lt32Chip as Chip<BasicMachine<F>, SC>>::generate_trace(air, self);
//
// self.add_chip_trace(
// config,
// challenger,
// &mut trace_commitments,
// &mut quotient_commitments,
// &mut log_degrees,
// &mut log_quotient_degrees,
// air,
// trace,
// );
// }
//
// if self.bitwise_u32.operations.len() > 0 {
// let air = &self.bitwise_u32;
// let trace = <Bitwise32Chip as Chip<BasicMachine<F>, SC>>::generate_trace(air, self);
//
// self.add_chip_trace(
// config,
// challenger,
// &mut trace_commitments,
// &mut quotient_commitments,
// &mut log_degrees,
// &mut log_quotient_degrees,
// air,
// trace,
// );
// }
//
// let pcs = config.pcs();
// let (aggregated_commitment, aggregated_trace) = pcs.combine(&trace_commitments);
// let (aggregated_quotient_commitment, aggregated_quotient_trace) =
// pcs.combine(&quotient_commitments);
// let max_log_degree = log_degrees.iter().max().unwrap();
// let max_quotient_degree = log_quotient_degrees.iter().max().unwrap();
// let (opening_proof, opened_values) = open(
// config,
// &aggregated_trace,
// &aggregated_quotient_trace,
// *max_log_degree,
// *max_quotient_degree,
// challenger,
// );
//
// let commitments = Commitments {
// trace: aggregated_commitment,
// quotient_chunks: aggregated_quotient_commitment,
// };
// MachineProof {
// chip_proof: ChipProof {
// proof: Proof {
// commitments,
// opened_values,
// opening_proof,
// degree_bits: *max_log_degree,
// },
// },
// phantom: PhantomData::default(),
// }
// }
//
// fn verify<SC>(proof: &MachineProof<SC>) -> Result<(), ()>
// where
// SC: StarkConfig<Val = F>,
// {
// Ok(())
// }
// }

0 comments on commit f23f0c4

Please sign in to comment.