notifications

package
v0.29.8-access-state-s... Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 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) 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) 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) OnDoubleProposeDetected added in v0.29.0

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

func (*NoopFinalizationConsumer) OnFinalizedBlock added in v0.29.0

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

type NoopPartialConsumer added in v0.29.0

type NoopPartialConsumer struct{}

func (*NoopPartialConsumer) OnCurrentViewDetails added in v0.29.6

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

func (*NoopPartialConsumer) OnDoubleTimeoutDetected added in v0.29.0

func (*NoopPartialConsumer) OnDoubleTimeoutDetected(*model.TimeoutObject, *model.TimeoutObject)

func (*NoopPartialConsumer) OnDoubleVotingDetected added in v0.29.0

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

func (*NoopPartialConsumer) OnEventProcessed added in v0.29.0

func (*NoopPartialConsumer) OnEventProcessed()

func (*NoopPartialConsumer) OnInvalidTimeoutDetected added in v0.29.0

func (*NoopPartialConsumer) OnInvalidTimeoutDetected(model.InvalidTimeoutError)

func (*NoopPartialConsumer) OnInvalidVoteDetected added in v0.29.0

func (*NoopPartialConsumer) OnInvalidVoteDetected(model.InvalidVoteError)

func (*NoopPartialConsumer) OnLocalTimeout added in v0.29.0

func (*NoopPartialConsumer) OnLocalTimeout(uint64)

func (*NoopPartialConsumer) OnPartialTc added in v0.29.0

func (*NoopPartialConsumer) OnQcTriggeredViewChange added in v0.29.0

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

func (*NoopPartialConsumer) OnReceiveProposal added in v0.29.0

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

func (*NoopPartialConsumer) OnReceiveQc added in v0.29.0

func (*NoopPartialConsumer) OnReceiveTc added in v0.29.0

func (*NoopPartialConsumer) OnStart added in v0.29.0

func (*NoopPartialConsumer) OnStart(uint64)

func (*NoopPartialConsumer) OnStartingTimeout added in v0.29.0

func (*NoopPartialConsumer) OnStartingTimeout(model.TimerInfo)

func (*NoopPartialConsumer) OnTcTriggeredViewChange added in v0.29.0

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

func (*NoopPartialConsumer) OnTimeoutProcessed added in v0.29.6

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

func (*NoopPartialConsumer) OnViewChange added in v0.29.0

func (*NoopPartialConsumer) OnViewChange(uint64, uint64)

func (*NoopPartialConsumer) OnVoteForInvalidBlockDetected added in v0.29.0

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

func (*NoopPartialConsumer) OnVoteProcessed added in v0.29.6

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

type NoopQCCreatedConsumer added in v0.29.0

type NoopQCCreatedConsumer struct{}

func (*NoopQCCreatedConsumer) OnQcConstructedFromVotes added in v0.29.0

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

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)

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 {
	NoopConsumer
	// 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) OnDoubleVotingDetected

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

func (*SlashingViolationsConsumer) OnInvalidVoteDetected

func (c *SlashingViolationsConsumer) OnInvalidVoteDetected(vote *model.Vote)

func (*SlashingViolationsConsumer) OnVoteForInvalidBlockDetected added in v0.23.9

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

type TelemetryConsumer

type TelemetryConsumer struct {
	NoopConsumer
	// 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) 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