diff --git a/CMakeModules/cpp_graphql_gen.cmake b/CMakeModules/cpp_graphql_gen.cmake index 3816ec6256..8fff070ad2 100644 --- a/CMakeModules/cpp_graphql_gen.cmake +++ b/CMakeModules/cpp_graphql_gen.cmake @@ -6,7 +6,7 @@ set(Boost_NO_WARN_NEW_VERSIONS 1) FetchContent_Declare( cppgraphqlgen GIT_REPOSITORY https://github.com/microsoft/cppgraphqlgen.git - GIT_TAG v4.5.6 + GIT_TAG v4.5.8 GIT_SHALLOW TRUE ) set(GRAPHQL_BUILD_TESTS OFF) diff --git a/CMakeModules/cppcheck.cmake b/CMakeModules/cppcheck.cmake index 1472b400d8..33bb8c8186 100644 --- a/CMakeModules/cppcheck.cmake +++ b/CMakeModules/cppcheck.cmake @@ -10,6 +10,7 @@ else () COMMAND ${CPP_CHECK_EXE} --error-exitcode=1 --enable=all + --check-level=exhaustive --suppress=missingInclude --suppress=missingIncludeSystem # find_if - useless here @@ -19,7 +20,6 @@ else () # false positive --suppress=uninitMemberVar:${PROJECT_SOURCE_DIR}/*/UPnP.cpp # This is only enabled because of test functions and false positives - --suppress=unusedFunction:${PROJECT_SOURCE_DIR}/*/Eth.cpp --suppress=unusedFunction:${PROJECT_SOURCE_DIR}/*/Common.cpp --suppress=unusedFunction:${PROJECT_SOURCE_DIR}/*/Base64.cpp --suppress=unusedFunction:${PROJECT_SOURCE_DIR}/*/util.cpp @@ -27,6 +27,13 @@ else () --suppress=unusedFunction:${PROJECT_SOURCE_DIR}/*/UPnP.cpp --suppress=unusedFunction:${PROJECT_SOURCE_DIR}/*/logger.cpp --suppress=unusedFunction:${PROJECT_SOURCE_DIR}/*/state_api.cpp + --suppress=unusedFunction:${PROJECT_SOURCE_DIR}/*/watches.hpp + --suppress=unusedFunction:${PROJECT_SOURCE_DIR}/*/vector_ref.h + --suppress=unusedFunction:${PROJECT_SOURCE_DIR}/*/RLP.h + --suppress=unusedFunction:${PROJECT_SOURCE_DIR}/*/FixedHash.h + --suppress=unusedFunction:${PROJECT_SOURCE_DIR}/*/CommonData.h + --suppress=unusedFunction:${PROJECT_SOURCE_DIR}/*/Common.h + --suppress=unusedFunction:${PROJECT_SOURCE_DIR}/*/Log.h # TODO remove this when we solve correct exit of programs --suppress=localMutex:${PROJECT_SOURCE_DIR}/*/main.cpp # Just style warning @@ -38,6 +45,7 @@ else () --suppress=unmatchedSuppression:${PROJECT_SOURCE_DIR}/*/Common.h --suppress=cstyleCast:${PROJECT_SOURCE_DIR}/*/vector_ref.h --suppress=cstyleCast:${PROJECT_SOURCE_DIR}/*/Common.h + --suppress=cstyleCast:${PROJECT_SOURCE_DIR}/*/transaction.cpp # not an issue here --suppress=virtualCallInConstructor:${PROJECT_SOURCE_DIR}/*/final_chain.cpp # just a warning diff --git a/conanfile.py b/conanfile.py index 221513fb83..9d1f5beccf 100644 --- a/conanfile.py +++ b/conanfile.py @@ -13,14 +13,14 @@ class TaraxaConan(ConanFile): generators = "cmake" def requirements(self): - self.requires("boost/1.85.0") - self.requires("cppcheck/2.12") #TODO(2.14.1) - self.requires("openssl/3.2.1") + self.requires("boost/1.86.0") + self.requires("cppcheck/2.15.0") + self.requires("openssl/3.3.2") self.requires("cryptopp/8.9.0") - self.requires("gtest/1.14.0") - self.requires("lz4/1.9.4") + self.requires("gtest/1.15.0") + self.requires("lz4/1.10.0") self.requires("rocksdb/9.2.1") - self.requires("prometheus-cpp/1.1.0") + self.requires("prometheus-cpp/1.2.4") self.requires("jsoncpp/1.9.5") def _configure_boost_libs(self): diff --git a/libraries/aleth/libdevcore/Common.h b/libraries/aleth/libdevcore/Common.h index 6c6b1b550b..6f89f48476 100644 --- a/libraries/aleth/libdevcore/Common.h +++ b/libraries/aleth/libdevcore/Common.h @@ -127,33 +127,6 @@ using strings = std::vector; // Null/Invalid values for convenience. extern bytes const NullBytes; -/// Interprets @a _u as a two's complement signed number and returns the -/// resulting s256. -inline s256 u2s(u256 _u) { - static const bigint c_end = bigint(1) << 256; - if (boost::multiprecision::bit_test(_u, 255)) - return s256(-(c_end - _u)); - else - return s256(_u); -} - -/// @returns the two's complement signed representation of the signed number _u. -inline u256 s2u(s256 _u) { - static const bigint c_end = bigint(1) << 256; - if (_u >= 0) - return u256(_u); - else - return u256(c_end + _u); -} - -/// @returns the smallest n >= 0 such that (1 << n) >= _x -inline unsigned int toLog2(u256 _x) { - unsigned ret; - for (ret = 0; _x >>= 1; ++ret) { - } - return ret; -} - template inline u256 exp10() { return exp10() * u256(10); @@ -164,12 +137,6 @@ inline u256 exp10<0>() { return u256(1); } -/// @returns the absolute distance between _a and _b. -template -inline N diff(N const& _a, N const& _b) { - return std::max(_a, _b) - std::min(_a, _b); -} - /// RAII utility class whose destructor calls a given function. class ScopeGuard { public: diff --git a/libraries/config/include/config/config_utils.hpp b/libraries/config/include/config/config_utils.hpp index 2586973d00..333c21bbdd 100644 --- a/libraries/config/include/config/config_utils.hpp +++ b/libraries/config/include/config/config_utils.hpp @@ -14,7 +14,7 @@ std::string getConfigErr(const std::vector &path); Json::Value getConfigData(Json::Value root, const std::vector &path, bool optional = false); std::string getConfigDataAsString(const Json::Value &root, const std::vector &path, bool optional = false, - std::string value = {}); + const std::string &value = {}); uint32_t getConfigDataAsUInt(const Json::Value &root, const std::vector &path, bool optional = false, uint32_t value = 0); diff --git a/libraries/config/src/config_utils.cpp b/libraries/config/src/config_utils.cpp index 2daab50d43..f7dc9dc475 100644 --- a/libraries/config/src/config_utils.cpp +++ b/libraries/config/src/config_utils.cpp @@ -28,7 +28,7 @@ Json::Value getConfigData(Json::Value root, const std::vector &path } std::string getConfigDataAsString(const Json::Value &root, const std::vector &path, bool optional, - std::string value) { + const std::string &value) { try { Json::Value ret = getConfigData(root, path, optional); if (ret.isNull()) { diff --git a/libraries/core_libs/consensus/src/dag/dag.cpp b/libraries/core_libs/consensus/src/dag/dag.cpp index 05adb111f3..d6c45716fb 100644 --- a/libraries/core_libs/consensus/src/dag/dag.cpp +++ b/libraries/core_libs/consensus/src/dag/dag.cpp @@ -148,7 +148,7 @@ bool Dag::computeOrder(const blk_hash_t &anchor, std::vector &ordere dfs.push({cur.first, true}); std::vector> neighbors; // iterate through neighbors - for (std::tie(adj_s, adj_e) = adjacenct_vertices(cur.first, graph_); adj_s != adj_e; adj_s++) { + for (std::tie(adj_s, adj_e) = boost::adjacent_vertices(cur.first, graph_); adj_s != adj_e; adj_s++) { if (epfriend.find(index_map[*adj_s]) == epfriend.end()) { // not in this epoch continue; } @@ -183,7 +183,7 @@ bool Dag::reachable(vertex_t const &from, vertex_t const &to) const { vertex_t t = st.top(); st.pop(); vertex_adj_iter_t s, e; - for (std::tie(s, e) = adjacenct_vertices(t, graph_); s != e; ++s) { + for (std::tie(s, e) = boost::adjacent_vertices(t, graph_); s != e; ++s) { if (visited.count(*s)) continue; if (*s == target) return true; visited.insert(*s); @@ -221,7 +221,7 @@ std::vector PivotTree::getGhostPath(const blk_hash_t &vertex) const cur = st.top(); st.pop(); post_order.emplace_back(cur); - for (std::tie(s, e) = adjacenct_vertices(cur, graph_); s != e; s++) { + for (std::tie(s, e) = boost::adjacent_vertices(cur, graph_); s != e; s++) { st.emplace(*s); } } @@ -232,7 +232,7 @@ std::vector PivotTree::getGhostPath(const blk_hash_t &vertex) const for (auto const &n : post_order) { auto total_w = 0; // get childrens - for (std::tie(s, e) = adjacenct_vertices(n, graph_); s != e; s++) { + for (std::tie(s, e) = boost::adjacent_vertices(n, graph_); s != e; s++) { if (weight_map.count(*s)) { // bigger timestamp total_w += weight_map[*s]; } @@ -248,7 +248,7 @@ std::vector PivotTree::getGhostPath(const blk_hash_t &vertex) const size_t heavist = 0; vertex_t next = root; - for (std::tie(s, e) = adjacenct_vertices(root, graph_); s != e; s++) { + for (std::tie(s, e) = boost::adjacent_vertices(root, graph_); s != e; s++) { if (!weight_map.count(*s)) continue; // bigger timestamp size_t w = weight_map[*s]; assert(w > 0); @@ -257,7 +257,6 @@ std::vector PivotTree::getGhostPath(const blk_hash_t &vertex) const next = *s; } else if (w == heavist) { if (index_map[*s] < index_map[next]) { - heavist = w; next = *s; } } diff --git a/libraries/core_libs/consensus/src/dag/dag_manager.cpp b/libraries/core_libs/consensus/src/dag/dag_manager.cpp index 27d178fe08..b08db434e4 100644 --- a/libraries/core_libs/consensus/src/dag/dag_manager.cpp +++ b/libraries/core_libs/consensus/src/dag/dag_manager.cpp @@ -375,7 +375,8 @@ uint DagManager::setDagBlockOrder(blk_hash_t const &new_anchor, PbftPeriod perio } else { db_->removeDagBlock(blk_hash); seen_blocks_.erase(blk_hash); - for (const auto &trx : dag_block->getTrxs()) expired_dag_blocks_transactions.emplace_back(trx); + const auto dag_trxs = dag_block->getTrxs(); + std::copy(dag_trxs.begin(), dag_trxs.end(), std::back_inserter(expired_dag_blocks_transactions)); } } }