From 6c3d3b05cf95d3830583dc7a11db2b82c86e0872 Mon Sep 17 00:00:00 2001 From: Giulio Rebuffo Date: Sat, 18 Mar 2023 17:15:07 +0100 Subject: [PATCH] lol --- cl/cltypes/ssz/ssz.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cl/cltypes/ssz/ssz.go b/cl/cltypes/ssz/ssz.go index fefe4b7391b..5537efa6be1 100644 --- a/cl/cltypes/ssz/ssz.go +++ b/cl/cltypes/ssz/ssz.go @@ -99,7 +99,9 @@ func DecodeDynamicList[T Unmarshaler](bytes []byte, start, end uint32, max uint6 return nil, ErrBadOffset } objs[i] = objs[i].Clone().(T) - objs[i].DecodeSSZ(buf[currentOffset:endOffset]) + if err := objs[i].DecodeSSZ(buf[currentOffset:endOffset]); err != nil { + return nil, err + } currentOffset = endOffset } return objs, nil @@ -121,7 +123,9 @@ func DecodeStaticList[T Unmarshaler](bytes []byte, start, end, bytesPerElement u objs := make([]T, elementsNum) for i := range objs { objs[i] = objs[i].Clone().(T) - objs[i].DecodeSSZ(buf[i*int(bytesPerElement):]) + if err := objs[i].DecodeSSZ(buf[i*int(bytesPerElement):]); err != nil { + return nil, err + } } return objs, nil }