Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
e6fa350
feat(ipc): add /ipc-codegen and /ipc-runtime foundation packages
charlielye May 29, 2026
3e97693
refactor(ipc-codegen): decouple TS clients from bb backends
charlielye May 29, 2026
df1e536
refactor(ipc-codegen): remove bb-native cpp command path
charlielye May 29, 2026
417ee62
refactor(ipc-codegen): make cpp echo a standalone project
charlielye May 29, 2026
f997d58
chore(ipc-codegen): localize echo example ignores
charlielye May 29, 2026
7087778
refactor(ipc-codegen): flatten echo example projects
charlielye May 29, 2026
382de58
refactor(ipc-codegen): move echo sources under src
charlielye May 29, 2026
04d0b90
refactor(ipc-codegen): vendor cpp support in echo example
charlielye May 29, 2026
5c97530
refactor(ipc-codegen): template cpp support headers
charlielye May 29, 2026
f4dc241
test(ipc-codegen): add native shm echo matrix
charlielye May 29, 2026
5c54ae1
docs(ipc): remove repo-specific wording
charlielye May 29, 2026
5d06bfd
docs(ipc-codegen): clean backend templates
charlielye May 29, 2026
e5ce4ec
docs(ipc-runtime): document single-client shm
charlielye May 29, 2026
f92837b
fix(ipc): keep bb msgpack serialization local
charlielye May 29, 2026
be8af42
fix(ipc-codegen): require schema aliases for bin32 types
charlielye May 29, 2026
9a8fcca
fix(ipc-codegen): run schema reflection as test command
charlielye May 29, 2026
0e0cc7b
fix(ipc-codegen): preserve cpp bin32 aliases in reflection
charlielye May 29, 2026
3d355e4
fix(ipc-codegen): support legacy msgpack for cpp aliases
charlielye May 29, 2026
ac6687f
fix(ipc-codegen): unpack cpp aliases through msgpack object
charlielye May 29, 2026
b2fdf4b
fix(ipc-codegen): emit structural ts client interfaces
charlielye May 29, 2026
6862168
fix(ipc-codegen): namespace cpp primitive aliases
charlielye May 30, 2026
34658af
fix(ipc-codegen): qualify cpp echo aliases
charlielye May 30, 2026
f177b6c
fix(ipc-runtime): extend uds client connect retry
charlielye May 30, 2026
ebdd258
fix(ipc-runtime): make signal shutdown async-safe
charlielye May 30, 2026
c3e47b3
fix(ipc-codegen): keep ffi entrypoint conventional
charlielye May 30, 2026
e21d721
fix(ipc-codegen): allow ts clients to customize error type
charlielye May 31, 2026
1d66b48
refactor(wsdb): migrate aztec-wsdb to ipc-codegen + ipc-runtime
charlielye May 29, 2026
06d6e37
fix(wsdb): consume generated ipc support locally
charlielye May 29, 2026
5affbca
fix(wsdb): generate ipc sources beside schema
charlielye May 29, 2026
c6be7c4
fix(wsdb): remove redundant cmake guard
charlielye May 29, 2026
2bcd85c
fix(wsdb): expose stable ipc client header
charlielye May 29, 2026
7359eb9
fix(wsdb): move vm2 ipc adapter out of sim glob
charlielye May 29, 2026
1304b12
fix(vm2): own wsdb ipc adapter target
charlielye May 29, 2026
cca8c80
fix(wsdb): drop stray msgpack formatting diff
charlielye May 29, 2026
51b751f
fix(wsdb): use typed ipc wire schema
charlielye May 29, 2026
cb554c7
fix(wsdb): align generated wire aliases and runtime client
charlielye May 30, 2026
ad970d0
fix(wsdb): align generated ipc packaging
charlielye May 30, 2026
1b41032
refactor(bbapi): migrate bb binary to ipc-codegen + ipc-runtime
charlielye May 29, 2026
60fa7bd
refactor(bbapi): clean up generated wire migration
charlielye May 29, 2026
bc50b5e
fix(bbapi): use namespaced generated aliases
charlielye May 30, 2026
d5cda6c
fix(bb): cover generated ipc in ci builds
charlielye May 30, 2026
b8c2f99
refactor(barretenberg-rs): migrate to ipc-codegen + ipc-runtime; drop…
charlielye May 29, 2026
c42c5d5
fix(barretenberg-rs): align tests with generated bin32 values
charlielye May 29, 2026
b6d1069
fix(barretenberg-rs): use conventional ffi entrypoint
charlielye May 30, 2026
f4a5319
refactor(bb.js): migrate to ipc-codegen + ipc-runtime; delete legacy …
charlielye May 29, 2026
09a49ca
fix(bb.js): drop stale generated field2 export
charlielye May 29, 2026
ba02d9e
fix(bb.js): preserve BBApiException for generated errors
charlielye May 31, 2026
827202f
refactor: cut TS world state and NAPI AVM over to WSDB IPC; delete NA…
charlielye May 7, 2026
62e0d90
fix(avm): hint collection over LowLevelMerkleDBInterface
charlielye May 11, 2026
9e7374a
fix(prover-client): close world state in TestContext.cleanup
charlielye May 11, 2026
e507d2f
fix(world-state): close world state in leaky tests
charlielye May 11, 2026
cbcae5e
fix(world-state): close beforeAll db in integration test
charlielye May 11, 2026
d4b7022
fix(prover-node): close world state in rerunEpochProvingJob
charlielye May 11, 2026
4cd40ff
refactor(world-state): encapsulate WSDB spawn in IpcWorldState.spawn
charlielye May 13, 2026
b19e061
refactor(world-state): use await using for IPC cleanup instead of try…
charlielye May 13, 2026
2be805c
test(e2e_p2p): bump sentinel warmup to +2 slots to avoid 3/5 attestat…
charlielye May 13, 2026
669ff5b
fix(nodejs_module/avm): realign includes + link to first-stack ipc-ru…
charlielye May 29, 2026
b8469f8
fix(world-state): align wsdb generated client calls
charlielye May 30, 2026
8e1a8eb
fix(avm): link napi simulator wsdb adapter
charlielye May 30, 2026
af05cb6
fix(world-state): remove stale ipc leaf helpers
charlielye May 31, 2026
d50fc74
fix(world-state): adapt typed wsdb leaf operations
charlielye Jun 1, 2026
263c4a9
fix(world-state): use camelcase ipc response fields
charlielye Jun 1, 2026
a74b9c6
fix(world-state): hide wsdb binary discovery
charlielye Jun 1, 2026
e7cc341
feat: add aztec-avm + aztec-cdb binaries and IPC supporting code
charlielye May 8, 2026
9c3e10a
fix(cdb_ipc_server): use addContractsFromLogs for CdbAddContracts
charlielye May 13, 2026
9db06e3
feat(simulator): AvmSimulatorPool.spawn factory + asyncDispose on poo…
charlielye May 13, 2026
0e65b48
fix(cdb-ipc): use process-wide counter for socket path uniqueness
charlielye May 14, 2026
9e34f3d
fix(avm): generate avm and cdb ipc clients from schemas
charlielye May 30, 2026
a9908cb
fix(avm): align cdb ipc serialization
charlielye May 30, 2026
501e381
feat: AVM cutover — delete NAPI AVM, wire IPC simulator pool + CDB IP…
charlielye May 11, 2026
007fdf1
chore: regenerate yarn.lock for AVM cutover package.json deltas
charlielye May 11, 2026
74d9302
fix: update reex/avm_integration/rollup_ivc tests for new simulator API
charlielye May 11, 2026
61dee5c
fix(nodejs_module): link world_state for LMDBStore instead of bare ba…
charlielye May 11, 2026
72f0eec
fix(cdb_ipc_server): use addContractsFromLogs for CdbAddContracts
charlielye May 13, 2026
2767c20
refactor(simulator): use AvmSimulatorPool.spawn at call sites; move A…
charlielye May 13, 2026
6aa8a5c
fix(avm-cutover): add AvmSimulatorPool import in avm_proving_tester; …
charlielye May 13, 2026
239c316
chore(ci): skip account_init.test.ts on AVM cutover branch (pre-exist…
charlielye May 13, 2026
750e988
chore(ci): expand AVM-cutover skip to all src/e2e_fees/*.test.ts
charlielye May 13, 2026
0492aa5
fix(avm-cutover): use WorldStateRevision::LATEST when AVM queries the…
charlielye May 14, 2026
bcdc85c
fix(test): align server.test.ts node-version check with merge-train fix
charlielye May 14, 2026
48aba3f
fix(test): close tester in custom_bc truncation describe afterEach
charlielye May 14, 2026
d457164
fix(test): close tester in avm_check_circuit_custom_bc truncation aft…
charlielye May 14, 2026
a820310
fix(avm): align cdb ipc generated client usage
charlielye May 30, 2026
7b53d83
fix(avm): remove stale cutover imports
charlielye May 31, 2026
8cc9db5
fix(aztec-node): hide wsdb backend setup
charlielye Jun 1, 2026
a96bb68
feat(kvdb): add aztec-kvdb standalone IPC server
charlielye May 13, 2026
e275ddf
refactor(kvdb): use TypedMessage wire format; add KvdbBackend TS spawner
charlielye May 13, 2026
f1d90fa
feat(kv-store): migrate AztecLMDBStoreV2 from NAPI to aztec-kvdb IPC
charlielye May 13, 2026
ad0a85d
refactor: delete LMDBStore NAPI surface; nodejs_module is now SHM-tra…
charlielye May 13, 2026
b823d27
fix(kvdb): realign include paths + ipc link to first-stack ipc-runtim…
charlielye May 29, 2026
a3718f8
fix(kvdb): generate ipc client from schema
charlielye May 30, 2026
b06b84f
fix(kvdb): format lmdb ipc store
charlielye May 30, 2026
f663fd1
fix(kvdb): remove redundant async from dispatch
charlielye May 31, 2026
69bb108
fix(kvdb): use ipc runtime shm client
charlielye Jun 1, 2026
aaf3af1
fix(kvdb): hide backend binary discovery
charlielye Jun 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
37 changes: 34 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ endef

# Fast bootstrap.
fast: release-image barretenberg boxes playground docs aztec-up \
bb-tests l1-contracts-tests yarn-project-tests boxes-tests playground-tests aztec-up-tests docs-tests noir-protocol-circuits-tests release-image-tests spartan claude-tests
bb-tests l1-contracts-tests yarn-project-tests boxes-tests playground-tests aztec-up-tests docs-tests noir-protocol-circuits-tests release-image-tests spartan claude-tests ipc-codegen-tests

# Full bootstrap.
full: fast bb-full-tests bb-cpp-full yarn-project-benches

# Release. Everything plus copy bb cross compiles to ts projects.
release: fast bb-cpp-release-dir bb-ts-cross-copy
release: fast bb-cpp-release-dir bb-ts-cross-copy ipc-runtime-cross

#==============================================================================
# Noir
Expand Down Expand Up @@ -211,7 +211,7 @@ bb-cpp-release-dir: bb-cpp-native bb-cpp-cross
bb-cpp-full: bb-cpp bb-cpp-gcc bb-cpp-fuzzing bb-cpp-asan bb-cpp-smt bb-cpp-cross-arm64-macos bb-cpp-cross-arm64-ios bb-cpp-cross-arm64-android

# BB TypeScript - TypeScript bindings
bb-ts: bb-cpp-wasm bb-cpp-wasm-threads bb-cpp-native
bb-ts: bb-cpp-wasm bb-cpp-wasm-threads bb-cpp-native ipc-runtime
$(call build,$@,barretenberg/ts)

# Copies the cross-compiles into bb.js.
Expand Down Expand Up @@ -275,6 +275,37 @@ bb-tests: bb-cpp-native-tests bb-acir-tests bb-ts-tests bb-sol-tests bb-bbup-tes

bb-full-tests: bb-cpp-wasm-threads-tests bb-cpp-asan-tests bb-cpp-smt-tests

#==============================================================================
# IPC Codegen
#==============================================================================

.PHONY: ipc-codegen ipc-codegen-tests
ipc-codegen:
$(call build,$@,ipc-codegen)

ipc-codegen-tests: ipc-codegen
$(call test,$@,ipc-codegen)

.PHONY: ipc-runtime ipc-runtime-tests ipc-runtime-cross
ipc-runtime:
$(call build,$@,ipc-runtime)

ipc-runtime-tests: ipc-runtime
$(call test,$@,ipc-runtime)

# Cross-compile the NAPI addon for the 3 non-host release targets.
# Host (amd64-linux) addon is produced by the standalone `ipc-runtime` target.
ipc-runtime-cross-arm64-linux:
$(call build,$@,ipc-runtime,build_cross arm64-linux)

ipc-runtime-cross-amd64-macos:
$(call build,$@,ipc-runtime,build_cross amd64-macos)

ipc-runtime-cross-arm64-macos:
$(call build,$@,ipc-runtime,build_cross arm64-macos)

ipc-runtime-cross: ipc-runtime ipc-runtime-cross-arm64-linux ipc-runtime-cross-amd64-macos ipc-runtime-cross-arm64-macos

#==============================================================================
# .claude tooling
#==============================================================================
Expand Down
3 changes: 2 additions & 1 deletion aztec-up/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
source $(git rev-parse --show-toplevel)/ci3/source_bootstrap

hash=$(hash_str $(cache_content_hash ^aztec-up/) $(../yarn-project/bootstrap.sh hash))
hash=$(hash_str $(cache_content_hash ^aztec-up/) $(../ipc-runtime/bootstrap.sh hash) $(../yarn-project/bootstrap.sh hash))

# Bare aliases ("nightly", "latest") resolve to this major version.
DEFAULT_MAJOR_VERSION=${AZTEC_TOOLCHAIN_DEFAULT_MAJOR_VERSION:-4}
Expand Down Expand Up @@ -103,6 +103,7 @@ EOF
# TODO(AD): we have kludged a retry here. a local NPM install ought to be robust enough not to.
echo "Deploying packages to local npm registry (version: $version)..."
{
echo $root/ipc-runtime/ts
echo $root/barretenberg/ts
$root/noir/bootstrap.sh get_projects
$root/yarn-project/bootstrap.sh get_projects
Expand Down
3 changes: 3 additions & 0 deletions barretenberg/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ bench-out
rust/barretenberg-rs/src/generated_types.rs
rust/barretenberg-rs/src/api.rs
ts/src/cbind/generated/

# Codegen output dirs (ipc-codegen emits into a `generated/` subdir under each consumer)
**/generated/
14 changes: 14 additions & 0 deletions barretenberg/acir_tests/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@aztec/bb.js@portal:../../ts::locator=bbjs-test%40workspace%3Abbjs-test"
dependencies:
"@aztec/ipc-runtime": "portal:../../ipc-runtime/ts"
comlink: "npm:^4.4.1"
commander: "npm:^12.1.0"
idb-keyval: "npm:^6.2.1"
Expand All @@ -39,6 +40,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@aztec/bb.js@portal:../../ts::locator=browser-test-app%40workspace%3Abrowser-test-app"
dependencies:
"@aztec/ipc-runtime": "portal:../../ipc-runtime/ts"
comlink: "npm:^4.4.1"
commander: "npm:^12.1.0"
idb-keyval: "npm:^6.2.1"
Expand All @@ -50,6 +52,18 @@ __metadata:
languageName: node
linkType: soft

"@aztec/ipc-runtime@portal:../../ipc-runtime/ts::locator=%40aztec%2Fbb.js%40portal%3A..%2F..%2Fts%3A%3Alocator%3Dbbjs-test%2540workspace%253Abbjs-test":
version: 0.0.0-use.local
resolution: "@aztec/ipc-runtime@portal:../../ipc-runtime/ts::locator=%40aztec%2Fbb.js%40portal%3A..%2F..%2Fts%3A%3Alocator%3Dbbjs-test%2540workspace%253Abbjs-test"
languageName: node
linkType: soft

"@aztec/ipc-runtime@portal:../../ipc-runtime/ts::locator=%40aztec%2Fbb.js%40portal%3A..%2F..%2Fts%3A%3Alocator%3Dbrowser-test-app%2540workspace%253Abrowser-test-app":
version: 0.0.0-use.local
resolution: "@aztec/ipc-runtime@portal:../../ipc-runtime/ts::locator=%40aztec%2Fbb.js%40portal%3A..%2F..%2Fts%3A%3Alocator%3Dbrowser-test-app%2540workspace%253Abrowser-test-app"
languageName: node
linkType: soft

"@babel/code-frame@npm:^7.0.0":
version: 7.26.2
resolution: "@babel/code-frame@npm:7.26.2"
Expand Down
6 changes: 6 additions & 0 deletions barretenberg/cpp/.rebuild_patterns
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@
^barretenberg/cpp/scripts/
^barretenberg/cpp/bootstrap.sh
^barretenberg/cpp/CMakePresets.json
# bbapi and ipc_runtime generate C++ headers via ipc-codegen at CMake-time.
# Treat the codegen sources + templates as part of bb-cpp's input so the CI
# cache key invalidates when the codegen changes.
^ipc-codegen/src/.*\.ts$
^ipc-codegen/templates/cpp/.*$
^ipc-runtime/cpp/.*$
2 changes: 1 addition & 1 deletion barretenberg/cpp/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ elif [ "$1" == "changed" ]; then
format_files "$files"
fi
elif [ "$1" == "check" ]; then
files=$(find ./src -iname *.hpp -o -iname *.cpp -o -iname *.tcc | grep -v bb/deps)
files=$(find ./src -iname *.hpp -o -iname *.cpp -o -iname *.tcc | grep -v bb/deps | grep -v '/generated/')
echo "$files" | parallel -N10 clang-format-20 --dry-run --Werror
elif [ -n "$1" ]; then
files=$(git diff-index --relative --name-only $1 | grep -e '\.\(cpp\|hpp\|tcc\)$')
Expand Down
16 changes: 13 additions & 3 deletions barretenberg/cpp/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if(WASM)
add_link_options(-Wl,--export-memory,--import-memory,--stack-first,-z,stack-size=1048576,--max-memory=4294967296)
endif()

include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${MSGPACK_INCLUDE} ${TRACY_INCLUDE} ${LMDB_INCLUDE} ${LIBDEFLATE_INCLUDE} ${HTTPLIB_INCLUDE} ${BACKWARD_INCLUDE} ${NLOHMANN_JSON_INCLUDE})
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${MSGPACK_INCLUDE} ${TRACY_INCLUDE} ${LMDB_INCLUDE} ${LIBDEFLATE_INCLUDE} ${HTTPLIB_INCLUDE} ${BACKWARD_INCLUDE} ${NLOHMANN_JSON_INCLUDE} ${CMAKE_CURRENT_SOURCE_DIR}/../../../ipc-runtime/cpp)

