Skip to content

Commit

Permalink
Committer now takes a Vector of elements
Browse files Browse the repository at this point in the history
Co-authored-by: Dragan Pilipovic  <[email protected]>
  • Loading branch information
kevaundray and dragan2234 committed Jan 18, 2024
1 parent ce21789 commit 86d5cac
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
5 changes: 2 additions & 3 deletions ipa-multipoint/src/committer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Check failure on line 32 in ipa-multipoint/src/committer.rs

View workflow job for this annotation

GitHub Actions / Lints

this expression creates a reference which is immediately dereferenced by the compiler

Self { precomp }
}
Expand Down
4 changes: 3 additions & 1 deletion ipa-multipoint/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion verkle-spec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion verkle-trie/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct Config<Storage, PolyCommit> {
pub type DefaultConfig<Storage> = Config<Storage, DefaultCommitter>;
impl<Storage> DefaultConfig<Storage> {
pub fn new(db: Storage) -> Self {
let committer = DefaultCommitter::new(new_crs());
let committer = DefaultCommitter::new(&new_crs().G);
Config { db, committer }
}
}
Expand Down

0 comments on commit 86d5cac

Please sign in to comment.