From 75aaa5e07bde2667b6f2f81cff56b876272e8216 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 3 Jun 2020 11:26:07 -0500 Subject: [PATCH] fix bad root (#6096) --- beacon-chain/state/stateutil/blocks.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/beacon-chain/state/stateutil/blocks.go b/beacon-chain/state/stateutil/blocks.go index 3dd976cab..b7f94d1f2 100644 --- a/beacon-chain/state/stateutil/blocks.go +++ b/beacon-chain/state/stateutil/blocks.go @@ -67,7 +67,22 @@ func BlockBodyRoot(body *ethpb.BeaconBlockBody) ([32]byte, error) { if body == nil { // Treat nil body to be the same as empty. This is mostly for test setup purposes and would // be very unlikely to happen in production workflow. - return [32]byte{117, 149, 118, 243, 29, 85, 147, 152, 201, 11, 234, 19, 146, 229, 35, 209, 93, 246, 109, 242, 141, 181, 176, 126, 79, 196, 1, 189, 124, 203, 199, 62}, nil + emptyRoot := make([]byte, 32) + emptyRandao := make([]byte, 96) + body = ðpb.BeaconBlockBody{ + RandaoReveal: emptyRandao, + Eth1Data: ðpb.Eth1Data{ + DepositRoot: emptyRoot, + DepositCount: 0, + BlockHash: emptyRoot, + }, + Graffiti: emptyRoot, + ProposerSlashings: make([]*ethpb.ProposerSlashing, 0), + AttesterSlashings: make([]*ethpb.AttesterSlashing, 0), + Attestations: make([]*ethpb.Attestation, 0), + Deposits: make([]*ethpb.Deposit, 0), + VoluntaryExits: make([]*ethpb.SignedVoluntaryExit, 0), + } } hasher := hashutil.CustomSHA256Hasher() fieldRoots := make([][32]byte, 8)