Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

llmq::CDKGSession Class Reference

The DKG session is a single instance of the DKG process. More...

#include <quorums_dkgsession.h>

+ Collaboration diagram for llmq::CDKGSession:

Public Member Functions

 CDKGSession (const Consensus::LLMQParams &_params, CBLSWorker &_blsWorker, CDKGSessionManager &_dkgManager)
 
bool Init (const CBlockIndex *pindexQuorum, const std::vector< CDeterministicMNCPtr > &mns, const uint256 &_myProTxHash)
 
size_t GetMyMemberIndex () const
 
void Contribute (CDKGPendingMessages &pendingMessages)
 The following sets of methods are for the first 4 phases handled in the session. More...
 
void SendContributions (CDKGPendingMessages &pendingMessages)
 
bool PreVerifyMessage (const uint256 &hash, const CDKGContribution &qc, bool &retBan) const
 
void ReceiveMessage (const uint256 &hash, const CDKGContribution &qc, bool &retBan)
 
void VerifyPendingContributions ()
 
void VerifyAndComplain (CDKGPendingMessages &pendingMessages)
 
void VerifyConnectionAndMinProtoVersions ()
 
void SendComplaint (CDKGPendingMessages &pendingMessages)
 
bool PreVerifyMessage (const uint256 &hash, const CDKGComplaint &qc, bool &retBan) const
 
void ReceiveMessage (const uint256 &hash, const CDKGComplaint &qc, bool &retBan)
 
void VerifyAndJustify (CDKGPendingMessages &pendingMessages)
 
void SendJustification (CDKGPendingMessages &pendingMessages, const std::set< uint256 > &forMembers)
 
bool PreVerifyMessage (const uint256 &hash, const CDKGJustification &qj, bool &retBan) const
 
void ReceiveMessage (const uint256 &hash, const CDKGJustification &qj, bool &retBan)
 
void VerifyAndCommit (CDKGPendingMessages &pendingMessages)
 
void SendCommitment (CDKGPendingMessages &pendingMessages)
 
bool PreVerifyMessage (const uint256 &hash, const CDKGPrematureCommitment &qc, bool &retBan) const
 
void ReceiveMessage (const uint256 &hash, const CDKGPrematureCommitment &qc, bool &retBan)
 
std::vector< CFinalCommitmentFinalizeCommitments ()
 
bool AreWeMember () const
 
void MarkBadMember (size_t idx)
 
void RelayInvToParticipants (const CInv &inv) const
 
CDKGMemberGetMember (const uint256 &proTxHash) const
 

Private Attributes

const Consensus::LLMQParamsparams
 
CBLSWorkerblsWorker
 
CBLSWorkerCache cache
 
CDKGSessionManagerdkgManager
 
const CBlockIndexpindexQuorum
 
std::vector< std::unique_ptr< CDKGMember > > members
 
std::map< uint256, size_t > membersMap
 
std::set< uint256relayMembers
 
BLSVerificationVectorPtr vvecContribution
 
BLSSecretKeyVector skContributions
 
BLSIdVector memberIds
 
std::vector< BLSVerificationVectorPtrreceivedVvecs
 
BLSSecretKeyVector receivedSkContributions
 
uint256 myProTxHash
 
CBLSId myId
 
size_t myIdx {(size_t)-1}
 
CCriticalSection invCs
 
std::map< uint256, CDKGContributioncontributions
 
std::map< uint256, CDKGComplaintcomplaints
 
std::map< uint256, CDKGJustificationjustifications
 
std::map< uint256, CDKGPrematureCommitmentprematureCommitments
 
std::vector< size_t > pendingContributionVerifications
 
std::set< uint256validCommitments
 

Friends

class CDKGSessionHandler
 
class CDKGSessionManager
 
class CDKGLogger
 

Detailed Description

The DKG session is a single instance of the DKG process.

It is owned and called by CDKGSessionHandler, which passes received DKG messages to the session. The session is not persistent and will loose it's state (the whole object is discarded) when it finishes (after the mining phase) or is aborted.

When incoming contributions are received and the verification vector is valid, it is passed to CDKGSessionManager which will store it in the evo DB. Secret key contributions which are meant for the local member are also passed to CDKGSessionManager to store them in the evo DB. If verification of the SK contribution initially fails, it is not passed to CDKGSessionManager. If the justification phase later gives a valid SK contribution from the same member, it is then passed to CDKGSessionManager and after this handled the same way.

The contributions stored by CDKGSessionManager are then later loaded by the quorum instances and used for signing sessions, but only if the local node is a member of the quorum.

Definition at line 239 of file quorums_dkgsession.h.

Constructor & Destructor Documentation

◆ CDKGSession()

