Skip to content

Conversation

@kunxian-xia
Copy link
Collaborator

@kunxian-xia kunxian-xia commented Sep 8, 2025

Summary

Sub tasks

@kunxian-xia kunxian-xia marked this pull request as draft September 8, 2025 13:51
@kunxian-xia kunxian-xia linked an issue Sep 9, 2025 that may be closed by this pull request
@kunxian-xia kunxian-xia changed the base branch from master to feat/multi_shard October 27, 2025 02:04
Copy link
Collaborator

@hero78119 hero78119 left a 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>,
Copy link
Collaborator

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,
}

Copy link
Collaborator Author

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}");
Copy link
Collaborator

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
Copy link
Collaborator

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

@kunxian-xia kunxian-xia marked this pull request as ready for review October 28, 2025 04:03
assert_eq!(xs.len(), 7);
assert_eq!(ys.len(), 7);
assert_eq!(slopes.len(), 7);
assert_eq!(final_sum.len(), 7 * 2);
Copy link
Collaborator

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");
Copy link
Collaborator

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
Copy link
Collaborator

@hero78119 hero78119 Oct 29, 2025

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");
Copy link
Collaborator

@hero78119 hero78119 Oct 29, 2025

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)
Copy link
Collaborator

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);
Copy link
Collaborator

@hero78119 hero78119 Oct 29, 2025

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 {
Copy link
Collaborator

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

https://github.com/Plonky3/Plonky3/blob/658115aae28312e97cd3ef38d1ab046839f734a8/challenger/src/grinding_challenger.rs#L56-L62

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.

feat: split timestamp into shard, clk

3 participants