use correct fork digest when broadcasting blob sidecars and sync msgs (#6440)

The fork digest determines the underlying data type on libp2p gossip,
so it's important to use the matching fork digest instead of picking
whatever wall epoch happens to be.
This commit is contained in:
Etan Kissling 2024-07-23 22:30:44 +02:00 committed by GitHub
parent 9f21182646
commit 20ede0ab35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 6 deletions

View File

@ -2694,23 +2694,28 @@ proc broadcastBlobSidecar*(
node: Eth2Node, subnet_id: BlobId, blob: deneb.BlobSidecar):
Future[SendResult] {.async: (raises: [CancelledError], raw: true).} =
let
forkPrefix = node.forkDigestAtEpoch(node.getWallEpoch)
topic = getBlobSidecarTopic(forkPrefix, subnet_id)
contextEpoch = blob.signed_block_header.message.slot.epoch
topic = getBlobSidecarTopic(
node.forkDigestAtEpoch(contextEpoch), subnet_id)
node.broadcast(topic, blob)
proc broadcastSyncCommitteeMessage*(
node: Eth2Node, msg: SyncCommitteeMessage,
subcommitteeIdx: SyncSubcommitteeIndex):
Future[SendResult] {.async: (raises: [CancelledError], raw: true).} =
let topic = getSyncCommitteeTopic(
node.forkDigestAtEpoch(node.getWallEpoch), subcommitteeIdx)
let
contextEpoch = msg.slot.epoch
topic = getSyncCommitteeTopic(
node.forkDigestAtEpoch(contextEpoch), subcommitteeIdx)
node.broadcast(topic, msg)
proc broadcastSignedContributionAndProof*(
node: Eth2Node, msg: SignedContributionAndProof):
Future[SendResult] {.async: (raises: [CancelledError], raw: true).} =
let topic = getSyncCommitteeContributionAndProofTopic(
node.forkDigestAtEpoch(node.getWallEpoch))
let
contextEpoch = msg.message.contribution.slot.epoch
topic = getSyncCommitteeContributionAndProofTopic(
node.forkDigestAtEpoch(contextEpoch))
node.broadcast(topic, msg)
proc broadcastLightClientFinalityUpdate*(