From 27b5e5dde3e2c0aefbe2898a94db98aa3b5e2b2b Mon Sep 17 00:00:00 2001 From: dante <45801863+alexander-camuto@users.noreply.github.com> Date: Tue, 28 Jan 2025 14:53:05 -0500 Subject: [PATCH] fix: make flushing err more informative (#919) --- Cargo.lock | 22 ++++++++++------------ Cargo.toml | 6 +----- src/bin/ezkl.rs | 6 +++++- src/lib.rs | 3 +++ src/tensor/var.rs | 4 +++- 5 files changed, 22 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 624c1410..064f466f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -1760,7 +1760,7 @@ checksum = "a650a461c6a8ff1ef205ed9a2ad56579309853fecefc2423f73dced342f92258" [[package]] name = "ecc" version = "0.1.0" -source = "git+https://github.com/zkonduit/halo2wrong?branch=ac/chunked-mv-lookup#b43ebe30e84825d0d004fa27803d99c4187d419f" +source = "git+https://github.com/zkonduit/halo2wrong?branch=ac%2Fchunked-mv-lookup#b43ebe30e84825d0d004fa27803d99c4187d419f" dependencies = [ "integer", "num-bigint", @@ -1968,13 +1968,11 @@ dependencies = [ "objc", "openssl", "pg_bigdecimal", - "portable-atomic", "pyo3", "pyo3-async-runtimes", "pyo3-log", "pyo3-stub-gen", "rand 0.8.5", - "regex", "reqwest", "semver 1.0.22", "seq-macro", @@ -2606,7 +2604,7 @@ dependencies = [ [[package]] name = "halo2wrong" version = "0.1.0" -source = "git+https://github.com/zkonduit/halo2wrong?branch=ac/chunked-mv-lookup#b43ebe30e84825d0d004fa27803d99c4187d419f" +source = "git+https://github.com/zkonduit/halo2wrong?branch=ac%2Fchunked-mv-lookup#b43ebe30e84825d0d004fa27803d99c4187d419f" dependencies = [ "halo2_proofs", "num-bigint", @@ -2957,7 +2955,7 @@ dependencies = [ [[package]] name = "integer" version = "0.1.0" -source = "git+https://github.com/zkonduit/halo2wrong?branch=ac/chunked-mv-lookup#b43ebe30e84825d0d004fa27803d99c4187d419f" +source = "git+https://github.com/zkonduit/halo2wrong?branch=ac%2Fchunked-mv-lookup#b43ebe30e84825d0d004fa27803d99c4187d419f" dependencies = [ "maingate", "num-bigint", @@ -3141,7 +3139,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -3268,7 +3266,7 @@ dependencies = [ [[package]] name = "maingate" version = "0.1.0" -source = "git+https://github.com/zkonduit/halo2wrong?branch=ac/chunked-mv-lookup#b43ebe30e84825d0d004fa27803d99c4187d419f" +source = "git+https://github.com/zkonduit/halo2wrong?branch=ac%2Fchunked-mv-lookup#b43ebe30e84825d0d004fa27803d99c4187d419f" dependencies = [ "halo2wrong", "num-bigint", @@ -3677,9 +3675,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "300.2.3+3.2.1" +version = "300.4.1+3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cff92b6f71555b61bb9315f7c64da3ca43d87531622120fea0195fc761b4843" +checksum = "faa4eac4138c62414b5622d1b31c5c304f34b406b013c079c2bbc652fdd6678c" dependencies = [ "cc", ] @@ -5232,7 +5230,7 @@ checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" [[package]] name = "snark-verifier" version = "0.1.1" -source = "git+https://github.com/zkonduit/snark-verifier?branch=ac/chunked-mv-lookup#8762701ab8fa04e7d243a346030afd85633ec970" +source = "git+https://github.com/zkonduit/snark-verifier?branch=ac%2Fchunked-mv-lookup#8762701ab8fa04e7d243a346030afd85633ec970" dependencies = [ "ecc", "halo2_proofs", @@ -6236,7 +6234,7 @@ dependencies = [ [[package]] name = "uniffi_testing" version = "0.28.0" -source = "git+https://github.com/ElusAegis/uniffi-rs?branch=feat/testing-feature-build-fix#4684b9e7da2d9c964c2b3a73883947aab7370a06" +source = "git+https://github.com/ElusAegis/uniffi-rs?branch=feat%2Ftesting-feature-build-fix#4684b9e7da2d9c964c2b3a73883947aab7370a06" dependencies = [ "anyhow", "camino", diff --git a/Cargo.toml b/Cargo.toml index 03409f29..fe810a98 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,6 @@ maybe-rayon = { version = "0.1.1", default-features = false } bincode = { version = "1.3.3", default-features = false } unzip-n = "0.1.2" num = "0.4.1" -portable-atomic = { version = "1.6.0", optional = true } tosubcommand = { git = "https://github.com/zkonduit/enum_to_subcommand", package = "tosubcommand", optional = true } semver = { version = "1.0.22", optional = true } @@ -74,7 +73,6 @@ tokio-postgres = { version = "0.7.10", optional = true } pg_bigdecimal = { version = "0.1.5", optional = true } lazy_static = { version = "1.4.0", optional = true } colored_json = { version = "3.0.1", default-features = false, optional = true } -regex = { version = "1", default-features = false, optional = true } tokio = { version = "1.35.0", default-features = false, features = [ "macros", "rt-multi-thread", @@ -244,16 +242,14 @@ ezkl = [ "dep:indicatif", "dep:gag", "dep:reqwest", - "dep:openssl", "dep:tokio-postgres", "dep:pg_bigdecimal", "dep:lazy_static", - "dep:regex", "dep:tokio", + "dep:openssl", "dep:mimalloc", "dep:chrono", "dep:sha256", - "dep:portable-atomic", "dep:clap_complete", "dep:halo2_solidity_verifier", "dep:semver", diff --git a/src/bin/ezkl.rs b/src/bin/ezkl.rs index 41d0a0fe..47026999 100644 --- a/src/bin/ezkl.rs +++ b/src/bin/ezkl.rs @@ -1,7 +1,11 @@ // ignore file if compiling for wasm + +#[cfg(all(feature = "ezkl", not(target_arch = "wasm32")))] +use mimalloc::MiMalloc; + #[global_allocator] #[cfg(all(feature = "ezkl", not(target_arch = "wasm32")))] -static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; +static GLOBAL: MiMalloc = MiMalloc; #[cfg(all(feature = "ezkl", not(target_arch = "wasm32")))] use clap::{CommandFactory, Parser}; diff --git a/src/lib.rs b/src/lib.rs index 38322182..5eb9536c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -29,6 +29,9 @@ //! A library for turning computational graphs, such as neural networks, into ZK-circuits. //! +#[cfg(all(feature = "ezkl", not(target_arch = "wasm32")))] +use mimalloc as _; + /// Error type // #[cfg_attr(not(feature = "ezkl"), derive(uniffi::Error))] #[derive(thiserror::Error, Debug)] diff --git a/src/tensor/var.rs b/src/tensor/var.rs index 85fb436d..79846e66 100644 --- a/src/tensor/var.rs +++ b/src/tensor/var.rs @@ -403,7 +403,9 @@ impl VarTensor { values: &ValTensor, ) -> Result { if values.len() > self.col_size() { - error!("Values are too large for the column"); + error!( + "There are too many values to flush for this column size, try setting the logrows to a higher value (eg. --logrows 22 on the cli)" + ); return Err(halo2_proofs::plonk::Error::Synthesis); }