Add LC p2p validators and subscribers (#15214)

* add and pass lcstore to sync service

* validator for optimistic updates

* validator for finality updates

* subscribers

* gossip scorings

* tmp - add validation test

* optimistic update validation tests

* finality update validation tests

* tests for subscribers

* deps

* changelog entry

* play around with config cleanup

* better logs

* better logs 2

* better logs 3

* address comments

* add comments
This commit is contained in:
Bastin
2025-04-29 16:07:17 +02:00
committed by GitHub
parent 1298dc3a46
commit b69c71d65a
17 changed files with 845 additions and 0 deletions

View File

@@ -99,6 +99,12 @@ type finalityUpdateAltair struct {
finalityBranch interfaces.LightClientFinalityBranch
}
// NewEmptyFinalityUpdateAltair normally should never be called and NewFinalityUpdateFromUpdate should be used instead.
// This function exists only for scenarios where an empty struct is required.
func NewEmptyFinalityUpdateAltair() interfaces.LightClientFinalityUpdate {
return &finalityUpdateAltair{}
}
func (u *finalityUpdateAltair) IsNil() bool {
return u == nil || u.p == nil
}
@@ -205,6 +211,12 @@ type finalityUpdateCapella struct {
finalityBranch interfaces.LightClientFinalityBranch
}
// NewEmptyFinalityUpdateCapella normally should never be called and NewFinalityUpdateFromUpdate should be used instead.
// This function exists only for scenarios where an empty struct is required.
func NewEmptyFinalityUpdateCapella() interfaces.LightClientFinalityUpdate {
return &finalityUpdateCapella{}
}
func (u *finalityUpdateCapella) IsNil() bool {
return u == nil || u.p == nil
}
@@ -311,6 +323,12 @@ type finalityUpdateDeneb struct {
finalityBranch interfaces.LightClientFinalityBranch
}
// NewEmptyFinalityUpdateDeneb normally should never be called and NewFinalityUpdateFromUpdate should be used instead.
// This function exists only for scenarios where an empty struct is required.
func NewEmptyFinalityUpdateDeneb() interfaces.LightClientFinalityUpdate {
return &finalityUpdateDeneb{}
}
func (u *finalityUpdateDeneb) IsNil() bool {
return u == nil || u.p == nil
}
@@ -417,6 +435,12 @@ type finalityUpdateElectra struct {
finalityBranch interfaces.LightClientFinalityBranchElectra
}
// NewEmptyFinalityUpdateElectra normally should never be called and NewFinalityUpdateFromUpdate should be used instead.
// This function exists only for scenarios where an empty struct is required.
func NewEmptyFinalityUpdateElectra() interfaces.LightClientFinalityUpdate {
return &finalityUpdateElectra{}
}
func (u *finalityUpdateElectra) IsNil() bool {
return u == nil || u.p == nil
}

View File

@@ -78,6 +78,12 @@ type optimisticUpdateAltair struct {
attestedHeader interfaces.LightClientHeader
}
// NewEmptyOptimisticUpdateAltair normally should never be called and NewOptimisticUpdateFromUpdate should be used instead.
// This function exists only for scenarios where an empty struct is required.
func NewEmptyOptimisticUpdateAltair() interfaces.LightClientOptimisticUpdate {
return &optimisticUpdateAltair{}
}
func (u *optimisticUpdateAltair) IsNil() bool {
return u == nil || u.p == nil
}
@@ -156,6 +162,12 @@ type optimisticUpdateCapella struct {
attestedHeader interfaces.LightClientHeader
}
// NewEmptyOptimisticUpdateCapella normally should never be called and NewOptimisticUpdateFromUpdate should be used instead.
// This function exists only for scenarios where an empty struct is required.
func NewEmptyOptimisticUpdateCapella() interfaces.LightClientOptimisticUpdate {
return &optimisticUpdateCapella{}
}
func (u *optimisticUpdateCapella) IsNil() bool {
return u == nil || u.p == nil
}
@@ -234,6 +246,12 @@ type optimisticUpdateDeneb struct {
attestedHeader interfaces.LightClientHeader
}
// NewEmptyOptimisticUpdateDeneb normally should never be called and NewOptimisticUpdateFromUpdate should be used instead.
// This function exists only for scenarios where an empty struct is required.
func NewEmptyOptimisticUpdateDeneb() interfaces.LightClientOptimisticUpdate {
return &optimisticUpdateDeneb{}
}
func (u *optimisticUpdateDeneb) IsNil() bool {
return u == nil || u.p == nil
}