llmq::CDKGSession::CDKGSession ( const Consensus::LLMQParams _params,
CBLSWorker _blsWorker,
CDKGSessionManager _dkgManager 
)
inline

Definition at line 286 of file quorums_dkgsession.h.

Member Function Documentation

◆ AreWeMember()

◆ Contribute()

void llmq::CDKGSession::Contribute ( CDKGPendingMessages pendingMessages)

The following sets of methods are for the first 4 phases handled in the session.

The flow of message calls is identical for all phases:

  1. Execute local action (e.g. create/send own contributions)
  2. PreVerify incoming messages for this phase. Preverification means that everything from the message is checked that does not require too much resources for verification. This specifically excludes all CPU intensive BLS operations.
  3. CDKGSessionHandler will collect pre verified messages in batches and perform batched BLS signature verification on these.
  4. ReceiveMessage is called for each pre verified message with a valid signature. ReceiveMessage is also responsible for further verification of validity (e.g. validate vvecs and SK contributions).

Definition at line 140 of file quorums_dkgsession.cpp.

References AreWeMember(), CBatchedLogger::Batch(), blsWorker, cxxtimer::Timer::count(), CBLSWorker::GenerateContributions(), memberIds, params, SendContributions(), skContributions, Consensus::LLMQParams::threshold, and vvecContribution.

◆ FinalizeCommitments()

◆ GetMember()

CDKGMember * llmq::CDKGSession::GetMember ( const uint256 proTxHash) const

Definition at line 1289 of file quorums_dkgsession.cpp.

References members, and membersMap.

Referenced by llmq::BatchVerifyMessageSigs(), PreVerifyMessage(), and ReceiveMessage().

◆ GetMyMemberIndex()

size_t llmq::CDKGSession::GetMyMemberIndex ( ) const
inline

Definition at line 291 of file quorums_dkgsession.h.

References myIdx.

◆ Init()

◆ MarkBadMember()

◆ PreVerifyMessage() [1/4]

◆ PreVerifyMessage() [2/4]

◆ PreVerifyMessage() [3/4]

bool llmq::CDKGSession::PreVerifyMessage ( const uint256 hash,
const CDKGJustification qj,
bool &  retBan 
) const

◆ PreVerifyMessage() [4/4]

◆ ReceiveMessage() [1/4]

◆ ReceiveMessage() [2/4]

◆ ReceiveMessage() [3/4]

◆ ReceiveMessage() [4/4]

◆ RelayInvToParticipants()

void llmq::CDKGSession::RelayInvToParticipants ( const CInv inv) const

◆ SendCommitment()

void llmq::CDKGSession::SendCommitment ( CDKGPendingMessages pendingMessages)

Definition at line 931 of file quorums_dkgsession.cpp.

References activeMasternodeInfo, CBLSWorkerCache::AggregateSecretKeys(), AreWeMember(), CBatchedLogger::Batch(), base_blob< BITS >::begin(), CActiveMasternodeInfo::blsKeyOperator, llmq::CLLMQUtils::BuildCommitmentHash(), CBLSWorkerCache::BuildQuorumVerificationVector(), cache, cxxtimer::Timer::count(), llmq::CDKGPrematureCommitment::CountValidMembers(), dkgManager, CBatchedLogger::Flush(), CBlockIndex::GetBlockHash(), CBLSWrapper< ImplType, _SerSize, C >::GetBuf(), CBLSSecretKey::GetPublicKey(), GetRandInt(), llmq::CDKGSessionManager::GetVerifiedContributions(), CBLSWrapper< ImplType, _SerSize, C >::IsValid(), llmq::CDKGPrematureCommitment::llmqType, CBLSSecretKey::MakeNewKey(), members, Consensus::LLMQParams::minSize, myProTxHash, params, pindexQuorum, llmq::CDKGPrematureCommitment::proTxHash, llmq::CDKGPendingMessages::PushPendingMessage(), llmq::quorumDKGDebugManager, llmq::CDKGPrematureCommitment::quorumHash, llmq::CDKGPrematureCommitment::quorumPublicKey, llmq::CDKGPrematureCommitment::quorumSig, llmq::CDKGPrematureCommitment::quorumVvecHash, SerializeHash(), CBLSWrapper< ImplType, _SerSize, C >::SetBuf(), llmq::ShouldSimulateError(), llmq::CDKGPrematureCommitment::sig, CBLSSecretKey::Sign(), skContributions, cxxtimer::Timer::stop(), CBLSWrapper< ImplType, _SerSize, C >::ToString(), Consensus::LLMQParams::type, llmq::CDKGDebugManager::UpdateLocalSessionStatus(), and llmq::CDKGPrematureCommitment::validMembers.

