Documentation
¶
Index ¶
- Constants
- func ConvBool(p payload.Safe) (bool, error)
- func ConvI(p payload.Safe) (int, error)
- func ConvI16(p payload.Safe) (int16, error)
- func ConvI32(p payload.Safe) (int32, error)
- func ConvI64(p payload.Safe) (int64, error)
- func ConvI8(p payload.Safe) (int8, error)
- func ConvStr(p payload.Safe) (string, error)
- func ConvU(p payload.Safe) (uint, error)
- func ConvU16(p payload.Safe) (uint16, error)
- func ConvU32(p payload.Safe) (uint32, error)
- func ConvU64(p payload.Safe) (uint64, error)
- func ConvU8(p payload.Safe) (uint8, error)
- func Marshal(s Message) (bytes.Buffer, error)
- func MarshalAgreement(r *bytes.Buffer, a Agreement) error
- func MarshalBlock(r *bytes.Buffer, b *block.Block) error
- func MarshalCertificate(r *bytes.Buffer, c *block.Certificate) error
- func MarshalHashable(r *bytes.Buffer, h *block.Header) error
- func MarshalHeader(r *bytes.Buffer, h *block.Header) error
- func MarshalReduction(r *bytes.Buffer, bev Reduction) error
- func MarshalScore(r *bytes.Buffer, sev Score) error
- func MarshalStepVotes(r *bytes.Buffer, vote *StepVotes) error
- func MarshalVoteSet(r *bytes.Buffer, evs []Reduction) error
- func MarshalVotes(r *bytes.Buffer, votes []*StepVotes) error
- func SignAgreement(a *Agreement, keys key.Keys) error
- func UnmarshalAddrMessage(r *bytes.Buffer, m SerializableMessage)
- func UnmarshalAgreement(r *bytes.Buffer, a *Agreement) error
- func UnmarshalAgreementMessage(r *bytes.Buffer, m SerializableMessage) error
- func UnmarshalBlock(r *bytes.Buffer, b *block.Block) error
- func UnmarshalBlockMessage(r *bytes.Buffer, m SerializableMessage) error
- func UnmarshalCertificate(r *bytes.Buffer, c *block.Certificate) error
- func UnmarshalChallengeMessage(r *bytes.Buffer, m SerializableMessage)
- func UnmarshalGetBlocksMessage(r *bytes.Buffer, m SerializableMessage) error
- func UnmarshalGetCandidateMessage(r *bytes.Buffer, m SerializableMessage)
- func UnmarshalHeader(r *bytes.Buffer, h *block.Header) error
- func UnmarshalInvMessage(r *bytes.Buffer, m SerializableMessage) error
- func UnmarshalReduction(r *bytes.Buffer, bev *Reduction) error
- func UnmarshalReductionMessage(r *bytes.Buffer, m SerializableMessage) error
- func UnmarshalResponseMessage(r *bytes.Buffer, m SerializableMessage) error
- func UnmarshalScore(r *bytes.Buffer, sev *Score) error
- func UnmarshalScoreMessage(r *bytes.Buffer, m SerializableMessage) error
- func UnmarshalTxMessage(r *bytes.Buffer, m SerializableMessage) error
- func UnmarshalVotes(r *bytes.Buffer, votes []*StepVotes) error
- type Addr
- type Agreement
- func (a Agreement) Cmp(other Agreement) int
- func (a Agreement) Copy() payload.Safe
- func (a Agreement) Equal(aev Agreement) bool
- func (a Agreement) GenerateCertificate() *block.Certificate
- func (a Agreement) Sender() []byte
- func (a *Agreement) SetSignature(signedVotes []byte)
- func (a Agreement) SignedVotes() []byte
- func (a Agreement) State() header.Header
- func (a Agreement) String() string
- type Certificate
- type Challenge
- type GetBlocks
- type GetCandidate
- type Inv
- type InvType
- type InvVect
- type Message
- type Reduction
- func MockCommitteeVoteSet(p *user.Provisioners, k []key.Keys, hash []byte, committeeSize int, ...) []Reduction
- func MockReduction(hash []byte, round uint64, step uint8, keys []key.Keys, iterativeIdx ...int) Reduction
- func MockVoteSet(hash []byte, round uint64, step uint8, keys []key.Keys, amount int) []Reduction
- func MockVotes(hash []byte, round uint64, step uint8, keys []key.Keys, amount int) []Reduction
- func NewReduction(hdr header.Header) *Reduction
- func UnmarshalVoteSet(r *bytes.Buffer) ([]Reduction, error)
- type Response
- type SafeBuffer
- type Score
- type ScoreProposal
- type Serializable
- type SerializableMessage
- type StepVotes
- type StepVotesMsg
Constants ¶
const EMPTY = "EMPTY"
EMPTY represents a empty message, used by the StopConsensus call.
Variables ¶
This section is empty.
Functions ¶
func Marshal ¶
Marshal a Message into a buffer. The buffer *does* include its Category (so if this is undesired, the client of this call needs to explicitly call topics.Extract on the resulting buffer. TODO: interface - once the Gossip preprocessing is removed from the Coordinator, there won't be a need for marshalBuffer.
func MarshalAgreement ¶
MarshalAgreement marshals an Agreement event into a buffer.
func MarshalBlock ¶
MarshalBlock marshals a block into a binary buffer.
func MarshalCertificate ¶
func MarshalCertificate(r *bytes.Buffer, c *block.Certificate) error
MarshalCertificate marshals a certificate.
func MarshalHashable ¶
MarshalHashable marshals the hashable part of the block into a binary buffer.
func MarshalHeader ¶
MarshalHeader marshals the header of a block into a binary buffer.
func MarshalReduction ¶
MarshalReduction a Reduction event into a buffer.
func MarshalScore ¶
MarshalScore the buffer into a committee Event. Field order is the following: * Blind Bid Fields [Score, Proof, Z, BidList, Seed, Candidate Block Hash].
func MarshalStepVotes ¶
MarshalStepVotes marshals the aggregated form of the BLS PublicKey and Signature for an ordered set of votes.
func MarshalVoteSet ¶
MarshalVoteSet marshals a slice of Reduction events to a buffer.
func MarshalVotes ¶
MarshalVotes marshals an array of StepVotes.
func SignAgreement ¶
SignAgreement signs an aggregated agreement event. XXX: either use this function or delete it!! Right now it is not used.
func UnmarshalAddrMessage ¶ added in v0.4.3
func UnmarshalAddrMessage(r *bytes.Buffer, m SerializableMessage)
UnmarshalAddrMessage into a SerializableMessage.
func UnmarshalAgreement ¶
UnmarshalAgreement unmarshals the buffer into an Agreement. Field order is the following: * Header [BLS Public Key; Round; Step] * Agreement [Signed Vote Set; Vote Set; BlockHash].
func UnmarshalAgreementMessage ¶
func UnmarshalAgreementMessage(r *bytes.Buffer, m SerializableMessage) error
UnmarshalAgreementMessage unmarshal a network inbound Agreement.
func UnmarshalBlock ¶
UnmarshalBlock unmarshals a block from a binary buffer.
func UnmarshalBlockMessage ¶ added in v0.4.0
func UnmarshalBlockMessage(r *bytes.Buffer, m SerializableMessage) error
UnmarshalBlockMessage unmarshals a block from a binary buffer into a SerializableMessage.
func UnmarshalCertificate ¶
func UnmarshalCertificate(r *bytes.Buffer, c *block.Certificate) error
UnmarshalCertificate unmarshals a certificate.
func UnmarshalChallengeMessage ¶ added in v0.4.3
func UnmarshalChallengeMessage(r *bytes.Buffer, m SerializableMessage)
UnmarshalChallengeMessage into a SerializableMessage.
func UnmarshalGetBlocksMessage ¶ added in v0.4.0
func UnmarshalGetBlocksMessage(r *bytes.Buffer, m SerializableMessage) error
UnmarshalGetBlocksMessage unmarshals a GetBlocks message into a SerializableMessage.
func UnmarshalGetCandidateMessage ¶ added in v0.4.0
func UnmarshalGetCandidateMessage(r *bytes.Buffer, m SerializableMessage)
UnmarshalGetCandidateMessage into a SerializableMessage.
func UnmarshalHeader ¶
UnmarshalHeader unmarshal a block header from a binary buffer.
func UnmarshalInvMessage ¶ added in v0.4.0
func UnmarshalInvMessage(r *bytes.Buffer, m SerializableMessage) error
UnmarshalInvMessage into a SerializableMessage.
func UnmarshalReduction ¶
UnmarshalReduction unmarshals the buffer into a Reduction event.
func UnmarshalReductionMessage ¶
func UnmarshalReductionMessage(r *bytes.Buffer, m SerializableMessage) error
UnmarshalReductionMessage unmarshals a serialization from a buffer.
func UnmarshalResponseMessage ¶ added in v0.4.3
func UnmarshalResponseMessage(r *bytes.Buffer, m SerializableMessage) error
UnmarshalResponseMessage into a SerializableMessage.
func UnmarshalScore ¶
UnmarshalScore unmarshals the buffer into a Score Event. Field order is the following: * Score Payload [score, proof, Z, BidList, Seed, Block Candidate Hash].
func UnmarshalScoreMessage ¶
func UnmarshalScoreMessage(r *bytes.Buffer, m SerializableMessage) error
UnmarshalScoreMessage unmarshal a ScoreMessage from a buffer.
func UnmarshalTxMessage ¶
func UnmarshalTxMessage(r *bytes.Buffer, m SerializableMessage) error
UnmarshalTxMessage unmarshals a Message carrying a tx from a buffer.
Types ¶
type Addr ¶ added in v0.4.3
type Addr struct {
NetAddr string
}
Addr contains a network address of a peer.
type Agreement ¶
type Agreement struct { VotesPerStep []*StepVotes Repr *big.Int // contains filtered or unexported fields }
Agreement is the Event created at the end of the Reduction process. It includes the aggregated compressed signatures of all voters.
func MockAgreement ¶
func MockAgreement(hash []byte, round uint64, step uint8, keys []key.Keys, p *user.Provisioners, iterativeIdx ...int) Agreement
MockAgreement returns a mocked Agreement Event, to be used for testing purposes. It includes a vararg iterativeIdx to help avoiding duplicates when testing.
func NewAgreement ¶
NewAgreement returns an empty Agreement event. It is supposed to be used by the (secondstep reducer) for creating Agreement messages.
func (Agreement) Copy ¶ added in v0.4.0
Copy the Agreement is somewhat more expensive than the other structures since it involves Marshaling and Unmarshaling. This is necessary since we do not have access to the underlying BLS structs.
func (Agreement) GenerateCertificate ¶
func (a Agreement) GenerateCertificate() *block.Certificate
GenerateCertificate is used by the Chain component.
func (*Agreement) SetSignature ¶
SetSignature set a signature to the Agreement.
func (Agreement) SignedVotes ¶
SignedVotes returns the signed vote.
type Certificate ¶ added in v0.4.0
Certificate is the event created upon finalizing a block in the Agreement phase. It will contain one of the received Agreement messages, to be used for creating a certificate later on, and the keys of all provisioners that voted for the winning block.
func NewCertificate ¶ added in v0.4.0
func NewCertificate(ag Agreement, keys [][]byte) Certificate
NewCertificate creates a Certificate message with the given fields.
func (Certificate) Copy ¶ added in v0.4.0
func (c Certificate) Copy() payload.Safe
Copy deeply a Certificate.
func (Certificate) String ¶ added in v0.4.0
func (c Certificate) String() string
String returns a string representation of a Certificate message.
type Challenge ¶ added in v0.4.3
type Challenge struct {
ChallengeString []byte
}
Challenge represents a challenge sent by a voucher seeder on connection.
type GetBlocks ¶ added in v0.4.0
type GetBlocks struct {
Locators [][]byte
}
GetBlocks defines a getblocks message on the Dusk wire protocol. It is used to request blocks from another peer.
func (GetBlocks) Copy ¶ added in v0.4.0
Copy a GetBlocks message. Implements the payload.Safe interface.
type GetCandidate ¶ added in v0.4.0
type GetCandidate struct {
Hash []byte
}
GetCandidate is used to request certain candidates from peers.
func (GetCandidate) Copy ¶ added in v0.4.0
func (g GetCandidate) Copy() payload.Safe
Copy a GetCandidate message. Implements the payload.Safe interface.
type Inv ¶ added in v0.4.0
type Inv struct {
InvList []InvVect
}
Inv contains a list of Inventory vector.
type Message ¶
type Message interface { Category() topics.Topic Payload() payload.Safe Equal(Message) bool Id() []byte // CachedBinary returns the marshaled form of this Payload as cached during // the unmarshaling of incoming messages. In case the message has been // created internally and never serialized, this should return an empty buffer. CachedBinary() bytes.Buffer Header() []byte }
Message is the core of the message-oriented architecture of the node. It is particularly important within the consensus, but in practice any component ends up dealing with it. It encapsulates the data exchanged by different nodes as well as internal components. The Message transits inside of the eventbus and is de- serialized through the Gossip procedure.
func NewWithHeader ¶ added in v0.4.0
NewWithHeader creates a new Message with non-nil header.
type Reduction ¶
type Reduction struct { SignedHash []byte // contains filtered or unexported fields }
Reduction is one of the messages used in the consensus algorithms. As such it encapsulates a header.Header to allow the Coordinator to correctly enforce the sequence of state changes expressed through the algorithm.
func MockCommitteeVoteSet ¶
func MockCommitteeVoteSet(p *user.Provisioners, k []key.Keys, hash []byte, committeeSize int, round uint64, step uint8) []Reduction
MockCommitteeVoteSet mocks a VoteSet.
func MockReduction ¶
func MockReduction(hash []byte, round uint64, step uint8, keys []key.Keys, iterativeIdx ...int) Reduction
MockReduction mocks a Reduction event and returns it. It includes a vararg iterativeIdx to help avoiding duplicates when testing.
func MockVoteSet ¶
MockVoteSet mocks a slice of Reduction events for two adjacent steps, and returns it.
func NewReduction ¶
NewReduction returns and empty Reduction event.
func UnmarshalVoteSet ¶
UnmarshalVoteSet unmarshals a Reduction slice from a buffer.
type Response ¶ added in v0.4.3
Response to a voucher seeder challenge.
type SafeBuffer ¶ added in v0.4.0
SafeBuffer is a byte.Buffer wrapper that let the Buffer implement Safe.
func (SafeBuffer) Copy ¶ added in v0.4.0
func (s SafeBuffer) Copy() payload.Safe
Copy complies with payload.Safe interface. It returns a deep copy of the buffer safe to publish to multiple subscribers.
type Score ¶
type Score struct { ScoreProposal PrevHash []byte Candidate block.Block }
Score extends the ScoreProposal with additional fields related to the candidate it pairs up with. The Score is supposed to be immutable once created and it gets forwarded to the other nodes.
func EmptyScore ¶
func EmptyScore() Score
EmptyScore is used primarily to initialize the Score, since empty scores should not be propagated externally.
func NewScore ¶
func NewScore(proposal ScoreProposal, pubkey, prevHash []byte, candidate block.Block) *Score
NewScore creates a new Score from a proposal.
type ScoreProposal ¶
type ScoreProposal struct { Score []byte Proof []byte Identity []byte Seed []byte // contains filtered or unexported fields }
ScoreProposal is an internal packet created by the node. the Score Message with the fields consistent with the Blind Bid data structure.
func EmptyScoreProposal ¶
func EmptyScoreProposal(hdr header.Header) ScoreProposal
EmptyScoreProposal is used to initialize a ScoreProposal. It is used primarily by the internal Score generator.
func MockScoreProposal ¶
func MockScoreProposal(hdr header.Header) ScoreProposal
MockScoreProposal mocks a ScoreProposal up.
func NewScoreProposal ¶
func NewScoreProposal(hdr header.Header, seed []byte, score blindbid.GenerateScoreResponse) ScoreProposal
NewScoreProposal creates a new ScoreProposal.
func (ScoreProposal) Copy ¶ added in v0.4.0
func (e ScoreProposal) Copy() payload.Safe
Copy complies with message.Safe interface. It returns a deep copy of the message safe to publish to multiple subscribers.
func (ScoreProposal) IsEmpty ¶
func (e ScoreProposal) IsEmpty() bool
IsEmpty tests a ScoreProposal for emptyness.
func (ScoreProposal) Sender ¶
func (e ScoreProposal) Sender() []byte
Sender of a Score event is the anonymous Z.
func (ScoreProposal) State ¶
func (e ScoreProposal) State() header.Header
State is used to comply to the consensus.Message interface.
func (ScoreProposal) String ¶
func (e ScoreProposal) String() string
String representation of the ScoreProposal.
type Serializable ¶
Serializable allows to set a payload.
type SerializableMessage ¶
type SerializableMessage interface { Message Serializable }
SerializableMessage is a Serializable and a Message.
type StepVotes ¶
StepVotes represents the aggregated votes for one reduction step. Normally an Agreement event includes two of these structures. They need to be kept separated since the BitSet representation of the Signees does not admit duplicates, whereas the same provisioner may very well be included in the committee for both Reduction steps.
func GenVotes ¶
func GenVotes(hash []byte, round uint64, step uint8, keys []key.Keys, p *user.Provisioners) []*StepVotes
GenVotes randomly generates a slice of StepVotes with the indicated length. Albeit random, the generation is consistent with the rules of Votes.
func NewStepVotes ¶
func NewStepVotes() *StepVotes
NewStepVotes returns a new StepVotes structure for a given round, step and block hash.
func UnmarshalStepVotes ¶
UnmarshalStepVotes unmarshals a single StepVote.
type StepVotesMsg ¶
StepVotesMsg is the internal message exchanged by the consensus components (through the signer.SendInternally method). It is not meant for external communications and therefore it does not have a Marshal/Unmarshal methods associated.
func NewStepVotesMsg ¶
func NewStepVotesMsg(round uint64, hash []byte, sender []byte, sv StepVotes) StepVotesMsg
NewStepVotesMsg creates a StepVotesMsg. Deprecated.
func (StepVotesMsg) Copy ¶ added in v0.4.0
func (s StepVotesMsg) Copy() payload.Safe
Copy deeply the StepVotesMsg.
func (StepVotesMsg) State ¶
func (s StepVotesMsg) State() header.Header
State returns the Header without information about Sender (as this is only for internal communications).