From b72d4d126bafc5b418e9b7024ab77a7afd4c00ba Mon Sep 17 00:00:00 2001 From: wborgeaud Date: Mon, 19 Jul 2021 19:38:39 +0200 Subject: [PATCH] Remove `indices` in `WirePartitions` --- src/permutation_argument.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/permutation_argument.rs b/src/permutation_argument.rs index 9a692cd3..49033a86 100644 --- a/src/permutation_argument.rs +++ b/src/permutation_argument.rs @@ -108,14 +108,17 @@ impl usize> TargetPartition { }); }); - WirePartitions { partition, indices } + let num_wires = partition.iter().map(|v| v.len()).sum(); + WirePartitions { + partition, + num_wires, + } } } pub struct WirePartitions { partition: Vec>, - // TODO: We don't need `indices` anymore, so we can delete it. - indices: HashMap, + num_wires: usize, } impl WirePartitions { @@ -143,8 +146,8 @@ impl WirePartitions { /// Generates sigma in the context of Plonk, which is a map from `[kn]` to `[kn]`, where `k` is /// the number of routed wires and `n` is the number of gates. fn get_sigma_map(&self, degree: usize) -> Vec { - debug_assert_eq!(self.indices.len() % degree, 0); - let num_routed_wires = self.indices.len() / degree; + debug_assert_eq!(self.num_wires % degree, 0); + let num_routed_wires = self.num_wires / degree; // Find a wire's "neighbor" in the context of Plonk's "extended copy constraints" check. In // other words, find the next wire in the given wire's partition. If the given wire is last in