-
Notifications
You must be signed in to change notification settings - Fork 303
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
feat: validate counters #6365
feat: validate counters #6365
Changes from 9 commits
8eae2d6
550f591
c615602
71b9d8e
82825ac
a903c3e
ab40d40
93344bd
b0f2215
40a3b72
5c50cce
277b1be
a12603f
788af35
e84da8f
2b3c53f
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 |
---|---|---|
|
@@ -108,15 +108,10 @@ impl ContextInterface for PrivateContext { | |
|
||
impl PrivateContext { | ||
pub fn new(inputs: PrivateContextInputs, args_hash: Field) -> PrivateContext { | ||
let side_effect_counter = inputs.start_side_effect_counter; | ||
let mut min_revertible_side_effect_counter = 0; | ||
if is_empty(inputs.call_context.msg_sender) { | ||
min_revertible_side_effect_counter = side_effect_counter; | ||
} | ||
PrivateContext { | ||
inputs, | ||
side_effect_counter, | ||
min_revertible_side_effect_counter, | ||
side_effect_counter: inputs.start_side_effect_counter + 1, | ||
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. All the side effects should have unique counters, including the start and end counter for a call, and all the data emitted within. |
||
min_revertible_side_effect_counter: 0, | ||
is_fee_payer: false, | ||
args_hash, | ||
return_hash: 0, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,7 @@ impl PublicContext { | |
pub fn new(inputs: PublicContextInputs, args_hash: Field) -> PublicContext { | ||
PublicContext { | ||
inputs, | ||
side_effect_counter: inputs.start_side_effect_counter, | ||
side_effect_counter: inputs.start_side_effect_counter + 1, | ||
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. Could you confirm that we are doing this right in the AVM? (i.e., the initialization of side effect counters, the increment order [whether we use the current and then increment or vice-versa], calculation of end counter, and passing these across enqueued calls). I'm not sure the tests in master would currently exercise all this. 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. That's a good point! Modified here to be consistent with the private land. |
||
args_hash, | ||
return_hash: 0, | ||
nullifier_read_requests: BoundedVec::new(), | ||
|
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.
min_revertible_side_effect_counter
is only propagated to the public inputs in init kernel circuit. And it's on the entrypoint to decide if it has a value or not. It's not necessary to set it to be the same as the call's start counter if it's the first call (empty msg_sender).