From 86d5cac6b02d60a4c346cde2dc5229ee1b715145 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Thu, 18 Jan 2024 19:46:37 +0000 Subject: [PATCH] Committer now takes a Vector of elements Co-authored-by: Dragan Pilipovic --- ipa-multipoint/src/committer.rs | 5 ++--- ipa-multipoint/src/main.rs | 4 +++- verkle-spec/src/lib.rs | 2 +- verkle-trie/src/config.rs | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ipa-multipoint/src/committer.rs b/ipa-multipoint/src/committer.rs index 5e6d2ce..032a222 100644 --- a/ipa-multipoint/src/committer.rs +++ b/ipa-multipoint/src/committer.rs @@ -22,15 +22,14 @@ pub trait Committer { } } -use crate::crs::CRS; #[derive(Clone, Debug)] pub struct DefaultCommitter { precomp: MSMPrecompWnaf, } impl DefaultCommitter { - pub fn new(crs: CRS) -> Self { - let precomp = MSMPrecompWnaf::new(&crs.G, 12); + pub fn new(points: &[Element]) -> Self { + let precomp = MSMPrecompWnaf::new(&points, 12); Self { precomp } } diff --git a/ipa-multipoint/src/main.rs b/ipa-multipoint/src/main.rs index 14c32ec..e59f998 100644 --- a/ipa-multipoint/src/main.rs +++ b/ipa-multipoint/src/main.rs @@ -7,7 +7,9 @@ fn main() { println!("Benchmarking Pedersen hashing..."); const N: usize = 5000; - let committer = DefaultCommitter::new(CRS::new(256, "eth_verkle_oct_2021".as_bytes())); + let crs = CRS::new(256, "eth_verkle_oct_2021".as_bytes()); + + let committer = DefaultCommitter::new(&crs.G); let mut vec_len = 1; while vec_len <= 256 { println!("\twith {} elements... ", vec_len); diff --git a/verkle-spec/src/lib.rs b/verkle-spec/src/lib.rs index cad678d..628ee1c 100644 --- a/verkle-spec/src/lib.rs +++ b/verkle-spec/src/lib.rs @@ -39,7 +39,7 @@ pub fn hash64(bytes64: [u8; 64]) -> H256 { // TODO: We should either make this a global or have it be passed in // TODO: so that we don't create a new crs each time - let committer = DefaultCommitter::new(new_crs()); + let committer = DefaultCommitter::new(&new_crs().G); let mut result = Element::zero(); let inputs = crate::util::chunk64(bytes64); diff --git a/verkle-trie/src/config.rs b/verkle-trie/src/config.rs index 64778fd..a146bd3 100644 --- a/verkle-trie/src/config.rs +++ b/verkle-trie/src/config.rs @@ -14,7 +14,7 @@ pub struct Config { pub type DefaultConfig = Config; impl DefaultConfig { pub fn new(db: Storage) -> Self { - let committer = DefaultCommitter::new(new_crs()); + let committer = DefaultCommitter::new(&new_crs().G); Config { db, committer } } }