Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
external_call_impl.hpp
Go to the documentation of this file.
1// AUTOGENERATED FILE
2#pragma once
3
5
6namespace bb::avm2 {
7
8template <typename FF_>
9template <typename ContainerOverSubrelations, typename AllEntities>
10void external_callImpl<FF_>::accumulate(ContainerOverSubrelations& evals,
11 const AllEntities& in,
12 [[maybe_unused]] const RelationParameters<FF_>&,
13 [[maybe_unused]] const FF_& scaling_factor)
14{
15 using C = ColumnAndShifts;
16
17 PROFILE_THIS_NAME("accumulate/external_call");
18
19 const auto execution_L2_GAS_LEFT = (in.get(C::execution_l2_gas_limit) - in.get(C::execution_l2_gas_used));
20 const auto execution_DA_GAS_LEFT = (in.get(C::execution_da_gas_limit) - in.get(C::execution_da_gas_used));
21 const auto execution_ALLOCATED_GTE_LEFT_L2 = (in.get(C::execution_register_0_) - execution_L2_GAS_LEFT);
22 const auto execution_ALLOCATED_LT_LEFT_L2 = ((execution_L2_GAS_LEFT - in.get(C::execution_register_0_)) - FF(1));
23 const auto execution_ALLOCATED_GTE_LEFT_DA = (in.get(C::execution_register_1_) - execution_DA_GAS_LEFT);
24 const auto execution_ALLOCATED_LT_LEFT_DA = ((execution_DA_GAS_LEFT - in.get(C::execution_register_1_)) - FF(1));
25
26 {
28 auto tmp = in.get(C::execution_sel_enter_call) * (FF(32) - in.get(C::execution_constant_32));
29 tmp *= scaling_factor;
30 std::get<0>(evals) += typename Accumulator::View(tmp);
31 }
32 {
33 using Accumulator = typename std::tuple_element_t<1, ContainerOverSubrelations>;
34 auto tmp = in.get(C::execution_call_is_l2_gas_allocated_lt_left) *
35 (FF(1) - in.get(C::execution_call_is_l2_gas_allocated_lt_left));
36 tmp *= scaling_factor;
37 std::get<1>(evals) += typename Accumulator::View(tmp);
38 }
39 {
40 using Accumulator = typename std::tuple_element_t<2, ContainerOverSubrelations>;
41 auto tmp =
42 in.get(C::execution_sel_enter_call) * (((execution_ALLOCATED_LT_LEFT_L2 - execution_ALLOCATED_GTE_LEFT_L2) *
43 in.get(C::execution_call_is_l2_gas_allocated_lt_left) +
44 execution_ALLOCATED_GTE_LEFT_L2) -
45 in.get(C::execution_call_allocated_left_l2_cmp_diff));
46 tmp *= scaling_factor;
47 std::get<2>(evals) += typename Accumulator::View(tmp);
48 }
49 {
50 using Accumulator = typename std::tuple_element_t<3, ContainerOverSubrelations>;
51 auto tmp = in.get(C::execution_sel_enter_call) * (((in.get(C::execution_register_0_) - execution_L2_GAS_LEFT) *
52 in.get(C::execution_call_is_l2_gas_allocated_lt_left) +
53 execution_L2_GAS_LEFT) -
54 in.get(C::execution_l2_gas_limit_shift));
55 tmp *= scaling_factor;
56 std::get<3>(evals) += typename Accumulator::View(tmp);
57 }
58 {
59 using Accumulator = typename std::tuple_element_t<4, ContainerOverSubrelations>;
60 auto tmp = in.get(C::execution_call_is_da_gas_allocated_lt_left) *
61 (FF(1) - in.get(C::execution_call_is_da_gas_allocated_lt_left));
62 tmp *= scaling_factor;
63 std::get<4>(evals) += typename Accumulator::View(tmp);
64 }
65 {
66 using Accumulator = typename std::tuple_element_t<5, ContainerOverSubrelations>;
67 auto tmp =
68 in.get(C::execution_sel_enter_call) * (((execution_ALLOCATED_LT_LEFT_DA - execution_ALLOCATED_GTE_LEFT_DA) *
69 in.get(C::execution_call_is_da_gas_allocated_lt_left) +
70 execution_ALLOCATED_GTE_LEFT_DA) -
71 in.get(C::execution_call_allocated_left_da_cmp_diff));
72 tmp *= scaling_factor;
73 std::get<5>(evals) += typename Accumulator::View(tmp);
74 }
75 {
76 using Accumulator = typename std::tuple_element_t<6, ContainerOverSubrelations>;
77 auto tmp = in.get(C::execution_sel_enter_call) * (((in.get(C::execution_register_1_) - execution_DA_GAS_LEFT) *
78 in.get(C::execution_call_is_da_gas_allocated_lt_left) +
79 execution_DA_GAS_LEFT) -
80 in.get(C::execution_da_gas_limit_shift));
81 tmp *= scaling_factor;
82 std::get<6>(evals) += typename Accumulator::View(tmp);
83 }
84}
85
86} // namespace bb::avm2
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
ColumnAndShifts
Definition columns.hpp:35
AvmFlavorSettings::FF FF
Definition field.hpp:10
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
#define PROFILE_THIS_NAME(name)
Definition op_count.hpp:16
Container for parameters used by the grand product (permutation, lookup) Honk relations.