Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
get_env_var_spec.cpp
Go to the documentation of this file.
3
4namespace bb::avm2::tracegen {
5
6// See PIL table in `get_env_var.pil` for reference.
8{
9 // default
10 Table table = {
11 .invalid_enum = false,
12 .envvar_pi_lookup_col0 = false,
13 .envvar_pi_lookup_col1 = false,
14 .envvar_pi_row_idx = 0,
15 .is_address = false,
16 .is_sender = false,
17 .is_transactionfee = false,
18 .is_isstaticcall = false,
19 .is_l2gasleft = false,
20 .is_dagasleft = false,
21 .out_tag = static_cast<uint8_t>(ValueTag::FF),
22 };
23
24 switch (static_cast<EnvironmentVariable>(envvar)) {
26 table.is_address = true;
27 table.out_tag = static_cast<uint8_t>(ValueTag::FF);
28 return table;
30 table.is_sender = true;
31 table.out_tag = static_cast<uint8_t>(ValueTag::FF);
32 return table;
34 table.is_transactionfee = true;
35 table.out_tag = static_cast<uint8_t>(ValueTag::FF);
36 return table;
38 table.envvar_pi_lookup_col0 = true;
40 table.out_tag = static_cast<uint8_t>(ValueTag::FF);
41 return table;
43 table.envvar_pi_lookup_col0 = true;
45 table.out_tag = static_cast<uint8_t>(ValueTag::FF);
46 return table;
48 table.envvar_pi_lookup_col0 = true;
50 table.out_tag = static_cast<uint8_t>(ValueTag::U32);
51 return table;
53 table.envvar_pi_lookup_col0 = true;
55 table.out_tag = static_cast<uint8_t>(ValueTag::U64);
56 return table;
58 table.envvar_pi_lookup_col1 = true; // Only case where we lookup from col1
60 table.out_tag = static_cast<uint8_t>(ValueTag::U128);
61 return table;
63 table.envvar_pi_lookup_col0 = true;
65 table.out_tag = static_cast<uint8_t>(ValueTag::U128);
66 return table;
68 table.is_isstaticcall = true;
69 table.out_tag = static_cast<uint8_t>(ValueTag::U1);
70 return table;
72 table.is_l2gasleft = true;
73 table.out_tag = static_cast<uint8_t>(ValueTag::U32);
74 return table;
76 table.is_dagasleft = true;
77 table.out_tag = static_cast<uint8_t>(ValueTag::U32);
78 return table;
79 default:
80 table.invalid_enum = true;
81 return table;
82 }
83}
84
85} // namespace bb::avm2::tracegen
#define AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_GAS_FEES_ROW_IDX
#define AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_BLOCK_NUMBER_ROW_IDX
#define AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_VERSION_ROW_IDX
#define AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_TIMESTAMP_ROW_IDX
#define AVM_PUBLIC_INPUTS_GLOBAL_VARIABLES_CHAIN_ID_ROW_IDX
static Table get_table(uint8_t envvar)