# Add avm-transpiler include path when library is provided
if(AVM_TRANSPILER_LIB)
Expand Down Expand Up @@ -126,12 +126,22 @@ if(NOT FUZZING AND NOT WASM AND NOT BB_LITE)
add_subdirectory(barretenberg/world_state)
# NOTE: Do not conditionally base this on the AVM flag as it defines a necessary vm2_sim library.
add_subdirectory(barretenberg/vm2)
add_subdirectory(barretenberg/ipc)
add_subdirectory(barretenberg/wsdb)
add_subdirectory(barretenberg/wsdb_client)
add_subdirectory(barretenberg/vm2_wsdb)
add_subdirectory(barretenberg/cdb)
add_subdirectory(barretenberg/kvdb)
add_subdirectory(barretenberg/avm)
add_subdirectory(barretenberg/nodejs_module)
endif()

# Pull in ipc-runtime as a C++ dependency. Provides the `ipc_runtime`
# library target (static, or INTERFACE under WASM with transport sources
# stubbed) that bbapi/wsdb/etc link against for the codegen-emitted
# bb_ipc_server.hpp dispatcher.
if(NOT FUZZING AND NOT BB_LITE)
add_subdirectory(${CMAKE_SOURCE_DIR}/../../ipc-runtime/cpp ${CMAKE_BINARY_DIR}/ipc-runtime)
endif()

