Skip to content

Commit

Permalink
Run solc with flag --optimize (#3)
Browse files Browse the repository at this point in the history
* feat: use `--optimize` instead of `--via-ir` to remove extra inline modulus

* doc: update `README.md`

* fix: use `.into` from `Address` to `[u8; 20]`
  • Loading branch information
han0110 authored Oct 3, 2023
1 parent ab4e36b commit 124f3c6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/separately.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fn main() {
let calldata = {
let instances = circuit.instances();
let proof = create_proof_checked(&params[&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());
Expand Down
2 changes: 1 addition & 1 deletion src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub(crate) mod test {
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.arg("--bin")
.arg("--via-ir")
.arg("--optimize")
.arg("-")
.spawn()
{
Expand Down
2 changes: 1 addition & 1 deletion src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ fn run_render_separately<C: halo2::TestCircuit<Fr>>() {

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}");
Expand Down

0 comments on commit 124f3c6

Please sign in to comment.