Skip to content

Commit

Permalink
Update bls lib (Raptor3um#377)
Browse files Browse the repository at this point in the history
* fix error too many messages

* update bls lib

---------

Co-authored-by: nandofw <[email protected]>
  • Loading branch information
nandofw and nandofw authored May 24, 2024
1 parent ab757d2 commit 87980a9
Show file tree
Hide file tree
Showing 993 changed files with 329,818 additions and 137 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ LCOV_FILTER_PATTERN = \
-p "/usr/include/" \
-p "/usr/lib/" \
-p "/usr/lib64/" \
-p "src/dashbls/" \
-p "src/leveldb/" \
-p "src/crc32c/" \
-p "src/bench/" \
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1783,7 +1783,7 @@ unset LIBS
LIBS="$LIBS_TEMP"

ac_configure_args="${ac_configure_args} --disable-shared --with-pic --enable-benchmark=no --enable-module-recovery --enable-module-schnorrsig"
AC_CONFIG_SUBDIRS([src/secp256k1])
AC_CONFIG_SUBDIRS([src/dashbls src/secp256k1])

AC_OUTPUT

Expand Down
1 change: 1 addition & 0 deletions contrib/devtools/copyright_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
EXCLUDE_DIRS = [
# git subtrees
"src/crypto/ctaes/",
"src/dashbls/",
"src/leveldb/",
"src/secp256k1/",
"src/univalue/",
Expand Down
79 changes: 0 additions & 79 deletions depends/packages/bls-dash.mk

This file was deleted.

2 changes: 1 addition & 1 deletion depends/packages/packages.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
packages:=boost libevent gmp bls-dash backtrace cmake immer zeromq
packages:=boost libevent gmp backtrace cmake immer zeromq

qrencode_linux_packages = qrencode
qrencode_android_packages = qrencode
Expand Down
23 changes: 16 additions & 7 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ endif
endif #ENABLE_STACKTRACES

BITCOIN_INCLUDES=-I$(builddir) -I$(srcdir)/secp256k1/include -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT) $(BDB_CPPFLAGS) $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS)

BLS_LIBS=-lbls-dash -lrelic_s
BITCOIN_INCLUDES+=-I$(srcdir)/dashbls/include -I$(srcdir)/dashbls/depends/relic/include -I$(srcdir)/dashbls/depends/minialloc/include

LIBBITCOIN_SERVER=libraptoreum_server.a
LIBBITCOIN_COMMON=libraptoreum_common.a
Expand All @@ -43,6 +42,7 @@ LIBBITCOIN_CLI=libraptoreum_cli.a
LIBBITCOIN_UTIL=libraptoreum_util.a
LIBBITCOIN_CRYPTO=crypto/libraptoreum_crypto.a
LIBBITCOINQT=qt/libraptoreumqt.a
LIBDASHBLS=dashbls/libdashbls.la
LIBSECP256K1=secp256k1/libsecp256k1.la

if ENABLE_ZMQ
Expand Down Expand Up @@ -73,6 +73,9 @@ LIBBITCOIN_CRYPTO_ARM_SHANI = crypto/libraptoreum_crypto_arm_shani.a
LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_ARM_SHANI)
endif

$(LIBDASHBLS):
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D)

