-
Notifications
You must be signed in to change notification settings - Fork 598
fix(avm): relax constraints for leaf_index kernel opcodes #8288
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -105,8 +105,15 @@ struct ExecutionHints { | |
| { | ||
| std::unordered_map<uint32_t, FF> hints_map; | ||
| push_vec_into_map(hints_map, storage_value_hints); | ||
| push_vec_into_map(hints_map, note_hash_exists_hints); | ||
| push_vec_into_map(hints_map, nullifier_exists_hints); | ||
| return hints_map; | ||
| } | ||
|
|
||
| // Leaf index -> exists | ||
| std::unordered_map<uint32_t, FF> get_leaf_index_hints() const | ||
|
Contributor
Author
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. Splitting out leaf index hints since they now use the leaf index instead of side effect counters which would likely collide in a single map |
||
| { | ||
| std::unordered_map<uint32_t, FF> hints_map; | ||
| push_vec_into_map(hints_map, note_hash_exists_hints); | ||
| push_vec_into_map(hints_map, l1_to_l2_message_exists_hints); | ||
| return hints_map; | ||
| } | ||
|
|
@@ -161,4 +168,4 @@ struct ExecutionHints { | |
| {} | ||
| }; | ||
|
|
||
| } // namespace bb::avm_trace | ||
| } // namespace bb::avm_trace | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -173,7 +173,16 @@ void AvmKernelTraceBuilder::op_note_hash_exists(uint32_t clk, | |
| { | ||
|
|
||
| uint32_t offset = START_NOTE_HASH_EXISTS_WRITE_OFFSET + note_hash_exists_offset; | ||
| perform_kernel_output_lookup(offset, side_effect_counter, note_hash, FF(result)); | ||
| // TODO(#8287)Lookups are heavily underconstrained atm | ||
| if (result == 1) { | ||
|
Contributor
Author
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 whole section is a bit messy atm while the lookups are still "half-on". Will be resolved when we clean up the hints/public inputs stuff and if we give the |
||
| perform_kernel_output_lookup(offset, side_effect_counter, note_hash, FF(result)); | ||
| } else { | ||
| // if the note_hash does NOT exist, the public inputs already contains the correct output value (i.e. the | ||
| // actual value at the index), so we don't try to overwrite the value | ||
| std::get<KERNEL_OUTPUTS_SIDE_EFFECT_COUNTER>(public_inputs)[offset] = side_effect_counter; | ||
| std::get<KERNEL_OUTPUTS_METADATA>(public_inputs)[offset] = FF(result); | ||
| kernel_output_selector_counter[offset]++; | ||
| } | ||
| note_hash_exists_offset++; | ||
|
|
||
| KernelTraceEntry entry = { | ||
|
|
@@ -245,7 +254,16 @@ void AvmKernelTraceBuilder::op_l1_to_l2_msg_exists(uint32_t clk, | |
| uint32_t result) | ||
| { | ||
| uint32_t offset = START_L1_TO_L2_MSG_EXISTS_WRITE_OFFSET + l1_to_l2_msg_exists_offset; | ||
| perform_kernel_output_lookup(offset, side_effect_counter, message, FF(result)); | ||
| // TODO(#8287)Lookups are heavily underconstrained atm | ||
| if (result == 1) { | ||
| perform_kernel_output_lookup(offset, side_effect_counter, message, FF(result)); | ||
| } else { | ||
| // if the l1_to_l2_msg_exists is false, the public inputs already contains the correct output value (i.e. the | ||
| // actual value at the index), so we don't try to overwrite the value | ||
| std::get<KERNEL_OUTPUTS_SIDE_EFFECT_COUNTER>(public_inputs)[offset] = side_effect_counter; | ||
| std::get<KERNEL_OUTPUTS_METADATA>(public_inputs)[offset] = FF(result); | ||
| kernel_output_selector_counter[offset]++; | ||
| } | ||
| l1_to_l2_msg_exists_offset++; | ||
|
|
||
| KernelTraceEntry entry = { | ||
|
|
||
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.
Had to turn off the kernel_value_out and side_effect parts of the lookup