2021-07-27 15:47:03 +00:00
|
|
|
package v2
|
|
|
|
|
|
|
|
import (
|
2021-09-23 01:10:25 +00:00
|
|
|
"context"
|
2021-07-27 15:47:03 +00:00
|
|
|
|
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/state/stateutil"
|
2021-09-15 01:18:39 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/config/features"
|
2021-07-29 21:45:17 +00:00
|
|
|
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
2021-07-27 15:47:03 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// computeFieldRoots returns the hash tree root computations of every field in
|
|
|
|
// the beacon state as a list of 32 byte roots.
|
2021-09-23 01:10:25 +00:00
|
|
|
func computeFieldRoots(ctx context.Context, state *ethpb.BeaconStateAltair) ([][]byte, error) {
|
2021-09-15 01:18:39 +00:00
|
|
|
if features.Get().EnableSSZCache {
|
2021-11-29 16:30:17 +00:00
|
|
|
return stateutil.CachedHasher.ComputeFieldRootsWithHasherAltair(ctx, state)
|
2021-07-27 15:47:03 +00:00
|
|
|
}
|
2021-11-29 16:30:17 +00:00
|
|
|
return stateutil.NocachedHasher.ComputeFieldRootsWithHasherAltair(ctx, state)
|
2021-07-27 15:47:03 +00:00
|
|
|
}
|