Skip to content

Commit b1d307f

Browse files
authored
fix ecdh psi coredump (#115)
* test docker.yml * update vcpkg docker * disable default features * update vcpkg-cache dockerfile * fix ecdh psi coredump
1 parent 435d124 commit b1d307f

File tree

7 files changed

+78
-28
lines changed

7 files changed

+78
-28
lines changed

.github/workflows/cpp_full_node_workflow.yml

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,13 @@ jobs:
8686
if: runner.os == 'macOS'
8787
run: |
8888
bash -x cpp/tools/install_depends.sh -o macos
89+
brew install libiconv m4 automake autoconf libtool
90+
echo "## m4:"`which m4`
91+
export DYLD_LIBRARY_PATH=/usr/local/opt/libiconv/lib:${DYLD_LIBRARY_PATH}
92+
export LDFLAGS="-L/usr/local/opt/libiconv/lib"
93+
export CPPFLAGS="-I/usr/local/opt/libiconv/include"
8994
mkdir -p cpp/build && cd cpp/build
90-
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path) && cmake -DBUILD_STATIC=ON -DTESTS=ON -DCOVERAGE=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../
95+
cmake -DBUILD_STATIC=ON -DTESTS=ON -DCOVERAGE=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../
9196
make -j3
9297
- name: Publish Error
9398
if: always()
@@ -125,9 +130,14 @@ jobs:
125130
uses: actions/upload-artifact@v4
126131
with:
127132
name: build-x64-osx-dbg-err.log
128-
path: /Users/runner/work/WeDPR-Component/WeDPR-Component/vcpkg/buildtrees/gsasl/build-x64-osx-dbg-err.log
133+
path: /Users/runner/work/WeDPR-Component/WeDPR-Component/vcpkg/buildtrees/gsasl/build-x64-osx-dbg-err.log
134+
- name: Publish Error macos
135+
if: always()
136+
uses: actions/upload-artifact@v4
137+
with:
138+
name: autoconf-x64-osx-err.log
139+
path: /Users/runner/work/WeDPR-Component/WeDPR-Component/vcpkg/buildtrees/gsasl/autoconf-x64-osx-err.log
129140

130-
131141
build_centos:
132142
name: build_centos full node
133143
runs-on: ubuntu-latest
@@ -178,7 +188,7 @@ jobs:
178188
yum update -y
179189
yum install -y epel-release centos-release-scl centos-release-scl-rh
180190
yum install -y https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
181-
yum install -y wget java-11-openjdk-devel git autoconf automake make gcc gcc-c++ glibc-static glibc-devel cmake3 ccache devtoolset-11 libzstd-devel zlib-devel flex bison python-devel python3-devel
191+
yum install -y libtool wget java-11-openjdk-devel git autoconf automake make gcc gcc-c++ glibc-static glibc-devel cmake3 ccache devtoolset-11 libzstd-devel zlib-devel flex bison python-devel python3-devel
182192
- uses: actions-rs/toolchain@v1
183193
with:
184194
toolchain: nightly-2022-07-28
@@ -200,6 +210,13 @@ jobs:
200210
df /tmp
201211
du /tmp | sort -n
202212
ls -lh /tmp
213+
- name: upgradeDepends
214+
run: |
215+
wget http://ftp.gnu.org/gnu/automake/automake-1.14.1.tar.gz
216+
tar -xf automake-1.14.1.tar.gz
217+
cd automake-1.14.1
218+
./configure && make -j4 && make install
219+
cd ..
203220
- name: DependenciesBuild
204221
run: |
205222
bash -x cpp/tools/install_depends.sh -o centos
@@ -212,13 +229,13 @@ jobs:
212229
- name: FreeDiskSpace
213230
run: |
214231
df -lh
215-
du -sch /usr/local/share/vcpkg/buildtrees/*
216-
du -sch /usr/local/share/vcpkg/buildtrees/grpc/src/*
217-
rm -rf /usr/local/share/vcpkg/buildtrees/grpc/src
218-
rm -rf /usr/local/share/vcpkg/buildtrees/grpc/*-dbg
219-
rm -rf /usr/local/share/vcpkg/buildtrees/openssl/src
220-
rm -rf /usr/local/share/vcpkg/buildtrees/openssl/*-dbg
221-
rm -rf /usr/local/share/vcpkg/buildtrees/*/*-dbg
232+
du -sch /__w/WeDPR-Component/WeDPR-Component/vcpkg/buildtrees/*
233+
du -sch /__w/WeDPR-Component/WeDPR-Component/vcpkg/buildtrees/grpc/src/*
234+
rm -rf /__w/WeDPR-Component/WeDPR-Component/vcpkg/buildtrees/grpc/src
235+
rm -rf /__w/WeDPR-Component/WeDPR-Component/vcpkg/buildtrees/grpc/*-dbg
236+
rm -rf /__w/WeDPR-Component/WeDPR-Component/vcpkg/buildtrees/openssl/src
237+
rm -rf /__w/WeDPR-Component/WeDPR-Component/vcpkg/buildtrees/openssl/*-dbg
238+
rm -rf /__w/WeDPR-Component/WeDPR-Component/vcpkg/buildtrees/*/*-dbg
222239
df -lh
223240
- name: Compile
224241
run: |
@@ -246,4 +263,10 @@ jobs:
246263
uses: actions/upload-artifact@v4
247264
with:
248265
name: vcpkg-manifest-install.log
249-
path: /__w/WeDPR-Component/WeDPR-Component/cpp/build/vcpkg-manifest-install.log
266+
path: /__w/WeDPR-Component/WeDPR-Component/cpp/build/vcpkg-manifest-install.log
267+
- name: Publish Error macos
268+
if: always()
269+
uses: actions/upload-artifact@v4
270+
with:
271+
name: autoconf-x64-linux-err.log
272+
path: /__w/WeDPR-Component/WeDPR-Component/vcpkg/buildtrees/gsasl/autoconf-x64-linux-err.log

