Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mock prover api #122

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 82 additions & 3 deletions plonk-core/src/constraint_system/composer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,85 @@ where
);
self.n += 1;
}

struct GateValues {

where
F: Field,
{
left: F,
right: F,
output: F,
fourth: F,
left_next: F,
right_next: F,
fourth_next: F,
left_selector: F,
right_selector: F,
constant_selector: F,
}


}
impl GateValues {

}
struct ConstraintErrorLocation<F>
where
F: Field,

{
// the row where this error occurs
row: usize,

// the gate values that caused the error
gate_values: GateValues<F>


}

impl ConstraintErrorLocation {

fn failure_location(&self) -> usize {

// returns the error location
self.row
}
fn failure_value(&self) -> Vec<usize> {

// returns the error value

self.gate_values
}

}
pub struct MockProver<F: Group + Field> {
k: u32,


/// The error location in the circuit.
errors_location: Vec<ConstraintErrorLocation>,




}

impl MockProver<F>{

fn failure_location(&self) -> usize {

// returns the error location
self.row
}
fn failure_value(&self) -> Vec<usize> {

// returns the error value

self.gate_values
}

}
/// Utility function that checks on the "front-end"
/// side of the PLONK implementation if the identity polynomial
/// is satisfied for each of the [`StandardComposer`]'s gates.
Expand Down Expand Up @@ -755,15 +834,15 @@ where
- *d
}
(false, false) => F::zero(),
_ => unreachable!(),
_ => unreachable!("Check failed at gate {}", i),
})
+ qrange
* (delta(*c - four * d)
+ delta(*b - four * c)
+ delta(*a - four * b)
+ delta(*d_next - four * a));

assert_eq!(k, F::zero(), "Check failed at gate {}", i,);
assert_eq!(k, F::zero(), "Check failed at gate {}; selector polynomials", i, qm,ql,qr,q4,qo,qc,qarith,qrange,qlogic,qfixed,qvar);
}
}
}
Expand Down Expand Up @@ -1000,4 +1079,4 @@ mod test {
ark_ed_on_bls12_377::EdwardsParameters
)
);
}
}