Skip to content

Commit

Permalink
Merge pull request #216 from skalenetwork/skaled-1855-release-build
Browse files Browse the repository at this point in the history
fix release build
  • Loading branch information
olehnikolaiev authored Dec 17, 2024
2 parents 4b92594 + 932308e commit 4a5c980
Show file tree
Hide file tree
Showing 8 changed files with 132 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
export CXX=g++-11
export TARGET=all
mkdir -p build && cd build
cmake ..
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
- name: Build
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.info
osx_build_and_test:
runs-on: macos-12
runs-on: macos-13
steps:
- name: Extract repo name
run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F /
Expand Down
100 changes: 54 additions & 46 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,48 +91,48 @@ endif()
set( CLANG_FORMAT_EXCLUDE_PATTERNS
${CMAKE_BINARY_DIR}
${DEPS_SOURCES_ROOT}
)
)
include( BlsFindClangFormat )

set( TOOLS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tools/")
set( DKG_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dkg/")

set(sourses_bls
bls/bls.cpp
bls/BLSPrivateKeyShare.cpp
bls/BLSPrivateKey.cpp
bls/BLSPublicKeyShare.cpp
bls/BLSPublicKey.cpp
bls/BLSSignature.cpp
bls/BLSSigShare.cpp
bls/BLSSigShareSet.cpp
dkg/dkg.cpp
dkg/DKGBLSWrapper.cpp
dkg/DKGBLSSecret.cpp
third_party/cryptlite/base64.cpp
tools/utils.cpp
)
bls/bls.cpp
bls/BLSPrivateKeyShare.cpp
bls/BLSPrivateKey.cpp
bls/BLSPublicKeyShare.cpp
bls/BLSPublicKey.cpp
bls/BLSSignature.cpp
bls/BLSSigShare.cpp
bls/BLSSigShareSet.cpp
dkg/dkg.cpp
dkg/DKGBLSWrapper.cpp
dkg/DKGBLSSecret.cpp
third_party/cryptlite/base64.cpp
tools/utils.cpp
)

set(headers_bls
libBLS.h
bls/bls.h
bls/BLSPrivateKeyShare.h
bls/BLSPrivateKey.h
bls/BLSPublicKeyShare.h
bls/BLSPublicKey.h
bls/BLSSignature.h
bls/BLSSigShare.h
bls/BLSSigShareSet.h
dkg/dkg.h
dkg/DKGBLSWrapper.h
dkg/DKGBLSSecret.h
third_party/json.hpp
third_party/cryptlite/sha256.h
third_party/cryptlite/sha1.h
third_party/cryptlite/hmac.h
third_party/cryptlite/base64.h
tools/utils.h
)
libBLS.h
bls/bls.h
bls/BLSPrivateKeyShare.h
bls/BLSPrivateKey.h
bls/BLSPublicKeyShare.h
bls/BLSPublicKey.h
bls/BLSSignature.h
bls/BLSSigShare.h
bls/BLSSigShareSet.h
dkg/dkg.h
dkg/DKGBLSWrapper.h
dkg/DKGBLSSecret.h
third_party/json.hpp
third_party/cryptlite/sha256.h
third_party/cryptlite/sha1.h
third_party/cryptlite/hmac.h
third_party/cryptlite/base64.h
tools/utils.h
)

set(PROJECT_VERSION 0.2.0)
add_definitions(-DBLS_VERSION=${PROJECT_VERSION})
Expand Down Expand Up @@ -164,16 +164,16 @@ else()
set( BOOST_LIBS_4_BLS boost_program_options )
endif()

set (WITH_PROCPS OFF)
set(WITH_PROCPS OFF)

set(BLS_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/bls
${DEPS_SOURCES_ROOT}
${DEPS_INSTALL_ROOT}
${CMAKE_CURRENT_SOURCE_DIR}/deps/include
PARENT_SCOPE
)
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/bls
${DEPS_SOURCES_ROOT}
${DEPS_INSTALL_ROOT}
${CMAKE_CURRENT_SOURCE_DIR}/deps/include
PARENT_SCOPE
)