.github/workflows/docker.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
- "README.md"
88
tags:
99
- 'v3.*.*'
10+
branches:
11+
- feature-milestone2-gateway
1012
pull_request:
1113
paths-ignore:
1214
- "docs/**"
@@ -25,12 +27,10 @@ env:
2527
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
2628
ACTIONS_RUNNER_FORCED_INTERNAL_NODE_VERSION: node16
2729
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
28-
# Use docker.io for Docker Hub if empty
29-
REGISTRY: ghcr.io
3030

3131
jobs:
3232
build-docker:
33-
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
33+
if: github.event.pull_request.merged == true || github.event_name == 'push'
3434
runs-on: ubuntu-latest
3535
steps:
3636
- name: Checkout
@@ -43,7 +43,6 @@ jobs:
4343
- name: Login to Docker Hub
4444
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3
4545
with:
46-
registry: ${{ env.REGISTRY }}
4746
username: ${{ secrets.DOCKER_FISCOPR_USER }}
4847
password: ${{ secrets.DOCKER_FISCOPR_TOKEN }}
4948
- name: Get git tag
@@ -70,7 +69,7 @@ jobs:
7069
GW_DOCKER_TAG="fiscoorg/wedpr-gateway-service:${GW_DOCKER_TAG}"
7170
echo "* Begin to build wedpr-gateway-service docker: ${GW_DOCKER_TAG}"
7271
cd docker-files/cpp/
73-
docker build --build-arg SOURCE_BRANCH=${BRANCH_NAME} --target wedpr-gateway-service -t ${GW_DOCKER_TAG} .
72+
docker build --no-cache --build-arg SOURCE_BRANCH=${BRANCH_NAME} --target wedpr-gateway-service -t ${GW_DOCKER_TAG} .
7473
echo "* Build wedpr-gateway-service docker: ${GW_DOCKER_TAG} success"
7574
docker push ${GW_DOCKER_TAG}
7675
echo "* Push wedpr-gateway-service docker: ${GW_DOCKER_TAG} success"

cpp/vcpkg.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@
131131
},
132132
"tarscpp",
133133
"tbb",
134-
"libiconv",
135134
"gsasl"
136135
]
137136
},

