github.com/prysmaticlabs/prysm@v1.4.4/beacon-chain/core/feed/state/events.go (about)

     1  // Package state contains types for state operation-specific events fired
     2  // during the runtime of a beacon node such state initialization, state updates,
     3  // and chain start.
     4  package state
     5  
     6  import (
     7  	"time"
     8  
     9  	types "github.com/prysmaticlabs/eth2-types"
    10  	"github.com/prysmaticlabs/prysm/proto/interfaces"
    11  )
    12  
    13  const (
    14  	// BlockProcessed is sent after a block has been processed and updated the state database.
    15  	BlockProcessed = iota + 1
    16  	// ChainStarted is sent when enough validators are active to start proposing blocks.
    17  	ChainStarted
    18  	// Initialized is sent when the internal beacon node's state is ready to be accessed.
    19  	Initialized
    20  	// Synced is sent when the beacon node has completed syncing and is ready to participate in the network.
    21  	Synced
    22  	// Reorg is an event sent when the new head state's slot after a block
    23  	// transition is lower than its previous head state slot value.
    24  	Reorg
    25  	// FinalizedCheckpoint event.
    26  	FinalizedCheckpoint
    27  	// NewHead of the chain event.
    28  	NewHead
    29  )
    30  
    31  // BlockProcessedData is the data sent with BlockProcessed events.
    32  type BlockProcessedData struct {
    33  	// Slot is the slot of the processed block.
    34  	Slot types.Slot
    35  	// BlockRoot of the processed block.
    36  	BlockRoot [32]byte
    37  	// SignedBlock is the physical processed block.
    38  	SignedBlock interfaces.SignedBeaconBlock
    39  	// Verified is true if the block's BLS contents have been verified.
    40  	Verified bool
    41  }
    42  
    43  // ChainStartedData is the data sent with ChainStarted events.
    44  type ChainStartedData struct {
    45  	// StartTime is the time at which the chain started.
    46  	StartTime time.Time
    47  }
    48  
    49  // SyncedData is the data sent with Synced events.
    50  type SyncedData struct {
    51  	// StartTime is the time at which the chain started.
    52  	StartTime time.Time
    53  }
    54  
    55  // InitializedData is the data sent with Initialized events.
    56  type InitializedData struct {
    57  	// StartTime is the time at which the chain started.
    58  	StartTime time.Time
    59  	// GenesisValidatorsRoot represents state.validators.HashTreeRoot().
    60  	GenesisValidatorsRoot []byte
    61  }