From a1163b4ade2a0e7d843ae4eef7c7b57f0134b2d4 Mon Sep 17 00:00:00 2001 From: Kim De Mey Date: Tue, 17 Jan 2023 14:47:22 +0100 Subject: [PATCH] Do not allow pre-merge headers without an AccumulatorProof (#1426) --- fluffy/network/history/accumulator.nim | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/fluffy/network/history/accumulator.nim b/fluffy/network/history/accumulator.nim index 87f4f22f0..195606a19 100644 --- a/fluffy/network/history/accumulator.nim +++ b/fluffy/network/history/accumulator.nim @@ -170,13 +170,16 @@ func verifyHeader*( of BlockHeaderProofType.accumulatorProof: a.verifyAccumulatorProof(header, proof.accumulatorProof) of BlockHeaderProofType.none: - # TODO: - # Currently there is no proof solution for verifying headers post-merge. - # Skipping canonical verification will allow for nodes to push block data - # that is not part of the canonical chain. - # For now we accept this flaw as the focus lies on testing data availability - # up to the head of the chain. - ok() + if header.isPreMerge(): + err("Pre merge header requires AccumulatorProof") + else: + # TODO: + # Currently there is no proof solution for verifying headers post-merge. + # Skipping canonical verification will allow for nodes to push block data + # that is not part of the canonical chain. + # For now we accept this flaw as the focus lies on testing data + # availability up to the head of the chain. + ok() func buildProof*( header: BlockHeader,