cpp/wedpr-computing/ppc-psi/src/ecdh-multi-psi/EcdhMultiCache.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,15 +328,23 @@ bool CalculatorCache::tryToFinalize()
328328
{
329329
continue;
330330
}
331+
auto data = getPlainDataByIndex(it.second.plainDataIndex);
331332
if (it.second.plainDataIndex > 0)
332333
{
333-
m_intersectionResult.emplace_back(getPlainDataByIndex(it.second.plainDataIndex));
334+
m_intersectionResult.emplace_back(data);
334335
}
335-
// means the header field, swap with the first element
336336
if (it.second.plainDataIndex == 0)
337337
{
338-
m_intersectionResult.emplace_back(m_intersectionResult[0]);
339-
m_intersectionResult[0] = getPlainDataByIndex(it.second.plainDataIndex);
338+
// means the header field, swap with the first element
339+
if (m_intersectionResult.size() > 0)
340+
{
341+
m_intersectionResult.emplace_back(m_intersectionResult[0]);
342+
m_intersectionResult[0] = data;
343+
}
344+
else
345+
{
346+
m_intersectionResult.emplace_back(data);
347+
}
340348
}
341349
}
342350
m_cacheState = CacheState::Finalized;

docker-files/cpp/Dockerfile

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM fiscoorg/wedpr-component-vcpkg-cache:v3.0.0 as builder
1+
FROM ubuntu:22.04 as builder
22

33
44

@@ -8,13 +8,31 @@ ARG SOURCE_BRANCH
88
ENV DEBIAN_FRONTEND=noninteractive \
99
SOURCE=${SOURCE_BRANCH:-main}
1010

11-
RUN git clone https://github.com/WeBankBlockchain/WeDPR-Component --recursive --depth=1 -b ${SOURCE} \
11+
# Note: depends on python3; default jdk for jni
12+
RUN apt-get -q update && apt-get install -qy --no-install-recommends \
13+
vim curl lcov git make nasm build-essential cmake wget libtool ca-certificates python3.11 python3-dev \
14+
libgmp-dev flex bison patch libzstd-dev unzip ninja-build pkg-config zip tar ccache uuid-runtime automake autoconf \
15+
m4 tcpdump net-tools gcc g++ default-jdk \
16+
&& ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
17+
&& apt-get install -qy --no-install-recommends tzdata \
18+
&& dpkg-reconfigure --frontend noninteractive tzdata \
19+
&& rm -rf /var/lib/apt/lists/*
20+
21+
# install rust
22+
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
23+
24+
ENV PATH="/root/.cargo/bin:${PATH}"
25+
26+
ENV VCPKG_FORCE_SYSTEM_BINARIES=1
27+
28+
RUN git clone https://github.com/WeBankBlockchain/WeDPR-Component --recursive --depth=1 -b ${SOURCE}
29+
1230
# ln the cached vcpkg and compile
13-
RUN cd WeDPR-Component/cpp && rm -rf vcpkg && ln -s /vcpkg \
31+
RUN cd WeDPR-Component/cpp \
1432
&& mkdir -p build && cd build \
15-
&& cmake .. -DBUILD_STATIC=ON \
33+
&& cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC=ON \
1634
&& make -j8
17-
35+
1836
FROM ubuntu:22.04 as wedpr-gateway-service
1937
2038

docker-files/cpp/vcpkg/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ RUN git clone https://github.com/cyjseagull/WeDPR-Component --recursive --depth=
3232
# move the vcpkg dependecies to /vcpkg
3333
RUN mv /WeDPR-Component/cpp/vcpkg /
3434

35+
# remove the WeDPR-Component
36+
RUN rm -rf /WeDPR-Component/ && rm -rf /vcpkg/buildtrees/*/src && rm -rf /vcpkg/buildtrees/*/*-dbg
37+

docker-files/model/model/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM wedpr-model-service-base-image:v3.0.0 as wedpr-model-service
1+
FROM fiscoorg/wedpr-model-service-base-image:v3.0.0 as wedpr-model-service
22
33

44
ENV LANG zh_CN.UTF-8

0 commit comments

Comments
 (0)