From 946fb756c5dfb9a48ffa279875b1577916c0047b Mon Sep 17 00:00:00 2001 From: AxVultis Date: Sat, 5 Dec 2020 19:43:44 +0100 Subject: [PATCH 1/5] Update build commit --- CMakeLists.txt | 25 ++++++++++++++++--------- src/version.h.in | 6 +++--- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 27a1df69..4a3aef24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.8.6) include(CheckCXXCompilerFlag) -set(VERSION "0.2") +set(VERSION "6.4.8") # Packaged from main commits set(COMMIT 72946d9) set(REFS " (HEAD -> master)") @@ -279,18 +279,25 @@ if (NOT COMMIT_ID_IN_VERSION) set(VERSION "${VERSION}-unknown") configure_file("src/version.h.in" "version/version.h") add_custom_target(version ALL) -elseif(DEFINED COMMIT) - string(REPLACE "." "\\." VERSION_RE "${VERSION}") - if(NOT REFS MATCHES "(\\(|, )tag: v${VERSION_RE}(\\)|, )") - set(VERSION "${VERSION}-g${COMMIT}") - endif() - configure_file("src/version.h.in" "version/version.h") - add_custom_target(version ALL) else() find_package(Git QUIET) if(Git_FOUND OR GIT_FOUND) message(STATUS "Found Git: ${GIT_EXECUTABLE}") - add_custom_target(version ALL "${CMAKE_COMMAND}" "-D" "VERSION=${VERSION}" "-D" "GIT=${GIT_EXECUTABLE}" "-D" "TO=${CMAKE_BINARY_DIR}/version/version.h" "-P" "src/version.cmake" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") + execute_process( + COMMAND git log -1 --format=%h + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE COMMIT + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + configure_file("src/version.h.in" "version/version.h") + add_custom_target(version ALL) + elseif(DEFINED COMMIT) + string(REPLACE "." "\\." VERSION_RE "${VERSION}") + if(NOT REFS MATCHES "(\\(|, )tag: v${VERSION_RE}(\\)|, )") + set(VERSION "${VERSION}-g${COMMIT}") + endif() + configure_file("src/version.h.in" "version/version.h") + add_custom_target(version ALL) else() message(STATUS "WARNING: Git was not found!") set(VERSION "${VERSION}-unknown") diff --git a/src/version.h.in b/src/version.h.in index 6a8520c2..550b8cc3 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -1,4 +1,4 @@ -#define BUILD_COMMIT_ID "@VERSION@" -#define PROJECT_VERSION "6.4.8" +#define BUILD_COMMIT_ID "@COMMIT@" +#define PROJECT_VERSION "@VERSION@" #define PROJECT_VERSION_BUILD_NO "Athena" -#define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO "(" BUILD_COMMIT_ID ")" +#define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO "(" PROJECT_VERSION "-" BUILD_COMMIT_ID ")" From 547b35b0ba44b2fcc64063cc1d1a323a21e1cfd4 Mon Sep 17 00:00:00 2001 From: AxVultis Date: Fri, 8 Oct 2021 22:48:56 +0200 Subject: [PATCH 2/5] Fix static build --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 27a1df69..6e39343a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -250,6 +250,7 @@ if(ARM) endif() if(STATIC) + set(Boost_NO_BOOST_CMAKE ON) set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_STATIC_RUNTIME ON) endif() From 1b5c7e7970b1e8e70598d8cdb1813411b147fa09 Mon Sep 17 00:00:00 2001 From: AxVultis Date: Sat, 9 Oct 2021 15:05:05 +0200 Subject: [PATCH 3/5] Remove ubuntu 16 workflow --- .github/workflows/check.yml | 35 ------------------------ .github/workflows/ubuntu16.yml | 50 ---------------------------------- 2 files changed, 85 deletions(-) delete mode 100644 .github/workflows/ubuntu16.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 0bbaac16..f888ebe5 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -60,41 +60,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - build-ubuntu16: - name: Ubuntu 16.04 - runs-on: ubuntu-16.04 - steps: - - uses: actions/checkout@master - - - name: Build - id: build - run: | - sudo apt-get update - sudo apt-get install -y libboost-all-dev - build_folder="build/debug" - ccx_ver=${GITHUB_SHA::7} - ccx_ver_folder=$(echo $ccx_ver | sed 's/\.//g') - release_name=ccx-cli-ubuntu-1604-dev"$ccx_ver" - mkdir -p "$build_folder" - cd "$build_folder" - cmake ../.. -DCMAKE_BUILD_TYPE=Debug - make -j2 - mkdir -p "$release_name" - exeFiles=() - for f in src/*; do [[ -x $f && -f $f ]] && exeFiles+=( "$f" ); done - strip "${exeFiles[@]}" - cp "${exeFiles[@]}" "$release_name/" - echo "::set-output name=release_name::${release_name}.zip" - echo "::set-output name=artifact_path::$build_folder/$release_name" - - - name: Upload To GH Artifacts - uses: actions/upload-artifact@v1.0.0 - with: - name: ${{ steps.build.outputs.release_name }} - path: ${{ steps.build.outputs.artifact_path }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - build-ubuntu18: name: Ubuntu 18.04 runs-on: ubuntu-18.04 diff --git a/.github/workflows/ubuntu16.yml b/.github/workflows/ubuntu16.yml deleted file mode 100644 index b387202e..00000000 --- a/.github/workflows/ubuntu16.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Ubuntu 16.04 - -on: - push: - tags: - - "*" - -jobs: - build-ubuntu16: - name: Ubuntu 16.04 - runs-on: ubuntu-16.04 - steps: - - uses: actions/checkout@master - - - name: Build - id: build - run: | - sudo apt-get update - sudo apt-get install -y libboost-all-dev - build_folder="build/debug" - ccx_ver=$(echo "$GITHUB_REF" | sed 's|refs/tags/||') - ccx_ver_folder=$(echo $ccx_ver | sed 's/\.//g') - release_name=ccx-cli-ubuntu-1604-v"$ccx_ver" - mkdir -p "$build_folder" - cd "$build_folder" - cmake ../.. - make -j2 - mkdir -p "$release_name/$ccx_ver_folder" - exeFiles=() - for f in src/*; do [[ -x $f && -f $f ]] && exeFiles+=( "$f" ); done - cp "${exeFiles[@]}" "$release_name/$ccx_ver_folder" - cd "$release_name" - tar -czf "$release_name".tar.gz "$ccx_ver_folder" - sha256=$(shasum -a 256 "$release_name".tar.gz | awk '{print toupper($1)}') - asset_path="./$build_folder/$release_name/$release_name.tar.gz" - echo "::set-output name=sha256::${sha256}" - echo "::set-output name=release_name::${release_name}.tar.gz" - echo "::set-output name=asset_path::${asset_path}" - echo "::set-output name=ccx_ver::${ccx_ver}" - - - name: Create Release - uses: softprops/action-gh-release@v1 - with: - files: ${{ steps.build.outputs.asset_path }} - name: Conceal Core CLI v${{ steps.build.outputs.ccx_ver }} - body: | - **${{ steps.build.outputs.release_name }}** - ${{ steps.build.outputs.sha256 }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From b761e4c895a21921c18fdcb35d5b40b850a4fe01 Mon Sep 17 00:00:00 2001 From: AxVultis Date: Sat, 9 Oct 2021 15:12:07 +0200 Subject: [PATCH 4/5] Static build for macOS --- .github/workflows/check.yml | 2 +- .github/workflows/macOS.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index f888ebe5..24b85e38 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -146,7 +146,7 @@ jobs: brew install gcc boost mkdir "$build_folder" cd "$build_folder" - cmake -DCMAKE_C_FLAGS="-mmacosx-version-min=10.12" -DCMAKE_CXX_FLAGS="-mmacosx-version-min=10.12" .. + cmake -DCMAKE_C_FLAGS="-mmacosx-version-min=10.12" -DCMAKE_CXX_FLAGS="-mmacosx-version-min=10.12" -DSTATIC=ON .. make -j2 mkdir "$release_name" exeFiles=() diff --git a/.github/workflows/macOS.yml b/.github/workflows/macOS.yml index 51fe605f..4cfae662 100644 --- a/.github/workflows/macOS.yml +++ b/.github/workflows/macOS.yml @@ -21,7 +21,7 @@ jobs: brew install gcc boost mkdir "$build_folder" cd "$build_folder" - cmake -DCMAKE_C_FLAGS="-mmacosx-version-min=10.12" -DCMAKE_CXX_FLAGS="-mmacosx-version-min=10.12" .. + cmake -DCMAKE_C_FLAGS="-mmacosx-version-min=10.12" -DCMAKE_CXX_FLAGS="-mmacosx-version-min=10.12" -DSTATIC=ON .. make -j2 mkdir "$release_name" exeFiles=() From 3e9f9a1f3ffaa6b59982d1e4b6d5ac9c10ababd2 Mon Sep 17 00:00:00 2001 From: fireice-uk Date: Thu, 21 Oct 2021 16:35:03 +0100 Subject: [PATCH 5/5] Implement a sanity limit on blocks and txes --- src/CryptoNoteConfig.h | 3 ++- src/CryptoNoteProtocol/CryptoNoteProtocolHandler.cpp | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/CryptoNoteConfig.h b/src/CryptoNoteConfig.h index e94fb4ae..44f43864 100644 --- a/src/CryptoNoteConfig.h +++ b/src/CryptoNoteConfig.h @@ -150,6 +150,7 @@ namespace CryptoNote const size_t BLOCKS_IDS_SYNCHRONIZING_DEFAULT_COUNT = 10000; // by default, blocks ids count in synchronizing const size_t BLOCKS_SYNCHRONIZING_DEFAULT_COUNT = 128; // by default, blocks count in blocks downloading const size_t COMMAND_RPC_GET_BLOCKS_FAST_MAX_COUNT = 1000; + const size_t COMMAND_RPC_GET_OBJECTS_MAX_COUNT = 1000; const int P2P_DEFAULT_PORT = 15000; const int RPC_DEFAULT_PORT = 16000; @@ -282,4 +283,4 @@ namespace CryptoNote } // namespace CryptoNote -#define ALLOW_DEBUG_COMMANDS \ No newline at end of file +#define ALLOW_DEBUG_COMMANDS diff --git a/src/CryptoNoteProtocol/CryptoNoteProtocolHandler.cpp b/src/CryptoNoteProtocol/CryptoNoteProtocolHandler.cpp index 13753b89..5a163fdf 100644 --- a/src/CryptoNoteProtocol/CryptoNoteProtocolHandler.cpp +++ b/src/CryptoNoteProtocol/CryptoNoteProtocolHandler.cpp @@ -395,11 +395,19 @@ int CryptoNoteProtocolHandler::handle_notify_new_transactions(int command, NOTIF int CryptoNoteProtocolHandler::handle_request_get_objects(int command, NOTIFY_REQUEST_GET_OBJECTS::request &arg, CryptoNoteConnectionContext &context) { logger(Logging::TRACE) << context << "NOTIFY_REQUEST_GET_OBJECTS"; + if(arg.blocks.size() > COMMAND_RPC_GET_OBJECTS_MAX_COUNT || arg.txs.size() > COMMAND_RPC_GET_OBJECTS_MAX_COUNT) + { + logger(Logging::ERROR) << context << "GET_OBJECTS_MAX_COUNT exceeded blocks: " << arg.blocks.size() << " txes: " << arg.txs.size(); + context.m_state = CryptoNoteConnectionContext::state_shutdown; + return 1; + } + NOTIFY_RESPONSE_GET_OBJECTS::request rsp; if (!m_core.handle_get_objects(arg, rsp)) { logger(Logging::ERROR) << context << "failed to handle request NOTIFY_REQUEST_GET_OBJECTS, dropping connection"; context.m_state = CryptoNoteConnectionContext::state_shutdown; + return 1; } logger(Logging::TRACE) << context << "-->>NOTIFY_RESPONSE_GET_OBJECTS: blocks.size()=" << rsp.blocks.size() << ", txs.size()=" << rsp.txs.size() << ", rsp.m_current_blockchain_height=" << rsp.current_blockchain_height << ", missed_ids.size()=" << rsp.missed_ids.size();