Skip to content

Commit 38c0c14

Browse files
authored
chore(avm): remove function selector type of getenv opcode (#10406)
Resolves #9396
1 parent 38941bf commit 38c0c14

File tree

32 files changed

+2061
-1863
lines changed

32 files changed

+2061
-1863
lines changed

avm-transpiler/src/transpile.rs

-2
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,6 @@ fn handle_getter_instruction(
786786
enum EnvironmentVariable {
787787
ADDRESS,
788788
SENDER,
789-
FUNCTIONSELECTOR,
790789
TRANSACTIONFEE,
791790
CHAINID,
792791
VERSION,
@@ -821,7 +820,6 @@ fn handle_getter_instruction(
821820
"avmOpcodeTimestamp" => EnvironmentVariable::TIMESTAMP,
822821
"avmOpcodeL2GasLeft" => EnvironmentVariable::L2GASLEFT,
823822
"avmOpcodeDaGasLeft" => EnvironmentVariable::DAGASLEFT,
824-
"avmOpcodeFunctionSelector" => EnvironmentVariable::FUNCTIONSELECTOR,
825823
"avmOpcodeIsStaticCall" => EnvironmentVariable::ISSTATICCALL,
826824
_ => panic!("Transpiler doesn't know how to process getter {:?}", function),
827825
};

barretenberg/cpp/pil/avm/constants_gen.pil

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ namespace constants(256);
2121
pol MEM_TAG_U128 = 6;
2222
pol SENDER_KERNEL_INPUTS_COL_OFFSET = 0;
2323
pol ADDRESS_KERNEL_INPUTS_COL_OFFSET = 1;
24-
pol FUNCTION_SELECTOR_KERNEL_INPUTS_COL_OFFSET = 2;
2524
pol IS_STATIC_CALL_KERNEL_INPUTS_COL_OFFSET = 3;
2625
pol CHAIN_ID_KERNEL_INPUTS_COL_OFFSET = 4;
2726
pol VERSION_KERNEL_INPUTS_COL_OFFSET = 5;

barretenberg/cpp/pil/avm/kernel.pil

+1-4
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ namespace main(256);
9595
#[SENDER_KERNEL]
9696
sel_op_sender * (kernel_in_offset - constants.SENDER_KERNEL_INPUTS_COL_OFFSET) = 0;
9797

98-
#[FUNCTION_SELECTOR_KERNEL]
99-
sel_op_function_selector * (kernel_in_offset - constants.FUNCTION_SELECTOR_KERNEL_INPUTS_COL_OFFSET) = 0;
100-
10198
#[FEE_TRANSACTION_FEE_KERNEL]
10299
sel_op_transaction_fee * (kernel_in_offset - constants.TRANSACTION_FEE_KERNEL_INPUTS_COL_OFFSET) = 0;
103100

@@ -172,7 +169,7 @@ namespace main(256);
172169

173170
//===== LOOKUPS INTO THE PUBLIC INPUTS ===========================================
174171
pol KERNEL_INPUT_SELECTORS = sel_op_address + sel_op_sender
175-
+ sel_op_function_selector + sel_op_transaction_fee + sel_op_chain_id
172+
+ sel_op_transaction_fee + sel_op_chain_id
176173
+ sel_op_version + sel_op_block_number + sel_op_timestamp
177174
+ sel_op_fee_per_l2_gas + sel_op_fee_per_da_gas + sel_op_is_static_call;
178175
// Ensure that only one kernel lookup is active when the kernel_in_offset is active

barretenberg/cpp/pil/avm/main.pil

+1-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ namespace main(256);
6161
// CONTEXT - ENVIRONMENT
6262
pol commit sel_op_address;
6363
pol commit sel_op_sender;
64-
pol commit sel_op_function_selector;
6564
pol commit sel_op_transaction_fee;
6665
pol commit sel_op_is_static_call;
6766

@@ -234,7 +233,6 @@ namespace main(256);
234233
// opcode decomposition.
235234
sel_op_address * (1 - sel_op_address) = 0;
236235
sel_op_sender * (1 - sel_op_sender) = 0;
237-
sel_op_function_selector * (1 - sel_op_function_selector) = 0;
238236
sel_op_transaction_fee * (1 - sel_op_transaction_fee) = 0;
239237
sel_op_chain_id * (1 - sel_op_chain_id) = 0;
240238
sel_op_version * (1 - sel_op_version) = 0;
@@ -445,7 +443,7 @@ namespace main(256);
445443
+ sel_op_ecadd + sel_op_msm;
446444
pol SEL_ALL_MEMORY = sel_op_mov + sel_op_set;
447445
pol KERNEL_INPUT_SELECTORS = sel_op_address + sel_op_sender
448-
+ sel_op_function_selector + sel_op_transaction_fee + sel_op_chain_id
446+
+ sel_op_transaction_fee + sel_op_chain_id
449447
+ sel_op_version + sel_op_block_number + sel_op_timestamp
450448
+ sel_op_fee_per_l2_gas + sel_op_fee_per_da_gas + sel_op_is_static_call;
451449
pol KERNEL_OUTPUT_SELECTORS = sel_op_note_hash_exists + sel_op_emit_note_hash + sel_op_nullifier_exists

barretenberg/cpp/src/barretenberg/vm/avm/generated/circuit_builder.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@ AvmCircuitBuilder::ProverPolynomials AvmCircuitBuilder::compute_polynomials() co
323323
polys.main_sel_op_fdiv.set_if_valid_index(i, rows[i].main_sel_op_fdiv);
324324
polys.main_sel_op_fee_per_da_gas.set_if_valid_index(i, rows[i].main_sel_op_fee_per_da_gas);
325325
polys.main_sel_op_fee_per_l2_gas.set_if_valid_index(i, rows[i].main_sel_op_fee_per_l2_gas);
326-
polys.main_sel_op_function_selector.set_if_valid_index(i, rows[i].main_sel_op_function_selector);
327326
polys.main_sel_op_get_contract_instance.set_if_valid_index(i,
328327
rows[i].main_sel_op_get_contract_instance);
329328
polys.main_sel_op_internal_call.set_if_valid_index(i, rows[i].main_sel_op_internal_call);

0 commit comments

Comments
 (0)