Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bbapi_avm.cpp
Go to the documentation of this file.
4
5namespace bb::bbapi {
6
7namespace {
8
9// Reset the AVM per-stage timings registry so the snapshot we return reflects only this call.
10void reset_avm_stats()
11{
13}
14
15// Take a snapshot of the AVM per-stage timings registry and convert it to the wire-format struct.
16std::vector<AvmStat> snapshot_avm_stats()
17{
18 auto snapshot = ::bb::avm2::Stats::get().snapshot();
20 result.reserve(snapshot.size());
21 for (auto& [name, value] : snapshot) {
22 result.push_back(AvmStat{ .name = std::move(name), .value_ms = value });
23 }
24 return result;
25}
26
27} // namespace
28
30{
31 reset_avm_stats();
33 return Response{
34 .proof = std::move(result.proof),
35 .stats = snapshot_avm_stats(),
36 };
37}
38
40{
41 bool verified = avm_verify_from_bytes(std::move(proof), std::move(public_inputs));
42 return Response{ .verified = verified };
43}
44
46{
47 reset_avm_stats();
49 return Response{ .passed = passed, .stats = snapshot_avm_stats() };
50}
51
52} // namespace bb::bbapi
AVM-specific command definitions for the Barretenberg RPC API.
std::vector< std::pair< std::string, uint64_t > > snapshot() const
Definition stats.cpp:55
static Stats & get()
Definition stats.cpp:10
void reset()
Definition stats.cpp:16
AvmProvingInputs inputs
bool avm_check_circuit_from_bytes(std::vector< uint8_t > inputs)
Check the AVM circuit from serialized inputs (msgpack bytes).
Definition api_avm.cpp:121
bool avm_verify_from_bytes(std::vector< bb::fr > proof, std::vector< uint8_t > public_inputs)
Verify an AVM proof from serialized data.
Definition api_avm.cpp:109
AvmProveResult avm_prove_from_bytes(std::vector< uint8_t > inputs)
Prove an AVM transaction from serialized inputs (msgpack bytes). Callers that need to verify the proo...
Definition api_avm.cpp:98
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
Response execute(const BBApiRequest &request={}) &&
Definition bbapi_avm.cpp:45
std::vector< bb::fr > proof
Definition bbapi_avm.hpp:46
Response execute(const BBApiRequest &request={}) &&
Definition bbapi_avm.cpp:29
A single AVM per-stage timing entry. value_ms is wall-clock milliseconds captured by bb::avm2::Stats ...
Definition bbapi_avm.hpp:25
std::string name
Definition bbapi_avm.hpp:28
Response execute(const BBApiRequest &request={}) &&
Definition bbapi_avm.cpp:39