Help us shape the future of Go! Take the 2026 Go Developer Survey

notifications

package
v0.37.21 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: AGPL-3.0 Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogConsumer

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

LogConsumer is an implementation of the notifications consumer that logs a message for each event.

func NewLogConsumer

func NewLogConsumer(log zerolog.Logger) *LogConsumer

func (*LogConsumer) OnBlockIncorporated

func (lc *LogConsumer) OnBlockIncorporated(block *model.Block)

func (*LogConsumer) OnCurrentViewDetails added in v0.29.6

func (lc *LogConsumer) OnCurrentViewDetails(currentView, finalizedView uint64, currentLeader flow.Identifier)

func (*LogConsumer) OnDoubleProposeDetected

func (lc *LogConsumer) OnDoubleProposeDetected(block *model.Block, alt *model.Block)

func (*LogConsumer) OnDoubleTimeoutDetected added in v0.29.0

func (lc *LogConsumer) OnDoubleTimeoutDetected(timeout *model.TimeoutObject, alt *model.TimeoutObject)

func (*LogConsumer) OnDoubleVotingDetected

func (lc *LogConsumer) OnDoubleVotingDetected(vote *model.Vote, alt *model.Vote)

func (*LogConsumer) OnEventProcessed

func (lc *LogConsumer) OnEventProcessed()

func (*LogConsumer) OnFinalizedBlock

func (lc *LogConsumer) OnFinalizedBlock(block *model.Block)

func (*LogConsumer) OnInvalidBlockDetected added in v0.31.0

func (lc *LogConsumer) OnInvalidBlockDetected(err flow.Slashable[model.InvalidProposalError])

func (*LogConsumer) OnInvalidTimeoutDetected added in v0.29.0

func (lc *LogConsumer) OnInvalidTimeoutDetected(err model.InvalidTimeoutError)

func (*LogConsumer) OnInvalidVoteDetected

func (lc *LogConsumer) OnInvalidVoteDetected(err model.InvalidVoteError)

func (*LogConsumer) OnLocalTimeout added in v0.29.0

func (lc *LogConsumer) OnLocalTimeout(currentView uint64)

func (*LogConsumer) OnNewQcDiscovered added in v0.29.0

func (lc *LogConsumer) OnNewQcDiscovered(qc *flow.QuorumCertificate)

func (*LogConsumer) OnNewTcDiscovered added in v0.29.0

func (lc *LogConsumer) OnNewTcDiscovered(tc *flow.TimeoutCertificate)

func (*LogConsumer) OnOwnProposal added in v0.29.0

func (lc *LogConsumer) OnOwnProposal(header *flow.Header, targetPublicationTime time.Time)

func (*LogConsumer) OnOwnTimeout added in v0.29.0

func (lc *LogConsumer) OnOwnTimeout(timeout *model.TimeoutObject)

func (*LogConsumer) OnOwnVote added in v0.29.0

func (lc *LogConsumer) OnOwnVote(blockID flow.Identifier, view uint64, sigData []byte, recipientID flow.Identifier)

func (*LogConsumer) OnPartialTc added in v0.29.0

func (lc *LogConsumer) OnPartialTc(currentView uint64, partialTc *hotstuff.PartialTcCreated)

func (*LogConsumer) OnPartialTcCreated added in v0.29.0

func (lc *LogConsumer) OnPartialTcCreated(view uint64, newestQC *flow.QuorumCertificate, lastViewTC *flow.TimeoutCertificate)

func (*LogConsumer) OnQcConstructedFromVotes

func (lc *LogConsumer) OnQcConstructedFromVotes(qc *flow.QuorumCertificate)

func (*LogConsumer) OnQcTriggeredViewChange

func (lc *LogConsumer) OnQcTriggeredViewChange(oldView uint64, newView uint64, qc *flow.QuorumCertificate)

func (*LogConsumer) OnReceiveProposal

