Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install (+run) halo2-analyzer #12

Open
teddav opened this issue Feb 22, 2024 · 8 comments
Open

Install (+run) halo2-analyzer #12

teddav opened this issue Feb 22, 2024 · 8 comments

Comments

@teddav
Copy link
Collaborator

teddav commented Feb 22, 2024

Halo2-analyzer seems like a good start to analyse an halo2 circuit. It's a bit annoying to install. Here are the steps I had to take on an x64 with Ubuntu 23.04.

  • First install cadical
git clone https://github.com/arminbiere/cadical.git
cd cadical
./configure
make
  • then cvc5
git clone https://github.com/cvc5/cvc5
cd cvc5
./configure.sh --auto-download
cd build
make
make check
  • and finally halo2-analyzer should run
    you just need nightly rust
rustup install nightly
cargo +nightly run

if you want to enable PSE:

cargo +nightly run --features use_pse_halo2_proofs

Unfortunately it has not been updated for the latest PSE fork.
@zeroqn and @rkdud007 have made the changes based on this repo: https://github.com/Analyzable-Halo2/pse-halo2
see here: https://gist.github.com/zeroqn/5453bd86876e6272f75ed8540fa37101
Here's the final code: summa halo2 analyzer

If anyone manages to run it, maybe comment on this issue.

@teddav
Copy link
Collaborator Author

teddav commented Feb 22, 2024

Alright that was fast... I managed to run it. I just had to install an extra dependency:

apt-get install -y libclang-dev
cargo +nightly run

I'll look at the output tomorrow morning

@0xpanicError
Copy link
Collaborator

I ran it and saw a bunch of unconstrained cell errors like

unconstrained cell in "assign entry username" region: Column { index: 0, column_type: Advice } (rotation: 0) -- very likely a bug.
unconstrained cell in "assign entry balance" region: Column { index: 1, column_type: Advice } (rotation: 0) -- very likely a bug.
unconstrained cell in "initial state for domain ConstantLength<3>" region: Column { index: 1, column_type: Advice } (rotation: 0) -- very likely a bug.
unconstrained cell in "assign value to perform range check" region: Column { index: 0, column_type: Advice } (rotation: 0) -- very likely a bug.
and many more ...

To be precise Finished analysis: 3566 unconstrained cells found.

Doing manual review to see if there are any bugs. Would love inputs if someone else finds something.

@thogiti
Copy link
Collaborator

thogiti commented Feb 22, 2024

It is quite common with these tools to get a ton of false positives. When I ran the Circom based tools, it is the same outcome. It outputs a ton of false positives.

@teddav
Copy link
Collaborator Author

teddav commented Feb 23, 2024

Yes @0xpanicError I had the same. Lot's of false positives it seems. Maybe there is a real issue in there but I can't see it 😁

@sachindkagrawal15
Copy link
Collaborator

I was able to run . Please find below the observations for different options :

  1. Unused Gates

unused gate: "partial rounds" (consider removing the gate or checking selectors in regions)
unused gate: "partial rounds" (consider removing the gate or checking selectors in regions)

@sachindkagrawal15
Copy link
Collaborator

  1. Unused Columns

Finished analysis: 0 unused columns found.

@sachindkagrawal15
Copy link
Collaborator

  1. Unconstrained Cells
    Finished analysis: 3566 unconstrained cells found.
    Detailed pdf reported attached
    unconstrained cells observations.pdf

@sachindkagrawal15
Copy link
Collaborator

sachindkagrawal15 commented Feb 26, 2024

  1. Underconstrained Circuit
    Received below prompt
    You can verify the circuit for a specific public input or a random number of public inputs:
  1. verify the circuit for a specific public input!
  2. Verify for a random number of public inputs!

Selected 2

2
How many random public inputs you want to verify?

Entered 4
Received below error :
How many random public inputs you want to verify?
4

thread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /Users/sachindagrawal/Documents/summa-analysis/korrekt/src/circuit_analyzer/analyzer.rs:1093:27
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants