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

feat(avm): add storage address kernel opcode #6863

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion barretenberg/cpp/pil/avm/avm_main.pil
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace avm_main(256);
// CALL CONTEXT
pol commit sel_op_sender;
pol commit sel_op_address;
pol commit sel_op_storage_address;

// FEES
pol commit sel_op_fee_per_l2_gas;
Expand Down Expand Up @@ -230,6 +231,7 @@ namespace avm_main(256);
// opcode decomposition.
sel_op_sender * (1 - sel_op_sender) = 0;
sel_op_address * (1 - sel_op_address) = 0;
sel_op_storage_address * (1 - sel_op_storage_address) = 0;
sel_op_chain_id * (1 - sel_op_chain_id) = 0;
sel_op_version * (1 - sel_op_version) = 0;
sel_op_block_number * (1 - sel_op_block_number) = 0;
Expand Down Expand Up @@ -361,7 +363,7 @@ namespace avm_main(256);

//===== KERNEL LOOKUPS =======================================================
pol KERNEL_INPUT_SELECTORS = (
sel_op_sender + sel_op_address + sel_op_chain_id + sel_op_version + sel_op_block_number + sel_op_coinbase +
sel_op_sender + sel_op_address + sel_op_storage_address + sel_op_chain_id + sel_op_version + sel_op_block_number + sel_op_coinbase +
sel_op_timestamp + sel_op_fee_per_l2_gas + sel_op_fee_per_da_gas + sel_op_transaction_fee
);
// Ensure that only one kernel lookup is active when the kernel_in_offset is active
Expand Down Expand Up @@ -510,6 +512,9 @@ namespace avm_main(256);
#[ADDRESS_KERNEL]
sel_op_address * (avm_kernel.kernel_in_offset - constants.ADDRESS_SELECTOR) = 0;

#[STORAGE_ADDRESS_KERNEL]
sel_op_storage_address * (avm_kernel.kernel_in_offset - constants.STORAGE_ADDRESS_SELECTOR) = 0;

// FEES
#[FEE_DA_GAS_KERNEL]
sel_op_fee_per_da_gas * (avm_kernel.kernel_in_offset - constants.FEE_PER_DA_GAS_SELECTOR) = 0;
Expand Down
1 change: 1 addition & 0 deletions barretenberg/cpp/pil/avm/constants.pil
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace constants(256);
// From Public Context Inputs
pol SENDER_SELECTOR = 0;
pol ADDRESS_SELECTOR = 1;
pol STORAGE_ADDRESS_SELECTOR = 2;

// NOTE: constant expression evaluation does not seem to be supported yet in pil
// pol START_GLOBAL_VARIABLES = CALL_CONTEXT_LENGTH + HEADER_LENGTH = 6 + 23 = 29
Expand Down
Loading
Loading