From 27681e55a5a9b2dabc7acad09b76ee33e80ef2f8 Mon Sep 17 00:00:00 2001 From: cyjseagull Date: Mon, 28 Oct 2024 15:52:35 +0800 Subject: [PATCH 1/2] fix centos ci no space left --- .github/workflows/cpp_full_node_workflow.yml | 25 ++++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/cpp_full_node_workflow.yml b/.github/workflows/cpp_full_node_workflow.yml index 77136375..59912a68 100644 --- a/.github/workflows/cpp_full_node_workflow.yml +++ b/.github/workflows/cpp_full_node_workflow.yml @@ -72,12 +72,6 @@ jobs: bash -x cpp/tools/install_depends.sh -o macos mkdir -p cpp/build && cd cpp/build && cmake -DTESTS=ON -DCOVERAGE=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../ make -j3 - - name: Publish Error - if: always() - uses: actions/upload-artifact@v4 - with: - name: config-x64-linux-dbg-err.log - path: /home/runner/work/WeDPR-Component/WeDPR-Component/vcpkg/buildtrees/libhdfs3/config-x64-linux-dbg-err.log - uses: actions/upload-artifact@v4 if: runner.os == 'macOS' with: @@ -111,6 +105,17 @@ jobs: volumes: - /usr/local/share/vcpkg:/usr/local/share/vcpkg steps: + - name: Check disk space + run: df . -h + - name: Free disk space + run: | + sudo docker rmi $(docker image ls -aq) >/dev/null 2>&1 || true + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc \ + /usr/local/share/powershell /usr/share/swift /usr/local/.ghcup || true + - name: Check disk space + run: | + df . -h + sudo du /usr/ -hx -d 4 --threshold=1G | sort -hr | head - uses: actions/checkout@v3 with: fetch-depth: 5 @@ -157,12 +162,6 @@ jobs: cd cpp/build cmake3 -DCMAKE_BUILD_TYPE=Release -DTESTS=ON -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake ../ cmake3 --build . --parallel 3 - - name: Publish Error - if: always() - uses: actions/upload-artifact@v3 - with: - name: vcpkg-manifest-install.log - path: /__w/WeDPR-Component/WeDPR-Component/cpp/build/vcpkg-manifest-install.log #- name: Test # run: | # export OMP_NUM_THREADS=1 @@ -178,4 +177,4 @@ jobs: - uses: actions/upload-artifact@v3 with: name: ppc-gateway-service-x64 - path: ./cpp/build/bin/ppc-gateway-service \ No newline at end of file + path: ./cpp/build/bin/ppc-gateway-service From f91497bae38188b6c35d402aa7218c1ca3a2f351 Mon Sep 17 00:00:00 2001 From: cyjseagull Date: Mon, 28 Oct 2024 16:32:36 +0800 Subject: [PATCH 2/2] deal with todo-lists --- .github/workflows/cpp_full_node_workflow.yml | 40 +++++++------ .github/workflows/cpp_sdk_workflow.yml | 8 +-- .github/workflows/cpp_toolkit_workflow.yml | 8 +-- cpp/cmake/CompilerSettings.cmake | 58 +++++++------------ cpp/cmake/Options.cmake | 2 +- cpp/cmake/grpc.cmake | 5 +- cpp/ppc-framework/protocol/GlobalConfig.h | 2 +- cpp/ppc-framework/protocol/Protocol.h | 24 +++----- cpp/ppc-framework/protocol/Task.h | 2 +- cpp/test-utils/FakeFront.h | 12 ++-- cpp/tools/install_depends.sh | 19 +----- .../src/controller/commandline_helper.py | 2 +- cpp/wedpr-computing/ppc-pir/src/OtPIRConfig.h | 2 +- cpp/wedpr-computing/ppc-pir/src/OtPIRImpl.cpp | 8 +-- cpp/wedpr-computing/ppc-pir/src/OtPIRImpl.h | 2 - .../ppc-pir/tests/TestBaseOT.cpp | 4 +- cpp/wedpr-computing/ppc-psi/src/Common.h | 2 +- cpp/wedpr-computing/ppc-psi/src/PSIConfig.h | 8 +-- .../src/bs-ecdh-psi/BsEcdhPSIFactory.h | 2 +- .../src/bs-ecdh-psi/core/BsEcdhCache.h | 1 - .../src/bs-ecdh-psi/core/BsEcdhTaskState.h | 2 +- .../bs-ecdh-psi/ffi/wedpr_ffi_edwards25519.h | 34 +++++------ .../src/bs-ecdh-psi/ffi/wedpr_utilities.h | 36 ++++++------ .../ppc-psi/src/cm2020-psi/CM2020PSIConfig.h | 2 +- .../ppc-psi/src/cm2020-psi/CM2020PSIImpl.cpp | 2 +- .../src/cm2020-psi/core/CM2020PSIReceiver.cpp | 12 ++-- .../src/cm2020-psi/core/CM2020PSISender.cpp | 13 +++-- .../src/cm2020-psi/protocol/CM2020PSIResult.h | 4 +- .../src/ecdh-conn-psi/EcdhConnPSIConfig.h | 2 +- .../src/ecdh-conn-psi/EcdhConnPSIImpl.cpp | 2 +- .../ecdh-conn-psi/core/EcdhConnPSIServer.cpp | 4 +- .../protocol/PSIConnMessageFactory.cpp | 4 +- .../src/ecdh-multi-psi/EcdhMultiPSIConfig.h | 2 +- .../src/ecdh-multi-psi/EcdhMultiPSIImpl.cpp | 2 +- .../core/EcdhMultiPSIMaster.cpp | 3 +- .../ppc-psi/src/ecdh-psi/EcdhPSIConfig.h | 4 +- .../ppc-psi/src/ecdh-psi/EcdhPSIImpl.cpp | 6 +- .../src/labeled-psi/LabeledPSIConfig.h | 4 +- .../src/labeled-psi/LabeledPSIImpl.cpp | 2 +- .../labeled-psi/core/LabeledPSIReceiver.cpp | 6 +- .../src/labeled-psi/core/LabeledPSISender.cpp | 6 +- .../ppc-psi/src/psi-framework/PSIFramework.h | 2 +- .../ppc-psi/src/psi-framework/TaskGuarder.h | 4 +- .../ppc-psi/src/ra2018-psi/RA2018PSIConfig.h | 2 +- .../tests/cm2020-psi/TestCM2020Impl.cpp | 4 +- .../tests/labeled-psi/TestLabeledPSIImpl.cpp | 10 ++-- .../tests/ra2018-psi/TestEcdhPSIImpl.cpp | 4 +- .../ppc-homo/paillier/OpenSSLPaillier.cpp | 1 - .../hive/udf/config/model/KeyConfig.java | 1 - .../ppc-tools/src/config/PPCConfig.cpp | 8 +++ .../ppc-tools/src/config/PPCConfig.h | 4 ++ cpp/wedpr-initializer/Initializer.cpp | 30 +++++----- .../grpc/client/FrontClient.cpp | 4 +- .../grpc/server/GatewayServer.cpp | 3 +- cpp/wedpr-protocol/grpc/server/GrpcServer.cpp | 2 +- .../protobuf/src/RequestConverter.h | 5 +- .../protobuf/tests/NodeInfoImplTest.cpp | 36 +++++++++++- .../protocol/tests/PPCMessageTest.cpp | 2 +- .../test/unittests/PPCChannelTest.cpp | 4 +- .../ppc-gateway/GatewayFactory.cpp | 7 ++- .../ppc-gateway/gateway/GatewayImpl.cpp | 5 +- .../ppc-gateway/gateway/GatewayImpl.h | 3 +- .../gateway/router/GatewayRouterManager.cpp | 7 ++- .../gateway/router/GatewayRouterManager.h | 6 +- .../ppc-gateway/p2p/router/RouterManager.cpp | 27 +++++++-- .../ppc-gateway/p2p/router/RouterManager.h | 4 +- .../ppc-gateway/test/demo/gateway_demo.cpp | 4 +- cpp/wedpr-transport/ppc-rpc/src/Rpc.cpp | 4 +- .../sdk/jni/transport/impl/TransportImpl.java | 2 - 69 files changed, 297 insertions(+), 261 deletions(-) diff --git a/.github/workflows/cpp_full_node_workflow.yml b/.github/workflows/cpp_full_node_workflow.yml index 59912a68..fcea6730 100644 --- a/.github/workflows/cpp_full_node_workflow.yml +++ b/.github/workflows/cpp_full_node_workflow.yml @@ -53,9 +53,9 @@ jobs: !c:/vcpkg/buildtrees !c:/vcpkg/packages !c:/vcpkg/downloads - key: build-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + key: build-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/cpp_full_node_workflow.yml') }} restore-keys: | - build-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + build-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/cpp_full_node_workflow.yml') }} build-all-${{ matrix.os }}-${{ github.base_ref }}- build-all-${{ matrix.os }}- - name: Build for linux @@ -105,17 +105,6 @@ jobs: volumes: - /usr/local/share/vcpkg:/usr/local/share/vcpkg steps: - - name: Check disk space - run: df . -h - - name: Free disk space - run: | - sudo docker rmi $(docker image ls -aq) >/dev/null 2>&1 || true - sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc \ - /usr/local/share/powershell /usr/share/swift /usr/local/.ghcup || true - - name: Check disk space - run: | - df . -h - sudo du /usr/ -hx -d 4 --threshold=1G | sort -hr | head - uses: actions/checkout@v3 with: fetch-depth: 5 @@ -128,9 +117,9 @@ jobs: /usr/local/share/vcpkg/packages /home/runner/.ccache /Users/runner/.ccache/ - key: centos-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + key: centos-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/cpp_full_node_workflow.yml') }} restore-keys: | - centos-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + centos-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/cpp_full_node_workflow.yml') }} centos-notest-all-${{ matrix.os }}-${{ github.base_ref }}- centos-notest-all-${{ matrix.os }}- - name: Prepare centos tools @@ -146,22 +135,35 @@ jobs: yum update -y yum install -y epel-release centos-release-scl centos-release-scl-rh yum install -y https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm - yum install -y wget java-11-openjdk-devel git make gcc gcc-c++ glibc-static glibc-devel openssl cmake3 ccache devtoolset-11 llvm-toolset-7.0 rh-perl530-perl libzstd-devel zlib-devel flex bison python-devel python3-devel - yum install -y rh-perl530-perl cmake3 zlib-devel ccache lcov python-devel python3-devel + yum install -y wget lcov java-11-openjdk-devel git make gcc gcc-c++ glibc-static glibc-devel cmake3 ccache devtoolset-11 libzstd-devel zlib-devel flex bison python-devel python3-devel yum install -y git - uses: actions-rs/toolchain@v1 with: toolchain: nightly-2022-07-28 override: true + - name: Check disk space + run: df . -h + - name: Free disk space + run: | + du -sch /usr/share/* + du -sch /opt/* + - name: Check disk space + run: | + df . -h + du /usr/ -hx -d 4 --threshold=1G | sort -hr | head + df /tmp + du /tmp | sort -n + ls -lh /tmp - name: Build run: | bash -x cpp/tools/install_depends.sh -o centos alias cmake='cmake3' - . /opt/rh/devtoolset-11/enable + . /opt/rh/devtoolset-11/enable + rm -rf python mkdir -p cpp/build cd cpp/build cmake3 -DCMAKE_BUILD_TYPE=Release -DTESTS=ON -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake ../ - cmake3 --build . --parallel 3 + #cmake3 --build . --parallel 3 #- name: Test # run: | # export OMP_NUM_THREADS=1 diff --git a/.github/workflows/cpp_sdk_workflow.yml b/.github/workflows/cpp_sdk_workflow.yml index bc4252d1..f4540e7e 100644 --- a/.github/workflows/cpp_sdk_workflow.yml +++ b/.github/workflows/cpp_sdk_workflow.yml @@ -53,9 +53,9 @@ jobs: ${{ env.VCPKG_ROOT }}/buildtrees ${{ env.VCPKG_ROOT }}/packages ${{ env.VCPKG_ROOT }}/downloads - key: build-sdk-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + key: build-sdk-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/cpp_sdk_workflow.yml') }} restore-keys: | - build-sdk-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + build-sdk-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/cpp_sdk_workflow.yml') }} build-sdk-${{ matrix.os }}-${{ github.base_ref }}- build-sdk-${{ matrix.os }}- - name: Add MSbuild to PATH @@ -127,9 +127,9 @@ jobs: /usr/local/share/vcpkg/packages /home/runner/.ccache /Users/runner/.ccache/ - key: centos-sdk-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + key: centos-sdk-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/cpp_sdk_workflow.yml') }} restore-keys: | - centos-sdk-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + centos-sdk-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/cpp_sdk_workflow.yml') }} centos-sdk-notest-all-${{ matrix.os }}-${{ github.base_ref }}- centos-sdk-notest-all-${{ matrix.os }}- - name: Prepare centos tools diff --git a/.github/workflows/cpp_toolkit_workflow.yml b/.github/workflows/cpp_toolkit_workflow.yml index fa1dc2e8..a1922156 100644 --- a/.github/workflows/cpp_toolkit_workflow.yml +++ b/.github/workflows/cpp_toolkit_workflow.yml @@ -53,9 +53,9 @@ jobs: ${{ env.VCPKG_ROOT }}/buildtrees ${{ env.VCPKG_ROOT }}/packages ${{ env.VCPKG_ROOT }}/downloads - key: build-toolkit-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + key: build-toolkit-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/cpp_toolkit_workflow.yml') }} restore-keys: | - build-toolkit-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + build-toolkit-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/cpp_toolkit_workflow.yml') }} build-toolkit-${{ matrix.os }}-${{ github.base_ref }}- build-toolkit-${{ matrix.os }}- - name: Add MSbuild to PATH @@ -118,9 +118,9 @@ jobs: /usr/local/share/vcpkg/packages /home/runner/.ccache /Users/runner/.ccache/ - key: centos-toolkit-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + key: centos-toolkit-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/cpp_toolkit_workflow.yml') }} restore-keys: | - centos-toolkit-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + centos-toolkit-notest-all-${{ matrix.os }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/cpp_toolkit_workflow.yml') }} centos-toolkit-notest-all-${{ matrix.os }}-${{ github.base_ref }}- centos-toolkit-notest-all-${{ matrix.os }}- - name: Prepare centos tools diff --git a/cpp/cmake/CompilerSettings.cmake b/cpp/cmake/CompilerSettings.cmake index 61396933..59c96030 100644 --- a/cpp/cmake/CompilerSettings.cmake +++ b/cpp/cmake/CompilerSettings.cmake @@ -1,12 +1,6 @@ set(CMAKE_CXX_STANDARD 20) set(Boost_NO_WARN_NEW_VERSIONS ON) message(STATUS "COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}") - -# export windows dll symbol -if(WIN32) - message(STATUS "Compile on Windows") - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS "ON") -endif() if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")) find_program(CCACHE_PROGRAM ccache) if(CCACHE_PROGRAM) @@ -132,38 +126,28 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA endif() endif () elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC") - add_compile_definitions(NOMINMAX) - - # Only support visual studio 2017 and visual studio 2019 - set(MSVC_MIN_VERSION "1914") # VS2017 15.7, for full-ish C++17 support + # Only support visual studio 2017 and visual studio 2019 + set(MSVC_MIN_VERSION "1914") # VS2017 15.7, for full-ish C++17 support - message(STATUS "Compile On Windows, MSVC_TOOLSET_VERSION: ${MSVC_TOOLSET_VERSION}") - - if (MSVC_TOOLSET_VERSION EQUAL 141) - message(STATUS "Compile On Visual Studio 2017") - elseif(MSVC_TOOLSET_VERSION EQUAL 142) - message(STATUS "Compile On Visual Studio 2019") - else() - message(FATAL_ERROR "Unsupported Visual Studio, supported list: [2017, 2019]. Current MSVC_TOOLSET_VERSION: ${MSVC_TOOLSET_VERSION}") - endif() - - add_compile_options(/std:c++latest) - add_compile_options(-bigobj) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") - if(BUILD_SHARED_LIBS) - if(CMAKE_BUILD_TYPE MATCHES "Debug") - add_compile_options(/MDd) - else() - add_compile_options(/MD) - endif() - else () - if(CMAKE_BUILD_TYPE MATCHES "Debug") - add_compile_options(/MTd) - else() - add_compile_options(/MT) - endif () - endif () - link_libraries(ws2_32 Crypt32 userenv) + message(STATUS "Compile On Windows, MSVC_TOOLSET_VERSION: ${MSVC_TOOLSET_VERSION}") + + if (MSVC_TOOLSET_VERSION EQUAL 141) + message(STATUS "Compile On Visual Studio 2017") + elseif(MSVC_TOOLSET_VERSION EQUAL 142) + message(STATUS "Compile On Visual Studio 2019") + else() + message(FATAL_ERROR "Unsupported Visual Studio, supported list: [2017, 2019]. Current MSVC_TOOLSET_VERSION: ${MSVC_TOOLSET_VERSION}") + endif() + + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17") + add_compile_definitions(NOMINMAX) + add_compile_options(-bigobj) + # MSVC only support static build + set(CMAKE_CXX_FLAGS_DEBUG "/MTd /DEBUG") + set(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /Os") + set(CMAKE_CXX_FLAGS_RELEASE "/MT") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MT /DEBUG") + link_libraries(ws2_32 Crypt32 userenv) else () message(WARNING "Your compiler is not tested, if you run into any issues, we'd welcome any patches.") endif () diff --git a/cpp/cmake/Options.cmake b/cpp/cmake/Options.cmake index 212ce9ca..9af80391 100644 --- a/cpp/cmake/Options.cmake +++ b/cpp/cmake/Options.cmake @@ -169,7 +169,7 @@ macro(print_config NAME) message("------------------------------------------------------------------------") message("-- Configuring ${NAME} ${PROJECT_VERSION}${VERSION_SUFFIX}") message("------------------------------------------------------------------------") - message("-- CMake Cmake version and location ${CMAKE_VERSION} (${CMAKE_COMMAND})") + message("-- CMake CMake version and location ${CMAKE_VERSION} (${CMAKE_COMMAND})") message("-- Compiler C++ compiler version ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}") message("-- CMAKE_BUILD_TYPE Build type ${CMAKE_BUILD_TYPE}") message("-- VCPKG_MANIFEST_FEATURES VCPKG manifest features ${VCPKG_MANIFEST_FEATURES}") diff --git a/cpp/cmake/grpc.cmake b/cpp/cmake/grpc.cmake index b88d316f..f95bbe1d 100644 --- a/cpp/cmake/grpc.cmake +++ b/cpp/cmake/grpc.cmake @@ -41,7 +41,10 @@ if(NOT GRPC_CPP_REFLECTION AND TARGET gRPC::grpc++_reflection) endif() endif() +get_target_property(GRPC_CPP_REFLECTION_INCLUDE gRPC::grpc++_reflection INTERFACE_INCLUDE_DIRECTORIES) +include_directories(${GRPC_CPP_REFLECTION_INCLUDE}) + set(PROTOC_BINARY ${Protobuf_PROTOC_EXECUTABLE}) message("# PROTOC_BINARY: ${Protobuf_PROTOC_EXECUTABLE}") message("# GRPC_CPP_PLUGIN: ${GRPC_CPP_PLUGIN}") -message("# GRPC_CPP_REFLECTION: ${GRPC_CPP_REFLECTION}") \ No newline at end of file +message("# GRPC_CPP_REFLECTION_INCLUDE: ${GRPC_CPP_REFLECTION_INCLUDE}") \ No newline at end of file diff --git a/cpp/ppc-framework/protocol/GlobalConfig.h b/cpp/ppc-framework/protocol/GlobalConfig.h index ab02443e..e223a746 100644 --- a/cpp/ppc-framework/protocol/GlobalConfig.h +++ b/cpp/ppc-framework/protocol/GlobalConfig.h @@ -33,7 +33,7 @@ class GlobalConfig GlobalConfig() { // set the supported-curves for ecdh-psi - auto key = calculateKey((uint8_t)TaskType::PSI, (uint8_t)PSIAlgorithmType::ECDH_PSI_2PC); + auto key = calculateKey((uint8_t)TaskType::PSI, (uint8_t)TaskAlgorithmType::ECDH_PSI_2PC); #ifdef ENABLE_CRYPTO_MB #ifdef ENABLE_CPU_FEATURES if (ppc::CPU_FEATURES.avx512ifma) diff --git a/cpp/ppc-framework/protocol/Protocol.h b/cpp/ppc-framework/protocol/Protocol.h index c9c6c850..ac86293b 100644 --- a/cpp/ppc-framework/protocol/Protocol.h +++ b/cpp/ppc-framework/protocol/Protocol.h @@ -57,8 +57,7 @@ inline std::ostream& operator<<(std::ostream& _out, TaskType const& _type) } // the PSIAlgorithm type -// TODO: rename PSIAlgorithmType to TaskAlgorithmType -enum class PSIAlgorithmType : uint8_t +enum class TaskAlgorithmType : uint8_t { // PSI implementation for https://eprint.iacr.org/2020/729.pdf(Private Set Intersection in the // Internet Setting from Lightweight Oblivious PRF) @@ -76,34 +75,29 @@ enum class PSIAlgorithmType : uint8_t BS_ECDH_PSI = 0x06, }; -// enum class PSIAlgorithmType : uint8_t -// { -// OT_PIR_2PC = 0x10, -// }; - -inline std::ostream& operator<<(std::ostream& _out, PSIAlgorithmType const& _type) +inline std::ostream& operator<<(std::ostream& _out, TaskAlgorithmType const& _type) { switch (_type) { - case PSIAlgorithmType::CM_PSI_2PC: + case TaskAlgorithmType::CM_PSI_2PC: _out << "CM_PSI_2PC"; break; - case PSIAlgorithmType::RA_PSI_2PC: + case TaskAlgorithmType::RA_PSI_2PC: _out << "RA_PSI_2PC"; break; - case PSIAlgorithmType::LABELED_PSI_2PC: + case TaskAlgorithmType::LABELED_PSI_2PC: _out << "LABELED_PSI_2PC"; break; - case PSIAlgorithmType::ECDH_PSI_2PC: + case TaskAlgorithmType::ECDH_PSI_2PC: _out << "ECDH_PSI_2PC"; break; - case PSIAlgorithmType::OT_PIR_2PC: + case TaskAlgorithmType::OT_PIR_2PC: _out << "OT_PIR_2PC"; break; - case PSIAlgorithmType::ECDH_PSI_MULTI: + case TaskAlgorithmType::ECDH_PSI_MULTI: _out << "ECDH_PSI_MULTI"; break; - case PSIAlgorithmType::ECDH_PSI_CONN: + case TaskAlgorithmType::ECDH_PSI_CONN: _out << "ECDH_PSI_CONN"; break; default: diff --git a/cpp/ppc-framework/protocol/Task.h b/cpp/ppc-framework/protocol/Task.h index 727205db..a43dd4fb 100644 --- a/cpp/ppc-framework/protocol/Task.h +++ b/cpp/ppc-framework/protocol/Task.h @@ -162,7 +162,7 @@ inline std::string printTaskInfo(Task::ConstPtr _task) std::ostringstream stringstream; stringstream << LOG_KV("id", _task->id()) << LOG_KV("type", (ppc::protocol::TaskType)_task->type()) - << LOG_KV("algorithm", (ppc::protocol::PSIAlgorithmType)_task->algorithm()) + << LOG_KV("algorithm", (ppc::protocol::TaskAlgorithmType)_task->algorithm()) << LOG_KV("taskPtr", _task); if (_task->selfParty()) { diff --git a/cpp/test-utils/FakeFront.h b/cpp/test-utils/FakeFront.h index ab1c9709..539c1238 100644 --- a/cpp/test-utils/FakeFront.h +++ b/cpp/test-utils/FakeFront.h @@ -89,7 +89,7 @@ class FakeFront : public FrontInterface uint8_t type = _message->algorithmType(); switch (type) { - case uint8_t(PSIAlgorithmType::RA_PSI_2PC): + case uint8_t(TaskAlgorithmType::RA_PSI_2PC): { if (!m_agencyToRA2018.count(_agencyID)) { @@ -103,7 +103,7 @@ class FakeFront : public FrontInterface _callback(nullptr); break; } - case uint8_t(PSIAlgorithmType::LABELED_PSI_2PC): + case uint8_t(TaskAlgorithmType::LABELED_PSI_2PC): { if (!m_agencyToLabeledPSI.count(_agencyID)) { @@ -117,7 +117,7 @@ class FakeFront : public FrontInterface _callback(nullptr); break; } - case uint8_t(PSIAlgorithmType::CM_PSI_2PC): + case uint8_t(TaskAlgorithmType::CM_PSI_2PC): { if (!m_agencyToCM2020.count(_agencyID)) { @@ -131,7 +131,7 @@ class FakeFront : public FrontInterface _callback(nullptr); break; } - case uint8_t(PSIAlgorithmType::ECDH_PSI_2PC): + case uint8_t(TaskAlgorithmType::ECDH_PSI_2PC): { if (!m_agencyToEcdhPSI.count(_agencyID)) { @@ -145,7 +145,7 @@ class FakeFront : public FrontInterface _callback(nullptr); break; } - case uint8_t(PSIAlgorithmType::ECDH_PSI_MULTI): + case uint8_t(TaskAlgorithmType::ECDH_PSI_MULTI): { if (!m_agencyToEcdhMutliPSI.count(_agencyID)) { @@ -159,7 +159,7 @@ class FakeFront : public FrontInterface _callback(nullptr); break; } - case uint8_t(PSIAlgorithmType::OT_PIR_2PC): + case uint8_t(TaskAlgorithmType::OT_PIR_2PC): { if (!m_agencyToOTPIR.count(_agencyID)) { diff --git a/cpp/tools/install_depends.sh b/cpp/tools/install_depends.sh index a4c467aa..d7a83ca2 100644 --- a/cpp/tools/install_depends.sh +++ b/cpp/tools/install_depends.sh @@ -25,22 +25,6 @@ install_gsasl_depend() LOG_INFO "the libgasal.a has already exists!" return fi - LOG_INFO "download and install gsasl..." - wget --no-check-certificate https://ftp.gnu.org/gnu/gsasl/gsasl-1.8.0.tar.gz && tar -xvf gsasl-1.8.0.tar.gz - - # centos - if [[ "${os_type}" == "centos" ]];then - cd gsasl-1.8.0 && ./configure --with-pic && make -j4 && make install - fi - # macos - if [[ "${os_type}" == "macos" ]];then - cd gsasl-1.8.0 && ./configure --with-pic && make -j4 && make install - fi - # ubuntu - if [[ "${os_type}" == "ubuntu" ]];then - cd gsasl-1.8.0 && ./configure --with-pic && make -j4 && make install - fi - LOG_INFO "download and install gsasl success..." LOG_INFO "download and install libgsasl..." wget --no-check-certificate https://ftp.gnu.org/gnu/gsasl/libgsasl-1.8.0.tar.gz && tar -xvf libgsasl-1.8.0.tar.gz @@ -57,6 +41,8 @@ install_gsasl_depend() if [[ "${os_type}" == "ubuntu" ]];then cd libgsasl-1.8.0 && ./configure --with-pic && make -j4 && make install fi + cd .. && rm -rf libgsasl-1.8.0 && rm -rf libgsasl-1.8.0.tar.gz + df -lh LOG_INFO "download and install libgsasl success..." } @@ -74,6 +60,7 @@ install_nasm_depend() LOG_INFO "download and install nasm 2.15..." wget --no-check-certificate https://www.nasm.us/pub/nasm/releasebuilds/2.15/nasm-2.15.tar.gz && tar -xvf nasm-2.15.tar.gz cd nasm-2.15 && ./configure && make -j4 && make install + cd .. && rm -rf nasm-2.15.tar.gz && rm -rf nasm-2.15 LOG_INFO "download and install nasm success..." } diff --git a/cpp/tools/ppc-builder/src/controller/commandline_helper.py b/cpp/tools/ppc-builder/src/controller/commandline_helper.py index 7873925c..bc995877 100644 --- a/cpp/tools/ppc-builder/src/controller/commandline_helper.py +++ b/cpp/tools/ppc-builder/src/controller/commandline_helper.py @@ -83,6 +83,6 @@ def execute_command(args): if command == utilities.CommandInfo.generate_config: generate_node_config(args, toml_config) return - # TODO: implement extend + # TODO: implement expand if command == utilities.CommandInfo.extend: utilities.log_error("unimplemented command %s" % command) diff --git a/cpp/wedpr-computing/ppc-pir/src/OtPIRConfig.h b/cpp/wedpr-computing/ppc-pir/src/OtPIRConfig.h index 3ecd2033..e51b1ade 100644 --- a/cpp/wedpr-computing/ppc-pir/src/OtPIRConfig.h +++ b/cpp/wedpr-computing/ppc-pir/src/OtPIRConfig.h @@ -44,7 +44,7 @@ class OtPIRConfig : public ppc::psi::PSIConfig uint16_t _parallelism = 3, const front::PPCMessageFactory::Ptr& _msgFactory = std::make_shared()) - : PSIConfig(ppc::protocol::PSIAlgorithmType::OT_PIR_2PC, _selfPartyID, std::move(_front), + : PSIConfig(ppc::protocol::TaskAlgorithmType::OT_PIR_2PC, _selfPartyID, std::move(_front), _msgFactory, std::move(_dataResourceLoader), _holdingMessageMinutes), m_cryptoBox(std::move(_cryptoBox)), m_threadPool(std::move(_threadPool)), diff --git a/cpp/wedpr-computing/ppc-pir/src/OtPIRImpl.cpp b/cpp/wedpr-computing/ppc-pir/src/OtPIRImpl.cpp index d0d2d383..6c390af9 100644 --- a/cpp/wedpr-computing/ppc-pir/src/OtPIRImpl.cpp +++ b/cpp/wedpr-computing/ppc-pir/src/OtPIRImpl.cpp @@ -39,7 +39,7 @@ using namespace ppc::psi; OtPIRImpl::OtPIRImpl(const OtPIRConfig::Ptr& _config, unsigned _idleTimeMs) : Worker("OT-PIR", _idleTimeMs), - TaskGuarder(_config, PSIAlgorithmType::OT_PIR_2PC, "OT-PIR-Timer"), + TaskGuarder(_config, TaskAlgorithmType::OT_PIR_2PC, "OT-PIR-Timer"), m_config(_config), m_msgQueue(std::make_shared()), m_ioService(std::make_shared()), @@ -221,7 +221,6 @@ void OtPIRImpl::checkFinishedTask() removeReceiver(taskID); removeSender(taskID); removePendingTask(taskID); - // TODO: 为什么这里要再调用一下执行任务 // asyncRunTask(); } } @@ -314,7 +313,7 @@ void OtPIRImpl::onHelloReceiver(const ppc::front::PPCMessageFace::Ptr& _message) // PIR_LOG(INFO) << LOG_BADGE("buildPPCMessage"); auto message = m_config->ppcMsgFactory()->buildPPCMessage(uint8_t(protocol::TaskType::PIR), - uint8_t(protocol::PSIAlgorithmType::OT_PIR_2PC), m_taskID, + uint8_t(protocol::TaskAlgorithmType::OT_PIR_2PC), m_taskID, std::make_shared()); message->setMessageType(uint8_t(OTPIRMessageType::RESULTS)); ppctars::serialize::encode(receiverMessageParams, *message->data()); @@ -510,7 +509,8 @@ void OtPIRImpl::runSenderGenerateCipher(PirTaskMessage taskMessage) // senderMessageParams.requestAgencyDataset = taskMessage.requestAgencyDataset; senderMessageParams.sendObfuscatedHash = senderMessage.sendObfuscatedHash; auto message = m_config->ppcMsgFactory()->buildPPCMessage(uint8_t(protocol::TaskType::PIR), - uint8_t(protocol::PSIAlgorithmType::OT_PIR_2PC), m_taskID, std::make_shared()); + uint8_t(protocol::TaskAlgorithmType::OT_PIR_2PC), m_taskID, + std::make_shared()); message->setMessageType(uint8_t(OTPIRMessageType::HELLO_RECEIVER)); ppctars::serialize::encode(senderMessageParams, *message->data()); addSender(senderMessage); diff --git a/cpp/wedpr-computing/ppc-pir/src/OtPIRImpl.h b/cpp/wedpr-computing/ppc-pir/src/OtPIRImpl.h index 971714f7..56aeac7d 100644 --- a/cpp/wedpr-computing/ppc-pir/src/OtPIRImpl.h +++ b/cpp/wedpr-computing/ppc-pir/src/OtPIRImpl.h @@ -184,8 +184,6 @@ class OtPIRImpl : public std::enable_shared_from_this, std::unordered_map m_receivers; mutable bcos::SharedMutex x_receivers; - - // TODO: 改为prefix-message的map 预处理的数据集 std::vector> messageKeypair; std::queue> m_taskQueue; diff --git a/cpp/wedpr-computing/ppc-pir/tests/TestBaseOT.cpp b/cpp/wedpr-computing/ppc-pir/tests/TestBaseOT.cpp index b76d867b..621a4255 100644 --- a/cpp/wedpr-computing/ppc-pir/tests/TestBaseOT.cpp +++ b/cpp/wedpr-computing/ppc-pir/tests/TestBaseOT.cpp @@ -197,7 +197,7 @@ void testOTPIRImplFunc(const std::string& _taskID, const std::string& _params, b senderPIRTask->setSelf(_senderParty); senderPIRTask->addParty(_receiverParty); senderPIRTask->setSyncResultToPeer(_syncResults); - senderPIRTask->setAlgorithm((uint8_t)PSIAlgorithmType::OT_PIR_2PC); + senderPIRTask->setAlgorithm((uint8_t)TaskAlgorithmType::OT_PIR_2PC); senderPIRTask->setType((uint8_t)ppc::protocol::TaskType::PIR); auto receiverPIRTask = std::make_shared(receiverAgencyName); @@ -206,7 +206,7 @@ void testOTPIRImplFunc(const std::string& _taskID, const std::string& _params, b receiverPIRTask->setSelf(_receiverParty); receiverPIRTask->addParty(_senderParty); receiverPIRTask->setSyncResultToPeer(_syncResults); - receiverPIRTask->setAlgorithm((uint8_t)PSIAlgorithmType::OT_PIR_2PC); + receiverPIRTask->setAlgorithm((uint8_t)TaskAlgorithmType::OT_PIR_2PC); receiverPIRTask->setType((uint8_t)ppc::protocol::TaskType::PIR); testOTPIR(factory, senderPIR, receiverPIR, senderPIRTask, receiverPIRTask, _expectedPIRResult, diff --git a/cpp/wedpr-computing/ppc-psi/src/Common.h b/cpp/wedpr-computing/ppc-psi/src/Common.h index b2673d28..392e63d2 100644 --- a/cpp/wedpr-computing/ppc-psi/src/Common.h +++ b/cpp/wedpr-computing/ppc-psi/src/Common.h @@ -94,7 +94,7 @@ enum PSIRetCode : int TaskIsNotRunning = -1025, OnException = -1026, TaskExists = -1027, - TaskKilled= -1028, + TaskKilled = -1028, TaskCountReachMax = -1029, TaskTimeout = -1030 }; diff --git a/cpp/wedpr-computing/ppc-psi/src/PSIConfig.h b/cpp/wedpr-computing/ppc-psi/src/PSIConfig.h index 4b67e599..1b81b545 100644 --- a/cpp/wedpr-computing/ppc-psi/src/PSIConfig.h +++ b/cpp/wedpr-computing/ppc-psi/src/PSIConfig.h @@ -34,12 +34,12 @@ class PSIConfig { public: using Ptr = std::shared_ptr; - PSIConfig(ppc::protocol::PSIAlgorithmType _algorithmType, + PSIConfig(ppc::protocol::TaskAlgorithmType _algorithmType, ppc::io::DataResourceLoader::Ptr _dataResourceLoader) : m_algorithmType(_algorithmType), m_dataResourceLoader(std::move(_dataResourceLoader)) {} - PSIConfig(ppc::protocol::PSIAlgorithmType _algorithmType, const std::string& _selfParty, + PSIConfig(ppc::protocol::TaskAlgorithmType _algorithmType, const std::string& _selfParty, ppc::front::FrontInterface::Ptr _front, ppc::front::PPCMessageFaceFactory::Ptr _ppcMsgFactory, ppc::io::DataResourceLoader::Ptr _dataResourceLoader, int _holdingMessageMinutes) @@ -62,7 +62,7 @@ class PSIConfig ppc::front::FrontInterface::Ptr const& front() const { return m_front; } std::string selfParty() const { return m_selfParty; } - ppc::protocol::PSIAlgorithmType algorithmType() const { return m_algorithmType; } + ppc::protocol::TaskAlgorithmType algorithmType() const { return m_algorithmType; } ppc::front::PPCMessageFaceFactory::Ptr const& ppcMsgFactory() const { return m_ppcMsgFactory; } int networkTimeout() const { return m_networkTimeout; } @@ -139,7 +139,7 @@ class PSIConfig protected: // the psi-alogrithm-type - ppc::protocol::PSIAlgorithmType m_algorithmType; + ppc::protocol::TaskAlgorithmType m_algorithmType; std::string m_selfParty; ppc::front::FrontInterface::Ptr m_front; // the front message factory diff --git a/cpp/wedpr-computing/ppc-psi/src/bs-ecdh-psi/BsEcdhPSIFactory.h b/cpp/wedpr-computing/ppc-psi/src/bs-ecdh-psi/BsEcdhPSIFactory.h index 08c3bb30..272fbd1d 100644 --- a/cpp/wedpr-computing/ppc-psi/src/bs-ecdh-psi/BsEcdhPSIFactory.h +++ b/cpp/wedpr-computing/ppc-psi/src/bs-ecdh-psi/BsEcdhPSIFactory.h @@ -37,7 +37,7 @@ class BsEcdhPSIFactory ppc::io::DataResourceLoader::Ptr _dataResourceLoader, uint32_t _timeoutMinutes) { auto config = std::make_shared( - ppc::protocol::PSIAlgorithmType::BS_ECDH_PSI, std::move(_dataResourceLoader)); + ppc::protocol::TaskAlgorithmType::BS_ECDH_PSI, std::move(_dataResourceLoader)); return std::make_shared( std::move(config), std::move(_threadPool), _timeoutMinutes); } diff --git a/cpp/wedpr-computing/ppc-psi/src/bs-ecdh-psi/core/BsEcdhCache.h b/cpp/wedpr-computing/ppc-psi/src/bs-ecdh-psi/core/BsEcdhCache.h index a939f8f2..035d3ba8 100644 --- a/cpp/wedpr-computing/ppc-psi/src/bs-ecdh-psi/core/BsEcdhCache.h +++ b/cpp/wedpr-computing/ppc-psi/src/bs-ecdh-psi/core/BsEcdhCache.h @@ -34,7 +34,6 @@ namespace ppc::psi { - enum TaskStep : int { Initializing = 1, diff --git a/cpp/wedpr-computing/ppc-psi/src/bs-ecdh-psi/core/BsEcdhTaskState.h b/cpp/wedpr-computing/ppc-psi/src/bs-ecdh-psi/core/BsEcdhTaskState.h index 9ae29a01..b69f235a 100644 --- a/cpp/wedpr-computing/ppc-psi/src/bs-ecdh-psi/core/BsEcdhTaskState.h +++ b/cpp/wedpr-computing/ppc-psi/src/bs-ecdh-psi/core/BsEcdhTaskState.h @@ -162,7 +162,7 @@ class BsEcdhTaskState { m_status = protocol::TaskStatus::RUNNING; m_autoPauseThreshold = PAUSE_THRESHOLD; - m_latestActiveTime = bcos::utcSteadyTime(); + m_latestActiveTime = bcos::utcSteadyTime(); } void turnToPausing() diff --git a/cpp/wedpr-computing/ppc-psi/src/bs-ecdh-psi/ffi/wedpr_ffi_edwards25519.h b/cpp/wedpr-computing/ppc-psi/src/bs-ecdh-psi/ffi/wedpr_ffi_edwards25519.h index 8427bebe..5c689c40 100644 --- a/cpp/wedpr-computing/ppc-psi/src/bs-ecdh-psi/ffi/wedpr_ffi_edwards25519.h +++ b/cpp/wedpr-computing/ppc-psi/src/bs-ecdh-psi/ffi/wedpr_ffi_edwards25519.h @@ -1,21 +1,21 @@ /** -* Copyright (C) 2023 WeDPR. -* SPDX-License-Identifier: Apache-2.0 -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -* @file wedpr_ffi_edwards25519.h -* @author: shawnhe -* @date 2023-10-10 + * Copyright (C) 2023 WeDPR. + * SPDX-License-Identifier: Apache-2.0 + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @file wedpr_ffi_edwards25519.h + * @author: shawnhe + * @date 2023-10-10 */ diff --git a/cpp/wedpr-computing/ppc-psi/src/bs-ecdh-psi/ffi/wedpr_utilities.h b/cpp/wedpr-computing/ppc-psi/src/bs-ecdh-psi/ffi/wedpr_utilities.h index c477d117..9fcf5da2 100644 --- a/cpp/wedpr-computing/ppc-psi/src/bs-ecdh-psi/ffi/wedpr_utilities.h +++ b/cpp/wedpr-computing/ppc-psi/src/bs-ecdh-psi/ffi/wedpr_utilities.h @@ -1,22 +1,22 @@ /** -* Copyright (C) 2023 WeDPR. -* SPDX-License-Identifier: Apache-2.0 -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -* @file wedpr_utilities.h -* @author: shawnhe -* @date 2023-10-10 -*/ + * Copyright (C) 2023 WeDPR. + * SPDX-License-Identifier: Apache-2.0 + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @file wedpr_utilities.h + * @author: shawnhe + * @date 2023-10-10 + */ #ifndef _WEDPR_UTILITIES_H_ #define _WEDPR_UTILITIES_H_ diff --git a/cpp/wedpr-computing/ppc-psi/src/cm2020-psi/CM2020PSIConfig.h b/cpp/wedpr-computing/ppc-psi/src/cm2020-psi/CM2020PSIConfig.h index 2f07e2cc..bd89fb11 100644 --- a/cpp/wedpr-computing/ppc-psi/src/cm2020-psi/CM2020PSIConfig.h +++ b/cpp/wedpr-computing/ppc-psi/src/cm2020-psi/CM2020PSIConfig.h @@ -44,7 +44,7 @@ class CM2020PSIConfig : public PSIConfig uint16_t _parallelism = 3, const front::PPCMessageFactory::Ptr& _msgFactory = std::make_shared()) - : PSIConfig(ppc::protocol::PSIAlgorithmType::CM_PSI_2PC, _selfPartyID, std::move(_front), + : PSIConfig(ppc::protocol::TaskAlgorithmType::CM_PSI_2PC, _selfPartyID, std::move(_front), _msgFactory, std::move(_dataResourceLoader), _holdingMessageMinutes), m_cryptoBox(std::move(_cryptoBox)), m_threadPool(std::move(_threadPool)), diff --git a/cpp/wedpr-computing/ppc-psi/src/cm2020-psi/CM2020PSIImpl.cpp b/cpp/wedpr-computing/ppc-psi/src/cm2020-psi/CM2020PSIImpl.cpp index d4534b5c..e0b62a7e 100644 --- a/cpp/wedpr-computing/ppc-psi/src/cm2020-psi/CM2020PSIImpl.cpp +++ b/cpp/wedpr-computing/ppc-psi/src/cm2020-psi/CM2020PSIImpl.cpp @@ -32,7 +32,7 @@ using namespace ppc::task; CM2020PSIImpl::CM2020PSIImpl(const CM2020PSIConfig::Ptr& _config, unsigned _idleTimeMs) : Worker("CM2020-PSI", _idleTimeMs), - TaskGuarder(_config, PSIAlgorithmType::CM_PSI_2PC, "CM2020-PSI-Timer"), + TaskGuarder(_config, TaskAlgorithmType::CM_PSI_2PC, "CM2020-PSI-Timer"), m_config(_config), m_msgQueue(std::make_shared()), m_ioService(std::make_shared()), diff --git a/cpp/wedpr-computing/ppc-psi/src/cm2020-psi/core/CM2020PSIReceiver.cpp b/cpp/wedpr-computing/ppc-psi/src/cm2020-psi/core/CM2020PSIReceiver.cpp index 0f4c92d1..dfe83d24 100644 --- a/cpp/wedpr-computing/ppc-psi/src/cm2020-psi/core/CM2020PSIReceiver.cpp +++ b/cpp/wedpr-computing/ppc-psi/src/cm2020-psi/core/CM2020PSIReceiver.cpp @@ -95,7 +95,7 @@ void CM2020PSIReceiver::runReceiver() } auto message = m_config->ppcMsgFactory()->buildPPCMessage(uint8_t(protocol::TaskType::PSI), - uint8_t(protocol::PSIAlgorithmType::CM_PSI_2PC), m_taskID, + uint8_t(protocol::TaskAlgorithmType::CM_PSI_2PC), m_taskID, std::make_shared()); message->setMessageType(uint8_t(CM2020PSIMessageType::HELLO_SENDER)); ppctars::serialize::encode(cm2020Params, *message->data()); @@ -189,7 +189,7 @@ void CM2020PSIReceiver::syncInputsSize() << LOG_KV("data", *bcos::toHexString(*data)) << LOG_KV("m_rInputSize", m_rInputSize); auto message = m_config->ppcMsgFactory()->buildPPCMessage( - uint8_t(TaskType::PSI), uint8_t(PSIAlgorithmType::CM_PSI_2PC), m_taskID, data); + uint8_t(TaskType::PSI), uint8_t(TaskAlgorithmType::CM_PSI_2PC), m_taskID, data); message->setMessageType(uint8_t(CM2020PSIMessageType::RECEIVER_SIZE)); m_config->front()->asyncSendMessage( @@ -216,7 +216,7 @@ void CM2020PSIReceiver::runRandomOT() m_otState = m_ot->senderGeneratePointA(); auto message = m_config->ppcMsgFactory()->buildPPCMessage(uint8_t(protocol::TaskType::PSI), - uint8_t(protocol::PSIAlgorithmType::CM_PSI_2PC), m_taskID, m_otState.second); + uint8_t(protocol::TaskAlgorithmType::CM_PSI_2PC), m_taskID, m_otState.second); message->setMessageType(uint8_t(CM2020PSIMessageType::POINT_A)); // send point A to ot receiver @@ -506,7 +506,7 @@ void CM2020PSIReceiver::negotiateMatrix(uint32_t _bucketIndex, uint32_t _matrixI auto sendBuffer = std::make_shared( buffer->begin() + rLen, buffer->begin() + rLen + currentLen); auto message = m_config->ppcMsgFactory()->buildPPCMessage(uint8_t(protocol::TaskType::PSI), - uint8_t(protocol::PSIAlgorithmType::CM_PSI_2PC), m_taskID, sendBuffer); + uint8_t(protocol::TaskAlgorithmType::CM_PSI_2PC), m_taskID, sendBuffer); message->setSeq(_bucketIndex * totalRound + round); message->setMessageType(uint8_t(CM2020PSIMessageType::MATRIX)); @@ -808,7 +808,7 @@ void CM2020PSIReceiver::syncResults(uint32_t _count) auto countData = std::make_shared(); encodeUnsignedNum(countData, uint32_t(_count)); auto message = m_config->ppcMsgFactory()->buildPPCMessage( - uint8_t(TaskType::PSI), uint8_t(PSIAlgorithmType::CM_PSI_2PC), m_taskID, countData); + uint8_t(TaskType::PSI), uint8_t(TaskAlgorithmType::CM_PSI_2PC), m_taskID, countData); message->setMessageType(uint8_t(CM2020PSIMessageType::RESULTS_SIZE)); auto error = m_config->sendMessage(m_taskState->peerID(), message); @@ -837,7 +837,7 @@ void CM2020PSIReceiver::syncResults(uint32_t _count) if (count == currentLen) { auto resMessage = m_config->ppcMsgFactory()->buildPPCMessage(uint8_t(TaskType::PSI), - uint8_t(PSIAlgorithmType::CM_PSI_2PC), m_taskID, buffer); + uint8_t(TaskAlgorithmType::CM_PSI_2PC), m_taskID, buffer); resMessage->setMessageType(uint8_t(CM2020PSIMessageType::RESULTS)); resMessage->setSeq(round); diff --git a/cpp/wedpr-computing/ppc-psi/src/cm2020-psi/core/CM2020PSISender.cpp b/cpp/wedpr-computing/ppc-psi/src/cm2020-psi/core/CM2020PSISender.cpp index d4018dc4..99a9105f 100644 --- a/cpp/wedpr-computing/ppc-psi/src/cm2020-psi/core/CM2020PSISender.cpp +++ b/cpp/wedpr-computing/ppc-psi/src/cm2020-psi/core/CM2020PSISender.cpp @@ -92,7 +92,7 @@ void CM2020PSISender::runSender() try { auto message = m_config->ppcMsgFactory()->buildPPCMessage(uint8_t(protocol::TaskType::PSI), - uint8_t(protocol::PSIAlgorithmType::CM_PSI_2PC), m_taskID, + uint8_t(protocol::TaskAlgorithmType::CM_PSI_2PC), m_taskID, std::make_shared()); message->setMessageType(uint8_t(CM2020PSIMessageType::HELLO_RECEIVER)); @@ -176,7 +176,7 @@ void CM2020PSISender::syncInputsSize() auto data = std::make_shared(); encodeUnsignedNum(data, m_sInputSize); auto message = m_config->ppcMsgFactory()->buildPPCMessage( - uint8_t(TaskType::PSI), uint8_t(PSIAlgorithmType::CM_PSI_2PC), m_taskID, data); + uint8_t(TaskType::PSI), uint8_t(TaskAlgorithmType::CM_PSI_2PC), m_taskID, data); message->setMessageType(uint8_t(CM2020PSIMessageType::SENDER_SIZE)); m_config->front()->asyncSendMessage( @@ -239,8 +239,8 @@ void CM2020PSISender::onPointAReceived(front::PPCMessageFace::Ptr _message) auto retPair = m_ot->receiverGeneratePointsB(m_otChoices, pointA); // send batch point B to ot sender - auto message = m_config->ppcMsgFactory()->buildPPCMessage( - uint8_t(TaskType::PSI), uint8_t(PSIAlgorithmType::CM_PSI_2PC), m_taskID, retPair.first); + auto message = m_config->ppcMsgFactory()->buildPPCMessage(uint8_t(TaskType::PSI), + uint8_t(TaskAlgorithmType::CM_PSI_2PC), m_taskID, retPair.first); message->setMessageType(uint8_t(CM2020PSIMessageType::POINT_B_ARRAY)); m_config->front()->asyncSendMessage( @@ -413,7 +413,8 @@ void CM2020PSISender::noticeReceiverDoNextRound() CM2020_PSI_LOG(INFO) << LOG_BADGE("noticeReceiverDoNextRound") << LOG_KV("taskID", m_taskID) << LOG_KV("round", m_oprfRound); auto message = m_config->ppcMsgFactory()->buildPPCMessage(uint8_t(protocol::TaskType::PSI), - uint8_t(protocol::PSIAlgorithmType::CM_PSI_2PC), m_taskID, std::make_shared()); + uint8_t(protocol::TaskAlgorithmType::CM_PSI_2PC), m_taskID, + std::make_shared()); message->setMessageType(uint8_t(CM2020PSIMessageType::DO_NEXT_ROUND)); m_config->front()->asyncSendMessage( m_taskState->peerID(), message, m_config->networkTimeout(), @@ -634,7 +635,7 @@ void CM2020PSISender::computeAndSendHash() } auto message = m_config->ppcMsgFactory()->buildPPCMessage( - uint8_t(TaskType::PSI), uint8_t(PSIAlgorithmType::CM_PSI_2PC), m_taskID, buffer); + uint8_t(TaskType::PSI), uint8_t(TaskAlgorithmType::CM_PSI_2PC), m_taskID, buffer); message->setMessageType(uint8_t(CM2020PSIMessageType::HASHES)); message->setSeq(round); diff --git a/cpp/wedpr-computing/ppc-psi/src/cm2020-psi/protocol/CM2020PSIResult.h b/cpp/wedpr-computing/ppc-psi/src/cm2020-psi/protocol/CM2020PSIResult.h index b690883e..4d461183 100644 --- a/cpp/wedpr-computing/ppc-psi/src/cm2020-psi/protocol/CM2020PSIResult.h +++ b/cpp/wedpr-computing/ppc-psi/src/cm2020-psi/protocol/CM2020PSIResult.h @@ -76,8 +76,8 @@ class CM2020PSIResult : public protocol::TaskResult jsonData["communication"] = m_communication; jsonData["syncResult"] = m_enableSyncResults; jsonData["intersections"] = m_intersections; -// jsonData["party0Size"] = m_party0Size; -// jsonData["party1Size"] = m_party1Size; + // jsonData["party0Size"] = m_party0Size; + // jsonData["party1Size"] = m_party1Size; if (!m_outputs.empty()) { diff --git a/cpp/wedpr-computing/ppc-psi/src/ecdh-conn-psi/EcdhConnPSIConfig.h b/cpp/wedpr-computing/ppc-psi/src/ecdh-conn-psi/EcdhConnPSIConfig.h index d42c8bf8..147dbab5 100644 --- a/cpp/wedpr-computing/ppc-psi/src/ecdh-conn-psi/EcdhConnPSIConfig.h +++ b/cpp/wedpr-computing/ppc-psi/src/ecdh-conn-psi/EcdhConnPSIConfig.h @@ -41,7 +41,7 @@ class EcdhConnPSIConfig : public PSIConfig EcdhConnPSIMessageFactory::Ptr _psiMsgFactory, ppc::io::DataResourceLoader::Ptr const& _dataResourceLoader, bcos::ThreadPool::Ptr _threadPool) - : PSIConfig(ppc::protocol::PSIAlgorithmType::ECDH_PSI_CONN, _ppcConfig->agencyID(), _front, + : PSIConfig(ppc::protocol::TaskAlgorithmType::ECDH_PSI_CONN, _ppcConfig->agencyID(), _front, _ppcMsgFactory, _dataResourceLoader, _ppcConfig->holdingMessageMinutes()), m_msgFactory(_psiMsgFactory), m_threadPool(_threadPool), diff --git a/cpp/wedpr-computing/ppc-psi/src/ecdh-conn-psi/EcdhConnPSIImpl.cpp b/cpp/wedpr-computing/ppc-psi/src/ecdh-conn-psi/EcdhConnPSIImpl.cpp index 81b5339f..6e989d85 100644 --- a/cpp/wedpr-computing/ppc-psi/src/ecdh-conn-psi/EcdhConnPSIImpl.cpp +++ b/cpp/wedpr-computing/ppc-psi/src/ecdh-conn-psi/EcdhConnPSIImpl.cpp @@ -33,7 +33,7 @@ using namespace ppc::task; EcdhConnPSIImpl::EcdhConnPSIImpl(const EcdhConnPSIConfig::Ptr& _config, unsigned _idleTimeMs) : m_config(std::move(_config)), m_msgPool(std::make_shared()), - TaskGuarder(_config, PSIAlgorithmType::ECDH_PSI_CONN, "ECDH-CONN-PSI-Timer"), + TaskGuarder(_config, TaskAlgorithmType::ECDH_PSI_CONN, "ECDH-CONN-PSI-Timer"), m_ecdhConnTaskStateFactory(std::make_shared()) {} diff --git a/cpp/wedpr-computing/ppc-psi/src/ecdh-conn-psi/core/EcdhConnPSIServer.cpp b/cpp/wedpr-computing/ppc-psi/src/ecdh-conn-psi/core/EcdhConnPSIServer.cpp index 9d342c9b..d615cdc5 100644 --- a/cpp/wedpr-computing/ppc-psi/src/ecdh-conn-psi/core/EcdhConnPSIServer.cpp +++ b/cpp/wedpr-computing/ppc-psi/src/ecdh-conn-psi/core/EcdhConnPSIServer.cpp @@ -50,9 +50,9 @@ void EcdhConnPSIServer::onHandShakeRequestHandler(const bcos::bytes& _msg) auto clientCurves = handRequestVo->GetCurve(); auto clientHashList = handRequestVo->GetHash(); auto supportedCurves = g_PPCConfig.supportedCurves( - (uint8_t)TaskType::PSI, (uint8_t)PSIAlgorithmType::ECDH_PSI_2PC); + (uint8_t)TaskType::PSI, (uint8_t)TaskAlgorithmType::ECDH_PSI_2PC); auto supportedHashList = g_PPCConfig.supportedHashList( - (uint8_t)TaskType::PSI, (uint8_t)PSIAlgorithmType::ECDH_PSI_2PC); + (uint8_t)TaskType::PSI, (uint8_t)TaskAlgorithmType::ECDH_PSI_2PC); std::set localCurves(supportedCurves.begin(), supportedCurves.end()); std::set localHashTypes(supportedHashList.begin(), supportedHashList.end()); bool curveSelected = false; diff --git a/cpp/wedpr-computing/ppc-psi/src/ecdh-conn-psi/protocol/PSIConnMessageFactory.cpp b/cpp/wedpr-computing/ppc-psi/src/ecdh-conn-psi/protocol/PSIConnMessageFactory.cpp index ec5ceb22..783cd4fb 100644 --- a/cpp/wedpr-computing/ppc-psi/src/ecdh-conn-psi/protocol/PSIConnMessageFactory.cpp +++ b/cpp/wedpr-computing/ppc-psi/src/ecdh-conn-psi/protocol/PSIConnMessageFactory.cpp @@ -53,8 +53,8 @@ bcos::bytes PSIConnMessageFactory::createHandshakeRequest( auto _hash = handShakeRequestVo->GetHash().cbegin(); #ifdef ENABLE_CONN - eccSuit->set_curve(2); // SM2 - eccSuit->set_hash(11); // SHA256 + eccSuit->set_curve(2); // SM2 + eccSuit->set_hash(11); // SHA256 #else eccSuit->set_curve(*_curve); eccSuit->set_hash(*_hash); diff --git a/cpp/wedpr-computing/ppc-psi/src/ecdh-multi-psi/EcdhMultiPSIConfig.h b/cpp/wedpr-computing/ppc-psi/src/ecdh-multi-psi/EcdhMultiPSIConfig.h index 9b256a72..d24a8f2c 100644 --- a/cpp/wedpr-computing/ppc-psi/src/ecdh-multi-psi/EcdhMultiPSIConfig.h +++ b/cpp/wedpr-computing/ppc-psi/src/ecdh-multi-psi/EcdhMultiPSIConfig.h @@ -20,7 +20,7 @@ class EcdhMultiPSIConfig : public PSIConfig int _holdingMessageMinutes, EcdhMultiPSIMessageFactory::Ptr const& _psiMsgFactory, const front::PPCMessageFactory::Ptr& _ppcMsgFactory = std::make_shared()) - : PSIConfig(ppc::protocol::PSIAlgorithmType::ECDH_PSI_MULTI, _selfPartyID, std::move(_front), + : PSIConfig(ppc::protocol::TaskAlgorithmType::ECDH_PSI_MULTI, _selfPartyID, std::move(_front), _ppcMsgFactory, std::move(_dataResourceLoader), _holdingMessageMinutes), m_threadPool(std::move(_threadPool)), m_cryptoBox(std::move(_cryptoBox)), diff --git a/cpp/wedpr-computing/ppc-psi/src/ecdh-multi-psi/EcdhMultiPSIImpl.cpp b/cpp/wedpr-computing/ppc-psi/src/ecdh-multi-psi/EcdhMultiPSIImpl.cpp index e3e9b9bb..1f7ec3e1 100644 --- a/cpp/wedpr-computing/ppc-psi/src/ecdh-multi-psi/EcdhMultiPSIImpl.cpp +++ b/cpp/wedpr-computing/ppc-psi/src/ecdh-multi-psi/EcdhMultiPSIImpl.cpp @@ -13,7 +13,7 @@ using namespace ppc::task; EcdhMultiPSIImpl::EcdhMultiPSIImpl(const EcdhMultiPSIConfig::Ptr& _config, unsigned _idleTimeMs) : m_config(std::move(_config)), m_msgQueue(std::make_shared()), - TaskGuarder(_config, PSIAlgorithmType::ECDH_PSI_MULTI, "ECDH-MULTI-PSI-Timer") + TaskGuarder(_config, TaskAlgorithmType::ECDH_PSI_MULTI, "ECDH-MULTI-PSI-Timer") {} void EcdhMultiPSIImpl::onReceiveMessage(ppc::front::PPCMessageFace::Ptr _msg) diff --git a/cpp/wedpr-computing/ppc-psi/src/ecdh-multi-psi/core/EcdhMultiPSIMaster.cpp b/cpp/wedpr-computing/ppc-psi/src/ecdh-multi-psi/core/EcdhMultiPSIMaster.cpp index 690738f2..877e1516 100644 --- a/cpp/wedpr-computing/ppc-psi/src/ecdh-multi-psi/core/EcdhMultiPSIMaster.cpp +++ b/cpp/wedpr-computing/ppc-psi/src/ecdh-multi-psi/core/EcdhMultiPSIMaster.cpp @@ -19,7 +19,8 @@ EcdhMultiPSIMaster::EcdhMultiPSIMaster(EcdhMultiPSIConfig::Ptr _config, TaskStat m_taskID = task->id(); m_masterCipherDataCache = std::make_shared(); m_final_counts[m_taskID] = 0; - m_syncResult = (task->syncResultToPeer() && std::find(receivers.begin(), receivers.end(), m_config->selfParty()) != receivers.end()); + m_syncResult = (task->syncResultToPeer() && std::find(receivers.begin(), receivers.end(), + m_config->selfParty()) != receivers.end()); } void EcdhMultiPSIMaster::asyncStartRunTask(ppc::protocol::Task::ConstPtr _task) diff --git a/cpp/wedpr-computing/ppc-psi/src/ecdh-psi/EcdhPSIConfig.h b/cpp/wedpr-computing/ppc-psi/src/ecdh-psi/EcdhPSIConfig.h index 41affc04..d2810d16 100644 --- a/cpp/wedpr-computing/ppc-psi/src/ecdh-psi/EcdhPSIConfig.h +++ b/cpp/wedpr-computing/ppc-psi/src/ecdh-psi/EcdhPSIConfig.h @@ -38,8 +38,8 @@ class EcdhPSIConfig : public PSIConfig ppc::io::DataResourceLoader::Ptr const& _dataResourceLoader, uint32_t _dataBatchSize, int _holdingMessageMinutes, bcos::ThreadPool::Ptr const& _threadPool = nullptr, int _threadPoolSize = std::thread::hardware_concurrency()) - : PSIConfig(ppc::protocol::PSIAlgorithmType::ECDH_PSI_2PC, _selfParty, _front, _ppcMsgFactory, - _dataResourceLoader, _holdingMessageMinutes), + : PSIConfig(ppc::protocol::TaskAlgorithmType::ECDH_PSI_2PC, _selfParty, _front, + _ppcMsgFactory, _dataResourceLoader, _holdingMessageMinutes), m_msgFactory(_msgFactory), m_threadPool(_threadPool), m_ecdhCryptoFactory(_ecdhCryptoFactory), diff --git a/cpp/wedpr-computing/ppc-psi/src/ecdh-psi/EcdhPSIImpl.cpp b/cpp/wedpr-computing/ppc-psi/src/ecdh-psi/EcdhPSIImpl.cpp index 3162328d..694dfe86 100644 --- a/cpp/wedpr-computing/ppc-psi/src/ecdh-psi/EcdhPSIImpl.cpp +++ b/cpp/wedpr-computing/ppc-psi/src/ecdh-psi/EcdhPSIImpl.cpp @@ -373,7 +373,7 @@ void EcdhPSIImpl::blindData(TaskState::Ptr const& _taskState) ECDH_LOG(WARNING) << LOG_DESC("blindData: send SyncDataBatchInfo request error") << LOG_KV("code", _error->errorCode()) << LOG_KV("msg", _error->errorMessage()); - // cancel the task(TODO:retry) + // cancel the task psi->cancelTask(std::move(_error), _taskState->task()->id()); }); ECDH_LOG(INFO) << LOG_DESC("blindData success") << printTaskInfo(_taskState->task()) @@ -653,9 +653,9 @@ void EcdhPSIImpl::onHandshakeRequest(PSIMessageInterface::Ptr const& _msg) std::set clientHashList(hashList.begin(), hashList.end()); auto supportedCurves = g_PPCConfig.supportedCurves( - (uint8_t)TaskType::PSI, (uint8_t)PSIAlgorithmType::ECDH_PSI_2PC); + (uint8_t)TaskType::PSI, (uint8_t)TaskAlgorithmType::ECDH_PSI_2PC); auto supportedHashList = g_PPCConfig.supportedHashList( - (uint8_t)TaskType::PSI, (uint8_t)PSIAlgorithmType::ECDH_PSI_2PC); + (uint8_t)TaskType::PSI, (uint8_t)TaskAlgorithmType::ECDH_PSI_2PC); std::set localCurves(supportedCurves.begin(), supportedCurves.end()); std::set localHashTypes(supportedHashList.begin(), supportedHashList.end()); auto handshakeResponse = diff --git a/cpp/wedpr-computing/ppc-psi/src/labeled-psi/LabeledPSIConfig.h b/cpp/wedpr-computing/ppc-psi/src/labeled-psi/LabeledPSIConfig.h index 01b7ebdd..8fe48aab 100644 --- a/cpp/wedpr-computing/ppc-psi/src/labeled-psi/LabeledPSIConfig.h +++ b/cpp/wedpr-computing/ppc-psi/src/labeled-psi/LabeledPSIConfig.h @@ -41,8 +41,8 @@ class LabeledPSIConfig : public PSIConfig ppc::crypto::CryptoBox::Ptr _cryptoBox, bcos::ThreadPool::Ptr _threadPool, ppc::io::DataResourceLoader::Ptr _dataResourceLoader, int _holdingMessageMinutes, front::PPCMessageFactory::Ptr _msgFactory = std::make_shared()) - : PSIConfig(ppc::protocol::PSIAlgorithmType::LABELED_PSI_2PC, _selfPartyID, std::move(_front), - _msgFactory, _dataResourceLoader, _holdingMessageMinutes), + : PSIConfig(ppc::protocol::TaskAlgorithmType::LABELED_PSI_2PC, _selfPartyID, + std::move(_front), _msgFactory, _dataResourceLoader, _holdingMessageMinutes), m_cryptoBox(std::move(_cryptoBox)), m_threadPool(std::move(_threadPool)), m_messageFactory(_msgFactory) diff --git a/cpp/wedpr-computing/ppc-psi/src/labeled-psi/LabeledPSIImpl.cpp b/cpp/wedpr-computing/ppc-psi/src/labeled-psi/LabeledPSIImpl.cpp index 290b1f83..0ac28d7e 100644 --- a/cpp/wedpr-computing/ppc-psi/src/labeled-psi/LabeledPSIImpl.cpp +++ b/cpp/wedpr-computing/ppc-psi/src/labeled-psi/LabeledPSIImpl.cpp @@ -37,7 +37,7 @@ using namespace ppc::task; LabeledPSIImpl::LabeledPSIImpl(LabeledPSIConfig::Ptr _config, unsigned _idleTimeMs) : Worker("LabeledPSI", _idleTimeMs), - TaskGuarder(_config, PSIAlgorithmType::LABELED_PSI_2PC, "Labeled-PSI-Timer"), + TaskGuarder(_config, TaskAlgorithmType::LABELED_PSI_2PC, "Labeled-PSI-Timer"), m_config(std::move(_config)), m_msgQueue(std::make_shared()), m_worker(std::make_shared("senderDB-worker", 1)) diff --git a/cpp/wedpr-computing/ppc-psi/src/labeled-psi/core/LabeledPSIReceiver.cpp b/cpp/wedpr-computing/ppc-psi/src/labeled-psi/core/LabeledPSIReceiver.cpp index 37221243..ec399d4e 100644 --- a/cpp/wedpr-computing/ppc-psi/src/labeled-psi/core/LabeledPSIReceiver.cpp +++ b/cpp/wedpr-computing/ppc-psi/src/labeled-psi/core/LabeledPSIReceiver.cpp @@ -158,7 +158,7 @@ void LabeledPSIReceiver::runReceiver() << LOG_KV("taskID", m_taskID) << LOG_KV("itemsSize", m_items.size()); auto message = m_config->ppcMsgFactory()->buildPPCMessage(uint8_t(protocol::TaskType::PSI), - uint8_t(protocol::PSIAlgorithmType::LABELED_PSI_2PC), m_taskID, + uint8_t(protocol::TaskAlgorithmType::LABELED_PSI_2PC), m_taskID, std::make_shared()); message->setMessageType(uint8_t(LabeledPSIMessageType::PARAMS_REQUEST)); @@ -250,7 +250,7 @@ void LabeledPSIReceiver::runOprfAsClient() oprfData.data = m_oprfClient->blind(m_items); auto blindedMessage = m_config->ppcMsgFactory()->buildPPCMessage(uint8_t(TaskType::PSI), - uint8_t(PSIAlgorithmType::LABELED_PSI_2PC), m_taskID, std::make_shared()); + uint8_t(TaskAlgorithmType::LABELED_PSI_2PC), m_taskID, std::make_shared()); blindedMessage->setMessageType(uint8_t(LabeledPSIMessageType::OPRF_BLINDED_ITEMS)); ppctars::serialize::encode(oprfData, *blindedMessage->data()); @@ -448,7 +448,7 @@ void LabeledPSIReceiver::requestQuery() } auto queryMessage = m_config->ppcMsgFactory()->buildPPCMessage(uint8_t(TaskType::PSI), - uint8_t(PSIAlgorithmType::LABELED_PSI_2PC), m_taskID, std::make_shared()); + uint8_t(TaskAlgorithmType::LABELED_PSI_2PC), m_taskID, std::make_shared()); queryMessage->setMessageType(uint8_t(LabeledPSIMessageType::QUERY)); ppctars::serialize::encode(queryRequest, *queryMessage->data()); diff --git a/cpp/wedpr-computing/ppc-psi/src/labeled-psi/core/LabeledPSISender.cpp b/cpp/wedpr-computing/ppc-psi/src/labeled-psi/core/LabeledPSISender.cpp index 419140cf..dcfbe99c 100644 --- a/cpp/wedpr-computing/ppc-psi/src/labeled-psi/core/LabeledPSISender.cpp +++ b/cpp/wedpr-computing/ppc-psi/src/labeled-psi/core/LabeledPSISender.cpp @@ -50,7 +50,7 @@ void LabeledPSISender::handlePsiParamsRequest(const PPCMessageFace::Ptr& _messag { auto tarsParams = fromPSIParams(m_senderDB->getParams(), m_senderDB->getBinBundleCount()); auto paramsMessage = m_messageFactory->buildPPCMessage(uint8_t(TaskType::PSI), - uint8_t(PSIAlgorithmType::LABELED_PSI_2PC), taskID, std::make_shared()); + uint8_t(TaskAlgorithmType::LABELED_PSI_2PC), taskID, std::make_shared()); paramsMessage->setMessageType(uint8_t(LabeledPSIMessageType::PARAMS_RESPONSE)); ppctars::serialize::encode(tarsParams, *paramsMessage->data()); @@ -91,7 +91,7 @@ void LabeledPSISender::handleBlindedItems(const front::PPCMessageFace::Ptr& _mes evaluatedData.data = m_config->oprfServer()->evaluate(blindedData.data); auto evaluatedMessage = m_messageFactory->buildPPCMessage(uint8_t(TaskType::PSI), - uint8_t(PSIAlgorithmType::LABELED_PSI_2PC), taskID, std::make_shared()); + uint8_t(TaskAlgorithmType::LABELED_PSI_2PC), taskID, std::make_shared()); evaluatedMessage->setMessageType(uint8_t(LabeledPSIMessageType::OPRF_EVALUATED_ITEMS)); ppctars::serialize::encode(evaluatedData, *evaluatedMessage->data()); @@ -432,7 +432,7 @@ void LabeledPSISender::sendResultPackage(const std::string& _taskID, const std:: } auto resultMessage = m_messageFactory->buildPPCMessage(uint8_t(TaskType::PSI), - uint8_t(PSIAlgorithmType::LABELED_PSI_2PC), _taskID, std::make_shared()); + uint8_t(TaskAlgorithmType::LABELED_PSI_2PC), _taskID, std::make_shared()); resultMessage->setMessageType(uint8_t(LabeledPSIMessageType::RESPONSE)); resultMessage->setSeq(_seq); ppctars::serialize::encode(queryResponse, *resultMessage->data()); diff --git a/cpp/wedpr-computing/ppc-psi/src/psi-framework/PSIFramework.h b/cpp/wedpr-computing/ppc-psi/src/psi-framework/PSIFramework.h index 66238319..bea4974e 100644 --- a/cpp/wedpr-computing/ppc-psi/src/psi-framework/PSIFramework.h +++ b/cpp/wedpr-computing/ppc-psi/src/psi-framework/PSIFramework.h @@ -32,7 +32,7 @@ #define PSI_FRAMEWORK_LOG(LEVEL) \ BCOS_LOG(LEVEL) << LOG_BADGE("PSI") \ - << LOG_BADGE((ppc::protocol::PSIAlgorithmType)m_psiConfig->algorithmType()) + << LOG_BADGE((ppc::protocol::TaskAlgorithmType)m_psiConfig->algorithmType()) namespace ppc::psi { using PSIMsgQueue = bcos::ConcurrentQueue; diff --git a/cpp/wedpr-computing/ppc-psi/src/psi-framework/TaskGuarder.h b/cpp/wedpr-computing/ppc-psi/src/psi-framework/TaskGuarder.h index aea7e3bf..c7da3a68 100644 --- a/cpp/wedpr-computing/ppc-psi/src/psi-framework/TaskGuarder.h +++ b/cpp/wedpr-computing/ppc-psi/src/psi-framework/TaskGuarder.h @@ -35,7 +35,7 @@ class TaskGuarder using Ptr = std::shared_ptr; explicit TaskGuarder(PSIConfig::Ptr _config) : m_config(std::move(_config)) {} TaskGuarder( - PSIConfig::Ptr _config, protocol::PSIAlgorithmType _type, const std::string& _timerName) + PSIConfig::Ptr _config, protocol::TaskAlgorithmType _type, const std::string& _timerName) : m_config(std::move(_config)), m_type(_type), m_taskStateFactory(std::make_shared()) @@ -322,7 +322,7 @@ class TaskGuarder protected: PSIConfig::Ptr m_config; - protocol::PSIAlgorithmType m_type; + protocol::TaskAlgorithmType m_type; TaskStateFactory::Ptr m_taskStateFactory; // the timer used to check the activity of peer node std::shared_ptr m_pingTimer; diff --git a/cpp/wedpr-computing/ppc-psi/src/ra2018-psi/RA2018PSIConfig.h b/cpp/wedpr-computing/ppc-psi/src/ra2018-psi/RA2018PSIConfig.h index 6954356e..9b4e2d5f 100644 --- a/cpp/wedpr-computing/ppc-psi/src/ra2018-psi/RA2018PSIConfig.h +++ b/cpp/wedpr-computing/ppc-psi/src/ra2018-psi/RA2018PSIConfig.h @@ -42,7 +42,7 @@ class RA2018PSIConfig : public PSIConfig std::string const& _dbName = "ra2018", uint64_t _cuckooFilterCacheSize = 255 * 1024 * 1024, uint64_t _ra2018CacheCapacity = 1024 * 1024 * 1024, int _dataBatchSize = -1, int _threadPoolSize = std::thread::hardware_concurrency()) - : PSIConfig(ppc::protocol::PSIAlgorithmType::RA_PSI_2PC, _selfParty, _front, _ppcMsgFactory, + : PSIConfig(ppc::protocol::TaskAlgorithmType::RA_PSI_2PC, _selfParty, _front, _ppcMsgFactory, _dataResourceLoader, _holdingMessageMinutes), m_oprf(std::move(_oprf)), m_binHashImpl(std::move(_binHashImpl)), diff --git a/cpp/wedpr-computing/ppc-psi/tests/cm2020-psi/TestCM2020Impl.cpp b/cpp/wedpr-computing/ppc-psi/tests/cm2020-psi/TestCM2020Impl.cpp index bb9f5bf6..bee77f70 100644 --- a/cpp/wedpr-computing/ppc-psi/tests/cm2020-psi/TestCM2020Impl.cpp +++ b/cpp/wedpr-computing/ppc-psi/tests/cm2020-psi/TestCM2020Impl.cpp @@ -153,7 +153,7 @@ void testCM2020PSIImplFunc(const std::string& _taskID, const std::string& _param senderPSITask->setSelf(_senderParty); senderPSITask->addParty(_receiverParty); senderPSITask->setSyncResultToPeer(_syncResults); - senderPSITask->setAlgorithm((uint8_t)PSIAlgorithmType::CM_PSI_2PC); + senderPSITask->setAlgorithm((uint8_t)TaskAlgorithmType::CM_PSI_2PC); auto receiverPSITask = std::make_shared(receiverAgencyName); receiverPSITask->setId(_taskID); @@ -161,7 +161,7 @@ void testCM2020PSIImplFunc(const std::string& _taskID, const std::string& _param receiverPSITask->setSelf(_receiverParty); receiverPSITask->addParty(_senderParty); receiverPSITask->setSyncResultToPeer(_syncResults); - receiverPSITask->setAlgorithm((uint8_t)PSIAlgorithmType::CM_PSI_2PC); + receiverPSITask->setAlgorithm((uint8_t)TaskAlgorithmType::CM_PSI_2PC); testCM2020PSI(factory, senderPSI, receiverPSI, senderPSITask, receiverPSITask, _expectedPSIResult, _expectedSuccess, _expectedErrorCode); diff --git a/cpp/wedpr-computing/ppc-psi/tests/labeled-psi/TestLabeledPSIImpl.cpp b/cpp/wedpr-computing/ppc-psi/tests/labeled-psi/TestLabeledPSIImpl.cpp index 3a030eae..d7a75168 100644 --- a/cpp/wedpr-computing/ppc-psi/tests/labeled-psi/TestLabeledPSIImpl.cpp +++ b/cpp/wedpr-computing/ppc-psi/tests/labeled-psi/TestLabeledPSIImpl.cpp @@ -61,7 +61,7 @@ void runSetup(LabeledPSIImpl::Ptr _sender) senderPSITask->setId("0x00000000"); senderPSITask->setParam(R"(["setup_sender_db","32"])"); senderPSITask->setSelf(senderParty); - senderPSITask->setAlgorithm((uint8_t)PSIAlgorithmType::LABELED_PSI_2PC); + senderPSITask->setAlgorithm((uint8_t)TaskAlgorithmType::LABELED_PSI_2PC); std::atomic flag = 0; _sender->asyncRunTask(senderPSITask, [&flag](ppc::protocol::TaskResult::Ptr&& _response) { @@ -97,7 +97,7 @@ void saveCache(LabeledPSIImpl::Ptr _sender) senderPSITask->setId("0x00000012"); senderPSITask->setParam(R"(["save_sender_cache"])"); senderPSITask->setSelf(senderParty); - senderPSITask->setAlgorithm((uint8_t)PSIAlgorithmType::LABELED_PSI_2PC); + senderPSITask->setAlgorithm((uint8_t)TaskAlgorithmType::LABELED_PSI_2PC); std::atomic flag = 0; _sender->asyncRunTask(senderPSITask, [&flag](ppc::protocol::TaskResult::Ptr&& _response) { @@ -128,7 +128,7 @@ void loadCache(LabeledPSIImpl::Ptr _sender) senderPSITask->setId("0x00000034"); senderPSITask->setParam(R"(["load_sender_cache"])"); senderPSITask->setSelf(senderParty); - senderPSITask->setAlgorithm((uint8_t)PSIAlgorithmType::LABELED_PSI_2PC); + senderPSITask->setAlgorithm((uint8_t)TaskAlgorithmType::LABELED_PSI_2PC); std::atomic flag = 0; _sender->asyncRunTask(senderPSITask, [&flag](ppc::protocol::TaskResult::Ptr&& _response) { @@ -236,13 +236,13 @@ void testLabeledPSIImplFunc(const std::string& _taskID, const std::string& _para senderPSITask->setId(_taskID); senderPSITask->setParam(_params); senderPSITask->setSelf(_senderParty); - senderPSITask->setAlgorithm((uint8_t)PSIAlgorithmType::LABELED_PSI_2PC); + senderPSITask->setAlgorithm((uint8_t)TaskAlgorithmType::LABELED_PSI_2PC); senderPSITask->addParty(_receiverParty); auto receiverPSITask = std::make_shared(receiverAgencyName); receiverPSITask->setId(_taskID); receiverPSITask->setSelf(_receiverParty); - receiverPSITask->setAlgorithm((uint8_t)PSIAlgorithmType::LABELED_PSI_2PC); + receiverPSITask->setAlgorithm((uint8_t)TaskAlgorithmType::LABELED_PSI_2PC); receiverPSITask->addParty(_senderParty); testLabeledPSI(senderPSI, receiverPSI, senderPSITask, receiverPSITask, _expectedSuccess, diff --git a/cpp/wedpr-computing/ppc-psi/tests/ra2018-psi/TestEcdhPSIImpl.cpp b/cpp/wedpr-computing/ppc-psi/tests/ra2018-psi/TestEcdhPSIImpl.cpp index 5c973bed..a100a4cd 100644 --- a/cpp/wedpr-computing/ppc-psi/tests/ra2018-psi/TestEcdhPSIImpl.cpp +++ b/cpp/wedpr-computing/ppc-psi/tests/ra2018-psi/TestEcdhPSIImpl.cpp @@ -87,7 +87,7 @@ void testEcdhImplFunc(int64_t _dataBatchSize, std::string const& _serverPSIDataS std::string taskID = "runPSI"; clientPSITask->setId(taskID); clientPSITask->setType((int8_t)TaskType::PSI); - clientPSITask->setAlgorithm((int8_t)PSIAlgorithmType::ECDH_PSI_2PC); + clientPSITask->setAlgorithm((int8_t)TaskAlgorithmType::ECDH_PSI_2PC); clientPSITask->setSelf(clientParty); clientPSITask->addParty(serverParty); @@ -103,7 +103,7 @@ void testEcdhImplFunc(int64_t _dataBatchSize, std::string const& _serverPSIDataS serverPSITask->setId(taskID); } serverPSITask->setType((int8_t)TaskType::PSI); - serverPSITask->setAlgorithm((int8_t)PSIAlgorithmType::ECDH_PSI_2PC); + serverPSITask->setAlgorithm((int8_t)TaskAlgorithmType::ECDH_PSI_2PC); serverPSITask->addParty(clientParty); // run psi testPSI(factory, serverPSI, clientPSI, serverPSITask, clientPSITask, _expectPSISuccess, diff --git a/cpp/wedpr-crypto/ppc-homo/paillier/OpenSSLPaillier.cpp b/cpp/wedpr-crypto/ppc-homo/paillier/OpenSSLPaillier.cpp index 302b2f27..75a32d91 100644 --- a/cpp/wedpr-crypto/ppc-homo/paillier/OpenSSLPaillier.cpp +++ b/cpp/wedpr-crypto/ppc-homo/paillier/OpenSSLPaillier.cpp @@ -221,7 +221,6 @@ BigNum OpenSSLPaillier::decrypt(bcos::bytesConstRef const& _cipherData, void* _k result.div(result.bn().get(), NULL, pk->n.bn().get(), ctx.get()); // result * lambdaInverse mod n - // TODO: check the overhead here auto lambdaInverse = sk->lambda.Invert(pk->n); result.modMul(result.bn().get(), lambdaInverse.bn().get(), pk->n.bn().get(), ctx.get()); // decode result to support negative case diff --git a/cpp/wedpr-crypto/ppc-udf/hive/src/main/java/com/webank/wedpr/hive/udf/config/model/KeyConfig.java b/cpp/wedpr-crypto/ppc-udf/hive/src/main/java/com/webank/wedpr/hive/udf/config/model/KeyConfig.java index a3308d29..550fb158 100644 --- a/cpp/wedpr-crypto/ppc-udf/hive/src/main/java/com/webank/wedpr/hive/udf/config/model/KeyConfig.java +++ b/cpp/wedpr-crypto/ppc-udf/hive/src/main/java/com/webank/wedpr/hive/udf/config/model/KeyConfig.java @@ -45,7 +45,6 @@ public class KeyConfig { public KeyConfig(ConfigProperty configProperty) throws ConfigException { Map keyConfig = configProperty.getKeys(); - // TODO: use dpm key files /// load the aes private key aesPrivateKey = ConfigProperty.getValue(keyConfig, AES_PRIVATE_KEY_PROPERTY, null); if (aesPrivateKey == null) { diff --git a/cpp/wedpr-helper/ppc-tools/src/config/PPCConfig.cpp b/cpp/wedpr-helper/ppc-tools/src/config/PPCConfig.cpp index 1a18fad4..95fac22a 100644 --- a/cpp/wedpr-helper/ppc-tools/src/config/PPCConfig.cpp +++ b/cpp/wedpr-helper/ppc-tools/src/config/PPCConfig.cpp @@ -65,6 +65,14 @@ void PPCConfig::loadGatewayConfig(boost::property_tree::ptree const& _pt) } // load the holdingMessageMinutes, in minutes m_holdingMessageMinutes = loadHoldingMessageMinutes(_pt, "gateway.holding_msg_minutes"); + // load seqSyncPeriod + m_seqSyncPeriod = _pt.get("gateway.seq_sync_period_ms", 5000); + if (m_seqSyncPeriod < 3000) + { + BOOST_THROW_EXCEPTION( + InvalidConfig() << errinfo_comment( + "The value of gateway.seq_sync_period_ms must no little than 3s")); + } // load the grpcConfig m_grpcConfig = loadGrpcConfig("transport", _pt); // load the GrpcServerConfig diff --git a/cpp/wedpr-helper/ppc-tools/src/config/PPCConfig.h b/cpp/wedpr-helper/ppc-tools/src/config/PPCConfig.h index d66db91e..2971e259 100644 --- a/cpp/wedpr-helper/ppc-tools/src/config/PPCConfig.h +++ b/cpp/wedpr-helper/ppc-tools/src/config/PPCConfig.h @@ -241,6 +241,8 @@ class PPCConfig // for ut void setAgencyID(std::string const& agencyID) { m_agencyID = agencyID; } + uint16_t seqSyncPeriod() const { return m_seqSyncPeriod; } + private: virtual void loadEndpointConfig(ppc::protocol::EndPoint& endPoint, bool requireHostIp, std::string const& sectionName, boost::property_tree::ptree const& pt); @@ -296,6 +298,8 @@ class PPCConfig // the gateway holding message time, in minutes, default 30min int m_holdingMessageMinutes = 30; + uint16_t m_seqSyncPeriod = 5000; + // the front config // TODO: parse the frontConfig ppc::front::FrontConfig::Ptr m_frontConfig; diff --git a/cpp/wedpr-initializer/Initializer.cpp b/cpp/wedpr-initializer/Initializer.cpp index d1e1acec..cfba5249 100644 --- a/cpp/wedpr-initializer/Initializer.cpp +++ b/cpp/wedpr-initializer/Initializer.cpp @@ -29,7 +29,7 @@ #include "protocol/src/PPCMessage.h" #include "wedpr-transport/sdk/src/TransportBuilder.h" #if 0 -//TODO: optimize here +//TODO: optimize here to implement EcdhConnPSI #include "ppc-psi/src/ecdh-conn-psi/EcdhConnPSIFactory.h" #endif #include "ppc-front/Front.h" @@ -210,7 +210,7 @@ void Initializer::initMsgHandlers() // register msg-handlers for ra2018-psi auto weakRA2018PSI = std::weak_ptr(m_ra2018PSI); m_ppcFront->registerMessageHandler((uint8_t)ppc::protocol::TaskType::PSI, - (uint8_t)ppc::protocol::PSIAlgorithmType::RA_PSI_2PC, + (uint8_t)ppc::protocol::TaskAlgorithmType::RA_PSI_2PC, [weakRA2018PSI](ppc::front::PPCMessageFace::Ptr _msg) { auto psi = weakRA2018PSI.lock(); if (!psi) @@ -224,7 +224,7 @@ void Initializer::initMsgHandlers() INIT_LOG(INFO) << LOG_DESC("initMsgHandlers for labeledPSI"); auto weakLabeledPSI = std::weak_ptr(m_labeledPSI); m_ppcFront->registerMessageHandler((uint8_t)ppc::protocol::TaskType::PSI, - (uint8_t)ppc::protocol::PSIAlgorithmType::LABELED_PSI_2PC, + (uint8_t)ppc::protocol::TaskAlgorithmType::LABELED_PSI_2PC, [weakLabeledPSI](ppc::front::PPCMessageFace::Ptr _msg) { auto psi = weakLabeledPSI.lock(); if (!psi) @@ -238,7 +238,7 @@ void Initializer::initMsgHandlers() INIT_LOG(INFO) << LOG_DESC("initMsgHandlers for CM2020PSI"); auto weakCM2020PSI = std::weak_ptr(m_cm2020PSI); m_ppcFront->registerMessageHandler((uint8_t)ppc::protocol::TaskType::PSI, - (uint8_t)ppc::protocol::PSIAlgorithmType::CM_PSI_2PC, + (uint8_t)ppc::protocol::TaskAlgorithmType::CM_PSI_2PC, [weakCM2020PSI](ppc::front::PPCMessageFace::Ptr _msg) { auto psi = weakCM2020PSI.lock(); if (!psi) @@ -252,7 +252,7 @@ void Initializer::initMsgHandlers() // register msg-handlers for ecdh-psi auto weakEcdhPSI = std::weak_ptr(m_ecdhPSI); m_ppcFront->registerMessageHandler((uint8_t)ppc::protocol::TaskType::PSI, - (uint8_t)ppc::protocol::PSIAlgorithmType::ECDH_PSI_2PC, + (uint8_t)ppc::protocol::TaskAlgorithmType::ECDH_PSI_2PC, [weakEcdhPSI](ppc::front::PPCMessageFace::Ptr _msg) { auto psi = weakEcdhPSI.lock(); if (!psi) @@ -266,7 +266,7 @@ void Initializer::initMsgHandlers() /*INIT_LOG(INFO) << LOG_DESC("initMsgHandlers for ecdh-conn-psi"); auto weakEcdhConnPSI = std::weak_ptr(m_ecdhConnPSI); m_ppcFront->registerMessageHandler((uint8_t)ppc::protocol::TaskType::PSI, - (uint8_t)ppc::protocol::PSIAlgorithmType::ECDH_PSI_CONN, + (uint8_t)ppc::protocol::TaskAlgorithmType::ECDH_PSI_CONN, [weakEcdhConnPSI](ppc::front::PPCMessageFace::Ptr _msg) { auto psi = weakEcdhConnPSI.lock(); if (!psi) @@ -280,7 +280,7 @@ void Initializer::initMsgHandlers() INIT_LOG(INFO) << LOG_DESC("initMsgHandlers for ecdh-multi-psi"); auto weakEcdhMultiPSI = std::weak_ptr(m_ecdhMultiPSI); m_ppcFront->registerMessageHandler((uint8_t)ppc::protocol::TaskType::PSI, - (uint8_t)ppc::protocol::PSIAlgorithmType::ECDH_PSI_MULTI, + (uint8_t)ppc::protocol::TaskAlgorithmType::ECDH_PSI_MULTI, [weakEcdhMultiPSI](ppc::front::PPCMessageFace::Ptr _msg) { auto psi = weakEcdhMultiPSI.lock(); if (!psi) @@ -294,7 +294,7 @@ void Initializer::initMsgHandlers() // register msg-handlers for ecdh-psi auto weakOtPIR = std::weak_ptr(m_otPIR); m_ppcFront->registerMessageHandler((uint8_t)ppc::protocol::TaskType::PIR, - (uint8_t)ppc::protocol::PSIAlgorithmType::OT_PIR_2PC, + (uint8_t)ppc::protocol::TaskAlgorithmType::OT_PIR_2PC, [weakOtPIR](ppc::front::PPCMessageFace::Ptr _msg) { auto pir = weakOtPIR.lock(); if (!pir) @@ -313,7 +313,7 @@ void Initializer::registerRpcHandler(ppc::rpc::RpcInterface::Ptr const& _rpc) // register task handler for ra2018-psi auto weakRA2018PSI = std::weak_ptr(m_ra2018PSI); _rpc->registerTaskHandler(ppc::protocol::TaskType::PSI, - (uint8_t)ppc::protocol::PSIAlgorithmType::RA_PSI_2PC, + (uint8_t)ppc::protocol::TaskAlgorithmType::RA_PSI_2PC, [weakRA2018PSI](ppc::protocol::Task::ConstPtr _task, std::function _handler) { auto ra2018Impl = weakRA2018PSI.lock(); @@ -328,7 +328,7 @@ void Initializer::registerRpcHandler(ppc::rpc::RpcInterface::Ptr const& _rpc) INIT_LOG(INFO) << LOG_DESC("registerRpcHandler for labeledPSI"); auto weakLabeledPSI = std::weak_ptr(m_labeledPSI); _rpc->registerTaskHandler(ppc::protocol::TaskType::PSI, - (uint8_t)ppc::protocol::PSIAlgorithmType::LABELED_PSI_2PC, + (uint8_t)ppc::protocol::TaskAlgorithmType::LABELED_PSI_2PC, [weakLabeledPSI](ppc::protocol::Task::ConstPtr _task, std::function _handler) { auto labeledPSI = weakLabeledPSI.lock(); @@ -343,7 +343,7 @@ void Initializer::registerRpcHandler(ppc::rpc::RpcInterface::Ptr const& _rpc) INIT_LOG(INFO) << LOG_DESC("registerRpcHandler for cm2020PSI"); auto weakCM2020PSI = std::weak_ptr(m_cm2020PSI); _rpc->registerTaskHandler(ppc::protocol::TaskType::PSI, - (uint8_t)ppc::protocol::PSIAlgorithmType::CM_PSI_2PC, + (uint8_t)ppc::protocol::TaskAlgorithmType::CM_PSI_2PC, [weakCM2020PSI](ppc::protocol::Task::ConstPtr _task, std::function _handler) { auto cm2020PSI = weakCM2020PSI.lock(); @@ -358,7 +358,7 @@ void Initializer::registerRpcHandler(ppc::rpc::RpcInterface::Ptr const& _rpc) INIT_LOG(INFO) << LOG_DESC("registerRpcHandler for ecdhPSI"); auto weakEcdhPSI = std::weak_ptr(m_ecdhPSI); _rpc->registerTaskHandler(ppc::protocol::TaskType::PSI, - (uint8_t)ppc::protocol::PSIAlgorithmType::ECDH_PSI_2PC, + (uint8_t)ppc::protocol::TaskAlgorithmType::ECDH_PSI_2PC, [weakEcdhPSI](ppc::protocol::Task::ConstPtr _task, std::function _handler) { auto psi = weakEcdhPSI.lock(); @@ -372,7 +372,7 @@ void Initializer::registerRpcHandler(ppc::rpc::RpcInterface::Ptr const& _rpc) INIT_LOG(INFO) << LOG_DESC("registerRpcHandler for ecdhMultiPSI"); auto weakEcdhMultiPSI = std::weak_ptr(m_ecdhMultiPSI); _rpc->registerTaskHandler(ppc::protocol::TaskType::PSI, - (uint8_t)ppc::protocol::PSIAlgorithmType::ECDH_PSI_MULTI, + (uint8_t)ppc::protocol::TaskAlgorithmType::ECDH_PSI_MULTI, [weakEcdhMultiPSI](ppc::protocol::Task::ConstPtr _task, std::function _handler) { auto psi = weakEcdhMultiPSI.lock(); @@ -386,7 +386,7 @@ void Initializer::registerRpcHandler(ppc::rpc::RpcInterface::Ptr const& _rpc) /*INIT_LOG(INFO) << LOG_DESC("registerRpcHandler for ecdhConnPSI"); auto weakEcdhConnPSI = std::weak_ptr(m_ecdhConnPSI); _rpc->registerTaskHandler(ppc::protocol::TaskType::PSI, - (uint8_t)ppc::protocol::PSIAlgorithmType::ECDH_PSI_CONN, + (uint8_t)ppc::protocol::TaskAlgorithmType::ECDH_PSI_CONN, [weakEcdhConnPSI](ppc::protocol::Task::ConstPtr _task, std::function _handler) { auto psi = weakEcdhConnPSI.lock(); @@ -401,7 +401,7 @@ void Initializer::registerRpcHandler(ppc::rpc::RpcInterface::Ptr const& _rpc) INIT_LOG(INFO) << LOG_DESC("registerRpcHandler for otPIR"); auto weakOtPIR = std::weak_ptr(m_otPIR); _rpc->registerTaskHandler(ppc::protocol::TaskType::PIR, - (uint8_t)ppc::protocol::PSIAlgorithmType::OT_PIR_2PC, + (uint8_t)ppc::protocol::TaskAlgorithmType::OT_PIR_2PC, [weakOtPIR](ppc::protocol::Task::ConstPtr _task, std::function _handler) { auto pir = weakOtPIR.lock(); diff --git a/cpp/wedpr-protocol/grpc/client/FrontClient.cpp b/cpp/wedpr-protocol/grpc/client/FrontClient.cpp index cd3b9b39..d3b33818 100644 --- a/cpp/wedpr-protocol/grpc/client/FrontClient.cpp +++ b/cpp/wedpr-protocol/grpc/client/FrontClient.cpp @@ -28,11 +28,11 @@ using namespace grpc; void FrontClient::onReceiveMessage(ppc::protocol::Message::Ptr const& msg, ReceiveMsgFunc callback) { - // TODO: optimize here std::unique_ptr request(new ReceivedMessage()); bcos::bytes encodedData; msg->encode(encodedData); - request->set_data(encodedData.data(), encodedData.size()); + *request->mutable_data() = + std::move(std::string_view((const char*)encodedData.data(), encodedData.size())); // The ClientContext instance used for creating an rpc must remain alive and valid for the // lifetime of the rpc diff --git a/cpp/wedpr-protocol/grpc/server/GatewayServer.cpp b/cpp/wedpr-protocol/grpc/server/GatewayServer.cpp index 4222d8af..a6b8b63b 100644 --- a/cpp/wedpr-protocol/grpc/server/GatewayServer.cpp +++ b/cpp/wedpr-protocol/grpc/server/GatewayServer.cpp @@ -29,7 +29,8 @@ ServerUnaryReactor* GatewayServer::asyncSendMessage(CallbackServerContext* conte ServerUnaryReactor* reactor(context->DefaultReactor()); try { - // TODO: optimize here + // TODO: optimize here (since bytes of protobuf is represented with string, no zero-copy + // method has been found yet, unless the payload is stored in string) bcos::bytes payloadData(sendedMsg->payload().begin(), sendedMsg->payload().end()); auto routeInfo = generateRouteInfo(m_routeInfoBuilder, sendedMsg->routeinfo()); m_gateway->asyncSendMessage((ppc::protocol::RouteType)sendedMsg->routetype(), routeInfo, diff --git a/cpp/wedpr-protocol/grpc/server/GrpcServer.cpp b/cpp/wedpr-protocol/grpc/server/GrpcServer.cpp index de95ab48..ee289ee1 100644 --- a/cpp/wedpr-protocol/grpc/server/GrpcServer.cpp +++ b/cpp/wedpr-protocol/grpc/server/GrpcServer.cpp @@ -19,7 +19,7 @@ */ #include "GrpcServer.h" #include "Common.h" -#include +#include "grpcpp/ext/proto_server_reflection_plugin.h" using namespace ppc::protocol; using namespace grpc; diff --git a/cpp/wedpr-protocol/protobuf/src/RequestConverter.h b/cpp/wedpr-protocol/protobuf/src/RequestConverter.h index 753b2aab..3bc8aebc 100644 --- a/cpp/wedpr-protocol/protobuf/src/RequestConverter.h +++ b/cpp/wedpr-protocol/protobuf/src/RequestConverter.h @@ -24,6 +24,7 @@ #include "ppc-framework/protocol/Protocol.h" #include #include +#include #include namespace ppc::protocol @@ -64,7 +65,9 @@ inline ppc::proto::SendedMessageRequest* generateRequest(std::string const& trac // set the route information setRouteInfo(request->mutable_routeinfo(), routeInfo); // set the payload(TODO: optimize here) - request->set_payload(payload.data(), payload.size()); + *request->mutable_payload() = + std::move(std::string_view((const char*)payload.data(), payload.size())); + request->set_timeout(timeout); return request; } diff --git a/cpp/wedpr-protocol/protobuf/tests/NodeInfoImplTest.cpp b/cpp/wedpr-protocol/protobuf/tests/NodeInfoImplTest.cpp index a234a8e1..6d0de595 100644 --- a/cpp/wedpr-protocol/protobuf/tests/NodeInfoImplTest.cpp +++ b/cpp/wedpr-protocol/protobuf/tests/NodeInfoImplTest.cpp @@ -17,12 +17,14 @@ * @author: yujiechen * @date 2024-09-06 */ - #include "protobuf/src/NodeInfoImpl.h" +#include "protobuf/src/RequestConverter.h" +#include #include #include using namespace ppc; +using namespace ppc::proto; using namespace ppc::protocol; using namespace bcos::test; @@ -54,6 +56,31 @@ void testNodeInfoEncodeDecode(INodeInfoFactory::Ptr factory, INodeInfo::Ptr node } } +void testPayloadMove(int payloadSize, int round) +{ + bcos::bytes payload; + char tmp = 'a'; + for (int i = 0; i < payloadSize; i++) + { + payload.emplace_back((char)(tmp + 1)); + } + auto startT = bcos::utcSteadyTime(); + auto request = new ppc::proto::SendedMessageRequest(); + for (int i = 0; i < round; i++) + { + std::unique_ptr request( + new ppc::proto::SendedMessageRequest()); + //*request->mutable_payload() = std::move(std::string_view((const char*)payload.data(), + //payload.size())); + *request->mutable_payload() = std::string_view((const char*)payload.data(), payload.size()); + // request->set_payload((const char*)payload.data(), payload.size()); + // std::cout << "#### request size: " << request->payload().size() << ", origin payload + // size: " << payloadSize << std::endl; + BOOST_CHECK(*request->mutable_payload() == std::string(payload.begin(), payload.end())); + } + std::cout << "### testPayloadMove, timecost: " << (bcos::utcSteadyTime() - startT) << std::endl; +} + BOOST_AUTO_TEST_CASE(testNodeInfo) { auto nodeInfoFactory = std::make_shared(); @@ -68,4 +95,11 @@ BOOST_AUTO_TEST_CASE(testNodeInfo) testNodeInfoEncodeDecode(nodeInfoFactory, nodeInfo); } +BOOST_AUTO_TEST_CASE(payloadMoveTest) +{ + testPayloadMove(10, 1); + testPayloadMove(100000, 10); + testPayloadMove(10000000, 10); +} + BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file diff --git a/cpp/wedpr-protocol/protocol/tests/PPCMessageTest.cpp b/cpp/wedpr-protocol/protocol/tests/PPCMessageTest.cpp index 1a8fea15..f478eae2 100644 --- a/cpp/wedpr-protocol/protocol/tests/PPCMessageTest.cpp +++ b/cpp/wedpr-protocol/protocol/tests/PPCMessageTest.cpp @@ -113,7 +113,7 @@ BOOST_AUTO_TEST_CASE(test_ppcMesage) { int version = 1; int taskType = uint8_t(protocol::TaskType::PSI); - int algorithmType = uint8_t(protocol::PSIAlgorithmType::CM_PSI_2PC); + int algorithmType = uint8_t(protocol::TaskAlgorithmType::CM_PSI_2PC); int messageType = 4; std::string taskID = "12345678"; int seq = 5; diff --git a/cpp/wedpr-transport/ppc-front/test/unittests/PPCChannelTest.cpp b/cpp/wedpr-transport/ppc-front/test/unittests/PPCChannelTest.cpp index e5f1ad9e..e5ae7866 100644 --- a/cpp/wedpr-transport/ppc-front/test/unittests/PPCChannelTest.cpp +++ b/cpp/wedpr-transport/ppc-front/test/unittests/PPCChannelTest.cpp @@ -47,14 +47,14 @@ BOOST_AUTO_TEST_CASE(test_ppcChannel) // register message handler channelManager->registerMsgHandlerForChannel( - uint8_t(protocol::TaskType::PSI), uint8_t(protocol::PSIAlgorithmType::CM_PSI_2PC)); + uint8_t(protocol::TaskType::PSI), uint8_t(protocol::TaskAlgorithmType::CM_PSI_2PC)); // receive message auto messageFactory = std::make_shared(); auto message = messageFactory->buildPPCMessage(); message->setVersion(1); message->setTaskType(uint8_t(protocol::TaskType::PSI)); - message->setAlgorithmType(uint8_t(protocol::PSIAlgorithmType::CM_PSI_2PC)); + message->setAlgorithmType(uint8_t(protocol::TaskAlgorithmType::CM_PSI_2PC)); message->setMessageType(4); message->setSeq(5); message->setTaskID("T_123456"); diff --git a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/GatewayFactory.cpp b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/GatewayFactory.cpp index db62f116..1c330acc 100644 --- a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/GatewayFactory.cpp +++ b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/GatewayFactory.cpp @@ -46,7 +46,7 @@ Service::Ptr GatewayFactory::buildService() const wsConfig->setSmSSL(gwConfig.networkConfig.enableSM); wsConfig->setMaxMsgSize(gwConfig.maxAllowedMsgSize); wsConfig->setReconnectPeriod(gwConfig.reconnectTime); - // TODO: setHeartbeatPeriod, setSendMsgTimeout + // default HeartbeatPeriod is 10s wsConfig->setThreadPoolSize(gwConfig.networkConfig.threadPoolSize); // connected peers wsConfig->setConnectPeers(m_gatewayConfig->nodeIPEndpointSetPtr()); @@ -73,6 +73,7 @@ Service::Ptr GatewayFactory::buildService() const IGateway::Ptr GatewayFactory::build(ppc::front::IFrontBuilder::Ptr const& frontBuilder) const { auto service = buildService(); - return std::make_shared( - service, frontBuilder, std::make_shared(), m_config->agencyID()); + return std::make_shared(service, frontBuilder, + std::make_shared(), m_config->agencyID(), + m_config->seqSyncPeriod()); } \ No newline at end of file diff --git a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/GatewayImpl.cpp b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/GatewayImpl.cpp index effe4ece..bc6822b9 100644 --- a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/GatewayImpl.cpp +++ b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/GatewayImpl.cpp @@ -32,7 +32,8 @@ using namespace bcos::boostssl::ws; GatewayImpl::GatewayImpl(Service::Ptr const& service, ppc::front::IFrontBuilder::Ptr const& frontBuilder, - std::shared_ptr ioService, std::string const& agency) + std::shared_ptr ioService, std::string const& agency, + uint16_t seqSyncPeriod) : m_service(service), m_msgBuilder( std::dynamic_pointer_cast(service->messageFactory())), @@ -52,7 +53,7 @@ GatewayImpl::GatewayImpl(Service::Ptr const& service, boost::bind(&GatewayImpl::onReceiveBroadcastMessage, this, boost::placeholders::_1, boost::placeholders::_2)); m_gatewayRouterManager = std::make_shared( - m_service, m_gatewayInfoFactory, m_localRouter, m_peerRouter); + m_service, m_gatewayInfoFactory, m_localRouter, m_peerRouter, seqSyncPeriod); m_service->registerOnNewSession([this](WsSession::Ptr _session) { if (!_session) diff --git a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/GatewayImpl.h b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/GatewayImpl.h index e965bab3..061dd567 100644 --- a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/GatewayImpl.h +++ b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/GatewayImpl.h @@ -33,7 +33,8 @@ class GatewayImpl : public IGateway, public std::enable_shared_from_this; GatewayImpl(Service::Ptr const& service, ppc::front::IFrontBuilder::Ptr const& frontBuilder, - std::shared_ptr ioService, std::string const& agency); + std::shared_ptr ioService, std::string const& agency, + uint16_t seqSyncPeriod = 5000); ~GatewayImpl() override = default; void start() override; diff --git a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/GatewayRouterManager.cpp b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/GatewayRouterManager.cpp index 19553502..ad482cb5 100644 --- a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/GatewayRouterManager.cpp +++ b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/GatewayRouterManager.cpp @@ -31,11 +31,12 @@ using namespace bcos::boostssl::ws; GatewayRouterManager::GatewayRouterManager(Service::Ptr service, GatewayNodeInfoFactory::Ptr nodeStatusFactory, LocalRouter::Ptr localRouter, - PeerRouterTable::Ptr peerRouter) + PeerRouterTable::Ptr peerRouter, uint16_t seqSyncPeriod) : m_service(std::move(service)), m_nodeStatusFactory(std::move(nodeStatusFactory)), m_localRouter(std::move(localRouter)), - m_peerRouter(std::move(peerRouter)) + m_peerRouter(std::move(peerRouter)), + m_seqSyncPeriod(seqSyncPeriod) { m_service->registerMsgHandler((uint16_t)GatewayPacketType::SyncNodeSeq, boost::bind(&GatewayRouterManager::onReceiveNodeSeqMessage, this, boost::placeholders::_1, @@ -49,7 +50,7 @@ GatewayRouterManager::GatewayRouterManager(Service::Ptr service, boost::bind(&GatewayRouterManager::onRecvResponseNodeStatusMsg, this, boost::placeholders::_1, boost::placeholders::_2)); - m_timer = std::make_shared(SEQ_SYNC_PERIOD, "seqSync"); + m_timer = std::make_shared(m_seqSyncPeriod, "seqSync"); // broadcast seq periodically m_timer->registerTimeoutHandler([this]() { broadcastStatusSeq(); }); } diff --git a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/GatewayRouterManager.h b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/GatewayRouterManager.h index 679eb08e..4224c290 100644 --- a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/GatewayRouterManager.h +++ b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/GatewayRouterManager.h @@ -32,7 +32,8 @@ class GatewayRouterManager public: using Ptr = std::shared_ptr; GatewayRouterManager(Service::Ptr service, GatewayNodeInfoFactory::Ptr nodeStatusFactory, - LocalRouter::Ptr localRouter, PeerRouterTable::Ptr peerRouter); + LocalRouter::Ptr localRouter, PeerRouterTable::Ptr peerRouter, + uint16_t seqSyncPeriod = 5000); virtual void start(); virtual void stop(); @@ -66,7 +67,6 @@ class GatewayRouterManager std::map m_p2pID2Seq; mutable bcos::SharedMutex x_p2pID2Seq; - // TODO: make this configurable - unsigned const SEQ_SYNC_PERIOD = 3000; + uint16_t m_seqSyncPeriod; }; } // namespace ppc::gateway \ No newline at end of file diff --git a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/router/RouterManager.cpp b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/router/RouterManager.cpp index b4518cb2..3c5f3b94 100644 --- a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/router/RouterManager.cpp +++ b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/router/RouterManager.cpp @@ -172,14 +172,29 @@ void RouterManager::onP2PNodesUnreachable(std::set const& _p2pNodeI ReadGuard readGuard(x_unreachableHandlers); handlers = m_unreachableHandlers; } - // TODO: async here - for (auto const& node : _p2pNodeIDs) - { - for (auto const& it : m_unreachableHandlers) + auto self = weak_from_this(); + m_service->threadPool()->enqueue([self, _p2pNodeIDs]() { + try { - it(node); + auto mgr = self.lock(); + if (!mgr) + { + return; + } + for (auto const& node : _p2pNodeIDs) + { + for (auto const& it : mgr->m_unreachableHandlers) + { + it(node); + } + } } - } + catch (std::exception const& e) + { + SERVICE_ROUTER_LOG(WARNING) << LOG_DESC("call unreachable handlers error for ") + << boost::diagnostic_information(e); + } + }); } catch (std::exception const& e) { diff --git a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/router/RouterManager.h b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/router/RouterManager.h index ab50a887..d55841db 100644 --- a/cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/router/RouterManager.h +++ b/cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/router/RouterManager.h @@ -21,11 +21,12 @@ #pragma once #include "../Service.h" #include "RouterTableInterface.h" +#include #include namespace ppc::gateway { -class RouterManager +class RouterManager : public std::enable_shared_from_this { public: using Ptr = std::shared_ptr; @@ -63,6 +64,7 @@ class RouterManager private: // for message forward Service::Ptr m_service; + std::shared_ptr m_routerTimer; // called when the given node unreachable diff --git a/cpp/wedpr-transport/ppc-gateway/test/demo/gateway_demo.cpp b/cpp/wedpr-transport/ppc-gateway/test/demo/gateway_demo.cpp index bb8aca0e..3d702dc7 100644 --- a/cpp/wedpr-transport/ppc-gateway/test/demo/gateway_demo.cpp +++ b/cpp/wedpr-transport/ppc-gateway/test/demo/gateway_demo.cpp @@ -41,7 +41,7 @@ inline static PPCMessageFace::Ptr buildMessage(std::string _taskID, uint32_t _se auto message = messageFactory->buildPPCMessage(); message->setVersion(1); message->setTaskType(uint8_t(protocol::TaskType::PSI)); - message->setAlgorithmType(uint8_t(protocol::PSIAlgorithmType::CM_PSI_2PC)); + message->setAlgorithmType(uint8_t(protocol::TaskAlgorithmType::CM_PSI_2PC)); message->setMessageType(4); message->setSeq(_seq); message->setTaskID(_taskID); @@ -84,7 +84,7 @@ int main(int argc, char* argv[]) front->start(); std::atomic flag = 0; - front->registerMessageHandler(uint8_t(TaskType::PSI), uint8_t(PSIAlgorithmType::CM_PSI_2PC), + front->registerMessageHandler(uint8_t(TaskType::PSI), uint8_t(TaskAlgorithmType::CM_PSI_2PC), [&flag](const PPCMessageFace::Ptr& _message) { std::cout << "message received\n" << "type: " << unsigned(_message->messageType()) << std::endl; diff --git a/cpp/wedpr-transport/ppc-rpc/src/Rpc.cpp b/cpp/wedpr-transport/ppc-rpc/src/Rpc.cpp index f2a78a09..5b039131 100644 --- a/cpp/wedpr-transport/ppc-rpc/src/Rpc.cpp +++ b/cpp/wedpr-transport/ppc-rpc/src/Rpc.cpp @@ -191,7 +191,7 @@ void Rpc::runTask(Json::Value const& _req, RespFunc _respFunc) oss << "The specified task algorithm not been implemented or disabled, type: " << (ppc::protocol::TaskType)(task->type()) << "(" << std::to_string(task->type()) << ")"; - oss << ", algorithm: " << (ppc::protocol::PSIAlgorithmType)(task->algorithm()) << "(" + oss << ", algorithm: " << (ppc::protocol::TaskAlgorithmType)(task->algorithm()) << "(" << std::to_string(task->algorithm()) << ")"; auto errorMsg = oss.str(); RPC_LOG(WARNING) << errorMsg; @@ -249,7 +249,7 @@ void Rpc::asyncRunTask(Json::Value const& _req, RespFunc _respFunc) oss << "The specified task algorithm not been implemented or disabled, type: " << (ppc::protocol::TaskType)(task->type()) << "(" << std::to_string(task->type()) << ")"; - oss << ", algorithm: " << (ppc::protocol::PSIAlgorithmType)(task->algorithm()) << "(" + oss << ", algorithm: " << (ppc::protocol::TaskAlgorithmType)(task->algorithm()) << "(" << std::to_string(task->algorithm()) << ")"; auto errorMsg = oss.str(); RPC_LOG(WARNING) << errorMsg; diff --git a/cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/java/com/webank/wedpr/sdk/jni/transport/impl/TransportImpl.java b/cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/java/com/webank/wedpr/sdk/jni/transport/impl/TransportImpl.java index 7f3ceb28..e44fccec 100644 --- a/cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/java/com/webank/wedpr/sdk/jni/transport/impl/TransportImpl.java +++ b/cpp/wedpr-transport/sdk-wrapper/java/bindings/src/main/java/com/webank/wedpr/sdk/jni/transport/impl/TransportImpl.java @@ -69,7 +69,6 @@ public void stop() { } /** - * TODO: register the component * * @param component the component used to router * @throws Exception failed case @@ -80,7 +79,6 @@ public void registerComponent(String component) { } /** - * TODO: unregister the component * * @param component the component used to route * @throws Exception failed case