diff --git a/dev-setup.sh b/dev-setup.sh index 15840863..a03f3434 100755 --- a/dev-setup.sh +++ b/dev-setup.sh @@ -20,15 +20,6 @@ sudo cp -r $cmake/bin/* /usr/local/bin/ sudo cp -r $cmake/share/* /usr/local/share/ rm $cmake.tar.gz && rm -r $cmake -# Libsodium -wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable.tar.gz -tar -zxvf libsodium-1.0.18-stable.tar.gz -pushd libsodium-stable > /dev/null 2>&1 -./configure && make -sudo make install -popd > /dev/null 2>&1 -rm libsodium-1.0.18-stable.tar.gz && rm -r libsodium-stable - # Blake3 git clone https://github.com/BLAKE3-team/BLAKE3.git pushd BLAKE3/c > /dev/null 2>&1 @@ -63,19 +54,6 @@ sudo chmod +x /usr/local/bin/flatc popd > /dev/null 2>&1 rm v1.12.0.tar.gz && rm -r flatbuffers-1.12.0 -# libfuse -sudo apt-get install -y meson ninja-build pkg-config -wget https://github.com/libfuse/libfuse/archive/fuse-3.8.0.tar.gz -tar -zxvf fuse-3.8.0.tar.gz -pushd libfuse-fuse-3.8.0 > /dev/null 2>&1 -mkdir build -pushd build > /dev/null 2>&1 -meson .. && ninja -sudo ninja install -popd > /dev/null 2>&1 -popd > /dev/null 2>&1 -rm fuse-3.8.0.tar.gz && rm -r libfuse-fuse-3.8.0 - # Reader-Writer queue wget https://github.com/cameron314/readerwriterqueue/archive/v1.0.3.tar.gz tar -zxvf v1.0.3.tar.gz @@ -104,11 +82,12 @@ sudo cp -r include/plog /usr/local/include/ popd > /dev/null 2>&1 rm 1.1.5.tar.gz && rm -r plog-1.1.5 -# Boost stacktrace -sudo apt-get install -y libboost-stacktrace-dev - -# Sqlite -sudo apt-get install -y sqlite3 libsqlite3-dev +# Library dependencies. +sudo apt-get install -y \ + libsodium-dev \ + sqlite3 libsqlite3-dev \ + libboost-stacktrace-dev \ + fuse3 # jq command (needed for remote cluster scripts) sudo apt-get install -y jq diff --git a/src/consensus.cpp b/src/consensus.cpp index d5d98ea0..d84ea535 100644 --- a/src/consensus.cpp +++ b/src/consensus.cpp @@ -1075,7 +1075,7 @@ namespace consensus } } - if (winning_votes < 2) // min_votes_required + if (winning_votes < min_votes_required) { LOG_INFO << "No consensus on last shard hash. Possible fork condition. won:" << winning_votes << " needed:" << min_votes_required; return false; diff --git a/test/docker/.gitignore b/test/docker/.gitignore deleted file mode 100644 index c5e82d74..00000000 --- a/test/docker/.gitignore +++ /dev/null @@ -1 +0,0 @@ -bin \ No newline at end of file diff --git a/test/docker/Dockerfile.ubt.20.04 b/test/docker/Dockerfile.ubt.20.04 index 892a68e9..b5bbdcad 100644 --- a/test/docker/Dockerfile.ubt.20.04 +++ b/test/docker/Dockerfile.ubt.20.04 @@ -3,12 +3,14 @@ FROM ubuntu:focal COPY libblake3.so /usr/local/lib/ -RUN apt-get update && apt-get install -y \ - libssl1.1 \ - sqlite3 \ - fuse3 - -RUN mkdir /usr/local/bin/hotpocket +RUN apt-get update \ + && apt-get install --no-install-recommends -y \ + libssl1.1 \ + sqlite3 \ + fuse3 \ + && rm -rf /var/lib/apt/lists/* \ + && mkdir /usr/local/bin/hotpocket + COPY hpcore hpfs hpws appbill /usr/local/bin/hotpocket/ ENTRYPOINT ["/usr/local/bin/hotpocket/hpcore"] diff --git a/test/docker/Dockerfile.ubt.20.04-njs b/test/docker/Dockerfile.ubt.20.04-njs new file mode 100644 index 00000000..9a025f9c --- /dev/null +++ b/test/docker/Dockerfile.ubt.20.04-njs @@ -0,0 +1,6 @@ +# HotPocket (Ubuntu 20.04) + NodeJs + +FROM hotpocketdev/hotpocket:ubt.20.04 + +# Copy the node binary from build context to the container image. +COPY node /usr/bin/ \ No newline at end of file diff --git a/test/docker/Dockerfile.ubt.20.04-njs.14 b/test/docker/Dockerfile.ubt.20.04-njs.14 deleted file mode 100644 index 8f0022d3..00000000 --- a/test/docker/Dockerfile.ubt.20.04-njs.14 +++ /dev/null @@ -1,7 +0,0 @@ -# HotPocket (Ubuntu 20.04) + NodeJs 14.x - -FROM hotpocketdev/hotpocket:ubt.20.04 - -RUN apt-get install -y curl -RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash - -RUN apt-get install -y nodejs diff --git a/test/docker/build.sh b/test/docker/build.sh index 2bc5c976..23133c50 100755 --- a/test/docker/build.sh +++ b/test/docker/build.sh @@ -3,12 +3,20 @@ hpcoredir=$(realpath ../..) repo=hotpocketdev/hotpocket -# Build base Ubuntu image. -mkdir -p bin -cp $hpcoredir/build/{hpcore,appbill} $hpcoredir/test/bin/{hpfs,hpws,libblake3.so} ./bin/ -strip ./bin/hpcore -docker build -t $repo:ubt.20.04 -f ./Dockerfile.ubt.20.04 ./bin -rm -r bin +# Prepare build context +tmp=$(mktemp -d) +cp $hpcoredir/build/{hpcore,appbill} $hpcoredir/test/bin/{hpfs,hpws,libblake3.so} $tmp/ +strip $tmp/hpcore -# NodeJs image. -docker build -t $repo:ubt.20.04-njs.14 -f ./Dockerfile.ubt.20.04-njs.14 . \ No newline at end of file +# Ubuntu base image +docker build -t $repo:ubt.20.04 -f ./Dockerfile.ubt.20.04 $tmp/ +rm -r $tmp/* + +# NodeJs image +# Download and place the nodejs binary in the build context. +curl -fsSL -o $tmp/nodejs.tar.xz https://nodejs.org/dist/v14.17.3/node-v14.17.3-linux-x64.tar.xz +tar -xvJf $tmp/nodejs.tar.xz --strip-components=2 -C $tmp/ node-v14.17.3-linux-x64/bin/node +rm $tmp/nodejs.tar.xz +docker build -t $repo:ubt.20.04-njs.14 -f ./Dockerfile.ubt.20.04-njs $tmp + +rm -r $tmp \ No newline at end of file diff --git a/test/local-cluster/Dockerfile b/test/local-cluster/Dockerfile index b9ef6cc5..cc9019ce 100644 --- a/test/local-cluster/Dockerfile +++ b/test/local-cluster/Dockerfile @@ -7,5 +7,5 @@ ENTRYPOINT ["/usr/local/bin/hotpocket/hpcore"] # Run with valgrind -# RUN apt-get install -y gdb valgrind +# RUN apt-get install --no-install-recommends -y gdb valgrind # ENTRYPOINT ["valgrind", "/usr/local/bin/hotpocket/hpcore"] \ No newline at end of file