target_include_directories(bls PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(bls PRIVATE ff ${CRYPTOPP_LIBRARY} ${GMPXX_LIBRARY} ${GMP_LIBRARY})
Expand Down Expand Up @@ -245,7 +245,9 @@ if(BUILD_TESTS)
if (EMSCRIPTEN)
target_compile_options(bls_unit_test PRIVATE -s DISABLE_EXCEPTION_CATCHING=1)
set_target_properties(bls_unit_test PROPERTIES LINK_FLAGS "-s DISABLE_EXCEPTION_CATCHING=1")
endif()
else()
target_compile_options(bls_unit_test PRIVATE -Wno-format-overflow)
endif()
target_link_libraries(bls_unit_test PRIVATE bls ${CRYPTOPP_LIBRARY} ff ${GMPXX_LIBRARY} ${GMP_LIBRARY} ${BOOST_LIBS_4_BLS})

add_test(NAME bls_tests COMMAND bls_unit_test)
Expand All @@ -255,7 +257,9 @@ if(BUILD_TESTS)
if (EMSCRIPTEN)
target_compile_options(dkg_unit_test PRIVATE -s DISABLE_EXCEPTION_CATCHING=1)
set_target_properties(dkg_unit_test PROPERTIES LINK_FLAGS "-s DISABLE_EXCEPTION_CATCHING=1")
endif()
else()
target_compile_options(dkg_unit_test PRIVATE -Wno-format-overflow)
endif()
target_link_libraries(dkg_unit_test PRIVATE bls ${CRYPTOPP_LIBRARY} ff ${GMP_LIBRARY} ${GMPXX_LIBRARY} ${BOOST_LIBS_4_BLS})

add_test(NAME dkg_tests COMMAND dkg_unit_test)
Expand All @@ -265,7 +269,9 @@ if(BUILD_TESTS)
if (EMSCRIPTEN)
target_compile_options(bls_test PRIVATE -s DISABLE_EXCEPTION_CATCHING=1)
set_target_properties(bls_test PROPERTIES LINK_FLAGS "-s DISABLE_EXCEPTION_CATCHING=1")
endif()
else()
target_compile_options(bls_test PRIVATE -Wno-format-overflow)
endif()
target_link_libraries(bls_test PRIVATE bls ${CRYPTOPP_LIBRARY} ff ${GMP_LIBRARY} ${GMPXX_LIBRARY} ${BOOST_LIBS_4_BLS})

add_test(NAME bls_test COMMAND bls_test)
Expand All @@ -281,7 +287,9 @@ if(BUILD_TESTS)
if (EMSCRIPTEN)
target_compile_options(utils_unit_test PRIVATE -s DISABLE_EXCEPTION_CATCHING=1)
set_target_properties(utils_unit_test PROPERTIES LINK_FLAGS "-s DISABLE_EXCEPTION_CATCHING=1")
endif()
else()
target_compile_options(utils_unit_test PRIVATE -Wno-format-overflow)
endif()
target_link_libraries(utils_unit_test PRIVATE bls te ${CRYPTOPP_LIBRARY} ff ${GMPXX_LIBRARY} ${GMP_LIBRARY} ${BOOST_LIBS_4_BLS})

add_test(NAME utils_tests COMMAND utils_unit_test)
Expand Down
8 changes: 8 additions & 0 deletions bls/bls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,10 @@ std::pair< libff::alt_bn128_Fr, libff::alt_bn128_G2 > Bls::KeysRecover(
throw ThresholdUtils::IncorrectInput( "not enough participants in the threshold group" );
}

if ( shares.size() > this->n_ || coeffs.size() > this->n_ ) {
throw ThresholdUtils::IncorrectInput( "too many participants in the threshold group" );
}

libff::alt_bn128_Fr secret_key = libff::alt_bn128_Fr::zero();

for ( size_t i = 0; i < this->t_; ++i ) {
Expand All @@ -365,6 +369,10 @@ libff::alt_bn128_G1 Bls::SignatureRecover( const std::vector< libff::alt_bn128_G
throw ThresholdUtils::IncorrectInput( "not enough participants in the threshold group" );
}

if ( shares.size() > this->n_ || coeffs.size() > this->n_ ) {
throw ThresholdUtils::IncorrectInput( "too many participants in the threshold group" );
}

libff::alt_bn128_G1 sign = libff::alt_bn128_G1::zero();

for ( size_t i = 0; i < this->t_; ++i ) {
Expand Down
36 changes: 24 additions & 12 deletions deps/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -565,17 +565,24 @@ then
then
env_restore
cd "$SOURCES_ROOT"
if [ ! -d "boost_1_68_0" ];
BOOST_NAME="boost_1_68_0"
BOOST_VERSION="1.68.0"
if [ "$UNIX_SYSTEM_NAME" = "Darwin" ];
then
BOOST_NAME="boost_1_82_0"
BOOST_VERSION="1.82.0"
fi
if [ ! -d "${BOOST_NAME}" ];
then
if [ ! -f "boost_1_68_0.tar.bz2" ];
if [ ! -f "${BOOST_NAME}.tar.bz2" ];
then
eval echo -e "${COLOR_INFO}downloading it${COLOR_DOTS}...${COLOR_RESET}"
eval "$WGET" https://sourceforge.net/projects/boost/files/boost/1.68.0/boost_1_68_0.tar.bz2
eval "$WGET" https://sourceforge.net/projects/boost/files/boost/${BOOST_VERSION}/${BOOST_NAME}.tar.bz2
fi
echo -e "${COLOR_INFO}unpacking it${COLOR_DOTS}...${COLOR_RESET}"
tar -xf boost_1_68_0.tar.bz2
tar -xf ${BOOST_NAME}.tar.bz2
fi
cd boost_1_68_0
cd ${BOOST_NAME}
echo -e "${COLOR_INFO}configuring and building it${COLOR_DOTS}...${COLOR_RESET}"
if [[ "${WITH_EMSCRIPTEN}" -eq 1 ]];
then
Expand All @@ -592,7 +599,7 @@ then
else
if [ "$UNIX_SYSTEM_NAME" = "Darwin" ];
then
eval ./b2 cxxflags=-fPIC toolset=clang cxxstd=14 cflags=-fPIC "${PARALLEL_MAKE_OPTIONS}" --prefix="$INSTALL_ROOT" --layout=system variant=debug link=static threading=multi install
eval ./b2 cxxflags=-fPIC toolset=clang cxxstd=17 cflags=-fPIC "${PARALLEL_MAKE_OPTIONS}" --prefix="$INSTALL_ROOT" --layout=system variant=debug link=static threading=multi install
else
if [[ "${WITH_EMSCRIPTEN}" -eq 1 ]];
then
Expand Down Expand Up @@ -681,21 +688,26 @@ then
# requiired for libff
env_restore
cd "$SOURCES_ROOT"
if [ ! -d "gmp-6.1.2" ];
GMP_NAME="gmp-6.1.2"
if [ "$UNIX_SYSTEM_NAME" = "Darwin" ];
then
GMP_NAME="gmp-6.3.0"
fi
if [ ! -d "${GMP_NAME}" ];
then
if [ ! -f "gmp-6.1.2.tar.xz" ];
if [ ! -f ""${GMP_NAME}".tar.xz" ];
then
echo -e "${COLOR_INFO}getting it from gmp website${COLOR_DOTS}...${COLOR_RESET}"
eval "$WGET" https://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.xz
eval "$WGET" https://ftp.gnu.org/gnu/gmp/"${GMP_NAME}".tar.xz
fi
echo -e "${COLOR_INFO}unpacking it${COLOR_DOTS}...${COLOR_RESET}"
eval tar -xf gmp-6.1.2.tar.xz
eval tar -xf "${GMP_NAME}".tar.xz
fi
cd gmp-6.1.2
cd "${GMP_NAME}"
echo -e "${COLOR_INFO}configuring it${COLOR_DOTS}...${COLOR_RESET}"
if [ "$UNIX_SYSTEM_NAME" = "Darwin" ];
then
eval ./configure "${CONF_CROSSCOMPILING_OPTS_GENERIC}" "${CONF_DEBUG_OPTIONS}" --enable-cxx --enable-static --disable-shared --build=x86_64-apple-darwin#{OS.kernel_version.major} --prefix="$INSTALL_ROOT"
eval ./configure "${CONF_CROSSCOMPILING_OPTS_GENERIC}" "${CONF_DEBUG_OPTIONS}" --enable-cxx --enable-static --disable-shared --disable-assembly --build=x86_64-apple-darwin#{OS.kernel_version.major} --prefix="$INSTALL_ROOT"
else
if [[ "${WITH_EMSCRIPTEN}" -eq 1 ]];
then
Expand Down
11 changes: 2 additions & 9 deletions deps/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,24 +114,17 @@ rm -f ./*.tar.bz2
rm -f ./*.zip
echo "Cleaning upacked library folders..."
rm -rf ./libiconv-1.15
rm -rf ./zlib
rm -rf ./openssl
rm -rf ./curl
rm -rf ./libuv
rm -rf ./libwebsockets
rm -rf ./boost_1_68_0
rm -rf ./argtable2
rm -rf ./nettle-2.0
rm -rf ./nettle-3.4.1
rm -rf ./gnutls-3.6.5
rm -rf ./boost*
rm -rf ./libmicrohttpd
rm -rf ./jsoncpp
rm -rf ./libjson-rpc-cpp
rm -rf ./libcryptopp
rm -rf ./gmp-6.1.2
rm -rf ./gmp-6*
rm -rf ./libff
rm -rf ./emsdk
rm -rf ./jsoncpp
rm -rf ./libjson-rpc-cpp*
rm -rf ./zlib
rm -rf ./argtable2
Expand Down
2 changes: 2 additions & 0 deletions third_party/cryptlite/sha256.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"

#ifndef _CRYPTLITE_SHA256_H_
#define _CRYPTLITE_SHA256_H_
#include <third_party/cryptlite/base64.h>
Expand Down
Loading

0 comments on commit 4a5c980

Please sign in to comment.