$(LIBSECP256K1): $(wildcard secp256k1/src/*.h) $(wildcard secp256k1/src/*.c) $(wildcard secp256k1/include/*)
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)

Expand Down Expand Up @@ -776,7 +779,7 @@ raptoreumd_LDADD = \
$(LIBMEMENV) \
$(LIBSECP256K1)

raptoreumd_LDADD += $(BACKTRACE_LIB) $(BOOST_LIBS) $(BDB_LIBS) $(MINIUPNPC_LIBS) $(NATPMP_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS) $(BLS_LIBS) $(GMP_LIBS)
raptoreumd_LDADD += $(BACKTRACE_LIB) $(BOOST_LIBS) $(BDB_LIBS) $(MINIUPNPC_LIBS) $(NATPMP_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS) $(LIBDASHBLS) $(GMP_LIBS)

# raptoreum-cli binary #
raptoreum_cli_SOURCES = raptoreum-cli.cpp
Expand All @@ -794,7 +797,7 @@ raptoreum_cli_LDADD = \
$(LIBBITCOIN_UTIL) \
$(LIBBITCOIN_CRYPTO)

raptoreum_cli_LDADD += $(BACKTRACE_LIB) $(BOOST_LIBS) $(EVENT_LIBS) $(BLS_LIBS) $(GMP_LIBS)
raptoreum_cli_LDADD += $(BACKTRACE_LIB) $(BOOST_LIBS) $(EVENT_LIBS) $(LIBDASHBLS) $(GMP_LIBS)

# raptoreum-wallet binary #
raptoreum_wallet_SOURCES = raptoreum-wallet.cpp
Expand Down Expand Up @@ -824,7 +827,7 @@ raptoreum_wallet_LDADD = \
$(LIBSECP256K1) \
$(LIBUNIVALUE)

raptoreum_wallet_LDADD += $(BACKTRACE_LIB) $(BOOST_LIBS) $(BDB_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(MINIUPNPC_LIBS) $(NATPMP_LIBS) $(ZMQ_LIBS) $(BLS_LIBS) $(GMP_LIBS)
raptoreum_wallet_LDADD += $(BACKTRACE_LIB) $(BOOST_LIBS) $(BDB_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(MINIUPNPC_LIBS) $(NATPMP_LIBS) $(ZMQ_LIBS) $(LIBDASHBLS) $(GMP_LIBS)
#

# raptoreumconsensus library #
Expand All @@ -833,8 +836,9 @@ include_HEADERS = script/raptoreumconsensus.h
libraptoreumconsensus_la_SOURCES = support/cleanse.cpp $(crypto_libraptoreum_crypto_a_SOURCES) $(libraptoreum_consensus_a_SOURCES)

libraptoreumconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS)
libraptoreumconsensus_la_LIBADD = $(LIBSECP256K1) $(BLS_LIBS) $(GMP_LIBS)
libraptoreumconsensus_la_LIBADD = $(LIBSECP256K1) $(LIBDASHBLS) $(GMP_LIBS)
libraptoreumconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL
libraptoreumconsensus_la_CPPFLAGS += -I$(srcdir)/dashbls/include -I$(srcdir)/dashbls/depends/relic/include -I$(srcdir)/dashbls/depends/minialloc/include
libraptoreumconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)

endif
Expand Down Expand Up @@ -863,7 +867,11 @@ CLEANFILES += wallet/test/*.gcda wallet/test/*.gcno
CLEANFILES += zmq/*.gcda zmq/*.gcno
CLEANFILES += obj/build.h

EXTRA_DIST = $(CTAES_DIST)
LIBDASHBLS_DIST = dashbls

EXTRA_DIST = \
$(CTAES_DIST) \
$(LIBDASHBLS_DIST)

config/raptoreum-config.h: config/stamp-h1
@$(MAKE) -C $(top_builddir) $(subdir)/$(@)
Expand All @@ -874,6 +882,7 @@ $(top_srcdir)/$(subdir)/config/raptoreum-config.h.in: $(am__configure_deps)


clean-local:
-$(MAKE) -C dashbls clean
-$(MAKE) -C secp256k1 clean
-rm -f leveldb/*/*.gcda leveldb/*/*.gcno leveldb/helpers/memenv/*.gcda leveldb/helpers/memenv/*.gcno
-rm -f config.h
Expand Down
1 change: 1 addition & 0 deletions src/Makefile.bench.include
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ bench_bench_raptoreum_LDADD = \
$(LIBBITCOIN_UTIL) \
$(LIBBITCOIN_CONSENSUS) \
$(LIBBITCOIN_CRYPTO) \
$(LIBDASHBLS) \
$(LIBLEVELDB) \
$(LIBMEMENV) \
$(LIBSECP256K1) \
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ endif
if ENABLE_ZMQ
qt_raptoreum_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
endif
qt_raptoreum_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) \
qt_raptoreum_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBDASHBLS) \
$(LIBUNIVALUE) $(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) $(BACKTRACE_LIB) $(BOOST_LIBS) $(QT_LIBS) \
$(QT_DBUS_LIBS) $(QR_LIBS) $(BDB_LIBS) $(MINIUPNPC_LIBS) $(NATPMP_LIBS) $(LIBSECP256K1) \
$(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(BLS_LIBS) $(GMP_LIBS)
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.qttest.include
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ endif
if ENABLE_ZMQ
qt_test_test_raptoreum_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
endif
qt_test_test_raptoreum_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) \
qt_test_test_raptoreum_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBDASHBLS) \
$(LIBUNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) $(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QT_TEST_LIBS) \
$(QR_LIBS) $(BDB_LIBS) $(MINIUPNPC_LIBS) $(NATPMP_LIBS) $(LIBSECP256K1) $(EVENT_PTHREADS_LIBS) \
$(EVENT_LIBS) $(BLS_LIBS) $(GMP_LIBS) $(BACKTRACE_LIB)
Expand Down
3 changes: 2 additions & 1 deletion src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ if ENABLE_WALLET
test_test_raptoreum_LDADD += $(LIBBITCOIN_WALLET)
endif
test_test_raptoreum_LDADD += $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) \
$(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) $(BACKTRACE_LIB) $(BOOST_LIBS) \
$(LIBBITCOIN_CRYPTO) $(LIBDASHBLS) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) $(BACKTRACE_LIB) $(BOOST_LIBS) \
$(LIBSECP256K1) $(EVENT_LIBS) $(EVENT_PTHREADS_LIBS)
test_test_raptoreum_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)

Expand All @@ -159,6 +159,7 @@ endif
$(LIBBITCOIN_UTIL) \
$(LIBBITCOIN_CONSENSUS) \
$(LIBBITCOIN_CRYPTO) \
$(LIBDASHBLS) \
$(LIBBITCOIN_CRYPTO_SSE41) \
$(LIBBITCOIN_CRYPTO_AVX2) \
$(LIBBITCOIN_CRYPTO_SHANI) \
Expand Down
12 changes: 6 additions & 6 deletions src/bls/bls.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
#include <util/strencodings.h>
#include <util/ranges.h>

// bls-dash uses relic, which may define DEBUG and ERROR, which leads to many warnings in some build setups
// dashbls uses relic, which may define DEBUG and ERROR, which leads to many warnings in some build setups
#undef ERROR
#undef DEBUG

#include <bls-dash/bls.hpp>
#include <bls-dash/privatekey.hpp>
#include <bls-dash/elements.hpp>
#include <bls-dash/schemes.hpp>
#include <bls-dash/threshold.hpp>
#include <dashbls/bls.hpp>
#include <dashbls/privatekey.hpp>
#include <dashbls/elements.hpp>
#include <dashbls/schemes.hpp>
#include <dashbls/threshold.hpp>

#undef DOUBLE
#undef SEED
Expand Down
17 changes: 17 additions & 0 deletions src/dashbls/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
BasedOnStyle: Google
UseTab: Never
ColumnLimit: 80
IndentWidth: 4
TabWidth: 4
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
AccessModifierOffset: -4
BinPackArguments: false
BinPackParameters: false
AlignAfterOpenBracket: AlwaysBreak
IndentCaseLabels: true
AllowAllParametersOfDeclarationOnNextLine: false
BreakBeforeBraces: Custom
BraceWrapping:
AfterFunction: true
PenaltyReturnTypeOnItsOwnLine: 1000
4 changes: 4 additions & 0 deletions src/dashbls/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
max-line-length = 120
exclude = ./typings/**/* python-impl/fields.py
ignore = E203,W503,E501
82 changes: 82 additions & 0 deletions src/dashbls/.github/workflows/build-binds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Build and test binds

on:
push:
branches:
- main
tags:
- '**'
pull_request:
branches:
- '**'

concurrency:
# SHA is added to the end if on `main` to let all main workflows run
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main') && github.sha || '' }}
cancel-in-progress: true

jobs:
build:
name: ${{ matrix.os }}, Python ${{ matrix.python }}, Go ${{ matrix.golang }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
golang: [ '1.17' ]
python: ['3.7', '3.8', '3.9', '3.10', '3.11']

steps:
- name: Checkout code
uses: actions/checkout@v3

- uses: chia-network/actions/setup-python@main
with:
python-version: ${{ matrix.python }}

- name: Test Python implementation
run: |
python python-impl/impl-test.py
- name: Install Emscripten SDK
uses: mymindstorm/setup-emsdk@v11

- name: Build JavaScript bindings
run: |
emcc -v
sh emsdk_build.sh
- name: Test JavaScript bindings
run: |
sh js_test.sh
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ^${{ matrix.golang }}

- name: Prepare build system for Ubuntu
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -qq --yes valgrind libgmp-dev cmake
hash -r
cmake --version
- name: Prepare build system for macOS
if: startsWith(matrix.os, 'macos')
run: |
ls -l
export MACOSX_DEPLOYMENT_TARGET=10.14
brew install gmp
- name: Build library using CMake
run: |
mkdir -p build && cd build
cmake ..
cmake --build . -- -j 6
- name: Build Go bindings
run: |
cd go-bindings
make
Loading

0 comments on commit 87980a9

Please sign in to comment.