messagetypes

package
v0.0.0-...-ff61ee7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2020 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

This package contains the code for the messages that will be used during consensus. Each message implements messages.MsgHeader.

Messages that implement sig.MultiSigMsgHeader are considered to be signed messages. Messages of this type will be tracked by the consensusinterface objects.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidStringMsg = fmt.Errorf("not equal string")

Functions

func CreateBVMessageStage

func CreateBVMessageStage(binVal types.BinVal, round types.ConsensusRound,
	stage byte) messages.InternalSignedMsgHeader

func GenerateCombinedMessageBytes

func GenerateCombinedMessageBytes(pms []*PartialMessage) (*messages.Message, error)

GenerateCombinedMessage creates the bytes of the full message from a list of partial messages. It assumes the partial messages have already been verified and have the same meta-data.

func GeneratePartialMessageDirect

func GeneratePartialMessageDirect(hdr messages.InternalSignedMsgHeader,
	round types.ConsensusRound, pieces int) ([]messages.InternalSignedMsgHeader, error)

GeneratePartialMessageDirect generates a partial message by evenly splitting it into pieces pieces. Round is the round of the proposal message in the consensus to distinguish the message from other rounds of the same index.

func GeneratePartialMessages

func GeneratePartialMessages(fullMsg []byte, round types.ConsensusRound, partialMessages [][]byte) []messages.InternalSignedMsgHeader

GeneratePartialMessage creates a set of partial messages given the full message and its parts

func GetBVMessageInfo

func GetBVMessageInfo(header messages.InternalSignedMsgHeader) (binVal types.BinVal,
	round types.ConsensusRound, stage byte)

Types

type AuxBothMessage

type AuxBothMessage struct {
	Round  types.ConsensusRound // The round within the consensus instance
	BinVal types.BinVal         // The supported binary value
}

AuxBothMessage is the type of messages used by the binary consensus It implements messages.MsgHeader

func NewAuxBothMessage

func NewAuxBothMessage() *AuxBothMessage

NewAuxBothMessage creates a new empty AuxBothMessage

func (*AuxBothMessage) DeserializeInternal

func (apm *AuxBothMessage) DeserializeInternal(m *messages.Message) (bytesRead, signEndOffset int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*AuxBothMessage) GetBaseMsgHeader

func (apm *AuxBothMessage) GetBaseMsgHeader() messages.InternalSignedMsgHeader

GetBaseMsgHeader returns the header pertaning to the message contents.

func (*AuxBothMessage) GetID

func (apm *AuxBothMessage) GetID() messages.HeaderID

GetID returns the header id for this header

func (*AuxBothMessage) GetMsgID

