-
Notifications
You must be signed in to change notification settings - Fork 298
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
Combine mload_32bytes and mstore_32bytes flags #1252
Changes from 3 commits
070a39e
2ca7fdb
1b05c52
f838282
3cd6008
1933143
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,8 +42,8 @@ global mload_packing_u64_LE: | |
// Post stack: offset' | ||
global mstore_unpacking: | ||
// stack: context, segment, offset, value, len, retdest | ||
%stack(context, segment, offset, value, len, retdest) -> (context, segment, offset, value, len, offset, len, retdest) | ||
// stack: context, segment, offset, value, len, offset, len, retdest | ||
%stack(context, segment, offset, value, len, retdest) -> (context, segment, offset, len, value, offset, len, retdest) | ||
// stack: context, segment, offset, len, value, offset, len, retdest | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes the argument order of In how many places is |
||
MSTORE_32BYTES | ||
// stack: offset, len, retdest | ||
ADD SWAP1 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,17 @@ pub(crate) const MSTORE_GENERAL_OP: Option<StackBehavior> = Some(StackBehavior { | |
disable_other_channels: false, | ||
}); | ||
|
||
pub(crate) const MLOAD_32BYTES_OP: Option<StackBehavior> = Some(StackBehavior { | ||
num_pops: 4, | ||
pushes: true, | ||
disable_other_channels: false, | ||
}); | ||
|
||
pub(crate) const MSTORE_32BYTES_OP: Option<StackBehavior> = Some(StackBehavior { | ||
num_pops: 5, | ||
pushes: false, | ||
disable_other_channels: false, | ||
}); | ||
// AUDITORS: If the value below is `None`, then the operation must be manually checked to ensure | ||
// that every general-purpose memory channel is either disabled or has its read flag and address | ||
// propertly constrained. The same applies when `disable_other_channels` is set to `false`, | ||
|
@@ -104,16 +115,7 @@ const STACK_BEHAVIORS: OpsColumnsView<Option<StackBehavior>> = OpsColumnsView { | |
dup: None, | ||
swap: None, | ||
context_op: None, // SET_CONTEXT is special since it involves the old and the new stack. | ||
mstore_32bytes: Some(StackBehavior { | ||
num_pops: 5, | ||
pushes: false, | ||
disable_other_channels: false, | ||
}), | ||
mload_32bytes: Some(StackBehavior { | ||
num_pops: 4, | ||
pushes: true, | ||
disable_other_channels: false, | ||
}), | ||
memop_32bytes: None, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd add a comment to say where these constraints do live (if only to make clear that they haven't been forgotten). |
||
exit_kernel: Some(StackBehavior { | ||
num_pops: 1, | ||
pushes: false, | ||
|
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.
nit: as we're re-using
ctl_data_keccak_sponge
both forMLOAD_32BYTES
andMSTORE_32BYTES
, perhaps a tiny comment explaining the distinction may be useful? (as the doc there is valid for MLOAD but the last memory channel is being read in the case of MSTORE, not pushed to).