Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
#include <bls_worker.h>
Classes | |
struct | SigVerifyJob |
Public Types | |
typedef std::function< void(const CBLSSignature &)> | SignDoneCallback |
typedef std::function< void(bool)> | SigVerifyDoneCallback |
typedef std::function< bool()> | CancelCond |
Public Member Functions | |
CBLSWorker () | |
~CBLSWorker () | |
void | Start () |
void | Stop () |
bool | GenerateContributions (int threshold, const BLSIdVector &ids, BLSVerificationVectorPtr &vvecRet, BLSSecretKeyVector &skShares) |
void | AsyncBuildQuorumVerificationVector (const std::vector< BLSVerificationVectorPtr > &vvecs, size_t start, size_t count, bool parallel, std::function< void(const BLSVerificationVectorPtr &)> doneCallback) |
std::future< BLSVerificationVectorPtr > | AsyncBuildQuorumVerificationVector (const std::vector< BLSVerificationVectorPtr > &vvecs, size_t start, size_t count, bool parallel) |
BLSVerificationVectorPtr | BuildQuorumVerificationVector (const std::vector< BLSVerificationVectorPtr > &vvecs, size_t start=0, size_t count=0, bool parallel=true) |
void | AsyncAggregateSecretKeys (const BLSSecretKeyVector &secKeys, size_t start, size_t count, bool parallel, std::function< void(const CBLSSecretKey &)> doneCallback) |
std::future< CBLSSecretKey > | AsyncAggregateSecretKeys (const BLSSecretKeyVector &secKeys, size_t start, size_t count, bool parallel) |
CBLSSecretKey | AggregateSecretKeys (const BLSSecretKeyVector &secKeys, size_t start=0, size_t count=0, bool parallel=true) |
void | AsyncAggregatePublicKeys (const BLSPublicKeyVector &pubKeys, size_t start, size_t count, bool parallel, std::function< void(const CBLSPublicKey &)> doneCallback) |
std::future< CBLSPublicKey > | AsyncAggregatePublicKeys (const BLSPublicKeyVector &pubKeys, size_t start, size_t count, bool parallel) |
CBLSPublicKey | AggregatePublicKeys (const BLSPublicKeyVector &pubKeys, size_t start=0, size_t count=0, bool parallel=true) |
void | AsyncAggregateSigs (const BLSSignatureVector &sigs, size_t start, size_t count, bool parallel, std::function< void(const CBLSSignature &)> doneCallback) |
std::future< CBLSSignature > | AsyncAggregateSigs (const BLSSignatureVector &sigs, size_t start, size_t count, bool parallel) |
CBLSSignature | AggregateSigs (const BLSSignatureVector &sigs, size_t start=0, size_t count=0, bool parallel=true) |
CBLSPublicKey | BuildPubKeyShare (const BLSVerificationVectorPtr &vvec, const CBLSId &id) |
void | AsyncVerifyContributionShares (const CBLSId &forId, const std::vector< BLSVerificationVectorPtr > &vvecs, const BLSSecretKeyVector &skShares, bool parallel, bool aggregated, std::function< void(const std::vector< bool > &)> doneCallback) |
std::future< std::vector< bool > > | AsyncVerifyContributionShares (const CBLSId &forId, const std::vector< BLSVerificationVectorPtr > &vvecs, const BLSSecretKeyVector &skShares, bool parallel, bool aggregated) |
std::vector< bool > | VerifyContributionShares (const CBLSId &forId, const std::vector< BLSVerificationVectorPtr > &vvecs, const BLSSecretKeyVector &skShares, bool parallel=true, bool aggregated=true) |
std::future< bool > | AsyncVerifyContributionShare (const CBLSId &forId, const BLSVerificationVectorPtr &vvec, const CBLSSecretKey &skContribution) |
bool | VerifyContributionShare (const CBLSId &forId, const BLSVerificationVectorPtr &vvec, const CBLSSecretKey &skContribution) |
bool | VerifyVerificationVector (const BLSVerificationVector &vvec, size_t start=0, size_t count=0) |
bool | VerifyVerificationVectors (const std::vector< BLSVerificationVectorPtr > &vvecs, size_t start=0, size_t count=0) |
bool | VerifySecretKeyVector (const BLSSecretKeyVector &secKeys, size_t start=0, size_t count=0) |
bool | VerifySignatureVector (const BLSSignatureVector &sigs, size_t start=0, size_t count=0) |
void | AsyncSign (const CBLSSecretKey &secKey, const uint256 &msgHash, SignDoneCallback doneCallback) |
std::future< CBLSSignature > | AsyncSign (const CBLSSecretKey &secKey, const uint256 &msgHash) |
void | AsyncVerifySig (const CBLSSignature &sig, const CBLSPublicKey &pubKey, const uint256 &msgHash, SigVerifyDoneCallback doneCallback, CancelCond cancelCond=[] { return false;}) |
std::future< bool > | AsyncVerifySig (const CBLSSignature &sig, const CBLSPublicKey &pubKey, const uint256 &msgHash, CancelCond cancelCond=[] { return false;}) |
bool | IsAsyncVerifyInProgress () |
Private Member Functions | |
void | PushSigVerifyBatch () |
Private Attributes | |
ctpl::thread_pool | workerPool |
std::mutex | sigVerifyMutex |
int | sigVerifyBatchesInProgress {0} |
std::vector< SigVerifyJob > | sigVerifyQueue |
Static Private Attributes | |
static const int | SIG_VERIFY_BATCH_SIZE = 8 |
Detailed Description
Definition at line 21 of file bls_worker.h.
Member Typedef Documentation
◆ CancelCond
typedef std::function<bool()> CBLSWorker::CancelCond |
Definition at line 26 of file bls_worker.h.
◆ SignDoneCallback
typedef std::function<void(const CBLSSignature&)> CBLSWorker::SignDoneCallback |
Definition at line 24 of file bls_worker.h.
◆ SigVerifyDoneCallback
typedef std::function<void(bool)> CBLSWorker::SigVerifyDoneCallback |
Definition at line 25 of file bls_worker.h.
Constructor & Destructor Documentation
◆ CBLSWorker()
CBLSWorker::CBLSWorker | ( | ) |
Definition at line 52 of file bls_worker.cpp.
◆ ~CBLSWorker()
CBLSWorker::~CBLSWorker | ( | ) |
Definition at line 56 of file bls_worker.cpp.
References Stop().
Member Function Documentation
◆ AggregatePublicKeys()
CBLSPublicKey CBLSWorker::AggregatePublicKeys | ( | const BLSPublicKeyVector & | pubKeys, |
size_t | start = 0 , |
||
size_t | count = 0 , |
||
bool | parallel = true |
||
) |
Definition at line 691 of file bls_worker.cpp.
References AsyncAggregatePublicKeys(), and count.
◆ AggregateSecretKeys()
CBLSSecretKey CBLSWorker::AggregateSecretKeys | ( | const BLSSecretKeyVector & | secKeys, |
size_t | start = 0 , |
||
size_t | count = 0 , |
||
bool | parallel = true |
||
) |
Definition at line 670 of file bls_worker.cpp.
References AsyncAggregateSecretKeys(), and count.
Referenced by CBLSWorkerCache::AggregateSecretKeys(), and llmq::CQuorumManager::BuildQuorumContributions().
◆ AggregateSigs()
CBLSSignature CBLSWorker::AggregateSigs | ( | const BLSSignatureVector & | sigs, |
size_t | start = 0 , |
||
size_t | count = 0 , |
||
bool | parallel = true |
||
) |
Definition at line 712 of file bls_worker.cpp.
References AsyncAggregateSigs(), and count.
◆ AsyncAggregatePublicKeys() [1/2]
void CBLSWorker::AsyncAggregatePublicKeys | ( | const BLSPublicKeyVector & | pubKeys, |
size_t | start, | ||
size_t | count, | ||
bool | parallel, | ||
std::function< void(const CBLSPublicKey &)> | doneCallback | ||
) |
Definition at line 676 of file bls_worker.cpp.
References AsyncAggregateHelper(), count, and workerPool.
Referenced by AggregatePublicKeys(), and AsyncAggregatePublicKeys().
◆ AsyncAggregatePublicKeys() [2/2]
std::future< CBLSPublicKey > CBLSWorker::AsyncAggregatePublicKeys | ( | const BLSPublicKeyVector & | pubKeys, |
size_t | start, | ||
size_t | count, | ||
bool | parallel | ||
) |
Definition at line 683 of file bls_worker.cpp.
References AsyncAggregatePublicKeys(), and count.
◆ AsyncAggregateSecretKeys() [1/2]
void CBLSWorker::AsyncAggregateSecretKeys | ( | const BLSSecretKeyVector & | secKeys, |
size_t | start, | ||
size_t | count, | ||
bool | parallel, | ||
std::function< void(const CBLSSecretKey &)> | doneCallback | ||
) |
Definition at line 655 of file bls_worker.cpp.
References AsyncAggregateHelper(), count, and workerPool.
Referenced by AggregateSecretKeys(), and AsyncAggregateSecretKeys().
◆ AsyncAggregateSecretKeys() [2/2]
std::future< CBLSSecretKey > CBLSWorker::AsyncAggregateSecretKeys | ( | const BLSSecretKeyVector & | secKeys, |
size_t | start, | ||
size_t | count, | ||
bool | parallel | ||
) |
Definition at line 662 of file bls_worker.cpp.
References AsyncAggregateSecretKeys(), and count.
◆ AsyncAggregateSigs() [1/2]
void CBLSWorker::AsyncAggregateSigs | ( | const BLSSignatureVector & | sigs, |
size_t | start, | ||
size_t | count, | ||
bool | parallel, | ||
std::function< void(const CBLSSignature &)> | doneCallback | ||
) |
Definition at line 697 of file bls_worker.cpp.
References AsyncAggregateHelper(), count, and workerPool.
Referenced by AggregateSigs(), and AsyncAggregateSigs().
◆ AsyncAggregateSigs() [2/2]
std::future< CBLSSignature > CBLSWorker::AsyncAggregateSigs | ( | const BLSSignatureVector & | sigs, |
size_t | start, | ||
size_t | count, | ||
bool | parallel | ||
) |
Definition at line 704 of file bls_worker.cpp.
References AsyncAggregateSigs(), and count.
◆ AsyncBuildQuorumVerificationVector() [1/2]
void CBLSWorker::AsyncBuildQuorumVerificationVector | ( | const std::vector< BLSVerificationVectorPtr > & | vvecs, |
size_t | start, | ||
size_t | count, | ||
bool | parallel, | ||
std::function< void(const BLSVerificationVectorPtr &)> | doneCallback | ||
) |
Definition at line 600 of file bls_worker.cpp.
References count, VectorAggregator< T >::Start(), VerifyVerificationVectors(), and workerPool.
Referenced by AsyncBuildQuorumVerificationVector(), and BuildQuorumVerificationVector().
◆ AsyncBuildQuorumVerificationVector() [2/2]
std::future< BLSVerificationVectorPtr > CBLSWorker::AsyncBuildQuorumVerificationVector | ( | const std::vector< BLSVerificationVectorPtr > & | vvecs, |
size_t | start, | ||
size_t | count, | ||
bool | parallel | ||
) |
Definition at line 620 of file bls_worker.cpp.
References AsyncBuildQuorumVerificationVector(), and count.
◆ AsyncSign() [1/2]
void CBLSWorker::AsyncSign | ( | const CBLSSecretKey & | secKey, |
const uint256 & | msgHash, | ||
CBLSWorker::SignDoneCallback | doneCallback | ||
) |
Definition at line 833 of file bls_worker.cpp.
References ctpl::thread_pool::push(), CBLSSecretKey::Sign(), and workerPool.
Referenced by AsyncSign().
◆ AsyncSign() [2/2]
std::future< CBLSSignature > CBLSWorker::AsyncSign | ( | const CBLSSecretKey & | secKey, |
const uint256 & | msgHash | ||
) |
Definition at line 840 of file bls_worker.cpp.
References AsyncSign().
◆ AsyncVerifyContributionShare()
std::future< bool > CBLSWorker::AsyncVerifyContributionShare | ( | const CBLSId & | forId, |
const BLSVerificationVectorPtr & | vvec, | ||
const CBLSSecretKey & | skContribution | ||
) |
Definition at line 754 of file bls_worker.cpp.
References CBLSSecretKey::GetPublicKey(), CBLSWrapper< ImplType, _SerSize, C >::IsValid(), CBLSPublicKey::PublicKeyShare(), ctpl::thread_pool::push(), VerifyVerificationVector(), and workerPool.
Referenced by llmq::CDKGSession::ReceiveMessage().
◆ AsyncVerifyContributionShares() [1/2]
void CBLSWorker::AsyncVerifyContributionShares | ( | const CBLSId & | forId, |
const std::vector< BLSVerificationVectorPtr > & | vvecs, | ||
const BLSSecretKeyVector & | skShares, | ||
bool | parallel, | ||
bool | aggregated, | ||
std::function< void(const std::vector< bool > &)> | doneCallback | ||
) |
Definition at line 726 of file bls_worker.cpp.
References CBLSWrapper< ImplType, _SerSize, C >::IsValid(), VerifyVerificationVectors(), and workerPool.
Referenced by AsyncVerifyContributionShares(), and VerifyContributionShares().
◆ AsyncVerifyContributionShares() [2/2]
std::future< std::vector< bool > > CBLSWorker::AsyncVerifyContributionShares | ( | const CBLSId & | forId, |
const std::vector< BLSVerificationVectorPtr > & | vvecs, | ||
const BLSSecretKeyVector & | skShares, | ||
bool | parallel, | ||
bool | aggregated | ||
) |
Definition at line 740 of file bls_worker.cpp.
References AsyncVerifyContributionShares().
◆ AsyncVerifySig() [1/2]
void CBLSWorker::AsyncVerifySig | ( | const CBLSSignature & | sig, |
const CBLSPublicKey & | pubKey, | ||
const uint256 & | msgHash, | ||
CBLSWorker::SigVerifyDoneCallback | doneCallback, | ||
CancelCond | cancelCond = [] { return false; } |
||
) |
Definition at line 847 of file bls_worker.cpp.
References CBLSWrapper< ImplType, _SerSize, C >::IsValid(), PushSigVerifyBatch(), SIG_VERIFY_BATCH_SIZE, sigVerifyBatchesInProgress, sigVerifyMutex, and sigVerifyQueue.
Referenced by AsyncVerifySig(), and BLSVerify_BatchedParallel().
◆ AsyncVerifySig() [2/2]
std::future< bool > CBLSWorker::AsyncVerifySig | ( | const CBLSSignature & | sig, |
const CBLSPublicKey & | pubKey, | ||
const uint256 & | msgHash, | ||
CancelCond | cancelCond = [] { return false; } |
||
) |
Definition at line 877 of file bls_worker.cpp.
References AsyncVerifySig().
◆ BuildPubKeyShare()
CBLSPublicKey CBLSWorker::BuildPubKeyShare | ( | const BLSVerificationVectorPtr & | vvec, |
const CBLSId & | id | ||
) |
Definition at line 719 of file bls_worker.cpp.
References CBLSPublicKey::PublicKeyShare().
Referenced by CBLSWorkerCache::BuildPubKeyShare().
◆ BuildQuorumVerificationVector()
BLSVerificationVectorPtr CBLSWorker::BuildQuorumVerificationVector | ( | const std::vector< BLSVerificationVectorPtr > & | vvecs, |
size_t | start = 0 , |
||
size_t | count = 0 , |
||
bool | parallel = true |
||
) |
Definition at line 628 of file bls_worker.cpp.
References AsyncBuildQuorumVerificationVector(), and count.
Referenced by llmq::CQuorumManager::BuildQuorumContributions(), DKG::BuildQuorumVerificationVector(), CBLSWorkerCache::BuildQuorumVerificationVector(), and DKG::ReceiveVvecs().
◆ GenerateContributions()
bool CBLSWorker::GenerateContributions | ( | int | threshold, |
const BLSIdVector & | ids, | ||
BLSVerificationVectorPtr & | vvecRet, | ||
BLSSecretKeyVector & | skShares | ||
) |
Definition at line 75 of file bls_worker.cpp.
References count, ctpl::thread_pool::push(), and workerPool.
Referenced by llmq::CDKGSession::Contribute(), and DKG::DKG().
◆ IsAsyncVerifyInProgress()
bool CBLSWorker::IsAsyncVerifyInProgress | ( | ) |
Definition at line 884 of file bls_worker.cpp.
References sigVerifyBatchesInProgress, and sigVerifyMutex.
Referenced by BLSVerify_BatchedParallel().
◆ PushSigVerifyBatch()
|
private |
Definition at line 891 of file bls_worker.cpp.
References CBLSSignature::AggregateInsecure(), ctpl::thread_pool::push(), SIG_VERIFY_BATCH_SIZE, sigVerifyBatchesInProgress, sigVerifyMutex, sigVerifyQueue, CBLSSignature::VerifyInsecureAggregated(), and workerPool.
Referenced by AsyncVerifySig().
◆ Start()
void CBLSWorker::Start | ( | ) |
Definition at line 61 of file bls_worker.cpp.
References RenameThreadPool(), ctpl::thread_pool::resize(), and workerPool.
Referenced by InitBLSTests(), and llmq::StartLLMQSystem().
◆ Stop()
void CBLSWorker::Stop | ( | ) |
Definition at line 69 of file bls_worker.cpp.
References ctpl::thread_pool::clear_queue(), ctpl::thread_pool::stop(), and workerPool.
Referenced by CleanupBLSTests(), llmq::StopLLMQSystem(), and ~CBLSWorker().
◆ VerifyContributionShare()
bool CBLSWorker::VerifyContributionShare | ( | const CBLSId & | forId, |
const BLSVerificationVectorPtr & | vvec, | ||
const CBLSSecretKey & | skContribution | ||
) |
Definition at line 776 of file bls_worker.cpp.
References CBLSSecretKey::GetPublicKey(), and CBLSPublicKey::PublicKeyShare().
◆ VerifyContributionShares()
std::vector< bool > CBLSWorker::VerifyContributionShares | ( | const CBLSId & | forId, |
const std::vector< BLSVerificationVectorPtr > & | vvecs, | ||
const BLSSecretKeyVector & | skShares, | ||
bool | parallel = true , |
||
bool | aggregated = true |
||
) |
Definition at line 748 of file bls_worker.cpp.
References AsyncVerifyContributionShares().
Referenced by DKG::VerifyContributionShares(), and llmq::CDKGSession::VerifyPendingContributions().
◆ VerifySecretKeyVector()
bool CBLSWorker::VerifySecretKeyVector | ( | const BLSSecretKeyVector & | secKeys, |
size_t | start = 0 , |
||
size_t | count = 0 |
||
) |
Definition at line 823 of file bls_worker.cpp.
References count, and VerifyVectorHelper().
◆ VerifySignatureVector()
bool CBLSWorker::VerifySignatureVector | ( | const BLSSignatureVector & | sigs, |
size_t | start = 0 , |
||
size_t | count = 0 |
||
) |
Definition at line 828 of file bls_worker.cpp.
References count, and VerifyVectorHelper().
◆ VerifyVerificationVector()
bool CBLSWorker::VerifyVerificationVector | ( | const BLSVerificationVector & | vvec, |
size_t | start = 0 , |
||
size_t | count = 0 |
||
) |
Definition at line 788 of file bls_worker.cpp.
References count, and VerifyVectorHelper().
Referenced by AsyncVerifyContributionShare(), and llmq::CDKGSession::PreVerifyMessage().
◆ VerifyVerificationVectors()
bool CBLSWorker::VerifyVerificationVectors | ( | const std::vector< BLSVerificationVectorPtr > & | vvecs, |
size_t | start = 0 , |
||
size_t | count = 0 |
||
) |
Definition at line 793 of file bls_worker.cpp.
References count.
Referenced by AsyncBuildQuorumVerificationVector(), and AsyncVerifyContributionShares().
Member Data Documentation
◆ SIG_VERIFY_BATCH_SIZE
|
staticprivate |
Definition at line 31 of file bls_worker.h.
Referenced by AsyncVerifySig(), and PushSigVerifyBatch().
◆ sigVerifyBatchesInProgress
|
private |
Definition at line 49 of file bls_worker.h.
Referenced by AsyncVerifySig(), IsAsyncVerifyInProgress(), and PushSigVerifyBatch().
◆ sigVerifyMutex
|
private |
Definition at line 48 of file bls_worker.h.
Referenced by AsyncVerifySig(), IsAsyncVerifyInProgress(), and PushSigVerifyBatch().
◆ sigVerifyQueue
|
private |
Definition at line 50 of file bls_worker.h.
Referenced by AsyncVerifySig(), and PushSigVerifyBatch().
◆ workerPool
|
private |
Definition at line 29 of file bls_worker.h.
Referenced by AsyncAggregatePublicKeys(), AsyncAggregateSecretKeys(), AsyncAggregateSigs(), AsyncBuildQuorumVerificationVector(), AsyncSign(), AsyncVerifyContributionShare(), AsyncVerifyContributionShares(), GenerateContributions(), PushSigVerifyBatch(), Start(), and Stop().
The documentation for this class was generated from the following files:
- src/bls/bls_worker.h
- src/bls/bls_worker.cpp