func (lc *LogConsumer) OnReceiveProposal(currentView uint64, proposal *model.Proposal)

func (*LogConsumer) OnReceiveQc added in v0.29.0

func (lc *LogConsumer) OnReceiveQc(currentView uint64, qc *flow.QuorumCertificate)

func (*LogConsumer) OnReceiveTc added in v0.29.0

func (lc *LogConsumer) OnReceiveTc(currentView uint64, tc *flow.TimeoutCertificate)

func (*LogConsumer) OnStart added in v0.29.0

func (lc *LogConsumer) OnStart(currentView uint64)

func (*LogConsumer) OnStartingTimeout

func (lc *LogConsumer) OnStartingTimeout(info model.TimerInfo)

func (*LogConsumer) OnTcConstructedFromTimeouts added in v0.29.0

func (lc *LogConsumer) OnTcConstructedFromTimeouts(tc *flow.TimeoutCertificate)

func (*LogConsumer) OnTcTriggeredViewChange added in v0.29.0

func (lc *LogConsumer) OnTcTriggeredViewChange(oldView uint64, newView uint64, tc *flow.TimeoutCertificate)

func (*LogConsumer) OnTimeoutProcessed added in v0.29.6

func (lc *LogConsumer) OnTimeoutProcessed(timeout *model.TimeoutObject)

func (*LogConsumer) OnViewChange added in v0.29.0

func (lc *LogConsumer) OnViewChange(oldView, newView uint64)

func (*LogConsumer) OnVoteForInvalidBlockDetected added in v0.23.9

func (lc *LogConsumer) OnVoteForInvalidBlockDetected(vote *model.Vote, proposal *model.Proposal)

func (*LogConsumer) OnVoteProcessed added in v0.29.6

func (lc *LogConsumer) OnVoteProcessed(vote *model.Vote)

type NoopCommunicatorConsumer added in v0.29.0

type NoopCommunicatorConsumer struct{}

func (*NoopCommunicatorConsumer) OnOwnProposal added in v0.29.0

func (*NoopCommunicatorConsumer) OnOwnProposal(*flow.Header, time.Time)

func (*NoopCommunicatorConsumer) OnOwnTimeout added in v0.29.0

func (*NoopCommunicatorConsumer) OnOwnVote added in v0.29.0

type NoopConsumer

NoopConsumer is an implementation of the notifications consumer that doesn't do anything.

func NewNoopConsumer

func NewNoopConsumer() *NoopConsumer

type NoopFinalizationConsumer added in v0.29.0

type NoopFinalizationConsumer struct{}

func (*NoopFinalizationConsumer) OnBlockIncorporated added in v0.29.0

func (*NoopFinalizationConsumer) OnBlockIncorporated(*model.Block)

func (*NoopFinalizationConsumer) OnFinalizedBlock added in v0.29.0

func (*NoopFinalizationConsumer) OnFinalizedBlock(*model.Block)

type NoopParticipantConsumer added in v0.31.0

type NoopParticipantConsumer struct{}

func (*NoopParticipantConsumer) OnCurrentViewDetails added in v0.31.0

func (*NoopParticipantConsumer) OnCurrentViewDetails(uint64, uint64, flow.Identifier)

func (*NoopParticipantConsumer) OnEventProcessed added in v0.31.0

func (*NoopParticipantConsumer) OnEventProcessed()

func (*NoopParticipantConsumer) OnLocalTimeout added in v0.31.0

func (*NoopParticipantConsumer) OnLocalTimeout(uint64)

func (*NoopParticipantConsumer) OnPartialTc added in v0.31.0

func (*NoopParticipantConsumer) OnQcTriggeredViewChange added in v0.31.0

func (*NoopParticipantConsumer) OnQcTriggeredViewChange(uint64, uint64, *flow.QuorumCertificate)

func (*NoopParticipantConsumer) OnReceiveProposal added in v0.31.0

