Skip to content

Commit

Permalink
use correct fork digest when broadcasting blob sidecars and sync msgs (
Browse files Browse the repository at this point in the history
…#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.
  • Loading branch information
etan-status authored Jul 23, 2024
1 parent 9f21182 commit 20ede0a
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions beacon_chain/networking/eth2_network.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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*(
Expand Down

0 comments on commit 20ede0a

Please sign in to comment.