Skip to content

Commit

Permalink
Rename compute_inputs to compute_hidden_inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
samtay committed Jul 11, 2023
1 parent 13421e5 commit f7c6028
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions sunscreen/src/types/zkp/gadgets/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl Gadget for SignedModulus {
2
}

fn compute_inputs(
fn compute_hidden_inputs(
&self,
gadget_inputs: &[sunscreen_zkp_backend::BigInt],
) -> ZkpResult<Vec<sunscreen_zkp_backend::BigInt>> {
Expand Down Expand Up @@ -144,7 +144,7 @@ impl Inverse {
}

impl Gadget for Inverse {
fn compute_inputs(&self, gadget_inputs: &[BigInt]) -> ZkpResult<Vec<BigInt>> {
fn compute_hidden_inputs(&self, gadget_inputs: &[BigInt]) -> ZkpResult<Vec<BigInt>> {
let x = gadget_inputs[0];

if x == BigInt::ZERO {
Expand Down Expand Up @@ -193,14 +193,14 @@ mod tests {
use super::*;

#[test]
fn compute_inputs_is_correct() {
fn compute_hidden_inputs_is_correct() {
let m = BigInt::from(22u32);
let field_modulus = <BulletproofsBackend as ZkpBackend>::Field::FIELD_MODULUS;

let gadget = SignedModulus::new(field_modulus, 16);

let test_case = |x: BigInt| {
let outputs = gadget.compute_inputs(&[x, m]).unwrap();
let outputs = gadget.compute_hidden_inputs(&[x, m]).unwrap();

let q = outputs[0];
let r = outputs[1];
Expand Down
4 changes: 2 additions & 2 deletions sunscreen/src/types/zkp/gadgets/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl ToUInt {
}

impl Gadget for ToUInt {
fn compute_inputs(&self, gadget_inputs: &[BigInt]) -> ZkpResult<Vec<BigInt>> {
fn compute_hidden_inputs(&self, gadget_inputs: &[BigInt]) -> ZkpResult<Vec<BigInt>> {
let val = gadget_inputs[0];

if self.n == 0 {
Expand Down Expand Up @@ -112,7 +112,7 @@ impl Gadget for ToUInt {
pub struct AssertBinary;

impl Gadget for AssertBinary {
fn compute_inputs(&self, gadget_inputs: &[BigInt]) -> ZkpResult<Vec<BigInt>> {
fn compute_hidden_inputs(&self, gadget_inputs: &[BigInt]) -> ZkpResult<Vec<BigInt>> {
let val = gadget_inputs[0];

if val != BigInt::ONE && val != BigInt::ZERO {
Expand Down
2 changes: 1 addition & 1 deletion sunscreen_zkp_backend/src/jit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ where
.map(|x| node_outputs[x].clone().zkp_into())
.collect::<Vec<BigInt>>();

let hidden_inputs = g.compute_inputs(&args)?;
let hidden_inputs = g.compute_hidden_inputs(&args)?;

let mut next_nodes = query
.edges_directed(id, Direction::Outgoing)
Expand Down
4 changes: 2 additions & 2 deletions sunscreen_zkp_backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ compile_error!("This crate currently requires a little endian target architectur
*
* We instead ask the prover to simply provide the binary decomposition
* and prove that it's correct. To do this, we create a gadget. Its
* [`compute_inputs`](Gadget::compute_inputs) method directly computes the
* [`compute_hidden_inputs`](Gadget::compute_hidden_inputs) method directly computes the
* decomposition with shifting and masking. Then, the
* [`gen_circuit`](Gadget::gen_circuit) method defined a circuit that proves
* the following:
Expand Down Expand Up @@ -106,7 +106,7 @@ pub trait Gadget: Any + Send + Sync {
*
* Implementors should ensure this function runs in constant time.
*/
fn compute_inputs(&self, gadget_inputs: &[BigInt]) -> Result<Vec<BigInt>>;
fn compute_hidden_inputs(&self, gadget_inputs: &[BigInt]) -> Result<Vec<BigInt>>;

/**
* Returns the expected number of gadget inputs.
Expand Down

0 comments on commit f7c6028

Please sign in to comment.