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

chore(acir)!: remove UnknownWitness #123

Merged
merged 1 commit into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
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
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 @@ -361,14 +359,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)
}
}