-
Notifications
You must be signed in to change notification settings - Fork 174
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
Introduce Emit
instruction
#1496
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.
Looks good! Thank you! I left a few small comments inline.
core/src/operations/mod.rs
Outdated
pub const OPCODE_EMIT: u8 = 0b0101_1010; | ||
|
||
pub const OPCODE_MRUPDATE: u8 = 0b0110_0000; | ||
pub const OPCODE_PUSH: u8 = 0b0110_0100; |
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.
Unless it causes some complications, I'd probably still move the PUSH
opcode to be immediately after the EMIT
opcode (e.g., be 0b0101_1011
). Not only would this lower the degree of PUSH
/EMIT
flags.
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.
Moved PUSH to 0b0101_1011
.
this lower the degree of
$f_{imm}$ flag,
The degree doesn't change though right? Since now both f_emit
and f_push
are degree 5.
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 think by virtue of having a common prefix and differing only in the first bit, the flags when added together will cause the last bit to cancel out, something like SPLIT
and LOOP
.
One thing that I just remembered, reductions in degree like these (or sometimes even more complex) can cause the constraint evaluation logic related to flags to result in the wrong evaluations. This happened a while back and took some time to debug.
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.
Yup that makes sense, very interesting.
6ca48d9
to
0701221
Compare
0701221
to
44e69f5
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.
> $$ | ||
sp \cdot \Delta gc \cdot (1 - f_{push})\cdot h_0 = 0 \text{ | degree} = 7 | ||
sp \cdot \Delta gc \cdot (1 - f_{imm})\cdot h_0 = 0 \text{ | degree} = 8 | ||
$$ |
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.
If we change the PUSH
opcode as described in #1496 (comment), the degree here would remain the same.
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.
As commented above, I believe this remains the same, since f_imm
is still degree 5
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.
Brought back to degree 7
45ce154
to
25b8a5c
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.
Looks good! Thank you! I left a few comments inline - but they are all pretty small (most are doc-related).
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.
Looks good to me, thank you!
assembly/src/assembler/tests.rs
Outdated
@@ -158,6 +161,40 @@ fn nested_blocks() -> Result<(), Report> { | |||
Ok(()) | |||
} | |||
|
|||
/// Ensures that the arguments of `emit` does indeed modify the digest of a basic block |
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.
typo: does -> do
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.
done
e18b8bf
to
0e2d4c4
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.
All looks good! Thank you!
Implements step 1 of #1457