mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-23 11:57:18 +00:00
beacon: Use Blake2b Sum512 Instead of 256 (#419)
* Revert "Add Skip Coverage Condition in Coverage.sh (#416)"
This reverts commit 72a5dd1cf4
.
* use blake2b512
* messed up on coverage.sh
This commit is contained in:
parent
72a5dd1cf4
commit
5356bda411
@ -132,7 +132,7 @@ func TestProcessBlockHash(t *testing.T) {
|
||||
exitRoutine <- true
|
||||
}()
|
||||
|
||||
announceHash := blake2b.Sum256([]byte{})
|
||||
announceHash := blake2b.Sum512([]byte{})
|
||||
hashAnnounce := &pb.BeaconBlockHashAnnounce{
|
||||
Hash: announceHash[:],
|
||||
}
|
||||
@ -329,7 +329,7 @@ func TestProcessCrystallizedHash(t *testing.T) {
|
||||
exitRoutine <- true
|
||||
}()
|
||||
|
||||
announceHash := blake2b.Sum256([]byte{})
|
||||
announceHash := blake2b.Sum512([]byte{})
|
||||
hashAnnounce := &pb.CrystallizedStateHashAnnounce{
|
||||
Hash: announceHash[:],
|
||||
}
|
||||
@ -362,7 +362,7 @@ func TestProcessActiveHash(t *testing.T) {
|
||||
exitRoutine <- true
|
||||
}()
|
||||
|
||||
announceHash := blake2b.Sum256([]byte{})
|
||||
announceHash := blake2b.Sum512([]byte{})
|
||||
hashAnnounce := &pb.ActiveStateHashAnnounce{
|
||||
Hash: announceHash[:],
|
||||
}
|
||||
@ -396,7 +396,7 @@ func TestProcessBadCrystallizedHash(t *testing.T) {
|
||||
}()
|
||||
|
||||
// Send blockHashAnnounce msg format to crystallized state channel. Should fail
|
||||
announceHash := blake2b.Sum256([]byte{})
|
||||
announceHash := blake2b.Sum512([]byte{})
|
||||
hashAnnounce := &pb.BeaconBlockHashAnnounce{
|
||||
Hash: announceHash[:],
|
||||
}
|
||||
@ -430,7 +430,7 @@ func TestProcessBadActiveHash(t *testing.T) {
|
||||
}()
|
||||
|
||||
// Send blockHashAnnounce msg format to active state channel. Should fail
|
||||
announceHash := blake2b.Sum256([]byte{})
|
||||
announceHash := blake2b.Sum512([]byte{})
|
||||
hashAnnounce := &pb.BeaconBlockHashAnnounce{
|
||||
Hash: announceHash[:],
|
||||
}
|
||||
|
@ -69,7 +69,10 @@ func (b *Block) Hash() ([32]byte, error) {
|
||||
if err != nil {
|
||||
return [32]byte{}, fmt.Errorf("could not marshal block proto data: %v", err)
|
||||
}
|
||||
return blake2b.Sum256(data), nil
|
||||
var hash [32]byte
|
||||
h := blake2b.Sum512(data)
|
||||
copy(hash[:], h[:32])
|
||||
return hash, nil
|
||||
}
|
||||
|
||||
// ParentHash corresponding to parent beacon block.
|
||||
|
@ -94,7 +94,10 @@ func (a *ActiveState) Hash() ([32]byte, error) {
|
||||
if err != nil {
|
||||
return [32]byte{}, err
|
||||
}
|
||||
return blake2b.Sum256(data), nil
|
||||
var hash [32]byte
|
||||
h := blake2b.Sum512(data)
|
||||
copy(hash[:], h[:32])
|
||||
return hash, nil
|
||||
}
|
||||
|
||||
// PendingAttestations returns attestations that have not yet been processed.
|
||||
@ -150,7 +153,10 @@ func (c *CrystallizedState) Hash() ([32]byte, error) {
|
||||
if err != nil {
|
||||
return [32]byte{}, err
|
||||
}
|
||||
return blake2b.Sum256(data), nil
|
||||
var hash [32]byte
|
||||
h := blake2b.Sum512(data)
|
||||
copy(hash[:], h[:32])
|
||||
return hash, nil
|
||||
}
|
||||
|
||||
// LastStateRecalc returns when the last time crystallized state recalculated.
|
||||
|
@ -16,7 +16,7 @@ func ShuffleIndices(seed common.Hash, validatorList []int) ([]int, error) {
|
||||
return nil, errors.New("Validator count has exceeded MaxValidator Count")
|
||||
}
|
||||
|
||||
hashSeed := blake2b.Sum256(seed[:])
|
||||
hashSeed := blake2b.Sum512(seed[:])
|
||||
validatorCount := len(validatorList)
|
||||
|
||||
// shuffle stops at the second to last index.
|
||||
|
@ -136,7 +136,10 @@ func (s *Service) fetchCrystallizedState(client pb.BeaconServiceClient) {
|
||||
log.Errorf("Could not marshal crystallized state proto: %v", err)
|
||||
continue
|
||||
}
|
||||
crystallizedStateHash := blake2b.Sum256(stateData)
|
||||
var crystallizedStateHash [32]byte
|
||||
h := blake2b.Sum512(stateData)
|
||||
copy(crystallizedStateHash[:], h[:32])
|
||||
|
||||
dynasty := crystallizedState.GetCurrentDynasty()
|
||||
|
||||
for i, validator := range crystallizedState.GetValidators() {
|
||||
|
Loading…
Reference in New Issue
Block a user