Referenced by VerifyAndCommit().

◆ SendComplaint()

◆ SendContributions()

◆ SendJustification()

◆ VerifyAndCommit()

void llmq::CDKGSession::VerifyAndCommit ( CDKGPendingMessages pendingMessages)

◆ VerifyAndComplain()

◆ VerifyAndJustify()

◆ VerifyConnectionAndMinProtoVersions()

◆ VerifyPendingContributions()

Friends And Related Function Documentation

◆ CDKGLogger

friend class CDKGLogger
friend

Definition at line 243 of file quorums_dkgsession.h.

◆ CDKGSessionHandler

friend class CDKGSessionHandler
friend

Definition at line 241 of file quorums_dkgsession.h.

◆ CDKGSessionManager

friend class CDKGSessionManager
friend

Definition at line 242 of file quorums_dkgsession.h.

Member Data Documentation

◆ blsWorker

CBLSWorker& llmq::CDKGSession::blsWorker
private

◆ cache

CBLSWorkerCache llmq::CDKGSession::cache
private

Definition at line 249 of file quorums_dkgsession.h.

Referenced by ReceiveMessage(), and SendCommitment().

◆ complaints

std::map<uint256, CDKGComplaint> llmq::CDKGSession::complaints
private

Definition at line 276 of file quorums_dkgsession.h.

Referenced by ReceiveMessage(), and VerifyAndJustify().

◆ contributions

std::map<uint256, CDKGContribution> llmq::CDKGSession::contributions
private

Definition at line 275 of file quorums_dkgsession.h.

Referenced by ReceiveMessage().

◆ dkgManager

CDKGSessionManager& llmq::CDKGSession::dkgManager
private

◆ invCs

CCriticalSection llmq::CDKGSession::invCs
mutableprivate

Definition at line 274 of file quorums_dkgsession.h.

Referenced by ReceiveMessage(), and RelayInvToParticipants().

◆ justifications

std::map<uint256, CDKGJustification> llmq::CDKGSession::justifications
private

Definition at line 277 of file quorums_dkgsession.h.

Referenced by ReceiveMessage().

◆ memberIds

BLSIdVector llmq::CDKGSession::memberIds
private

Definition at line 261 of file quorums_dkgsession.h.

Referenced by Contribute(), and Init().

◆ members

◆ membersMap

std::map<uint256, size_t> llmq::CDKGSession::membersMap
private

Definition at line 256 of file quorums_dkgsession.h.

Referenced by FinalizeCommitments(), GetMember(), and Init().

◆ myId

CBLSId llmq::CDKGSession::myId
private

Definition at line 267 of file quorums_dkgsession.h.

Referenced by Init(), ReceiveMessage(), and VerifyPendingContributions().

◆ myIdx

size_t llmq::CDKGSession::myIdx {(size_t)-1}
private

◆ myProTxHash

◆ params

◆ pendingContributionVerifications

std::vector<size_t> llmq::CDKGSession::pendingContributionVerifications
private

Definition at line 280 of file quorums_dkgsession.h.

Referenced by ReceiveMessage(), and VerifyPendingContributions().

◆ pindexQuorum

◆ prematureCommitments

std::map<uint256, CDKGPrematureCommitment> llmq::CDKGSession::prematureCommitments
private

Definition at line 278 of file quorums_dkgsession.h.

Referenced by FinalizeCommitments(), and ReceiveMessage().

◆ receivedSkContributions

BLSSecretKeyVector llmq::CDKGSession::receivedSkContributions
private

Definition at line 264 of file quorums_dkgsession.h.

Referenced by Init(), ReceiveMessage(), and VerifyPendingContributions().

◆ receivedVvecs

std::vector<BLSVerificationVectorPtr> llmq::CDKGSession::receivedVvecs
private

Definition at line 262 of file quorums_dkgsession.h.

Referenced by Init(), ReceiveMessage(), and VerifyPendingContributions().

◆ relayMembers

std::set<uint256> llmq::CDKGSession::relayMembers
private

Definition at line 257 of file quorums_dkgsession.h.

Referenced by Init(), and RelayInvToParticipants().

◆ skContributions

BLSSecretKeyVector llmq::CDKGSession::skContributions
private

◆ validCommitments

std::set<uint256> llmq::CDKGSession::validCommitments
private

Definition at line 283 of file quorums_dkgsession.h.

Referenced by FinalizeCommitments(), and ReceiveMessage().

◆ vvecContribution

BLSVerificationVectorPtr llmq::CDKGSession::vvecContribution
private

Definition at line 258 of file quorums_dkgsession.h.

Referenced by Contribute(), and SendContributions().


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