8#include <gtest/gtest.h>
20class ChonkPinnedIvcInputsTest :
public ::testing::Test {
24 static std::filesystem::path find_repo_root()
26 if (
const char* env =
std::getenv(
"AZTEC_REPO_ROOT"); env !=
nullptr && *env !=
'\0') {
27 return std::filesystem::path{ env };
29 return std::filesystem::weakly_canonical(std::filesystem::current_path() /
"../../..");
32 static std::filesystem::path pinned_inputs_root()
34 if (
const char* env =
std::getenv(
"CHONK_PINNED_IVC_INPUTS_DIR"); env !=
nullptr && *env !=
'\0') {
35 return std::filesystem::path{ env };
37 return find_repo_root() /
"yarn-project/end-to-end/example-app-ivc-inputs-out";
43 if (!std::filesystem::is_directory(inputs_root)) {
46 for (
const auto& entry :
std::filesystem::directory_iterator(inputs_root)) {
47 if (entry.is_directory() && std::filesystem::exists(entry.path() /
"ivc-inputs.msgpack")) {
48 flows.push_back(entry.path());
60 [filter](
const auto& flow) {
61 return flow.filename().string().find(filter) == std::string::npos;
66 const char* limit_env =
std::getenv(
"CHONK_PINNED_IVC_FLOW_LIMIT");
67 if (limit_env ==
nullptr || *limit_env ==
'\0') {
71 const long limit =
std::strtol(limit_env, &end, 10);
72 if (end != limit_env && *end ==
'\0' && limit > 0 &&
static_cast<size_t>(limit) < flows.size()) {
73 flows.resize(
static_cast<size_t>(limit));
77 static void run_flow(
const std::filesystem::path& flow_dir)
79 const std::filesystem::path inputs_path = flow_dir /
"ivc-inputs.msgpack";
80 info(
"ChonkPinnedIvcInputs: loading ", inputs_path.string());
83 ASSERT_FALSE(raw_steps.empty()) <<
"no execution steps in " << inputs_path;
85 const auto hiding_bytecode = raw_steps.back().bytecode;
92 for (
auto& step : raw_steps) {
105 auto verify_response =
108 EXPECT_TRUE(verify_response.valid) <<
"ChonkVerify rejected " << flow_dir.filename();
112TEST_F(ChonkPinnedIvcInputsTest, AllPinnedFlows)
114 const auto inputs_root = pinned_inputs_root();
115 auto flows = find_flow_dirs(inputs_root);
116 ASSERT_FALSE(flows.empty()) <<
"no pinned Chonk flows under " << inputs_root
117 <<
". Run `barretenberg/cpp/scripts/chonk_inputs.sh download` first.";
119 apply_flow_selection(flows);
120 const char* flow_filter =
std::getenv(
"CHONK_PINNED_IVC_FLOW");
121 ASSERT_FALSE(flows.empty() && flow_filter !=
nullptr && *flow_filter !=
'\0')
122 <<
"CHONK_PINNED_IVC_FLOW='" << flow_filter <<
"' matched no pinned flows under " << inputs_root;
123 ASSERT_FALSE(flows.empty()) <<
"no pinned Chonk flows found under " << inputs_root;
125 for (
const auto& flow : flows) {
126 SCOPED_TRACE(
"flow: " + flow.filename().string());
Chonk-specific command definitions for the Barretenberg RPC API.
Shared type definitions for the Barretenberg RPC API.
TEST_F(BoomerangIPARecursiveTests, FullRecursiveVerifierMediumRandom)
std::filesystem::path bb_crs_path()
void init_file_crs_factory(const std::filesystem::path &path)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
static std::vector< PrivateExecutionStepRaw > load_and_decompress(const std::filesystem::path &input_path)
Accumulate the previously loaded circuit into the IVC proof.
std::vector< uint8_t > witness
Serialized witness data for the last loaded circuit.
Compute MegaHonk verification key for a circuit to be accumulated in Chonk.
Load a circuit into the Chonk instance for accumulation.
CircuitInput circuit
Circuit to be loaded with its bytecode and verification key.
Generate a proof for all accumulated circuits.
Response execute(BBApiRequest &request) &&
Initialize a new Chonk instance for incremental proof accumulation.
Verify a Chonk proof with its verification key.
ChonkProof proof
The Chonk proof to verify.