subscribe to Deneb blob subnets (#5342)

This commit is contained in:
tersec 2023-08-23 19:31:41 +00:00 committed by GitHub
parent 93d82e2892
commit ef184c8959
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 2 deletions

View File

@ -948,6 +948,12 @@ proc addCapellaMessageHandlers(
node.addAltairMessageHandlers(forkDigest, slot) node.addAltairMessageHandlers(forkDigest, slot)
node.network.subscribe(getBlsToExecutionChangeTopic(forkDigest), basicParams) node.network.subscribe(getBlsToExecutionChangeTopic(forkDigest), basicParams)
proc addDenebMessageHandlers(
node: BeaconNode, forkDigest: ForkDigest, slot: Slot) =
node.addCapellaMessageHandlers(forkDigest, slot)
for topic in blobSidecarTopics(forkDigest):
node.network.subscribe(topic, basicParams)
proc removeAltairMessageHandlers(node: BeaconNode, forkDigest: ForkDigest) = proc removeAltairMessageHandlers(node: BeaconNode, forkDigest: ForkDigest) =
node.removePhase0MessageHandlers(forkDigest) node.removePhase0MessageHandlers(forkDigest)
@ -963,6 +969,11 @@ proc removeCapellaMessageHandlers(node: BeaconNode, forkDigest: ForkDigest) =
node.removeAltairMessageHandlers(forkDigest) node.removeAltairMessageHandlers(forkDigest)
node.network.unsubscribe(getBlsToExecutionChangeTopic(forkDigest)) node.network.unsubscribe(getBlsToExecutionChangeTopic(forkDigest))
proc removeDenebMessageHandlers(node: BeaconNode, forkDigest: ForkDigest) =
node.removeCapellaMessageHandlers(forkDigest)
for topic in blobSidecarTopics(forkDigest):
node.network.unsubscribe(topic)
proc updateSyncCommitteeTopics(node: BeaconNode, slot: Slot) = proc updateSyncCommitteeTopics(node: BeaconNode, slot: Slot) =
template lastSyncUpdate: untyped = template lastSyncUpdate: untyped =
node.consensusManager[].actionTracker.lastSyncUpdate node.consensusManager[].actionTracker.lastSyncUpdate
@ -1115,7 +1126,7 @@ proc updateGossipStatus(node: BeaconNode, slot: Slot) {.async.} =
removeAltairMessageHandlers, removeAltairMessageHandlers,
removeAltairMessageHandlers, # bellatrix (altair handlers, different forkDigest) removeAltairMessageHandlers, # bellatrix (altair handlers, different forkDigest)
removeCapellaMessageHandlers, removeCapellaMessageHandlers,
removeCapellaMessageHandlers # deneb (capella handlers, different forkDigest) removeDenebMessageHandlers
] ]
for gossipFork in oldGossipForks: for gossipFork in oldGossipForks:
@ -1126,7 +1137,7 @@ proc updateGossipStatus(node: BeaconNode, slot: Slot) {.async.} =
addAltairMessageHandlers, addAltairMessageHandlers,
addAltairMessageHandlers, # bellatrix (altair handlers, different forkDigest) addAltairMessageHandlers, # bellatrix (altair handlers, different forkDigest)
addCapellaMessageHandlers, addCapellaMessageHandlers,
addCapellaMessageHandlers # deneb (capella handlers, different forkDigest) addDenebMessageHandlers
] ]
for gossipFork in newGossipForks: for gossipFork in newGossipForks:

View File

@ -218,3 +218,7 @@ func getSyncSubnets*(
# 3. # 3.
res.setBit(i div (SYNC_COMMITTEE_SIZE div SYNC_COMMITTEE_SUBNET_COUNT)) res.setBit(i div (SYNC_COMMITTEE_SIZE div SYNC_COMMITTEE_SUBNET_COUNT))
res res
iterator blobSidecarTopics*(forkDigest: ForkDigest): string =
for i in 0.SubnetId ..< static(BLOB_SIDECAR_SUBNET_COUNT.SubnetId):
yield getBlobSidecarTopic(forkDigest, i)

View File

@ -80,6 +80,13 @@ suite "Honest validator":
"/eth2/00000000/sync_committee_3/ssz_snappy" "/eth2/00000000/sync_committee_3/ssz_snappy"
getBlobSidecarTopic(forkDigest, SubnetId(1)) == getBlobSidecarTopic(forkDigest, SubnetId(1)) ==
"/eth2/00000000/blob_sidecar_1/ssz_snappy" "/eth2/00000000/blob_sidecar_1/ssz_snappy"
toSeq(blobSidecarTopics(forkDigest)) ==
["/eth2/00000000/blob_sidecar_0/ssz_snappy",
"/eth2/00000000/blob_sidecar_1/ssz_snappy",
"/eth2/00000000/blob_sidecar_2/ssz_snappy",
"/eth2/00000000/blob_sidecar_3/ssz_snappy",
"/eth2/00000000/blob_sidecar_4/ssz_snappy",
"/eth2/00000000/blob_sidecar_5/ssz_snappy"]
test "is_aggregator": test "is_aggregator":
check: check: