diff --git a/examples/nodejs_client/package-lock.json b/examples/nodejs_client/package-lock.json index 88cefa61..d63ba334 100644 --- a/examples/nodejs_client/package-lock.json +++ b/examples/nodejs_client/package-lock.json @@ -5,17 +5,17 @@ "async-limiter": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", - "integrity": "sha1-3TeelPDbgxCwgpH51kwyCXZmF/0=" + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" }, "base64-js": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", - "integrity": "sha1-WOzoy3XdB+ce0IxzarxfrE2/jfE=" + "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" }, "bson": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/bson/-/bson-4.0.4.tgz", - "integrity": "sha1-S9os7fKuehjRXLJO4e3ox5f47s8=", + "integrity": "sha512-Ioi3TD0/1V3aI8+hPfC56TetYmzfq2H07jJa9A1lKTxWsFtHtYdLMGMXjtGEg9v0f72NSM07diRQEUNYhLupIA==", "requires": { "buffer": "^5.1.0", "long": "^4.0.0" @@ -24,7 +24,7 @@ "buffer": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz", - "integrity": "sha1-oxdJ3H2B2E2wir+Te2uMQDP2J4Y=", + "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==", "requires": { "base64-js": "^1.0.2", "ieee754": "^1.1.4" @@ -41,7 +41,7 @@ "ieee754": { "version": "1.1.13", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", - "integrity": "sha1-7BaFWOlaoYH9h9N/VcMrvLZwi4Q=" + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" }, "isomorphic-ws": { "version": "4.0.1", @@ -51,12 +51,12 @@ "libsodium": { "version": "0.7.6", "resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.6.tgz", - "integrity": "sha1-AYuAxXKAVIF4Rfv/pVQnREG9onc=" + "integrity": "sha512-hPb/04sEuLcTRdWDtd+xH3RXBihpmbPCsKW/Jtf4PsvdyKh+D6z2D2gvp/5BfoxseP+0FCOg66kE+0oGUE/loQ==" }, "libsodium-wrappers": { "version": "0.7.6", "resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.6.tgz", - "integrity": "sha1-uu1MFtS/lhAQSHWtio4WTSWdSPs=", + "integrity": "sha512-OUO2CWW5bHdLr6hkKLHIKI4raEkZrf3QHkhXsJ1yCh6MZ3JDA7jFD3kCATNquuGSG6MjjPHQIQms0y0gBDzjQg==", "requires": { "libsodium": "0.7.6" } @@ -64,7 +64,7 @@ "long": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha1-mntxz7fTYaGU6lVSQckvdGjVvyg=" + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" }, "node-gyp-build": { "version": "3.7.0", @@ -82,7 +82,7 @@ "ws": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/ws/-/ws-7.1.2.tgz", - "integrity": "sha1-xnLRYp3ouyepaZ61mb5Hru7dj3M=", + "integrity": "sha512-gftXq3XI81cJCgkUiAVixA0raD9IVmXqsylCrjRygw4+UOOGzPoxnQ6r/CnVL9i+mDncJo94tSkyrtuuQVBmrg==", "requires": { "async-limiter": "^1.0.0" } diff --git a/src/conf.cpp b/src/conf.cpp index a724689b..5f8fa273 100644 --- a/src/conf.cpp +++ b/src/conf.cpp @@ -279,10 +279,10 @@ namespace conf cfg.unl.emplace(bin_pubkey); } - cfg.peerport = d["peerport"].as(); - cfg.pubport = d["pubport"].as(); - cfg.roundtime = d["roundtime"].as(); - cfg.peerdiscoverytime = d["peerdiscoverytime"].as(); + cfg.peerport = d["peerport"].as(); + cfg.pubport = d["pubport"].as(); + cfg.roundtime = d["roundtime"].as(); + cfg.peerdiscoverytime = d["peerdiscoverytime"].as(); cfg.pubmaxsize = d["pubmaxsize"].as(); cfg.pubmaxcpm = d["pubmaxcpm"].as(); diff --git a/src/consensus.cpp b/src/consensus.cpp index 927e5f39..6c462515 100644 --- a/src/consensus.cpp +++ b/src/consensus.cpp @@ -290,7 +290,7 @@ namespace consensus // Stage 1 must start in the next round window. // (This makes sure stage 3 gets whichever the remaining time in the round after stage 1 and 2) stage_start = current_round_start + conf::cfg.roundtime; - const int64_t to_wait = stage_start - now; + const uint64_t to_wait = stage_start - now; LOG_DEBUG << "Waiting " << std::to_string(to_wait) << "ms for next round stage 1"; util::sleep(to_wait); @@ -302,7 +302,7 @@ namespace consensus // Compute stage time wait. // Node wait between stages to collect enough proposals from previous stages from other nodes. - const int64_t to_wait = stage_start - now; + const uint64_t to_wait = stage_start - now; // 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. diff --git a/src/msg/fbuf/p2pmsg_helpers.cpp b/src/msg/fbuf/p2pmsg_helpers.cpp index afb78e16..e982a40f 100644 --- a/src/msg/fbuf/p2pmsg_helpers.cpp +++ b/src/msg/fbuf/p2pmsg_helpers.cpp @@ -74,7 +74,7 @@ namespace msg::fbuf::p2pmsg //check message timestamp (ignore this for large messages). if (container_buf_size <= MAX_SIZE_FOR_TIME_CHECK) { - const int64_t time_now = util::get_epoch_milliseconds(); + const uint64_t time_now = util::get_epoch_milliseconds(); if (container->timestamp() < (time_now - conf::cfg.roundtime * 4)) { LOG_DEBUG << "Peer message is too old."; diff --git a/src/p2p/p2p.cpp b/src/p2p/p2p.cpp index 36ddcaf3..c83395a9 100644 --- a/src/p2p/p2p.cpp +++ b/src/p2p/p2p.cpp @@ -197,7 +197,7 @@ namespace p2p return false; } - const int64_t time_now = util::get_epoch_milliseconds(); + const uint64_t time_now = util::get_epoch_milliseconds(); // Checking the time to live of the container. The time to live for forwarding is three times the round time. if (container->timestamp() < (time_now - (conf::cfg.roundtime * 3))) { diff --git a/src/sc.cpp b/src/sc.cpp index 8e453cd0..ded9ac54 100644 --- a/src/sc.cpp +++ b/src/sc.cpp @@ -9,7 +9,7 @@ namespace sc { - const int MAX_SEQ_PACKET_SIZE = 128 * 1024; + const uint32_t MAX_SEQ_PACKET_SIZE = 128 * 1024; bool init_success = false; // We maintain two hpfs global processes for merging and rw sessions. diff --git a/src/sc.hpp b/src/sc.hpp index 29bc8fcc..41e31324 100644 --- a/src/sc.hpp +++ b/src/sc.hpp @@ -75,7 +75,7 @@ namespace sc moodycamel::ReaderWriterQueue control_messages; // Current HotPocket consensus time. - int64_t time = 0; + uint64_t time = 0; // Current HotPocket lcl (seq no. and ledger hash hex) std::string lcl; diff --git a/src/util.cpp b/src/util.cpp index 309c37e5..df9cb402 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -134,18 +134,18 @@ namespace util } /** - * Returns current time in UNIX epoch milliseconds. - */ - int64_t get_epoch_milliseconds() + * Returns current time in UNIX epoch milliseconds. + */ + uint64_t get_epoch_milliseconds() { - return std::chrono::duration_cast( + return std::chrono::duration_cast>( std::chrono::system_clock::now().time_since_epoch()) .count(); } /** - * Sleeps the current thread for specified no. of milliseconds. - */ + * Sleeps the current thread for specified no. of milliseconds. + */ void sleep(const uint64_t milliseconds) { std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds)); @@ -423,13 +423,12 @@ namespace util { result = std::stoull(str); } - catch(const std::exception& e) + catch (const std::exception &e) { // Return -1 if any exceptions are captured. return -1; } return 0; - } } // namespace util diff --git a/src/util.hpp b/src/util.hpp index 635a0fc6..ab12fd71 100644 --- a/src/util.hpp +++ b/src/util.hpp @@ -79,7 +79,7 @@ namespace util std::string get_hex(std::string_view bin, const off_t skip = 0, const size_t take = 0); - int64_t get_epoch_milliseconds(); + uint64_t get_epoch_milliseconds(); void sleep(const uint64_t milliseconds);