PIVX Core  5.6.99
P2P Digital Currency
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
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:
[legend]

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 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 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 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 CDKGPrematureCommitment &qc, bool &retBan) const
 
void ReceiveMessage (const uint256 &hash, const CDKGPrematureCommitment &qc, bool &retBan)
 
std::vector< CFinalCommitmentFinalizeCommitments ()
 
bool AreWeMember () const
 
void MarkBadMember (CDKGMember *member)
 
void RelayInvToParticipants (const CInv &inv) const
 
CDKGMemberGetMember (const uint256 &proTxHash) const
 

Private Member Functions

bool ShouldSimulateError (const std::string &error_type)
 

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}
 
RecursiveMutex invCs
 
std::map< uint256, CDKGContributioncontributions
 
std::map< uint256, CDKGComplaintcomplaints
 
std::map< uint256, CDKGJustificationjustifications
 
std::map< uint256, CDKGPrematureCommitmentprematureCommitments
 
std::set< uint256seenMessages
 
std::vector< size_t > pendingContributionVerifications
 
std::set< uint256validCommitments
 

Friends

class CDKGSessionHandler
 
class CDKGSessionManager
 
class CDKGLogger
 
template<typename Message >
class CDKGMessageHandler
 

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 229 of file quorums_dkgsession.h.

Constructor & Destructor Documentation

◆ CDKGSession()

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

Definition at line 278 of file quorums_dkgsession.h.

Member Function Documentation

◆ AreWeMember()

bool llmq::CDKGSession::AreWeMember ( ) const
inline

Definition at line 327 of file quorums_dkgsession.h.

Here is the call graph for this function:
Here is the caller graph for this function:

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

Here is the call graph for this function:

◆ FinalizeCommitments()

std::vector< CFinalCommitment > llmq::CDKGSession::FinalizeCommitments ( )

Definition at line 1181 of file quorums_dkgsession.cpp.

Here is the call graph for this function:

◆ GetMember()

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

Definition at line 1293 of file quorums_dkgsession.cpp.

Here is the caller graph for this function:

◆ GetMyMemberIndex()

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

Definition at line 283 of file quorums_dkgsession.h.

◆ Init()

bool llmq::CDKGSession::Init ( const CBlockIndex _pindexQuorum,
const std::vector< CDeterministicMNCPtr > &  mns,
const uint256 _myProTxHash 
)

Definition at line 96 of file quorums_dkgsession.cpp.

Here is the call graph for this function:

◆ MarkBadMember()

void llmq::CDKGSession::MarkBadMember ( CDKGMember member)

Definition at line 1302 of file quorums_dkgsession.cpp.

Here is the caller graph for this function:

◆ PreVerifyMessage() [1/4]

bool llmq::CDKGSession::PreVerifyMessage ( const CDKGComplaint qc,
bool &  retBan 
) const

Definition at line 522 of file quorums_dkgsession.cpp.

Here is the call graph for this function:

◆ PreVerifyMessage() [2/4]

bool llmq::CDKGSession::PreVerifyMessage ( const CDKGContribution qc,
bool &  retBan 
) const

Definition at line 213 of file quorums_dkgsession.cpp.

Here is the call graph for this function:

◆ PreVerifyMessage() [3/4]

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

Definition at line 719 of file quorums_dkgsession.cpp.

Here is the call graph for this function:

◆ PreVerifyMessage() [4/4]

bool llmq::CDKGSession::PreVerifyMessage ( const CDKGPrematureCommitment qc,
bool &  retBan 
) const

Definition at line 1037 of file quorums_dkgsession.cpp.

Here is the call graph for this function:

◆ ReceiveMessage() [1/4]

void llmq::CDKGSession::ReceiveMessage ( const uint256 hash,
const CDKGComplaint qc,
bool &  retBan 
)

Definition at line 564 of file quorums_dkgsession.cpp.

Here is the call graph for this function:

◆ ReceiveMessage() [2/4]

void llmq::CDKGSession::ReceiveMessage ( const uint256 hash,
const CDKGContribution qc,
bool &  retBan 
)

Definition at line 259 of file quorums_dkgsession.cpp.

Here is the call graph for this function:

◆ ReceiveMessage() [3/4]

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

Definition at line 777 of file quorums_dkgsession.cpp.

Here is the call graph for this function:

◆ ReceiveMessage() [4/4]

void llmq::CDKGSession::ReceiveMessage ( const uint256 hash,
const CDKGPrematureCommitment qc,
bool &  retBan 
)

Definition at line 1097 of file quorums_dkgsession.cpp.

Here is the call graph for this function:

◆ RelayInvToParticipants()

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

Definition at line 1314 of file quorums_dkgsession.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendCommitment()

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

Definition at line 925 of file quorums_dkgsession.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendComplaint()

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

