mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-04-29 15:37:59 +00:00
Cmake cleanup (#77)
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -4,7 +4,7 @@
|
||||
.*.sw?
|
||||
.DS_Store
|
||||
build
|
||||
hpsupport.dir
|
||||
hpcore.dir
|
||||
.vscode
|
||||
**/Makefile
|
||||
**/CMakeCache.txt
|
||||
|
||||
164
CMakeLists.txt
164
CMakeLists.txt
@@ -21,13 +21,73 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY build)
|
||||
|
||||
link_directories(/usr/local/lib)
|
||||
|
||||
add_library(hpsupport
|
||||
# We have 3 executable build outputs: appbill, hpstatemon and hpcore
|
||||
|
||||
|
||||
#-------appbill-------
|
||||
|
||||
add_executable(appbill
|
||||
src/bill/appbill.cpp
|
||||
)
|
||||
|
||||
|
||||
#-------hpstatemon-------
|
||||
|
||||
add_executable(hpstatemon
|
||||
src/statefs/state_monitor/fusefs.cpp
|
||||
src/statefs/state_monitor/state_monitor.cpp
|
||||
src/statefs/hasher.cpp
|
||||
src/statefs/state_common.cpp
|
||||
)
|
||||
target_link_libraries(hpstatemon
|
||||
libfuse3.so.3
|
||||
libsodium.a
|
||||
libboost_system.a
|
||||
libboost_thread.a
|
||||
libboost_filesystem.a
|
||||
libboost_stacktrace_backtrace.a
|
||||
backtrace
|
||||
pthread
|
||||
crypto
|
||||
ssl
|
||||
${CMAKE_DL_LIBS} # Needed for stacktrace support
|
||||
)
|
||||
|
||||
|
||||
#-------hpcore-------
|
||||
|
||||
add_executable(hpcore
|
||||
src/util.cpp
|
||||
src/crypto.cpp
|
||||
src/conf.cpp
|
||||
src/hplog.cpp
|
||||
src/proc.cpp
|
||||
src/bill/corebill.cpp
|
||||
src/statefs/hasher.cpp
|
||||
src/statefs/state_common.cpp
|
||||
src/statefs/hashmap_builder.cpp
|
||||
src/statefs/hashtree_builder.cpp
|
||||
src/statefs/state_restore.cpp
|
||||
src/statefs/state_store.cpp
|
||||
src/sock/socket_client.cpp
|
||||
src/sock/socket_server.cpp
|
||||
src/sock/socket_message.cpp
|
||||
src/sock/socket_session.cpp
|
||||
src/sock/socket_session_lambda.cpp
|
||||
src/fbschema/common_helpers.cpp
|
||||
src/fbschema/p2pmsg_helpers.cpp
|
||||
src/fbschema/ledger_helpers.cpp
|
||||
src/jsonschema/usrmsg_helpers.cpp
|
||||
src/p2p/peer_session_handler.cpp
|
||||
src/p2p/p2p.cpp
|
||||
src/usr/user_session_handler.cpp
|
||||
src/usr/usr.cpp
|
||||
src/cons/cons.cpp
|
||||
src/cons/ledger_handler.cpp
|
||||
src/cons/state_handler.cpp
|
||||
src/main.cpp
|
||||
)
|
||||
target_link_libraries(hpsupport
|
||||
target_link_libraries(hpcore
|
||||
libsodium.a
|
||||
libboost_system.a
|
||||
libboost_thread.a
|
||||
@@ -39,94 +99,8 @@ target_link_libraries(hpsupport
|
||||
pthread
|
||||
crypto
|
||||
ssl
|
||||
${CMAKE_DL_LIBS}
|
||||
${CMAKE_DL_LIBS} # Needed for stacktrace support
|
||||
)
|
||||
|
||||
add_library(hpstatefs
|
||||
src/statefs/hasher.cpp
|
||||
src/statefs/state_common.cpp
|
||||
src/statefs/hashmap_builder.cpp
|
||||
src/statefs/hashtree_builder.cpp
|
||||
src/statefs/state_restore.cpp
|
||||
src/statefs/state_store.cpp
|
||||
)
|
||||
target_link_libraries(hpstatefs hpsupport)
|
||||
|
||||
add_library(hpproc
|
||||
src/proc/proc.cpp
|
||||
)
|
||||
target_link_libraries(hpproc hpsupport hpstatefs)
|
||||
|
||||
add_library(hpbill
|
||||
src/bill/corebill.cpp
|
||||
)
|
||||
target_link_libraries(hpbill hpsupport)
|
||||
|
||||
add_library(hpsock
|
||||
src/sock/socket_client.cpp
|
||||
src/sock/socket_server.cpp
|
||||
src/sock/socket_message.cpp
|
||||
src/sock/socket_session.cpp
|
||||
src/sock/socket_session_lambda.cpp
|
||||
)
|
||||
target_link_libraries(hpsock hpsupport hpbill)
|
||||
|
||||
add_library(hpschema
|
||||
src/fbschema/common_helpers.cpp
|
||||
src/fbschema/p2pmsg_helpers.cpp
|
||||
src/fbschema/ledger_helpers.cpp
|
||||
src/jsonschema/usrmsg_helpers.cpp
|
||||
)
|
||||
target_link_libraries(hpschema hpsupport)
|
||||
|
||||
add_library(hpp2p
|
||||
src/p2p/peer_session_handler.cpp
|
||||
src/p2p/p2p.cpp
|
||||
)
|
||||
target_link_libraries(hpp2p hpsupport hpsock hpschema)
|
||||
|
||||
add_library(hpusr
|
||||
src/usr/user_session_handler.cpp
|
||||
src/usr/usr.cpp
|
||||
)
|
||||
target_link_libraries(hpusr hpsupport hpsock hpschema)
|
||||
|
||||
add_library(hpcons
|
||||
src/cons/cons.cpp
|
||||
src/cons/ledger_handler.cpp
|
||||
src/cons/state_handler.cpp
|
||||
)
|
||||
target_link_libraries(hpcons hpsupport hpproc hpp2p hpusr)
|
||||
|
||||
add_executable(hpcore
|
||||
src/main.cpp
|
||||
)
|
||||
target_link_libraries(hpcore
|
||||
hpsupport
|
||||
hpproc
|
||||
hpbill
|
||||
hpschema
|
||||
hpsock
|
||||
hpp2p
|
||||
hpusr
|
||||
hpcons
|
||||
)
|
||||
|
||||
add_executable(hpstatemon
|
||||
src/statefs/state_monitor/fusefs.cpp
|
||||
src/statefs/state_monitor/state_monitor.cpp
|
||||
src/statefs/hasher.cpp
|
||||
src/statefs/state_common.cpp
|
||||
)
|
||||
target_link_libraries(hpstatemon
|
||||
hpsupport
|
||||
libfuse3.so.3
|
||||
)
|
||||
|
||||
add_executable(appbill
|
||||
src/bill/appbill.cpp
|
||||
)
|
||||
|
||||
add_dependencies(hpcore
|
||||
hpstatemon
|
||||
appbill
|
||||
@@ -138,21 +112,15 @@ add_dependencies(hpcore
|
||||
# COMMAND strip ./build/appbill
|
||||
# )
|
||||
|
||||
target_precompile_headers(hpsupport PUBLIC src/pchheader.hpp)
|
||||
target_precompile_headers(hpcore REUSE_FROM hpsupport)
|
||||
target_precompile_headers(hpsock REUSE_FROM hpsupport)
|
||||
target_precompile_headers(hpschema REUSE_FROM hpsupport)
|
||||
target_precompile_headers(hpp2p REUSE_FROM hpsupport)
|
||||
target_precompile_headers(hpusr REUSE_FROM hpsupport)
|
||||
target_precompile_headers(hpcons REUSE_FROM hpsupport)
|
||||
target_precompile_headers(hpstatemon REUSE_FROM hpsupport)
|
||||
target_precompile_headers(hpstatemon PUBLIC src/pchheader.hpp)
|
||||
target_precompile_headers(hpcore REUSE_FROM hpcore)
|
||||
|
||||
# Create docker image from hpcore build output with 'make docker'
|
||||
# Requires docker to be runnable without 'sudo'
|
||||
add_custom_target(docker
|
||||
COMMAND mkdir -p ./test/local-cluster/bin
|
||||
COMMAND cp ./build/hpcore ./build/hpstatemon ./build/appbill ./test/local-cluster/bin/
|
||||
COMMAND cp ./fusebin/fusermount3 ./fusebin/libfuse3.so.3 ./test/local-cluster/bin/
|
||||
COMMAND cp ./test/fusebin/fusermount3 ./test/fusebin/libfuse3.so.3 ./test/local-cluster/bin/
|
||||
COMMAND docker build -t hpcore:latest ./test/local-cluster
|
||||
)
|
||||
set_target_properties(docker PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||
|
||||
62
src/conf.cpp
62
src/conf.cpp
@@ -61,7 +61,7 @@ int rekey()
|
||||
if (save_config() != 0)
|
||||
return -1;
|
||||
|
||||
std::cout << "New signing keys generated at " << ctx.configfile << std::endl;
|
||||
std::cout << "New signing keys generated at " << ctx.config_file << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -73,15 +73,15 @@ int rekey()
|
||||
*/
|
||||
int create_contract()
|
||||
{
|
||||
if (boost::filesystem::exists(ctx.contractdir))
|
||||
if (boost::filesystem::exists(ctx.contract_dir))
|
||||
{
|
||||
std::cout << "Contract dir already exists. Cannot create contract at the same location.\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
boost::filesystem::create_directories(ctx.configdir);
|
||||
boost::filesystem::create_directories(ctx.histdir);
|
||||
boost::filesystem::create_directories(ctx.statedir);
|
||||
boost::filesystem::create_directories(ctx.config_dir);
|
||||
boost::filesystem::create_directories(ctx.hist_dir);
|
||||
boost::filesystem::create_directories(ctx.state_dir);
|
||||
boost::filesystem::create_directories(ctx.state_hist_dir);
|
||||
|
||||
//Create config file with default settings.
|
||||
@@ -110,7 +110,7 @@ int create_contract()
|
||||
if (save_config() != 0)
|
||||
return -1;
|
||||
|
||||
std::cout << "Contract directory created at " << ctx.contractdir << std::endl;
|
||||
std::cout << "Contract directory created at " << ctx.contract_dir << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -138,18 +138,18 @@ void set_contract_dir_paths(std::string exepath, std::string basedir)
|
||||
// resolving the path through realpath will remove any trailing slash if present
|
||||
basedir = util::realpath(basedir);
|
||||
|
||||
ctx.exedir = boost::filesystem::path(util::realpath(exepath)).parent_path().string();
|
||||
ctx.statemonexepath = ctx.exedir + "/" + "hpstatemon";
|
||||
ctx.exe_dir = boost::filesystem::path(util::realpath(exepath)).parent_path().string();
|
||||
ctx.statemon_exe_path = ctx.exe_dir + "/" + "hpstatemon";
|
||||
|
||||
ctx.contractdir = basedir;
|
||||
ctx.configdir = basedir + "/cfg";
|
||||
ctx.configfile = ctx.configdir + "/hp.cfg";
|
||||
ctx.tlskeyfile = ctx.configdir + "/tlskey.pem";
|
||||
ctx.tlscertfile = ctx.configdir + "/tlscert.pem";
|
||||
ctx.histdir = basedir + "/hist";
|
||||
ctx.statedir = basedir + "/state";
|
||||
ctx.contract_dir = basedir;
|
||||
ctx.config_dir = basedir + "/cfg";
|
||||
ctx.config_file = ctx.config_dir + "/hp.cfg";
|
||||
ctx.tls_key_file = ctx.config_dir + "/tlskey.pem";
|
||||
ctx.tls_cert_file = ctx.config_dir + "/tlscert.pem";
|
||||
ctx.hist_dir = basedir + "/hist";
|
||||
ctx.state_dir = basedir + "/state";
|
||||
ctx.state_hist_dir = basedir + "/statehist";
|
||||
ctx.logdir = basedir + "/log";
|
||||
ctx.log_dir = basedir + "/log";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,7 +161,7 @@ int load_config()
|
||||
{
|
||||
// Read the file into json document object.
|
||||
|
||||
std::ifstream ifs(ctx.configfile);
|
||||
std::ifstream ifs(ctx.config_file);
|
||||
rapidjson::IStreamWrapper isw(ifs);
|
||||
|
||||
rapidjson::Document d;
|
||||
@@ -225,18 +225,18 @@ int load_config()
|
||||
// Populate runtime contract execution args.
|
||||
if (!cfg.binargs.empty())
|
||||
boost::split(cfg.runtime_binexec_args, cfg.binargs, boost::is_any_of(" "));
|
||||
cfg.runtime_binexec_args.insert(cfg.runtime_binexec_args.begin(), ( cfg.binary[0] == '/' ? cfg.binary : util::realpath( ctx.contractdir + "/bin/" + cfg.binary ) ) );
|
||||
cfg.runtime_binexec_args.insert(cfg.runtime_binexec_args.begin(), ( cfg.binary[0] == '/' ? cfg.binary : util::realpath( ctx.contract_dir + "/bin/" + cfg.binary ) ) );
|
||||
|
||||
|
||||
// Populate runtime app bill args.
|
||||
if (!cfg.appbillargs.empty())
|
||||
boost::split(cfg.runtime_appbill_args, cfg.appbillargs, boost::is_any_of(" "));
|
||||
|
||||
cfg.runtime_appbill_args.insert(cfg.runtime_appbill_args.begin(), ( cfg.appbill[0] == '/' ? cfg.appbill : util::realpath( ctx.contractdir + "/bin/" + cfg.appbill ) ) );
|
||||
cfg.runtime_appbill_args.insert(cfg.runtime_appbill_args.begin(), ( cfg.appbill[0] == '/' ? cfg.appbill : util::realpath( ctx.contract_dir + "/bin/" + cfg.appbill ) ) );
|
||||
|
||||
// Uncomment for docker-based execution.
|
||||
// std::string volumearg;
|
||||
// volumearg.append("type=bind,source=").append(ctx.statedir).append(",target=/state");
|
||||
// volumearg.append("type=bind,source=").append(ctx.state_dir).append(",target=/state");
|
||||
// const char *dockerargs[] = {"/usr/bin/docker", "run", "--rm", "-i", "--mount", volumearg.data(), cfg.binary.data()};
|
||||
// cfg.runtime_binexec_args.insert(cfg.runtime_binexec_args.begin(), std::begin(dockerargs), std::end(dockerargs));
|
||||
|
||||
@@ -378,13 +378,13 @@ int save_config()
|
||||
|
||||
// Write the json doc to file.
|
||||
|
||||
std::ofstream ofs(ctx.configfile);
|
||||
std::ofstream ofs(ctx.config_file);
|
||||
rapidjson::OStreamWrapper osw(ofs);
|
||||
|
||||
rapidjson::PrettyWriter<rapidjson::OStreamWrapper> writer(osw);
|
||||
if (!d.Accept(writer))
|
||||
{
|
||||
std::cout << "Writing to config file failed. " << ctx.configfile << std::endl;
|
||||
std::cout << "Writing to config file failed. " << ctx.config_file << std::endl;
|
||||
return -1;
|
||||
}
|
||||
ofs.close();
|
||||
@@ -471,7 +471,7 @@ int validate_config()
|
||||
|
||||
if (fields_missing)
|
||||
{
|
||||
std::cout << "Required configuration fields missing at " << ctx.configfile << std::endl;
|
||||
std::cout << "Required configuration fields missing at " << ctx.config_file << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -513,23 +513,23 @@ int validate_config()
|
||||
int validate_contract_dir_paths()
|
||||
{
|
||||
const std::string paths[7] = {
|
||||
ctx.contractdir,
|
||||
ctx.configfile,
|
||||
ctx.histdir,
|
||||
ctx.statedir,
|
||||
ctx.contract_dir,
|
||||
ctx.config_file,
|
||||
ctx.hist_dir,
|
||||
ctx.state_dir,
|
||||
ctx.state_hist_dir,
|
||||
ctx.tlskeyfile,
|
||||
ctx.tlscertfile};
|
||||
ctx.tls_key_file,
|
||||
ctx.tls_cert_file};
|
||||
|
||||
for (const std::string &path : paths)
|
||||
{
|
||||
if (!boost::filesystem::exists(path))
|
||||
{
|
||||
if (path == ctx.tlskeyfile || path == ctx.tlscertfile)
|
||||
if (path == ctx.tls_key_file || path == ctx.tls_cert_file)
|
||||
{
|
||||
std::cout << path << " does not exist. Please provide self-signed certificates. Can generate using command\n"
|
||||
<< "openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout tlskey.pem -out tlscert.pem\n"
|
||||
<< "and add it to " + ctx.configdir << std::endl;
|
||||
<< "and add it to " + ctx.config_dir << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
21
src/conf.hpp
21
src/conf.hpp
@@ -24,18 +24,18 @@ enum OPERATING_MODE
|
||||
struct contract_ctx
|
||||
{
|
||||
std::string command; // The CLI command issued to launch HotPocket
|
||||
std::string exedir; // Hot Pocket executable dir.
|
||||
std::string statemonexepath;// State monitor executable file path.
|
||||
std::string exe_dir; // Hot Pocket executable dir.
|
||||
std::string statemon_exe_path;// State monitor executable file path.
|
||||
|
||||
std::string contractdir; // Contract base directory full path
|
||||
std::string histdir; // Contract history dir full path
|
||||
std::string statedir; // Contract executing state dir full path (This is the fuse mount point)
|
||||
std::string contract_dir; // Contract base directory full path
|
||||
std::string hist_dir; // Contract ledger history dir full path
|
||||
std::string state_dir; // Contract executing state dir full path (This is the fuse mount point)
|
||||
std::string state_hist_dir; // Contract state history dir full path
|
||||
std::string logdir; // Contract log dir full path
|
||||
std::string configdir; // Contract config dir full path
|
||||
std::string configfile; // Full path to the contract config file
|
||||
std::string tlskeyfile; // Full path to the tls secret key file
|
||||
std::string tlscertfile; // Full path to the tls certificate
|
||||
std::string log_dir; // Contract log dir full path
|
||||
std::string config_dir; // Contract config dir full path
|
||||
std::string config_file; // Full path to the contract config file
|
||||
std::string tls_key_file; // Full path to the tls secret key file
|
||||
std::string tls_cert_file; // Full path to the tls certificate
|
||||
};
|
||||
|
||||
// Holds all the contract config values.
|
||||
@@ -54,7 +54,6 @@ struct contract_config
|
||||
OPERATING_MODE mode; // Operating mode of the contract (Observing/Proposing).
|
||||
std::string pubkeyhex; // Contract hex public key
|
||||
std::string seckeyhex; // Contract hex secret key
|
||||
std::string keytype; // Key generation algorithm used by libsodium
|
||||
std::string binary; // Full path to the contract binary
|
||||
std::string binargs; // CLI arguments to pass to the contract binary
|
||||
std::string appbill; // binary to execute for appbill
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "../p2p/peer_session_handler.hpp"
|
||||
#include "../hplog.hpp"
|
||||
#include "../crypto.hpp"
|
||||
#include "../proc/proc.hpp"
|
||||
#include "../proc.hpp"
|
||||
#include "ledger_handler.hpp"
|
||||
#include "state_handler.hpp"
|
||||
#include "cons.hpp"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "../pchheader.hpp"
|
||||
#include "../util.hpp"
|
||||
#include "../proc/proc.hpp"
|
||||
#include "../proc.hpp"
|
||||
#include "../p2p/p2p.hpp"
|
||||
#include "../usr/user_input.hpp"
|
||||
#include "ledger_handler.hpp"
|
||||
|
||||
@@ -84,8 +84,8 @@ void remove_old_ledgers(const uint64_t led_seq_no)
|
||||
|
||||
std::string dir_path;
|
||||
|
||||
dir_path.reserve(conf::ctx.histdir.size() + 1);
|
||||
dir_path.append(conf::ctx.histdir)
|
||||
dir_path.reserve(conf::ctx.hist_dir.size() + 1);
|
||||
dir_path.append(conf::ctx.hist_dir)
|
||||
.append("/");
|
||||
|
||||
for (itr = cons::ctx.cache.begin();
|
||||
@@ -120,8 +120,8 @@ void write_ledger(const std::string &file_name, const char *ledger_raw, size_t l
|
||||
|
||||
std::string path;
|
||||
|
||||
path.reserve(file_name.size() + conf::ctx.histdir.size() + 5);
|
||||
path.append(conf::ctx.histdir)
|
||||
path.reserve(file_name.size() + conf::ctx.hist_dir.size() + 5);
|
||||
path.append(conf::ctx.hist_dir)
|
||||
.append("/")
|
||||
.append(file_name)
|
||||
.append(".lcl");
|
||||
@@ -139,8 +139,8 @@ void write_ledger(const std::string &file_name, const char *ledger_raw, size_t l
|
||||
void remove_ledger(const std::string &file_name)
|
||||
{
|
||||
std::string file_path;
|
||||
file_path.reserve(conf::ctx.histdir.size() + file_name.size() + 5);
|
||||
file_path.append(conf::ctx.histdir)
|
||||
file_path.reserve(conf::ctx.hist_dir.size() + file_name.size() + 5);
|
||||
file_path.append(conf::ctx.hist_dir)
|
||||
.append("/")
|
||||
.append(file_name)
|
||||
.append(".lcl");
|
||||
@@ -156,18 +156,18 @@ const ledger_history load_ledger()
|
||||
ledger_history ldg_hist;
|
||||
//Get all records at lcl history direcory and find the last closed ledger.
|
||||
size_t latest_pos = 0;
|
||||
for (const auto &entry : boost::filesystem::directory_iterator(conf::ctx.histdir))
|
||||
for (const auto &entry : boost::filesystem::directory_iterator(conf::ctx.hist_dir))
|
||||
{
|
||||
const boost::filesystem::path file_path = entry.path();
|
||||
const std::string file_name = file_path.stem().string();
|
||||
|
||||
if (boost::filesystem::is_directory(file_path))
|
||||
{
|
||||
LOG_ERR << "Found directory " << file_name << " in " << conf::ctx.histdir << ". There should be no folders in this directory";
|
||||
LOG_ERR << "Found directory " << file_name << " in " << conf::ctx.hist_dir << ". There should be no folders in this directory";
|
||||
}
|
||||
else if (file_path.extension() != ".lcl")
|
||||
{
|
||||
LOG_ERR << "Found invalid file extension: " << file_path.extension() << " for lcl file " << file_name << " in " << conf::ctx.histdir;
|
||||
LOG_ERR << "Found invalid file extension: " << file_path.extension() << " for lcl file " << file_name << " in " << conf::ctx.hist_dir;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -197,7 +197,7 @@ const ledger_history load_ledger()
|
||||
else
|
||||
{
|
||||
//lcl records should follow [ledger sequnce numer]-lcl[lcl hex] format.
|
||||
LOG_ERR << "Invalid lcl file name: " << file_name << " in " << conf::ctx.histdir;
|
||||
LOG_ERR << "Invalid lcl file name: " << file_name << " in " << conf::ctx.hist_dir;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -345,8 +345,8 @@ const p2p::history_response retrieve_ledger_history(const p2p::history_request &
|
||||
|
||||
std::string path;
|
||||
|
||||
path.reserve(conf::ctx.histdir.size() + cache.lcl.size() + 5);
|
||||
path.append(conf::ctx.histdir)
|
||||
path.reserve(conf::ctx.hist_dir.size() + cache.lcl.size() + 5);
|
||||
path.append(conf::ctx.hist_dir)
|
||||
.append("/")
|
||||
.append(cache.lcl)
|
||||
.append(".lcl");
|
||||
|
||||
@@ -57,8 +57,8 @@ void init()
|
||||
if (conf::cfg.loggers.count("file") == 1)
|
||||
{
|
||||
logging::add_file_log(
|
||||
keywords::target = conf::ctx.logdir, // Log file directory.
|
||||
keywords::file_name = conf::ctx.logdir + "/hp_%N.log", // File name pattern "hp_1.log".
|
||||
keywords::target = conf::ctx.log_dir, // Log file directory.
|
||||
keywords::file_name = conf::ctx.log_dir + "/hp_%N.log", // File name pattern "hp_1.log".
|
||||
keywords::rotation_size = 10 * 1024 * 1024, // Rotate files every 10 MB.
|
||||
keywords::max_size = 500 * 1024 * 1024, // Do not exceed 500 MB total logs.
|
||||
keywords::filter = (a_severity >= severity),
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "util.hpp"
|
||||
#include "conf.hpp"
|
||||
#include "crypto.hpp"
|
||||
#include "proc/proc.hpp"
|
||||
#include "proc.hpp"
|
||||
#include "hplog.hpp"
|
||||
#include "usr/usr.hpp"
|
||||
#include "p2p/p2p.hpp"
|
||||
@@ -176,7 +176,7 @@ int main(int argc, char **argv)
|
||||
|
||||
// Set HP process cwd to the contract directory. This will make both HP and contract process
|
||||
// both have the same cwd.
|
||||
chdir(conf::ctx.contractdir.c_str());
|
||||
chdir(conf::ctx.contract_dir.c_str());
|
||||
|
||||
hplog::init();
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#include "../pchheader.hpp"
|
||||
#include "../conf.hpp"
|
||||
#include "../hplog.hpp"
|
||||
#include "../fbschema/common_helpers.hpp"
|
||||
#include "../fbschema/p2pmsg_container_generated.h"
|
||||
#include "../fbschema/p2pmsg_content_generated.h"
|
||||
#include "../statefs/hasher.hpp"
|
||||
#include "../statefs/state_common.hpp"
|
||||
#include "../statefs/hashtree_builder.hpp"
|
||||
#include "pchheader.hpp"
|
||||
#include "conf.hpp"
|
||||
#include "hplog.hpp"
|
||||
#include "fbschema/common_helpers.hpp"
|
||||
#include "fbschema/p2pmsg_container_generated.h"
|
||||
#include "fbschema/p2pmsg_content_generated.h"
|
||||
#include "statefs/hasher.hpp"
|
||||
#include "statefs/state_common.hpp"
|
||||
#include "statefs/hashtree_builder.hpp"
|
||||
#include "proc.hpp"
|
||||
#include "../cons/cons.hpp"
|
||||
#include "cons/cons.hpp"
|
||||
|
||||
namespace proc
|
||||
{
|
||||
@@ -161,7 +161,7 @@ int start_state_monitor()
|
||||
// Give enough time for the state monitor to start.
|
||||
// We wait until Fuse filesystem is mounted for max number of retries.
|
||||
uint16_t retry_count = 0;
|
||||
std::string findmnt_command = FINDMNT_COMMAND + conf::ctx.statedir;
|
||||
std::string findmnt_command = FINDMNT_COMMAND + conf::ctx.state_dir;
|
||||
while (retry_count < 50)
|
||||
{
|
||||
util::sleep(10);
|
||||
@@ -181,9 +181,9 @@ int start_state_monitor()
|
||||
|
||||
// Fill process args.
|
||||
char *execv_args[4];
|
||||
execv_args[0] = conf::ctx.statemonexepath.data();
|
||||
execv_args[0] = conf::ctx.statemon_exe_path.data();
|
||||
execv_args[1] = conf::ctx.state_hist_dir.data();
|
||||
execv_args[2] = conf::ctx.statedir.data();
|
||||
execv_args[2] = conf::ctx.state_dir.data();
|
||||
execv_args[3] = NULL;
|
||||
|
||||
int ret = execv(execv_args[0], execv_args);
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef _HP_PROC_
|
||||
#define _HP_PROC_
|
||||
|
||||
#include "../pchheader.hpp"
|
||||
#include "../usr/usr.hpp"
|
||||
#include "../util.hpp"
|
||||
#include "pchheader.hpp"
|
||||
#include "usr/usr.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
/**
|
||||
* Contains helper functions regarding POSIX process execution and IPC between HP and SC.
|
||||
@@ -58,11 +58,11 @@ void socket_server<T>::run()
|
||||
boost::asio::ssl::context::no_sslv3);
|
||||
|
||||
//Providing the certification file for ssl context
|
||||
ctx.use_certificate_chain_file(conf::ctx.tlscertfile);
|
||||
ctx.use_certificate_chain_file(conf::ctx.tls_cert_file);
|
||||
|
||||
// Providing key file for the ssl context
|
||||
ctx.use_private_key_file(
|
||||
conf::ctx.tlskeyfile,
|
||||
conf::ctx.tls_key_file,
|
||||
boost::asio::ssl::context::pem);
|
||||
|
||||
// Start accepting a connection
|
||||
|
||||
@@ -24,22 +24,16 @@
|
||||
#include <sys/resource.h>
|
||||
#include <sys/xattr.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
|
||||
// C++ includes
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <list>
|
||||
#include <mutex>
|
||||
#include <fstream>
|
||||
#include <thread>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <unordered_map>
|
||||
#include "state_monitor.hpp"
|
||||
|
||||
#include "../../pchheader.hpp"
|
||||
#include "../state_common.hpp"
|
||||
#include "state_monitor.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ if [ $mode = "new" ]; then
|
||||
$hpcore/build/hpstatemon \
|
||||
$hpcore/examples/echo_contract/contract.js \
|
||||
$hpcore/examples/random_contract/rnd_contract \
|
||||
$hpcore/fusebin/libfuse3.so.3 \
|
||||
$hpcore/fusebin/fusermount3 \
|
||||
../fusebin/libfuse3.so.3 \
|
||||
../fusebin/fusermount3 \
|
||||
./consensus-test-continuous.sh \
|
||||
./setup-hp.sh \
|
||||
geveo@$vmip:~/
|
||||
|
||||
Reference in New Issue
Block a user