dkg

package
v0.22.8-patch-2-fees Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 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 module.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(_ network.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(_ network.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.

func NewReactorEngine

func NewReactorEngine(
	log zerolog.Logger,
	me module.Local,
	state protocol.State,
	keyStorage storage.DKGKeys,
	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. It compares the key vector locally produced by Consensus nodes against the FlowDKG smart contract key vectors. If the keys don't match a log statement will be invoked. In the happy case the locally produced key should match, if the keys do not match the node will have a invalid random beacon key.

func (*ReactorEngine) EpochSetupPhaseStarted

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

EpochSetupPhaseStarted handles the EpochSetupPhaseStared protocol event. It starts a new controller for the epoch and registers the triggers to regularly query the DKG smart-contract and transition between phases at the specified views.

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