Documentation
¶
Index ¶
Constants ¶
const ( // SrStartRound defines ID of Subround "Start round" SrStartRound = iota // SrBlock defines ID of Subround "block" SrBlock // SrSignature defines ID of Subround "signature" SrSignature // SrEndRound defines ID of Subround "End round" SrEndRound )
const ( // MtUnknown defines ID of a message that has unknown data inside MtUnknown consensus.MessageType = iota // MtBlockBodyAndHeader defines ID of a message that has a block body and a block header inside MtBlockBodyAndHeader // MtBlockBody defines ID of a message that has a block body inside MtBlockBody // MtBlockHeader defines ID of a message that has a block header inside MtBlockHeader // MtSignature defines ID of a message that has a Signature inside MtSignature // MtBlockHeaderFinalInfo defines ID of a message that has a block header final info inside // (aggregate signature, bitmap and seal leader signature for the proposed and accepted header) MtBlockHeaderFinalInfo // MtInvalidSigners defines ID of a message that has a invalid signers p2p messages inside MtInvalidSigners )
const ( // BlockBodyAndHeaderStringValue represents the string to be used to identify a block body and a block header BlockBodyAndHeaderStringValue = "(BLOCK_BODY_AND_HEADER)" // BlockBodyStringValue represents the string to be used to identify a block body BlockBodyStringValue = "(BLOCK_BODY)" // BlockHeaderStringValue represents the string to be used to identify a block header BlockHeaderStringValue = "(BLOCK_HEADER)" // BlockSignatureStringValue represents the string to be used to identify a block's signature BlockSignatureStringValue = "(SIGNATURE)" // BlockHeaderFinalInfoStringValue represents the string to be used to identify a block's header final info BlockHeaderFinalInfoStringValue = "(FINAL_INFO)" // BlockUnknownStringValue represents the string to be used to identify an unknown block BlockUnknownStringValue = "(UNKNOWN)" // BlockDefaultStringValue represents the message to identify a message that is undefined BlockDefaultStringValue = "Undefined message type" )
const DefaultMaxNumOfMessageTypeAccepted = uint32(1)
DefaultMaxNumOfMessageTypeAccepted represents the maximum number of the same message type accepted in one round to be received from the same public key for the default message types
const MaxNumOfMessageTypeSignatureAccepted = uint32(2)
MaxNumOfMessageTypeSignatureAccepted represents the maximum number of the signature message type accepted in one round to be received from the same public key
const PeerMaxMessagesPerSec = uint32(6)
PeerMaxMessagesPerSec defines how many messages can be propagated by a pid in a round. The value was chosen by following the next premises:
- a leader can propagate as maximum as 3 messages per round: proposed header block + proposed body + final info;
- due to the fact that a delayed signature of the proposer (from previous round) can be received in the current round adds an extra 1 to the total value, reaching value 4;
- Because the leader might be selected in the next round and might have an empty data pool, it can send the newly empty proposed block at the very beginning of the next round. One extra message here, yielding to a total of 5.
- If we consider the forks that can appear on the system wee need to add one more to the value.
Validators only send one signature message in a round, treating the edge case of a delayed message, will need at most 2 messages per round (which is ok as it is below the set value of 5)
Variables ¶
This section is empty.
Functions ¶
func GetStringValue ¶ added in v1.9.0
func GetStringValue(msgType consensus.MessageType) string
GetStringValue returns the string value of a given MessageType
func GetSubroundName ¶ added in v1.9.0
GetSubroundName returns the name of each Subround from a given Subround ID
func NewConsensusService ¶
func NewConsensusService() (*worker, error)
NewConsensusService creates a new worker object
Types ¶
This section is empty.