From 2fd96fd5c66de20c0b9b092b58e2800682a59de4 Mon Sep 17 00:00:00 2001 From: kyonRay Date: Mon, 25 Nov 2024 22:07:03 +0800 Subject: [PATCH] (CI): add ubuntu upload, try to fix windows compile cppsdk error. --- .github/workflows/release.yml | 16 ++-- .github/workflows/workflow-github-macOS.yml | 11 --- .../workflows/workflow-self-hosted-arm.yml | 11 ++- .../workflows/workflow-self-hosted-centos.yml | 13 +-- .../workflow-self-hosted-ubuntu-upload.yml | 83 +++++++++++++++++++ .../bcos-boostssl/websocket/WsError.h | 4 + .../interfaces/crypto/CommonType.h | 2 +- .../signature/fastsm2/fast_sm2.cpp | 60 +++++++------- .../signature/hsmSM2/HsmSM2Crypto.cpp | 21 ++--- bcos-rpc/test/sample.conf | 4 +- bcos-sdk/CMakeLists.txt | 8 +- bcos-utilities/bcos-utilities/BoostLog.h | 28 ++++++- .../bcos-utilities/BoostLogInitializer.cpp | 4 +- bcos-utilities/bcos-utilities/Common.cpp | 3 +- tools/BcosAirBuilder/build_chain.sh | 14 ++-- 15 files changed, 195 insertions(+), 87 deletions(-) create mode 100644 .github/workflows/workflow-self-hosted-ubuntu-upload.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f96c902f0b..4a175ebfea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ concurrency: jobs: compile_macOS_release: name: upload standard binary of macOS - runs-on: macos-15-large + runs-on: macos-15 # runs-on: self-hosted-mac # if: startsWith(github.ref,'v2') steps: @@ -42,7 +42,7 @@ jobs: with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: bin/fisco-bcos.tar.gz - asset_name: fisco-bcos-macOS-x86_64.tar.gz + asset_name: fisco-bcos-macOS-arm.tar.gz tag: ${{ github.ref }} overwrite: true - name: Upload fisco-bcos-lightnode binaries to release @@ -50,7 +50,7 @@ jobs: with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: bin/lightnode.tar.gz - asset_name: fisco-bcos-lightnode-macOS-x86_64.tar.gz + asset_name: fisco-bcos-lightnode-macOS-arm.tar.gz tag: ${{ github.ref }} overwrite: true - name: Upload BcosNodeService binaries to release @@ -58,7 +58,7 @@ jobs: with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: fisco-bcos-tars-service/BcosNodeService.tgz - asset_name: BcosNodeService-macOS-x86_64.tgz + asset_name: BcosNodeService-macOS-arm.tgz tag: ${{ github.ref }} overwrite: true - name: Upload BcosRpcService binaries to release @@ -66,7 +66,7 @@ jobs: with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: fisco-bcos-tars-service/BcosRpcService.tgz - asset_name: BcosRpcService-macOS-x86_64.tgz + asset_name: BcosRpcService-macOS-arm.tgz tag: ${{ github.ref }} overwrite: true - name: Upload BcosGatewayService binaries to release @@ -74,7 +74,7 @@ jobs: with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: fisco-bcos-tars-service/BcosGatewayService.tgz - asset_name: BcosGatewayService-macOS-x86_64.tgz + asset_name: BcosGatewayService-macOS-arm.tgz tag: ${{ github.ref }} overwrite: true - name: Upload BcosMaxNodeService binaries to release @@ -82,7 +82,7 @@ jobs: with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: fisco-bcos-tars-service/BcosMaxNodeService.tgz - asset_name: BcosMaxNodeService-macOS-x86_64.tgz + asset_name: BcosMaxNodeService-macOS-arm.tgz tag: ${{ github.ref }} overwrite: true - name: Upload BcosExecutorService binaries to release @@ -90,7 +90,7 @@ jobs: with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: fisco-bcos-tars-service/BcosExecutorService.tgz - asset_name: BcosExecutorService-macOS-x86_64.tgz + asset_name: BcosExecutorService-macOS-arm.tgz tag: ${{ github.ref }} overwrite: true - name: Upload build_chain.sh diff --git a/.github/workflows/workflow-github-macOS.yml b/.github/workflows/workflow-github-macOS.yml index 25e5d68674..186b1b37e1 100644 --- a/.github/workflows/workflow-github-macOS.yml +++ b/.github/workflows/workflow-github-macOS.yml @@ -51,16 +51,5 @@ jobs: run: | cd build && CTEST_OUTPUT_ON_FAILURE=TRUE make test - - name: prepare RPCAPI Tests - run: cd tools && bash .ci/rpcapi_ci_prepare.sh - - - name: FISCO BCOS RpcApiTest - uses: matt-ball/newman-action@v1.0.4 - with: - collection: https://raw.githubusercontent.com/FISCO-BCOS/FISCOBCOS-RPC-API/main/fiscobcos.rpcapi.collection.json - - name: Integration test - Air run: cd tools && bash .ci/ci_check_air.sh ${{ github.base_ref }} - - - name: Integration test - Pro - run: cd tools && bash .ci/ci_check_pro.sh ${{ github.base_ref }} \ No newline at end of file diff --git a/.github/workflows/workflow-self-hosted-arm.yml b/.github/workflows/workflow-self-hosted-arm.yml index 75535ec33c..57f39fa627 100644 --- a/.github/workflows/workflow-self-hosted-arm.yml +++ b/.github/workflows/workflow-self-hosted-arm.yml @@ -15,6 +15,8 @@ on: env: ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true + ACTIONS_RUNNER_FORCED_INTERNAL_NODE_VERSION: node16 + ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16 concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true @@ -28,14 +30,17 @@ jobs: env: VCPKG_ROOT: ~/cache/vcpkg DEPS_ROOT: ~/cache/deps + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true + ACTIONS_RUNNER_FORCED_INTERNAL_NODE_VERSION: node16 + ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16 steps: - - uses: actions/checkout@v3 - with: - clean: false - name: Set up Node.js 16.x uses: actions/setup-node@v2 with: node-version: "16.x" + - uses: actions/checkout@v3 + with: + clean: false - name: Prepare centos tools run: | diff --git a/.github/workflows/workflow-self-hosted-centos.yml b/.github/workflows/workflow-self-hosted-centos.yml index 288cbe9b1a..116e856d0d 100644 --- a/.github/workflows/workflow-self-hosted-centos.yml +++ b/.github/workflows/workflow-self-hosted-centos.yml @@ -12,6 +12,8 @@ concurrency: cancel-in-progress: true env: ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true + ACTIONS_RUNNER_FORCED_INTERNAL_NODE_VERSION: node16 + ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16 jobs: build_centos: @@ -22,11 +24,10 @@ jobs: env: VCPKG_ROOT: ~/cache/vcpkg DEPS_ROOT: ~/cache/deps + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true + ACTIONS_RUNNER_FORCED_INTERNAL_NODE_VERSION: node16 + ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16 steps: - - uses: actions/checkout@v3 - with: - clean: false - - name: Set up JDK 1.8 uses: actions/setup-java@v3 with: @@ -37,7 +38,9 @@ jobs: uses: actions/setup-node@v2 with: node-version: "16.x" - + - uses: actions/checkout@v3 + with: + clean: false - name: yum install run: | sudo yum install -y -q epel-release centos-release-scl flex bison patch gmp-static glibc-static glibc-devel libzstd-devel diff --git a/.github/workflows/workflow-self-hosted-ubuntu-upload.yml b/.github/workflows/workflow-self-hosted-ubuntu-upload.yml new file mode 100644 index 0000000000..a38734ae54 --- /dev/null +++ b/.github/workflows/workflow-self-hosted-ubuntu-upload.yml @@ -0,0 +1,83 @@ +name: Ubuntu CI Upload +on: + push: + paths-ignore: + - "docs/**" + - "Changelog.md" + - "README.md" + pull_request: + branches: + - release-3.* + - feature-3.* + - bugfix-3.* + - master + release: + types: [ push ] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true +env: + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true + +jobs: + build_centos: + name: ubuntu ci upload + runs-on: self-hosted-ubuntu + strategy: + fail-fast: false + env: + VCPKG_ROOT: /home/ci/cache/vcpkg + DEPS_ROOT: /home/ci/cache/deps + steps: + - uses: actions/checkout@v3 + with: + clean: false + + - name: Set up JDK 1.8 + uses: actions/setup-java@v3 + with: + distribution: "zulu" + java-version: "8.0.382" + + - name: Set up Node.js 16.x + uses: actions/setup-node@v2 + with: + node-version: "16.x" + + - name: apt install + run: | + sudo apt update + sudo apt install -y lcov ccache wget python3-dev python3-pip git curl zip unzip tar + sudo apt install -y --no-install-recommends \ + clang make build-essential cmake libssl-dev zlib1g-dev ca-certificates \ + libgmp-dev flex bison patch libzstd-dev ninja-build pkg-config ccache uuid-runtime automake + + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2024-02-25 + override: true + + - name: Reuse build cache + run: | + mkdir -p ./build + rm -rf deps + ln -s ${{ env.DEPS_ROOT }} deps + + - name: Remove cache if correspond dir change + run: ./tools/.ci/clear_build_cache.sh + + - name: update vcpkg + run: | + cd ${{ env.VCPKG_ROOT }} && git fetch --all && git checkout master && git pull + cd - + + - name: Build for linux + run: | + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + cd build && cmake -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTESTS=OFF -DCOVERAGE=OFF -DWITH_LIGHTNODE=ON -DWITH_CPPSDK=ON -DWITH_TIKV=OFF -DWITH_TARS_SERVICES=OFF -DTOOLS=OFF -DBUILD_STATIC=ON -DALLOCATOR=default .. || cat *.log + make -j6 + - uses: actions/upload-artifact@v3 + with: + name: fisco-bcos.tar.gz + path: build/fisco-bcos-air/fisco-bcos \ No newline at end of file diff --git a/bcos-boostssl/bcos-boostssl/websocket/WsError.h b/bcos-boostssl/bcos-boostssl/websocket/WsError.h index 6b7bf729b2..4115920924 100644 --- a/bcos-boostssl/bcos-boostssl/websocket/WsError.h +++ b/bcos-boostssl/bcos-boostssl/websocket/WsError.h @@ -47,7 +47,11 @@ inline bool notRetryAgain(int _wsError) inline std::string wsErrorToString(WsError _wsError) { +#ifdef WIN32 + return std::to_string(_wsError); +#else return std::string(magic_enum::enum_name(_wsError)); +#endif } } // namespace bcos::boostssl::ws \ No newline at end of file diff --git a/bcos-crypto/bcos-crypto/interfaces/crypto/CommonType.h b/bcos-crypto/bcos-crypto/interfaces/crypto/CommonType.h index 0f94009b96..63db698b8a 100644 --- a/bcos-crypto/bcos-crypto/interfaces/crypto/CommonType.h +++ b/bcos-crypto/bcos-crypto/interfaces/crypto/CommonType.h @@ -19,8 +19,8 @@ * @date 2021-04-01 */ #pragma once +#include #include -#include #define CRYPTO_LOG(LEVEL) BCOS_LOG(LEVEL) << LOG_BADGE("CRYPTO") namespace bcos::crypto diff --git a/bcos-crypto/bcos-crypto/signature/fastsm2/fast_sm2.cpp b/bcos-crypto/bcos-crypto/signature/fastsm2/fast_sm2.cpp index 5be05565bc..54ef8e9abf 100644 --- a/bcos-crypto/bcos-crypto/signature/fastsm2/fast_sm2.cpp +++ b/bcos-crypto/bcos-crypto/signature/fastsm2/fast_sm2.cpp @@ -18,9 +18,9 @@ * @date 2022.01.17 * @author yujiechen */ -#include "bcos-utilities/BoostLog.h" #include #include +#include #include #include #include @@ -58,7 +58,7 @@ int8_t bcos::crypto::fast_sm2_sign(const CInputBuffer* raw_private_key, bn = BN_bin2bn((const unsigned char*)publicKeyData, 65, NULL); if (bn == nullptr) { - CRYPTO_LOG(ERROR) << LOG_DESC("fast_sm2_sign: error of BN_bin2bn for publicKey"); + CRYPTO_LOG(WARNING) << LOG_DESC("fast_sm2_sign: error of BN_bin2bn for publicKey"); goto done; } @@ -66,49 +66,49 @@ int8_t bcos::crypto::fast_sm2_sign(const CInputBuffer* raw_private_key, privateKey = BN_bin2bn((const unsigned char*)raw_private_key->data, raw_private_key->len, NULL); if (privateKey == nullptr) { - CRYPTO_LOG(ERROR) << LOG_DESC("sm2: fast_sm2_sign: error of BN_bin2bn for privateKey"); + CRYPTO_LOG(WARNING) << LOG_DESC("sm2: fast_sm2_sign: error of BN_bin2bn for privateKey"); goto done; } publicKey = EC_POINT_bn2point(sm2Group, bn, NULL, NULL); if (publicKey == NULL) { - CRYPTO_LOG(ERROR) << LOG_DESC( - "sm2: fast_sm2_sign: error of EC_POINT_bn2point for publicKey") - << LOG_KV("len", raw_public_key->len) - << LOG_KV( - "pubHex", *toHexString(raw_public_key->data, - raw_public_key->data + raw_public_key->len, "0x")); + CRYPTO_LOG(WARNING) << LOG_DESC( + "sm2: fast_sm2_sign: error of EC_POINT_bn2point for publicKey") + << LOG_KV("len", raw_public_key->len) + << LOG_KV( + "pubHex", *toHexString(raw_public_key->data, + raw_public_key->data + raw_public_key->len, "0x")); goto done; } sm2Key = EC_KEY_new(); if (sm2Key == NULL) { - CRYPTO_LOG(ERROR) << "sm2: fast_sm2_sign: error of EC_KEY_new"; + CRYPTO_LOG(WARNING) << "sm2: fast_sm2_sign: error of EC_KEY_new"; goto done; } if (!EC_KEY_set_group(sm2Key, sm2Group)) { - CRYPTO_LOG(ERROR) << "sm2: fast_sm2_sign: error of EC_KEY_set_group"; + CRYPTO_LOG(WARNING) << "sm2: fast_sm2_sign: error of EC_KEY_set_group"; goto done; } // set the private key if (!EC_KEY_set_private_key(sm2Key, privateKey)) { - CRYPTO_LOG(ERROR) << "sm2: fast_sm2_sign: error of EC_KEY_set_private_key"; + CRYPTO_LOG(WARNING) << "sm2: fast_sm2_sign: error of EC_KEY_set_private_key"; goto done; } // set the public key if (!EC_KEY_set_public_key(sm2Key, publicKey)) { - CRYPTO_LOG(ERROR) << "sm2: fast_sm2_sign: error of EC_KEY_set_public_key"; + CRYPTO_LOG(WARNING) << "sm2: fast_sm2_sign: error of EC_KEY_set_public_key"; goto done; } sig = sm2_do_sign(sm2Key, EVP_sm3(), (const uint8_t*)c_userId, (size_t)strlen(c_userId), (const uint8_t*)raw_message_hash->data, raw_message_hash->len); if (sig == NULL) { - CRYPTO_LOG(ERROR) << "sm2: fast_sm2_sign: error of sm2_do_sign"; + CRYPTO_LOG(WARNING) << "sm2: fast_sm2_sign: error of sm2_do_sign"; goto done; } // set (r, s) to output_signature @@ -169,55 +169,55 @@ int8_t bcos::crypto::fast_sm2_verify(const CInputBuffer* raw_public_key, point = EC_POINT_new(sm2Group); if (point == NULL) { - CRYPTO_LOG(ERROR) << "sm2: fast_sm2_verify: error of EC_POINT_new"; + CRYPTO_LOG(WARNING) << "sm2: fast_sm2_verify: error of EC_POINT_new"; goto done; } if (!EC_POINT_bn2point(sm2Group, bn, point, NULL)) { - CRYPTO_LOG(ERROR) << "sm2: fast_sm2_verify: error of EC_POINT_bin2point"; + CRYPTO_LOG(WARNING) << "sm2: fast_sm2_verify: error of EC_POINT_bin2point"; goto done; } sm2Key = EC_KEY_new(); if (sm2Key == NULL) { - CRYPTO_LOG(ERROR) << "sm2: fast_sm2_verify: error of EC_KEY_new"; + CRYPTO_LOG(WARNING) << "sm2: fast_sm2_verify: error of EC_KEY_new"; goto done; } if (!EC_KEY_set_group(sm2Key, sm2Group)) { - CRYPTO_LOG(ERROR) << "sm2: fast_sm2_verify: error of EC_KEY_set_group"; + CRYPTO_LOG(WARNING) << "sm2: fast_sm2_verify: error of EC_KEY_set_group"; goto done; } if (!EC_KEY_set_public_key(sm2Key, point)) { - CRYPTO_LOG(ERROR) << "EC_KEY_set_public_key of EC_KEY_set_public_key"; + CRYPTO_LOG(WARNING) << "EC_KEY_set_public_key of EC_KEY_set_public_key"; goto done; } r = BN_bin2bn((const unsigned char*)raw_signature->data, c_R_FIELD_LEN, NULL); if (r == NULL) { - CRYPTO_LOG(ERROR) << "sm2: fast_sm2_verify: error of BN_bin2bn for r"; + CRYPTO_LOG(WARNING) << "sm2: fast_sm2_verify: error of BN_bin2bn for r"; goto done; } s = BN_bin2bn((const unsigned char*)(raw_signature->data + c_R_FIELD_LEN), c_S_FIELD_LEN, NULL); if (s == NULL) { - CRYPTO_LOG(ERROR) << "sm2: fast_sm2_verify: error of BN_bin2bn for s"; + CRYPTO_LOG(WARNING) << "sm2: fast_sm2_verify: error of BN_bin2bn for s"; goto done; } signData = ECDSA_SIG_new(); if (signData == NULL) { - CRYPTO_LOG(ERROR) << "sm2: fast_sm2_verify: error of ECDSA_SIG_new"; + CRYPTO_LOG(WARNING) << "sm2: fast_sm2_verify: error of ECDSA_SIG_new"; goto done; } // takes ownership of r and s if (!ECDSA_SIG_set0(signData, r, s)) { - CRYPTO_LOG(ERROR) << "sm2: fast_sm2_verify: error of ECDSA_SIG_set0"; + CRYPTO_LOG(WARNING) << "sm2: fast_sm2_verify: error of ECDSA_SIG_set0"; goto done; } if (sm2_do_verify(sm2Key, EVP_sm3(), signData, (const uint8_t*)c_userId, strlen(c_userId), @@ -259,41 +259,41 @@ int8_t bcos::crypto::fast_sm2_derive_public_key( BN_bin2bn((const unsigned char*)raw_private_key->data, raw_private_key->len, NULL); if (!privateKey) { - CRYPTO_LOG(ERROR) << "sm2: fast_sm2_derive_public_key: error of BN_bin2bn for privateKey"; + CRYPTO_LOG(WARNING) << "sm2: fast_sm2_derive_public_key: error of BN_bin2bn for privateKey"; goto done; } ctx = BN_CTX_new(); if (!ctx) { - CRYPTO_LOG(ERROR) << "sm2: fast_sm2_derive_public_key: error of BN_CTX_new"; + CRYPTO_LOG(WARNING) << "sm2: fast_sm2_derive_public_key: error of BN_CTX_new"; goto done; } sm2Key = EC_KEY_new_by_curve_name(NID_sm2); if (!sm2Key) { - CRYPTO_LOG(ERROR) << "sm2: fast_sm2_derive_public_key: error of EC_KEY_new_by_curve_name"; + CRYPTO_LOG(WARNING) << "sm2: fast_sm2_derive_public_key: error of EC_KEY_new_by_curve_name"; goto done; } if (!EC_KEY_set_private_key(sm2Key, privateKey)) { - CRYPTO_LOG(ERROR) << "sm2: fast_sm2_derive_public_key: error EC_KEY_set_private_key"; + CRYPTO_LOG(WARNING) << "sm2: fast_sm2_derive_public_key: error EC_KEY_set_private_key"; goto done; } pubPoint = EC_POINT_new(sm2Group); if (!pubPoint) { - CRYPTO_LOG(ERROR) << "sm2: fast_sm2_derive_public_key: error EC_POINT_new"; + CRYPTO_LOG(WARNING) << "sm2: fast_sm2_derive_public_key: error EC_POINT_new"; goto done; } if (!EC_POINT_mul(sm2Group, pubPoint, privateKey, NULL, NULL, NULL)) { - CRYPTO_LOG(ERROR) << "sm2: fast_sm2_derive_public_key: error of EC_POINT_mul"; + CRYPTO_LOG(WARNING) << "sm2: fast_sm2_derive_public_key: error of EC_POINT_mul"; goto done; } if (!EC_POINT_point2buf( sm2Group, pubPoint, POINT_CONVERSION_UNCOMPRESSED, (unsigned char**)&publicKey, ctx)) { - CRYPTO_LOG(ERROR) + CRYPTO_LOG(WARNING) << "sm2: fast_sm2_derive_public_key: error of EC_POINT_point2bin for publicKey"; goto done; } diff --git a/bcos-crypto/bcos-crypto/signature/hsmSM2/HsmSM2Crypto.cpp b/bcos-crypto/bcos-crypto/signature/hsmSM2/HsmSM2Crypto.cpp index a75e17033e..6941b520ae 100644 --- a/bcos-crypto/bcos-crypto/signature/hsmSM2/HsmSM2Crypto.cpp +++ b/bcos-crypto/bcos-crypto/signature/hsmSM2/HsmSM2Crypto.cpp @@ -18,12 +18,13 @@ * @date 2022.10.07 * @author lucasli */ -#include "hsm-crypto/hsm/CryptoProvider.h" -#include "hsm-crypto/hsm/SDFCryptoProvider.h" #include #include #include #include +#include +#include +#include #include using namespace bcos; @@ -77,8 +78,8 @@ std::shared_ptr HsmSM2Crypto::sign( (unsigned char*)hashResult, &uiHashResultLen); if (code != SDR_OK) { - CRYPTO_LOG(ERROR) << "[HSMSignature::sign] ERROR of compute H(M')" - << LOG_KV("message", provider.GetErrorMessage(code)); + CRYPTO_LOG(WARNING) << "[HSMSignature::sign] ERROR of compute H(M')" + << LOG_KV("message", provider.GetErrorMessage(code)); return nullptr; } @@ -88,8 +89,8 @@ std::shared_ptr HsmSM2Crypto::sign( key, hsm::SM2, (const unsigned char*)hashResult, 32, signatureData->data(), &signLen); if (code != SDR_OK) { - CRYPTO_LOG(ERROR) << "[HSMSignature::sign] ERROR of Sign" - << LOG_KV("message", provider.GetErrorMessage(code)); + CRYPTO_LOG(WARNING) << "[HSMSignature::sign] ERROR of Sign" + << LOG_KV("message", provider.GetErrorMessage(code)); return nullptr; } @@ -129,8 +130,8 @@ bool HsmSM2Crypto::verify( (unsigned char*)hashResult.data(), &uiHashResultLen); if (code != SDR_OK) { - CRYPTO_LOG(ERROR) << "[HSMSignature::verify] ERROR of Hash" - << LOG_KV("message", provider.GetErrorMessage(code)); + CRYPTO_LOG(WARNING) << "[HSMSignature::verify] ERROR of Hash" + << LOG_KV("message", provider.GetErrorMessage(code)); return false; } @@ -138,8 +139,8 @@ bool HsmSM2Crypto::verify( HSM_SM3_DIGEST_LENGTH, _signatureData.data(), 64, &verifyResult); if (code != SDR_OK) { - CRYPTO_LOG(ERROR) << "[HSMSignature::verify] ERROR of Verify" - << LOG_KV("message", provider.GetErrorMessage(code)); + CRYPTO_LOG(WARNING) << "[HSMSignature::verify] ERROR of Verify" + << LOG_KV("message", provider.GetErrorMessage(code)); return false; } return true; diff --git a/bcos-rpc/test/sample.conf b/bcos-rpc/test/sample.conf index 4199135e62..95fc57ea2b 100644 --- a/bcos-rpc/test/sample.conf +++ b/bcos-rpc/test/sample.conf @@ -4,7 +4,7 @@ setdivision=NULL #本地node的ip:port - # node=tars.tarsnode.ServerObj@tcp -h 10.120.129.226 -p 19386 -t 60000 + # node=tars.tarsnode.ServerObj@tcp -h 127.0.0.1 -p 19386 -t 60000 #应用名称 app=fiscobcos #服务名称 @@ -55,7 +55,7 @@ #主控的地址 - # locator=tars.tarsregistry.QueryObj@tcp -h 10.120.129.226 -p 17890 + # locator=tars.tarsregistry.QueryObj@tcp -h 127.0.0.1 -p 17890 #同步超时时间 # sync-invoke-timeout=3000 #异步超时时间 diff --git a/bcos-sdk/CMakeLists.txt b/bcos-sdk/CMakeLists.txt index 386013ffcf..dbc856894d 100644 --- a/bcos-sdk/CMakeLists.txt +++ b/bcos-sdk/CMakeLists.txt @@ -1,9 +1,11 @@ file(GLOB_RECURSE SRC_LIST "bcos-cpp-sdk/*.cpp") list(APPEND LINK_LIB_LIST bcos-crypto bcos-boostssl bcos-utilities ${TARS_PROTOCOL_TARGET} jsoncpp_static OpenSSL::SSL OpenSSL::Crypto) +file(GLOB_RECURSE TARS_LIST "bcos-cpp-sdk/tarsRPC/*.cpp") if (ONLY_CPP_SDK AND (NOT WITH_SWIG_SDK)) - list(REMOVE_ITEM SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/bcos-cpp-sdk/tarsRPC/CoRPCClient.cpp") - list(REMOVE_ITEM SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/bcos-cpp-sdk/tarsRPC/RPCClient.cpp") - list(REMOVE_ITEM SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/bcos-cpp-sdk/tarsRPC/detail/Core.cpp") + # for TARS_LIST + foreach (TARS_FILE ${TARS_LIST}) + list(REMOVE_ITEM SRC_LIST "${TARS_FILE}") + endforeach () endif () find_package(Boost REQUIRED log serialization) diff --git a/bcos-utilities/bcos-utilities/BoostLog.h b/bcos-utilities/bcos-utilities/BoostLog.h index b831301e1c..d1c5faffcb 100644 --- a/bcos-utilities/bcos-utilities/BoostLog.h +++ b/bcos-utilities/bcos-utilities/BoostLog.h @@ -21,6 +21,30 @@ */ #pragma once +#ifdef WIN32 +#define WIN32_LEAN_AND_MEAN +#endif + +#ifdef ERROR +#undef ERROR +#endif + +#ifdef TRACE +#undef TRACE +#endif + +#ifdef INFO +#undef INFO +#endif + +#ifdef WARNING +#undef WARNING +#endif + +#ifdef FATAL +#undef FATAL +#endif + #include #include #include @@ -44,10 +68,6 @@ #define LOG_KV(_K, _V) "," << (_K) << "=" << (_V) #endif -#ifdef ERROR -#undef ERROR -#endif - namespace bcos { extern std::string const FileLogger; diff --git a/bcos-utilities/bcos-utilities/BoostLogInitializer.cpp b/bcos-utilities/bcos-utilities/BoostLogInitializer.cpp index 0af2c4996a..3b00f143e1 100644 --- a/bcos-utilities/bcos-utilities/BoostLogInitializer.cpp +++ b/bcos-utilities/bcos-utilities/BoostLogInitializer.cpp @@ -20,9 +20,9 @@ */ #include "BoostLogInitializer.h" #include "BoostLogThreadNameAttribute.h" -#include "bcos-framework/bcos-framework/Common.h" -#include "bcos-utilities/BoostLog.h" +#include #include +#include #include #include #include diff --git a/bcos-utilities/bcos-utilities/Common.cpp b/bcos-utilities/bcos-utilities/Common.cpp index 9402aead38..bbb2006435 100644 --- a/bcos-utilities/bcos-utilities/Common.cpp +++ b/bcos-utilities/bcos-utilities/Common.cpp @@ -18,10 +18,11 @@ * @date 2021-02-24 */ -#include "bcos-utilities/BoostLog.h" +#include #define NOMINMAX #if defined(WIN32) || defined(WIN64) || defined(_WIN32) || defined(_WIN32_) #define _WIN32_WINNT 0x0601 +#define WIN32_LEAN_AND_MEAN #include #else #include diff --git a/tools/BcosAirBuilder/build_chain.sh b/tools/BcosAirBuilder/build_chain.sh index 05b5dd3159..2a7c3c673f 100755 --- a/tools/BcosAirBuilder/build_chain.sh +++ b/tools/BcosAirBuilder/build_chain.sh @@ -624,14 +624,14 @@ modify node e.g bash $0 -C modify -N ./node0 -u ./ca/ca.crt bash $0 -C modify -N ./node0 -u ./ca/ca.crt -s deploy pro service e.g - bash $0 -p 30300,20200 -l 172.31.184.227:2,172.30.93.111:2 -C deploy -V pro -o generate -t all - bash $0 -p 30300,20200 -l 172.31.184.227:2,172.30.93.111:2 -C deploy -V pro -o generate -t all -s - bash $0 -p 30300,20200 -l 172.31.184.227:2,172.30.93.111:2 -C deploy -V pro -o generate -e ./binary - bash $0 -p 30300,20200,40400 -l 172.31.184.227:2,172.30.93.111:2 -C deploy -V pro -o generate -y cdn -v ${service_binary_version} -r ./binaryPath + bash $0 -p 30300,20200 -l [IP1]:2,[IP2]:2 -C deploy -V pro -o generate -t all + bash $0 -p 30300,20200 -l [IP1]:2,[IP2]:2 -C deploy -V pro -o generate -t all -s + bash $0 -p 30300,20200 -l [IP1]:2,[IP2]:2 -C deploy -V pro -o generate -e ./binary + bash $0 -p 30300,20200,40400 -l [IP1]:2,[IP2]:2 -C deploy -V pro -o generate -y cdn -v ${service_binary_version} -r ./binaryPath deploy max service e.g - bash $0 -p 30300,20200,40400,2379 -l 172.31.184.227:1,172.30.93.111:1,172.31.184.54:1,172.31.185.59:1 -C deploy -V max -o generate -t all - bash $0 -p 30300,20200,40400,2379 -l 172.31.184.227:1,172.30.93.111:1,172.31.184.54:1,172.31.185.59:1 -C deploy -V max -o generate -t all -e ./binary -s - bash $0 -p 30300,20200,40400,2379 -l 172.31.184.227:1,172.30.93.111:1,172.31.184.54:1,172.31.185.59:1 -C deploy -V max -o generate -y cdn -v ${service_binary_version} -r ./binaryPath + bash $0 -p 30300,20200,40400,2379 -l [IP1]:1,[IP2]:1,[IP3]:1,[IP4]:1 -C deploy -V max -o generate -t all + bash $0 -p 30300,20200,40400,2379 -l [IP1]:1,[IP2]:1,[IP3]:1,[IP4]:1 -C deploy -V max -o generate -t all -e ./binary -s + bash $0 -p 30300,20200,40400,2379 -l [IP1]:1,[IP2]:1,[IP3]:1,[IP4]:1 -C deploy -V max -o generate -y cdn -v ${service_binary_version} -r ./binaryPath bash $0 -c config.toml -C deploy -V max -o generate -t all expand pro node e.g bash $0 -C expand_node -V pro -o expand_node -c ./config.toml