From 8389389d37621eb612a134499e7faddcd920ea5e Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Tue, 22 Dec 2020 12:27:36 +0000 Subject: [PATCH 1/2] model: metrics 0.13.0-alpha.13 --- Cargo.toml | 2 +- src/model.rs | 6 +++--- src/poly/commitment.rs | 4 ++-- src/poly/commitment/msm.rs | 2 +- src/poly/commitment/prover.rs | 2 +- src/poly/commitment/verifier.rs | 2 +- src/poly/domain.rs | 6 +++--- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e8ccfdb..dcbe5c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ bitvec = "0.18" subtle = "2.3" crossbeam-utils = "0.7" ff = "0.8" -metrics = "=0.13.0-alpha.11" +metrics = "=0.13.0-alpha.13" num_cpus = "1.13" rand = "0.7" diff --git a/src/model.rs b/src/model.rs index 940b73a..6e5f56f 100644 --- a/src/model.rs +++ b/src/model.rs @@ -5,7 +5,7 @@ use std::collections::HashMap; use std::fmt; use std::sync::Arc; -use metrics::{Key, Recorder, Unit}; +use metrics::{GaugeValue, Key, Recorder, Unit}; /// A [`metrics`] recorder for examining halo2 metrics. /// @@ -94,11 +94,11 @@ impl Recorder for ModelRecorder { .or_default() += value; } - fn update_gauge(&self, _key: Key, _value: f64) { + fn update_gauge(&self, _key: Key, _value: GaugeValue) { unimplemented!() } - fn record_histogram(&self, _key: Key, _value: u64) { + fn record_histogram(&self, _key: Key, _value: f64) { unimplemented!() } } diff --git a/src/poly/commitment.rs b/src/poly/commitment.rs index 6729ac5..a4066c2 100644 --- a/src/poly/commitment.rs +++ b/src/poly/commitment.rs @@ -125,7 +125,7 @@ impl Params { poly: &Polynomial, r: Blind, ) -> C::Projective { - metrics::increment!("multiexp", "size" => format!("{}", poly.len() + 1), "fn" => "commit"); + metrics::increment_counter!("multiexp", "size" => format!("{}", poly.len() + 1), "fn" => "commit"); let mut tmp_scalars = Vec::with_capacity(poly.len() + 1); let mut tmp_bases = Vec::with_capacity(poly.len() + 1); @@ -146,7 +146,7 @@ impl Params { poly: &Polynomial, r: Blind, ) -> C::Projective { - metrics::increment!("multiexp", "size" => format!("{}", poly.len() + 1), "fn" => "commit_lagrange"); + metrics::increment_counter!("multiexp", "size" => format!("{}", poly.len() + 1), "fn" => "commit_lagrange"); let mut tmp_scalars = Vec::with_capacity(poly.len() + 1); let mut tmp_bases = Vec::with_capacity(poly.len() + 1); diff --git a/src/poly/commitment/msm.rs b/src/poly/commitment/msm.rs index 1d11d66..098c1cd 100644 --- a/src/poly/commitment/msm.rs +++ b/src/poly/commitment/msm.rs @@ -112,7 +112,7 @@ impl<'a, C: CurveAffine> MSM<'a, C> { assert_eq!(scalars.len(), len); - metrics::increment!("multiexp", "size" => format!("{}", len), "fn" => "MSM::eval"); + metrics::increment_counter!("multiexp", "size" => format!("{}", len), "fn" => "MSM::eval"); bool::from(best_multiexp(&scalars, &bases).is_zero()) } } diff --git a/src/poly/commitment/prover.rs b/src/poly/commitment/prover.rs index 999367b..38cbf16 100644 --- a/src/poly/commitment/prover.rs +++ b/src/poly/commitment/prover.rs @@ -175,7 +175,7 @@ impl Proof { let d = C::Scalar::rand(); let s = C::Scalar::rand(); - metrics::increment!("multiexp", "val" => "delta", "size" => "3"); + metrics::increment_counter!("multiexp", "val" => "delta", "size" => "3"); let delta = best_multiexp(&[d, d * &b, s], &[g, u, params.h]).to_affine(); // Feed delta into the transcript diff --git a/src/poly/commitment/verifier.rs b/src/poly/commitment/verifier.rs index 3770db4..55b6d6e 100644 --- a/src/poly/commitment/verifier.rs +++ b/src/poly/commitment/verifier.rs @@ -55,7 +55,7 @@ impl<'a, C: CurveAffine> Guard<'a, C> { pub fn compute_g(&self) -> C { let s = compute_s(&self.challenges_sq, self.allinv); - metrics::increment!("multiexp", "size" => format!("{}", s.len()), "fn" => "compute_g"); + metrics::increment_counter!("multiexp", "size" => format!("{}", s.len()), "fn" => "compute_g"); let mut tmp = best_multiexp(&s, &self.msm.params.g); tmp += self.msm.params.h; tmp.to_affine() diff --git a/src/poly/domain.rs b/src/poly/domain.rs index 09a2cd8..022a67c 100644 --- a/src/poly/domain.rs +++ b/src/poly/domain.rs @@ -205,7 +205,7 @@ impl EvaluationDomain { assert_eq!(a.values.len(), 1 << self.k); // Perform inverse FFT to obtain the polynomial in coefficient form - metrics::increment!("ifft", "size" => format!("{}", a.len()), "fn" => "lagrange_to_coeff"); + metrics::increment_counter!("ifft", "size" => format!("{}", a.len()), "fn" => "lagrange_to_coeff"); Self::ifft(&mut a.values, self.omega_inv, self.k, self.ifft_divisor); Polynomial { @@ -240,7 +240,7 @@ impl EvaluationDomain { Self::distribute_powers(&mut a.values, g); } a.values.resize(self.extended_len(), G::group_zero()); - metrics::increment!("fft", "size" => format!("{}", self.extended_len()), "fn" => "coeff_to_extended"); + metrics::increment_counter!("fft", "size" => format!("{}", self.extended_len()), "fn" => "coeff_to_extended"); best_fft(&mut a.values, self.extended_omega, self.extended_k); Polynomial { @@ -259,7 +259,7 @@ impl EvaluationDomain { assert_eq!(a.values.len(), self.extended_len()); // Inverse FFT - metrics::increment!("ifft", "size" => format!("{}", a.len()), "fn" => "extended_to_coeff"); + metrics::increment_counter!("ifft", "size" => format!("{}", a.len()), "fn" => "extended_to_coeff"); Self::ifft( &mut a.values, self.extended_omega_inv, From c8e6fd9dfd549c3b901a251189dfd31702cb8370 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Tue, 22 Dec 2020 12:28:31 +0000 Subject: [PATCH 2/2] Pin all metrics crate dependencies We depend on the alpha version, where breaking changes are occurring regularly. However, the metrics crate does not pin exact versions of its dependencies, which can break our CI if a new alpha dependency is released with breaking changes. Fortunately the metrics crate only has a single metrics-* dependency, so we can just pin that as well. --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index dcbe5c8..27de33d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,6 +39,7 @@ subtle = "2.3" crossbeam-utils = "0.7" ff = "0.8" metrics = "=0.13.0-alpha.13" +metrics-macros = "=0.1.0-alpha.9" num_cpus = "1.13" rand = "0.7"