Skip to content

Commit

Permalink
Moved some headers in blsct and moved BLS_ETH=1 to configure.ac
Browse files Browse the repository at this point in the history
  • Loading branch information
mxaddict committed Feb 14, 2024
1 parent 2ad883b commit 5bbfaa0
Show file tree
Hide file tree
Showing 28 changed files with 36 additions and 53 deletions.
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,9 @@ fi

CORE_CPPFLAGS="$CORE_CPPFLAGS -DHAVE_BUILD_INFO"

# We need to have have BLS_ETH=1 for bls and mcl libs
CORE_CPPFLAGS="$CORE_CPPFLAGS -DBLS_ETH=1"

AC_ARG_WITH([utils],
[AS_HELP_STRING([--with-utils],
[build navcoin-cli navcoin-tx navcoin-util navcoin-wallet (default=yes)])],
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ $(LIBBLS):
ARCH='$(firstword $(subst -, ,$(HOST)))' \
CC='$(CC)' \
CXX='$(CXX)' \
CFLAGS='$(CXXFLAGS) -DBLS_ETH=1' \
CFLAGS='$(CXXFLAGS)' \
LDFLAGS='$(LDFLAGS)' \
ARFLAGS='$(ARFLAGS)' \
AR='$(AR)' \
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ BITCOIN_TEST_SUITE += \
endif # ENABLE_WALLET

test_test_navcoin_SOURCES = $(BITCOIN_TEST_SUITE) $(BITCOIN_TESTS) $(JSON_TEST_FILES) $(RAW_TEST_FILES)
test_test_navcoin_CPPFLAGS = $(AM_CPPFLAGS) -DBLS_ETH=1 $(BITCOIN_INCLUDES) $(TESTDEFS) $(BOOST_CPPFLAGS) $(EVENT_CFLAGS)
test_test_navcoin_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(TESTDEFS) $(BOOST_CPPFLAGS) $(EVENT_CFLAGS)
test_test_navcoin_LDADD = $(LIBTEST_UTIL)
if ENABLE_WALLET
test_test_navcoin_LDADD += $(LIBBITCOIN_WALLET)
Expand Down
6 changes: 5 additions & 1 deletion src/blsct/arith/mcl/mcl_g1point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <blsct/arith/mcl/mcl_g1point.h>
#include <numeric>
#include <streams.h>

#include <numeric>

MclG1Point::MclG1Point()
{
// Replacement of mclBnG1_clear to avoid segfault in static context
Expand Down Expand Up @@ -184,6 +185,9 @@ std::vector<uint8_t> MclG1Point::GetVch() const

bool MclG1Point::SetVch(const std::vector<uint8_t>& b)
{
// auto g = GetBasePoint();
// auto x = GetBasePoint().GetVch();
// if (mclBnG1_deserialize(&m_point, &x[0], x.size()) == 0) {
if (mclBnG1_deserialize(&m_point, &b[0], b.size()) == 0) {
mclBnG1_clear(&m_point);
return false;
Expand Down
9 changes: 4 additions & 5 deletions src/blsct/arith/mcl/mcl_g1point.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
#ifndef NAVCOIN_BLSCT_ARITH_MCL_MCL_G1POINT_H
#define NAVCOIN_BLSCT_ARITH_MCL_MCL_G1POINT_H

#include <stddef.h>
#include <string>
#include <vector>

#define BLS_ETH 1
#include <bls/bls384_256.h>
#include <blsct/arith/endianness.h>
#include <blsct/arith/mcl/mcl_scalar.h>
#include <uint256.h>

#include <stddef.h>
#include <string>
#include <vector>

class MclG1Point
{
public:
Expand Down
2 changes: 1 addition & 1 deletion src/blsct/arith/mcl/mcl_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#ifndef NAVCOIN_BLSCT_ARITH_MCL_MCL_INIT_H
#define NAVCOIN_BLSCT_ARITH_MCL_MCL_INIT_H

#define BLS_ETH 1
#include <bls/bls384_256.h>

#include <iostream>
#include <mutex>
#include <stdexcept>
Expand Down
14 changes: 6 additions & 8 deletions src/blsct/arith/mcl/mcl_scalar.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,18 @@
#ifndef NAVCOIN_BLSCT_ARITH_MCL_MCL_SCALAR_H
#define NAVCOIN_BLSCT_ARITH_MCL_MCL_SCALAR_H

#include <array>
#include <functional>
#include <stddef.h>
#include <string>
#include <vector>

#define BLS_ETH 1
#include <bls/bls384_256.h>
#include <hash.h>
#include <node/protocol_version.h>
#include <serialize.h>
#include <streams.h>
#include <uint256.h>

#include <array>
#include <functional>
#include <stddef.h>
#include <string>
#include <vector>

using namespace std::literals::string_literals;

class MclScalar
Expand Down
3 changes: 1 addition & 2 deletions src/blsct/arith/mcl/mcl_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#ifndef NAVCOIN_BLSCT_ARITH_MCL_MCL_UTIL_H
#define NAVCOIN_BLSCT_ARITH_MCL_MCL_UTIL_H

#define BLS_ETH 1
#include <bls/bls384_256.h>
#include <blsct/arith/mcl/mcl_g1point.h>
#include <blsct/arith/mcl/mcl_scalar.h>
Expand All @@ -29,4 +28,4 @@ struct MclUtil {
}
};

#endif // NAVCOIN_BLSCT_ARITH_MCL_MCL_UTIL_H
#endif // NAVCOIN_BLSCT_ARITH_MCL_MCL_UTIL_H
2 changes: 0 additions & 2 deletions src/blsct/double_public_key.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#ifndef NAVCOIN_BLSCT_DOUBLE_PUBLIC_KEY_H
#define NAVCOIN_BLSCT_DOUBLE_PUBLIC_KEY_H

#define BLS_ETH 1

#include <blsct/arith/mcl/mcl.h>
#include <blsct/public_key.h>

Expand Down
6 changes: 3 additions & 3 deletions src/blsct/eip_2333/bls12_381_keygen.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
#ifndef NAVCOIN_BLSCT_EIP_2333_BLS12_381_KEYGEN_H
#define NAVCOIN_BLSCT_EIP_2333_BLS12_381_KEYGEN_H

#include <array>
#define BLS_ETH 1
#include <bls/bls384_256.h>
#include <blsct/arith/mcl/mcl_scalar.h>
#include <crypto/sha256.h>
#include <crypto/hmac_sha256.h>
#include <crypto/sha256.h>

#include <array>

class BLS12_381_KeyGen
{
Expand Down
2 changes: 0 additions & 2 deletions src/blsct/private_key.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#define BLS_ETH 1

#include <blsct/private_key.h>

namespace blsct {
Expand Down
2 changes: 0 additions & 2 deletions src/blsct/private_key.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#ifndef NAVCOIN_BLSCT_PRIVATE_KEY_H
#define NAVCOIN_BLSCT_PRIVATE_KEY_H

#define BLS_ETH 1

#include <blsct/arith/mcl/mcl.h>
#include <blsct/public_key.h>
#include <blsct/common.h>
Expand Down
2 changes: 0 additions & 2 deletions src/blsct/public_key.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#define BLS_ETH 1

#include <blsct/common.h> // causes mutual dependency issue if included in the public_key header
#include <blsct/public_key.h>
#include <tinyformat.h>
Expand Down
2 changes: 0 additions & 2 deletions src/blsct/public_key.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#ifndef NAVCOIN_BLSCT_PUBLIC_KEY_H
#define NAVCOIN_BLSCT_PUBLIC_KEY_H

#define BLS_ETH 1

#include <blsct/arith/mcl/mcl.h>
#include <blsct/signature.h>
#include <key.h>
Expand Down
2 changes: 0 additions & 2 deletions src/blsct/public_keys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#define BLS_ETH 1

#include <algorithm>
#include <blsct/common.h>
#include <blsct/public_keys.h>
Expand Down
3 changes: 1 addition & 2 deletions src/blsct/public_keys.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
#ifndef NAVCOIN_BLSCT_PUBLIC_KEYS_H
#define NAVCOIN_BLSCT_PUBLIC_KEYS_H

#define BLS_ETH 1
#include <blsct/public_key.h>

#include <vector>
#include <blsct/public_key.h>

namespace blsct {

Expand Down
6 changes: 3 additions & 3 deletions src/blsct/set_mem_proof/set_mem_proof_prover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
#include <blsct/building_block/lazy_points.h>
#include <blsct/common.h>
#include <blsct/set_mem_proof/set_mem_proof_prover.h>
#include <cmath>
#include <hash.h>
#include <node/protocol_version.h>
#include <stdexcept>
#include <streams.h>
#include <util/strencodings.h>

#include <cmath>
#include <stdexcept>

template <typename T>
const typename SetMemProofProver<T>::Scalar& SetMemProofProver<T>::One()
{
Expand Down
3 changes: 1 addition & 2 deletions src/blsct/signature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <algorithm>
#include <blsct/signature.h>
#define BLS_ETH 1
#include <bls/bls384_256.h>
#include <iterator>
#include <streams.h>
#include <tinyformat.h>

#include <algorithm>

namespace blsct {

Expand Down
3 changes: 1 addition & 2 deletions src/blsct/signature.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
#ifndef NAVCOIN_BLSCT_SIGNATURE_H
#define NAVCOIN_BLSCT_SIGNATURE_H

#define BLS_ETH 1
#include <bls/bls384_256.h>
#include <node/protocol_version.h>
#include <serialize.h>

#include <vector>

namespace blsct {
Expand Down
2 changes: 1 addition & 1 deletion src/blsct/wallet/txfactory_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ CTransactionRef AggregateTransactions(const std::vector<CTransactionRef>& txs);
UnsignedOutput CreateOutput(const blsct::DoublePublicKey& destination, const CAmount& nAmount, std::string sMemo, const TokenId& tokenId = TokenId(), const Scalar& blindingKey = Scalar::Rand(), const std::vector<uint8_t>& outputNonce = std::vector<uint8_t>());
} // namespace blsct

#endif // TXFACTORY_GLOBAL_H
#endif // TXFACTORY_GLOBAL_H
4 changes: 3 additions & 1 deletion src/kernel/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ static CBlock CreateBLSCTGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t
static CBlock CreateBLSCTGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const std::string& outHex)
{
blsct::UnsignedOutput out;
DataStream ss(MakeByteSpan(ParseHex(outHex)));
auto hex = ParseHex(outHex);
auto span = MakeByteSpan(hex);
DataStream ss{span};
ss >> out;

return CreateBLSCTGenesisBlock(nTime, nNonce, nBits, nVersion, out);
Expand Down
1 change: 0 additions & 1 deletion src/test/blsct/building_block/generator_deriver_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#define BOOST_UNIT_TEST
#define BLS_ETH 1

#include <blsct/arith/mcl/mcl.h>
#include <ctokens/tokenid.h>
Expand Down
1 change: 0 additions & 1 deletion src/test/blsct/common_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#define BOOST_UNIT_TEST
#define BLS_ETH 1

#include <boost/test/unit_test.hpp>
#include <test/util/setup_common.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#define BOOST_UNIT_TEST
#define BLS_ETH 1

#include <boost/test/unit_test.hpp>
#include <test/util/setup_common.h>
Expand Down
1 change: 0 additions & 1 deletion src/test/blsct/set_mem_proof/set_mem_proof_setup_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#define BOOST_UNIT_TEST
#define BLS_ETH 1

#include <boost/test/unit_test.hpp>
#include <test/util/setup_common.h>
Expand Down
1 change: 0 additions & 1 deletion src/test/blsct/set_mem_proof/set_mem_proof_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#define BOOST_UNIT_TEST
#define BLS_ETH 1

#include <blsct/arith/mcl/mcl.h>
#include <blsct/arith/elements.h>
Expand Down
3 changes: 1 addition & 2 deletions src/test/blsct/sign_verify_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#define BOOST_UNIT_TEST
#define BLS_ETH 1

#include <blsct/common.h>
#include <blsct/private_key.h>
Expand Down Expand Up @@ -154,4 +153,4 @@ BOOST_AUTO_TEST_CASE(test_verify_batch_bad_inputs)

BOOST_AUTO_TEST_SUITE_END()

} // namespace blsct
} // namespace blsct
1 change: 0 additions & 1 deletion src/test/blsct/signature_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#define BOOST_UNIT_TEST
#define BLS_ETH 1

#include <blsct/common.h>
#include <blsct/private_key.h>
Expand Down

0 comments on commit 5bbfaa0

Please sign in to comment.