diff --git a/README.md b/README.md index 21675495..2371d86e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Hot Pocket Consensus Engine +# HotPocket Consensus Engine ## What's here? *In development* @@ -14,16 +14,16 @@ A C++ version of hotpocket designed for production envrionments, original protot * Concurrent Queue - https://github.com/cameron314/concurrentqueue * Boost Stacktrace - https://www.boost.org -## Setting up Hot Pocket development environment +## Setting up HotPocket development environment Run the setup script located at the repo root (tested on Ubuntu 20.04). ``` ./dev-setup.sh ``` -## Build Hot Pocket +## Build HotPocket 1. Run `cmake .` (You only have to do this once) -1. Run `make` (Hot Pocket binary will be created as `./build/hpcore`) -1. Refer to the Wiki for instructions on running Hot Pocket. +1. Run `make` (HotPocket binary will be created as `./build/hpcore`) +1. Refer to the Wiki for instructions on running HotPocket. ## FlatBuffers message definitions If you update flatbuffers message definitions, you need to run the flatbuffers code generator to update the stubs. diff --git a/dev-setup.sh b/dev-setup.sh index 1f4fd53e..465930c8 100755 --- a/dev-setup.sh +++ b/dev-setup.sh @@ -1,6 +1,6 @@ #!/bin/bash # Usage ./dev-setup.sh -# Hot Pocket build environment setup script. +# HotPocket build environment setup script. set -e # exit on error @@ -105,6 +105,6 @@ sudo ldconfig popd > /dev/null 2>&1 rm -r $workdir -# Build Hot Pocket +# Build HotPocket cmake . make \ No newline at end of file diff --git a/examples/js_client/browser-example.html b/examples/js_client/browser-example.html index 83cc8166..8c91c115 100644 --- a/examples/js_client/browser-example.html +++ b/examples/js_client/browser-example.html @@ -5,7 +5,7 @@ - + diff --git a/examples/nodejs_contract/diagnostic_contract.js b/examples/nodejs_contract/diagnostic_contract.js index a73ede44..48650af9 100644 --- a/examples/nodejs_contract/diagnostic_contract.js +++ b/examples/nodejs_contract/diagnostic_contract.js @@ -27,7 +27,7 @@ const diagnosticContract = async (ctx) => { let output = null; if (mode === "status") { - output = "Hot Pocket diagnostic contract is running."; + output = "HotPocket diagnostic contract is running."; } else if (mode === "file") { const param = parseInt(data); diff --git a/src/conf.hpp b/src/conf.hpp index 8eaa3032..00c116aa 100644 --- a/src/conf.hpp +++ b/src/conf.hpp @@ -259,7 +259,7 @@ namespace conf struct contract_ctx { std::string command; // The CLI command issued to launch HotPocket - std::string exe_dir; // Hot Pocket executable dir. + std::string exe_dir; // HotPocket executable dir. std::string hpws_exe_path; // hpws executable file path. std::string hpfs_exe_path; // hpfs executable file path. @@ -281,7 +281,7 @@ namespace conf struct flock config_lock; // Config file lock. }; - // Log severity levels used in Hot Pocket. + // Log severity levels used in HotPocket. enum LOG_SEVERITY { DEBUG, diff --git a/src/consensus.cpp b/src/consensus.cpp index 5b7918ba..4b18ef78 100644 --- a/src/consensus.cpp +++ b/src/consensus.cpp @@ -86,7 +86,7 @@ namespace consensus { if (kill_switch(util::get_epoch_milliseconds())) { - LOG_ERROR << "Hot Pocket usage limit failure."; + LOG_ERROR << "HotPocket usage limit failure."; break; } @@ -715,7 +715,7 @@ namespace consensus // If a node doesn't have enough time (eg. due to network delay) to recieve/send reliable stage proposals for next stage, // it will join in next round. Otherwise it will continue particapating in this round. - if (stage_start < now || to_wait < ctx.stage_reset_wait_threshold) //todo: self claculating/adjusting network delay + if (stage_start < now || to_wait < ctx.stage_reset_wait_threshold) // todo: self claculating/adjusting network delay { LOG_DEBUG << "Missed stage " << std::to_string(ctx.stage) << " window. Resetting to stage 0."; ctx.stage = 0; @@ -1420,7 +1420,7 @@ namespace consensus * @param prop_patch_hash Hash of patch file which reached consensus. * @param current_patch_hash Hash of the current patch file. * @return 0 on success. -1 on failure. - */ + */ int apply_consensed_patch_file_changes(const util::h32 &prop_patch_hash, const util::h32 ¤t_patch_hash) { // Check whether is there any patch changes to be applied which reached consensus. diff --git a/src/killswitch/CMakeLists.txt b/src/killswitch/CMakeLists.txt index 67d60992..6727b571 100644 --- a/src/killswitch/CMakeLists.txt +++ b/src/killswitch/CMakeLists.txt @@ -1,11 +1,11 @@ -### +# ## # Compile-time timestamping library -# +# # Adapted from https://github.com/kraiskil/cmake_timestamp -# This is only used for the Hot Pocket kill switch. +# This is only used for the HotPocket kill switch. -#CMake 3.12 made using OBJECT libraries much nicer, so we use that. +# CMake 3.12 made using OBJECT libraries much nicer, so we use that. cmake_minimum_required(VERSION 3.12) # Set CMake variable BUILD_TIME to 'now'. This 'now' is the time @@ -13,26 +13,25 @@ cmake_minimum_required(VERSION 3.12) string(TIMESTAMP BUILD_TIME "%s" UTC) # Compile the library that contains the global variables -add_library( killswitch OBJECT killswitch.c) +add_library(killswitch OBJECT killswitch.c) target_compile_definitions( killswitch PRIVATE -DBUILD_TIME="${BUILD_TIME}" ) -target_include_directories( killswitch +target_include_directories(killswitch PUBLIC - $ + $ ) -#Add a dummy target that removes the CMake variable BUILD_TIME from CMake's cache. -#this forces CMake to be-rerun when we hit this target. +# Add a dummy target that removes the CMake variable BUILD_TIME from CMake's cache. +# this forces CMake to be-rerun when we hit this target. add_custom_target( clear_cache COMMAND ${CMAKE_COMMAND} -U BUILD_TIME ${CMAKE_BINARY_DIR} ) -#Have the cache clearing be run before trying to build the killswitch library. -#This (I think) is the same as a PRE_BUILD custom_command. But PRE_BUILD is -#available for VS generators only, on others it is synonymous to PRE_LINK, -#i.e. "post compile" +# Have the cache clearing be run before trying to build the killswitch library. +# This (I think) is the same as a PRE_BUILD custom_command. But PRE_BUILD is +# available for VS generators only, on others it is synonymous to PRE_LINK, +# i.e. "post compile" add_dependencies(killswitch clear_cache) - diff --git a/src/killswitch/killswitch.c b/src/killswitch/killswitch.c index 314fba93..8c424f90 100644 --- a/src/killswitch/killswitch.c +++ b/src/killswitch/killswitch.c @@ -9,7 +9,7 @@ uint64_t build_time_sec = 0; /** * Returns true if kill switch is activated (allowed time has expired). - * Otherwise returns false (can keep using Hot Pocket). + * Otherwise returns false (can keep using HotPocket). * @param epoch_ms Current time in epoch milliseconds. */ bool kill_switch(const uint64_t epoch_ms) diff --git a/src/killswitch/readme.txt b/src/killswitch/readme.txt index 0b4f96cf..889ac785 100644 --- a/src/killswitch/readme.txt +++ b/src/killswitch/readme.txt @@ -1,4 +1,4 @@ Based on https://github.com/kraiskil/cmake_timestamp This whole folder exists to get the CMAKE compile/link time into the binary so we can perform -Hot Pocket time-based kill switch check. This folder must be removed when we no longer need the kill switch. +HotPocket time-based kill switch check. This folder must be removed when we no longer need the kill switch. diff --git a/src/main.cpp b/src/main.cpp index 12d02f47..bc711b27 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -18,12 +18,12 @@ #include "killswitch/killswitch.h" /** - * Parses CLI args and extracts hot pocket command and parameters given. + * Parses CLI args and extracts HotPocket command and parameters given. * HP command line accepts command and the contract directory(optional) */ int parse_cmd(int argc, char **argv) { - if (argc > 1) //We get working dir as an arg anyway. So we need to check for >1 args. + if (argc > 1) // We get working dir as an arg anyway. So we need to check for >1 args. { // We populate the global contract ctx with the detected command. conf::ctx.command = argv[1]; @@ -162,7 +162,7 @@ int main(int argc, char **argv) { if (kill_switch(util::get_epoch_milliseconds())) { - std::cerr << "Hot Pocket usage limit failure.\n"; + std::cerr << "HotPocket usage limit failure.\n"; return -1; } @@ -202,7 +202,7 @@ int main(int argc, char **argv) hplog::init(); - LOG_INFO << "Hot Pocket " << version::HP_VERSION; + LOG_INFO << "HotPocket " << version::HP_VERSION; LOG_INFO << "Role: " << (conf::cfg.node.role == conf::ROLE::OBSERVER ? "Observer" : "Validator"); LOG_INFO << "Public key: " << conf::cfg.node.public_key_hex; LOG_INFO << "Contract: " << conf::cfg.contract.id << " (" << conf::cfg.contract.version << ")"; diff --git a/src/msg/json/usrmsg_json.cpp b/src/msg/json/usrmsg_json.cpp index 4b4ac57b..a4d5b7af 100644 --- a/src/msg/json/usrmsg_json.cpp +++ b/src/msg/json/usrmsg_json.cpp @@ -56,7 +56,7 @@ namespace msg::usrmsg::json // We do not use jsoncons library here in favour of performance because this is a simple json message. // Since we know the rough size of the challenge message we reserve adequate amount for the holder. - // Only Hot Pocket version number is variable length. + // Only HotPocket version number is variable length. msg.reserve(256); msg += "{\""; msg += msg::usrmsg::FLD_HP_VERSION; diff --git a/src/p2p/peer_comm_session.hpp b/src/p2p/peer_comm_session.hpp index 8f618778..61cf4560 100644 --- a/src/p2p/peer_comm_session.hpp +++ b/src/p2p/peer_comm_session.hpp @@ -7,8 +7,8 @@ namespace p2p { - /** - * Represents a WebSocket connection to a Hot Pocket peer. + /** + * Represents a WebSocket connection to a HotPocket peer. */ class peer_comm_session : public comm::comm_session { diff --git a/src/sc/sc.cpp b/src/sc/sc.cpp index 3594920e..f696b1f8 100644 --- a/src/sc/sc.cpp +++ b/src/sc/sc.cpp @@ -563,7 +563,7 @@ namespace sc } else if (pid > 0) { - // Hot Pocket process. + // HotPocket process. int status = 0; if (waitpid(pid, &status, 0) == -1) { diff --git a/src/usr/user_comm_session.hpp b/src/usr/user_comm_session.hpp index f78cd649..35daf63e 100644 --- a/src/usr/user_comm_session.hpp +++ b/src/usr/user_comm_session.hpp @@ -6,8 +6,8 @@ namespace usr { - /** - * Represents a WebSocket connection to a Hot Pocket user. + /** + * Represents a WebSocket connection to a HotPocket user. */ class user_comm_session : public comm::comm_session { diff --git a/src/util/version.hpp b/src/util/version.hpp index e30afe2c..9c8f162f 100644 --- a/src/util/version.hpp +++ b/src/util/version.hpp @@ -5,7 +5,7 @@ namespace version { - // Hot Pocket version. Written to new configs and p2p/user messages. + // HotPocket version. Written to new configs and p2p/user messages. constexpr const char *HP_VERSION = "0.6.0"; // Minimum compatible config version (this will be used to validate configs). diff --git a/test/docker/build.sh b/test/docker/build.sh index 6b24fc36..6247e17a 100755 --- a/test/docker/build.sh +++ b/test/docker/build.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Builds all the Hot Pocket docker images. +# Builds all the HotPocket docker images. hpcoredir=$(realpath ../..) img=evernodedev/hotpocket diff --git a/test/docker/push.sh b/test/docker/push.sh index 905a81e6..23939880 100755 --- a/test/docker/push.sh +++ b/test/docker/push.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Pushes all the Hot Pocket images into docker hub. +# Pushes all the HotPocket images into docker hub. img=evernodedev/hotpocket diff --git a/test/local-cluster/Dockerfile b/test/local-cluster/Dockerfile index 3a803cce..d111c0e3 100644 --- a/test/local-cluster/Dockerfile +++ b/test/local-cluster/Dockerfile @@ -1,4 +1,4 @@ -# We are going with Hot Pocket NodeJs docker image because sample contracts need NodeJs to run. +# We are going with HotPocket NodeJs docker image because sample contracts need NodeJs to run. FROM evernodedev/hotpocket:latest-ubt.20.04-njs.16 # Copy (overwrite) the local build outputs into the docker image. diff --git a/test/local-cluster/cluster-create.sh b/test/local-cluster/cluster-create.sh index ac9d5b07..c7603d76 100755 --- a/test/local-cluster/cluster-create.sh +++ b/test/local-cluster/cluster-create.sh @@ -7,7 +7,7 @@ # Validate the node count arg. if [ -n "$1" ] && [ "$1" -eq "$1" ] 2>/dev/null; then - echo "Generating a Hot Pocket cluster of ${1} node(s)..." + echo "Generating a HotPocket cluster of ${1} node(s)..." else echo "Error: Please provide number of nodes." exit 1 diff --git a/test/vm-cluster/cluster.sh b/test/vm-cluster/cluster.sh index 937105ac..731d11a5 100755 --- a/test/vm-cluster/cluster.sh +++ b/test/vm-cluster/cluster.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Hot Pocket cluster management script. +# HotPocket cluster management script. # Usage examples: # ./cluster.sh new @@ -10,15 +10,15 @@ # Command modes: # info - Displays information about current cluster configuration status. # select - Sets the currently active contract from the list of contracts defined in cluster config file. -# new - Install hot pocket dependencies and hot pocket with example contracts to each node. -# updatebin - Deploy updated hot pocket and example binaries into specified node or entire cluster. +# new - Install HotPocket dependencies and HotPocket with example contracts to each node. +# updatebin - Deploy updated HotPocket and example binaries into specified node or entire cluster. # updateconfig - Updates the config file of specified node or entire cluster. # reconfig - Cleans and reconfigures the entire cluster using already uploaded HP binaries. -# start - Run hot pocket on specified node or entire cluster. -# stop - Gracefully stop hot pocket (if running) on specified node or entire cluster. -# check - Get hot pocket running process ids on specified node or entire cluster. -# log - Stream hot pocket console output log (if running) on specified node. -# kill - Force kill hot pocket (if running) on specified node or entire cluster. +# start - Run HotPocket on specified node or entire cluster. +# stop - Gracefully stop HotPocket (if running) on specified node or entire cluster. +# check - Get HotPocket running process ids on specified node or entire cluster. +# log - Stream HotPocket console output log (if running) on specified node. +# kill - Force kill HotPocket (if running) on specified node or entire cluster. # reboot - Reboot specified node. # ssh - Open up an ssh terminal for the specified node. # ssl - Creates LetsEncrypt ssl certs matching with the domain name.