Skip to content

Commit

Permalink
Add prover server to CMake build system. Update prover server cpp fil…
Browse files Browse the repository at this point in the history
…es in order to get them to compile.
  • Loading branch information
rex1fernando committed Jan 16, 2024
1 parent ea72e69 commit 6566077
Show file tree
Hide file tree
Showing 6 changed files with 204 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set(USE_OPENMP ON CACHE BOOL "Use OpenMP")

project(rapidsnark LANGUAGES CXX ASM)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

message("USE_ASM=" ${USE_ASM})
Expand Down
190 changes: 189 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ set(LIB_SOURCES
fileloader.hpp
prover.cpp
prover.h
proverapi.hpp
proverapi.cpp
fullprover.hpp
fullprover.cpp
../depends/ffiasm/c/misc.cpp
../depends/ffiasm/c/naf.cpp
../depends/ffiasm/c/splitparstr.cpp
Expand All @@ -113,16 +117,21 @@ set_target_properties(rapidsnarkStaticFrFq PROPERTIES POSITION_INDEPENDENT_CODE
set_target_properties(rapidsnarkStaticFrFq PROPERTIES OUTPUT_NAME rapidsnark-fr-fq)

add_executable(prover main_prover.cpp)
add_executable(proverServer main_proofserver.cpp)
target_link_libraries(prover rapidsnarkStatic)
target_link_libraries(proverServer rapidsnarkStatic)
target_link_libraries(proverServer pistache)

add_library(rapidsnark SHARED ${LIB_SOURCES})

if(USE_LOGGER OR NOT USE_OPENMP)
target_link_libraries(prover pthread)
target_link_libraries(proverServer pthread)
endif()

if(USE_SODIUM)
target_link_libraries(prover sodium)
target_link_libraries(proverServer sodium)
endif()


Expand All @@ -134,6 +143,7 @@ if(OpenMP_CXX_FOUND)

elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
target_link_libraries(prover OpenMP::OpenMP_CXX)
target_link_libraries(proverServer OpenMP::OpenMP_CXX)
endif()

endif()
Expand Down
4 changes: 2 additions & 2 deletions src/fullprover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <fstream>

#include "fullprover.hpp"
#include "fr.hpp"

#include "logger.hpp"
#include "logging.hpp"
#include "wtns_utils.hpp"

using namespace CPlusPlusLogging;

std::string getfilename(std::string path)
{
Expand Down
5 changes: 1 addition & 4 deletions src/main_proofserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
#include <pistache/endpoint.h>
#include "proverapi.hpp"
#include "fullprover.hpp"
#include "logger.hpp"
#include "logging.hpp"

using namespace CPlusPlusLogging;
using namespace Pistache;
using namespace Pistache::Rest;

Expand All @@ -15,8 +14,6 @@ int main(int argc, char **argv) {
return -1;
}

Logger::getInstance()->enableConsoleLogging();
Logger::getInstance()->updateLogLevel(LOG_LEVEL_DEBUG);
LOG_INFO("Initializing server...");
int port = std::stoi(argv[1]); // parse port
// parse the zkeys
Expand Down
2 changes: 1 addition & 1 deletion src/proverapi.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "proverapi.hpp"
#include "nlohmann/json.hpp"
#include "logger.hpp"
#include "logging.hpp"

using namespace Pistache;
using json = nlohmann::json;
Expand Down

0 comments on commit 6566077

Please sign in to comment.