if(FUZZING_AVM)
if(FUZZING)
# Only add these if they weren't added above (when NOT FUZZING AND NOT WASM)
Expand Down
9 changes: 7 additions & 2 deletions barretenberg/cpp/src/barretenberg/api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ if(AVM_TRANSPILER_LIB)
target_link_libraries(api_objects PRIVATE avm_transpiler)
endif()

if(NOT WASM AND NOT BB_LITE)
target_link_libraries(api_objects PRIVATE ipc)
# api_objects compiles api_msgpack.cpp / api_chonk.cpp / api_ultra_honk.cpp
# which transitively include bbapi/generated/bb_types.hpp → ipc_runtime/throw.hpp.
# ipc_runtime is a STATIC lib natively and an INTERFACE (header-only) lib under
# WASM, so linking under both modes just propagates the include path.
if(NOT BB_LITE)
target_include_directories(api_objects PRIVATE ${CMAKE_SOURCE_DIR}/src/barretenberg/bbapi/generated)
target_link_libraries(api_objects PRIVATE ipc_runtime)
endif()
70 changes: 48 additions & 22 deletions barretenberg/cpp/src/barretenberg/api/api_chonk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
#include "barretenberg/api/file_io.hpp"
#include "barretenberg/api/json_output.hpp"
#include "barretenberg/api/log.hpp"
#include "barretenberg/bbapi/bbapi.hpp"
#include "barretenberg/bbapi/bbapi_handlers.hpp"
#include "barretenberg/bbapi/bbapi_shared.hpp"
#include "barretenberg/bbapi/bbapi_wire_convert.hpp"
#include "barretenberg/bbapi/generated/bb_types.hpp"
#include "barretenberg/chonk/chonk.hpp"
#include "barretenberg/chonk/chonk_verifier.hpp"
#include "barretenberg/chonk/mock_circuit_producer.hpp"
Expand Down Expand Up @@ -33,16 +36,21 @@ namespace { // anonymous namespace
*/
void write_chonk_vk(std::vector<uint8_t> bytecode, const std::filesystem::path& output_path, const API::Flags& flags)
{
bbapi::BBApiRequest request;
auto response =
bbapi::ChonkComputeVk{ .circuit = { .bytecode = std::move(bytecode) }, .use_zk_flavor = flags.use_zk_flavor }
.execute();
bbapi::handle_chonk_compute_vk(request,
bbapi::wire::ChonkComputeVk{
.circuit = bbapi::wire::CircuitInputNoVK{ .bytecode = std::move(bytecode) },
.use_zk_flavor = flags.use_zk_flavor,
});

const bool is_stdout = output_path == "-";
if (is_stdout) {
write_bytes_to_stdout(response.bytes);
} else if (flags.output_format == "json") {
// Note: Chonk VK doesn't have a hash, so we pass an empty string
std::string json_content = VkJson::build(response.fields, "", flags.scheme);
// Note: Chonk VK doesn't have a hash, so we pass an empty string.
auto fields = bbapi::fr_vec_from_wire(response.fields);
std::string json_content = VkJson::build(fields, "", flags.scheme);
write_file(output_path / "vk.json", std::vector<uint8_t>(json_content.begin(), json_content.end()));
info("VK (JSON) saved to ", output_path / "vk.json");
} else {
Expand All @@ -60,21 +68,25 @@ void ChonkAPI::prove(const Flags& flags,
request.vk_policy = bbapi::parse_vk_policy(flags.vk_policy);
std::vector<PrivateExecutionStepRaw> raw_steps = PrivateExecutionStepRaw::load_and_decompress(input_path);

bbapi::ChonkStart{ .num_circuits = static_cast<uint32_t>(raw_steps.size()) }.execute(request);
bbapi::handle_chonk_start(request,
bbapi::wire::ChonkStart{ .num_circuits = static_cast<uint32_t>(raw_steps.size()) });
info("Chonk: starting with ", raw_steps.size(), " circuits");
for (size_t i = 0; i < raw_steps.size(); ++i) {
const auto& step = raw_steps[i];
bbapi::ChonkLoad{
.circuit = { .name = step.function_name, .bytecode = step.bytecode, .verification_key = step.vk },
}
.execute(request);
bbapi::handle_chonk_load(request,
bbapi::wire::ChonkLoad{ .circuit = bbapi::wire::CircuitInput{
.name = step.function_name,
.bytecode = step.bytecode,
.verification_key = step.vk,
} });

// NOLINTNEXTLINE(bugprone-unchecked-optional-access): we know the optional has been set here.
info("Chonk: accumulating " + step.function_name);
bbapi::ChonkAccumulate{ .witness = step.witness }.execute(request);
bbapi::handle_chonk_accumulate(request, bbapi::wire::ChonkAccumulate{ .witness = step.witness });
}

auto proof = bbapi::ChonkProve{}.execute(request).proof;
auto wire_proof = bbapi::handle_chonk_prove(request, bbapi::wire::ChonkProve{}).proof;
auto proof = bbapi::chonk_proof_from_wire(std::move(wire_proof));

const bool output_to_stdout = output_dir == "-";

Expand Down Expand Up @@ -117,7 +129,9 @@ bool ChonkAPI::verify([[maybe_unused]] const Flags& flags,

auto vk_buffer = read_vk_file(vk_path);

auto response = bbapi::ChonkVerify{ .proof = std::move(proof), .vk = std::move(vk_buffer) }.execute();
bbapi::BBApiRequest request;
auto response = bbapi::handle_chonk_verify(
request, bbapi::wire::ChonkVerify{ .proof = bbapi::chonk_proof_to_wire(proof), .vk = std::move(vk_buffer) });
return response.valid;
}

Expand Down Expand Up @@ -147,7 +161,14 @@ bool ChonkAPI::batch_verify([[maybe_unused]] const Flags& flags, const std::file

info("ChonkAPI::batch_verify - found ", proofs.size(), " proof/vk pairs in ", proofs_dir.string());

auto response = bbapi::ChonkBatchVerify{ .proofs = std::move(proofs), .vks = std::move(vks) }.execute();
std::vector<bbapi::wire::ChonkProof> wire_proofs;
wire_proofs.reserve(proofs.size());
for (const auto& p : proofs) {
wire_proofs.push_back(bbapi::chonk_proof_to_wire(p));
}
bbapi::BBApiRequest request;
auto response = bbapi::handle_chonk_batch_verify(
request, bbapi::wire::ChonkBatchVerify{ .proofs = std::move(wire_proofs), .vks = std::move(vks) });
return response.valid;
}

Expand Down Expand Up @@ -221,12 +242,14 @@ bool ChonkAPI::check_precomputed_vks(const Flags& flags, const std::filesystem::
return false;
}
const bool use_zk_flavor = (i == raw_steps.size() - 1);
auto response =
bbapi::ChonkCheckPrecomputedVk{
.circuit = { .name = step.function_name, .bytecode = step.bytecode, .verification_key = step.vk },
auto response = bbapi::handle_chonk_check_precomputed_vk(
request,
bbapi::wire::ChonkCheckPrecomputedVk{
.circuit = bbapi::wire::CircuitInput{ .name = step.function_name,
.bytecode = step.bytecode,
.verification_key = step.vk },
.use_zk_flavor = use_zk_flavor,
}
.execute();
});

if (!response.valid) {
info("VK mismatch detected for function ", step.function_name);
Expand Down Expand Up @@ -271,9 +294,12 @@ void chonk_gate_count(const std::string& bytecode_path, bool include_gates_per_o
bbapi::BBApiRequest request;

auto bytecode = get_bytecode(bytecode_path);
auto response = bbapi::ChonkStats{ .circuit = { .name = "ivc_circuit", .bytecode = std::move(bytecode) },
.include_gates_per_opcode = include_gates_per_opcode }
.execute(request);
auto response = bbapi::handle_chonk_stats(
request,
bbapi::wire::ChonkStats{
.circuit = bbapi::wire::CircuitInputNoVK{ .name = "ivc_circuit", .bytecode = std::move(bytecode) },
.include_gates_per_opcode = include_gates_per_opcode,
});

// Build the circuit report. It always has one function, corresponding to the ACIR constraint systems.
// NOTE: can be reconsidered
Expand Down
Loading
Loading