From 6f87f41bdaa96e995e5cf881f6981f05d47ce4bc Mon Sep 17 00:00:00 2001 From: pk910 Date: Sun, 31 Mar 2024 03:32:16 +0200 Subject: [PATCH] remove hardcoded sync committee size checks --- spec/altair/syncaggregate.go | 6 ------ spec/altair/synccommittee.go | 8 +------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/spec/altair/syncaggregate.go b/spec/altair/syncaggregate.go index b8b0de96..cc00ef62 100644 --- a/spec/altair/syncaggregate.go +++ b/spec/altair/syncaggregate.go @@ -70,12 +70,6 @@ func (s *SyncAggregate) unpack(syncAggregateJSON *syncAggregateJSON) error { if err != nil { return errors.Wrap(err, "invalid value for sync committee bits") } - if len(syncCommitteeBits) < syncCommitteeSize/8 { - return errors.New("sync committee bits too short") - } - if len(syncCommitteeBits) > syncCommitteeSize/8 { - return errors.New("sync committee bits too long") - } s.SyncCommitteeBits = syncCommitteeBits if syncAggregateJSON.SyncCommitteeSignature == "" { diff --git a/spec/altair/synccommittee.go b/spec/altair/synccommittee.go index 9e2e1f37..8d50ad39 100644 --- a/spec/altair/synccommittee.go +++ b/spec/altair/synccommittee.go @@ -25,9 +25,6 @@ import ( "github.com/pkg/errors" ) -// Altair constants. -var syncCommitteeSize = 512 - // SyncCommittee is the Ethereum 2 sync committee structure. type SyncCommittee struct { Pubkeys []phase0.BLSPubKey `ssz-size:"512,48" dynssz-size:"SYNC_COMMITTEE_SIZE,48"` @@ -70,10 +67,7 @@ func (s *SyncCommittee) UnmarshalJSON(input []byte) error { } func (s *SyncCommittee) unpack(syncCommitteeJSON *syncCommitteeJSON) error { - if len(syncCommitteeJSON.Pubkeys) != syncCommitteeSize { - return errors.New("incorrect length for public keys") - } - s.Pubkeys = make([]phase0.BLSPubKey, syncCommitteeSize) + s.Pubkeys = make([]phase0.BLSPubKey, len(syncCommitteeJSON.Pubkeys)) for i := range syncCommitteeJSON.Pubkeys { pubKey, err := hex.DecodeString(strings.TrimPrefix(syncCommitteeJSON.Pubkeys[i], "0x")) if err != nil {