dkg

package
v0.29.10 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: AGPL-3.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

View Source
const DefaultPollStep = 10

DefaultPollStep specifies the default number of views that separate two calls to the DKG smart-contract to read broadcast messages.

Variables

This section is empty.

Functions

This section is empty.

Types

type MessagingEngine

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

MessagingEngine is a network engine that enables DKG nodes to exchange private messages over the network.

func NewMessagingEngine

func NewMessagingEngine(
	logger zerolog.Logger,
	net network.Network,
	me module.Local,
	tunnel *dkg.BrokerTunnel) (*MessagingEngine, error)

NewMessagingEngine returns a new engine.

func (*MessagingEngine) Done

func (e *MessagingEngine) Done() <-chan struct{}

Done implements the module ReadyDoneAware interface. It returns a channel that will close when the engine has successfully stopped.

func (*MessagingEngine) Process

func (e *MessagingEngine) Process(_ channels.Channel, originID flow.Identifier, event interface{}) error

Process implements the network Engine interface

func (*MessagingEngine) ProcessLocal

func (e *MessagingEngine) ProcessLocal(event interface{}) error

ProcessLocal implements the network Engine interface

func (*MessagingEngine) Ready

func (e *MessagingEngine) Ready() <-chan struct{}

Ready implements the module ReadyDoneAware interface. It returns a channel that will close when the engine has successfully started.

func (*MessagingEngine) Submit

func (e *MessagingEngine) Submit(_ channels.Channel, originID flow.Identifier, event interface{})

Submit implements the network Engine interface

func (*MessagingEngine) SubmitLocal

func (e *MessagingEngine) SubmitLocal(event interface{})

SubmitLocal implements the network Engine interface

type ReactorEngine

type ReactorEngine struct {
	events.Noop

	State protocol.State
	// contains filtered or unexported fields
}

ReactorEngine is an engine that reacts to chain events to start new DKG runs, and manage subsequent phase transitions. Any unexpected error triggers a panic as it would undermine the security of the protocol. TODO replace engine.Unit with component.Component

func NewReactorEngine

func NewReactorEngine(
	log zerolog.Logger,
	me module.Local,
	state protocol.State,
	dkgState storage.DKGState,
	controllerFactory module.DKGControllerFactory,
	viewEvents events.Views,
) *ReactorEngine

NewReactorEngine return a new ReactorEngine.

func (*ReactorEngine) Done

func (e *ReactorEngine) Done() <-chan struct{}

Done implements the module ReadyDoneAware interface. It returns a channel that will close when the engine has successfully stopped.

func (*ReactorEngine) EpochCommittedPhaseStarted

func (e *ReactorEngine) EpochCommittedPhaseStarted(currentEpochCounter uint64, first *flow.Header)

EpochCommittedPhaseStarted handles the EpochCommittedPhaseStarted protocol event by checking the consistency of our locally computed key share. NOTE: ReactorEngine will not recover from mid-DKG crashes, therefore we do not need to handle dropped protocol events here.

func (*ReactorEngine) EpochSetupPhaseStarted

func (e *ReactorEngine) EpochSetupPhaseStarted(currentEpochCounter uint64, first *flow.Header)

EpochSetupPhaseStarted handles the EpochSetupPhaseStarted protocol event by starting the DKG process. NOTE: ReactorEngine will not recover from mid-DKG crashes, therefore we do not need to handle dropped protocol events here.

func (*ReactorEngine) Ready

func (e *ReactorEngine) Ready() <-chan struct{}

Ready implements the module ReadyDoneAware interface. It returns a channel that will close when the engine has successfully started.

Jump to

Keyboard shortcuts

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