Skip to content

Commit

Permalink
remove hardcoded sync committee size checks
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Mar 31, 2024
1 parent e6830a2 commit 6f87f41
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
6 changes: 0 additions & 6 deletions spec/altair/syncaggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "" {
Expand Down
8 changes: 1 addition & 7 deletions spec/altair/synccommittee.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 6f87f41

Please sign in to comment.