From cccf47b4f4405f18dc9bfbd54fccaa7005fdc1d2 Mon Sep 17 00:00:00 2001 From: "lightclient@protonmail.com" Date: Tue, 23 May 2023 14:04:18 +0200 Subject: [PATCH] internal/era: error if accumulator has more records than max allowed --- internal/era/accumulator.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/era/accumulator.go b/internal/era/accumulator.go index 78fa451930..19e03973f1 100644 --- a/internal/era/accumulator.go +++ b/internal/era/accumulator.go @@ -30,6 +30,9 @@ func ComputeAccumulator(hashes []common.Hash, tds []*big.Int) (common.Hash, erro if len(hashes) != len(tds) { return common.Hash{}, fmt.Errorf("must have equal number hashes as td values") } + if len(hashes) > MaxEra1Size { + return common.Hash{}, fmt.Errorf("too many records: have %d, max %d", len(hashes), MaxEra1Size) + } hh := ssz.NewHasher() for i := range hashes { rec := headerRecord{hashes[i], tds[i]}