2020-04-29 17:40:33 +00:00
|
|
|
// Package state contains types for state operation-specific events fired
|
|
|
|
// during the runtime of a beacon node such state initialization, state updates,
|
|
|
|
// and chain start.
|
2019-12-07 17:57:26 +00:00
|
|
|
package state
|
|
|
|
|
2021-01-05 20:40:11 +00:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2024-02-15 05:46:47 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces"
|
|
|
|
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
2021-01-05 20:40:11 +00:00
|
|
|
)
|
2019-12-07 17:57:26 +00:00
|
|
|
|
|
|
|
const (
|
|
|
|
// BlockProcessed is sent after a block has been processed and updated the state database.
|
|
|
|
BlockProcessed = iota + 1
|
|
|
|
// ChainStarted is sent when enough validators are active to start proposing blocks.
|
|
|
|
ChainStarted
|
2023-05-03 04:34:01 +00:00
|
|
|
// deprecated: Initialized is sent when the internal beacon node's state is ready to be accessed.
|
|
|
|
_
|
|
|
|
// deprecated: Synced is sent when the beacon node has completed syncing and is ready to participate in the network.
|
|
|
|
_
|
2023-04-13 14:47:13 +00:00
|
|
|
// Reorg is an event sent when the new head is not a descendant of the previous head.
|
2020-05-06 19:15:31 +00:00
|
|
|
Reorg
|
2021-06-10 21:13:15 +00:00
|
|
|
// FinalizedCheckpoint event.
|
|
|
|
FinalizedCheckpoint
|
|
|
|
// NewHead of the chain event.
|
|
|
|
NewHead
|
2023-03-17 19:25:36 +00:00
|
|
|
// MissedSlot is sent when we need to notify users that a slot was missed.
|
|
|
|
MissedSlot
|
2024-01-11 18:38:59 +00:00
|
|
|
// LightClientFinalityUpdate event
|
|
|
|
LightClientFinalityUpdate
|
|
|
|
// LightClientOptimisticUpdate event
|
|
|
|
LightClientOptimisticUpdate
|
2019-12-07 17:57:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// BlockProcessedData is the data sent with BlockProcessed events.
|
|
|
|
type BlockProcessedData struct {
|
2020-02-10 16:59:55 +00:00
|
|
|
// Slot is the slot of the processed block.
|
2023-01-26 14:40:12 +00:00
|
|
|
Slot primitives.Slot
|
2020-05-06 19:15:31 +00:00
|
|
|
// BlockRoot of the processed block.
|
2019-12-07 17:57:26 +00:00
|
|
|
BlockRoot [32]byte
|
2021-01-05 20:40:11 +00:00
|
|
|
// SignedBlock is the physical processed block.
|
2023-02-09 09:23:32 +00:00
|
|
|
SignedBlock interfaces.ReadOnlySignedBeaconBlock
|
2019-12-07 17:57:26 +00:00
|
|
|
// Verified is true if the block's BLS contents have been verified.
|
|
|
|
Verified bool
|
2023-07-20 17:26:34 +00:00
|
|
|
// Optimistic is true if the block is optimistic.
|
|
|
|
Optimistic bool
|
2019-12-07 17:57:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ChainStartedData is the data sent with ChainStarted events.
|
|
|
|
type ChainStartedData struct {
|
|
|
|
// StartTime is the time at which the chain started.
|
|
|
|
StartTime time.Time
|
|
|
|
}
|
|
|
|
|
2020-04-18 10:45:20 +00:00
|
|
|
// SyncedData is the data sent with Synced events.
|
|
|
|
type SyncedData struct {
|
|
|
|
// StartTime is the time at which the chain started.
|
|
|
|
StartTime time.Time
|
|
|
|
}
|
|
|
|
|
2019-12-07 17:57:26 +00:00
|
|
|
// InitializedData is the data sent with Initialized events.
|
|
|
|
type InitializedData struct {
|
|
|
|
// StartTime is the time at which the chain started.
|
|
|
|
StartTime time.Time
|
2020-08-27 18:13:32 +00:00
|
|
|
// GenesisValidatorsRoot represents state.validators.HashTreeRoot().
|
2020-04-14 20:27:03 +00:00
|
|
|
GenesisValidatorsRoot []byte
|
2019-12-07 17:57:26 +00:00
|
|
|
}
|