Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

#include <bls_worker.h>

+ Collaboration diagram for CBLSWorker:

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< BLSVerificationVectorPtrAsyncBuildQuorumVerificationVector (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< CBLSSecretKeyAsyncAggregateSecretKeys (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< CBLSPublicKeyAsyncAggregatePublicKeys (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< CBLSSignatureAsyncAggregateSigs (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< CBLSSignatureAsyncSign (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< SigVerifyJobsigVerifyQueue
 

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 
)

◆ 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 
)

◆ 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 
)

◆ 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 
)

◆ 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; } 
)

◆ 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 
)

◆ 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()

◆ 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 ( )

◆ VerifyContributionShare()

bool CBLSWorker::VerifyContributionShare ( const CBLSId forId,
const BLSVerificationVectorPtr vvec,
const CBLSSecretKey skContribution 
)

◆ VerifyContributionShares()

std::vector< bool > CBLSWorker::VerifyContributionShares ( const CBLSId forId,
const std::vector< BLSVerificationVectorPtr > &  vvecs,
const BLSSecretKeyVector skShares,
bool  parallel = true,
bool  aggregated = true 
)

◆ 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 
)

◆ 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

const int CBLSWorker::SIG_VERIFY_BATCH_SIZE = 8
staticprivate

Definition at line 31 of file bls_worker.h.

Referenced by AsyncVerifySig(), and PushSigVerifyBatch().

◆ sigVerifyBatchesInProgress

int CBLSWorker::sigVerifyBatchesInProgress {0}
private

Definition at line 49 of file bls_worker.h.

Referenced by AsyncVerifySig(), IsAsyncVerifyInProgress(), and PushSigVerifyBatch().

◆ sigVerifyMutex

std::mutex CBLSWorker::sigVerifyMutex
private

Definition at line 48 of file bls_worker.h.

Referenced by AsyncVerifySig(), IsAsyncVerifyInProgress(), and PushSigVerifyBatch().

◆ sigVerifyQueue

std::vector<SigVerifyJob> CBLSWorker::sigVerifyQueue
private

Definition at line 50 of file bls_worker.h.

Referenced by AsyncVerifySig(), and PushSigVerifyBatch().

◆ workerPool


The documentation for this class was generated from the following files:
Released under the MIT license