services

package
v1.9.7-0...-42bb602 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: LGPL-3.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIgnore                          = errors.New("ignore") // ErrIgnore is used to indicate that the message should be ignored.
	ErrBlockYoungerThanParent          = errors.New("block is younger than parent")
	ErrInvalidCommitmentsCount         = errors.New("invalid commitments count")
	ErrCommitmentsInclusionProofFailed = errors.New("commitments inclusion proof failed")
	ErrInvalidSidecarSlot              = errors.New("invalid sidecar slot")
	ErrBlobIndexOutOfRange             = errors.New("blob index out of range")
)
View Source
var ErrInvalidBlsSignature = errors.New("invalid bls signature")
View Source
var (
	ErrInvalidSignature = errors.New("invalid signature")
)

Functions

func AggregateAndProofSignature

func AggregateAndProofSignature(
	state *state.CachingBeaconState,
	aggregate *cltypes.AggregateAndProof,
) ([]byte, []byte, []byte, error)

func AggregateMessageSignature

func AggregateMessageSignature(
	s *state.CachingBeaconState,
	aggregateAndProof *cltypes.SignedAggregateAndProof,
	attestingIndicies []uint64,
) ([]byte, []byte, []byte, error)

func AggregatorSignature

func AggregatorSignature(
	state *state.CachingBeaconState,
	aggregate *cltypes.SignedAggregateAndProof,
) ([]byte, []byte, []byte, error)

func NewProposerSlashingService

func NewProposerSlashingService(
	operationsPool pool.OperationsPool,
	syncedDataManager synced_data.SyncedData,
	beaconCfg *clparams.BeaconChainConfig,
	ethClock eth_clock.EthereumClock,
	emitters *beaconevents.EventEmitter,
) *proposerSlashingService

Types

type AggregateAndProofService

type AggregateAndProofService Service[*SignedAggregateAndProofForGossip]

func NewAggregateAndProofService

func NewAggregateAndProofService(
	ctx context.Context,
	syncedDataManager *synced_data.SyncedDataManager,
	forkchoiceStore forkchoice.ForkChoiceStorage,
	beaconCfg *clparams.BeaconChainConfig,
	opPool pool.OperationsPool,
	test bool,
	batchSignatureVerifier *BatchSignatureVerifier,
) AggregateAndProofService

type AggregateVerificationData

type AggregateVerificationData struct {
	Signatures  [][]byte
	SignRoots   [][]byte
	Pks         [][]byte
	F           func()
	SendingPeer *sentinel.Peer
}

each AggregateVerification request has sentinel.SentinelClient and *sentinel.GossipData to make sure that we can validate it separately and in case of failure we ban corresponding GossipData.Peer or simply run F and publish GossipData in case signature verification succeeds.

func GetSignaturesOnAggregate

func GetSignaturesOnAggregate(
	s *state.CachingBeaconState,
	aggregateAndProof *cltypes.SignedAggregateAndProof,
	attestingIndicies []uint64,
) (*AggregateVerificationData, error)

type AttestationForGossip

type AttestationForGossip struct {
	Attestation       *solid.Attestation
	SingleAttestation *solid.SingleAttestation // New container after Electra
	Receiver          *sentinel.Peer
	// ImmediateProcess indicates whether the attestation should be processed immediately or able to be scheduled for later processing.
	ImmediateProcess bool
}

AttestationWithGossipData type represents attestation with the gossip data where it's coming from.

type AttestationService

type AttestationService Service[*AttestationForGossip]

func NewAttestationService

func NewAttestationService(
	ctx context.Context,
	forkchoiceStore forkchoice.ForkChoiceStorage,
	committeeSubscribe committee_subscription.CommitteeSubscribe,
	ethClock eth_clock.EthereumClock,
	syncedDataManager synced_data.SyncedData,
	beaconCfg *clparams.BeaconChainConfig,
	netCfg *clparams.NetworkConfig,
	emitters *beaconevents.EventEmitter,
	batchSignatureVerifier *BatchSignatureVerifier,
) AttestationService

type BLSToExecutionChangeService

type BLSToExecutionChangeService Service[*SignedBLSToExecutionChangeForGossip]

func NewBLSToExecutionChangeService

func NewBLSToExecutionChangeService(
	operationsPool pool.OperationsPool,
	emitters *beaconevents.EventEmitter,
	syncedDataManager synced_data.SyncedData,
	beaconCfg *clparams.BeaconChainConfig,
	batchSignatureVerifier *BatchSignatureVerifier,
) BLSToExecutionChangeService

type BatchSignatureVerifier

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

func NewBatchSignatureVerifier

func NewBatchSignatureVerifier(ctx context.Context, sentinel sentinel.SentinelClient) *BatchSignatureVerifier

func (*BatchSignatureVerifier) AsyncVerifyAggregateProof

func (b *BatchSignatureVerifier) AsyncVerifyAggregateProof(data *AggregateVerificationData)

func (*BatchSignatureVerifier) AsyncVerifyAttestation

func (b *BatchSignatureVerifier) AsyncVerifyAttestation(data *AggregateVerificationData)

AsyncVerifyAttestation schedules new verification

func (*BatchSignatureVerifier) AsyncVerifyBlsToExecutionChange

func (b *BatchSignatureVerifier) AsyncVerifyBlsToExecutionChange(data *AggregateVerificationData)

func (*BatchSignatureVerifier) AsyncVerifySyncCommitteeMessage

