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

A simple GM Halo2 circuit for testing #17

Closed
wants to merge 27 commits into from
Closed

Conversation

0xisk
Copy link
Collaborator

@0xisk 0xisk commented Aug 6, 2024

Changes in this PR:

  1. Fork a version from the origin impl of GM encryption (https://github.com/crodriguezvega/probabilisticpubkey) and update it's dependence's versions.
  2. Impl a simple halo2 circuit using halo2-lib and halo2-wasm.

@0xisk 0xisk changed the title Feature/halo2 gm circuit A simple GM Halo2 circuit for testing Aug 7, 2024
@0xisk 0xisk requested a review from ndrwnaguib August 7, 2024 14:50
@0xisk 0xisk force-pushed the feature/halo2-gm-circuit branch from 126be94 to cb6f0b8 Compare August 8, 2024 10:10
@0xisk 0xisk self-assigned this Aug 8, 2024
Copy link
Owner

@ndrwnaguib ndrwnaguib left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @0xisk. The PR looks good to me, I left a few comments. Also, would it be better if we add probabilistic-encryption as a submodule instead since we are not modifying the code in anyway?

.vscode/settings.json Outdated Show resolved Hide resolved
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments on how these constants were chosen would be useful.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the default values commonly used in various Halo2 examples. However, I plan to add a detailed explanation of how these values are chosen next week. I'm currently benchmarking another Halo2 project, which will provide deeper insights into the rationale behind these selections.

Comment on lines 148 to 172
// #[test]
// fn test_gm_encryption_mock() -> Result<()> {
// let path = "configs/gm_encryption.config";
// let circuit_params: CircuitConfig = serde_json::from_reader(
// File::open(path)
// .map_err(|e| anyhow!(e))
// .with_context(|| format!("The circuit config file does not exist: {}", path))?,
// )
// .map_err(|e| anyhow!(e))
// .with_context(|| format!("Failed to read the circuit config file: {}", path))?;

// let gm_verification_inputs = mock_gm_encryption()?;

// let mut halo2_wasm = Halo2Wasm::new();

// halo2_wasm.config(circuit_params);

// let mut circuit = GmVerificationCircuit::new(&halo2_wasm, gm_verification_inputs);

// circuit.verify_encryption();

// halo2_wasm.mock();

// Ok(())
// }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This snippet seems to be the same as the one above it? Was it left by mistake or we are keeping it for a reason?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it wasn't left by mistake, I was thinking how to get this test successful at the end as the expected constraint is that the expected_cipher is not equal to the actual_cipher. But I didn't find a way for doing such a constraint yet. So I will remove this test unit for now.

@0xisk
Copy link
Collaborator Author

0xisk commented Aug 18, 2024

Thank you @0xisk. The PR looks good to me, I left a few comments. Also, would it be better if we add probabilistic-encryption as a submodule instead since we are not modifying the code in anyway?

I would keep this forked version, because the original version is outdated. Some of the packages have conflicts like num-big so in the forked version I updated the dependencies.

@ndrwnaguib ndrwnaguib force-pushed the feature/halo2-gm-circuit branch from 58f6bfb to fbc397a Compare August 27, 2024 14:16
@ndrwnaguib
Copy link
Owner

@0xisk As we have just decided during the meeting, would it be possible to export the changes as a patch file and add probabilistic-encryption as a submodule to which we apply the patch file after recursively cloning the this repo.

@0xisk
Copy link
Collaborator Author

0xisk commented Sep 16, 2024

@0xisk As we have just decided during the meeting, would it be possible to export the changes as a patch file and add probabilistic-encryption as a submodule to which we apply the patch file after recursively cloning the this repo.

@ndrwnaguib I have pushed the changes into a patch file, also have updated the README docs for dealing with submodules.

@0xisk 0xisk requested a review from ndrwnaguib September 16, 2024 10:07
@0xisk
Copy link
Collaborator Author

0xisk commented Sep 19, 2024

@ndrwnaguib I have updated the README, just added a simple project description. But imo I think it worth adding all your written doc in https://ndrwnaguib.com/zk-auctions/ in the README, I think it is easy to generate markdown out of it.

@0xisk
Copy link
Collaborator Author

0xisk commented Nov 7, 2024

After team discussions, we've decided to switch from Halo2 to Risc0. That is because at the moment it seems to us the most ready one and it provides good proving experience (runnable on laptops), and verifying experience (blockchain integration use groth16, same as circom). (@ndrwnaguib)

@0xisk 0xisk closed this Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants