From 24409545553174079bab6725b51d3a888b532ab5 Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Wed, 14 Dec 2022 02:30:34 +0100 Subject: [PATCH] allow syncing capella blocks (#4423) --- beacon_chain/networking/eth2_network.nim | 2 +- beacon_chain/sync/sync_protocol.nim | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/beacon_chain/networking/eth2_network.nim b/beacon_chain/networking/eth2_network.nim index 7be298115..8dd800341 100644 --- a/beacon_chain/networking/eth2_network.nim +++ b/beacon_chain/networking/eth2_network.nim @@ -804,7 +804,7 @@ func chunkMaxSize[T](): uint32 = when T is ForkySignedBeaconBlock: when T is phase0.SignedBeaconBlock or T is altair.SignedBeaconBlock: MAX_CHUNK_SIZE - elif T is bellatrix.SignedBeaconBlock: + elif T is bellatrix.SignedBeaconBlock or T is capella.SignedBeaconBlock: MAX_CHUNK_SIZE_BELLATRIX else: {.fatal: "what's the chunk size here?".} diff --git a/beacon_chain/sync/sync_protocol.nim b/beacon_chain/sync/sync_protocol.nim index 32a365c32..952855da0 100644 --- a/beacon_chain/sync/sync_protocol.nim +++ b/beacon_chain/sync/sync_protocol.nim @@ -14,7 +14,7 @@ import std/[options, tables, sets, macros], chronicles, chronos, snappy/codec, libp2p/switch, - ../spec/datatypes/[phase0, altair, bellatrix], + ../spec/datatypes/[phase0, altair, bellatrix, capella], ../spec/[helpers, forks, network], ".."/[beacon_clock], ../networking/eth2_network, @@ -106,6 +106,12 @@ proc readChunkPayload*( return ok newClone(ForkedSignedBeaconBlock.init(res.get)) else: return err(res.error) + elif contextBytes == peer.network.forkDigests.capella: + let res = await readChunkPayload(conn, peer, capella.SignedBeaconBlock) + if res.isOk: + return ok newClone(ForkedSignedBeaconBlock.init(res.get)) + else: + return err(res.error) else: return neterr InvalidContextBytes