func (*NoopParticipantConsumer) OnReceiveProposal(uint64, *model.Proposal)

func (*NoopParticipantConsumer) OnReceiveQc added in v0.31.0

func (*NoopParticipantConsumer) OnReceiveTc added in v0.31.0

func (*NoopParticipantConsumer) OnStart added in v0.31.0

func (*NoopParticipantConsumer) OnStart(uint64)

func (*NoopParticipantConsumer) OnStartingTimeout added in v0.31.0

func (*NoopParticipantConsumer) OnStartingTimeout(model.TimerInfo)

func (*NoopParticipantConsumer) OnTcTriggeredViewChange added in v0.31.0

func (*NoopParticipantConsumer) OnTcTriggeredViewChange(uint64, uint64, *flow.TimeoutCertificate)

func (*NoopParticipantConsumer) OnViewChange added in v0.31.0

func (*NoopParticipantConsumer) OnViewChange(uint64, uint64)

type NoopProposalViolationConsumer added in v0.31.0

type NoopProposalViolationConsumer struct{}

func (*NoopProposalViolationConsumer) OnDoubleProposeDetected added in v0.31.0

func (*NoopProposalViolationConsumer) OnDoubleProposeDetected(*model.Block, *model.Block)

func (*NoopProposalViolationConsumer) OnDoubleTimeoutDetected added in v0.31.0

func (*NoopProposalViolationConsumer) OnDoubleVotingDetected added in v0.31.0

func (*NoopProposalViolationConsumer) OnDoubleVotingDetected(*model.Vote, *model.Vote)

func (*NoopProposalViolationConsumer) OnInvalidBlockDetected added in v0.31.0

func (*NoopProposalViolationConsumer) OnInvalidTimeoutDetected added in v0.31.0

func (*NoopProposalViolationConsumer) OnInvalidTimeoutDetected(model.InvalidTimeoutError)

func (*NoopProposalViolationConsumer) OnInvalidVoteDetected added in v0.31.0

func (*NoopProposalViolationConsumer) OnInvalidVoteDetected(model.InvalidVoteError)

func (*NoopProposalViolationConsumer) OnVoteForInvalidBlockDetected added in v0.31.0

func (*NoopProposalViolationConsumer) OnVoteForInvalidBlockDetected(*model.Vote, *model.Proposal)

type NoopTimeoutCollectorConsumer added in v0.29.0

type NoopTimeoutCollectorConsumer struct{}

func (*NoopTimeoutCollectorConsumer) OnNewQcDiscovered added in v0.29.0

func (*NoopTimeoutCollectorConsumer) OnNewTcDiscovered added in v0.29.0

func (*NoopTimeoutCollectorConsumer) OnPartialTcCreated added in v0.29.0

func (*NoopTimeoutCollectorConsumer) OnTcConstructedFromTimeouts added in v0.29.0

func (*NoopTimeoutCollectorConsumer) OnTcConstructedFromTimeouts(*flow.TimeoutCertificate)

func (*NoopTimeoutCollectorConsumer) OnTimeoutProcessed added in v0.31.0

func (*NoopTimeoutCollectorConsumer) OnTimeoutProcessed(*model.TimeoutObject)

type NoopVoteCollectorConsumer added in v0.31.0

type NoopVoteCollectorConsumer struct{}

func (*NoopVoteCollectorConsumer) OnQcConstructedFromVotes added in v0.31.0

func (*NoopVoteCollectorConsumer) OnQcConstructedFromVotes(*flow.QuorumCertificate)

func (*NoopVoteCollectorConsumer) OnVoteProcessed added in v0.31.0

func (*NoopVoteCollectorConsumer) OnVoteProcessed(*model.Vote)

type PathHandler

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

