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

The snark proof with separate public inputs file #31

Merged
merged 77 commits into from
Oct 29, 2024

Conversation

gavin-ygy
Copy link
Contributor

No description provided.

}

fn replace_public_inputs(public_inputstream: Vec<u8>, proof_public_inputs: &Vec<u8>) -> bool {
let output_dir = "../contracts/verifier".to_string();
Copy link
Member

Choose a reason for hiding this comment

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

Can we remove the hardcoding here? make sure each function does one thing. This function just calculates the Snark public input, you should do this only.

if !replace_public_inputs(input.public_inputstream, &prover_result.public_values) {
log::info!("public_inputs check false.");
return Err("public_inputs check false.".into());
}
//contract
let output_dir = "../contracts/src".to_string();
Copy link
Member

Choose a reason for hiding this comment

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

Never use the relative path in a binary. Make sure the user know the input/output path explicitly.

@@ -220,9 +231,9 @@ impl Data {

fn set_sha2_go_input(seg_size_u: u32, execute_only_b: bool) -> anyhow::Result<ProverInput> {
let elf_path = env::var("ELF_PATH").expect("ELF PATH is missed");
let args = env::var("ARGS").unwrap_or("data-to-hash".to_string());
Copy link
Member

Choose a reason for hiding this comment

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

if you have a function, which receives argments, but also read environment, how does people know which paths to pass the parameters??

Copy link
Member

Choose a reason for hiding this comment

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

Never read the ENV in an intermediate function.

let input = ProverInput {
elf: read(elf_path).unwrap(),
public_inputstream: "".into(),
public_inputstream: "0".into(),
Copy link
Member

@eigmax eigmax Oct 28, 2024

Choose a reason for hiding this comment

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

This should be explained. Why you fill in a "0" and how it should be solved in the future.

sdk/README.md Outdated

## Use the libsnark

1. The compile.sh in the path sdk/src/local/libsnark only supports X86_64 linux.
Copy link
Member

Choose a reason for hiding this comment

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

We can support in MacOS, but only via Docker.

README.md Outdated
> 3. There are three guest programs(sha2-rust, sha2-go, mem-alloc-vec), each capable of generating a SNARK proof on a machine
equipped with an AMD EPYC 7R13 processor and 250GB of memory. The following will use sha2-rust as an example to demonstrate local and network proofs.
> 3. There are four guest programs(sha2-rust, sha2-go, mem-alloc-vec,revme), each capable of generating a SNARK proof on a machine
equipped with an AMD EPYC 7R13 processor and 246GB of memory. The following will use sha2-rust and revme as an example to demonstrate local and network proofs.
Copy link
Member

Choose a reason for hiding this comment

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

Why should we tell people this ??

Copy link
Member

Choose a reason for hiding this comment

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

We may scale to any server

README.md Outdated
#### Generating the public input about a specific block

> [!NOTE]
> The local node is the [GOAT](https://goat.network) test chain in the following example. You must use the Eth-Compatible local node.
Copy link
Member

Choose a reason for hiding this comment

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

Why are you able to connect the localhost as the GOAT ?????

let input = ProverInput {
elf: read(elf_path).unwrap(),
public_inputstream: "".into(),
public_inputstream: "0".into(), //if the public input is empty, please using "0"
Copy link
Member

Choose a reason for hiding this comment

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

if we change this asset back to the old one, allowing the size less than or equal to 32, we can use an empty public input. https://github.com/zkMIPS/zkm/blob/415b293dcf59bf9c09a3ff602259f13cfc51395c/prover/src/generation/mod.rs#L55 Plz help check this.

@eigmax eigmax merged commit 63a2270 into zkMIPS:main Oct 29, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants