Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
dbd4e7e
Add ctpl header only library
random-zebra Mar 28, 2021
c64ed08
Add helper to rename all threads of a ctpl::thread_pool
codablock May 24, 2018
fb70c81
Add Chia bls-signatures library to depends
codablock Sep 18, 2018
43764b5
[Build] Add libsodium to bls depends
random-zebra Mar 28, 2021
4104d84
Implement wrappers around Chia BLS lib
codablock Oct 3, 2018
5b400c6
[Trivial] Rename BCLog::BENCH/RAND to BCLog::BENCHMARK/RANDOM
random-zebra Mar 29, 2021
d43627d
Add simple helpers/wrappers for BLS+AES based integrated encryption
codablock May 24, 2018
ecf4a90
Add highly parallelized worker/helper for BLS/DKG calculations
codablock May 24, 2018
aa06cad
Add BLS and DKG benchmarks
codablock May 24, 2018
017ba0a
[BUG] Initialize Random for bench tests
random-zebra Mar 29, 2021
5ab344b
Add ECDSA benchmarks
codablock Sep 14, 2018
d2d1506
Move bls stuff from crypto/ to bls/
random-zebra Mar 29, 2021
0f35185
[Build][Depends] Update chia-bls to use PIVX repo, v20181101
random-zebra Mar 29, 2021
809afbf
[Trivial] Missing include in reverelock_tests.cpp
random-zebra Jun 2, 2021
16b466e
Add pooled_secure_allocator and mt_pooled_secure_allocator
codablock Jun 2, 2021
f0d2416
Use mt_pooled_secure_allocator for BLS secure allocation
codablock Jun 2, 2021
a497941
Bail out early from secure deallocation
codablock Jun 2, 2021
69203ef
Ensure correct order of destruction for BLS secure allocator
codablock Jun 2, 2021
91e8a9c
[Refactor] Initialize BLS allocator in BasicTestingSetup
random-zebra Jun 2, 2021
cbe0a93
Faster default-initialization of BLS primitives
codablock Jun 2, 2021
252060b
Implement CBLSLazySignature for lazy serialization/deserialization
codablock Jun 2, 2021
9e458b8
Make CBLSLazySignature thread safe
codablock Jun 2, 2021
b995418
Perform malleability check in CBLSLazySignature
codablock Jun 2, 2021
fcc055d
Implement general CBLSLazyWrapper for bls sigs/public keys/private keys
random-zebra Jun 2, 2021
8ba3221
[Refactoring] Update BLS files
random-zebra Jun 2, 2021
f4573d8
bls: Refactor CBLSWrapper::SetBuf and CBLSWrapper::GetBuf
xdustinface Dec 12, 2020
36cb844
bls: Add CBLSId(const int64_t n) and CBLSId(const uint256& nHash)
xdustinface Jun 2, 2021
79738a8
bench: refactor instantiations of CBLSId
random-zebra Jun 2, 2021
ef788b1
bls: Drop CBLSId::{SetInt, SetHash, FromInt, FromHash}
xdustinface Jun 2, 2021
350446e
Drop CBLSId(int64_t) ctor
random-zebra Jun 2, 2021
c37efb4
bls: Directly assign some aggregation results
xdustinface Dec 27, 2020
0b6932b
bls: Avoid needless hashing
UdjinM6 Mar 12, 2021
406ec77
BLS: serialization updates
random-zebra Jun 2, 2021
4b269a8
depends: update to chia-bls version 1.0.0
xdustinface Jun 2, 2021
3481f75
depends: Temporary rename package chia_bls to bls-dash
random-zebra Jun 2, 2021
c3506a8
bls: Integrate the upgraded version into the codebase
random-zebra Jun 2, 2021
3081b62
[BLS] Don't use old legacy scheme at all
random-zebra Jun 3, 2021
c8d4407
[QA] Add test for BLS sign/verify message and sethexstr
random-zebra Jun 3, 2021
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
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ target_include_directories(ZEROCOIN_A PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(COMMON_SOURCES
./src/base58.cpp
./src/bip38.cpp
./src/bls/bls.cpp
./src/bls/bls_ies.cpp
./src/bls/bls_worker.cpp
./src/consensus/params.cpp
./src/consensus/upgrades.cpp
./src/chainparams.cpp
Expand Down
2 changes: 1 addition & 1 deletion depends/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ No other options are needed, the paths are automatically configured.

Common linux dependencies:

sudo apt-get install make automake cmake curl g++-multilib libtool binutils-gold bsdmainutils pkg-config python3 patch
sudo apt-get install make automake curl g++-multilib libtool binutils-gold bsdmainutils pkg-config python3 patch

For linux ARM cross compilation:

Expand Down
47 changes: 47 additions & 0 deletions depends/packages/bls-dash.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package=bls-dash
$(package)_version=1.0.0
# It's actually from https://github.com/Chia-Network/bls-signatures, but we have so many patches atm that it's forked
$(package)_download_path=https://github.com/PIVX-Project/bls-signatures/archive
$(package)_file_name=$($(package)_version).tar.gz
$(package)_sha256_hash=ecbc51457dd3de153af27333038f149ba585e16fe46351b763938cb6ef0f2d9a
$(package)_dependencies=gmp cmake libsodium

define $(package)_set_vars
$(package)_config_opts=-DCMAKE_INSTALL_PREFIX=$($(package)_staging_dir)/$(host_prefix)
$(package)_config_opts+= -DCMAKE_PREFIX_PATH=$($(package)_staging_dir)/$(host_prefix)
$(package)_config_opts+= -DSTLIB=ON -DSHLIB=OFF -DSTBIN=ON
$(package)_config_opts+= -DBUILD_BLS_PYTHON_BINDINGS=0 -DBUILD_BLS_TESTS=0 -DBUILD_BLS_BENCHMARKS=0
$(package)_config_opts_linux=-DOPSYS=LINUX -DCMAKE_SYSTEM_NAME=Linux
$(package)_config_opts_darwin=-DOPSYS=MACOSX -DCMAKE_SYSTEM_NAME=Darwin
$(package)_config_opts_mingw32=-DOPSYS=WINDOWS -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SHARED_LIBRARY_LINK_C_FLAGS=""
$(package)_config_opts_i686+= -DWSIZE=32
$(package)_config_opts_x86_64+= -DWSIZE=64
$(package)_config_opts_arm+= -DWSIZE=32
$(package)_config_opts_armv7l+= -DWSIZE=32
$(package)_config_opts_debug=-DDEBUG=ON -DCMAKE_BUILD_TYPE=Debug

ifneq ($(darwin_native_toolchain),)
$(package)_config_opts_darwin+= -DCMAKE_AR="$(host_prefix)/native/bin/$($(package)_ar)"
$(package)_config_opts_darwin+= -DCMAKE_RANLIB="$(host_prefix)/native/bin/$($(package)_ranlib)"
endif
endef

define $(package)_config_cmds
export CC="$($(package)_cc)" && \
export CXX="$($(package)_cxx)" && \
export CFLAGS="$($(package)_cflags) $($(package)_cppflags)" && \
export CXXFLAGS="$($(package)_cxxflags) $($(package)_cppflags)" && \
export LDFLAGS="$($(package)_ldflags)" && \
mkdir -p build && cd build && \
$(host_prefix)/bin/cmake ../ $($(package)_config_opts)
endef

define $(package)_build_cmds
cd build && \
$(MAKE) $($(package)_build_opts)
endef

define $(package)_stage_cmds
cd build && \
$(MAKE) install
endef
17 changes: 17 additions & 0 deletions depends/packages/cmake.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package=cmake
$(package)_version=3.14.7
$(package)_download_path=https://cmake.org/files/v3.14/
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=9221993e0af3e6d10124d840ff24f5b2f3b884416fca04d3312cb0388dec1385

define $(package)_config_cmds
./bootstrap --prefix=$(host_prefix)
endef

define $(package)_build_cmds
$(MAKE)
endef

define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install
endef
3 changes: 2 additions & 1 deletion depends/packages/native_cdrkit.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ $(package)_download_path=https://distro.ibiblio.org/fatdog/source/600/c
$(package)_file_name=cdrkit-$($(package)_version).tar.bz2
$(package)_sha256_hash=b50d64c214a65b1a79afe3a964c691931a4233e2ba605d793eb85d0ac3652564
$(package)_patches=cdrkit-deterministic.patch
$(package)_dependencies=cmake

define $(package)_preprocess_cmds
patch -p1 < $($(package)_patch_dir)/cdrkit-deterministic.patch
endef

define $(package)_config_cmds
cmake -DCMAKE_INSTALL_PREFIX=$(build_prefix)
$(host_prefix)/bin/cmake -DCMAKE_INSTALL_PREFIX=$(build_prefix)
endef

define $(package)_build_cmds
Expand Down
3 changes: 2 additions & 1 deletion depends/packages/native_libdmg-hfsplus.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ $(package)_file_name=$($(package)_version).tar.gz
$(package)_sha256_hash=56fbdc48ec110966342f0ecddd6f8f89202f4143ed2a3336e42bbf88f940850c
$(package)_build_subdir=build
$(package)_patches=remove-libcrypto-dependency.patch
$(package)_dependencies=cmake

define $(package)_preprocess_cmds
patch -p1 < $($(package)_patch_dir)/remove-libcrypto-dependency.patch && \
mkdir build
endef

define $(package)_config_cmds
cmake -DCMAKE_INSTALL_PREFIX:PATH=$(build_prefix) ..
$(host_prefix)/bin/cmake -DCMAKE_INSTALL_PREFIX:PATH=$(build_prefix)/bin ..
endef

define $(package)_build_cmds
Expand Down
2 changes: 1 addition & 1 deletion depends/packages/packages.mk
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ rust_crates := \
crate_zcash_proofs

rust_packages := rust $(rust_crates)
packages:=boost libevent gmp $(zcash_packages) libsodium
packages:=boost libevent gmp $(zcash_packages) libsodium bls-dash cmake

qt_packages = qrencode zlib

Expand Down
21 changes: 17 additions & 4 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ BITCOIN_INCLUDES += -I$(srcdir)/rust/include
BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include
BITCOIN_INCLUDES += $(UNIVALUE_CFLAGS)

BLS_LIBS=-lbls-dash -lgmp

LIBBITCOIN_SERVER=libbitcoin_server.a
LIBBITCOIN_COMMON=libbitcoin_common.a
LIBBITCOIN_CLI=libbitcoin_cli.a
Expand Down Expand Up @@ -154,6 +156,9 @@ BITCOIN_CORE_H = \
bip38.h \
bloom.h \
blocksignature.h \
bls/bls.h \
bls/bls_ies.h \
bls/bls_worker.h \
chain.h \
chainparams.h \
chainparamsbase.h \
Expand Down Expand Up @@ -181,6 +186,7 @@ BITCOIN_CORE_H = \
core_io.h \
cuckoocache.h \
crypter.h \
ctpl.h \
cyclingvector.h \
evo/deterministicmns.h \
evo/evodb.h \
Expand Down Expand Up @@ -267,6 +273,8 @@ BITCOIN_CORE_H = \
stakeinput.h \
script/ismine.h \
streams.h \
support/allocators/mt_pooled_secure.h \
support/allocators/pooled_secure.h \
support/allocators/secure.h \
support/allocators/zeroafterfree.h \
support/cleanse.h \
Expand Down Expand Up @@ -493,6 +501,9 @@ libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libbitcoin_common_a_SOURCES = \
base58.cpp \
bip38.cpp \
bls/bls.cpp \
bls/bls_ies.cpp \
bls/bls_worker.cpp \
chainparams.cpp \
consensus/upgrades.cpp \
coins.cpp \
Expand Down Expand Up @@ -623,7 +634,7 @@ pivxd_LDADD = \
$(LIBRUSTZCASH) \
$(LIBZCASH_LIBS)

pivxd_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS)
pivxd_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS) $(BLS_LIBS)

# pivx-cli binary #
pivx_cli_SOURCES = pivx-cli.cpp
Expand All @@ -644,7 +655,8 @@ pivx_cli_LDADD = \
$(LIBRUSTZCASH) \
$(LIBZCASH_LIBS)

pivx_cli_LDADD += $(BOOST_LIBS) $(EVENT_LIBS)
pivx_cli_LDADD += $(BOOST_LIBS) $(EVENT_LIBS) $(BLS_LIBS)

#

# pivx-tx binary #
Expand All @@ -668,7 +680,8 @@ pivx_tx_LDADD = \
$(LIBRUSTZCASH) \
$(LIBZCASH_LIBS)

pivx_tx_LDADD += $(BOOST_LIBS)
pivx_tx_LDADD += $(BOOST_LIBS) $(BLS_LIBS)

#

# bitcoinconsensus library #
Expand Down Expand Up @@ -696,7 +709,7 @@ if GLIBC_BACK_COMPAT
endif

libbitcoinconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
libbitcoinconsensus_la_LIBADD = $(LIBSECP256K1)
libbitcoinconsensus_la_LIBADD = $(LIBSECP256K1) $(BLS_LIBS)
libbitcoinconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL
libbitcoinconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)

Expand Down
5 changes: 4 additions & 1 deletion src/Makefile.bench.include
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ bench_bench_pivx_SOURCES = \
bench/bench.h \
bench/Examples.cpp \
bench/base58.cpp \
bench/bls.cpp \
bench/bls_dkg.cpp \
bench/checkblock.cpp \
bench/checkqueue.cpp \
bench/chacha20.cpp \
bench/crypto_hash.cpp \
bench/ecdsa.cpp \
bench/lockedpool.cpp \
bench/perf.cpp \
bench/perf.h \
Expand Down Expand Up @@ -47,7 +50,7 @@ if ENABLE_ZMQ
bench_bench_pivx_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
endif

bench_bench_pivx_LDADD += $(LIBBITCOIN_CONSENSUS) $(BOOST_LIBS) $(BDB_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS)
bench_bench_pivx_LDADD += $(LIBBITCOIN_CONSENSUS) $(BOOST_LIBS) $(BDB_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(BLS_LIBS)
bench_bench_pivx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)

# !TODO: .raw.h generated test files are not removed with make clean
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ qt_pivx_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
endif
qt_pivx_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBBITCOIN_ZEROCOIN) $(LIBSAPLING) $(LIBRUSTZCASH) $(LIBZCASH_LIBS) $(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) \
$(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(SVG_LIBS) $(CHARTS_LIBS) $(BDB_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) \
$(EVENT_PTHREADS_LIBS) $(EVENT_LIBS)
$(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(BLS_LIBS)
qt_pivx_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
qt_pivx_qt_LIBTOOLFLAGS = $(AM_LIBTOOLFLAGS) --tag CXX

Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.qttest.include
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ endif
qt_test_test_pivx_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBBITCOIN_ZEROCOIN) $(LIBLEVELDB) $(LIBSAPLING) $(LIBRUSTZCASH) $(LIBZCASH_LIBS) \
$(LIBLEVELDB_SSE42) $(LIBMEMENV) $(BOOST_LIBS) $(QT_DBUS_LIBS) $(QT_TEST_LIBS) $(QT_LIBS) \
$(QR_LIBS) $(BDB_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) \
$(EVENT_PTHREADS_LIBS) $(EVENT_LIBS)
$(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(BLS_LIBS)
qt_test_test_pivx_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
qt_test_test_pivx_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS)

Expand Down
3 changes: 2 additions & 1 deletion src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ BITCOIN_TESTS =\
test/base64_tests.cpp \
test/bech32_tests.cpp \
test/bip32_tests.cpp \
test/bls_tests.cpp \
test/budget_tests.cpp \
test/checkblock_tests.cpp \
test/Checkpoints_tests.cpp \
Expand Down Expand Up @@ -185,7 +186,7 @@ endif

test_test_pivx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)

test_test_pivx_LDADD += $(LIBRUSTZCASH) $(LIBBITCOIN_CONSENSUS) $(BDB_LIBS) $(MINIUPNPC_LIBS) $(LIBZCASH_LIBS)
test_test_pivx_LDADD += $(LIBRUSTZCASH) $(LIBBITCOIN_CONSENSUS) $(BDB_LIBS) $(MINIUPNPC_LIBS) $(LIBZCASH_LIBS) $(BLS_LIBS)
test_test_pivx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -static

if ENABLE_ZMQ
Expand Down
17 changes: 15 additions & 2 deletions src/bench/bench_pivx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,30 @@

#include "bench.h"

#include "bls/bls.h"
#include "key.h"
#include "random.h"
#include "util/system.h"

int
main(int argc, char** argv)
void InitBLSTests();
void CleanupBLSTests();
void CleanupBLSDkgTests();

int main(int argc, char** argv)
{
ECC_Start();
ECCVerifyHandle globalVerifyHandle;
RandomInit();
BLSInit();
InitBLSTests();
SetupEnvironment();
g_logger->m_print_to_file = false; // don't want to write to debug.log file

benchmark::BenchRunner::RunAll();

// need to be called before global destructors kick in (PoolAllocator is needed due to many BLSSecretKeys)
CleanupBLSDkgTests();
CleanupBLSTests();

ECC_Stop();
}
Loading