-
Notifications
You must be signed in to change notification settings - Fork 71
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
base: main
Are you sure you want to change the base?
feat: implement subarray equality check using RLC #189
Conversation
plonky2x/src/frontend/builder/mod.rs
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end sentence with period
plonky2x/src/frontend/builder/mod.rs
Outdated
|
||
/// 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 |
There was a problem hiding this comment.
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 =
plonky2x/src/frontend/eth/mpt/rlc.rs
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add period to end
plonky2x/src/frontend/eth/mpt/rlc.rs
Outdated
let mut is_within_subarray: Variable = self.zero(); | ||
let mut commitment = self.zero(); | ||
|
||
let _one: Variable = self.one(); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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()?
plonky2x/src/frontend/eth/mpt/rlc.rs
Outdated
|
||
let pw = PartialWitness::new(); | ||
let circuit = builder.build(); | ||
let proof = circuit.data.prove(pw).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment here!
@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! |
f77d751
to
7dc11d8
Compare
No description provided.