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 MarshalAggrAgreement(r *bytes.Buffer, aggr AggrAgreement) 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 MarshalNewBlock(r *bytes.Buffer, sev NewBlock) error
- func MarshalReduction(r *bytes.Buffer, bev Reduction) 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 UnmarshalAggrAgreement(r *bytes.Buffer, a *AggrAgreement) error
- func UnmarshalAggrAgreementMessage(r *bytes.Buffer, m SerializableMessage) error
- 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 UnmarshalNewBlock(r *bytes.Buffer, sev *NewBlock) error
- func UnmarshalNewBlockMessage(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 UnmarshalTxMessage(r *bytes.Buffer, m SerializableMessage) error
- func UnmarshalVotes(r *bytes.Buffer, votes []*StepVotes) error
- type Addr
- type AggrAgreement
- 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(signature []byte)
- func (a Agreement) Signature() []byte
- func (a Agreement) State() header.Header
- func (a Agreement) String() string
- type Challenge
- type GetBlocks
- type GetCandidate
- type Inv
- type InvType
- type InvVect
- type Message
- type Metadata
- type NewBlock
- 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 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 MarshalAggrAgreement ¶ added in v0.4.4
func MarshalAggrAgreement(r *bytes.Buffer, aggr AggrAgreement) error
MarshalAggrAgreement marshal the AggrAgreement into a Buffer.
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 MarshalNewBlock ¶ added in v0.4.4
MarshalNewBlock the buffer into a committee Event. Field order is the following: * Blind Bid Fields [Score, Proof, Z, BidList, Seed, Candidate Block Hash].
func MarshalReduction ¶
MarshalReduction a Reduction event into a buffer.
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 UnmarshalAggrAgreement ¶ added in v0.4.4
func UnmarshalAggrAgreement(r *bytes.Buffer, a *AggrAgreement) error
UnmarshalAggrAgreement unmarshals the buffer into an AggrAgreement.
func UnmarshalAggrAgreementMessage ¶ added in v0.4.4
func UnmarshalAggrAgreementMessage(r *bytes.Buffer, m SerializableMessage) error
UnmarshalAggrAgreementMessage unmarshal a network inbound AggrAgreement.
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 UnmarshalNewBlock ¶ added in v0.4.4
UnmarshalNewBlock unmarshals the buffer into a NewBlock Event. Field order is the following: * Score Payload [score, proof, Z, BidList, Seed, Block Candidate Hash].
func UnmarshalNewBlockMessage ¶ added in v0.4.4
func UnmarshalNewBlockMessage(r *bytes.Buffer, m SerializableMessage) error
UnmarshalNewBlockMessage unmarshal a NewBlockMessage from a buffer.
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 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 AggrAgreement ¶ added in v0.4.4
AggrAgreement stores an agreement (with the provisioners) and the bitset representing those who voted in favor.
func NewAggrAgreement ¶ added in v0.4.4
func NewAggrAgreement(payload Agreement, bitset uint64, aggrSig []byte) AggrAgreement
NewAggrAgreement creates an AggrAgreement message with the given fields.
func (AggrAgreement) Copy ¶ added in v0.4.4
func (a AggrAgreement) Copy() payload.Safe
Copy deeply a AggrAgreement.
func (AggrAgreement) String ¶ added in v0.4.4
func (a AggrAgreement) String() string
String returns a string representation of a AggrAgreement message.
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.
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 Metadata() *Metadata }
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 NewWithMetadata ¶ added in v0.6.0
NewWithMetadata creates a new Message with non-nil metadata.
type NewBlock ¶ added in v0.4.4
type NewBlock struct { PrevHash []byte Candidate block.Block SignedHash []byte // contains filtered or unexported fields }
NewBlock extends the ScoreProposal with additional fields related to the candidate it pairs up with. The NewBlock is supposed to be immutable once created and it gets forwarded to the other nodes.
func EmptyNewBlock ¶ added in v0.4.4
func EmptyNewBlock() NewBlock
EmptyNewBlock is used primarily to initialize the NewBlock, since empty newblocks should not be propagated externally.
func MockNewBlock ¶ added in v0.4.4
MockNewBlock mocks a NewBlock and returns it.
func NewNewBlock ¶ added in v0.4.4
NewNewBlock creates a new Score from a proposal.
func (NewBlock) Copy ¶ added in v0.4.4
Copy complies with message.Safe interface. It returns a deep copy of the message safe to publish to multiple subscribers.
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.
func (Reduction) MarshalJSON ¶ added in v0.4.4
MarshalJSON ...
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 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, seed []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, step uint8) 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).