Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/salticidae/cmake/Modules/")

add_subdirectory(salticidae)
include_directories(salticidae/include)
include_directories(/opt/homebrew/opt/salticidae@31/include)

find_package(OpenSSL REQUIRED)
find_package(Threads REQUIRED)
Expand All @@ -46,6 +46,9 @@ add_dependencies(secp256k1 libsecp256k1)

include_directories(./)
include_directories(include)
include_directories(/opt/homebrew/opt/openssl@3/include/)
include_directories(/opt/homebrew/opt/libuv/include/)

add_library(hotstuff
OBJECT
src/util.cpp
Expand All @@ -61,11 +64,11 @@ if(BUILD_SHARED)
set_property(TARGET hotstuff PROPERTY POSITION_INDEPENDENT_CODE 1)
add_library(hotstuff_shared SHARED $<TARGET_OBJECTS:hotstuff>)
set_target_properties(hotstuff_shared PROPERTIES OUTPUT_NAME "hotstuff")
target_link_libraries(hotstuff_shared salticidae_static secp256k1 crypto ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(hotstuff_shared secp256k1 crypto ${CMAKE_THREAD_LIBS_INIT} /opt/homebrew/opt/salticidae@31/lib/libsalticidae.a)
endif()
add_library(hotstuff_static STATIC $<TARGET_OBJECTS:hotstuff>)
set_target_properties(hotstuff_static PROPERTIES OUTPUT_NAME "hotstuff")
target_link_libraries(hotstuff_static salticidae_static secp256k1 crypto ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(hotstuff_static secp256k1 crypto ${CMAKE_THREAD_LIBS_INIT} /opt/homebrew/opt/salticidae@31/lib/libsalticidae.a)

add_subdirectory(test)

Expand All @@ -91,11 +94,11 @@ endif()
# build tools
add_executable(hotstuff-keygen
src/hotstuff_keygen.cpp)
target_link_libraries(hotstuff-keygen hotstuff_static)
target_link_libraries(hotstuff-keygen hotstuff_static /opt/homebrew/opt/salticidae@31/lib/libsalticidae.a)

add_executable(hotstuff-tls-keygen
src/hotstuff_tls_keygen.cpp)
target_link_libraries(hotstuff-tls-keygen hotstuff_static)
target_link_libraries(hotstuff-tls-keygen hotstuff_static /opt/homebrew/opt/salticidae@31/lib/libsalticidae.a)

find_package(Doxygen)
if (DOXYGEN_FOUND)
Expand Down
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM debian:bullseye-slim as hotstuff
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install git gcc g++ make cmake libuv1-dev libssl-dev libsodium-dev autoconf libnet1-dev libtool pastebinit python3 bash gdb dnsutils nano inetutils-ping net-tools sudo iproute2
RUN git clone https://github.com/aixoss/gmp && cd gmp && ./configure && make install
RUN git clone https://github.com/hot-stuff/libhotstuff.git && cd libhotstuff && git submodule update --init --recursive && git submodule update --recursive --remote
RUN cd libhotstuff && cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED=ON -DHOTSTUFF_PROTO_LOG=ON && make

ADD ./scripts /
COPY ./scripts /libhotstuff/examples
COPY ./hotstuff.conf /libhotstuff
ENTRYPOINT ["/run_demo.sh"]


FROM debian:bullseye-slim as hotstuff_client
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install git gcc g++ make cmake libuv1-dev libssl-dev libsodium-dev autoconf libnet1-dev libtool pastebinit python3 bash gdb dnsutils nano inetutils-ping net-tools sudo iproute2
RUN git clone https://github.com/aixoss/gmp && cd gmp && ./configure && make install
RUN git clone https://github.com/hot-stuff/libhotstuff.git && cd libhotstuff && git submodule update --init --recursive && git submodule update --recursive --remote
RUN cd libhotstuff && cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED=ON -DHOTSTUFF_PROTO_LOG=ON && make

ADD ./scripts /
COPY ./scripts /libhotstuff/examples
COPY ./hotstuff.conf /libhotstuff
ENTRYPOINT ["/run_demo_client.sh"]
41 changes: 41 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: '1'
services:
hotstuff_container1:
image: hotstuff
environment:
- IMAGE_IDX=0
networks:
hotstuff_network:
ipv4_address: 172.18.0.2
hotstuff_container2:
image: hotstuff
environment:
- IMAGE_IDX=1
networks:
hotstuff_network:
ipv4_address: 172.18.0.3
hotstuff_container3:
image: hotstuff
environment:
- IMAGE_IDX=2
networks:
hotstuff_network:
ipv4_address: 172.18.0.4
hotstuff_container4:
image: hotstuff
environment:
- IMAGE_IDX=3
networks:
hotstuff_network:
ipv4_address: 172.18.0.5
hotstuff_client:
image: hotstuff_client
networks:
hotstuff_network:
ipv4_address: 172.18.0.6
networks:
hotstuff_network:
ipam:
driver: default
config:
- subnet: 172.18.0.0/16
8 changes: 4 additions & 4 deletions hotstuff.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
block-size = 1
pace-maker = rr
replica = 127.0.0.1:10000;20000, 039f89215177475ac408d079b45acef4591fc477dd690f2467df052cf0c7baba23, 542865a568784c4e77c172b82e99cb8a1a53b7bee5f86843b04960ea4157f420
replica = 127.0.0.1:10001;20001, 0278740a5bec75e333b3c93965b1609163b15d2e3c2fdef141d4859ec70c238e7a, c261250345ebcd676a0edeea173526608604f626b2e8bc4fd2142d3bde1d44d5
replica = 127.0.0.1:10002;20002, 0269eb606576a315a630c2483deed35cc4bd845abae1c693f97c440c89503fa92e, 065b010aed5629edfb5289e8b22fc6cc6b33c4013bfdd128caba80c3c02d6d78
replica = 127.0.0.1:10003;20003, 03e6911bf17e632eecdfa0dc9fc6efc9ddca60c0e3100db469a3d3d62008044a53, 6540a0fea67efcb08f53ec3a952df4c3f0e2e07c2778fd92320807717e29a651
replica = 172.18.0.2:10000;20000, 039f89215177475ac408d079b45acef4591fc477dd690f2467df052cf0c7baba23, 542865a568784c4e77c172b82e99cb8a1a53b7bee5f86843b04960ea4157f420
replica = 172.18.0.3:10001;20001, 0278740a5bec75e333b3c93965b1609163b15d2e3c2fdef141d4859ec70c238e7a, c261250345ebcd676a0edeea173526608604f626b2e8bc4fd2142d3bde1d44d5
replica = 172.18.0.4:10002;20002, 0269eb606576a315a630c2483deed35cc4bd845abae1c693f97c440c89503fa92e, 065b010aed5629edfb5289e8b22fc6cc6b33c4013bfdd128caba80c3c02d6d78
replica = 172.18.0.5:10003;20003, 03e6911bf17e632eecdfa0dc9fc6efc9ddca60c0e3100db469a3d3d62008044a53, 6540a0fea67efcb08f53ec3a952df4c3f0e2e07c2778fd92320807717e29a651
18 changes: 6 additions & 12 deletions scripts/run_demo.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
#!/bin/bash
rep=({0..3})
if [[ $# -gt 0 ]]; then
rep=($@)
fi

i=${IMAGE_IDX:=1}
# avoid stack overflow as in our simple demo the bootstrapping replica will
# potentially have a long chain of promise resolution
ulimit -s unlimited

for i in "${rep[@]}"; do
echo "starting replica $i"
#valgrind --leak-check=full ./examples/hotstuff-app --conf hotstuff-sec${i}.conf > log${i} 2>&1 &
#gdb -ex r -ex bt -ex q --args ./examples/hotstuff-app --conf hotstuff-sec${i}.conf > log${i} 2>&1 &
./examples/hotstuff-app --conf ./hotstuff-sec${i}.conf > log${i} 2>&1 &
done
wait
echo "starting replica $i"
#valgrind --leak-check=full ./examples/hotstuff-app --conf hotstuff-sec${i}.conf > log${i} 2>&1 &
#gdb -ex r -ex bt -ex q --args ./examples/hotstuff-app --conf hotstuff-sec${i}.conf > log${i} 2>&1 &
cd libhotstuff
./examples/hotstuff-app --conf "./hotstuff-sec${i}.conf" > "logs" 2>&1
2 changes: 1 addition & 1 deletion scripts/run_demo_client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
# rotation will be scheduled. Try to kill and run run_demo_client.sh again, new
# commands should still get through (be replicated) once the new leader becomes
# stable.

cd libhotstuff
./examples/hotstuff-client --idx 0 --iter -1 --max-async 4