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

Refactor R1CS struct to be generic on field #63

Merged
merged 16 commits into from
May 14, 2024
Merged

Refactor R1CS struct to be generic on field #63

merged 16 commits into from
May 14, 2024

Conversation

katat
Copy link
Collaborator

@katat katat commented May 10, 2024

No description provided.

pub enum BackendKind {
KimchiVesta(KimchiVesta),
R1CS(R1csBls12_381),
R1csBls12_381(R1CS<R1csBls12381Field>),
R1csBn128(R1CS<R1csBn128Field>),
Copy link
Contributor

Choose a reason for hiding this comment

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

should we call it bn254 everywhere? what's the most popular name :D?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

snarkjs calls it bn128 :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

maybe better with bn254 as the google results seem to prefer this one

Copy link
Contributor

@mimoo mimoo left a comment

Choose a reason for hiding this comment

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

btw we should update the README at some point ^^

constraints: Vec<Constraint>,
witness_vars: Vec<Value<R1csBls12_381>>,
constraints: Vec<Constraint<F>>,
witness_vars: Vec<Value<Self>>,
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we need #38 as some point to make Value<F>

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

maybe at the point when we are implementing the stdlib, so we can review the better way to handle Hint.

src/tests/examples.rs Outdated Show resolved Hide resolved
);
// verify proof
verifier_index.verify(full_public_inputs, proof)?;
println!("proof verified");
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe keep it unimplemented!() to not surprise anyone with a different behavior?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That makes sense as this run command is expected to generate circuit and witness files for r1cs, but it currently does inline proving and verifying for kimchi without generating anything. We may revisit this when it is needed to serialize the kimchi circuit and witness.

I updated it to keep unimplemented! for the kimchi backend for this command.

.public_outputs
.iter()
.map(|var| witness[var.index])
.collect();
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yeah! Indeed that is practical

src/backends/r1cs/mod.rs Outdated Show resolved Hide resolved
@katat katat merged commit 146b31a into main May 14, 2024
1 check passed
@katat katat deleted the generic/r1cs_ branch May 14, 2024 02:10
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