func (b *BatchSignatureVerifier) AsyncVerifySyncCommitteeMessage(data *AggregateVerificationData)

func (*BatchSignatureVerifier) AsyncVerifySyncContribution

func (b *BatchSignatureVerifier) AsyncVerifySyncContribution(data *AggregateVerificationData)

func (*BatchSignatureVerifier) AsyncVerifyVoluntaryExit

func (b *BatchSignatureVerifier) AsyncVerifyVoluntaryExit(data *AggregateVerificationData)

func (*BatchSignatureVerifier) ImmediateVerification

func (b *BatchSignatureVerifier) ImmediateVerification(data *AggregateVerificationData) error

func (*BatchSignatureVerifier) Start

func (b *BatchSignatureVerifier) Start()

type BlobSidecarsService

type BlobSidecarsService Service[*cltypes.BlobSidecar]

func NewBlobSidecarService

func NewBlobSidecarService(
	ctx context.Context,
	beaconCfg *clparams.BeaconChainConfig,
	forkchoiceStore forkchoice.ForkChoiceStorage,
	syncedDataManager *synced_data.SyncedDataManager,
	ethClock eth_clock.EthereumClock,
	emitters *beaconevents.EventEmitter,
	test bool,
) BlobSidecarsService

NewBlobSidecarService creates a new blob sidecar service

type BlockService

type BlockService Service[*cltypes.SignedBeaconBlock]

type ProposerSlashingService

type ProposerSlashingService Service[*cltypes.ProposerSlashing]

type Service

type Service[T any] interface {
	ProcessMessage(ctx context.Context, subnet *uint64, msg T) error
}

func NewBlockService

NewBlockService creates a new block service

type SignedAggregateAndProofForGossip

type SignedAggregateAndProofForGossip struct {
	SignedAggregateAndProof *cltypes.SignedAggregateAndProof
	Receiver                *sentinel.Peer
	ImmediateProcess        bool
}

SignedAggregateAndProofData is passed to SignedAggregateAndProof service. The service does the signature verification asynchronously. That's why we cannot wait for its ProcessMessage call to finish to check error. The service will do re-publishing of the gossip or banning the peer in case of invalid signature by itself. that's why we are passing sentinel.SentinelClient and *sentinel.GossipData to enable the service to do all of that by itself.

type SignedBLSToExecutionChangeForGossip

type SignedBLSToExecutionChangeForGossip struct {
	SignedBLSToExecutionChange *cltypes.SignedBLSToExecutionChange
	Receiver                   *sentinel.Peer
	ImmediateVerification      bool
}

SignedBLSToExecutionChangeForGossip type represents SignedBLSToExecutionChange with the gossip data where it's coming from.

type SignedContributionAndProofForGossip

type SignedContributionAndProofForGossip struct {
	SignedContributionAndProof *cltypes.SignedContributionAndProof
	Receiver                   *sentinel.Peer
	ImmediateVerification      bool
}

SignedContributionAndProofWithGossipData type represents SignedContributionAndProof with the gossip data where it's coming from.

type SignedVoluntaryExitForGossip

type SignedVoluntaryExitForGossip struct {
	SignedVoluntaryExit   *cltypes.SignedVoluntaryExit
	Receiver              *sentinel.Peer
	ImmediateVerification bool
}

SignedVoluntaryExitForGossip type represents SignedVoluntaryExit with the gossip data where it's coming from.

type SyncCommitteeMessageForGossip

type SyncCommitteeMessageForGossip struct {
	SyncCommitteeMessage  *cltypes.SyncCommitteeMessage
	Receiver              *sentinel.Peer
	ImmediateVerification bool
}

type SyncCommitteeMessagesService

type SyncCommitteeMessagesService Service[*SyncCommitteeMessageForGossip]

func NewSyncCommitteeMessagesService

func NewSyncCommitteeMessagesService(
	beaconChainCfg *clparams.BeaconChainConfig,
	ethClock eth_clock.EthereumClock,
	syncedDataManager *synced_data.SyncedDataManager,
	syncContributionPool sync_contribution_pool.SyncContributionPool,
	batchSignatureVerifier *BatchSignatureVerifier,
	test bool,
) SyncCommitteeMessagesService

NewSyncCommitteeMessagesService creates a new sync committee messages service

type SyncContributionService

type SyncContributionService Service[*SignedContributionAndProofForGossip]

func NewSyncContributionService

func NewSyncContributionService(
	syncedDataManager *synced_data.SyncedDataManager,
	beaconCfg *clparams.BeaconChainConfig,
	syncContributionPool sync_contribution_pool.SyncContributionPool,
	ethClock eth_clock.EthereumClock,
	emitters *beaconevents.EventEmitter,
	batchSignatureVerifier *BatchSignatureVerifier,
	test bool,
) SyncContributionService

NewSyncContributionService creates a new sync contribution service

type VoluntaryExitService

type VoluntaryExitService Service[*SignedVoluntaryExitForGossip]

func NewVoluntaryExitService

func NewVoluntaryExitService(
	operationsPool pool.OperationsPool,
	emitters *beaconevents.EventEmitter,
	syncedDataManager synced_data.SyncedData,
	beaconCfg *clparams.BeaconChainConfig,
	ethClock eth_clock.EthereumClock,
	batchSignatureVerifier *BatchSignatureVerifier,
) VoluntaryExitService

Directories

Path Synopsis
Package mock_services is a generated GoMock package.
Package mock_services is a generated GoMock package.

Jump to

Keyboard shortcuts

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