From c2438153eabaa0fa793fa1a77fbc3739cfab8cf5 Mon Sep 17 00:00:00 2001 From: AxVultis Date: Tue, 20 Oct 2020 12:35:07 +0200 Subject: [PATCH 01/47] Create codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 68 +++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/codeql-analysis.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 00000000..cebc17bf --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,68 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +name: "CodeQL" + +on: + push: + branches: [master, codeql] + pull_request: + # The branches below must be a subset of the branches above + branches: [master, codeql] + schedule: + - cron: "0 3 * * 2" + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + # Override automatic language detection by changing the below list + # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] + language: ["cpp"] + # Learn more... + # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + # - name: Autobuild + # uses: github/codeql-action/autobuild@v1 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + - name: Install Boost + run: | + sudo apt install -y libboost-all-dev + + - name: Build + run: | + mkdir build && cd $_ + cmake .. -DCMAKE_BUILD_TYPE=Debug + make -j4 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 From d4a5ee236f4c842dcf264bcc42a933d19085ad7f Mon Sep 17 00:00:00 2001 From: AxVultis Date: Wed, 21 Oct 2020 10:47:13 +0200 Subject: [PATCH 02/47] Fix security warnings --- src/CryptoNoteCore/TransactionPool.cpp | 11 ++++++++--- src/CryptoNoteCore/UpgradeDetector.h | 7 ++++--- src/SimpleWallet/SimpleWallet.cpp | 4 +++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/CryptoNoteCore/TransactionPool.cpp b/src/CryptoNoteCore/TransactionPool.cpp index de286c08..d64127a1 100644 --- a/src/CryptoNoteCore/TransactionPool.cpp +++ b/src/CryptoNoteCore/TransactionPool.cpp @@ -412,15 +412,20 @@ namespace CryptoNote ss << storeToJson(txd.tx) << std::endl; } + char time[50]; + ctime_r(&txd.receiveTime, time); + ss << "blobSize: " << txd.blobSize << std::endl << "fee: " << m_currency.formatAmount(txd.fee) << std::endl - << "received: " << std::ctime(&txd.receiveTime); + << "received: " << time; auto ttlIt = m_ttlIndex.find(txd.id); if (ttlIt != m_ttlIndex.end()) { - // ctime() returns string that ends with new line - ss << "TTL: " << std::ctime(reinterpret_cast(&ttlIt->second)); + // ctime() returns string that ends with new line + char time[50]; + ctime_r(reinterpret_cast(&ttlIt->second), time); + ss << "TTL: " << time; } ss << std::endl; diff --git a/src/CryptoNoteCore/UpgradeDetector.h b/src/CryptoNoteCore/UpgradeDetector.h index 62a595d4..fcdf8388 100644 --- a/src/CryptoNoteCore/UpgradeDetector.h +++ b/src/CryptoNoteCore/UpgradeDetector.h @@ -124,9 +124,10 @@ namespace CryptoNote { if (m_blockchain.size() % (60 * 60 / m_currency.difficultyTarget()) == 0) { auto interval = m_currency.difficultyTarget() * (upgradeHeight() - m_blockchain.size() + 2); time_t upgradeTimestamp = time(nullptr) + static_cast(interval); - struct tm* upgradeTime = localtime(&upgradeTimestamp);; + struct tm upgradeTime; + localtime_r(&upgradeTimestamp, &upgradeTime); char upgradeTimeStr[40]; - strftime(upgradeTimeStr, 40, "%H:%M:%S %Y.%m.%d", upgradeTime); + strftime(upgradeTimeStr, 40, "%H:%M:%S %Y.%m.%d", &upgradeTime); logger(Logging::TRACE, Logging::BRIGHT_GREEN) << "###### UPGRADE is going to happen after block index " << upgradeHeight() << " at about " << upgradeTimeStr << " (in " << Common::timeIntervalToString(interval) << ")! Current last block index " << (m_blockchain.size() - 1) << @@ -198,7 +199,7 @@ namespace CryptoNote { assert(m_currency.upgradeVotingThreshold() > 0 && m_currency.upgradeVotingThreshold() <= 100); size_t voteCounter = getNumberOfVotes(height); - return m_currency.upgradeVotingThreshold() * m_currency.upgradeVotingWindow() <= 100 * voteCounter; + return m_currency.upgradeVotingWindow() * m_currency.upgradeVotingThreshold() <= 100 * voteCounter; } private: diff --git a/src/SimpleWallet/SimpleWallet.cpp b/src/SimpleWallet/SimpleWallet.cpp index 9ca2709c..2627adb0 100644 --- a/src/SimpleWallet/SimpleWallet.cpp +++ b/src/SimpleWallet/SimpleWallet.cpp @@ -420,7 +420,9 @@ void printListTransfersItem(LoggerRef& logger, const WalletLegacyTransaction& tx char timeString[TIMESTAMP_MAX_WIDTH + 1]; time_t timestamp = static_cast(txInfo.timestamp); - if (std::strftime(timeString, sizeof(timeString), "%Y-%m-%d %H:%M:%S", std::gmtime(×tamp)) == 0) { + struct tm time; + gmtime_r(×tamp, &time); + if (std::strftime(timeString, sizeof(timeString), "%Y-%m-%d %H:%M:%S", &time) == 0) { throw std::runtime_error("time buffer is too small"); } From 7b2b90f352d17e7f4f4f0fcd7ab790b1226d4ab1 Mon Sep 17 00:00:00 2001 From: AxVultis Date: Wed, 21 Oct 2020 15:58:02 +0200 Subject: [PATCH 03/47] Fix warning --- src/CryptoNoteCore/UpgradeDetector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CryptoNoteCore/UpgradeDetector.h b/src/CryptoNoteCore/UpgradeDetector.h index fcdf8388..967a06b3 100644 --- a/src/CryptoNoteCore/UpgradeDetector.h +++ b/src/CryptoNoteCore/UpgradeDetector.h @@ -199,7 +199,7 @@ namespace CryptoNote { assert(m_currency.upgradeVotingThreshold() > 0 && m_currency.upgradeVotingThreshold() <= 100); size_t voteCounter = getNumberOfVotes(height); - return m_currency.upgradeVotingWindow() * m_currency.upgradeVotingThreshold() <= 100 * voteCounter; + return (size_t) m_currency.upgradeVotingThreshold() * m_currency.upgradeVotingWindow() <= 100 * voteCounter; } private: From 5c8d781225296ba2850bacf204647d388b0e4bf3 Mon Sep 17 00:00:00 2001 From: AxVultis Date: Wed, 21 Oct 2020 17:32:50 +0200 Subject: [PATCH 04/47] Fix warnings --- src/CryptoNoteCore/Blockchain.cpp | 8 ++++---- src/CryptoNoteCore/Blockchain.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/CryptoNoteCore/Blockchain.cpp b/src/CryptoNoteCore/Blockchain.cpp index ba43e84c..9f5cc857 100644 --- a/src/CryptoNoteCore/Blockchain.cpp +++ b/src/CryptoNoteCore/Blockchain.cpp @@ -664,7 +664,7 @@ namespace CryptoNote Crypto::Hash blockHash = get_block_hash(block.bl); m_blockIndex.push(blockHash); uint64_t interest = 0; - for (uint16_t t = 0; t < block.transactions.size(); ++t) + for (uint32_t t = 0; t < block.transactions.size(); ++t) { const TransactionEntry &transaction = block.transactions[t]; Crypto::Hash transactionHash = getObjectHash(transaction.tx); @@ -686,7 +686,7 @@ namespace CryptoNote } // process outputs - for (uint16_t o = 0; o < transaction.tx.outputs.size(); ++o) + for (uint32_t o = 0; o < transaction.tx.outputs.size(); ++o) { const auto &out = transaction.tx.outputs[o]; if (out.target.type() == typeid(KeyOutput)) @@ -2737,7 +2737,7 @@ namespace CryptoNote } transaction.m_global_output_indexes.resize(transaction.tx.outputs.size()); - for (uint16_t output = 0; output < transaction.tx.outputs.size(); ++output) + for (uint32_t output = 0; output < transaction.tx.outputs.size(); ++output) { if (transaction.tx.outputs[output].target.type() == typeid(KeyOutput)) { @@ -3153,7 +3153,7 @@ namespace CryptoNote const BlockEntry &block = m_blocks[b]; m_timestampIndex.add(block.bl.timestamp, get_block_hash(block.bl)); m_generatedTransactionsIndex.add(block.bl); - for (uint16_t t = 0; t < block.transactions.size(); ++t) + for (size_t t = 0; t < block.transactions.size(); ++t) { const TransactionEntry &transaction = block.transactions[t]; m_paymentIdIndex.add(transaction.tx); diff --git a/src/CryptoNoteCore/Blockchain.h b/src/CryptoNoteCore/Blockchain.h index 1e593826..b93f9976 100644 --- a/src/CryptoNoteCore/Blockchain.h +++ b/src/CryptoNoteCore/Blockchain.h @@ -204,7 +204,7 @@ namespace CryptoNote struct TransactionIndex { uint32_t block; - uint16_t transaction; + uint32_t transaction; void serialize(ISerializer &s) { @@ -220,7 +220,7 @@ namespace CryptoNote struct MultisignatureOutputUsage { TransactionIndex transactionIndex; - uint16_t outputIndex; + uint32_t outputIndex; bool isUsed; void serialize(ISerializer &s) From 188a307b29a74b8855a53e2c0e3efb6cf79c2167 Mon Sep 17 00:00:00 2001 From: AxVultis Date: Sat, 6 Mar 2021 23:06:43 +0100 Subject: [PATCH 05/47] Update tests --- CMakeLists.txt | 1 + tests/IntegrationTestLib/InProcTestNode.cpp | 2 +- tests/IntegrationTests/Node.cpp | 11 ++++++----- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 27a1df69..86cd3ce9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -270,6 +270,7 @@ endif() if(BUILD_TESTS) add_subdirectory(tests) + add_subdirectory(external/gtest) enable_testing() endif() diff --git a/tests/IntegrationTestLib/InProcTestNode.cpp b/tests/IntegrationTestLib/InProcTestNode.cpp index 2bc2204e..ee08eaee 100644 --- a/tests/IntegrationTestLib/InProcTestNode.cpp +++ b/tests/IntegrationTestLib/InProcTestNode.cpp @@ -61,7 +61,7 @@ void InProcTestNode::workerThread(std::promise& initPromise) { try { - core.reset(new CryptoNote::core(m_currency, NULL, log)); + core.reset(new CryptoNote::core(m_currency, NULL, log, false, false)); protocol.reset(new CryptoNote::CryptoNoteProtocolHandler(m_currency, dispatcher, *core, NULL, log)); p2pNode.reset(new CryptoNote::NodeServer(dispatcher, *protocol, log)); protocol->set_p2p_endpoint(p2pNode.get()); diff --git a/tests/IntegrationTests/Node.cpp b/tests/IntegrationTests/Node.cpp index 42119d8c..e7542451 100644 --- a/tests/IntegrationTests/Node.cpp +++ b/tests/IntegrationTests/Node.cpp @@ -205,7 +205,8 @@ TEST_F(NodeTest, generateBlockchain) std::string password = "pass"; CryptoNote::WalletGreen wallet(dispatcher, currency, *mainNode, logger); - wallet.initialize(password); + std::string walletFile("wallet.bin", std::ios::binary | std::ios::trunc); + wallet.initialize(walletFile, password); std::string minerAddress = wallet.createAddress(); daemon.startMining(1, minerAddress); @@ -220,8 +221,8 @@ TEST_F(NodeTest, generateBlockchain) daemon.stopMining(); - std::ofstream walletFile("wallet.bin", std::ios::binary | std::ios::trunc); - wallet.save(walletFile); + + wallet.save(); wallet.shutdown(); dumpBlockchainInfo(*mainNode); @@ -257,7 +258,7 @@ TEST_F(NodeTest, addMoreBlocks) CryptoNote::WalletGreen wallet(dispatcher, currency, *mainNode, logger); { - std::ifstream walletFile("wallet.bin", std::ios::binary); + std::string walletFile("wallet.bin", std::ios::binary); wallet.load(walletFile, password); } @@ -275,7 +276,7 @@ TEST_F(NodeTest, addMoreBlocks) daemon.stopMining(); std::ofstream walletFile("wallet.bin", std::ios::binary | std::ios::trunc); - wallet.save(walletFile); + wallet.save(); wallet.shutdown(); dumpBlockchainInfo(*mainNode); From dda32a084662d48287279728dacb3052102b7c92 Mon Sep 17 00:00:00 2001 From: AxVultis Date: Sun, 7 Mar 2021 10:24:40 +0100 Subject: [PATCH 06/47] Update Ubuntu20.04 build check --- .github/workflows/check.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 16f22d0e..51cd05bd 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -131,20 +131,15 @@ jobs: - name: Build id: build run: | - sudo fallocate -l 6G /swapfile - sudo chmod 600 /swapfile - sudo mkswap /swapfile - sudo swapon /swapfile - BOOST_ROOT= - sudo apt-get purge '*boost*' - sudo apt install -y libboost-all-dev + 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-2004-v"$ccx_ver" mkdir -p "$build_folder" cd "$build_folder" - cmake ../.. + cmake ../.. -DCMAKE_BUILD_TYPE=Debug make -j2 mkdir -p "$release_name" exeFiles=() @@ -171,7 +166,8 @@ jobs: - name: Build id: build run: | - sudo apt install -y libboost-all-dev clang + sudo apt-get update + sudo apt-get install -y libboost-all-dev clang build_folder="build/debug" ccx_ver=${GITHUB_SHA::7} ccx_ver_folder=$(echo $ccx_ver | sed 's/\.//g') From 17b56e5e9e50d481a0bb180b60ea38a81781c1a9 Mon Sep 17 00:00:00 2001 From: AxVultis Date: Fri, 16 Apr 2021 22:17:36 +0200 Subject: [PATCH 07/47] Add sonarcloud --- .github/workflows/sonarcloud.yml | 30 ++++++++++++++++++++++++++++++ sonar-project.properties | 17 +++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/sonarcloud.yml create mode 100644 sonar-project.properties diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml new file mode 100644 index 00000000..64bb1f0f --- /dev/null +++ b/.github/workflows/sonarcloud.yml @@ -0,0 +1,30 @@ +name: sonarcloud +on: [push, pull_request] +jobs: + sonarcloud: + name: sonarcloud + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: setup sonar-scanner + uses: warchant/setup-sonar-scanner@v3 + + - name: sonarcloud build & scan + run: | + sudo apt-get update + sudo apt-get install -y libboost-all-dev + wget https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip + unzip build-wrapper-linux-x86.zip + export PATH=./build-wrapper-linux-x86:$PATH + mkdir build + cd build + cmake .. -DCMAKE_BUILD_TYPE=Release + cd .. + build-wrapper-linux-x86-64 --out-dir bw-output cmake --build build -- -j 2 + sonar-scanner + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..dfccca71 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,17 @@ +sonar.host.url=https://sonarcloud.io +sonar.projectKey=bstera_conceal-core +sonar.organization=bstera + +# This is the name and version displayed in the SonarCloud UI. +sonar.projectName=conceal-core +sonar.projectVersion=6.4.5 + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +sonar.sources=src + +# Encoding of the source code. Default is default system encoding +sonar.sourceEncoding=UTF-8 + +sonar.cfamily.build-wrapper-output=bw-output +sonar.cfamily.threads=2 +sonar.cfamily.cache.enabled=false From 12a61bc74768d33a87a201a429e9d0c135bc6d80 Mon Sep 17 00:00:00 2001 From: AxVultis Date: Sun, 27 Jun 2021 17:04:43 +0200 Subject: [PATCH 08/47] Update --- .github/workflows/codeql-analysis.yml | 4 ++-- src/CryptoNoteCore/Blockchain.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index cebc17bf..a7dfdd2e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -61,8 +61,8 @@ jobs: - name: Build run: | mkdir build && cd $_ - cmake .. -DCMAKE_BUILD_TYPE=Debug - make -j4 + cmake .. -DCMAKE_BUILD_TYPE=Release + make -j2 - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v1 diff --git a/src/CryptoNoteCore/Blockchain.h b/src/CryptoNoteCore/Blockchain.h index c8519ccb..9349c110 100644 --- a/src/CryptoNoteCore/Blockchain.h +++ b/src/CryptoNoteCore/Blockchain.h @@ -204,7 +204,7 @@ namespace CryptoNote struct TransactionIndex { uint32_t block; - uint32_t transaction; + uint16_t transaction; void serialize(ISerializer &s) { @@ -220,7 +220,7 @@ namespace CryptoNote struct MultisignatureOutputUsage { TransactionIndex transactionIndex; - uint32_t outputIndex; + uint16_t outputIndex; bool isUsed; void serialize(ISerializer &s) From 9ac23178ced9e1b80671fe5095eedc00062fbc3b Mon Sep 17 00:00:00 2001 From: AxVultis Date: Sun, 18 Jul 2021 11:36:34 +0200 Subject: [PATCH 09/47] Update tests --- src/CryptoNoteCore/Core.h | 2 +- tests/CMakeLists.txt | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/CryptoNoteCore/Core.h b/src/CryptoNoteCore/Core.h index 51eed052..aca3943f 100644 --- a/src/CryptoNoteCore/Core.h +++ b/src/CryptoNoteCore/Core.h @@ -34,7 +34,7 @@ namespace CryptoNote { class core : public ICore, public IMinerHandler, public IBlockchainStorageObserver, public ITxPoolObserver { public: - core(const Currency ¤cy, i_cryptonote_protocol *pprotocol, Logging::ILogger &logger, bool blockchainIndexesEnabled, bool blockchainAutosaveEnabled); + core(const Currency ¤cy, i_cryptonote_protocol *pprotocol, Logging::ILogger &logger, bool blockchainIndexesEnabled = false, bool blockchainAutosaveEnabled = false); ~core(); bool on_idle() override; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d9ce41ff..e8995532 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -60,3 +60,8 @@ set_property(TARGET NodeRpcProxyTests PROPERTY OUTPUT_NAME "node_rpc_proxy_tests set_property(TARGET PerformanceTests PROPERTY OUTPUT_NAME "performance_tests") set_property(TARGET SystemTests PROPERTY OUTPUT_NAME "system_tests") set_property(TARGET DifficultyTests PROPERTY OUTPUT_NAME "difficulty_tests") + +if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR APPLE AND NOT ANDROID) + target_link_libraries(CoreTests -lresolv) + target_link_libraries(IntegrationTests -lresolv) +endif() \ No newline at end of file From 735df76eb0623e8c3b8209222299af92b779a548 Mon Sep 17 00:00:00 2001 From: AxVultis Date: Sun, 12 Sep 2021 11:39:26 +0200 Subject: [PATCH 10/47] Remove ubuntu 16 workflows --- .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 c30072cd..25820ae5 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 bb66e37b74ac3e5ac4b619a159221fd0d580b33d Mon Sep 17 00:00:00 2001 From: AxVultis Date: Sat, 18 Sep 2021 14:33:04 +0200 Subject: [PATCH 11/47] chacha8 --- src/crypto/chacha8.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/crypto/chacha8.h b/src/crypto/chacha8.h index 96dacd34..a0a05c27 100644 --- a/src/crypto/chacha8.h +++ b/src/crypto/chacha8.h @@ -26,11 +26,6 @@ namespace Crypto struct chacha8_key { uint8_t data[CHACHA8_KEY_SIZE]; - - ~chacha8_key() - { - memset(data, 0, sizeof(data)); - } }; // MS VC 2012 doesn't interpret `class chacha8_iv` as POD in spite of [9.0.10], so it is a struct From 3cc8900174d6e8bfefe23cdbf59c706808769324 Mon Sep 17 00:00:00 2001 From: AxVultis Date: Sat, 18 Sep 2021 14:34:26 +0200 Subject: [PATCH 12/47] Revert "Array size fix" This reverts commit a1eac2ce1469c60faad613aa6be6c11d6a71277f. Unit tests are using ALL memory --- src/Serialization/BinaryInputStreamSerializer.cpp | 4 ++-- src/Serialization/KVBinaryInputStreamSerializer.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Serialization/BinaryInputStreamSerializer.cpp b/src/Serialization/BinaryInputStreamSerializer.cpp index eeb60f97..28b6ea55 100644 --- a/src/Serialization/BinaryInputStreamSerializer.cpp +++ b/src/Serialization/BinaryInputStreamSerializer.cpp @@ -39,7 +39,7 @@ void BinaryInputStreamSerializer::endObject() { bool BinaryInputStreamSerializer::beginArray(size_t& size, Common::StringView name) { readVarintAs(stream, size); - if (size > 10000 * 1024 * 1024) { + if (size > 100 * 1024 * 1024) { throw std::runtime_error("array size is too big"); } @@ -93,7 +93,7 @@ bool BinaryInputStreamSerializer::operator()(std::string& value, Common::StringV uint64_t size; readVarint(stream, size); - if (size > 10000 * 1024 * 1024) { + if (size > 100 * 1024 * 1024) { throw std::runtime_error("string size is too big"); } else if (size > 0) { std::vector temp; diff --git a/src/Serialization/KVBinaryInputStreamSerializer.cpp b/src/Serialization/KVBinaryInputStreamSerializer.cpp index 5c576d32..67090b7a 100644 --- a/src/Serialization/KVBinaryInputStreamSerializer.cpp +++ b/src/Serialization/KVBinaryInputStreamSerializer.cpp @@ -70,7 +70,7 @@ size_t readVarint(Common::IInputStream& s) { std::string readString(Common::IInputStream& s) { auto size = readVarint(s); - if (size > 10000 * 1024 * 1024) { + if (size > 100 * 1024 * 1024) { throw std::runtime_error("string size is too big"); } From d0e4c70d0327ac04265d47970562e8777734a2de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98x?= <35565671+krypt0x@users.noreply.github.com> Date: Thu, 11 Nov 2021 13:02:18 +0000 Subject: [PATCH 13/47] adding badges add workflow badges and standardised the bash instructions --- README.md | 85 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 1cba2e04..2bcf03c7 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,14 @@ ![image](https://github.com/ConcealNetwork/conceal-imagery/blob/master/logos/splash.png) -![](https://github.com/bomb-on/conceal-core/workflows/Ubuntu%2016.04/badge.svg) ![](https://github.com/bomb-on/conceal-core/workflows/Ubuntu%2018.04/badge.svg) ![](https://github.com/bomb-on/conceal-core/workflows/Windows/badge.svg) ![](https://github.com/bomb-on/conceal-core/workflows/macOS/badge.svg) +[![Ubuntu 20.04](https://github.com/ConcealNetwork/conceal-core/actions/workflows/ubuntu20.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/ubuntu20.yml) +[![Ubuntu 18.04](https://github.com/ConcealNetwork/conceal-core/actions/workflows/ubuntu18.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/ubuntu18.yml) +[![Windows](https://github.com/ConcealNetwork/conceal-core/actions/workflows/windows.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/windows.yml) +[![macOS](https://github.com/ConcealNetwork/conceal-core/actions/workflows/macOS.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/macOS.yml) # Conceal Core (CLI) Latest Release: v6.5.1 -Maintained by Conceal Developers. +Maintained by Conceal Developers, overseen by Conceal Team and driven by Conceal Community. ## Information Conceal Network is a secure peer-to-peer privacy framework empowering individuals and organizations to anonymously communicate and interact financially in a decentralized and censorship resistant ecosystem. @@ -38,21 +41,21 @@ For example if you have 8GB of RAM, then your SWAP size should be 5GB - Ubuntu / Linux ```bash - sudo fallocate -l 5G /swapfile - sudo chmod 600 /swapfile - sudo mkswap /swapfile - sudo swapon /swapfile + $ sudo fallocate -l 5G /swapfile + $ sudo chmod 600 /swapfile + $ sudo mkswap /swapfile + $ sudo swapon /swapfile ``` - Rasberry Pi OS ```bash - sudo dphys-swapfile swapoff - sudo nano /etc/dphys-swapfile - CONF_SWAPSIZE=5120 - sudo nano /sbin/dphys-swapfile - #CONF_MAXSWAP=2048 - sudo dphys-swapfile setup - sudo dphys-swapfile swapon + $ sudo dphys-swapfile swapoff + $ sudo nano /etc/dphys-swapfile + $ CONF_SWAPSIZE=5120 + $ sudo nano /sbin/dphys-swapfile + $ #CONF_MAXSWAP=2048 + $ sudo dphys-swapfile setup + $ sudo dphys-swapfile swapon ``` ### Linux / Ubuntu / Debian @@ -61,18 +64,18 @@ For example if you have 8GB of RAM, then your SWAP size should be 5GB - You will need the following dependencies to build the Conceal CLI: boost, cmake, git, gcc, g++, python, and make. - On Ubuntu: - ``` - sudo apt update - sudo apt-get install -y build-essential python-dev gcc g++ git cmake libboost-all-dev + ```bash + $ sudo apt update + $ sudo apt-get install -y build-essential python-dev gcc g++ git cmake libboost-all-dev ``` #### Building -- `git clone https://github.com/ConcealNetwork/conceal-core` -- `cd conceal-core` -- `mkdir build && cd $_` -- `cmake ..` -- `make` +git clone https://github.com/ConcealNetwork/conceal-core` +cd conceal-core` +mkdir build && cd $_` +cmake ..` +make` If the build is successful the binaries will be in the `src` folder. @@ -97,13 +100,13 @@ Other ARM CPU/OS combinations should be possible if the CPU supports Neon/AES. From the start menu, open 'x64 Native Tools Command Prompt for vs2019' or run "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsMSBuildCmd.bat" from any command prompt. -```bash -git clone https://github.com/ConcealNetwork/conceal-core -cd conceal-core -mkdir build -cmake .. -G "Visual Studio 16 2019" -A x64 -DBOOST_LIBRARYDIR="c:\local\boost_1_73_0\lib64-msvc-14.2" -msbuild concealX.sln /p:Configuration=Release /m -``` + ```bash + git clone https://github.com/ConcealNetwork/conceal-core + cd conceal-core + mkdir build + cmake .. -G "Visual Studio 16 2019" -A x64 -DBOOST_LIBRARYDIR="c:\local\boost_1_73_0\lib64-msvc-14.2" + msbuild concealX.sln /p:Configuration=Release /m + ``` If the build is successful the binaries will be in the `src/Release` folder. @@ -114,29 +117,29 @@ If the build is successful the binaries will be in the `src/Release` folder. In order to install prerequisites, [XCode](https://developer.apple.com/xcode/) and [Homebrew](https://brew.sh/) needs to be installed. Once both are ready, open Terminal app and run the following command to install additional tools: -```bash -$ xcode-select --install -``` + ```bash + $ xcode-select --install + ``` On newer macOS versions (v10.14 and higher) this step is done through Software Update in System Preferences. After that, proceed with installing dependencies: -```bash -$ brew install git python cmake gcc boost -``` + ```bash + $ brew install git python cmake gcc boost + ``` #### Building When all dependencies are installed, build Conceal Core binaries: -```bash -$ git clone https://github.com/ConcealNetwork/conceal-core -$ cd conceal-core -$ mkdir build && cd $_ -$ cmake .. -$ make -``` + ```bash + $ git clone https://github.com/ConcealNetwork/conceal-core + $ cd conceal-core + $ mkdir build && cd $_ + $ cmake .. + $ make + ``` If the build is successful the binaries will be located in `src` directory. From c9df7c074444752146b53e86013597b0521a20d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98x?= <35565671+krypt0x@users.noreply.github.com> Date: Thu, 11 Nov 2021 13:19:06 +0000 Subject: [PATCH 14/47] fixed typo fixed typo in bash instructions --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2bcf03c7..db48a1cd 100644 --- a/README.md +++ b/README.md @@ -71,11 +71,13 @@ For example if you have 8GB of RAM, then your SWAP size should be 5GB #### Building -git clone https://github.com/ConcealNetwork/conceal-core` -cd conceal-core` -mkdir build && cd $_` -cmake ..` -make` + ```bash + $ git clone https://github.com/ConcealNetwork/conceal-core` + $ cd conceal-core + $ mkdir build && cd $_ + $ cmake .. + $ make + ``` If the build is successful the binaries will be in the `src` folder. From 1693d4ed4ceaec5ff2079e284fcb03b8fa3441ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98x?= <35565671+krypt0x@users.noreply.github.com> Date: Thu, 11 Nov 2021 13:19:55 +0000 Subject: [PATCH 15/47] typo fixed typo in building instructions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index db48a1cd..613e48dc 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ For example if you have 8GB of RAM, then your SWAP size should be 5GB #### Building ```bash - $ git clone https://github.com/ConcealNetwork/conceal-core` + $ git clone https://github.com/ConcealNetwork/conceal-core $ cd conceal-core $ mkdir build && cd $_ $ cmake .. From 9a365b966dbcc4b9e5a6b15a508acadc98eed7d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98x?= <35565671+krypt0x@users.noreply.github.com> Date: Thu, 11 Nov 2021 13:40:01 +0000 Subject: [PATCH 16/47] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 613e48dc..7d4e29f6 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ After that, proceed with installing dependencies: When all dependencies are installed, build Conceal Core binaries: - ```bash + ``` $ git clone https://github.com/ConcealNetwork/conceal-core $ cd conceal-core $ mkdir build && cd $_ From f075366d61d5b082eb846d615108b5f32de58d0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98x?= <35565671+krypt0x@users.noreply.github.com> Date: Thu, 11 Nov 2021 13:41:00 +0000 Subject: [PATCH 17/47] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7d4e29f6..9f493763 100644 --- a/README.md +++ b/README.md @@ -135,13 +135,13 @@ After that, proceed with installing dependencies: When all dependencies are installed, build Conceal Core binaries: - ``` +``` $ git clone https://github.com/ConcealNetwork/conceal-core $ cd conceal-core $ mkdir build && cd $_ $ cmake .. $ make - ``` +``` If the build is successful the binaries will be located in `src` directory. From 5242b887095a7c823028964b32a3b422f461b3f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98x?= <35565671+krypt0x@users.noreply.github.com> Date: Thu, 11 Nov 2021 13:42:06 +0000 Subject: [PATCH 18/47] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9f493763..cfe188b2 100644 --- a/README.md +++ b/README.md @@ -128,8 +128,8 @@ On newer macOS versions (v10.14 and higher) this step is done through Software U After that, proceed with installing dependencies: ```bash - $ brew install git python cmake gcc boost - ``` + $ brew install git python cmake gcc boost``` + #### Building From 1b2ea7f4d453add08b69d04fbd5823bd66698d86 Mon Sep 17 00:00:00 2001 From: AxVultis Date: Thu, 11 Nov 2021 15:33:24 +0100 Subject: [PATCH 19/47] Fix GitHub Actions release upload --- .github/workflows/check.yml | 24 ++++++++++++------------ .github/workflows/macOS.yml | 16 +++++++++------- .github/workflows/ubuntu18.yml | 18 ++++++++++-------- .github/workflows/ubuntu20.yml | 18 ++++++++++-------- .github/workflows/windows.yml | 16 +++++++++------- 5 files changed, 50 insertions(+), 42 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 24b85e38..2e142475 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -34,8 +34,8 @@ jobs: run: | $build_folder = "build" $sha = "${{ github.sha }}" - $ccx_ver = $sha.SubString(0,7) - $release_name = "ccx-cli-win64-v$ccx_ver" + $ccx_version = $sha.SubString(0,7) + $release_name = "ccx-cli-win64-v$ccx_version" mkdir "$build_folder" cd "$build_folder" cmake -G "Visual Studio 16 2019" .. @@ -49,7 +49,7 @@ jobs: echo "::set-output name=sha256::${sha256}" echo "::set-output name=release_name::${release_name}.zip" echo "::set-output name=asset_path::${asset_path}" - echo "::set-output name=ccx_ver::${ccx_ver}" + echo "::set-output name=ccx_version::${ccx_version}" echo "::set-output name=artifact_path::$build_folder/src/Release/$release_name" - name: Upload To GH Artifacts @@ -72,9 +72,9 @@ jobs: 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-1804-dev"$ccx_ver" + ccx_version=${GITHUB_SHA::7} + ccx_ver_folder=$(echo $ccx_version | sed 's/\.//g') + release_name=ccx-cli-ubuntu-1804-dev"$ccx_version" mkdir -p "$build_folder" cd "$build_folder" cmake ../.. -DCMAKE_BUILD_TYPE=Debug @@ -107,9 +107,9 @@ jobs: 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-2004-dev"$ccx_ver" + ccx_version=${GITHUB_SHA::7} + ccx_ver_folder=$(echo $ccx_version | sed 's/\.//g') + release_name=ccx-cli-ubuntu-2004-dev"$ccx_version" mkdir -p "$build_folder" cd "$build_folder" cmake ../.. -DCMAKE_BUILD_TYPE=Debug @@ -140,9 +140,9 @@ jobs: id: build run: | build_folder="build/" - ccx_ver=${GITHUB_SHA::7} - ccx_ver_folder=$(echo $ccx_ver | sed 's/\.//g') - release_name=ccx-cli-macos-dev"$ccx_ver" + ccx_version=${GITHUB_SHA::7} + ccx_ver_folder=$(echo $ccx_version | sed 's/\.//g') + release_name=ccx-cli-macos-dev"$ccx_version" brew install gcc boost mkdir "$build_folder" cd "$build_folder" diff --git a/.github/workflows/macOS.yml b/.github/workflows/macOS.yml index 4cfae662..55004d00 100644 --- a/.github/workflows/macOS.yml +++ b/.github/workflows/macOS.yml @@ -16,8 +16,8 @@ jobs: id: build run: | build_folder="build/" - ccx_ver=$(echo ${{ github.ref }} | sed 's|refs/tags/||') - release_name="ccx-cli-macOS-v$ccx_ver" + ccx_version=$(echo ${{ github.ref }} | sed 's|refs/tags/||') + release_name="ccx-cli-macOS-v$ccx_version" brew install gcc boost mkdir "$build_folder" cd "$build_folder" @@ -33,15 +33,17 @@ jobs: echo "::set-output name=sha256::${sha256}" echo "::set-output name=release_name::${release_name}.zip" echo "::set-output name=asset_path::${asset_path}" - echo "::set-output name=ccx_ver::${ccx_ver}" + echo "::set-output name=ccx_version::${ccx_version}" + # since https://github.com/softprops/action-gh-release/pull/145 body is replaced instead of being appended + # use v0.1.12 for now - name: Create Release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v0.1.12 with: files: ${{ steps.build.outputs.asset_path }} - name: Conceal Core CLI v${{ steps.build.outputs.ccx_ver }} + name: Conceal Core CLI v${{ steps.build.outputs.ccx_version }} body: | - **${{ steps.build.outputs.release_name }}** - ${{ steps.build.outputs.sha256 }} + [Download for macOS](../../releases/download/${{ steps.build.outputs.ccx_version }}/${{ steps.build.outputs.release_name }}) **${{ steps.build.outputs.release_name }}** + `SHA256 : ${{ steps.build.outputs.sha256 }}` env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ubuntu18.yml b/.github/workflows/ubuntu18.yml index 9bd39524..9d5de5bb 100644 --- a/.github/workflows/ubuntu18.yml +++ b/.github/workflows/ubuntu18.yml @@ -18,9 +18,9 @@ jobs: 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-1804-v"$ccx_ver" + ccx_version=$(echo "$GITHUB_REF" | sed 's|refs/tags/||') + ccx_ver_folder=$(echo $ccx_version | sed 's/\.//g') + release_name=ccx-cli-ubuntu-1804-v"$ccx_version" mkdir -p "$build_folder" cd "$build_folder" cmake ../.. @@ -36,15 +36,17 @@ jobs: 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}" + echo "::set-output name=ccx_version::${ccx_version}" + # since https://github.com/softprops/action-gh-release/pull/145 body is replaced instead of being appended + # use v0.1.12 for now - name: Create Release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v0.1.12 with: files: ${{ steps.build.outputs.asset_path }} - name: Conceal Core CLI v${{ steps.build.outputs.ccx_ver }} + name: Conceal Core CLI v${{ steps.build.outputs.ccx_version }} body: | - **${{ steps.build.outputs.release_name }}** - ${{ steps.build.outputs.sha256 }} + [Download for Ubuntu 18.04](../../releases/download/${{ steps.build.outputs.ccx_version }}/${{ steps.build.outputs.release_name }}) **${{ steps.build.outputs.release_name }}** + `SHA256 : ${{ steps.build.outputs.sha256 }}` env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ubuntu20.yml b/.github/workflows/ubuntu20.yml index e0ee7304..a02a6fd8 100644 --- a/.github/workflows/ubuntu20.yml +++ b/.github/workflows/ubuntu20.yml @@ -22,9 +22,9 @@ jobs: 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-2004-v"$ccx_ver" + ccx_version=$(echo "$GITHUB_REF" | sed 's|refs/tags/||') + ccx_ver_folder=$(echo $ccx_version | sed 's/\.//g') + release_name=ccx-cli-ubuntu-2004-v"$ccx_version" mkdir -p "$build_folder" cd "$build_folder" cmake ../.. @@ -40,15 +40,17 @@ jobs: 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}" + echo "::set-output name=ccx_version::${ccx_version}" + # since https://github.com/softprops/action-gh-release/pull/145 body is replaced instead of being appended + # use v0.1.12 for now - name: Create Release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v0.1.12 with: files: ${{ steps.build.outputs.asset_path }} - name: Conceal Core CLI v${{ steps.build.outputs.ccx_ver }} + name: Conceal Core CLI v${{ steps.build.outputs.ccx_version }} body: | - **${{ steps.build.outputs.release_name }}** - ${{ steps.build.outputs.sha256 }} + [Download for Ubuntu 20.04](../../releases/download/${{ steps.build.outputs.ccx_version }}/${{ steps.build.outputs.release_name }}) **${{ steps.build.outputs.release_name }}** + `SHA256 : ${{ steps.build.outputs.sha256 }}` env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index b779f19b..810d9012 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -30,8 +30,8 @@ jobs: id: build run: | $build_folder = "build" - $ccx_ver = "${{ github.ref }}" -replace 'refs/tags/' - $release_name = "ccx-cli-win64-v$ccx_ver" + $ccx_version = "${{ github.ref }}" -replace 'refs/tags/' + $release_name = "ccx-cli-win64-v$ccx_version" mkdir "$build_folder" cd "$build_folder" cmake -G "Visual Studio 16 2019" .. @@ -45,15 +45,17 @@ jobs: echo "::set-output name=sha256::${sha256}" echo "::set-output name=release_name::${release_name}.zip" echo "::set-output name=asset_path::${asset_path}" - echo "::set-output name=ccx_ver::${ccx_ver}" + echo "::set-output name=ccx_version::${ccx_version}" + # since https://github.com/softprops/action-gh-release/pull/145 body is replaced instead of being appended + # use v0.1.12 for now - name: Create Release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v0.1.12 with: files: ${{ steps.build.outputs.asset_path }} - name: Conceal Core CLI v${{ steps.build.outputs.ccx_ver }} + name: Conceal Core CLI v${{ steps.build.outputs.ccx_version }} body: | - **${{ steps.build.outputs.release_name }}** - ${{ steps.build.outputs.sha256 }} + [Download for Windows](../../releases/download/${{ steps.build.outputs.ccx_version }}/${{ steps.build.outputs.release_name }}) **${{ steps.build.outputs.release_name }}** + `SHA256 : ${{ steps.build.outputs.sha256 }}` env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 7bc98929fdd3747b8806b89790d82edf76563df4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98x?= <35565671+krypt0x@users.noreply.github.com> Date: Thu, 11 Nov 2021 14:48:11 +0000 Subject: [PATCH 20/47] Update README.md --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cfe188b2..3b55c042 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,12 @@ ![image](https://github.com/ConcealNetwork/conceal-imagery/blob/master/logos/splash.png) +# Conceal Core (CLI) +Latest Release: v6.5.1 [![Ubuntu 20.04](https://github.com/ConcealNetwork/conceal-core/actions/workflows/ubuntu20.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/ubuntu20.yml) [![Ubuntu 18.04](https://github.com/ConcealNetwork/conceal-core/actions/workflows/ubuntu18.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/ubuntu18.yml) [![Windows](https://github.com/ConcealNetwork/conceal-core/actions/workflows/windows.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/windows.yml) [![macOS](https://github.com/ConcealNetwork/conceal-core/actions/workflows/macOS.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/macOS.yml) -# Conceal Core (CLI) -Latest Release: v6.5.1 - Maintained by Conceal Developers, overseen by Conceal Team and driven by Conceal Community. ## Information @@ -40,7 +39,7 @@ In some build scenarios it may be necessary to increase the size of the SWAP to For example if you have 8GB of RAM, then your SWAP size should be 5GB - Ubuntu / Linux - ```bash + ``` $ sudo fallocate -l 5G /swapfile $ sudo chmod 600 /swapfile $ sudo mkswap /swapfile From 1c90d16ae457f5e114caf2488daa5b4dc997ec70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98x?= <35565671+krypt0x@users.noreply.github.com> Date: Thu, 11 Nov 2021 15:21:33 +0000 Subject: [PATCH 21/47] Update README.md --- README.md | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 3b55c042..b6aa6450 100644 --- a/README.md +++ b/README.md @@ -39,15 +39,15 @@ In some build scenarios it may be necessary to increase the size of the SWAP to For example if you have 8GB of RAM, then your SWAP size should be 5GB - Ubuntu / Linux - ``` +``` $ sudo fallocate -l 5G /swapfile $ sudo chmod 600 /swapfile $ sudo mkswap /swapfile $ sudo swapon /swapfile - ``` +``` - Rasberry Pi OS - ```bash +``` $ sudo dphys-swapfile swapoff $ sudo nano /etc/dphys-swapfile $ CONF_SWAPSIZE=5120 @@ -55,7 +55,7 @@ For example if you have 8GB of RAM, then your SWAP size should be 5GB $ #CONF_MAXSWAP=2048 $ sudo dphys-swapfile setup $ sudo dphys-swapfile swapon - ``` +``` ### Linux / Ubuntu / Debian @@ -63,20 +63,20 @@ For example if you have 8GB of RAM, then your SWAP size should be 5GB - You will need the following dependencies to build the Conceal CLI: boost, cmake, git, gcc, g++, python, and make. - On Ubuntu: - ```bash +``` $ sudo apt update $ sudo apt-get install -y build-essential python-dev gcc g++ git cmake libboost-all-dev - ``` +``` #### Building - ```bash +``` $ git clone https://github.com/ConcealNetwork/conceal-core $ cd conceal-core $ mkdir build && cd $_ $ cmake .. $ make - ``` +``` If the build is successful the binaries will be in the `src` folder. @@ -101,13 +101,13 @@ Other ARM CPU/OS combinations should be possible if the CPU supports Neon/AES. From the start menu, open 'x64 Native Tools Command Prompt for vs2019' or run "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsMSBuildCmd.bat" from any command prompt. - ```bash +``` git clone https://github.com/ConcealNetwork/conceal-core cd conceal-core mkdir build cmake .. -G "Visual Studio 16 2019" -A x64 -DBOOST_LIBRARYDIR="c:\local\boost_1_73_0\lib64-msvc-14.2" msbuild concealX.sln /p:Configuration=Release /m - ``` +``` If the build is successful the binaries will be in the `src/Release` folder. @@ -118,16 +118,17 @@ If the build is successful the binaries will be in the `src/Release` folder. In order to install prerequisites, [XCode](https://developer.apple.com/xcode/) and [Homebrew](https://brew.sh/) needs to be installed. Once both are ready, open Terminal app and run the following command to install additional tools: - ```bash +``` $ xcode-select --install - ``` +``` On newer macOS versions (v10.14 and higher) this step is done through Software Update in System Preferences. After that, proceed with installing dependencies: - ```bash - $ brew install git python cmake gcc boost``` +```bash + $ brew install git python cmake gcc boost +``` #### Building From 76f24eec6b903e22c10fa856dc614eda6a881e06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98x?= <35565671+krypt0x@users.noreply.github.com> Date: Thu, 11 Nov 2021 15:22:42 +0000 Subject: [PATCH 22/47] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b6aa6450..f181d794 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ Latest Release: v6.5.1 [![Windows](https://github.com/ConcealNetwork/conceal-core/actions/workflows/windows.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/windows.yml) [![macOS](https://github.com/ConcealNetwork/conceal-core/actions/workflows/macOS.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/macOS.yml) + Maintained by Conceal Developers, overseen by Conceal Team and driven by Conceal Community. ## Information From 1499457f4e97e25c1d6e3f5303d2feabc621352f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98x?= <35565671+krypt0x@users.noreply.github.com> Date: Thu, 11 Nov 2021 15:23:32 +0000 Subject: [PATCH 23/47] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index f181d794..7c6cd29d 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,11 @@ ![image](https://github.com/ConcealNetwork/conceal-imagery/blob/master/logos/splash.png) # Conceal Core (CLI) -Latest Release: v6.5.1 [![Ubuntu 20.04](https://github.com/ConcealNetwork/conceal-core/actions/workflows/ubuntu20.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/ubuntu20.yml) [![Ubuntu 18.04](https://github.com/ConcealNetwork/conceal-core/actions/workflows/ubuntu18.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/ubuntu18.yml) [![Windows](https://github.com/ConcealNetwork/conceal-core/actions/workflows/windows.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/windows.yml) [![macOS](https://github.com/ConcealNetwork/conceal-core/actions/workflows/macOS.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/macOS.yml) - +Latest Release: v6.5.1 Maintained by Conceal Developers, overseen by Conceal Team and driven by Conceal Community. From a8adaa9b9de1e5e24aa07f90c378e03a2494016d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98x?= <35565671+krypt0x@users.noreply.github.com> Date: Thu, 11 Nov 2021 15:24:10 +0000 Subject: [PATCH 24/47] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7c6cd29d..3bc7833c 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ [![Ubuntu 18.04](https://github.com/ConcealNetwork/conceal-core/actions/workflows/ubuntu18.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/ubuntu18.yml) [![Windows](https://github.com/ConcealNetwork/conceal-core/actions/workflows/windows.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/windows.yml) [![macOS](https://github.com/ConcealNetwork/conceal-core/actions/workflows/macOS.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/macOS.yml) + Latest Release: v6.5.1 Maintained by Conceal Developers, overseen by Conceal Team and driven by Conceal Community. From 38049e38ee619172286d4a9d5bc7e8421c9a773d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98x?= <35565671+krypt0x@users.noreply.github.com> Date: Thu, 11 Nov 2021 15:25:27 +0000 Subject: [PATCH 25/47] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3bc7833c..b18f8bc6 100644 --- a/README.md +++ b/README.md @@ -102,13 +102,13 @@ Other ARM CPU/OS combinations should be possible if the CPU supports Neon/AES. From the start menu, open 'x64 Native Tools Command Prompt for vs2019' or run "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsMSBuildCmd.bat" from any command prompt. -``` + ``` git clone https://github.com/ConcealNetwork/conceal-core cd conceal-core mkdir build cmake .. -G "Visual Studio 16 2019" -A x64 -DBOOST_LIBRARYDIR="c:\local\boost_1_73_0\lib64-msvc-14.2" msbuild concealX.sln /p:Configuration=Release /m -``` + ``` If the build is successful the binaries will be in the `src/Release` folder. From e6044d39136dd3cc2ce4303b3e437126372208b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98x?= <35565671+krypt0x@users.noreply.github.com> Date: Thu, 11 Nov 2021 15:26:18 +0000 Subject: [PATCH 26/47] Update README.md --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b18f8bc6..2abb3043 100644 --- a/README.md +++ b/README.md @@ -102,13 +102,13 @@ Other ARM CPU/OS combinations should be possible if the CPU supports Neon/AES. From the start menu, open 'x64 Native Tools Command Prompt for vs2019' or run "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsMSBuildCmd.bat" from any command prompt. - ``` - git clone https://github.com/ConcealNetwork/conceal-core - cd conceal-core - mkdir build - cmake .. -G "Visual Studio 16 2019" -A x64 -DBOOST_LIBRARYDIR="c:\local\boost_1_73_0\lib64-msvc-14.2" - msbuild concealX.sln /p:Configuration=Release /m - ``` +``` + git clone https://github.com/ConcealNetwork/conceal-core + cd conceal-core + mkdir build + cmake .. -G "Visual Studio 16 2019" -A x64 -DBOOST_LIBRARYDIR="c:\local\boost_1_73_0\lib64-msvc-14.2" + msbuild concealX.sln /p:Configuration=Release /m +``` If the build is successful the binaries will be in the `src/Release` folder. From 25e619bb4363c5d5ba3c0f152a7bd70e963cecb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98x?= <35565671+krypt0x@users.noreply.github.com> Date: Thu, 11 Nov 2021 15:44:45 +0000 Subject: [PATCH 27/47] Update Readme (#226) Added workflow badges and standardised the bash instructions --- README.md | 90 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 48 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 1cba2e04..2abb3043 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,14 @@ ![image](https://github.com/ConcealNetwork/conceal-imagery/blob/master/logos/splash.png) -![](https://github.com/bomb-on/conceal-core/workflows/Ubuntu%2016.04/badge.svg) ![](https://github.com/bomb-on/conceal-core/workflows/Ubuntu%2018.04/badge.svg) ![](https://github.com/bomb-on/conceal-core/workflows/Windows/badge.svg) ![](https://github.com/bomb-on/conceal-core/workflows/macOS/badge.svg) - # Conceal Core (CLI) +[![Ubuntu 20.04](https://github.com/ConcealNetwork/conceal-core/actions/workflows/ubuntu20.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/ubuntu20.yml) +[![Ubuntu 18.04](https://github.com/ConcealNetwork/conceal-core/actions/workflows/ubuntu18.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/ubuntu18.yml) +[![Windows](https://github.com/ConcealNetwork/conceal-core/actions/workflows/windows.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/windows.yml) +[![macOS](https://github.com/ConcealNetwork/conceal-core/actions/workflows/macOS.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/macOS.yml) + Latest Release: v6.5.1 -Maintained by Conceal Developers. +Maintained by Conceal Developers, overseen by Conceal Team and driven by Conceal Community. ## Information Conceal Network is a secure peer-to-peer privacy framework empowering individuals and organizations to anonymously communicate and interact financially in a decentralized and censorship resistant ecosystem. @@ -37,23 +40,23 @@ In some build scenarios it may be necessary to increase the size of the SWAP to For example if you have 8GB of RAM, then your SWAP size should be 5GB - Ubuntu / Linux - ```bash - sudo fallocate -l 5G /swapfile - sudo chmod 600 /swapfile - sudo mkswap /swapfile - sudo swapon /swapfile - ``` +``` + $ sudo fallocate -l 5G /swapfile + $ sudo chmod 600 /swapfile + $ sudo mkswap /swapfile + $ sudo swapon /swapfile +``` - Rasberry Pi OS - ```bash - sudo dphys-swapfile swapoff - sudo nano /etc/dphys-swapfile - CONF_SWAPSIZE=5120 - sudo nano /sbin/dphys-swapfile - #CONF_MAXSWAP=2048 - sudo dphys-swapfile setup - sudo dphys-swapfile swapon - ``` +``` + $ sudo dphys-swapfile swapoff + $ sudo nano /etc/dphys-swapfile + $ CONF_SWAPSIZE=5120 + $ sudo nano /sbin/dphys-swapfile + $ #CONF_MAXSWAP=2048 + $ sudo dphys-swapfile setup + $ sudo dphys-swapfile swapon +``` ### Linux / Ubuntu / Debian @@ -61,18 +64,20 @@ For example if you have 8GB of RAM, then your SWAP size should be 5GB - You will need the following dependencies to build the Conceal CLI: boost, cmake, git, gcc, g++, python, and make. - On Ubuntu: - ``` - sudo apt update - sudo apt-get install -y build-essential python-dev gcc g++ git cmake libboost-all-dev - ``` +``` + $ sudo apt update + $ sudo apt-get install -y build-essential python-dev gcc g++ git cmake libboost-all-dev +``` #### Building -- `git clone https://github.com/ConcealNetwork/conceal-core` -- `cd conceal-core` -- `mkdir build && cd $_` -- `cmake ..` -- `make` +``` + $ git clone https://github.com/ConcealNetwork/conceal-core + $ cd conceal-core + $ mkdir build && cd $_ + $ cmake .. + $ make +``` If the build is successful the binaries will be in the `src` folder. @@ -97,12 +102,12 @@ Other ARM CPU/OS combinations should be possible if the CPU supports Neon/AES. From the start menu, open 'x64 Native Tools Command Prompt for vs2019' or run "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsMSBuildCmd.bat" from any command prompt. -```bash -git clone https://github.com/ConcealNetwork/conceal-core -cd conceal-core -mkdir build -cmake .. -G "Visual Studio 16 2019" -A x64 -DBOOST_LIBRARYDIR="c:\local\boost_1_73_0\lib64-msvc-14.2" -msbuild concealX.sln /p:Configuration=Release /m +``` + git clone https://github.com/ConcealNetwork/conceal-core + cd conceal-core + mkdir build + cmake .. -G "Visual Studio 16 2019" -A x64 -DBOOST_LIBRARYDIR="c:\local\boost_1_73_0\lib64-msvc-14.2" + msbuild concealX.sln /p:Configuration=Release /m ``` If the build is successful the binaries will be in the `src/Release` folder. @@ -114,8 +119,8 @@ If the build is successful the binaries will be in the `src/Release` folder. In order to install prerequisites, [XCode](https://developer.apple.com/xcode/) and [Homebrew](https://brew.sh/) needs to be installed. Once both are ready, open Terminal app and run the following command to install additional tools: -```bash -$ xcode-select --install +``` + $ xcode-select --install ``` On newer macOS versions (v10.14 and higher) this step is done through Software Update in System Preferences. @@ -123,19 +128,20 @@ On newer macOS versions (v10.14 and higher) this step is done through Software U After that, proceed with installing dependencies: ```bash -$ brew install git python cmake gcc boost + $ brew install git python cmake gcc boost ``` + #### Building When all dependencies are installed, build Conceal Core binaries: -```bash -$ git clone https://github.com/ConcealNetwork/conceal-core -$ cd conceal-core -$ mkdir build && cd $_ -$ cmake .. -$ make +``` + $ git clone https://github.com/ConcealNetwork/conceal-core + $ cd conceal-core + $ mkdir build && cd $_ + $ cmake .. + $ make ``` If the build is successful the binaries will be located in `src` directory. From 734c1a73f19187aca20f8f3ea86da2a866be382f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98x?= <35565671+krypt0x@users.noreply.github.com> Date: Thu, 11 Nov 2021 16:06:52 +0000 Subject: [PATCH 28/47] Update README.md fixed batch instructions and added ryo devs to `special thanks` section --- README.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 2abb3043..d6755154 100644 --- a/README.md +++ b/README.md @@ -71,12 +71,12 @@ For example if you have 8GB of RAM, then your SWAP size should be 5GB #### Building -``` - $ git clone https://github.com/ConcealNetwork/conceal-core - $ cd conceal-core - $ mkdir build && cd $_ - $ cmake .. - $ make +```bash + git clone https://github.com/ConcealNetwork/conceal-core + cd conceal-core + mkdir build && cd $_ + cmake .. + make ``` If the build is successful the binaries will be in the `src` folder. @@ -119,32 +119,32 @@ If the build is successful the binaries will be in the `src/Release` folder. In order to install prerequisites, [XCode](https://developer.apple.com/xcode/) and [Homebrew](https://brew.sh/) needs to be installed. Once both are ready, open Terminal app and run the following command to install additional tools: -``` - $ xcode-select --install +```bash + xcode-select --install ``` On newer macOS versions (v10.14 and higher) this step is done through Software Update in System Preferences. After that, proceed with installing dependencies: -```bash - $ brew install git python cmake gcc boost -``` + ```bash + brew install git python cmake gcc boost + ``` #### Building When all dependencies are installed, build Conceal Core binaries: -``` - $ git clone https://github.com/ConcealNetwork/conceal-core - $ cd conceal-core - $ mkdir build && cd $_ - $ cmake .. - $ make -``` + ```bash + git clone https://github.com/ConcealNetwork/conceal-core + cd conceal-core + mkdir build && cd $_ + cmake .. + make + ``` If the build is successful the binaries will be located in `src` directory. #### Special Thanks -Special thanks goes out to the developers from Cryptonote, Bytecoin, Monero, Forknote, TurtleCoin, Karbo and Masari. +Special thanks goes out to the developers from Cryptonote, Bytecoin, Ryo, Monero, Forknote, TurtleCoin, Karbo and Masari. From 281ea22ca758d0955bc55116ca0afd8d7056f6df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98x?= <35565671+krypt0x@users.noreply.github.com> Date: Thu, 11 Nov 2021 16:34:24 +0000 Subject: [PATCH 29/47] Update README.md Fixed workflow badges and updated bash instructions --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index 08fdc762..d6755154 100644 --- a/README.md +++ b/README.md @@ -71,14 +71,12 @@ For example if you have 8GB of RAM, then your SWAP size should be 5GB #### Building - ```bash git clone https://github.com/ConcealNetwork/conceal-core cd conceal-core mkdir build && cd $_ cmake .. make - ``` If the build is successful the binaries will be in the `src` folder. @@ -146,7 +144,6 @@ When all dependencies are installed, build Conceal Core binaries: make ``` - If the build is successful the binaries will be located in `src` directory. #### Special Thanks From 80b74a7ff829426873edca80bef571a992d6d39c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98x?= <35565671+krypt0x@users.noreply.github.com> Date: Thu, 11 Nov 2021 16:46:09 +0000 Subject: [PATCH 30/47] Fixed workflow badges and updated bash instructions (#230) Fixed workflow badges and updated bash instructions --- README.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 2abb3043..d6755154 100644 --- a/README.md +++ b/README.md @@ -71,12 +71,12 @@ For example if you have 8GB of RAM, then your SWAP size should be 5GB #### Building -``` - $ git clone https://github.com/ConcealNetwork/conceal-core - $ cd conceal-core - $ mkdir build && cd $_ - $ cmake .. - $ make +```bash + git clone https://github.com/ConcealNetwork/conceal-core + cd conceal-core + mkdir build && cd $_ + cmake .. + make ``` If the build is successful the binaries will be in the `src` folder. @@ -119,32 +119,32 @@ If the build is successful the binaries will be in the `src/Release` folder. In order to install prerequisites, [XCode](https://developer.apple.com/xcode/) and [Homebrew](https://brew.sh/) needs to be installed. Once both are ready, open Terminal app and run the following command to install additional tools: -``` - $ xcode-select --install +```bash + xcode-select --install ``` On newer macOS versions (v10.14 and higher) this step is done through Software Update in System Preferences. After that, proceed with installing dependencies: -```bash - $ brew install git python cmake gcc boost -``` + ```bash + brew install git python cmake gcc boost + ``` #### Building When all dependencies are installed, build Conceal Core binaries: -``` - $ git clone https://github.com/ConcealNetwork/conceal-core - $ cd conceal-core - $ mkdir build && cd $_ - $ cmake .. - $ make -``` + ```bash + git clone https://github.com/ConcealNetwork/conceal-core + cd conceal-core + mkdir build && cd $_ + cmake .. + make + ``` If the build is successful the binaries will be located in `src` directory. #### Special Thanks -Special thanks goes out to the developers from Cryptonote, Bytecoin, Monero, Forknote, TurtleCoin, Karbo and Masari. +Special thanks goes out to the developers from Cryptonote, Bytecoin, Ryo, Monero, Forknote, TurtleCoin, Karbo and Masari. From 577a6c2dadcd548c4103d195bd152c20f353a2a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98x?= <35565671+krypt0x@users.noreply.github.com> Date: Thu, 11 Nov 2021 16:51:44 +0000 Subject: [PATCH 31/47] Update README.md --- README.md | 59 +++++++++++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index d6755154..5131f38c 100644 --- a/README.md +++ b/README.md @@ -40,23 +40,23 @@ In some build scenarios it may be necessary to increase the size of the SWAP to For example if you have 8GB of RAM, then your SWAP size should be 5GB - Ubuntu / Linux -``` - $ sudo fallocate -l 5G /swapfile - $ sudo chmod 600 /swapfile - $ sudo mkswap /swapfile - $ sudo swapon /swapfile -``` + ```bash + sudo fallocate -l 5G /swapfile + sudo chmod 600 /swapfile + sudo mkswap /swapfile + sudo swapon /swapfile + ``` - Rasberry Pi OS -``` - $ sudo dphys-swapfile swapoff - $ sudo nano /etc/dphys-swapfile - $ CONF_SWAPSIZE=5120 - $ sudo nano /sbin/dphys-swapfile - $ #CONF_MAXSWAP=2048 - $ sudo dphys-swapfile setup - $ sudo dphys-swapfile swapon -``` + ``` + sudo dphys-swapfile swapoff + sudo nano /etc/dphys-swapfile + CONF_SWAPSIZE=5120 + sudo nano /sbin/dphys-swapfile + #CONF_MAXSWAP=2048 + sudo dphys-swapfile setup + sudo dphys-swapfile swapon + ``` ### Linux / Ubuntu / Debian @@ -64,20 +64,19 @@ For example if you have 8GB of RAM, then your SWAP size should be 5GB - You will need the following dependencies to build the Conceal CLI: boost, cmake, git, gcc, g++, python, and make. - On Ubuntu: -``` - $ sudo apt update + ```bash + sudo apt update $ sudo apt-get install -y build-essential python-dev gcc g++ git cmake libboost-all-dev -``` + ``` #### Building - -```bash + ```bash git clone https://github.com/ConcealNetwork/conceal-core cd conceal-core mkdir build && cd $_ cmake .. make -``` + ``` If the build is successful the binaries will be in the `src` folder. @@ -102,13 +101,13 @@ Other ARM CPU/OS combinations should be possible if the CPU supports Neon/AES. From the start menu, open 'x64 Native Tools Command Prompt for vs2019' or run "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsMSBuildCmd.bat" from any command prompt. -``` - git clone https://github.com/ConcealNetwork/conceal-core - cd conceal-core - mkdir build - cmake .. -G "Visual Studio 16 2019" -A x64 -DBOOST_LIBRARYDIR="c:\local\boost_1_73_0\lib64-msvc-14.2" - msbuild concealX.sln /p:Configuration=Release /m -``` + ```bash + git clone https://github.com/ConcealNetwork/conceal-core + cd conceal-core + mkdir build + cmake .. -G "Visual Studio 16 2019" -A x64 -DBOOST_LIBRARYDIR="c:\local\boost_1_73_0\lib64-msvc-14.2" + msbuild concealX.sln /p:Configuration=Release /m + ``` If the build is successful the binaries will be in the `src/Release` folder. @@ -119,9 +118,9 @@ If the build is successful the binaries will be in the `src/Release` folder. In order to install prerequisites, [XCode](https://developer.apple.com/xcode/) and [Homebrew](https://brew.sh/) needs to be installed. Once both are ready, open Terminal app and run the following command to install additional tools: -```bash + ```bash xcode-select --install -``` + ``` On newer macOS versions (v10.14 and higher) this step is done through Software Update in System Preferences. From 6eb63e468d25ccea7e9c2fd901f81bc14d94b743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98x?= <35565671+krypt0x@users.noreply.github.com> Date: Thu, 11 Nov 2021 17:16:43 +0000 Subject: [PATCH 32/47] Updated bash instructions (#231) Updated bash instructions --- README.md | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 5131f38c..b3ea4b28 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ For example if you have 8GB of RAM, then your SWAP size should be 5GB ``` - Rasberry Pi OS - ``` + ```bash sudo dphys-swapfile swapoff sudo nano /etc/dphys-swapfile CONF_SWAPSIZE=5120 @@ -62,14 +62,15 @@ For example if you have 8GB of RAM, then your SWAP size should be 5GB #### Prerequisites -- You will need the following dependencies to build the Conceal CLI: boost, cmake, git, gcc, g++, python, and make. -- On Ubuntu: +- You will need the following dependencies to build the Conceal CLI: boost, cmake, git, gcc, g++, python, and make: ```bash sudo apt update - $ sudo apt-get install -y build-essential python-dev gcc g++ git cmake libboost-all-dev + sudo apt-get install -y build-essential python-dev gcc g++ git cmake libboost-all-dev ``` - + #### Building + +- On Ubuntu: ```bash git clone https://github.com/ConcealNetwork/conceal-core cd conceal-core @@ -99,9 +100,8 @@ Other ARM CPU/OS combinations should be possible if the CPU supports Neon/AES. #### Building -From the start menu, open 'x64 Native Tools Command Prompt for vs2019' or run "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsMSBuildCmd.bat" from any command prompt. - - ```bash +- From the start menu, open 'x64 Native Tools Command Prompt for vs2019' or run "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsMSBuildCmd.bat" from any command prompt. + ```ps git clone https://github.com/ConcealNetwork/conceal-core cd conceal-core mkdir build @@ -115,17 +115,15 @@ If the build is successful the binaries will be in the `src/Release` folder. #### Prerequisites -In order to install prerequisites, [XCode](https://developer.apple.com/xcode/) and [Homebrew](https://brew.sh/) needs to be installed. +- In order to install prerequisites, [XCode](https://developer.apple.com/xcode/) and [Homebrew](https://brew.sh/) needs to be installed. Once both are ready, open Terminal app and run the following command to install additional tools: - ```bash xcode-select --install ``` -On newer macOS versions (v10.14 and higher) this step is done through Software Update in System Preferences. - -After that, proceed with installing dependencies: +- On newer macOS versions (v10.14 and higher) this step is done through Software Update in System Preferences. +- After that, proceed with installing dependencies: ```bash brew install git python cmake gcc boost ``` @@ -133,8 +131,7 @@ After that, proceed with installing dependencies: #### Building -When all dependencies are installed, build Conceal Core binaries: - +- When all dependencies are installed, build Conceal Core binaries: ```bash git clone https://github.com/ConcealNetwork/conceal-core cd conceal-core From d7c88f4f04e2f6b97c473e01d633c2461a7172ff Mon Sep 17 00:00:00 2001 From: AxVultis Date: Fri, 12 Nov 2021 12:36:21 +0100 Subject: [PATCH 33/47] Fix usage of *time --- src/CryptoNoteCore/TransactionPool.cpp | 46 ++++++++++++++++++++------ src/CryptoNoteCore/UpgradeDetector.h | 17 +++++++--- src/SimpleWallet/SimpleWallet.cpp | 13 ++++++-- 3 files changed, 57 insertions(+), 19 deletions(-) diff --git a/src/CryptoNoteCore/TransactionPool.cpp b/src/CryptoNoteCore/TransactionPool.cpp index 44009d09..30350cd7 100644 --- a/src/CryptoNoteCore/TransactionPool.cpp +++ b/src/CryptoNoteCore/TransactionPool.cpp @@ -445,25 +445,49 @@ namespace CryptoNote ss << storeToJson(txd.tx) << std::endl; } - char time[50]; - ctime_r(&txd.receiveTime, time); - ss << "blobSize: " << txd.blobSize << std::endl << "fee: " << m_currency.formatAmount(txd.fee) << std::endl - << "received: " << time; + << "received: "; + + char receivedTimeStr[32]; + struct tm receivedTimeTm; +#ifdef _WIN32 + gmtime_s(&receivedTimeTm, &txd.receiveTime); +#else + gmtime_r(&txd.receiveTime, &receivedTimeTm); +#endif + if (std::strftime(receivedTimeStr, sizeof(receivedTimeStr), "%c", &receivedTimeTm)) + { + ss << receivedTimeStr << " UTC"; + } + else + { + ss << "unable to get time"; + } + ss << std::endl; auto ttlIt = m_ttlIndex.find(txd.id); if (ttlIt != m_ttlIndex.end()) { - // ctime() returns string that ends with new line - char time[50]; - ctime_r(reinterpret_cast(&ttlIt->second), time); - ss << "TTL: " << time; + char ttlTimeStr[32]; + struct tm ttlTimeTm; + time_t timestamp = reinterpret_cast(&ttlIt->second); +#ifdef _WIN32 + gmtime_s(&ttlTimeTm, ×tamp); +#else + gmtime_r(×tamp, &ttlTimeTm); +#endif + if (std::strftime(ttlTimeStr, sizeof(ttlTimeStr), "%c", &ttlTimeTm)) + { + ss << "TTL: " << ttlTimeStr << " UTC"; + } + else + { + ss << "TTL failed"; + } + ss << std::endl; } - - ss << std::endl; } - return ss.str(); } //--------------------------------------------------------------------------------- diff --git a/src/CryptoNoteCore/UpgradeDetector.h b/src/CryptoNoteCore/UpgradeDetector.h index 967a06b3..cf53ed1c 100644 --- a/src/CryptoNoteCore/UpgradeDetector.h +++ b/src/CryptoNoteCore/UpgradeDetector.h @@ -123,14 +123,21 @@ namespace CryptoNote { if (m_blockchain.size() % (60 * 60 / m_currency.difficultyTarget()) == 0) { auto interval = m_currency.difficultyTarget() * (upgradeHeight() - m_blockchain.size() + 2); + char upgradeTimeStr[32]; + struct tm upgradeTimeTm; time_t upgradeTimestamp = time(nullptr) + static_cast(interval); - struct tm upgradeTime; - localtime_r(&upgradeTimestamp, &upgradeTime); - char upgradeTimeStr[40]; - strftime(upgradeTimeStr, 40, "%H:%M:%S %Y.%m.%d", &upgradeTime); +#ifdef _WIN32 + gmtime_s(&upgradeTimeTm, &upgradeTimestamp); +#else + gmtime_r(&upgradeTimestamp, &upgradeTimeTm); +#endif + if (!std::strftime(upgradeTimeStr, sizeof(upgradeTimeStr), "%c", &upgradeTimeTm)) + { + throw std::runtime_error("time buffer is too small"); + } logger(Logging::TRACE, Logging::BRIGHT_GREEN) << "###### UPGRADE is going to happen after block index " << upgradeHeight() << " at about " << - upgradeTimeStr << " (in " << Common::timeIntervalToString(interval) << ")! Current last block index " << (m_blockchain.size() - 1) << + upgradeTimeStr << " UTC" << " (in " << Common::timeIntervalToString(interval) << ")! Current last block index " << (m_blockchain.size() - 1) << ", hash " << get_block_hash(m_blockchain.back().bl); } } else if (m_blockchain.size() == upgradeHeight() + 1) { diff --git a/src/SimpleWallet/SimpleWallet.cpp b/src/SimpleWallet/SimpleWallet.cpp index fcf53f9c..cea42be9 100644 --- a/src/SimpleWallet/SimpleWallet.cpp +++ b/src/SimpleWallet/SimpleWallet.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -393,7 +394,7 @@ std::string makeCenteredString(size_t width, const std::string& text) { return std::string(offset, ' ') + text + std::string(width - text.size() - offset, ' '); } -const size_t TIMESTAMP_MAX_WIDTH = 19; +const size_t TIMESTAMP_MAX_WIDTH = 32; const size_t HASH_MAX_WIDTH = 64; const size_t TOTAL_AMOUNT_MAX_WIDTH = 20; const size_t FEE_MAX_WIDTH = 14; @@ -421,14 +422,20 @@ void printListTransfersItem(LoggerRef& logger, const WalletLegacyTransaction& tx char timeString[TIMESTAMP_MAX_WIDTH + 1]; time_t timestamp = static_cast(txInfo.timestamp); struct tm time; +#ifdef _WIN32 + gmtime_s(&time, ×tamp); +#else gmtime_r(×tamp, &time); - if (std::strftime(timeString, sizeof(timeString), "%Y-%m-%d %H:%M:%S", &time) == 0) { +#endif + + if (!std::strftime(timeString, sizeof(timeString), "%c", &time)) + { throw std::runtime_error("time buffer is too small"); } std::string rowColor = txInfo.totalAmount < 0 ? MAGENTA : GREEN; logger(INFO, rowColor) - << std::setw(TIMESTAMP_MAX_WIDTH) << timeString + << std::left << std::setw(TIMESTAMP_MAX_WIDTH) << timeString << " " << std::setw(HASH_MAX_WIDTH) << Common::podToHex(txInfo.hash) << " " << std::setw(TOTAL_AMOUNT_MAX_WIDTH) << currency.formatAmount(txInfo.totalAmount) << " " << std::setw(FEE_MAX_WIDTH) << currency.formatAmount(txInfo.fee) From 3d41c0cf28a2530d4f97298a6f19a7d8b35c21f8 Mon Sep 17 00:00:00 2001 From: AxVultis Date: Fri, 12 Nov 2021 12:36:43 +0100 Subject: [PATCH 34/47] Fix chacha8 warning --- src/crypto/chacha8.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/crypto/chacha8.h b/src/crypto/chacha8.h index 96dacd34..a0a05c27 100644 --- a/src/crypto/chacha8.h +++ b/src/crypto/chacha8.h @@ -26,11 +26,6 @@ namespace Crypto struct chacha8_key { uint8_t data[CHACHA8_KEY_SIZE]; - - ~chacha8_key() - { - memset(data, 0, sizeof(data)); - } }; // MS VC 2012 doesn't interpret `class chacha8_iv` as POD in spite of [9.0.10], so it is a struct From 631cf36806fea4a94d66c230e625e39aa247b68b Mon Sep 17 00:00:00 2001 From: AxVultis Date: Fri, 12 Nov 2021 13:08:38 +0100 Subject: [PATCH 35/47] Fix narrow type --- src/CryptoNoteCore/Blockchain.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CryptoNoteCore/Blockchain.cpp b/src/CryptoNoteCore/Blockchain.cpp index f66c6589..7835fe51 100644 --- a/src/CryptoNoteCore/Blockchain.cpp +++ b/src/CryptoNoteCore/Blockchain.cpp @@ -668,7 +668,7 @@ namespace CryptoNote { const TransactionEntry &transaction = block.transactions[t]; Crypto::Hash transactionHash = getObjectHash(transaction.tx); - TransactionIndex transactionIndex = {b, t}; + TransactionIndex transactionIndex = {b, static_cast(t)}; m_transactionMap.insert(std::make_pair(transactionHash, transactionIndex)); // process inputs @@ -695,7 +695,7 @@ namespace CryptoNote } else if (out.target.type() == typeid(MultisignatureOutput)) { - MultisignatureOutputUsage usage = {transactionIndex, o, false}; + MultisignatureOutputUsage usage = {transactionIndex, static_cast(o), false}; m_multisignatureOutputs[out.amount].push_back(usage); } } @@ -2752,7 +2752,7 @@ namespace CryptoNote { auto &amountOutputs = m_multisignatureOutputs[transaction.tx.outputs[output].amount]; transaction.m_global_output_indexes[output] = static_cast(amountOutputs.size()); - MultisignatureOutputUsage outputUsage = {transactionIndex, output, false}; + MultisignatureOutputUsage outputUsage = {transactionIndex, static_cast(output), false}; amountOutputs.push_back(outputUsage); } } From 5b20d321b5287f770419a67a493a62138f85de6a Mon Sep 17 00:00:00 2001 From: AxVultis Date: Fri, 12 Nov 2021 16:14:28 +0100 Subject: [PATCH 36/47] Fix bugs reported by sonarcloud --- src/Common/FileMappedVector.h | 2 +- src/Common/Varint.h | 2 +- src/CryptoNoteCore/BlockIndex.cpp | 18 +++--- src/CryptoNoteCore/Currency.cpp | 11 +++- src/HTTP/HttpParser.cpp | 35 ++++++++---- src/HTTP/HttpResponse.cpp | 56 +++++++++---------- .../KVBinaryInputStreamSerializer.cpp | 1 - src/Transfers/TypeHelpers.h | 8 +-- 8 files changed, 77 insertions(+), 56 deletions(-) diff --git a/src/Common/FileMappedVector.h b/src/Common/FileMappedVector.h index fa2dc38d..19f66fe7 100644 --- a/src/Common/FileMappedVector.h +++ b/src/Common/FileMappedVector.h @@ -759,7 +759,7 @@ void FileMappedVector::rename(const std::string& newPath) { template template void FileMappedVector::atomicUpdate(F&& func) { - atomicUpdate0(capacity(), prefixSize(), suffixSize(), std::move(func)); + atomicUpdate0(capacity(), prefixSize(), suffixSize(), std::forward(func)); } template diff --git a/src/Common/Varint.h b/src/Common/Varint.h index f24800e0..6f50af57 100644 --- a/src/Common/Varint.h +++ b/src/Common/Varint.h @@ -59,6 +59,6 @@ namespace Tools { template int read_varint(InputIt &&first, InputIt &&last, T &i) { - return read_varint::digits, InputIt, T>(std::move(first), std::move(last), i); + return read_varint::digits, InputIt, T>(std::forward(first), std::forward(last), i); } } diff --git a/src/CryptoNoteCore/BlockIndex.cpp b/src/CryptoNoteCore/BlockIndex.cpp index 8ae3f460..25a795f2 100644 --- a/src/CryptoNoteCore/BlockIndex.cpp +++ b/src/CryptoNoteCore/BlockIndex.cpp @@ -43,19 +43,23 @@ namespace CryptoNote { return false; } - std::vector BlockIndex::buildSparseChain(const Crypto::Hash& startBlockId) const { + std::vector BlockIndex::buildSparseChain(const Crypto::Hash &startBlockId) const + { assert(m_index.count(startBlockId) > 0); uint32_t startBlockHeight; - getBlockHeight(startBlockId, startBlockHeight); - std::vector result; - size_t sparseChainEnd = static_cast(startBlockHeight + 1); - for (size_t i = 1; i <= sparseChainEnd; i *= 2) { - result.emplace_back(m_container[sparseChainEnd - i]); + if (getBlockHeight(startBlockId, startBlockHeight)) + { + size_t sparseChainEnd = static_cast(startBlockHeight + 1); + for (size_t i = 1; i <= sparseChainEnd; i *= 2) + { + result.emplace_back(m_container[sparseChainEnd - i]); + } } - if (result.back() != m_container[0]) { + if (result.back() != m_container[0]) + { result.emplace_back(m_container[0]); } diff --git a/src/CryptoNoteCore/Currency.cpp b/src/CryptoNoteCore/Currency.cpp index 35026ecf..522b5d32 100644 --- a/src/CryptoNoteCore/Currency.cpp +++ b/src/CryptoNoteCore/Currency.cpp @@ -1092,7 +1092,12 @@ namespace CryptoNote uint64_t T = 120; // target solvetime seconds uint64_t N = 60; // N=45, 60, and 90 for T=600, 120, 60. - uint64_t L(0), ST, sum_3_ST(0), next_D, prev_D, this_timestamp, previous_timestamp; + uint64_t L = 0; + uint64_t sum_3_ST = 0; + uint64_t next_D = 0; + uint64_t prev_D; + uint64_t this_timestamp; + uint64_t previous_timestamp; // Make sure timestamps & CD vectors are not bigger than they are supposed to be. // assert(timestamps.size() == cumulative_difficulties.size() && @@ -1100,9 +1105,9 @@ namespace CryptoNote // If it's a new coin, do startup code. // Increase difficulty_guess if it needs to be much higher, but guess lower than lowest guess. - uint64_t difficulty_guess = 100; if (timestamps.size() <= 10) { + uint64_t difficulty_guess = 100; return difficulty_guess; } // Use "if" instead of "else if" in case vectors are incorrectly N all the time instead of N+1. @@ -1130,7 +1135,7 @@ namespace CryptoNote this_timestamp = previous_timestamp + 1; } // Limit solvetime ST to 6*T to prevent large drop in difficulty that could cause oscillations. - ST = std::min(6 * T, this_timestamp - previous_timestamp); + uint64_t ST = std::min(6 * T, this_timestamp - previous_timestamp); previous_timestamp = this_timestamp; L += ST * i; // give linearly higher weight to more recent solvetimes // delete the following line if you do not want the "jump rule" diff --git a/src/HTTP/HttpParser.cpp b/src/HTTP/HttpParser.cpp index 1c702ed2..bec49f71 100644 --- a/src/HTTP/HttpParser.cpp +++ b/src/HTTP/HttpParser.cpp @@ -26,17 +26,30 @@ void throwIfNotGood(std::istream& stream) { namespace CryptoNote { -HttpResponse::HTTP_STATUS HttpParser::parseResponseStatusFromString(const std::string& status) { - if (status == "200 OK" || status == "200 Ok") return CryptoNote::HttpResponse::STATUS_200; - else if (status.substr(0, 4) == "401 ") return CryptoNote::HttpResponse::STATUS_401; - else if (status == "404 Not Found") return CryptoNote::HttpResponse::STATUS_404; - else if (status == "500 Internal Server Error") return CryptoNote::HttpResponse::STATUS_500; - else throw std::system_error(make_error_code(CryptoNote::error::HttpParserErrorCodes::UNEXPECTED_SYMBOL), - "Unknown HTTP status code is given"); - - return CryptoNote::HttpResponse::STATUS_200; //unaccessible -} - + HttpResponse::HTTP_STATUS HttpParser::parseResponseStatusFromString(const std::string &status) + { + if (status == "200 OK" || status == "200 Ok") + { + return CryptoNote::HttpResponse::STATUS_200; + } + else if (status.substr(0, 4) == "401 ") + { + return CryptoNote::HttpResponse::STATUS_401; + } + else if (status == "404 Not Found") + { + return CryptoNote::HttpResponse::STATUS_404; + } + else if (status == "500 Internal Server Error") + { + return CryptoNote::HttpResponse::STATUS_500; + } + else + { + throw std::system_error(make_error_code(CryptoNote::error::HttpParserErrorCodes::UNEXPECTED_SYMBOL), + "Unknown HTTP status code is given"); + } + } void HttpParser::receiveRequest(std::istream& stream, HttpRequest& request) { readWord(stream, request.method); diff --git a/src/HTTP/HttpResponse.cpp b/src/HTTP/HttpResponse.cpp index 2fb75a86..febe134d 100644 --- a/src/HTTP/HttpResponse.cpp +++ b/src/HTTP/HttpResponse.cpp @@ -10,38 +10,38 @@ namespace { -const char* getStatusString(CryptoNote::HttpResponse::HTTP_STATUS status) { - switch (status) { - case CryptoNote::HttpResponse::STATUS_200: - return "200 OK"; - case CryptoNote::HttpResponse::STATUS_401: - return "401 Unauthorized"; - case CryptoNote::HttpResponse::STATUS_404: - return "404 Not Found"; - case CryptoNote::HttpResponse::STATUS_500: - return "500 Internal Server Error"; - default: - throw std::runtime_error("Unknown HTTP status code is given"); + const char *getStatusString(CryptoNote::HttpResponse::HTTP_STATUS status) + { + switch (status) + { + case CryptoNote::HttpResponse::STATUS_200: + return "200 OK"; + case CryptoNote::HttpResponse::STATUS_401: + return "401 Unauthorized"; + case CryptoNote::HttpResponse::STATUS_404: + return "404 Not Found"; + case CryptoNote::HttpResponse::STATUS_500: + return "500 Internal Server Error"; + default: + throw std::runtime_error("Unknown HTTP status code is given"); + } } - return ""; //unaccessible -} - -const char* getErrorBody(CryptoNote::HttpResponse::HTTP_STATUS status) { - switch (status) { - case CryptoNote::HttpResponse::STATUS_401: - return "Authorization required\n"; - case CryptoNote::HttpResponse::STATUS_404: - return "Requested url is not found\n"; - case CryptoNote::HttpResponse::STATUS_500: - return "Internal server error is occurred\n"; - default: - throw std::runtime_error("Error body for given status is not available"); + const char *getErrorBody(CryptoNote::HttpResponse::HTTP_STATUS status) + { + switch (status) + { + case CryptoNote::HttpResponse::STATUS_401: + return "Authorization required\n"; + case CryptoNote::HttpResponse::STATUS_404: + return "Requested url is not found\n"; + case CryptoNote::HttpResponse::STATUS_500: + return "Internal server error is occurred\n"; + default: + throw std::runtime_error("Error body for given status is not available"); + } } - return ""; //unaccessible -} - } //namespace namespace CryptoNote { diff --git a/src/Serialization/KVBinaryInputStreamSerializer.cpp b/src/Serialization/KVBinaryInputStreamSerializer.cpp index 128f0a60..4295b9ff 100644 --- a/src/Serialization/KVBinaryInputStreamSerializer.cpp +++ b/src/Serialization/KVBinaryInputStreamSerializer.cpp @@ -130,7 +130,6 @@ JsonValue loadValue(Common::IInputStream& stream, uint8_t type) { case BIN_KV_SERIALIZE_TYPE_ARRAY: return loadArray(stream, type); default: throw std::runtime_error("Unknown data type"); - break; } } diff --git a/src/Transfers/TypeHelpers.h b/src/Transfers/TypeHelpers.h index 533b5420..8a5b3867 100644 --- a/src/Transfers/TypeHelpers.h +++ b/src/Transfers/TypeHelpers.h @@ -12,10 +12,10 @@ namespace CryptoNote { -inline bool operator==(const AccountPublicAddress &_v1, const AccountPublicAddress &_v2) { - return memcmp(&_v1, &_v2, sizeof(AccountPublicAddress)) == 0; -} - + inline bool operator==(const AccountPublicAddress &_v1, const AccountPublicAddress &_v2) + { + return _v1.spendPublicKey == _v2.spendPublicKey && _v1.viewPublicKey == _v2.viewPublicKey; + } } namespace std { From d29eded2b1ec7144c2b1d4e322fea3ab8ab092ef Mon Sep 17 00:00:00 2001 From: AxVultis Date: Fri, 12 Nov 2021 16:15:11 +0100 Subject: [PATCH 37/47] Add CodeQL --- .github/workflows/codeql-analysis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index a7dfdd2e..c33ca03e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -7,10 +7,10 @@ name: "CodeQL" on: push: - branches: [master, codeql] + branches: [master, codeql, branch-sonarcloud] pull_request: # The branches below must be a subset of the branches above - branches: [master, codeql] + branches: [master, codeql, branch-sonarcloud] schedule: - cron: "0 3 * * 2" From ef8c13ab105617a91b9962c725e6c91e27fdc7ea Mon Sep 17 00:00:00 2001 From: Jay Taylor <92698655+cartoon-face@users.noreply.github.com> Date: Wed, 24 Nov 2021 13:21:10 +0000 Subject: [PATCH 38/47] Limit sending coins to within MONEY_SUPPLY --- src/SimpleWallet/SimpleWallet.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SimpleWallet/SimpleWallet.cpp b/src/SimpleWallet/SimpleWallet.cpp index b60d9ff1..469a5dd1 100644 --- a/src/SimpleWallet/SimpleWallet.cpp +++ b/src/SimpleWallet/SimpleWallet.cpp @@ -228,8 +228,9 @@ struct TransferCommand { bool ok = m_currency.parseAmount(value, de.amount); if (!ok || 0 == de.amount) { + // max should never exceed MONEY_SUPPLY logger(ERROR, BRIGHT_RED) << "amount is wrong: " << arg << ' ' << value << - ", expected number from 0 to " << m_currency.formatAmount(std::numeric_limits::max()); + ", expected number from 0 to " << m_currency.formatAmount(CryptoNote::parameters::MONEY_SUPPLY); return false; } From 741f70533bcc6eafb715d70bab0a705bd42264fe Mon Sep 17 00:00:00 2001 From: Jay Taylor <92698655+cartoon-face@users.noreply.github.com> Date: Wed, 24 Nov 2021 13:24:20 +0000 Subject: [PATCH 39/47] Use SIZE_MAX instead of potentially exceeding bytes --- src/Serialization/BinaryInputStreamSerializer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Serialization/BinaryInputStreamSerializer.cpp b/src/Serialization/BinaryInputStreamSerializer.cpp index c7bf6c05..7611b2e3 100644 --- a/src/Serialization/BinaryInputStreamSerializer.cpp +++ b/src/Serialization/BinaryInputStreamSerializer.cpp @@ -39,7 +39,7 @@ void BinaryInputStreamSerializer::endObject() { bool BinaryInputStreamSerializer::beginArray(size_t& size, Common::StringView name) { readVarintAs(stream, size); - if (size > 10000 * 1024 * 1024) { + if (size > SIZE_MAX) { throw std::runtime_error("array size is too big"); } @@ -90,10 +90,10 @@ bool BinaryInputStreamSerializer::operator()(bool& value, Common::StringView nam } bool BinaryInputStreamSerializer::operator()(std::string& value, Common::StringView name) { - uint64_t size; + size_t size; readVarint(stream, size); - if (size > 10000 * 1024 * 1024) { + if (size > SIZE_MAX) { throw std::runtime_error("string size is too big"); } else if (size > 0) { std::vector temp; From e889d578db77bf7ccfd697cc4a067391a82f4251 Mon Sep 17 00:00:00 2001 From: Jay Taylor <92698655+cartoon-face@users.noreply.github.com> Date: Wed, 24 Nov 2021 13:25:30 +0000 Subject: [PATCH 40/47] Use SIZE_MAX instead of potentially exceeding bytes --- src/Serialization/KVBinaryInputStreamSerializer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Serialization/KVBinaryInputStreamSerializer.cpp b/src/Serialization/KVBinaryInputStreamSerializer.cpp index 128f0a60..0b1c598e 100644 --- a/src/Serialization/KVBinaryInputStreamSerializer.cpp +++ b/src/Serialization/KVBinaryInputStreamSerializer.cpp @@ -70,7 +70,7 @@ size_t readVarint(Common::IInputStream& s) { std::string readString(Common::IInputStream& s) { auto size = readVarint(s); - if (size > 10000 * 1024 * 1024) { + if (size > SIZE_MAX) { throw std::runtime_error("string size is too big"); } From 5173cb7469973dfbc95a0e9ec6cd53bc2fcf7093 Mon Sep 17 00:00:00 2001 From: Jay Taylor <92698655+cartoon-face@users.noreply.github.com> Date: Wed, 24 Nov 2021 15:41:06 +0000 Subject: [PATCH 41/47] Fix no known conversion on Mac CI https://github.com/ConcealNetwork/conceal-core/runs/4312530105?check_suite_focus=true#step:3:889 --- src/Serialization/BinaryInputStreamSerializer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Serialization/BinaryInputStreamSerializer.cpp b/src/Serialization/BinaryInputStreamSerializer.cpp index 7611b2e3..aec8876e 100644 --- a/src/Serialization/BinaryInputStreamSerializer.cpp +++ b/src/Serialization/BinaryInputStreamSerializer.cpp @@ -90,7 +90,7 @@ bool BinaryInputStreamSerializer::operator()(bool& value, Common::StringView nam } bool BinaryInputStreamSerializer::operator()(std::string& value, Common::StringView name) { - size_t size; + uint64_t size; readVarint(stream, size); if (size > SIZE_MAX) { From 45b51bac88da5595042f3831be4e50fbfe885689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98x?= <35565671+krypt0x@users.noreply.github.com> Date: Wed, 24 Nov 2021 23:05:31 +0000 Subject: [PATCH 42/47] Update SECURITY.md --- SECURITY.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index a64bf122..6bd3ba69 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -7,8 +7,8 @@ currently being supported with security updates. | Version | Supported | | ------- | ------------------ | -| 6.4.8 | :white_check_mark: | -| 6.4.4 | :white_check_mark: | +| 6.5.1 | :white_check_mark: | +| 6.4.9 | :white_check_mark: | ## Reporting a Vulnerability From c52b22030861c4ffdb0e27be44ca50d8691f0661 Mon Sep 17 00:00:00 2001 From: Jay Taylor <92698655+cartoon-face@users.noreply.github.com> Date: Sat, 27 Nov 2021 19:38:54 +0000 Subject: [PATCH 43/47] Remove unused variable from Logging `std::streambuf::setp(char, char)` doesn't need or use `pptr()` as it only needs 2 char inputs, currently occupied by `pbase()` and `epptr()` --- src/Logging/LoggerMessage.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Logging/LoggerMessage.cpp b/src/Logging/LoggerMessage.cpp index 141d6f18..dc207aa5 100644 --- a/src/Logging/LoggerMessage.cpp +++ b/src/Logging/LoggerMessage.cpp @@ -64,7 +64,6 @@ LoggerMessage::LoggerMessage(LoggerMessage&& other) //streambuf swap char *_Pfirst = pbase(); - char *_Pnext = pptr(); char *_Pend = epptr(); char *_Gfirst = eback(); char *_Gnext = gptr(); From 714eb9c131200bf8f1f0a224b720e0d4354542b5 Mon Sep 17 00:00:00 2001 From: Jay Taylor <92698655+cartoon-face@users.noreply.github.com> Date: Mon, 29 Nov 2021 11:57:41 +0000 Subject: [PATCH 44/47] Remove unused variable from Logging (#234) `std::streambuf::setp(char, char)` doesn't need or use `pptr()` as it only needs 2 char inputs, currently occupied by `pbase()` and `epptr()` --- src/Logging/LoggerMessage.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Logging/LoggerMessage.cpp b/src/Logging/LoggerMessage.cpp index 141d6f18..dc207aa5 100644 --- a/src/Logging/LoggerMessage.cpp +++ b/src/Logging/LoggerMessage.cpp @@ -64,7 +64,6 @@ LoggerMessage::LoggerMessage(LoggerMessage&& other) //streambuf swap char *_Pfirst = pbase(); - char *_Pnext = pptr(); char *_Pend = epptr(); char *_Gfirst = eback(); char *_Gnext = gptr(); From 2a189f62a8d4cbb77b4e847c8d9eaaa1cf2c2d05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98x?= <35565671+krypt0x@users.noreply.github.com> Date: Mon, 29 Nov 2021 13:11:10 +0000 Subject: [PATCH 45/47] v6.5.2 (#235) * v.6.5.2 --- CMakeLists.txt | 4 ++-- README.md | 34 +++++++++++++++++----------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 42555f5a..fd92dc56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.0) include(CheckCXXCompilerFlag) -set(VERSION "6.5.1") +set(VERSION "6.5.2") set(VERSION_BUILD_NO "Endovelicus") # Packaged from main commits set(COMMIT 72946d9) @@ -308,4 +308,4 @@ else() endif() add_subdirectory(external) -add_subdirectory(src) \ No newline at end of file +add_subdirectory(src) diff --git a/README.md b/README.md index b3ea4b28..51cf3ecf 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Windows](https://github.com/ConcealNetwork/conceal-core/actions/workflows/windows.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/windows.yml) [![macOS](https://github.com/ConcealNetwork/conceal-core/actions/workflows/macOS.yml/badge.svg)](https://github.com/ConcealNetwork/conceal-core/actions/workflows/macOS.yml) -Latest Release: v6.5.1 +Latest Release: v6.5.2 Maintained by Conceal Developers, overseen by Conceal Team and driven by Conceal Community. @@ -40,15 +40,15 @@ In some build scenarios it may be necessary to increase the size of the SWAP to For example if you have 8GB of RAM, then your SWAP size should be 5GB - Ubuntu / Linux - ```bash +```bash sudo fallocate -l 5G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile - ``` +``` - Rasberry Pi OS - ```bash +```bash sudo dphys-swapfile swapoff sudo nano /etc/dphys-swapfile CONF_SWAPSIZE=5120 @@ -56,28 +56,28 @@ For example if you have 8GB of RAM, then your SWAP size should be 5GB #CONF_MAXSWAP=2048 sudo dphys-swapfile setup sudo dphys-swapfile swapon - ``` +``` ### Linux / Ubuntu / Debian #### Prerequisites - You will need the following dependencies to build the Conceal CLI: boost, cmake, git, gcc, g++, python, and make: - ```bash +```bash sudo apt update sudo apt-get install -y build-essential python-dev gcc g++ git cmake libboost-all-dev - ``` +``` #### Building - On Ubuntu: - ```bash +```bash git clone https://github.com/ConcealNetwork/conceal-core cd conceal-core mkdir build && cd $_ cmake .. make - ``` +``` If the build is successful the binaries will be in the `src` folder. @@ -101,13 +101,13 @@ Other ARM CPU/OS combinations should be possible if the CPU supports Neon/AES. #### Building - From the start menu, open 'x64 Native Tools Command Prompt for vs2019' or run "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsMSBuildCmd.bat" from any command prompt. - ```ps +```ps git clone https://github.com/ConcealNetwork/conceal-core cd conceal-core mkdir build cmake .. -G "Visual Studio 16 2019" -A x64 -DBOOST_LIBRARYDIR="c:\local\boost_1_73_0\lib64-msvc-14.2" msbuild concealX.sln /p:Configuration=Release /m - ``` +``` If the build is successful the binaries will be in the `src/Release` folder. @@ -117,28 +117,28 @@ If the build is successful the binaries will be in the `src/Release` folder. - In order to install prerequisites, [XCode](https://developer.apple.com/xcode/) and [Homebrew](https://brew.sh/) needs to be installed. Once both are ready, open Terminal app and run the following command to install additional tools: - ```bash +```bash xcode-select --install - ``` +``` - On newer macOS versions (v10.14 and higher) this step is done through Software Update in System Preferences. - After that, proceed with installing dependencies: - ```bash +```bash brew install git python cmake gcc boost - ``` +``` #### Building - When all dependencies are installed, build Conceal Core binaries: - ```bash +```bash git clone https://github.com/ConcealNetwork/conceal-core cd conceal-core mkdir build && cd $_ cmake .. make - ``` +``` If the build is successful the binaries will be located in `src` directory. From d4136dee05abc592177d95007927979b5cdbdefd Mon Sep 17 00:00:00 2001 From: AxVultis Date: Mon, 29 Nov 2021 21:49:02 +0100 Subject: [PATCH 46/47] File cleanup --- .github/workflows/codeql-analysis.yml | 68 --------------------------- .github/workflows/sonarcloud.yml | 30 ------------ sonar-project.properties | 17 ------- 3 files changed, 115 deletions(-) delete mode 100644 .github/workflows/codeql-analysis.yml delete mode 100644 .github/workflows/sonarcloud.yml delete mode 100644 sonar-project.properties diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index c33ca03e..00000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,68 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -name: "CodeQL" - -on: - push: - branches: [master, codeql, branch-sonarcloud] - pull_request: - # The branches below must be a subset of the branches above - branches: [master, codeql, branch-sonarcloud] - schedule: - - cron: "0 3 * * 2" - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - # Override automatic language detection by changing the below list - # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] - language: ["cpp"] - # Learn more... - # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - # - name: Autobuild - # uses: github/codeql-action/autobuild@v1 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - - name: Install Boost - run: | - sudo apt install -y libboost-all-dev - - - name: Build - run: | - mkdir build && cd $_ - cmake .. -DCMAKE_BUILD_TYPE=Release - make -j2 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml deleted file mode 100644 index 64bb1f0f..00000000 --- a/.github/workflows/sonarcloud.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: sonarcloud -on: [push, pull_request] -jobs: - sonarcloud: - name: sonarcloud - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: setup sonar-scanner - uses: warchant/setup-sonar-scanner@v3 - - - name: sonarcloud build & scan - run: | - sudo apt-get update - sudo apt-get install -y libboost-all-dev - wget https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip - unzip build-wrapper-linux-x86.zip - export PATH=./build-wrapper-linux-x86:$PATH - mkdir build - cd build - cmake .. -DCMAKE_BUILD_TYPE=Release - cd .. - build-wrapper-linux-x86-64 --out-dir bw-output cmake --build build -- -j 2 - sonar-scanner - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/sonar-project.properties b/sonar-project.properties deleted file mode 100644 index dfccca71..00000000 --- a/sonar-project.properties +++ /dev/null @@ -1,17 +0,0 @@ -sonar.host.url=https://sonarcloud.io -sonar.projectKey=bstera_conceal-core -sonar.organization=bstera - -# This is the name and version displayed in the SonarCloud UI. -sonar.projectName=conceal-core -sonar.projectVersion=6.4.5 - -# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. -sonar.sources=src - -# Encoding of the source code. Default is default system encoding -sonar.sourceEncoding=UTF-8 - -sonar.cfamily.build-wrapper-output=bw-output -sonar.cfamily.threads=2 -sonar.cfamily.cache.enabled=false From b97c26f9233af3a9b8a87d33fbc552bad051f748 Mon Sep 17 00:00:00 2001 From: Jay Taylor Date: Wed, 1 Dec 2021 18:27:52 +0000 Subject: [PATCH 47/47] SonarCloud code smell minors This should clear up all the code smell minor warnings on SonarCloud --- src/BlockchainExplorer/BlockchainExplorer.cpp | 6 ++--- src/CryptoNoteCore/Miner.cpp | 14 +++++----- src/CryptoNoteCore/OnceInInterval.h | 7 +++-- src/CryptoNoteCore/TransactionPool.cpp | 2 +- .../CryptoNoteProtocolHandler.cpp | 26 +++++++++---------- src/Logging/LoggerMessage.cpp | 2 +- src/Mnemonics/language_base.h | 4 +-- src/NodeRpcProxy/NodeRpcProxy.cpp | 14 +++++----- src/P2p/NetNode.cpp | 17 ++++++------ src/Wallet/PoolRpcServer.cpp | 20 +++++++------- src/Wallet/WalletRpcServer.cpp | 6 ++--- src/WalletLegacy/WalletTransactionSender.cpp | 15 ++++++----- src/crypto/keccak.c | 12 ++++++--- 13 files changed, 76 insertions(+), 69 deletions(-) diff --git a/src/BlockchainExplorer/BlockchainExplorer.cpp b/src/BlockchainExplorer/BlockchainExplorer.cpp index 18da8dbd..beef49c3 100644 --- a/src/BlockchainExplorer/BlockchainExplorer.cpp +++ b/src/BlockchainExplorer/BlockchainExplorer.cpp @@ -131,11 +131,11 @@ class ScopeExitHandler { }; BlockchainExplorer::BlockchainExplorer(INode& node, Logging::ILogger& logger) : + synchronized(false), + observersCounter(0), node(node), logger(logger, "BlockchainExplorer"), - state(NOT_INITIALIZED), - synchronized(false), - observersCounter(0) { + state(NOT_INITIALIZED) { } BlockchainExplorer::~BlockchainExplorer() {} diff --git a/src/CryptoNoteCore/Miner.cpp b/src/CryptoNoteCore/Miner.cpp index 4d2a498d..f2714839 100644 --- a/src/CryptoNoteCore/Miner.cpp +++ b/src/CryptoNoteCore/Miner.cpp @@ -37,18 +37,18 @@ namespace CryptoNote m_stop(true), m_template(boost::value_initialized()), m_template_no(0), - m_diffic(0), m_handler(handler), - m_pausers_count(0), - m_threads_total(0), m_starter_nonce(0), - m_last_hr_merge_time(0), - m_hashes(0), + m_threads_total(0), + m_pausers_count(0), + m_diffic(0), m_do_print_hashrate(false), m_do_mining(false), - m_current_hash_rate(0), m_update_block_template_interval(5), - m_update_merge_hr_interval(2) + m_update_merge_hr_interval(2), + m_current_hash_rate(0), + m_last_hr_merge_time(0), + m_hashes(0) { } //----------------------------------------------------------------------------------------------------- diff --git a/src/CryptoNoteCore/OnceInInterval.h b/src/CryptoNoteCore/OnceInInterval.h index 658a8c46..53562b94 100644 --- a/src/CryptoNoteCore/OnceInInterval.h +++ b/src/CryptoNoteCore/OnceInInterval.h @@ -14,8 +14,11 @@ namespace CryptoNote class OnceInInterval { public: - OnceInInterval(unsigned interval, bool startNow = true) - : m_interval(interval), m_lastCalled(startNow ? 0 : time(nullptr)) {} + OnceInInterval(unsigned interval, bool startNow = true) : + m_lastCalled(startNow ? 0 : time(nullptr)), + m_interval(interval) + { + } template bool call(F func) { diff --git a/src/CryptoNoteCore/TransactionPool.cpp b/src/CryptoNoteCore/TransactionPool.cpp index d00b155f..23d8bee6 100644 --- a/src/CryptoNoteCore/TransactionPool.cpp +++ b/src/CryptoNoteCore/TransactionPool.cpp @@ -111,9 +111,9 @@ namespace CryptoNote CryptoNote::ITransactionValidator &validator, CryptoNote::ITimeProvider &timeProvider, Logging::ILogger &log) : m_currency(currency), - m_validator(validator), m_timeProvider(timeProvider), m_txCheckInterval(60, timeProvider), + m_validator(validator), m_fee_index(boost::get<1>(m_transactions)), logger(log, "txpool") { diff --git a/src/CryptoNoteProtocol/CryptoNoteProtocolHandler.cpp b/src/CryptoNoteProtocol/CryptoNoteProtocolHandler.cpp index 5a163fdf..e845991c 100644 --- a/src/CryptoNoteProtocol/CryptoNoteProtocolHandler.cpp +++ b/src/CryptoNoteProtocol/CryptoNoteProtocolHandler.cpp @@ -43,22 +43,20 @@ void relay_post_notify(IP2pEndpoint &p2p, typename t_parametr::request &arg, con } // namespace -CryptoNoteProtocolHandler::CryptoNoteProtocolHandler(const Currency ¤cy, System::Dispatcher &dispatcher, ICore &rcore, IP2pEndpoint *p_net_layout, Logging::ILogger &log) : m_dispatcher(dispatcher), - m_currency(currency), - m_core(rcore), - m_p2p(p_net_layout), - m_synchronized(false), - m_stop(false), - m_observedHeight(0), - m_peersCount(0), - logger(log, "protocol") -{ - - if (!m_p2p) +CryptoNoteProtocolHandler::CryptoNoteProtocolHandler(const Currency ¤cy, System::Dispatcher &dispatcher, ICore &rcore, IP2pEndpoint *p_net_layout, Logging::ILogger &log) : + m_currency(currency), + m_p2p(p_net_layout), + m_core(rcore), + m_synchronized(false), + m_stop(false), + m_observedHeight(0), + m_peersCount(0), + logger(log, "protocol"), + m_dispatcher(dispatcher) { - m_p2p = &m_p2p_stub; + if (!m_p2p) + m_p2p = &m_p2p_stub; } -} size_t CryptoNoteProtocolHandler::getPeerCount() const { diff --git a/src/Logging/LoggerMessage.cpp b/src/Logging/LoggerMessage.cpp index dc207aa5..98653e3e 100644 --- a/src/Logging/LoggerMessage.cpp +++ b/src/Logging/LoggerMessage.cpp @@ -29,10 +29,10 @@ LoggerMessage::~LoggerMessage() { LoggerMessage::LoggerMessage(LoggerMessage&& other) : std::ostream(std::move(other)) , std::streambuf(std::move(other)) + , message(other.message) , category(other.category) , logLevel(other.logLevel) , logger(other.logger) - , message(other.message) , timestamp(boost::posix_time::microsec_clock::local_time()) , gotText(false) { this->set_rdbuf(this); diff --git a/src/Mnemonics/language_base.h b/src/Mnemonics/language_base.h index 959ba65e..8b51539e 100644 --- a/src/Mnemonics/language_base.h +++ b/src/Mnemonics/language_base.h @@ -128,8 +128,8 @@ namespace Language public: Base(const char *language_name, const std::vector &words, uint32_t prefix_length): word_list(words), - unique_prefix_length(prefix_length), - language_name(language_name) + language_name(language_name), + unique_prefix_length(prefix_length) { } virtual ~Base() diff --git a/src/NodeRpcProxy/NodeRpcProxy.cpp b/src/NodeRpcProxy/NodeRpcProxy.cpp index 920886db..5523b98f 100644 --- a/src/NodeRpcProxy/NodeRpcProxy.cpp +++ b/src/NodeRpcProxy/NodeRpcProxy.cpp @@ -52,13 +52,13 @@ std::error_code interpretResponseStatus(const std::string& status) { } NodeRpcProxy::NodeRpcProxy(const std::string& nodeHost, unsigned short nodePort) : - m_rpcTimeout(10000), - m_pullInterval(5000), - m_nodeHost(nodeHost), - m_nodePort(nodePort), - m_lastLocalBlockTimestamp(0), - m_connected(true) { - resetInternalState(); + m_nodeHost(nodeHost), + m_nodePort(nodePort), + m_rpcTimeout(10000), + m_pullInterval(5000), + m_lastLocalBlockTimestamp(0), + m_connected(true) { + resetInternalState(); } NodeRpcProxy::~NodeRpcProxy() { diff --git a/src/P2p/NetNode.cpp b/src/P2p/NetNode.cpp index 928d4207..fb1ed80f 100644 --- a/src/P2p/NetNode.cpp +++ b/src/P2p/NetNode.cpp @@ -193,22 +193,21 @@ namespace CryptoNote } NodeServer::NodeServer(System::Dispatcher& dispatcher, CryptoNote::CryptoNoteProtocolHandler& payload_handler, Logging::ILogger& log) : - m_dispatcher(dispatcher), - m_workingContextGroup(dispatcher), m_payload_handler(payload_handler), m_allow_local_ip(false), + m_timedSyncTimer(m_dispatcher), + m_dispatcher(dispatcher), + m_workingContextGroup(dispatcher), + m_peerlist_store_interval(60 * 30, false), + m_stop(false), m_hide_my_port(false), m_network_id(CRYPTONOTE_NETWORK), + m_connections_maker_interval(1), logger(log, "node_server"), - m_stopEvent(m_dispatcher), m_idleTimer(m_dispatcher), - m_timedSyncTimer(m_dispatcher), m_timeoutTimer(m_dispatcher), - m_stop(false), - // intervals - // m_peer_handshake_idle_maker_interval(CryptoNote::P2P_DEFAULT_HANDSHAKE_INTERVAL), - m_connections_maker_interval(1), - m_peerlist_store_interval(60 * 30, false) { + m_stopEvent(m_dispatcher) + { } void NodeServer::serialize(ISerializer& s) { diff --git a/src/Wallet/PoolRpcServer.cpp b/src/Wallet/PoolRpcServer.cpp index 95960657..f86d594e 100644 --- a/src/Wallet/PoolRpcServer.cpp +++ b/src/Wallet/PoolRpcServer.cpp @@ -52,15 +52,17 @@ pool_rpc_server::pool_rpc_server( CryptoNote::Currency& currency, const std::string& walletFile) : - HttpServer(dispatcher, log), - logger(log, "WalletRpc"), - m_dispatcher(dispatcher), - m_stopComplete(dispatcher), - m_wallet(w), - m_node(n), - m_currency(currency), - m_walletFilename(walletFile) { -} + HttpServer(dispatcher, log), + logger(log, "WalletRpc"), + m_currency(currency), + m_walletFilename(walletFile), + m_dispatcher(dispatcher), + m_stopComplete(dispatcher), + m_wallet(w), + m_node(n) + { + } + //------------------------------------------------------------------------------------------------------------------------------ bool pool_rpc_server::run() { start(m_bind_ip, m_port, m_rpcUser, m_rpcPassword); diff --git a/src/Wallet/WalletRpcServer.cpp b/src/Wallet/WalletRpcServer.cpp index 39a8e51b..11c5b934 100644 --- a/src/Wallet/WalletRpcServer.cpp +++ b/src/Wallet/WalletRpcServer.cpp @@ -62,12 +62,12 @@ wallet_rpc_server::wallet_rpc_server( : HttpServer(dispatcher, log), logger(log, "WalletRpc"), + m_currency(currency), + m_walletFilename(walletFile), m_dispatcher(dispatcher), m_stopComplete(dispatcher), m_wallet(w), - m_node(n), - m_currency(currency), - m_walletFilename(walletFile) { + m_node(n) { } //------------------------------------------------------------------------------------------------------------------------------ bool wallet_rpc_server::run() { diff --git a/src/WalletLegacy/WalletTransactionSender.cpp b/src/WalletLegacy/WalletTransactionSender.cpp index ad8cc4ab..ec6b969e 100644 --- a/src/WalletLegacy/WalletTransactionSender.cpp +++ b/src/WalletLegacy/WalletTransactionSender.cpp @@ -168,13 +168,14 @@ namespace namespace CryptoNote { - WalletTransactionSender::WalletTransactionSender(const Currency ¤cy, WalletUserTransactionsCache &transactionsCache, AccountKeys keys, ITransfersContainer &transfersContainer, INode &node) : m_currency(currency), - m_transactionsCache(transactionsCache), - m_isStoping(false), - m_keys(keys), - m_transferDetails(transfersContainer), - m_upperTransactionSizeLimit(m_currency.transactionMaxSize()), - m_node(node) + WalletTransactionSender::WalletTransactionSender(const Currency ¤cy, WalletUserTransactionsCache &transactionsCache, AccountKeys keys, ITransfersContainer &transfersContainer, INode &node) : + m_currency(currency), + m_isStoping(false), + m_transferDetails(transfersContainer), + m_transactionsCache(transactionsCache), + m_upperTransactionSizeLimit(m_currency.transactionMaxSize()), + m_keys(keys), + m_node(node) { } diff --git a/src/crypto/keccak.c b/src/crypto/keccak.c index 40f29ebd..dfe3229e 100644 --- a/src/crypto/keccak.c +++ b/src/crypto/keccak.c @@ -33,10 +33,12 @@ const int keccakf_piln[24] = void keccakf(uint64_t st[25], int rounds) { - int i, j, round; - uint64_t t, bc[5]; + int i; + int j; + uint64_t t; + uint64_t bc[5]; - for (round = 0; round < rounds; round++) { + for (int round = 0; round < rounds; round++) { // Theta for (i = 0; i < 5; i++) @@ -77,7 +79,9 @@ int keccak(const uint8_t *in, int inlen, uint8_t *md, int mdlen) { state_t st; uint8_t temp[144]; - int i, rsiz, rsizw; + int i; + int rsiz; + int rsizw; const int HASH_DATA_AREA = 136;