Skip to content

Commit

Permalink
IS-864 bls sync config
Browse files Browse the repository at this point in the history
  • Loading branch information
olehnikolaiev committed Apr 24, 2024
1 parent dc3970a commit 5276c8e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
3 changes: 2 additions & 1 deletion crypto/CryptoManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,8 @@ void CryptoManager::verifyThresholdSig(

MONITOR( __CLASS_NAME__, __FUNCTION__ )

if ( verifyRealSignatures ) {
if ( verifyRealSignatures && ( !getSchain()->getNode()->isSyncOnlyNode() ||
getSchain()->verifyBlsSyncPatch( _ts.getS() ) ) ) {
auto blsSig = dynamic_pointer_cast< ConsensusBLSSignature >( _signature );

CHECK_STATE( blsSig );
Expand Down
26 changes: 13 additions & 13 deletions node/ConsensusEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1039,26 +1039,26 @@ void ConsensusEngine::setPublicKeyInfo( ptr< vector< string > >& _ecdsaPublicKey
CHECK_STATE( _totalSigners >= _requiredSigners );


this->blsPublicKeys = _blsPublicKeyShares;
this->ecdsaPublicKeys = _ecdsaPublicKeys;
if ( _blsPublicKeyShares ) {
// not the case for the sync nodes
this->blsPublicKeys = _blsPublicKeyShares;

map< size_t, shared_ptr< BLSPublicKeyShare > > blsPubKeyShares;
for ( uint64_t i = 0; i < _requiredSigners; i++ ) {
LOG( info, "Parsing BLS key share:" << blsPublicKeys->at( i )->at( 0 ) );

map< size_t, shared_ptr< BLSPublicKeyShare > > blsPubKeyShares;
BLSPublicKeyShare pubKey( blsPublicKeys->at( i ), _requiredSigners, _totalSigners );

blsPubKeyShares[i + 1] = make_shared< BLSPublicKeyShare >( pubKey );
}

for ( uint64_t i = 0; i < _requiredSigners; i++ ) {
LOG( info, "Parsing BLS key share:" << blsPublicKeys->at( i )->at( 0 ) );

BLSPublicKeyShare pubKey( blsPublicKeys->at( i ), _requiredSigners, _totalSigners );
// create pub key

blsPubKeyShares[i + 1] = make_shared< BLSPublicKeyShare >( pubKey );
blsPublicKey = make_shared< BLSPublicKey >(
make_shared< map< size_t, shared_ptr< BLSPublicKeyShare > > >( blsPubKeyShares ),
_requiredSigners, _totalSigners );
}

// create pub key

blsPublicKey = make_shared< BLSPublicKey >(
make_shared< map< size_t, shared_ptr< BLSPublicKeyShare > > >( blsPubKeyShares ),
_requiredSigners, _totalSigners );
}


Expand Down
1 change: 0 additions & 1 deletion node/Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,6 @@ bool Node::isSyncOnlyNode() const {
return isSyncNode;
}


bool Node::verifyRealSignatures() const {
return sgxEnabled || ( isSyncNode && blsPublicKey );
}
Expand Down

0 comments on commit 5276c8e

Please sign in to comment.