From b8a9de6df243580016e3475cbb457017949d083d Mon Sep 17 00:00:00 2001 From: freehere107 Date: Mon, 5 Aug 2024 09:07:34 +0800 Subject: [PATCH] Update Vectors Max elements to 512 * 1024 --- types/Vectors.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/types/Vectors.go b/types/Vectors.go index b95426e..7055d58 100644 --- a/types/Vectors.go +++ b/types/Vectors.go @@ -13,6 +13,8 @@ type Vec struct { ScaleDecoder } +const maxVecLength = 512 * 1024 + func (v *Vec) Init(data scaleBytes.ScaleBytes, option *ScaleDecoderOption) { if v.SubType != "" && option != nil { option.SubType = v.SubType @@ -23,8 +25,8 @@ func (v *Vec) Init(data scaleBytes.ScaleBytes, option *ScaleDecoderOption) { func (v *Vec) Process() { elementCount := v.ProcessAndUpdateData("Compact").(int) var result []interface{} - if elementCount > 99_999 { - panic(fmt.Sprintf("Vec length %d exceeds %d with subType %s", elementCount, 99_999, v.SubType)) + if elementCount > maxVecLength { + panic(fmt.Sprintf("Vec length %d exceeds %d with subType %s", elementCount, maxVecLength, v.SubType)) } subType := v.SubType for i := 0; i < elementCount; i++ {