Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
cli.cpp
Go to the documentation of this file.
5
7#include <string>
8
9namespace bb::avm {
10
11int parse_and_run_avm(int argc, char* argv[])
12{
13 CLI::App app{ "bb-avm-sim: Standalone AVM simulator server" };
14 app.require_subcommand(1);
15
16 // -----------------------------------------------------------------------
17 // Subcommand: msgpack
18 // -----------------------------------------------------------------------
19 CLI::App* msgpack_command = app.add_subcommand("msgpack", "Msgpack API interface.");
20
21 // msgpack run
22 CLI::App* msgpack_run_command = msgpack_command->add_subcommand("run", "Start the AVM simulator IPC server.");
23
24 std::string input_path;
25 msgpack_run_command->add_option("-i,--input", input_path, "IPC socket/shm path (.sock or .shm)")->required();
26
27 std::string wsdb_path;
28 msgpack_run_command->add_option("--wsdb", wsdb_path, "WSDB server IPC path")->required();
29
30 std::string cdb_path;
31 msgpack_run_command->add_option("--cdb", cdb_path, "CDB server IPC path")->required();
32
33 // Parse CLI
34 try {
35 app.parse(argc, argv);
36 } catch (const CLI::ParseError& e) {
37 return app.exit(e);
38 }
39
40 try {
41 if (msgpack_run_command->parsed()) {
42 return execute_avm_server(input_path, wsdb_path, cdb_path);
43 }
44 } catch (const std::exception& e) {
45 info("Error: ", e.what());
46 return 1;
47 }
48
49 return 0;
50}
51
52} // namespace bb::avm
AVM IPC handler context.
#define info(...)
Definition log.hpp:93
int execute_avm_server(const std::string &input_path, const std::string &wsdb_path, const std::string &cdb_path)
Start the bb-avm-sim IPC server.
int parse_and_run_avm(int argc, char *argv[])
Definition cli.cpp:11