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

feat: implement subarray equality check using RLC #189

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

NikolayKostadinov21
Copy link

No description provided.

@@ -268,6 +268,15 @@ impl<L: PlonkParameters<D>, const D: usize> CircuitBuilder<L, D> {
pub fn to_be_bits<V: EvmVariable>(&mut self, variable: V) -> Vec<BoolVariable> {
variable.to_be_bits(self)
}

/// Takes a slice of bits and returns the number with little-endian bit representation as a Variable
Copy link
Contributor

Choose a reason for hiding this comment

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

end sentence with period


/// Takes a slice of bits and returns the number with little-endian bit representation as a Variable
pub fn le_sum(&mut self, bits: &[BoolVariable]) -> Variable {
let bits_in_booltarget = bits
Copy link
Contributor

Choose a reason for hiding this comment

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

just call it let bits =

if a[a_offset + i] != b[b_offset + i] {
return 0;
impl<L: PlonkParameters<D>, const D: usize> CircuitBuilder<L, D> {
/// Generates a commitment for a subarray using RLC
Copy link
Contributor

Choose a reason for hiding this comment

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

add period to end

let mut is_within_subarray: Variable = self.zero();
let mut commitment = self.zero();

let _one: Variable = self.one();
Copy link
Contributor

Choose a reason for hiding this comment

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

let one, instead of let _one

builder.assert_subarray_equal(&a, a_offset, &b, b_offset, len);

let pw = PartialWitness::new();
let circuit = builder.build();
Copy link
Contributor

Choose a reason for hiding this comment

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

can you make this use circuit.inputs() and circuit.prove()?


let pw = PartialWitness::new();
let circuit = builder.build();
let proof = circuit.data.prove(pw).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment here!

@jtguibas
Copy link
Contributor

@NikolayKostadinov21 Overall, looks like a solid implementation of the subarray equality check. I'll take a closer look at the actual RLC implementation and make sure the logic looks correct in a bit.

In the meantime, it would be great if you could address the comments I left on the PR!

@jtguibas jtguibas changed the title Implement subarray equality check using RLC feat: implement subarray equality check using RLC Sep 22, 2023
@Xearty Xearty force-pushed the rlp-todos/subarray_equal branch from f77d751 to 7dc11d8 Compare October 3, 2023 07:48
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.

4 participants