PathHandler maintains a notion of the current path through the state machine. It allows to close a path and open new path. Each path is identified by a unique (randomly generated) uuid. Along each path, we can capture information about relevant Steps (each step is represented by a Zerolog Event). In case there is no currently open path, the PathHandler still returns a Step, but such steps are logged as telemetry errors.

func NewPathHandler

func NewPathHandler(log zerolog.Logger) *PathHandler

NewPathHandler instantiate a new PathHandler. The PathHandler has no currently open path Logger MUST include `chain` parameter as part of log context with corresponding chain ID to correctly map telemetry events to chain.

func (*PathHandler) CloseCurrentPath

func (p *PathHandler) CloseCurrentPath() *PathHandler

CloseCurrentPath closes the current path. Repeated calls to CloseCurrentPath are handled. All Details hereafter, until a new Path is started, are logged as telemetry Errors. Returns self-reference for chaining

func (*PathHandler) IsCurrentPathClosed

func (p *PathHandler) IsCurrentPathClosed() bool

IsCurrentPathClosed if and only if the most recently started path has been closed.

func (*PathHandler) NextStep

func (p *PathHandler) NextStep() *zerolog.Event

NextStep returns a Zerolog event for the currently open path. If the current path is closed, the event will be logged as telemetry error.

func (*PathHandler) StartNextPath

func (p *PathHandler) StartNextPath(view uint64) *PathHandler

StartNextPath starts a new Path. Implicitly closes previous path if still open. Returns self-reference for chaining

type SlashingViolationsConsumer

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

SlashingViolationsConsumer is an implementation of the notifications consumer that logs a message for any slashable offenses.

func NewSlashingViolationsConsumer

func NewSlashingViolationsConsumer(log zerolog.Logger) *SlashingViolationsConsumer

func (*SlashingViolationsConsumer) OnDoubleProposeDetected

func (c *SlashingViolationsConsumer) OnDoubleProposeDetected(block1 *model.Block, block2 *model.Block)

func (*SlashingViolationsConsumer) OnDoubleTimeoutDetected added in v0.31.0

func (c *SlashingViolationsConsumer) OnDoubleTimeoutDetected(timeout *model.TimeoutObject, altTimeout *model.TimeoutObject)

func (*SlashingViolationsConsumer) OnDoubleVotingDetected

func (c *SlashingViolationsConsumer) OnDoubleVotingDetected(vote1 *model.Vote, vote2 *model.Vote)

func (*SlashingViolationsConsumer) OnInvalidBlockDetected added in v0.31.0

func (c *SlashingViolationsConsumer) OnInvalidBlockDetected(err flow.Slashable[model.InvalidProposalError])

func (*SlashingViolationsConsumer) OnInvalidTimeoutDetected added in v0.30.0

func (c *SlashingViolationsConsumer) OnInvalidTimeoutDetected(err model.InvalidTimeoutError)

func (*SlashingViolationsConsumer) OnInvalidVoteDetected

func (c *SlashingViolationsConsumer) OnInvalidVoteDetected(err model.InvalidVoteError)

func (*SlashingViolationsConsumer) OnVoteForInvalidBlockDetected added in v0.23.9

func (c *SlashingViolationsConsumer) OnVoteForInvalidBlockDetected(vote *model.Vote, proposal *model.Proposal)

type TelemetryConsumer

type TelemetryConsumer struct {
	NoopTimeoutCollectorConsumer
	NoopVoteCollectorConsumer
	// contains filtered or unexported fields
}

TelemetryConsumer implements the hotstuff.Consumer interface. consumes outbound notifications produced by the HotStuff state machine. For this purpose, the TelemetryConsumer enriches the state machine's notifications:

  • The goal is to identify all events as belonging together that were emitted during a path through the state machine.
  • A path through the state machine begins when: -- a block has been received -- a QC has been constructed -- a TC has been constructed -- a partial TC has been constructed -- a local timeout has been initiated
  • Each path through the state machine is identified by a unique id.

