From 124f3c68577ee548d73da0a54248ec83714f8831 Mon Sep 17 00:00:00 2001 From: Han Date: Wed, 4 Oct 2023 07:48:58 +0800 Subject: [PATCH] Run `solc` with flag `--optimize` (#3) * feat: use `--optimize` instead of `--via-ir` to remove extra inline modulus * doc: update `README.md` * fix: use `.into` from `Address` to `[u8; 20]` --- README.md | 3 +-- examples/separately.rs | 2 +- src/evm.rs | 2 +- src/test.rs | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2ec93b6..5152dfd 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,7 @@ Note that function selector is already included. ## Limitations - It only allows circuit with **exact 1 instance column** and **no rotated query to this instance column**. -- Option `--via-ir` seems necessary when compiling the generated contract, otherwise it'd cause stack too deep error. However, `--via-ir` is not allowed to be used with `--standard-json`, not sure how to work around this yet. -- Even the `configure` is same, the [selector compression](https://github.com/privacy-scaling-explorations/halo2/blob/7a2165617195d8baa422ca7b2b364cef02380390/halo2_proofs/src/plonk/circuit/compress_selectors.rs#L51) might lead to different configuration when selector assignments are different. To avoid this we might need to update halo2 to support disabling selector compression. +- Currently even the `configure` is same, the [selector compression](https://github.com/privacy-scaling-explorations/halo2/blob/7a2165617195d8baa422ca7b2b364cef02380390/halo2_proofs/src/plonk/circuit/compress_selectors.rs#L51) might lead to different configuration when selector assignments are different. After PR https://github.com/privacy-scaling-explorations/halo2/pull/212 is merged we will have an alternative API to do key generation without selector compression. - Now it only supports BDFG21 batch open scheme (aka SHPLONK), GWC19 is not yet implemented. ## Compatibility diff --git a/examples/separately.rs b/examples/separately.rs index 5a4f9a5..d748332 100644 --- a/examples/separately.rs +++ b/examples/separately.rs @@ -45,7 +45,7 @@ fn main() { let calldata = { let instances = circuit.instances(); let proof = create_proof_checked(¶ms[&k], &pk, circuit, &instances, &mut rng); - encode_calldata(vk_address.0.into(), &proof, &instances) + encode_calldata(Some(vk_address.into()), &proof, &instances) }; let (gas_cost, output) = evm.call(verifier_address, calldata); assert_eq!(output, [vec![0; 31], vec![1]].concat()); diff --git a/src/evm.rs b/src/evm.rs index e67594e..c442694 100644 --- a/src/evm.rs +++ b/src/evm.rs @@ -69,7 +69,7 @@ pub(crate) mod test { .stdout(Stdio::piped()) .stderr(Stdio::piped()) .arg("--bin") - .arg("--via-ir") + .arg("--optimize") .arg("-") .spawn() { diff --git a/src/test.rs b/src/test.rs index 416664a..fb31148 100644 --- a/src/test.rs +++ b/src/test.rs @@ -102,7 +102,7 @@ fn run_render_separately>() { let (gas_cost, output) = evm.call( verifier_address, - encode_calldata(vk_address.0.into(), &proof, &instances), + encode_calldata(Some(vk_address.into()), &proof, &instances), ); assert_eq!(output, [vec![0; 31], vec![1]].concat()); println!("Gas cost: {gas_cost}");