From 34f28a31b13dda0c1d9642fdcb40757d3eefddff Mon Sep 17 00:00:00 2001 From: terence tsao Date: Sun, 10 May 2020 20:45:31 -0700 Subject: [PATCH] No magic number for `BlockBodyRoot` (#5803) * `GetValidatorPerformance` return `Unavailable` when syncing * Use proper config values for BlockBodyRoot Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> --- beacon-chain/state/stateutil/blocks.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/beacon-chain/state/stateutil/blocks.go b/beacon-chain/state/stateutil/blocks.go index 482976739..3dd976cab 100644 --- a/beacon-chain/state/stateutil/blocks.go +++ b/beacon-chain/state/stateutil/blocks.go @@ -91,12 +91,12 @@ func BlockBodyRoot(body *ethpb.BeaconBlockBody) ([32]byte, error) { graffitiRoot := bytesutil.ToBytes32(body.Graffiti) fieldRoots[2] = graffitiRoot - proposerSlashingsRoot, err := ssz.HashTreeRootWithCapacity(body.ProposerSlashings, 16) + proposerSlashingsRoot, err := ssz.HashTreeRootWithCapacity(body.ProposerSlashings, params.BeaconConfig().MaxProposerSlashings) if err != nil { return [32]byte{}, err } fieldRoots[3] = proposerSlashingsRoot - attesterSlashingsRoot, err := ssz.HashTreeRootWithCapacity(body.AttesterSlashings, 1) + attesterSlashingsRoot, err := ssz.HashTreeRootWithCapacity(body.AttesterSlashings, params.BeaconConfig().MaxAttesterSlashings) if err != nil { return [32]byte{}, err } @@ -107,13 +107,13 @@ func BlockBodyRoot(body *ethpb.BeaconBlockBody) ([32]byte, error) { } fieldRoots[5] = attsRoot - depositRoot, err := ssz.HashTreeRootWithCapacity(body.Deposits, 16) + depositRoot, err := ssz.HashTreeRootWithCapacity(body.Deposits, params.BeaconConfig().MaxDeposits) if err != nil { return [32]byte{}, err } fieldRoots[6] = depositRoot - exitRoot, err := ssz.HashTreeRootWithCapacity(body.VoluntaryExits, 16) + exitRoot, err := ssz.HashTreeRootWithCapacity(body.VoluntaryExits, params.BeaconConfig().MaxVoluntaryExits) if err != nil { return [32]byte{}, err }