Skip to content

Commit

Permalink
chore(avm): remove function selector type of getenv opcode (#10406)
Browse files Browse the repository at this point in the history
Resolves #9396
  • Loading branch information
jeanmon authored Dec 6, 2024
1 parent 38941bf commit 38c0c14
Show file tree
Hide file tree
Showing 32 changed files with 2,061 additions and 1,863 deletions.
2 changes: 0 additions & 2 deletions avm-transpiler/src/transpile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,6 @@ fn handle_getter_instruction(
enum EnvironmentVariable {
ADDRESS,
SENDER,
FUNCTIONSELECTOR,
TRANSACTIONFEE,
CHAINID,
VERSION,
Expand Down Expand Up @@ -821,7 +820,6 @@ fn handle_getter_instruction(
"avmOpcodeTimestamp" => EnvironmentVariable::TIMESTAMP,
"avmOpcodeL2GasLeft" => EnvironmentVariable::L2GASLEFT,
"avmOpcodeDaGasLeft" => EnvironmentVariable::DAGASLEFT,
"avmOpcodeFunctionSelector" => EnvironmentVariable::FUNCTIONSELECTOR,
"avmOpcodeIsStaticCall" => EnvironmentVariable::ISSTATICCALL,
_ => panic!("Transpiler doesn't know how to process getter {:?}", function),
};
Expand Down
1 change: 0 additions & 1 deletion barretenberg/cpp/pil/avm/constants_gen.pil
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ namespace constants(256);
pol MEM_TAG_U128 = 6;
pol SENDER_KERNEL_INPUTS_COL_OFFSET = 0;
pol ADDRESS_KERNEL_INPUTS_COL_OFFSET = 1;
pol FUNCTION_SELECTOR_KERNEL_INPUTS_COL_OFFSET = 2;
pol IS_STATIC_CALL_KERNEL_INPUTS_COL_OFFSET = 3;
pol CHAIN_ID_KERNEL_INPUTS_COL_OFFSET = 4;
pol VERSION_KERNEL_INPUTS_COL_OFFSET = 5;
Expand Down
5 changes: 1 addition & 4 deletions barretenberg/cpp/pil/avm/kernel.pil
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ namespace main(256);
#[SENDER_KERNEL]
sel_op_sender * (kernel_in_offset - constants.SENDER_KERNEL_INPUTS_COL_OFFSET) = 0;

#[FUNCTION_SELECTOR_KERNEL]
sel_op_function_selector * (kernel_in_offset - constants.FUNCTION_SELECTOR_KERNEL_INPUTS_COL_OFFSET) = 0;

#[FEE_TRANSACTION_FEE_KERNEL]
sel_op_transaction_fee * (kernel_in_offset - constants.TRANSACTION_FEE_KERNEL_INPUTS_COL_OFFSET) = 0;

Expand Down Expand Up @@ -172,7 +169,7 @@ namespace main(256);

//===== LOOKUPS INTO THE PUBLIC INPUTS ===========================================
pol KERNEL_INPUT_SELECTORS = sel_op_address + sel_op_sender
+ sel_op_function_selector + sel_op_transaction_fee + sel_op_chain_id
+ sel_op_transaction_fee + sel_op_chain_id
+ sel_op_version + sel_op_block_number + sel_op_timestamp
+ sel_op_fee_per_l2_gas + sel_op_fee_per_da_gas + sel_op_is_static_call;
// Ensure that only one kernel lookup is active when the kernel_in_offset is active
Expand Down
4 changes: 1 addition & 3 deletions barretenberg/cpp/pil/avm/main.pil
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ namespace main(256);
// CONTEXT - ENVIRONMENT
pol commit sel_op_address;
pol commit sel_op_sender;
pol commit sel_op_function_selector;
pol commit sel_op_transaction_fee;
pol commit sel_op_is_static_call;

Expand Down Expand Up @@ -234,7 +233,6 @@ namespace main(256);
// opcode decomposition.
sel_op_address * (1 - sel_op_address) = 0;
sel_op_sender * (1 - sel_op_sender) = 0;
sel_op_function_selector * (1 - sel_op_function_selector) = 0;
sel_op_transaction_fee * (1 - sel_op_transaction_fee) = 0;
sel_op_chain_id * (1 - sel_op_chain_id) = 0;
sel_op_version * (1 - sel_op_version) = 0;
Expand Down Expand Up @@ -445,7 +443,7 @@ namespace main(256);
+ sel_op_ecadd + sel_op_msm;
pol SEL_ALL_MEMORY = sel_op_mov + sel_op_set;
pol KERNEL_INPUT_SELECTORS = sel_op_address + sel_op_sender
+ sel_op_function_selector + sel_op_transaction_fee + sel_op_chain_id
+ sel_op_transaction_fee + sel_op_chain_id
+ sel_op_version + sel_op_block_number + sel_op_timestamp
+ sel_op_fee_per_l2_gas + sel_op_fee_per_da_gas + sel_op_is_static_call;
pol KERNEL_OUTPUT_SELECTORS = sel_op_note_hash_exists + sel_op_emit_note_hash + sel_op_nullifier_exists
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ AvmCircuitBuilder::ProverPolynomials AvmCircuitBuilder::compute_polynomials() co
polys.main_sel_op_fdiv.set_if_valid_index(i, rows[i].main_sel_op_fdiv);
polys.main_sel_op_fee_per_da_gas.set_if_valid_index(i, rows[i].main_sel_op_fee_per_da_gas);
polys.main_sel_op_fee_per_l2_gas.set_if_valid_index(i, rows[i].main_sel_op_fee_per_l2_gas);
polys.main_sel_op_function_selector.set_if_valid_index(i, rows[i].main_sel_op_function_selector);
polys.main_sel_op_get_contract_instance.set_if_valid_index(i,
rows[i].main_sel_op_get_contract_instance);
polys.main_sel_op_internal_call.set_if_valid_index(i, rows[i].main_sel_op_internal_call);
Expand Down
Loading

0 comments on commit 38c0c14

Please sign in to comment.