Additionally, the TelemetryConsumer reports events related to vote and timeout aggregation but those events are not bound to a path, so they are reported differently. Generally, the TelemetryConsumer could export the collected data to a variety of backends. For now, we export the data to a logger.

Telemetry does NOT capture slashing notifications

func NewTelemetryConsumer

func NewTelemetryConsumer(log zerolog.Logger) *TelemetryConsumer

NewTelemetryConsumer creates consumer that reports telemetry events using logger backend. Logger MUST include `chain` parameter as part of log context with corresponding chain ID to correctly map telemetry events to chain.

func (*TelemetryConsumer) OnBlockIncorporated

func (t *TelemetryConsumer) OnBlockIncorporated(block *model.Block)

func (*TelemetryConsumer) OnCurrentViewDetails added in v0.29.6

func (t *TelemetryConsumer) OnCurrentViewDetails(currentView, finalizedView uint64, currentLeader flow.Identifier)

func (*TelemetryConsumer) OnEventProcessed

func (t *TelemetryConsumer) OnEventProcessed()

func (*TelemetryConsumer) OnFinalizedBlock

func (t *TelemetryConsumer) OnFinalizedBlock(block *model.Block)

func (*TelemetryConsumer) OnLocalTimeout added in v0.29.0

func (t *TelemetryConsumer) OnLocalTimeout(currentView uint64)

func (*TelemetryConsumer) OnOwnProposal added in v0.29.0

func (t *TelemetryConsumer) OnOwnProposal(proposal *flow.Header, targetPublicationTime time.Time)

func (*TelemetryConsumer) OnOwnTimeout added in v0.29.0

func (t *TelemetryConsumer) OnOwnTimeout(timeout *model.TimeoutObject)

func (*TelemetryConsumer) OnOwnVote added in v0.29.0

func (t *TelemetryConsumer) OnOwnVote(blockID flow.Identifier, view uint64, _ []byte, recipientID flow.Identifier)

func (*TelemetryConsumer) OnPartialTc added in v0.29.0

func (t *TelemetryConsumer) OnPartialTc(currentView uint64, partialTc *hotstuff.PartialTcCreated)

func (*TelemetryConsumer) OnQcTriggeredViewChange

func (t *TelemetryConsumer) OnQcTriggeredViewChange(oldView uint64, newView uint64, qc *flow.QuorumCertificate)

func (*TelemetryConsumer) OnReceiveProposal

func (t *TelemetryConsumer) OnReceiveProposal(currentView uint64, proposal *model.Proposal)

func (*TelemetryConsumer) OnReceiveQc added in v0.29.0

func (t *TelemetryConsumer) OnReceiveQc(currentView uint64, qc *flow.QuorumCertificate)

func (*TelemetryConsumer) OnReceiveTc added in v0.29.0

func (t *TelemetryConsumer) OnReceiveTc(currentView uint64, tc *flow.TimeoutCertificate)

func (*TelemetryConsumer) OnStart added in v0.29.0

func (t *TelemetryConsumer) OnStart(currentView uint64)

func (*TelemetryConsumer) OnStartingTimeout

func (t *TelemetryConsumer) OnStartingTimeout(info model.TimerInfo)

func (*TelemetryConsumer) OnTcTriggeredViewChange added in v0.29.0

func (t *TelemetryConsumer) OnTcTriggeredViewChange(oldView uint64, newView uint64, tc *flow.TimeoutCertificate)

func (*TelemetryConsumer) OnTimeoutProcessed added in v0.29.6

func (t *TelemetryConsumer) OnTimeoutProcessed(timeout *model.TimeoutObject)

func (*TelemetryConsumer) OnViewChange added in v0.31.0

func (t *TelemetryConsumer) OnViewChange(oldView, newView uint64)

func (*TelemetryConsumer) OnVoteProcessed added in v0.29.6

func (t *TelemetryConsumer) OnVoteProcessed(vote *model.Vote)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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