func (apm *AuxBothMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header, in this case a BinMsgID (see MsgID definition for more details)

func (*AuxBothMessage) GetSignType

func (*AuxBothMessage) GetSignType() types.SignType

GetSignType returns types.NormalSignature

func (*AuxBothMessage) NeedsSMValidation

func (apm *AuxBothMessage) NeedsSMValidation(types.ConsensusIndex, int) (idx types.ConsensusIndex,

	proposal []byte, err error)

NeedsSMValidation returns nil, since these messages do not need to be validated by the state machine.

func (*AuxBothMessage) SerializeInternal

func (apm *AuxBothMessage) SerializeInternal(m *messages.Message) (bytesWritten, signEndOffset int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*AuxBothMessage) ShallowCopy

func (apm *AuxBothMessage) ShallowCopy() messages.InternalSignedMsgHeader

type AuxProofMessage

type AuxProofMessage struct {
	Round     types.ConsensusRound // The round within the consensus instance
	BinVal    types.BinVal         // The supported binary value
	AllowCoin bool                 // Allows BinVal to take the value 0, 1, or Coin
}

AuxProofMessage is the type of messages used by the binary consensus It implements messages.MsgHeader

func NewAuxProofMessage

func NewAuxProofMessage(allowNotCoin bool) *AuxProofMessage

NewAuxProofMessage creates a new empty AuxProofMessage

func (*AuxProofMessage) DeserializeInternal

func (apm *AuxProofMessage) DeserializeInternal(m *messages.Message) (bytesRead, signEndOffset int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*AuxProofMessage) GetBaseMsgHeader

func (apm *AuxProofMessage) GetBaseMsgHeader() messages.InternalSignedMsgHeader

GetBaseMsgHeader returns the header pertaning to the message contents.

func (*AuxProofMessage) GetID

func (apm *AuxProofMessage) GetID() messages.HeaderID

GetID returns the header id for this header

func (*AuxProofMessage) GetMsgID

func (apm *AuxProofMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header, in this case a BinMsgID (see MsgID definition for more details)

func (*AuxProofMessage) GetSignType

func (apm *AuxProofMessage) GetSignType() types.SignType

GetSignType returns types.Secondary signature for round 1, types.NormalSignature otherwise.

func (*AuxProofMessage) NeedsSMValidation

func (apm *AuxProofMessage) NeedsSMValidation(types.ConsensusIndex, int) (idx types.ConsensusIndex,
	proposal []byte, err error)

NeedsSMValidation returns nil, since these messages do not need to be validated by the state machine.

func (*AuxProofMessage) SerializeInternal

func (apm *AuxProofMessage) SerializeInternal(m *messages.Message) (bytesWritten, signEndOffset int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*AuxProofMessage) ShallowCopy

type AuxProofMessageTimeout

type AuxProofMessageTimeout types.ConsensusRound

AuxProofMessageTimeout is sent internally to indicate that timeout has passed for a round while waiting for AuxProofMessage

func (AuxProofMessageTimeout) Deserialize

Deserialize is unused since it is a local message.

func (AuxProofMessageTimeout) GetBytes

func (tm AuxProofMessageTimeout) GetBytes(*messages.Message) ([]byte, error)

GetBytes is unused since it is a local message.

func (AuxProofMessageTimeout) GetID

GetID returns the header id for this header.

func (AuxProofMessageTimeout) GetMsgID

func (tm AuxProofMessageTimeout) GetMsgID() messages.MsgID

GetMsgID is unused since it is a local message.

func (AuxProofMessageTimeout) PeekHeaders

PeekHeaders is unused since it is a local message.

func (AuxProofMessageTimeout) Serialize

func (tm AuxProofMessageTimeout) Serialize(*messages.Message) (int, error)

Serialize is unused since it is a local message.

type AuxStage0Message

type AuxStage0Message struct {
	Round  types.ConsensusRound // The round within the consensus instance
	BinVal types.BinVal         // The supported binary value
}

AuxStage0Message is the type of messages used by the binary consensus It implements messages.MsgHeader

func NewAuxStage0Message

func NewAuxStage0Message() *AuxStage0Message

NewAuxStage0Message creates a new empty AuxStage0Message

func (*AuxStage0Message) DeserializeInternal

func (apm *AuxStage0Message) DeserializeInternal(m *messages.Message) (bytesRead, signEndOffset int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*AuxStage0Message) GetBaseMsgHeader

func (apm *AuxStage0Message) GetBaseMsgHeader() messages.InternalSignedMsgHeader

GetBaseMsgHeader returns the header pertaning to the message contents.

func (*AuxStage0Message) GetID

func (apm *AuxStage0Message) GetID() messages.HeaderID

GetID returns the header id for this header

func (*AuxStage0Message) GetMsgID

func (apm *AuxStage0Message) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header, in this case a BinMsgID (see MsgID definition for more details)

func (*AuxStage0Message) GetSignType

func (*AuxStage0Message) GetSignType() types.SignType

GetSignType returns types.NormalSignature

func (*AuxStage0Message) NeedsSMValidation

func (apm *AuxStage0Message) NeedsSMValidation(types.ConsensusIndex, int) (idx types.ConsensusIndex,
	proposal []byte, err error)

NeedsSMValidation returns nil, since these messages do not need to be validated by the state machine.

func (*AuxStage0Message) SerializeInternal

func (apm *AuxStage0Message) SerializeInternal(m *messages.Message) (bytesWritten, signEndOffset int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*AuxStage0Message) ShallowCopy

type AuxStage1Message

type AuxStage1Message struct {
	Round  types.ConsensusRound // The round within the consensus instance
	BinVal types.BinVal         // The supported binary value, 0 represents a binary value, 1 represents bot
}

AuxStage1Message is the type of messages used by the binary consensus It implements messages.MsgHeader

func NewAuxStage1Message

func NewAuxStage1Message() *AuxStage1Message

NewAuxStage1Message creates a new empty AuxStage1Message

func (*AuxStage1Message) DeserializeInternal

func (apm *AuxStage1Message) DeserializeInternal(m *messages.Message) (bytesRead, signEndOffset int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*AuxStage1Message) GetBaseMsgHeader

func (apm *AuxStage1Message) GetBaseMsgHeader() messages.InternalSignedMsgHeader

GetBaseMsgHeader returns the header pertaning to the message contents.

func (*AuxStage1Message) GetID

func (apm *AuxStage1Message) GetID() messages.HeaderID

GetID returns the header id for this header

func (*AuxStage1Message) GetMsgID

func (apm *AuxStage1Message) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header, in this case a BinMsgID (see MsgID definition for more details)

func (*AuxStage1Message) GetSignType

func (*AuxStage1Message) GetSignType() types.SignType

GetSignType returns types.NormalSignature

func (*AuxStage1Message) NeedsSMValidation

func (apm *AuxStage1Message) NeedsSMValidation(types.ConsensusIndex, int) (idx types.ConsensusIndex,
	proposal []byte, err error)

NeedsSMValidation returns nil, since these messages do not need to be validated by the state machine.

func (*AuxStage1Message) SerializeInternal

func (apm *AuxStage1Message) SerializeInternal(m *messages.Message) (bytesWritten, signEndOffset int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*AuxStage1Message) ShallowCopy

type BVMessage0

type BVMessage0 struct {
	Round types.ConsensusRound // The round within the consensus instance
	Stage byte                 // The stage within the consensus this message is for
}

BVMessage0 is the type of messages used by the binary consensus It implements messages.MsgHeader

func NewBVMessage0

func NewBVMessage0() *BVMessage0

NewBVMessage0 creates a new empty BVMessage0

func (*BVMessage0) DeserializeInternal

func (bvm *BVMessage0) DeserializeInternal(m *messages.Message) (bytesRead, signEndOffset int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*BVMessage0) GetBaseMsgHeader

func (bvm *BVMessage0) GetBaseMsgHeader() messages.InternalSignedMsgHeader

GetBaseMsgHeader returns the header pertaning to the message contents.

func (*BVMessage0) GetID

func (bvm *BVMessage0) GetID() messages.HeaderID

GetID returns the header id for this header

func (*BVMessage0) GetMsgID

func (bvm *BVMessage0) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header, in this case a BinMsgID (see MsgID definition for more details)

func (*BVMessage0) GetSignType

func (*BVMessage0) GetSignType() types.SignType

GetSignType returns type.NormalSignature

func (*BVMessage0) NeedsSMValidation

func (bvm *BVMessage0) NeedsSMValidation(types.ConsensusIndex, int) (idx types.ConsensusIndex,
	proposal []byte, err error)

NeedsSMValidation returns nil, since these messages do not need to be validated by the state machine.

func (*BVMessage0) SerializeInternal

func (bvm *BVMessage0) SerializeInternal(m *messages.Message) (bytesWritten, signEndOffset int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*BVMessage0) ShallowCopy

func (bvm *BVMessage0) ShallowCopy() messages.InternalSignedMsgHeader

type BVMessage1

type BVMessage1 struct {
	Round types.ConsensusRound // The round within the consensus instance
	Stage byte
}

BVMessage1 is the type of messages used by the binary consensus It implements messages.MsgHeader

func NewBVMessage1

func NewBVMessage1() *BVMessage1

NewBVMessage1 creates a new empty BVMessage1

func (*BVMessage1) DeserializeInternal

func (bvm *BVMessage1) DeserializeInternal(m *messages.Message) (bytesRead, signEndOffset int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*BVMessage1) GetBaseMsgHeader

func (bvm *BVMessage1) GetBaseMsgHeader() messages.InternalSignedMsgHeader

GetBaseMsgHeader returns the header pertaning to the message contents.

func (*BVMessage1) GetID

func (bvm *BVMessage1) GetID() messages.HeaderID

GetID returns the header id for this header

func (*BVMessage1) GetMsgID

func (bvm *BVMessage1) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header, in this case a BinMsgID (see MsgID definition for more details)

func (*BVMessage1) GetSignType

func (*BVMessage1) GetSignType() types.SignType

GetSignType retursn types.NormalSignature

func (*BVMessage1) NeedsSMValidation

func (bvm *BVMessage1) NeedsSMValidation(types.ConsensusIndex, int) (idx types.ConsensusIndex,
	proposal []byte, err error)

NeedsSMValidation returns nil, since these messages do not need to be validated by the state machine.

func (*BVMessage1) SerializeInternal

func (bvm *BVMessage1) SerializeInternal(m *messages.Message) (bytesWritten, signEndOffset int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*BVMessage1) ShallowCopy

func (bvm *BVMessage1) ShallowCopy() messages.InternalSignedMsgHeader

type BinMsgID

type BinMsgID struct {
	HdrID messages.HeaderID
	Round types.ConsensusRound
	Stage byte
}

BinMsgID implements messages.MsgID. It is used to differentiate between AuxProofMessages of different rounds by comparing them, for example, during consensus we can count n-t different AuxProofMessages of each round (even if the AuxProofMessages have different binary values, the BinMsgID should be equal for the same round).

func (BinMsgID) IsMsgID

func (BinMsgID) IsMsgID() bool

IsMsgID to satisfy the interface and returns true

func (BinMsgID) ToBytes

func (bm BinMsgID) ToBytes(index types.ConsensusIndex) []byte

func (BinMsgID) ToMsgIDInfo

func (bm BinMsgID) ToMsgIDInfo() messages.MsgIDInfo

ToMsgIDInfo converts the MsgID to a MsgIDInfo

type BinProposeMessage

type BinProposeMessage struct {
	Index  types.ConsensusIndex // Index is the index of consensus
	BinVal types.BinVal         // BinVal is the binary value to propose
	// contains filtered or unexported fields
}

BinProposeMessage details a proposal for an instance of binary consensus. It implements messages.MsgHeader

func NewBinProposeMessage

func NewBinProposeMessage(index types.ConsensusIndex, binVal types.BinVal) *BinProposeMessage

NewBinProposeMessage creates a new bin propose message

func (BinProposeMessage) Deserialize

func (BinProposeMessage) Deserialize(*messages.Message, types.ConsensusIndexFuncs) (int, error)

Deserialize is unsed since it is a lcoal message.

func (BinProposeMessage) GetBytes

func (BinProposeMessage) GetBytes(*messages.Message) ([]byte, error)

GetBytes is unsed since it is a lcoal message.

func (*BinProposeMessage) GetID

func (pm *BinProposeMessage) GetID() messages.HeaderID

GetID returns the header id for this header

func (*BinProposeMessage) GetIndex

func (pm *BinProposeMessage) GetIndex() types.ConsensusIndex

GetIndex returns the consensus index of this message

func (*BinProposeMessage) GetMsgID

func (pm *BinProposeMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header (see MsgID definition for more details)

func (BinProposeMessage) PeekHeaders

func (BinProposeMessage) PeekHeaders(*messages.Message,
	types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)

PeekHeaders is unused since it is a local message.

func (BinProposeMessage) Serialize

func (BinProposeMessage) Serialize(*messages.Message) (int, error)

Serialize is unsed since it is a lcoal message.

type CoinMessage

type CoinMessage struct {
	Round types.ConsensusRound // The round within the consensus instance
	// contains filtered or unexported fields
}

CoinMessage is used by random binary consensus. Once we receive n-t of these for the threshold signature, the coin value of the round is revealed. To ensure that coin is unpredictable, be sure to change config.CsID each time consensus is run (this is included in all signed messages). It implements messages.MsgHeader

func NewCoinMessage

func NewCoinMessage() *CoinMessage

NewCoinMessage creates a new empty CoinMessage

func (*CoinMessage) DeserializeInternal

func (cm *CoinMessage) DeserializeInternal(m *messages.Message) (bytesRead, signEndOffset int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*CoinMessage) GetBaseMsgHeader

func (cm *CoinMessage) GetBaseMsgHeader() messages.InternalSignedMsgHeader

GetBaseMsgHeader returns the header pertaning to the message contents.

func (*CoinMessage) GetID

func (cm *CoinMessage) GetID() messages.HeaderID

GetID returns the header id for this header

func (*CoinMessage) GetMsgID

func (cm *CoinMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header, in this case a BinMsgID (see MsgID definition for more details)

func (*CoinMessage) GetSignType

func (cm *CoinMessage) GetSignType() types.SignType

GetSignType returns the SignType that was used for this message during allocation.

func (*CoinMessage) NeedsSMValidation

func (cm *CoinMessage) NeedsSMValidation(types.ConsensusIndex, int) (idx types.ConsensusIndex,
	proposal []byte, err error)

NeedsSMValidation returns nil, since these messages do not need to be validated by the state machine.

func (*CoinMessage) SerializeInternal

func (cm *CoinMessage) SerializeInternal(m *messages.Message) (bytesWritten, signEndOffset int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*CoinMessage) ShallowCopy

func (cm *CoinMessage) ShallowCopy() messages.InternalSignedMsgHeader

type CoinMsgID

type CoinMsgID struct {
	HdrID messages.HeaderID
	Round types.ConsensusRound
}

BinMsgID implements messages.MsgID. It is used to differentiate between CoinMessages of different rounds by comparing them, for example, during consensus we can count n-t different CoinMessages of each round (even if the CoinMessages have different binary values, the BinMsgID should be equal for the same round).

func (CoinMsgID) IsMsgID

func (CoinMsgID) IsMsgID() bool

IsMsgID to satisfy the interface and returns true

func (CoinMsgID) ToBytes

func (bm CoinMsgID) ToBytes(index types.ConsensusIndex) []byte

func (CoinMsgID) ToMsgIDInfo

func (bm CoinMsgID) ToMsgIDInfo() messages.MsgIDInfo

ToMsgIDInfo converts the MsgID to a MsgIDInfo

type CoinPreMessage

type CoinPreMessage struct {
	Round types.ConsensusRound // The round within the consensus instance
}

CoinPreMessage is used by random binary consensus. It is sent before the coin to change a t+1 threshold coin to an n-t one It implements messages.MsgHeader

func NewCoinPreMessage

func NewCoinPreMessage() *CoinPreMessage

NewCoinPreMessage creates a new empty CoinPreMessage

func (*CoinPreMessage) DeserializeInternal

func (cm *CoinPreMessage) DeserializeInternal(m *messages.Message) (bytesRead, signEndOffset int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*CoinPreMessage) GetBaseMsgHeader

func (cm *CoinPreMessage) GetBaseMsgHeader() messages.InternalSignedMsgHeader

GetBaseMsgHeader returns the header pertaning to the message contents.

func (*CoinPreMessage) GetID

func (cm *CoinPreMessage) GetID() messages.HeaderID

GetID returns the header id for this header

func (*CoinPreMessage) GetMsgID

func (cm *CoinPreMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header, in this case a BinMsgID (see MsgID definition for more details)

func (*CoinPreMessage) GetSignType

func (cm *CoinPreMessage) GetSignType() types.SignType

GetSignType returns the SignType that was used for this message during allocation.

func (*CoinPreMessage) NeedsSMValidation

func (cm *CoinPreMessage) NeedsSMValidation(types.ConsensusIndex, int) (idx types.ConsensusIndex,
	proposal []byte, err error)

NeedsSMValidation returns nil, since these messages do not need to be validated by the state machine.

func (*CoinPreMessage) SerializeInternal

func (cm *CoinPreMessage) SerializeInternal(m *messages.Message) (bytesWritten, signEndOffset int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*CoinPreMessage) ShallowCopy

type CombinedMessage

type CombinedMessage struct {
	messages.InternalSignedMsgHeader
	Round            types.ConsensusRound
	FullMsgHash      types.HashBytes
	PartialMsgHashes []types.HashBytes
}

CombinedMsg is a full message constructed from partial messages It implements messages.InternalSignedMsgHeader

func CreatePartial

func CreatePartial(hdr messages.InternalSignedMsgHeader, round types.ConsensusRound, pieces int,
	partialType types.PartialMessageType) (combined *CombinedMessage, partials []messages.InternalSignedMsgHeader, err error)

CreatePartial creates a list of partial messages and the corresponding combined message given a header, the number of pieces to break the message into and the partial message type.

func GenerateCombinedMessage

GenerateCombinedMessage takes a PartialMessage that was one of the inputs to GenerateCombinedMessageBytes, the output of that function, and a function that will return a message header from the headerID. It outputs the CombinedMessage created from this.

func NewCombinedMessage

func NewCombinedMessage(fullMsg messages.InternalSignedMsgHeader) *CombinedMessage

NewCombinedMessage returns a new CombinedMessage for the given internal message header type.

func NewCombinedMessageFromPartial

func NewCombinedMessageFromPartial(partial *PartialMessage, fullMsg messages.InternalSignedMsgHeader) *CombinedMessage

NewCombinedMessage returns a new CombinedMessage for the given header and partial message.

func (*CombinedMessage) DeserializeInternal

func (mvi *CombinedMessage) DeserializeInternal(m *messages.Message) (bytesRead, signEndOffset int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*CombinedMessage) GetBaseMsgHeader

func (mvi *CombinedMessage) GetBaseMsgHeader() messages.InternalSignedMsgHeader

GetBaseMsgHeader returns the header pertaning to the message contents.

func (*CombinedMessage) SerializeInternal

func (mvi *CombinedMessage) SerializeInternal(m *messages.Message) (bytesWritten, signEndOffset int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*CombinedMessage) ShallowCopy

ShallowCopy returns a shallow copy of the message

type ConsBinStateMessage

type ConsBinStateMessage []byte

ConsBinStateMessage represents a set of many consensus messages all appended together. It is used during recovery to send blocks of messages. It implements messages.MsgHeader

func (ConsBinStateMessage) Deserialize

Deserialize deserialzes a header into the object, returning the number of bytes read

func (ConsBinStateMessage) GetBytes

func (cm ConsBinStateMessage) GetBytes(m *messages.Message) ([]byte, error)

GetBytes returns the bytes that make up the message

func (ConsBinStateMessage) GetID

GetID returns the header id for this header

func (ConsBinStateMessage) GetIndex

func (cm ConsBinStateMessage) GetIndex() types.ConsensusInt

GetIndex returns 0.

func (ConsBinStateMessage) GetMsgID

func (cm ConsBinStateMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header (see MsgID definition for more details)

func (ConsBinStateMessage) PeekHeaders

func (ConsBinStateMessage) PeekHeaders(m *messages.Message,
	unmarFunc types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)

PeekHeader returns the indices related to the messages without impacting m.

func (ConsBinStateMessage) Serialize

func (cm ConsBinStateMessage) Serialize(m *messages.Message) (int, error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

type ConsMessage

type ConsMessage struct {
	// contains filtered or unexported fields
}

ConsMessage is a header that indicates it will be followed by a message dealing with consensus. It implements messages.MsgHeader

func NewConsMessage

func NewConsMessage() *ConsMessage

func (*ConsMessage) Deserialize

func (cm *ConsMessage) Deserialize(m *messages.Message, _ types.ConsensusIndexFuncs) (int, error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*ConsMessage) GetBytes

func (npm *ConsMessage) GetBytes(m *messages.Message) ([]byte, error)

GetBytes returns the bytes that make up the message

func (*ConsMessage) GetID

func (cm *ConsMessage) GetID() messages.HeaderID

GetID returns the header id for this header

func (*ConsMessage) GetIndex

func (npm *ConsMessage) GetIndex() types.ConsensusIndex

GetIndex returns the consensus index for this message.

func (*ConsMessage) GetMsgID

func (cm *ConsMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header, in this case a BinMsgID (see MsgID definition for more details)

func (ConsMessage) PeekHeaders

func (ConsMessage) PeekHeaders(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)

PeekHeader returns the indices related to the messages without impacting m.

func (*ConsMessage) Serialize

func (cm *ConsMessage) Serialize(m *messages.Message) (int, error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

type EventMessage

type EventMessage struct {
	Event graph.EventInfo
	// contains filtered or unexported fields
}

EventMessage is used during multi-value consensus to send a graph based message to all other nodes. It implements messages.MsgHeader

func NewEventMessage

func NewEventMessage() *EventMessage

NewEventMessage creates a new mv echo message

func (*EventMessage) DeserializeInternal

func (hm *EventMessage) DeserializeInternal(m *messages.Message) (bytesRead, signEndOffset int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*EventMessage) GetBaseMsgHeader

func (hm *EventMessage) GetBaseMsgHeader() messages.InternalSignedMsgHeader

GetBaseMsgHeader returns the header pertaning to the message contents.

func (*EventMessage) GetEventInfoHash

func (hm *EventMessage) GetEventInfoHash() types.HashBytes

GetEventInfoHash returns the hash of the event info object.

func (*EventMessage) GetID

func (hm *EventMessage) GetID() messages.HeaderID

GetID returns the header id for this header

func (*EventMessage) GetMsgID

func (hm *EventMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header, in this case a MvMsgID (see MsgID definition for more details)

func (*EventMessage) GetSignType

func (*EventMessage) GetSignType() types.SignType

GetSignType returns types.NormalSignature

func (*EventMessage) NeedsSMValidation

func (hm *EventMessage) NeedsSMValidation(types.ConsensusIndex, int) (idx types.ConsensusIndex,
	proposal []byte, err error)

NeedsSMValidation returns nil, since these messages do not need to be validated by the state machine (this is because we have concurrent proposals).

func (*EventMessage) SerializeInternal

func (hm *EventMessage) SerializeInternal(m *messages.Message) (bytesWritten, signEndOffset int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*EventMessage) ShallowCopy

func (hm *EventMessage) ShallowCopy() messages.InternalSignedMsgHeader

type HashMessage

type HashMessage struct {
	TheHash types.HashBytes // The hash of the proposal being echo'd
}

HashMessage is used during multi-value consensus to echo the MvInitMessage by all participants. It implements messages.MsgHeader

func NewHashMessage

func NewHashMessage() *HashMessage

NewHashMessage creates a new mv echo message

func (*HashMessage) DeserializeInternal

func (hm *HashMessage) DeserializeInternal(m *messages.Message) (bytesRead, signEndOffset int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*HashMessage) GetBaseMsgHeader

func (hm *HashMessage) GetBaseMsgHeader() messages.InternalSignedMsgHeader

GetBaseMsgHeader returns the header pertaning to the message contents.

func (*HashMessage) GetID

func (hm *HashMessage) GetID() messages.HeaderID

GetID returns the header id for this header

func (*HashMessage) GetMsgID

func (hm *HashMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header, in this case a MvMsgID (see MsgID definition for more details)

func (*HashMessage) GetSignType

func (*HashMessage) GetSignType() types.SignType

GetSignType returns types.NormalSignature

func (*HashMessage) NeedsSMValidation

func (hm *HashMessage) NeedsSMValidation(types.ConsensusIndex, int) (idx types.ConsensusIndex,
	proposal []byte, err error)

NeedsSMValidation returns nil, since these messages do not need to be validated by the state machine.

func (*HashMessage) SerializeInternal

func (hm *HashMessage) SerializeInternal(m *messages.Message) (bytesWritten, signEndOffset int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*HashMessage) ShallowCopy

func (hm *HashMessage) ShallowCopy() messages.InternalSignedMsgHeader

type IndexMessage

type IndexMessage struct {
	Indices []graph.IndexType
	IsReply bool
}

IndexMessage is used during multi-value consensus to send a graph based message to all other nodes. It implements messages.MsgHeader

func NewIndexMessage

func NewIndexMessage() *IndexMessage

NewIndexMessage creates a new index message.

func (*IndexMessage) DeserializeInternal

func (hm *IndexMessage) DeserializeInternal(m *messages.Message) (bytesRead, signEndOffset int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*IndexMessage) GetBaseMsgHeader

func (hm *IndexMessage) GetBaseMsgHeader() messages.InternalSignedMsgHeader

GetBaseMsgHeader returns the header pertaning to the message contents.

func (*IndexMessage) GetID

func (hm *IndexMessage) GetID() messages.HeaderID

GetID returns the header id for this header

func (*IndexMessage) GetMsgID

func (hm *IndexMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header, in this case a BasicMsgID (see MsgID definition for more details)

func (*IndexMessage) GetSignType

func (*IndexMessage) GetSignType() types.SignType

GetSignType returns types.NormalSignature

func (*IndexMessage) NeedsSMValidation

func (hm *IndexMessage) NeedsSMValidation(types.ConsensusIndex, int) (idx types.ConsensusIndex,
	proposal []byte, err error)

NeedsSMValidation returns nil.

func (*IndexMessage) SerializeInternal

func (hm *IndexMessage) SerializeInternal(m *messages.Message) (bytesWritten, signEndOffset int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*IndexMessage) ShallowCopy

func (hm *IndexMessage) ShallowCopy() messages.InternalSignedMsgHeader

type IndexRecoverMsg

type IndexRecoverMsg struct {
	IndexMessage
	MissingDependencies []graph.EventPointer
	// contains filtered or unexported fields
}

IndexRecoverMsg is used for MvCons4 recovery

func NewIndexRecoverMsg

func NewIndexRecoverMsg(index types.ConsensusIndex) *IndexRecoverMsg

NewIndexMessage creates a new index recover message.

func (*IndexRecoverMsg) Deserialize

func (npm *IndexRecoverMsg) Deserialize(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (n int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*IndexRecoverMsg) GetBytes

func (npm *IndexRecoverMsg) GetBytes(m *messages.Message) ([]byte, error)

GetBytes returns the bytes that make up the message

func (*IndexRecoverMsg) GetID

func (npm *IndexRecoverMsg) GetID() messages.HeaderID

GetID returns the header id for this header

func (*IndexRecoverMsg) GetIndex

func (npm *IndexRecoverMsg) GetIndex() types.ConsensusIndex

GetIndex returns the consensus index for this message.

func (IndexRecoverMsg) PeekHeaders

func (IndexRecoverMsg) PeekHeaders(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)

PeekHeader returns the indices related to the messages without impacting m.

func (*IndexRecoverMsg) Serialize

func (npm *IndexRecoverMsg) Serialize(m *messages.Message) (n int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

type MvCommitMessage

type MvCommitMessage struct {
	ProposalHash types.HashBytes // The hash of the proposal being Commit'd
	Round        types.ConsensusRound
}

MvCommitMessage is used during multi-value consensus to Commit the MvInitMessage by all participants. It implements messages.MsgHeader

func NewMvCommitMessage

func NewMvCommitMessage() *MvCommitMessage

NewMvCommitMessage creates a new mv Commit message

func (*MvCommitMessage) DeserializeInternal

func (mvc *MvCommitMessage) DeserializeInternal(m *messages.Message) (bytesRead, signEndOffset int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*MvCommitMessage) GetBaseMsgHeader

func (mvc *MvCommitMessage) GetBaseMsgHeader() messages.InternalSignedMsgHeader

GetBaseMsgHeader returns the header pertaning to the message contents.

func (*MvCommitMessage) GetID

func (mvc *MvCommitMessage) GetID() messages.HeaderID

GetID returns the header id for this header

func (*MvCommitMessage) GetMsgID

func (mvc *MvCommitMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header, in this case a MvMsgID (see MsgID definition for more details)

func (*MvCommitMessage) GetSignType

func (mvc *MvCommitMessage) GetSignType() types.SignType

NeedsCoinProof returns false.

func (*MvCommitMessage) NeedsSMValidation

func (mvc *MvCommitMessage) NeedsSMValidation(types.ConsensusIndex, int) (idx types.ConsensusIndex,
	proposal []byte, err error)

NeedsSMValidation returns nil, since these messages do not need to be validated by the state machine.

func (*MvCommitMessage) SerializeInternal

func (mvc *MvCommitMessage) SerializeInternal(m *messages.Message) (bytesWritten, signEndOffset int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*MvCommitMessage) ShallowCopy

type MvCommitMessageTimeout

type MvCommitMessageTimeout types.ConsensusRound

MvCommitMessageTimeout is sent internally to indicate that timeout has passed for a round while waiting for MvCommitMessage

func (MvCommitMessageTimeout) Deserialize

Deserialize is unused since it is a local message.

func (MvCommitMessageTimeout) GetBytes

func (tm MvCommitMessageTimeout) GetBytes(*messages.Message) ([]byte, error)

GetBytes is unused since it is a local message.

func (MvCommitMessageTimeout) GetID

GetID returns the header id for this header.

func (MvCommitMessageTimeout) GetMsgID

func (tm MvCommitMessageTimeout) GetMsgID() messages.MsgID

GetMsgID is unused since it is a local message.

func (MvCommitMessageTimeout) PeekHeaders

PeekHeaders is unused since it is a local message.

func (MvCommitMessageTimeout) Serialize

func (tm MvCommitMessageTimeout) Serialize(*messages.Message) (int, error)

Serialize is unused since it is a local message.

type MvEchoHashMessage

type MvEchoHashMessage struct {
	ProposalHash    types.HashBytes // The hash of the proposal being echo'd
	Round           types.ConsensusRound
	RandHash        types.HashBytes // the hash to identify the unique set of members (when using types.LaterMC and random members)
	IncludeRandHash bool            // if true we include the rand hash in the message
}

MvEchoMessage is used during multi-value consensus to echo the MvInitMessage by all participants, plus an additional hash. It implements messages.MsgHeader

func NewMvEchoHashMessage

func NewMvEchoHashMessage(includeRandHash bool) *MvEchoHashMessage

NewMvEchoMessage creates a new mv echo message

func (*MvEchoHashMessage) DeserializeInternal

func (mve *MvEchoHashMessage) DeserializeInternal(m *messages.Message) (bytesRead, signEndOffset int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*MvEchoHashMessage) GetBaseMsgHeader

func (mve *MvEchoHashMessage) GetBaseMsgHeader() messages.InternalSignedMsgHeader

GetBaseMsgHeader returns the header pertaning to the message contents.

func (*MvEchoHashMessage) GetID

func (mve *MvEchoHashMessage) GetID() messages.HeaderID

GetID returns the header id for this header

func (*MvEchoHashMessage) GetMsgID

func (mve *MvEchoHashMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header, in this case a MvMsgID (see MsgID definition for more details)

func (*MvEchoHashMessage) GetSignType

func (*MvEchoHashMessage) GetSignType() types.SignType

GetSignType return types.NormalSignature

func (*MvEchoHashMessage) NeedsSMValidation

func (mve *MvEchoHashMessage) NeedsSMValidation(types.ConsensusIndex, int) (idx types.ConsensusIndex,
	proposal []byte, err error)

NeedsSMValidation returns nil, since these messages do not need to be validated by the state machine.

func (*MvEchoHashMessage) SerializeInternal

func (mve *MvEchoHashMessage) SerializeInternal(m *messages.Message) (bytesWritten, signEndOffset int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*MvEchoHashMessage) ShallowCopy

type MvEchoMessage

type MvEchoMessage struct {
	ProposalHash types.HashBytes // The hash of the proposal being echo'd
	Round        types.ConsensusRound
}

MvEchoMessage is used during multi-value consensus to echo the MvInitMessage by all participants. It implements messages.MsgHeader

func NewMvEchoMessage

func NewMvEchoMessage() *MvEchoMessage

NewMvEchoMessage creates a new mv echo message

func (*MvEchoMessage) DeserializeInternal

func (mve *MvEchoMessage) DeserializeInternal(m *messages.Message) (bytesRead, signEndOffset int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*MvEchoMessage) GetBaseMsgHeader

func (mve *MvEchoMessage) GetBaseMsgHeader() messages.InternalSignedMsgHeader

GetBaseMsgHeader returns the header pertaning to the message contents.

func (*MvEchoMessage) GetID

func (mve *MvEchoMessage) GetID() messages.HeaderID

GetID returns the header id for this header

func (*MvEchoMessage) GetMsgID

func (mve *MvEchoMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header, in this case a MvMsgID (see MsgID definition for more details)

func (*MvEchoMessage) GetSignType

func (*MvEchoMessage) GetSignType() types.SignType

GetSignType return types.NormalSignature

func (*MvEchoMessage) NeedsSMValidation

func (mve *MvEchoMessage) NeedsSMValidation(types.ConsensusIndex, int) (idx types.ConsensusIndex,
	proposal []byte, err error)

NeedsSMValidation returns nil, since these messages do not need to be validated by the state machine.

func (*MvEchoMessage) SerializeInternal

func (mve *MvEchoMessage) SerializeInternal(m *messages.Message) (bytesWritten, signEndOffset int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*MvEchoMessage) ShallowCopy

func (mve *MvEchoMessage) ShallowCopy() messages.InternalSignedMsgHeader

type MvEchoMessageTimeout

type MvEchoMessageTimeout types.ConsensusRound

MvEchoMessageTimeout is sent internally to indicate that timeout has passed for a round while waiting for MvEchoMessage

func (MvEchoMessageTimeout) Deserialize

Deserialize is unused since it is a local message.

func (MvEchoMessageTimeout) GetBytes

func (tm MvEchoMessageTimeout) GetBytes(*messages.Message) ([]byte, error)

GetBytes is unused since it is a local message.

func (MvEchoMessageTimeout) GetID

GetID returns the header id for this header.

func (MvEchoMessageTimeout) GetMsgID

func (tm MvEchoMessageTimeout) GetMsgID() messages.MsgID

GetMsgID is unused since it is a local message.

func (MvEchoMessageTimeout) PeekHeaders

PeekHeaders is unused since it is a local message.

func (MvEchoMessageTimeout) Serialize

func (tm MvEchoMessageTimeout) Serialize(*messages.Message) (int, error)

Serialize is unused since it is a local message.

type MvInitMessage

type MvInitMessage struct {
	Proposal    []byte // The proposal
	ByzProposal []byte // Alternative proposal for byzantine nodes
	Round       types.ConsensusRound
}

MvInitMessage is used by the coordinator of a round of multi-value consensus to send its proposal. It implements messages.MsgHeader

func NewMvInitMessage

func NewMvInitMessage() *MvInitMessage

NewMvInitMessage creates a new mv init message

func (*MvInitMessage) DeserializeInternal

func (mvi *MvInitMessage) DeserializeInternal(m *messages.Message) (bytesRead, signEndOffset int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*MvInitMessage) GetBaseMsgHeader

func (mvi *MvInitMessage) GetBaseMsgHeader() messages.InternalSignedMsgHeader

GetBaseMsgHeader returns the header pertaning to the message contents.

func (*MvInitMessage) GetID

func (mvi *MvInitMessage) GetID() messages.HeaderID

GetID returns the header id for this header

func (*MvInitMessage) GetMsgID

func (mvi *MvInitMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header, in this case a MvMsgID (see MsgID definition for more details)

func (*MvInitMessage) GetSignType

func (*MvInitMessage) GetSignType() types.SignType

GetSignType returns types.NormalSignature

func (*MvInitMessage) NeedsSMValidation

func (mvi *MvInitMessage) NeedsSMValidation(msgIndex types.ConsensusIndex, proposalIdx int) (idx types.ConsensusIndex,
	proposal []byte, err error)

NeedsSMValidation returns the proposal bytes to be validated by the SM. It takes as input the current index and returns the index -1. It panics if proposalIdx is not 0.

func (*MvInitMessage) SerializeInternal

func (mvi *MvInitMessage) SerializeInternal(m *messages.Message) (bytesWritten, signEndOffset int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*MvInitMessage) ShallowCopy

func (mvi *MvInitMessage) ShallowCopy() messages.InternalSignedMsgHeader

ShallowCopy makes a shallow copy of the message

type MvInitMessageTimeout

type MvInitMessageTimeout types.ConsensusRound

MvInitMessageTimeout is sent internally to indicate that timeout has passed for a round while waiting for MvInitMessage

func (MvInitMessageTimeout) Deserialize

Deserialize is unused since it is a local message.

func (MvInitMessageTimeout) GetBytes

func (tm MvInitMessageTimeout) GetBytes(*messages.Message) ([]byte, error)

GetBytes is unused since it is a local message.

func (MvInitMessageTimeout) GetID

GetID returns the header id for this header.

func (MvInitMessageTimeout) GetMsgID

func (tm MvInitMessageTimeout) GetMsgID() messages.MsgID

GetMsgID is unused since it is a local message.

func (MvInitMessageTimeout) PeekHeaders

PeekHeaders is unused since it is a local message.

func (MvInitMessageTimeout) Serialize

func (tm MvInitMessageTimeout) Serialize(*messages.Message) (int, error)

Serialize is unused since it is a local message.

type MvInitSupportMessage

type MvInitSupportMessage struct {
	Proposal        []byte             // The proposal
	ByzProposal     []byte             // Alternative proposal for byzantine nodes
	SupportedIndex  types.ConsensusInt // the index supported by this init
	SupportedHash   types.HashBytes    // the hash of the init message supported
	RandHash        types.HashBytes    // the hash to identify the unique set of members (when using types.LaterMC and random members)
	IncludeRandHash bool               // if true we include the rand hash in the message
}

MvInitSupportMessage is used by the coordinator of a round of multi-value consensus to send its proposal with the additional information about the previous proposal it points to. It implements messages.MsgHeader

func NewMvInitSupportMessage

func NewMvInitSupportMessage(includeRandHash bool) *MvInitSupportMessage

NewMvInitMessage creates a new mv init message

func (*MvInitSupportMessage) DeserializeInternal

func (mvi *MvInitSupportMessage) DeserializeInternal(m *messages.Message) (bytesRead, signEndOffset int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*MvInitSupportMessage) GetBaseMsgHeader

func (mvi *MvInitSupportMessage) GetBaseMsgHeader() messages.InternalSignedMsgHeader

GetBaseMsgHeader returns the header pertaning to the message contents.

func (*MvInitSupportMessage) GetID

func (mvi *MvInitSupportMessage) GetID() messages.HeaderID

GetID returns the header id for this header

func (*MvInitSupportMessage) GetMsgID

func (mvi *MvInitSupportMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header, in this case a MvMsgID (see MsgID definition for more details)

func (*MvInitSupportMessage) GetSignType

func (*MvInitSupportMessage) GetSignType() types.SignType

GetSignType returns types.NormalSignature

func (*MvInitSupportMessage) NeedsSMValidation

func (mvi *MvInitSupportMessage) NeedsSMValidation(msgIndex types.ConsensusIndex, proposalIdx int) (idx types.ConsensusIndex,
	proposal []byte, err error)

NeedsSMValidation returns the proposal bytes to be validated by the state machine.

func (*MvInitSupportMessage) SerializeInternal

func (mvi *MvInitSupportMessage) SerializeInternal(m *messages.Message) (bytesWritten, signEndOffset int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*MvInitSupportMessage) ShallowCopy

ShallowCopy makes a shallow copy of the message

type MvMsgID

type MvMsgID struct {
	HdrID messages.HeaderID
	Round types.ConsensusRound
}

MvMsgID implements messages.MsgID. It is used to differentiate between multi-value consensus messages of different types rounds by comparing them, for example, during consensus we can count n-t different MvEchoMessages of each round (even if the MvEchoMessages have different echo values, the MvMsgID should be equal for the same round).

func (MvMsgID) IsMsgID

func (MvMsgID) IsMsgID() bool

IsMsgID to satisfy the interface and returns true

func (MvMsgID) ToBytes

func (bm MvMsgID) ToBytes(index types.ConsensusIndex) []byte

func (MvMsgID) ToMsgIDInfo

func (bm MvMsgID) ToMsgIDInfo() messages.MsgIDInfo

ToMsgIDInfo converts the MsgID to a MsgIDInfo

type MvMultiInitMessage

type MvMultiInitMessage struct {
	Proposals [][]byte // The proposals
}

MvInitMessage is used by the coordinator of a round of multi-value consensus to send multiple proposals using a single consensus item. It implements messages.MsgHeader

func NewMvMultiInitMessage

func NewMvMultiInitMessage() *MvMultiInitMessage

NewMvMultiInitMessage creates a new mv init message

func (*MvMultiInitMessage) DeserializeInternal

func (mvi *MvMultiInitMessage) DeserializeInternal(m *messages.Message) (bytesRead, signEndOffset int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*MvMultiInitMessage) GetBaseMsgHeader

func (mvi *MvMultiInitMessage) GetBaseMsgHeader() messages.InternalSignedMsgHeader

GetBaseMsgHeader returns the header pertaning to the message contents.

func (*MvMultiInitMessage) GetID

func (mvi *MvMultiInitMessage) GetID() messages.HeaderID

GetID returns the header id for this header

func (*MvMultiInitMessage) GetMsgID

func (mvi *MvMultiInitMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header, in this case a MvMsgID (see MsgID definition for more details)

func (*MvMultiInitMessage) GetSignType

func (*MvMultiInitMessage) GetSignType() types.SignType

GetSignType returns types.NormalSignature

func (*MvMultiInitMessage) NeedsSMValidation

func (mvi *MvMultiInitMessage) NeedsSMValidation(msgIndex types.ConsensusIndex, proposalIdx int) (idx types.ConsensusIndex,
	proposal []byte, err error)

NeedsSMValidation returns the proposal bytes at the given proposalIdx to be validated by the SM. It returns the same msgIndex taken an input for idx output.

func (*MvMultiInitMessage) SerializeInternal

func (mvi *MvMultiInitMessage) SerializeInternal(m *messages.Message) (bytesWritten, signEndOffset int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*MvMultiInitMessage) ShallowCopy

ShallowCopy makes a shallow copy of the message

type MvProposeMessage

type MvProposeMessage struct {
	Index       types.ConsensusIndex // Index is the index of consensus for the proposal
	Proposal    []byte               // The actual proposal
	ByzProposal []byte               // Alternative proposal for byzantine nodes
	// contains filtered or unexported fields
}

MvProposeMessage details a proposal for an instance of multi-value consensus. It implements messages.MsgHeader

func NewMvProposeMessage

func NewMvProposeMessage(index types.ConsensusIndex, proposal []byte) *MvProposeMessage

NewMvProposeMessage creates a new mv propose message

func (MvProposeMessage) Deserialize

func (MvProposeMessage) Deserialize(*messages.Message, types.ConsensusIndexFuncs) (int, error)

Deserialize is unsed since it is a lcoal message.

func (MvProposeMessage) GetBytes

func (MvProposeMessage) GetBytes(*messages.Message) ([]byte, error)

GetBytes is unsed since it is a lcoal message.

func (*MvProposeMessage) GetID

func (pm *MvProposeMessage) GetID() messages.HeaderID

GetID returns the header id for this header

func (*MvProposeMessage) GetIndex

func (pm *MvProposeMessage) GetIndex() types.ConsensusIndex

GetIndex returns the consensus index of this message

func (*MvProposeMessage) GetMsgID

func (pm *MvProposeMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header (see MsgID definition for more details)

func (MvProposeMessage) PeekHeaders

func (MvProposeMessage) PeekHeaders(*messages.Message,
	types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)

PeekHeaders is unused since it is a local message.

func (MvProposeMessage) Serialize

func (MvProposeMessage) Serialize(*messages.Message) (int, error)

Serialize is unsed since it is a lcoal message.

type MvRequestRecoverMessage

type MvRequestRecoverMessage struct {
	Index        types.ConsensusIndex
	ProposalHash types.HashBytes // The hash of the proposal to recover
}

MvRequestRecoverMessage is used when multi-value consensus has completed, but only a hash was received, so the full proposal must be requested. It implements messages.MsgHeader

func NewMvRequestRecoverMessage

func NewMvRequestRecoverMessage() *MvRequestRecoverMessage

NewMvRequestRecoverMessage creates a new mv request recover message

func (*MvRequestRecoverMessage) Deserialize

func (mrm *MvRequestRecoverMessage) Deserialize(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (int, error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*MvRequestRecoverMessage) GetBytes

func (mrm *MvRequestRecoverMessage) GetBytes(m *messages.Message) ([]byte, error)

GetBytes returns the bytes that make up the message

func (*MvRequestRecoverMessage) GetID

GetID returns the header id for this header

func (*MvRequestRecoverMessage) GetIndex

GetIndex returns the consensus index for this message.

func (*MvRequestRecoverMessage) GetMsgID

func (mrm *MvRequestRecoverMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header (see MsgID definition for more details)

func (*MvRequestRecoverMessage) PeekHeaders

PeekHeader returns the indices related to the messages without impacting m.

func (*MvRequestRecoverMessage) Serialize

func (mrm *MvRequestRecoverMessage) Serialize(m *messages.Message) (int, error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

type NetworkTestMessage

type NetworkTestMessage struct {
	ID    uint32
	Index types.ConsensusID
}

func (*NetworkTestMessage) Deserialize

func (tm *NetworkTestMessage) Deserialize(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (int, error)

func (*NetworkTestMessage) GetBytes

func (tm *NetworkTestMessage) GetBytes(m *messages.Message) ([]byte, error)

func (NetworkTestMessage) GetID

func (*NetworkTestMessage) GetIndex

func (tm *NetworkTestMessage) GetIndex() types.ConsensusID

func (*NetworkTestMessage) GetMsgID

func (tm *NetworkTestMessage) GetMsgID() messages.MsgID

func (NetworkTestMessage) PeekHeaders

func (NetworkTestMessage) PeekHeaders(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (index types.ConsensusIndex,
	err error)

PeekHeader returns the indices related to the messages without impacting m.

func (*NetworkTestMessage) Serialize

func (tm *NetworkTestMessage) Serialize(m *messages.Message) (int, error)

type NoProgressMessage

type NoProgressMessage struct {
	TestID       int
	IndexDecided bool // if true then have already decided this index so only want future information
	// contains filtered or unexported fields
}

NoProgressMessage is sent when a node has made no progress towards consensus after a timeout. It implements messages.MsgHeader

func NewNoProgressMessage

func NewNoProgressMessage(index types.ConsensusIndex, indexDecided bool, testID int) *NoProgressMessage

func (*NoProgressMessage) Deserialize

func (npm *NoProgressMessage) Deserialize(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (int, error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*NoProgressMessage) GetBytes

func (npm *NoProgressMessage) GetBytes(m *messages.Message) ([]byte, error)

GetBytes returns the bytes that make up the message

func (*NoProgressMessage) GetID

func (npm *NoProgressMessage) GetID() messages.HeaderID

GetID returns the header id for this header

func (*NoProgressMessage) GetIndex

func (npm *NoProgressMessage) GetIndex() types.ConsensusIndex

GetIndex returns the consensus index for this message.

func (*NoProgressMessage) GetMsgID

func (npm *NoProgressMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header, in this case a BinMsgID (see MsgID definition for more details)

func (NoProgressMessage) PeekHeaders

func (NoProgressMessage) PeekHeaders(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)

PeekHeader returns the indices related to the messages without impacting m.

func (*NoProgressMessage) Serialize

func (npm *NoProgressMessage) Serialize(m *messages.Message) (int, error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

type PartialMessage

type PartialMessage struct {
	FullMsgHash types.HashBytes
	// Round is the consensus round, since we only have the index in the normal header, and we need the round for distingusing the proposals
	Round            types.ConsensusRound
	PartialMsgHashes []types.HashBytes
	PartialMsg       []byte
	PartialMsgIndex  int
}

PartialMessage is used by the coordinator of a round of multi-value consensus to send its proposal. It implements messages.InternalSignedMsgHeader

func NewPartialMessage

func NewPartialMessage() *PartialMessage

NewPartialMessage creates a new partial message

func (*PartialMessage) DeserializeInternal

func (pm *PartialMessage) DeserializeInternal(m *messages.Message) (bytesRead, signEndOffset int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*PartialMessage) GetBaseMsgHeader

func (pm *PartialMessage) GetBaseMsgHeader() messages.InternalSignedMsgHeader

GetBaseMsgHeader returns the header pertaning to the message contents.

func (*PartialMessage) GetID

func (pm *PartialMessage) GetID() messages.HeaderID

GetID returns the header id for this header

func (*PartialMessage) GetMsgID

func (pm *PartialMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header (see MsgID definition for more details) TODO

func (*PartialMessage) GetSignType

func (pm *PartialMessage) GetSignType() types.SignType

GetSignType returns types.NormalSignature

func (*PartialMessage) NeedsSMValidation

func (pm *PartialMessage) NeedsSMValidation(types.ConsensusIndex, int) (idx types.ConsensusIndex,
	proposal []byte, err error)

NeedsSMValidation returns nil, since these messages do not need to be validated by the state machine.

func (*PartialMessage) SerializeInternal

func (pm *PartialMessage) SerializeInternal(m *messages.Message) (bytesWritten, signEndOffset int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*PartialMessage) ShallowCopy

ShallowCopy returns a shallow copy of the message

type ScMsgID

type ScMsgID sig.PubKeyID

ScMsgID implements messages.MsgID. It is used to differentiate between multi-value consensus messages of different types by comparing them.

func (ScMsgID) IsMsgID

func (ScMsgID) IsMsgID() bool

IsMsgID to satisfy the interface and returns true

func (ScMsgID) ToBytes

func (sc ScMsgID) ToBytes(index types.ConsensusIndex) []byte

func (ScMsgID) ToMsgIDInfo

func (sc ScMsgID) ToMsgIDInfo() messages.MsgIDInfo

ToMsgIDInfo converts the MsgID to a MsgIDInfo

type SimpleConsMessage

type SimpleConsMessage struct {
	MyPub sig.Pub // The local nodes public key.
}

SimpleConsMessage is the message type used for the simple cons test. The message itself includes the public key (for fun). It implements messages.MsgHeader

func NewSimpleConsMessage

func NewSimpleConsMessage(pub sig.Pub) *SimpleConsMessage

NewSimpleConsMessage creates a new simple cons message

func (*SimpleConsMessage) DeserializeInternal

func (scm *SimpleConsMessage) DeserializeInternal(m *messages.Message) (bytesRead, signEndOffset int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*SimpleConsMessage) GetBaseMsgHeader

func (scm *SimpleConsMessage) GetBaseMsgHeader() messages.InternalSignedMsgHeader

GetBaseMsgHeader returns the header pertaning to the message contents.

func (*SimpleConsMessage) GetID

func (scm *SimpleConsMessage) GetID() messages.HeaderID

GetID returns the header id for this header

func (*SimpleConsMessage) GetMsgID

func (scm *SimpleConsMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header, in this case a BinMsgID (see MsgID definition for more details)

func (*SimpleConsMessage) GetSignType

func (*SimpleConsMessage) GetSignType() types.SignType

GetSignType returns types.NormalSignature

func (*SimpleConsMessage) NeedsSMValidation

func (scm *SimpleConsMessage) NeedsSMValidation(types.ConsensusIndex, int) (idx types.ConsensusIndex,
	proposal []byte, err error)

NeedsSMValidation returns nil, since these messages do not need to be validated by the state machine.

func (*SimpleConsMessage) SerializeInternal

func (scm *SimpleConsMessage) SerializeInternal(m *messages.Message) (bytesWritten, signEndOffset int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

func (*SimpleConsMessage) ShallowCopy

type SimpleConsProposeMessage

type SimpleConsProposeMessage struct {
	// contains filtered or unexported fields
}

SimpleConsProposeMessage is used as a proposal for the simple cons test. The proposal is just the consensus index.

func NewSimpleConsProposeMessage

func NewSimpleConsProposeMessage(index types.ConsensusIndex) *SimpleConsProposeMessage

func (SimpleConsProposeMessage) Deserialize

func (SimpleConsProposeMessage) Deserialize(*messages.Message, types.ConsensusIndexFuncs) (int, error)

Deserialize is unsed since it is a lcoal message.

func (SimpleConsProposeMessage) GetBytes

func (SimpleConsProposeMessage) GetBytes(*messages.Message) ([]byte, error)

GetBytes is unsed since it is a lcoal message.

func (*SimpleConsProposeMessage) GetID

GetID returns the header id for this header

func (*SimpleConsProposeMessage) GetMsgID

func (cm *SimpleConsProposeMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header, in this case a BinMsgID (see MsgID definition for more details)

func (SimpleConsProposeMessage) PeekHeaders

func (SimpleConsProposeMessage) PeekHeaders(*messages.Message,
	types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)

PeekHeaders is unused since it is a local message.

func (SimpleConsProposeMessage) Serialize

func (SimpleConsProposeMessage) Serialize(*messages.Message) (int, error)

Serialize is unsed since it is a lcoal message.

type TestMessageTimeout

type TestMessageTimeout int

TestMessageTimeout is used in the csnet package for testing.

func (TestMessageTimeout) CreateCopy

func (tm TestMessageTimeout) CreateCopy() messages.MsgHeader

func (TestMessageTimeout) Deserialize

func (TestMessageTimeout) GetBytes

func (tm TestMessageTimeout) GetBytes(m *messages.Message) ([]byte, error)

func (TestMessageTimeout) GetID

func (TestMessageTimeout) GetMsgID

func (tm TestMessageTimeout) GetMsgID() messages.MsgID

func (TestMessageTimeout) PeekHeaders

func (TestMessageTimeout) PeekHeaders(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (index types.ConsensusIndex,
	err error)

PeekHeader returns the indices related to the messages without impacting m.

func (TestMessageTimeout) Serialize

func (tm TestMessageTimeout) Serialize(m *messages.Message) (int, error)

type VRFProofMessage

type VRFProofMessage struct {
	Index    types.ConsensusIndex
	VRFProof sig.VRFProof
}

VRFProofMessage contains a VRFProof.

func NewVRFProofMessage

func NewVRFProofMessage(index types.ConsensusIndex, vrf sig.VRFProof) *VRFProofMessage

NewVRFProofMessage creates a new simple cons message

func (*VRFProofMessage) Deserialize

func (vrm *VRFProofMessage) Deserialize(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (bytesRead int, err error)

Deserialize deserialzes a header into the object, returning the number of bytes read

func (*VRFProofMessage) GetBytes

func (vrm *VRFProofMessage) GetBytes(m *messages.Message) ([]byte, error)

GetBytes returns the bytes that make up the message

func (*VRFProofMessage) GetID

func (vrm *VRFProofMessage) GetID() messages.HeaderID

GetID returns the header id for this header

func (*VRFProofMessage) GetIndex

func (vrm *VRFProofMessage) GetIndex() types.ConsensusIndex

GetIndex returns the consensus index for this message.

func (*VRFProofMessage) GetMsgID

func (vrm *VRFProofMessage) GetMsgID() messages.MsgID

GetMsgID returns the MsgID for this specific header.

func (*VRFProofMessage) PeekHeaders

func (*VRFProofMessage) PeekHeaders(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (index types.ConsensusIndex,
	err error)

PeekHeader returns the indices related to the messages without impacting m.

func (*VRFProofMessage) Serialize

func (vrm *VRFProofMessage) Serialize(m *messages.Message) (bytesWritten int, err error)

Serialize appends a serialized header to the message m, and returns the size of bytes written

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL