mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-27 21:57:16 +00:00
parent
3144c36164
commit
5ab93dfabb
@ -20,6 +20,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/bls"
|
||||
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/forkutils"
|
||||
"github.com/prysmaticlabs/prysm/shared/hashutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"github.com/prysmaticlabs/prysm/shared/trieutil"
|
||||
)
|
||||
@ -94,7 +95,8 @@ func ProcessBlockRandao(beaconState *pb.BeaconState, block *pb.BeaconBlock, veri
|
||||
latestMixesLength := params.BeaconConfig().LatestRandaoMixesLength
|
||||
currentEpoch := helpers.CurrentEpoch(beaconState)
|
||||
latestMixSlice := beaconState.LatestRandaoMixes[currentEpoch%latestMixesLength]
|
||||
for i, x := range block.RandaoReveal {
|
||||
blockRandaoReveal := hashutil.Hash(block.RandaoReveal)
|
||||
for i, x := range blockRandaoReveal {
|
||||
latestMixSlice[i] ^= x
|
||||
}
|
||||
beaconState.LatestRandaoMixes[currentEpoch%latestMixesLength] = latestMixSlice
|
||||
|
@ -106,7 +106,8 @@ func TestProcessBlockRandao_SignatureVerifiesAndUpdatesLatestStateMixes(t *testi
|
||||
}
|
||||
currentEpoch := helpers.CurrentEpoch(beaconState)
|
||||
mix := newState.LatestRandaoMixes[currentEpoch%params.BeaconConfig().LatestRandaoMixesLength]
|
||||
if bytes.Equal(mix, params.BeaconConfig().EmptySignature[:]) {
|
||||
|
||||
if bytes.Equal(mix, params.BeaconConfig().ZeroHash[:]) {
|
||||
t.Errorf(
|
||||
"Expected empty signature to be overwritten by randao reveal, received %v",
|
||||
params.BeaconConfig().EmptySignature,
|
||||
|
@ -28,8 +28,7 @@ func GenesisBeaconState(
|
||||
params.BeaconConfig().LatestRandaoMixesLength,
|
||||
)
|
||||
for i := 0; i < len(latestRandaoMixes); i++ {
|
||||
emptySig := params.BeaconConfig().EmptySignature
|
||||
latestRandaoMixes[i] = emptySig[:]
|
||||
latestRandaoMixes[i] = make([]byte, 32)
|
||||
}
|
||||
|
||||
zeroHash := params.BeaconConfig().ZeroHash[:]
|
||||
|
Loading…
Reference in New Issue
Block a user