mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 19:40:37 +00:00
Fix blob sidecar subnet check (#13102)
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
parent
00826e8858
commit
f55708b995
@ -61,8 +61,8 @@ func (s *Service) validateBlob(ctx context.Context, pid peer.ID, msg *pubsub.Mes
|
||||
}
|
||||
blob := sBlob.Message
|
||||
|
||||
// [REJECT] The sidecar is for the correct topic -- i.e. sidecar.index matches the topic {index}.
|
||||
want := fmt.Sprintf("blob_sidecar_%d", blob.Index)
|
||||
// [REJECT] The sidecar is for the correct subnet -- i.e. compute_subnet_for_blob_sidecar(sidecar.index) == subnet_id.
|
||||
want := fmt.Sprintf("blob_sidecar_%d", computeSubnetForBlobSidecar(blob.Index))
|
||||
if !strings.Contains(*msg.Topic, want) {
|
||||
log.WithFields(blobFields(blob)).Debug("Sidecar blob does not match topic")
|
||||
return pubsub.ValidationReject, fmt.Errorf("wrong topic name: %s", *msg.Topic)
|
||||
@ -237,3 +237,7 @@ func blobFields(b *eth.BlobSidecar) logrus.Fields {
|
||||
"index": b.Index,
|
||||
}
|
||||
}
|
||||
|
||||
func computeSubnetForBlobSidecar(index uint64) uint64 {
|
||||
return index % params.BeaconConfig().BlobsidecarSubnetCount
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user