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

Commit

Permalink
chore(acir)!: remove UnknownWitness (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored Feb 28, 2023
1 parent 097cfb0 commit 9f002c7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
10 changes: 0 additions & 10 deletions acir/src/native_types/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ use std::cmp::Ordering;
use std::io::{Read, Write};
use std::ops::{Add, Mul, Neg, Sub};

use super::witness::UnknownWitness;

// In the addition polynomial
// We can have arbitrary fan-in/out, so we need more than wL,wR and wO
// When looking at the arithmetic gate for the quotient polynomial in standard plonk
Expand Down Expand Up @@ -448,14 +446,6 @@ impl Sub<&Witness> for &Expression {
self - &Expression::from(rhs)
}
}
impl Sub<&UnknownWitness> for &Expression {
type Output = Expression;
fn sub(self, rhs: &UnknownWitness) -> Expression {
let mut cloned = self.clone();
cloned.linear_combinations.insert(0, (-FieldElement::one(), rhs.as_witness()));
cloned
}
}

impl Expression {
// Checks if this polynomial can fit into one arithmetic identity
Expand Down
19 changes: 0 additions & 19 deletions acir/src/native_types/witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ impl Witness {
true
}

pub fn to_unknown(self) -> UnknownWitness {
UnknownWitness(self.0)
}

pub fn to_bytes(
witnesses: &std::collections::BTreeMap<Witness, acir_field::FieldElement>,
) -> Vec<u8> {
Expand All @@ -51,18 +47,3 @@ impl Witness {
rmp_serde::from_slice(buf_d.as_slice()).unwrap()
}
}

// This is a witness that is unknown relative to the rest of the witnesses in the arithmetic gate
// We use this, so that they are pushed to the beginning of the array
//
// When they are pushed to the beginning of the array, they are less likely to be used in an intermediate gate
// by the optimizer, which would mean two unknowns in an equation.
// See Issue #20
// TODO: can we find a better solution to this?
pub struct UnknownWitness(pub u32);

impl UnknownWitness {
pub fn as_witness(&self) -> Witness {
Witness(self.0)
}
}

0 comments on commit 9f002c7

Please sign in to comment.