event

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package event contains data structures that are attached to events in the relay. Though many of these events are triggered on-chain, that is not an inherent requirement of structures in this package.

Index

Constants

View Source
const (
	// DKGSeedCachePeriod is the time period the cache maintains
	// the DKG seed corresponding to a DKG instance.
	DKGSeedCachePeriod = 7 * 24 * time.Hour
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DKGResultSubmission

type DKGResultSubmission struct {
	MemberIndex    uint32
	GroupPublicKey []byte
	Misbehaved     []uint8

	BlockNumber uint64
}

DKGResultSubmission represents a DKG result submission event. It is emitted after a submitted DKG result is positively validated on the chain. It contains the index of the member who submitted the result and a final public key of the group. TODO: Adjust to the v2 RandomBeacon contract and rename to DKGResultSubmitted.

type DKGStarted

type DKGStarted struct {
	Seed        *big.Int
	BlockNumber uint64
}

DKGStarted represents a DKG start event.

type Deduplicator

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

Deduplicator decides whether the given event should be handled by the client or not.

Event subscription may emit the same event two or more times. The same event can be emitted right after it's been emitted for the first time. The same event can also be emitted a long time after it's been emitted for the first time. It is deduplicator's responsibility to decide whether the given event is a duplicate and should be ignored or if it is not a duplicate and should be handled.

Those events are supported: - DKG started - relay entry requested

func NewDeduplicator

func NewDeduplicator(chain chain) *Deduplicator

NewDeduplicator constructs a new Deduplicator instance.

func (*Deduplicator) NotifyDKGStarted

func (d *Deduplicator) NotifyDKGStarted(
	newDKGSeed *big.Int,
) bool

NotifyDKGStarted notifies the client wants to start the distributed key generation upon receiving an event. It returns boolean indicating whether the client should proceed with the execution or ignore the event as a duplicate.

func (*Deduplicator) NotifyRelayEntryStarted

func (d *Deduplicator) NotifyRelayEntryStarted(
	newRequestStartBlock uint64,
	newRequestPreviousEntry string,
) (bool, error)

NotifyRelayEntryStarted notifies the client wants to start relay entry generation upon receiving an event. It returns boolean indicating whether the client should proceed with the execution or ignore the event as a duplicate.

type GroupRegistration

type GroupRegistration struct {
	GroupPublicKey []byte

	BlockNumber uint64
}

GroupRegistration represents an event of registering a new group with the given public key. TODO: Adjust to the v2 RandomBeacon contract and rename to GroupRegistered.

type RelayEntryRequested

type RelayEntryRequested struct {
	PreviousEntry  []byte
	GroupPublicKey []byte
	BlockNumber    uint64
}

RelayEntryRequested represents a request for an entry in the threshold relay. TODO: Adjust to the v2 RandomBeacon contract.

type RelayEntrySubmitted

type RelayEntrySubmitted struct {
	BlockNumber uint64
}

RelayEntrySubmitted indicates that valid relay entry has been submitted to the chain for the currently processed relay request. This event is intended to be used by operators for tracking entry generation and submission progress. TODO: Adjust to the v2 RandomBeacon contract.

Jump to

Keyboard shortcuts

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