Skip to content
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

Proper handling of leaf index in kernel trace #8287

Open
Tracked by #7123
IlyasRidhuan opened this issue Aug 30, 2024 · 1 comment
Open
Tracked by #7123

Proper handling of leaf index in kernel trace #8287

IlyasRidhuan opened this issue Aug 30, 2024 · 1 comment
Assignees
Labels
C-avm Component: AVM related tickets (aka public VM)

Comments

@IlyasRidhuan
Copy link
Contributor

Kernel outputs in the AVM are organised into columns based on a specific offset and are sorted by an incrementing side_effect_counter.

Changes to NOTEHASHEXISTS and L1TOL2MSGEXISTS means we no longer use the side_effect_counter here but instead use the leaf_index to check against. For now, I've replaced the side_effect_counter with leaf_index so that the columns contain the correct information when verifying. However, I've also had to relax some constraints as well as not make the full set of changes to the AVM hints structure.

To properly handle this we need to re-organise the kernel outputs columns, where the side_effect_counter based opcodes are kept contiguous. This means that the NOTEHASHEXISTS and L1TOL2MSGEXISTS would likely be in their own structure.

  1. Changes to side_effect_trace.ts to accomodate "hinting" for leaf index based opcodes
  2. Changes to ordering within kernel_trace.pil - maybe putting the leaf index based slots at the start or relaxing the incrementing constraints for these two opcodes
  3. Changes to the hints_map, no longer keyed by side_effect_counter
@IlyasRidhuan IlyasRidhuan self-assigned this Aug 30, 2024
@jeanmon jeanmon added the C-avm Component: AVM related tickets (aka public VM) label Aug 30, 2024
@IlyasRidhuan
Copy link
Contributor Author

Additionally, we will need to update the way #[KERNEL_OUTPUT_LOOKUP] works, specifically the columns
ia and kernel_value_out, as well as side_effect_counter and kernel_side_effect_out.

The former has to change since TreeReadRequests now has the following behaviour if checking that value a exists at index i.

  • if value_at(i) == a then kernel_value_out and ia will contain a
  • if value_at(i) == b then kernel_value_out = b and ia will break since it b wont be part of the opcode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-avm Component: AVM related tickets (aka public VM)
Projects
Status: Todo
Development

No branches or pull requests

2 participants