Documentation ¶
Index ¶
- Constants
- Variables
- func WithBaseService(base service.BaseService) service.Option[Service]
- func WithBlockValidator(bv *core.BlockValidator) service.Option[Service]
- func WithExecutionEngine(ee ExecutionEngine) service.Option[Service]
- func WithLocalBuilder(lb LocalBuilder) service.Option[Service]
- func WithPayloadValidator(pv *core.PayloadValidator) service.Option[Service]
- func WithStakingService(sks StakingService) service.Option[Service]
- func WithStateProcessor(sp *core.StateProcessor) service.Option[Service]
- type ExecutionEngine
- type LocalBuilder
- type RandaoProcessor
- type Service
- func (s *Service) PostBlockProcess(ctx context.Context, st state.BeaconState, blk beacontypes.ReadOnlyBeaconBlock) error
- func (s *Service) ProcessBeaconBlock(ctx context.Context, st state.BeaconState, blk beacontypes.ReadOnlyBeaconBlock, ...) error
- func (s *Service) ProcessSlot(st state.BeaconState) error
- type StakingService
Constants ¶
const ( // MetricReceivedInvalidPayload is used to count the number of times an // invalid payload is received. MetricReceivedInvalidPayload = "beaconkit.blockchain.received_invalid_payload" // MetricFailedToBuildLocalPayload is used to count the number of times the // local builder fails to build a payload when triggered via // the chain service. //nolint:lll MetricFailedToBuildLocalPayload = "beaconkit.blockchain.failed_to_build_local_payload" )
Variables ¶
var ( // ErrInvalidPayload indicates that the payload of a beacon block is // invalid. ErrInvalidPayload = errors.New("invalid payload") // ErrNoPayloadInBeaconBlock indicates that a beacon block was expected to // have a payload, but none was found. ErrNoPayloadInBeaconBlock = errors.New("no payload in beacon block") )
Functions ¶
func WithBaseService ¶
func WithBaseService(base service.BaseService) service.Option[Service]
WithBaseService returns an Option that sets the BaseService for the Service.
func WithBlockValidator ¶
func WithBlockValidator(bv *core.BlockValidator) service.Option[Service]
WithBlockValidator is a function that returns an Option. It sets the BlockValidator of the Service to the provided Service.
func WithExecutionEngine ¶
func WithExecutionEngine(ee ExecutionEngine) service.Option[Service]
WithExecutionService is a function that returns an Option. It sets the ExecutionService of the Service to the provided Service.
func WithLocalBuilder ¶
func WithLocalBuilder(lb LocalBuilder) service.Option[Service]
WithLocalBuilder is a function that returns an Option. It sets the BuilderService of the Service to the provided Service.
func WithPayloadValidator ¶
func WithPayloadValidator(pv *core.PayloadValidator) service.Option[Service]
WithPayloadValidator is a function that returns an Option.
func WithStakingService ¶
func WithStakingService(sks StakingService) service.Option[Service]
WithExecutionService is a function that returns an Option. It sets the ExecutionService of the Service to the provided Service.
func WithStateProcessor ¶
func WithStateProcessor(sp *core.StateProcessor) service.Option[Service]
WithStateProcessor is a function that returns an Option.
Types ¶
type ExecutionEngine ¶
type ExecutionEngine interface { // GetPayload returns the payload and blobs bundle for the given slot. GetPayload( ctx context.Context, req *execution.GetPayloadRequest, ) (enginetypes.ExecutionPayload, *engine.BlobsBundleV1, bool, error) // NotifyForkchoiceUpdate notifies the execution client of a forkchoice // update. NotifyForkchoiceUpdate( ctx context.Context, req *execution.ForkchoiceUpdateRequest, ) (*engine.PayloadID, *primitives.ExecutionHash, error) // VerifyAndNotifyNewPayload verifies the new payload and notifies the // execution VerifyAndNotifyNewPayload( ctx context.Context, req *execution.NewPayloadRequest, ) (bool, error) }
type LocalBuilder ¶
type LocalBuilder interface { BuildLocalPayload( ctx context.Context, st state.BeaconState, parentEth1Hash primitives.ExecutionHash, slot primitives.Slot, timestamp uint64, parentBlockRoot primitives.Root, ) (*engine.PayloadID, error) }
LocalBuilder is the interface for the builder service.
type RandaoProcessor ¶
type RandaoProcessor interface { BuildReveal( st state.BeaconState, ) (primitives.BLSSignature, error) MixinNewReveal( st state.BeaconState, reveal primitives.BLSSignature, ) error VerifyReveal( st state.BeaconState, proposerPubkey primitives.BLSPubkey, reveal primitives.BLSSignature, ) error }
RandaoProcessor is the interface for the randao processor.
type Service ¶
type Service struct { service.BaseService // contains filtered or unexported fields }
Service is the blockchain service.
func (*Service) PostBlockProcess ¶
func (s *Service) PostBlockProcess( ctx context.Context, st state.BeaconState, blk beacontypes.ReadOnlyBeaconBlock, ) error
PostBlockProcess is called after a block has been processed. It is responsible for processing logs and other post block tasks.
func (*Service) ProcessBeaconBlock ¶
func (s *Service) ProcessBeaconBlock( ctx context.Context, st state.BeaconState, blk beacontypes.ReadOnlyBeaconBlock, blobs *datypes.BlobSidecars, ) error
ProcessBeaconBlock receives an incoming beacon block, it first validates and then processes the block.
func (*Service) ProcessSlot ¶
func (s *Service) ProcessSlot( st state.BeaconState, ) error
ProcessSlot processes the incoming beacon slot.
type StakingService ¶
type StakingService interface { // ProcessLogsInETH1Block processes logs in an eth1 block. ProcessLogsInETH1Block( ctx context.Context, st state.BeaconState, blockHash primitives.ExecutionHash, ) error }
StakingService is the interface for the staking service.