Skip to content

Commit

Permalink
Merge pull request #159 from skalenetwork/bug/SKALE-4693-fix-consensu…
Browse files Browse the repository at this point in the history
…s-compatibility

Bug/skale 4693 fix consensus compatibility
  • Loading branch information
olehnikolaiev authored Oct 21, 2021
2 parents 4a1e3a1 + 8ffc527 commit 237e51b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bls/BLSPublicKey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ bool BLSPublicKey::AggregatedVerifySig(

BLSPublicKey::BLSPublicKey(
std::shared_ptr< std::map< size_t, std::shared_ptr< BLSPublicKeyShare > > > koefs_pkeys_map,
size_t _requiredSigners, size_t _totalSigners ) {
size_t _requiredSigners, size_t _totalSigners )
: t( _requiredSigners ), n( _totalSigners ) {
crypto::ThresholdUtils::initCurve();

crypto::ThresholdUtils::checkSigners( _requiredSigners, _totalSigners );
Expand Down
6 changes: 6 additions & 0 deletions bls/BLSPublicKey.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class BLSPublicKeyShare;
class BLSPublicKey {
private:
std::shared_ptr< libff::alt_bn128_G2 > libffPublicKey;
size_t t;
size_t n;

public:
BLSPublicKey( const std::shared_ptr< std::vector< std::string > > );
Expand All @@ -56,6 +58,10 @@ class BLSPublicKey {
std::shared_ptr< std::vector< std::string > > toString();

std::shared_ptr< libff::alt_bn128_G2 > getPublicKey() const;

size_t getRequiredSigners() const { return t; }

size_t getTotalSigners() const { return n; }
};


Expand Down
3 changes: 3 additions & 0 deletions test/test_bls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ BOOST_AUTO_TEST_CASE( libBlsAPI ) {
pkeys_map1 ),
num_signed, num_all );

BOOST_REQUIRE( common_pkey1.getRequiredSigners() == num_signed );
BOOST_REQUIRE( common_pkey1.getTotalSigners() == num_all );

BOOST_REQUIRE( common_pkey1.VerifySig( hash_ptr, common_sig_ptr ) );

std::vector< size_t > participants1( num_all ); // use the whole set of participants
Expand Down

0 comments on commit 237e51b

Please sign in to comment.