-
Notifications
You must be signed in to change notification settings - Fork 21
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
bn254_syscalls #828
bn254_syscalls #828
Conversation
55df130
to
fbf16d3
Compare
fbf16d3
to
a2f3d4e
Compare
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.
Great!
See start_addr
comment.
WriteMEM::construct_circuit( | ||
cb, | ||
start_addr.expr() + (i * WORD_SIZE) as u64, |
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.
The witness start_address
could be removed, right?
bn254_fp2_add_config: | ||
<LargeEcallDummy<E, Bn254Fp2AddSpec> as Instruction<E>>::InstructionConfig, | ||
bn254_fp2_mul_config: | ||
<LargeEcallDummy<E, Bn254Fp2MulSpec> as Instruction<E>>::InstructionConfig, |
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.
Note: Eventually the ecall circuit can be adapted to have a single circuit for all ecalls, or one circuit per common shape of arguments (1 or 2 pointers). That will be more efficient to verify.
(Not for this PR)
@@ -59,15 +58,15 @@ impl<E: ExtensionField, S: SyscallSpec> Instruction<E> for LargeEcallDummy<E, S> | |||
.map(|i| { | |||
let val_before = cb.create_witin(|| format!("mem_before_{}", i)); | |||
let val_after = cb.create_witin(|| format!("mem_after_{}", i)); | |||
|
|||
let addr = cb.create_witin(|| format!("addr_{}", i)); |
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.
In principle it could also be two witnesses for the two pointer arguments (e.g. p
and q
) and then the consecutive addresses of each one.
(Not required in this PR)
|
||
fn main() { | ||
let log_flag = true; | ||
let log_state = |state: &[u32]| { |
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.
Cool technique.
F: From<[Word; WORDS]> | ||
+ Into<[Word; WORDS]> | ||
+ std::ops::Add<Output = F> | ||
+ std::ops::Mul<Output = 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.
Nice factoring.
Adds interface for precompiles pertaining to the
bn254
elliptic curve. Mostly follows the structure of the existing precompiles.Caveats:
ecall
circuit to accept arbitrary memory addresses, as opposed to consecutive addresses as it does now. As discussed with @naure, this requires more attention; but I think the review can happen in parallel