diff --git a/src/config/config.cpp b/src/config/config.cpp index c283d203e..6602c37e5 100644 --- a/src/config/config.cpp +++ b/src/config/config.cpp @@ -1,4 +1,5 @@ #include +#include #include #include "definitions.hpp" #include "config.hpp" @@ -263,7 +264,13 @@ void Config::load(json &config) finalVerifier = configPath + "/final/final.verifier.dat"; finalVerkey = configPath + "/final/final.fflonk.verkey.json"; finalStarkZkey = configPath + "/final/final.fflonk.zkey"; - + // check if file exists + ifstream f; + f.open(finalVerkey); + if (f.fail()) { + finalVerkey = configPath + "/final/final.verkey.json"; + finalStarkZkey = configPath + "/final/final.g16.0001.zkey"; + } if (config.contains("rom") && config["rom"].is_string()) rom = config["rom"]; diff --git a/src/prover/prover.cpp b/src/prover/prover.cpp index 45ada1f5f..7f8878af7 100644 --- a/src/prover/prover.cpp +++ b/src/prover/prover.cpp @@ -113,8 +113,10 @@ Prover::Prover(Goldilocks &fr, cout << "Prover::genBatchProof() successfully allocated " << polsSize << " bytes" << endl; } - prover = new Fflonk::FflonkProver(AltBn128::Engine::engine, pAddress, polsSize); - prover->setZkey(zkey.get()); + if (Zkey::FFLONK_PROTOCOL_ID == protocolId) { + prover = new Fflonk::FflonkProver(AltBn128::Engine::engine, pAddress, polsSize); + prover->setZkey(zkey.get()); + } StarkInfo _starkInfoRecursiveF(config, config.recursivefStarkInfo); pAddressStarksRecursiveF = (void *)malloc(_starkInfoRecursiveF.mapTotalN * sizeof(Goldilocks::Element)); @@ -142,8 +144,6 @@ Prover::~Prover() BinFileUtils::BinFile *pZkey = zkey.release(); ZKeyUtils::Header *pZkeyHeader = zkeyHeader.release(); - assert(groth16Prover.get() == nullptr); - assert(groth16Prover == nullptr); assert(zkey.get() == nullptr); assert(zkey == nullptr); assert(zkeyHeader.get() == nullptr); @@ -168,7 +168,8 @@ Prover::~Prover() } free(pAddressStarksRecursiveF); - delete prover; + if (prover != NULL) + delete prover; delete starkZkevm; delete starksC12a;