Definition at line 479 of file quorums_dkgsession.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendContributions()

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

Definition at line 160 of file quorums_dkgsession.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendJustification()

void llmq::CDKGSession::SendJustification ( CDKGPendingMessages pendingMessages,
const std::set< uint256 > &  forMembers 
)

Definition at line 670 of file quorums_dkgsession.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShouldSimulateError()

bool llmq::CDKGSession::ShouldSimulateError ( const std::string &  error_type)
private

Definition at line 57 of file quorums_dkgsession.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VerifyAndCommit()

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

Definition at line 882 of file quorums_dkgsession.cpp.

Here is the call graph for this function:

◆ VerifyAndComplain()

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

Definition at line 407 of file quorums_dkgsession.cpp.

Here is the call graph for this function:

◆ VerifyAndJustify()

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

Definition at line 630 of file quorums_dkgsession.cpp.

Here is the call graph for this function:

◆ VerifyConnectionAndMinProtoVersions()

void llmq::CDKGSession::VerifyConnectionAndMinProtoVersions ( )

Definition at line 445 of file quorums_dkgsession.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VerifyPendingContributions()

void llmq::CDKGSession::VerifyPendingContributions ( )

Definition at line 358 of file quorums_dkgsession.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ CDKGLogger

friend class CDKGLogger
friend

Definition at line 233 of file quorums_dkgsession.h.

◆ CDKGMessageHandler

template<typename Message >
friend class CDKGMessageHandler
friend

Definition at line 234 of file quorums_dkgsession.h.

◆ CDKGSessionHandler

friend class CDKGSessionHandler
friend

Definition at line 231 of file quorums_dkgsession.h.

◆ CDKGSessionManager

friend class CDKGSessionManager
friend

Definition at line 232 of file quorums_dkgsession.h.

Member Data Documentation

◆ blsWorker

CBLSWorker& llmq::CDKGSession::blsWorker
private

Definition at line 239 of file quorums_dkgsession.h.

◆ cache

CBLSWorkerCache llmq::CDKGSession::cache
private

Definition at line 240 of file quorums_dkgsession.h.

◆ complaints

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

Definition at line 266 of file quorums_dkgsession.h.

◆ contributions

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

Definition at line 265 of file quorums_dkgsession.h.

◆ dkgManager

CDKGSessionManager& llmq::CDKGSession::dkgManager
private

Definition at line 241 of file quorums_dkgsession.h.

◆ invCs

RecursiveMutex llmq::CDKGSession::invCs
mutableprivate

Definition at line 264 of file quorums_dkgsession.h.

◆ justifications

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

Definition at line 267 of file quorums_dkgsession.h.

◆ memberIds

BLSIdVector llmq::CDKGSession::memberIds
private

Definition at line 251 of file quorums_dkgsession.h.

◆ members

std::vector<std::unique_ptr<CDKGMember> > llmq::CDKGSession::members
private

Definition at line 245 of file quorums_dkgsession.h.

◆ membersMap

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

Definition at line 246 of file quorums_dkgsession.h.

◆ myId

CBLSId llmq::CDKGSession::myId
private

Definition at line 257 of file quorums_dkgsession.h.

◆ myIdx

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

Definition at line 258 of file quorums_dkgsession.h.

◆ myProTxHash

uint256 llmq::CDKGSession::myProTxHash
private

Definition at line 256 of file quorums_dkgsession.h.

◆ params

const Consensus::LLMQParams& llmq::CDKGSession::params
private

Definition at line 237 of file quorums_dkgsession.h.

◆ pendingContributionVerifications

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

Definition at line 272 of file quorums_dkgsession.h.

◆ pindexQuorum

const CBlockIndex* llmq::CDKGSession::pindexQuorum
private

Definition at line 243 of file quorums_dkgsession.h.

◆ prematureCommitments

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

Definition at line 268 of file quorums_dkgsession.h.

◆ receivedSkContributions

BLSSecretKeyVector llmq::CDKGSession::receivedSkContributions
private

Definition at line 254 of file quorums_dkgsession.h.

◆ receivedVvecs

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

Definition at line 252 of file quorums_dkgsession.h.

◆ relayMembers

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

Definition at line 247 of file quorums_dkgsession.h.

◆ seenMessages

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

Definition at line 270 of file quorums_dkgsession.h.

◆ skContributions

BLSSecretKeyVector llmq::CDKGSession::skContributions
private

Definition at line 249 of file quorums_dkgsession.h.

◆ validCommitments

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

Definition at line 275 of file quorums_dkgsession.h.

◆ vvecContribution

BLSVerificationVectorPtr llmq::CDKGSession::vvecContribution
private

Definition at line 248 of file quorums_dkgsession.h.


The documentation for this class was generated from the following files: