From 85cb77b171ce3ee493628007c7a1cfae2ea878e6 Mon Sep 17 00:00:00 2001 From: Han Date: Tue, 2 Jan 2024 14:07:57 +0800 Subject: [PATCH] Avoid ambiguous and reduce dependnecy (#11) * refactor: avoid ambiguous and reduce dependnecy * ci: fix * fix: clippy --- .github/workflows/ci.yml | 2 +- Cargo.toml | 4 ++-- examples/separately.rs | 2 +- src/codegen.rs | 2 +- templates/Halo2Verifier.sol | 3 +-- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 03e508c..5146421 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: cache-on-failure: true - name: Install solc - run: (hash svm 2>/dev/null || cargo install --locked --git https://github.com/alloy-rs/svm-rs) && svm install 0.8.21 && solc --version + run: (hash svm 2>/dev/null || cargo install svm-rs) && svm install 0.8.21 && solc --version - name: Run test run: cargo test --workspace --all-features --all-targets -- --nocapture diff --git a/Cargo.toml b/Cargo.toml index 8106040..affc3f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,11 +15,11 @@ itertools = "0.11.0" blake2b_simd = "1" # For feature = "evm" -revm = { version = "3.3.0", optional = true } +revm = { version = "3.3.0", default-features = false, optional = true } [dev-dependencies] rand = "0.8.5" -revm = "3.3.0" +revm = { version = "3.3.0", default-features = false } halo2_maingate = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", tag = "v2023_04_20", package = "maingate" } [features] diff --git a/examples/separately.rs b/examples/separately.rs index d748332..b2e58c5 100644 --- a/examples/separately.rs +++ b/examples/separately.rs @@ -223,7 +223,7 @@ mod prelude { ff::PrimeField, }, plonk::*, - poly::{commitment::Params, kzg::commitment::ParamsKZG, Rotation}, + poly::{kzg::commitment::ParamsKZG, Rotation}, }; pub use rand::{ rngs::{OsRng, StdRng}, diff --git a/src/codegen.rs b/src/codegen.rs index 30d93a6..d950c27 100644 --- a/src/codegen.rs +++ b/src/codegen.rs @@ -176,7 +176,7 @@ impl<'a> SolidityGenerator<'a> { let l = self.meta.rotation_last.unsigned_abs() as u64; fr_to_u256(domain.get_omega_inv().pow_vartime([l])) }; - let has_accumulator = U256::from(self.acc_encoding.is_some()); + let has_accumulator = U256::from(self.acc_encoding.is_some() as usize); let acc_offset = self .acc_encoding .map(|acc_encoding| U256::from(acc_encoding.offset)) diff --git a/templates/Halo2Verifier.sol b/templates/Halo2Verifier.sol index 505d58a..7abfb0b 100644 --- a/templates/Halo2Verifier.sol +++ b/templates/Halo2Verifier.sol @@ -262,7 +262,6 @@ contract Halo2Verifier { let proof_cptr := PROOF_CPTR let challenge_mptr := CHALLENGE_MPTR {%- for num_advices in num_advices %} - {%- let num_challenges = num_challenges[loop.index0] %} // Phase {{ loop.index }} for @@ -274,7 +273,7 @@ contract Halo2Verifier { } challenge_mptr, hash_mptr := squeeze_challenge(challenge_mptr, hash_mptr, r) - {%- for _ in 0..num_challenges - 1 %} + {%- for _ in 0..num_challenges[loop.index0] - 1 %} challenge_mptr := squeeze_challenge_cont(challenge_mptr, r) {%- endfor %} {%- endfor %}