Skip to content

Commit

Permalink
feat: avm unconstrained external call (#6846)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com>
  • Loading branch information
IlyasRidhuan and Maddiaa0 authored Jun 4, 2024
1 parent 42242f3 commit 5a65ffc
Show file tree
Hide file tree
Showing 16 changed files with 478 additions and 202 deletions.
4 changes: 3 additions & 1 deletion barretenberg/cpp/pil/avm/avm_main.pil
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ namespace avm_main(256);
pol commit sel_internal_return;
pol commit sel_jump;
pol commit sel_jumpi;
pol commit sel_external_call;

// Halt program execution
pol commit sel_halt;
Expand Down Expand Up @@ -276,6 +277,7 @@ namespace avm_main(256);
sel_jump * (1 - sel_jump) = 0;
sel_jumpi * (1 - sel_jumpi) = 0;
sel_halt * (1 - sel_halt) = 0;
sel_external_call * (1 - sel_external_call) = 0;

// Might be removed if derived from opcode based on a lookup of constants
sel_mov * ( 1 - sel_mov) = 0;
Expand Down Expand Up @@ -413,7 +415,7 @@ namespace avm_main(256);

//===== CONTROL_FLOW_CONSISTENCY ============================================
pol INTERNAL_CALL_STACK_SELECTORS = (first + sel_internal_call + sel_internal_return + sel_halt);
pol ALL_CTRL_FLOW_SEL = sel_jump + sel_jumpi + sel_internal_call + sel_internal_return;
pol ALL_CTRL_FLOW_SEL = sel_jump + sel_jumpi + sel_internal_call + sel_internal_return + sel_external_call;

pol ALL_BINARY_SEL = sel_op_and + sel_op_or + sel_op_xor;
pol ALL_GADGET_SEL = sel_op_radix_le + sel_op_sha256 + sel_op_poseidon2 + sel_op_keccak + sel_op_pedersen;
Expand Down
11 changes: 11 additions & 0 deletions barretenberg/cpp/pil/avm/constants.pil
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,14 @@ namespace constants(256);
// Other AVM specific constants
pol INTERNAL_CALL_SPACE_ID = 255;

// Lengths of kernel output vectors
// Read requests
pol MAX_NULLIFIER_READ_REQUESTS_PER_CALL = 32;
pol MAX_NOTE_HASH_READ_REQUESTS_PER_CALL = 32;
pol MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL = 32;
pol MAX_PUBLIC_DATA_READS_PER_CALL = 16;

// Emitting Data
pol MAX_NEW_NOTE_HASHES_PER_CALL = 16;
pol MAX_NEW_NULLIIFIERS_PER_CALL = 16;
pol MAX_NEW_L2_TO_L1_MSGS_PER_CALL = 2;
Loading

0 comments on commit 5a65ffc

Please sign in to comment.