24 for (uint32_t j = 0; j < events.size(); j++) {
25 const auto&
event = events[j];
26 const auto&
calldata =
event.calldata;
28 bool is_last = j == events.size() - 1;
30 for (
size_t i = 0; i <
calldata.size(); i++) {
31 bool is_latch = i ==
calldata.size() - 1;
34 { C::calldata_sel, 1 },
37 { C::calldata_index, i + 1 },
38 { C::calldata_latch, is_latch ? 1 : 0 },
40 { C::calldata_diff_context_id,
53 { C::calldata_sel, 1 },
55 { C::calldata_value, 0 },
56 { C::calldata_index, 0 },
57 { C::calldata_latch, 1 },
59 { C::calldata_diff_context_id, !is_last ? events[j + 1].context_id -
context_id - 1 : 0 },
72 for (
const auto&
event : events) {
74 size_t input_size =
event.calldata.size() + 1;
75 calldata_with_sep.reserve(input_size);
76 calldata_with_sep.insert(calldata_with_sep.end(),
event.calldata.begin(),
event.calldata.end());
77 auto calldata_field_at = [&calldata_with_sep](
size_t i) ->
FF {
78 return i < calldata_with_sep.size() ? calldata_with_sep[i] : 0;
86 auto padding_amount = (2 * calldata_with_sep.size()) % 3;
87 auto num_rounds_rem = (calldata_with_sep.size() + padding_amount) / 3;
89 while (num_rounds_rem > 0) {
93 { C::calldata_hashing_sel, 1 },
94 { C::calldata_hashing_start,
index == 0 ? 1 : 0 },
95 { C::calldata_hashing_sel_not_start,
index == 0 ? 0 : 1 },
96 { C::calldata_hashing_context_id,
event.context_id },
97 { C::calldata_hashing_calldata_size,
event.calldata.size() },
98 { C::calldata_hashing_input_len, calldata_with_sep.size() },
99 { C::calldata_hashing_rounds_rem, num_rounds_rem },
100 { C::calldata_hashing_index_0_,
index },
101 { C::calldata_hashing_index_1_,
index + 1 },
102 { C::calldata_hashing_index_2_,
index + 2 },
103 { C::calldata_hashing_input_0_, calldata_field_at(
index) },
104 { C::calldata_hashing_input_1_, calldata_field_at(
index + 1) },
105 { C::calldata_hashing_input_2_, calldata_field_at(
index + 2) },
106 { C::calldata_hashing_output_hash, output_hash },
107 { C::calldata_hashing_sel_not_padding_1, (num_rounds_rem == 1) && (padding_amount == 2) ? 0 : 1 },
108 { C::calldata_hashing_sel_not_padding_2, (num_rounds_rem == 1) && (padding_amount > 0) ? 0 : 1 },
109 { C::calldata_hashing_latch, num_rounds_rem == 1 ? 1 : 0 },
Implements a parallelized batch insertion indexed tree Accepts template argument of the type of store...