Conversation
| #[allow(unused_variables)] | ||
| #[no_mangle] | ||
| pub extern "C" fn syscall_bn254_scalar_mul(p: *mut u32, q: *const u32) { |
|
|
||
| #[allow(unused_variables)] | ||
| #[no_mangle] | ||
| pub extern "C" fn syscall_bn254_scalar_mac(ret: *mut u32, a: *const u32, b: *const u32) { |
There was a problem hiding this comment.
MAC means multiply-accumulate.
*ret += (*a)*(*b).
| fn num_extra_cycles(&self) -> u32 { | ||
| 1 | ||
| } |
There was a problem hiding this comment.
In offline memory check,
- each memory read operation will put one read record
(addr, value, prev_cycle)in the read set, one write record(addr, value, cycle)in the write set.prev_cycle < cycleis enforced. - each memory write operation will put one read record
(addr, prev_value, prev_cycle)in the read set, one write record(addr, value, cycle)in the write set.prev_cycle < cycleis also enforced.
If p == q, q is accessed in cycle; then p will be accessed in cycle+1.
| fn num_extra_cycles(&self) -> u32 { | ||
| 1 | ||
| } |
There was a problem hiding this comment.
- The address of scalar field element
ais located at q[0]; - The address of scalar field element
bis located at q[1];
We should return 3 as num_extra_cycles() because we read 4 times into memory as any of them can overlap with each other.
| channel: T, | ||
| nonce: T, | ||
| clk: T, | ||
| p_ptr: T, |
There was a problem hiding this comment.
p_ptr is the value in register X10. And q_ptr is the value in register X11.
| let a_ptr = arg2.0[0..4] | ||
| .iter() | ||
| .rev() | ||
| .cloned() | ||
| .map(|v| v.into()) | ||
| .fold(AB::Expr::zero(), |acc, b| acc * AB::Expr::from_canonical_u16(0x100) + b); |
There was a problem hiding this comment.
reconstruct the value of a_ptr from 4 bytes.
There was a problem hiding this comment.
warning: a[0] + a[1]*2^8 + a[2]*2^16 + a[3]*2^24 might overflow.
There was a problem hiding this comment.
We can use the BabyBearWordRangeChecker to ensure that a_ptr is always a valid baby bear word like CPU chip did for memory access opcodes.
|
|
||
| builder.eval_memory_access_slice( | ||
| local.shard, | ||
| local.clk.into(), |
There was a problem hiding this comment.
It should be clk + 3.
|
|
||
| builder.eval_memory_access_slice( | ||
| local.shard, | ||
| local.clk.into(), |
| builder.eval_memory_access_slice( | ||
| local.shard, | ||
| local.clk.into(), | ||
| local.arg2_ptr, | ||
| &local.arg2_access, | ||
| local.is_real, | ||
| ); |
|
|
||
| builder.eval_memory_access_slice( | ||
| local.shard, | ||
| local.clk.into(), |
There was a problem hiding this comment.
It should be clk + 2.
* hack pv digest into keccak * update verify part in pv
it is too difficult to keep history.. since upstream make a single huge commit with 20k lines of new codes.. for history, check #18
known issues
sp1/crates/core/machine/src/syscall/memcpy.rs
Line 179 in 700cdad
refactor
useless files, delete them?
features needed
WarpBn254forenum SP1Proof? convenient for our sp1-halo2 wrapper.