Remove some unused warnings (#192)

- Made some methods public, if they seemed like they'd be useful crates that depend on plonky2, and seemed like good/stable APIs
- Deleted a few things I didn't think seemed very useful
- Left a few for now that I was on the fence about
This commit is contained in:
Daniel Lubarov 2021-08-19 08:23:45 -07:00 committed by GitHub
parent 7c97751c13
commit 90c7a72ceb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 11 additions and 72 deletions

View File

@ -11,11 +11,7 @@ use crate::plonk::circuit_builder::CircuitBuilder;
impl<F: Extendable<D>, const D: usize> CircuitBuilder<F, D> {
/// Split the given element into a list of targets, where each one represents a
/// base-B limb of the element, with little-endian ordering.
pub(crate) fn split_le_base<const B: usize>(
&mut self,
x: Target,
num_limbs: usize,
) -> Vec<Target> {
pub fn split_le_base<const B: usize>(&mut self, x: Target, num_limbs: usize) -> Vec<Target> {
let gate_type = BaseSumGate::<B>::new(num_limbs);
let gate = self.add_gate(gate_type.clone(), vec![]);
let sum = Target::wire(gate, BaseSumGate::<B>::WIRE_SUM);

View File

@ -200,7 +200,7 @@ impl<F: Extendable<D>, const D: usize> Tree<GateRef<F, D>> {
}
/// Returns the tree's maximum filtered constraint degree.
fn max_filtered_degree(&self) -> usize {
pub fn max_filtered_degree(&self) -> usize {
self.traversal()
.into_iter()
.map(|(g, p)| g.0.degree() + p.len())

View File

@ -30,7 +30,7 @@ impl<F: Field> HashOut<F> {
}
}
pub(crate) fn rand() -> Self {
pub fn rand() -> Self {
Self {
elements: [F::rand(), F::rand(), F::rand(), F::rand()],
}

View File

@ -191,18 +191,13 @@ impl<F: Extendable<D>, const D: usize> CircuitBuilder<F, D> {
self.random_access(cap_index, state_ext, cap_ext);
}
pub(crate) fn assert_hashes_equal(&mut self, x: HashOutTarget, y: HashOutTarget) {
pub fn assert_hashes_equal(&mut self, x: HashOutTarget, y: HashOutTarget) {
for i in 0..4 {
self.assert_equal(x.elements[i], y.elements[i]);
}
}
pub(crate) fn named_assert_hashes_equal(
&mut self,
x: HashOutTarget,
y: HashOutTarget,
name: String,
) {
pub fn named_assert_hashes_equal(&mut self, x: HashOutTarget, y: HashOutTarget, name: String) {
for i in 0..4 {
self.named_assert_equal(
x.elements[i],

View File

@ -114,18 +114,6 @@ impl<F: Field> Challenger<F> {
.expect("Output buffer should be non-empty")
}
pub fn get_2_challenges(&mut self) -> (F, F) {
(self.get_challenge(), self.get_challenge())
}
pub fn get_3_challenges(&mut self) -> (F, F, F) {
(
self.get_challenge(),
self.get_challenge(),
self.get_challenge(),
)
}
pub fn get_n_challenges(&mut self, n: usize) -> Vec<F> {
(0..n).map(|_| self.get_challenge()).collect()
}
@ -279,24 +267,6 @@ impl RecursiveChallenger {
.expect("Output buffer should be non-empty")
}
pub(crate) fn get_2_challenges<F: Extendable<D>, const D: usize>(
&mut self,
builder: &mut CircuitBuilder<F, D>,
) -> (Target, Target) {
(self.get_challenge(builder), self.get_challenge(builder))
}
pub(crate) fn get_3_challenges<F: Extendable<D>, const D: usize>(
&mut self,
builder: &mut CircuitBuilder<F, D>,
) -> (Target, Target, Target) {
(
self.get_challenge(builder),
self.get_challenge(builder),
self.get_challenge(builder),
)
}
pub(crate) fn get_n_challenges<F: Extendable<D>, const D: usize>(
&mut self,
builder: &mut CircuitBuilder<F, D>,

View File

@ -58,6 +58,7 @@ impl CircuitConfig {
self.num_wires - self.num_routed_wires
}
#[cfg(test)]
pub(crate) fn large_config() -> Self {
Self {
num_wires: 126,
@ -75,6 +76,7 @@ impl CircuitConfig {
}
}
#[cfg(test)]
pub(crate) fn large_zk_config() -> Self {
CircuitConfig {
zero_knowledge: true,

View File

@ -115,11 +115,11 @@ impl<F: Field> PolynomialCoeffs<F> {
/// The number of coefficients. This does not filter out any zero coefficients, so it is not
/// necessarily related to the degree.
pub(crate) fn len(&self) -> usize {
pub fn len(&self) -> usize {
self.coeffs.len()
}
pub(crate) fn log_len(&self) -> usize {
pub fn log_len(&self) -> usize {
log2_strict(self.len())
}

View File

@ -4,7 +4,7 @@ use crate::polynomial::polynomial::PolynomialValues;
pub(crate) mod context_tree;
pub(crate) mod marking;
pub(crate) mod partial_products;
pub(crate) mod reducing;
pub mod reducing;
pub(crate) mod timing;
pub(crate) fn bits_u64(n: u64) -> usize {
@ -15,10 +15,6 @@ pub(crate) const fn ceil_div_usize(a: usize, b: usize) -> usize {
(a + b - 1) / b
}
pub(crate) fn pad_to_multiple_usize(a: usize, b: usize) -> usize {
ceil_div_usize(a, b) * b
}
/// Computes `ceil(log_2(n))`.
pub(crate) fn log2_ceil(n: usize) -> usize {
n.next_power_of_two().trailing_zeros() as usize

View File

@ -1,7 +1,7 @@
use std::borrow::Borrow;
use crate::field::extension_field::target::ExtensionTarget;
use crate::field::extension_field::{Extendable, Frobenius};
use crate::field::extension_field::Extendable;
use crate::field::field_types::Field;
use crate::gates::reducing::ReducingGate;
use crate::iop::target::Target;
@ -80,16 +80,6 @@ impl<F: Field> ReducingFactor<F> {
pub fn reset(&mut self) {
self.count = 0;
}
pub fn repeated_frobenius<const D: usize>(&self, count: usize) -> Self
where
F: Frobenius<D>,
{
Self {
base: self.base.repeated_frobenius(count),
count: self.count,
}
}
}
#[derive(Debug, Clone)]
@ -190,16 +180,6 @@ impl<const D: usize> ReducingFactorTarget<D> {
pub fn reset(&mut self) {
self.count = 0;
}
pub fn repeated_frobenius<F>(&self, count: usize, builder: &mut CircuitBuilder<F, D>) -> Self
where
F: Extendable<D>,
{
Self {
base: self.base.repeated_frobenius(count, builder),
count: self.count,
}
}
}
#[cfg(test)]