Validator: Choose a reasonable cap for the attested target epochs slice (#8452)

* Choose a reasonable cap for the attested target epochs slice

* revert bazelrc

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
This commit is contained in:
Preston Van Loon 2021-02-15 19:37:35 -06:00 committed by GitHub
parent 4bed8d4ed4
commit aef5a7b428
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -174,7 +174,7 @@ func (s *Store) CheckSlashableAttestation(
existingSourceEpoch := bytesutil.BytesToEpochBigEndian(sourceEpochBytes) existingSourceEpoch := bytesutil.BytesToEpochBigEndian(sourceEpochBytes)
// There can be multiple target epochs attested per source epoch. // There can be multiple target epochs attested per source epoch.
attestedTargetEpochs := make([]types.Epoch, 0) attestedTargetEpochs := make([]types.Epoch, 0, len(targetEpochsBytes)/8)
for i := 0; i < len(targetEpochsBytes); i += 8 { for i := 0; i < len(targetEpochsBytes); i += 8 {
targetEpoch := bytesutil.BytesToEpochBigEndian(targetEpochsBytes[i : i+8]) targetEpoch := bytesutil.BytesToEpochBigEndian(targetEpochsBytes[i : i+8])
attestedTargetEpochs = append(attestedTargetEpochs, targetEpoch) attestedTargetEpochs = append(attestedTargetEpochs, targetEpoch)