Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
calldata_hashing.cpp
Go to the documentation of this file.
2
6
7namespace bb::avm2::simulation {
8
10{
11 // todo(ilyas): this probably simulates faster at the cost of re-work in tracegen
12 std::vector<FF> calldata_with_sep = { DOM_SEP__PUBLIC_CALLDATA };
13 for (const auto& value : calldata) {
14 // Note: Using `insert` breaks GCC.
15 calldata_with_sep.push_back(value);
16 }
17 FF computed_hash = hasher.hash(calldata_with_sep);
18 BB_ASSERT_EQ(computed_hash, cd_hash);
19
20 events.emit({
21 .context_id = context_id,
22 .calldata = { calldata.begin(), calldata.end() },
23 });
24}
25
26} // namespace bb::avm2::simulation
#define BB_ASSERT_EQ(actual, expected,...)
Definition assert.hpp:93
#define DOM_SEP__PUBLIC_CALLDATA
EventEmitterInterface< CalldataEvent > & events
void assert_calldata_hash(const FF &cd_hash, std::span< const FF > calldata) override
virtual FF hash(const std::vector< FF > &input)=0
AvmFlavorSettings::FF FF
Definition field.hpp:10
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13