-
Notifications
You must be signed in to change notification settings - Fork 59
feat: Macro define_verify_openvm_stark #1620
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
Conversation
c316819
to
3d10170
Compare
This comment has been minimized.
This comment has been minimized.
3d10170
to
1402e28
Compare
f214f43
to
c1829fc
Compare
1402e28
to
78f0f29
Compare
This comment has been minimized.
This comment has been minimized.
78f0f29
to
fd2cc4d
Compare
This comment has been minimized.
This comment has been minimized.
fd2cc4d
to
25061e4
Compare
This comment has been minimized.
This comment has been minimized.
906e765
to
e56163d
Compare
25061e4
to
d946854
Compare
This comment has been minimized.
This comment has been minimized.
d946854
to
70a005c
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
a9d152f
to
7b2dd5c
Compare
This comment has been minimized.
This comment has been minimized.
docs/specs/RISCV.md
Outdated
@@ -72,6 +72,10 @@ the guest must take care to validate all data and account for behavior in cases | |||
| printstr | I | 0001011 | 011 | 0x1 | Tries to convert `[rd..rd + rs1]_2` to UTF-8 string and print to host stdout. Will print error message if conversion fails. | | |||
| hintrandom | I | 0001011 | 011 | 0x2 | Resets the hint stream to `4 * rd` random bytes from `rand::rngs::OsRng` on the host. | | |||
|
|||
| RISC-V Inst | FMT | opcode[6:0] | funct3 | funct7 | RISC-V description and notes | | |||
|--------------|-----|-------------|---------|---------|---------------------------------------------------------------------------------------------------------------------------------| | |||
| nativestorew | R | 0001011 | 111 | 2 | Stores the 4-byte word `rs1` at address `rd` in native address space. The address `rd` must be aligned to a 4-byte boundary. | |
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.
| nativestorew | R | 0001011 | 111 | 2 | Stores the 4-byte word `rs1` at address `rd` in native address space. The address `rd` must be aligned to a 4-byte boundary. | | |
| nativestorew | R | 0001011 | 111 | 0x2 | Stores the 4-byte word `rs1` at address `rd` in native address space. The address `rd` must be aligned to a 4-byte boundary. | |
nit: for consistency
(RV32_REGISTER_NUM_LIMBS * dec_insn.rs1) as isize, | ||
(RV32_REGISTER_NUM_LIMBS * dec_insn.rd) as isize, | ||
0, | ||
1, |
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.
do we have constant for this addr space?
.map(|x| x as u32) | ||
.collect(); | ||
|
||
let key = ASM_FILENAME |
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.
why is the filename part of the key?
and if it is part of the key, why the base filename and not the full path?
/// little-endian bytes. | ||
#[macro_export] | ||
macro_rules! define_verify_openvm_stark { | ||
($fn_name: ident, $asm_folder: expr, $asm_filename: literal) => { |
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.
why the separation between folder vs filename?
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.
Well I didn't figure out how to split a constant string in macro at compile time
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.
I meant why did you need the key to just be the filename
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.
Ah it's more friendly to add inputs into key-value store. "/usr/abc/xxx/verifier.asm" is much more weird than "verifier.asm"...
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.
LGTM except that the key calculation should be moved into a function.
Either in this PR or another, let's move the macro into a dedicated crate as we discussed.
b10d91f
to
d7a1322
Compare
7b2dd5c
to
e539dd3
Compare
This comment has been minimized.
This comment has been minimized.
e539dd3
to
66d85df
Compare
Commit: 66d85df |
- Add a RISC-V custom instruction `nativestorew` into `Rv32IoTranspilerExtension`. - Add macro `define_verify_openvm_stark`, which can define a function for guest program to verify a stark proof. closes INT-3896
- Add a RISC-V custom instruction `nativestorew` into `Rv32IoTranspilerExtension`. - Add macro `define_verify_openvm_stark`, which can define a function for guest program to verify a stark proof. closes INT-3896
nativestorew
intoRv32IoTranspilerExtension
.define_verify_openvm_stark
, which can define a function for guest program to verify a stark proof.closes INT-3896