diff --git a/beacon-chain/core/blocks/block_operations.go b/beacon-chain/core/blocks/block_operations.go index aff03b829..2b6863685 100644 --- a/beacon-chain/core/blocks/block_operations.go +++ b/beacon-chain/core/blocks/block_operations.go @@ -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 diff --git a/beacon-chain/core/blocks/block_operations_test.go b/beacon-chain/core/blocks/block_operations_test.go index 11bfa59e9..6edfe248f 100644 --- a/beacon-chain/core/blocks/block_operations_test.go +++ b/beacon-chain/core/blocks/block_operations_test.go @@ -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, diff --git a/beacon-chain/core/state/state.go b/beacon-chain/core/state/state.go index 1f85929d7..2df50ea45 100644 --- a/beacon-chain/core/state/state.go +++ b/beacon-chain/core/state/state.go @@ -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[:]