Skip to content

Commit

Permalink
Update Vectors Max elements to 512 * 1024
Browse files Browse the repository at this point in the history
  • Loading branch information
freehere107 committed Aug 5, 2024
1 parent 2ce2ec3 commit b8a9de6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions types/Vectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,8 +25,8 @@ func (v *Vec) Init(data scaleBytes.ScaleBytes, option *ScaleDecoderOption) {
func (v *Vec) Process() {
elementCount := v.ProcessAndUpdateData("Compact<u32>").(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++ {
Expand Down

0 comments on commit b8a9de6

Please sign in to comment.