-
Couldn't load subscription status.
- Fork 39
Feat: septic curve based continuation #1061
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
base: feat/multi_shard
Are you sure you want to change the base?
Conversation
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.
1st quick review pass, without reviewing global chip in detail
| /// 2. The curve's order is a large prime number of 31x7 bits | ||
| #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | ||
| pub struct SepticPoint<F> { | ||
| pub x: SepticExtension<F>, |
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.
a tiny question: it seems SepticExtension extension field is also a field, so in future both could be define separately?, e.g.
pub struct SepticPoint<F, E<BaseField = F>> {
pub x: E,
pub y: E,
}
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.
yeah, this should work.
| // to store the internal partial sums for ecc additions | ||
| log2_num_instances += 1; | ||
| } | ||
| println!("{log2_num_instances}"); |
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.
nitpicks: leftover
| vm.get_pc().into(), | ||
| end_cycle, | ||
| io_init.iter().map(|rec| rec.value).collect_vec(), | ||
| vec![0; 14], // point_at_infinity |
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.
nitpick: SEPTIC_EXTENSION_DEGREE * 2 better than hardcode
| assert_eq!(xs.len(), 7); | ||
| assert_eq!(ys.len(), 7); | ||
| assert_eq!(slopes.len(), 7); | ||
| assert_eq!(final_sum.len(), 7 * 2); |
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.
nitpicks: replace with SEPTIC_EXTENSION_DEGREE
| .map(|i| cb.create_witin(|| format!("slope{}", i))) | ||
| .collect(); | ||
| let addr = cb.create_witin(|| "addr"); | ||
| let is_ram_register = cb.create_witin(|| "is_ram_register"); |
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.
it seems there missing assert_bit on is_ram_register
| 1 - is_global_write.expr(), | ||
| local_clk.expr(), | ||
| )?; | ||
| // TODO: enforce shard = shard_id in the public values |
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.
there is api cb.query_shard_id() and we need below constrian
- if is_global_write == 0, then assert_lt(global_clk, cb.query_shard_id())
- if is_global_write == 1, then assert_eq(global_clk, cb.query_shard_id())
| let addr = cb.create_witin(|| "addr"); | ||
| let is_ram_register = cb.create_witin(|| "is_ram_register"); | ||
| let value = UInt::new(|| "value", cb)?; | ||
| let shard = cb.create_witin(|| "shard"); |
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.
follow comments here #1061 (comment)
we can remove shard and just keep global_clk
| let n = next_pow2_instance_padding(steps.len()); | ||
| // compute the input for the binary tree for ec point summation | ||
| steps | ||
| .par_chunks_mut(num_instance_per_batch) |
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.
chores: we can combine this into line 506 so steps only need to traverse once
| .collect_vec() | ||
| }; | ||
| // build x[b,0], x[b,1], y[b,0], y[b,1] | ||
| let mut x0 = filter_bj(&xs, 0); |
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.
suggestion: will be nice to add TODO for define new api split_to_owned_even_odd in SmartSlice so we can use it like as_view_slice
| ]; | ||
|
|
||
| let prime = E::BaseField::order().to_u64_digits()[0]; | ||
| loop { |
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.
An improvement: we can do parallel search + find_any just like plonk3 grinding api
Summary
Sub tasks
cmd:
cargo test --release --lib test_ecc_quark_prover --features "sanity-check" -- --nocaptureGlobalchip @kunxian-xiasum != p[0] + p[1]LocalFinalizechip continuation of multi-shard + ram bus #1084