diff --git a/beacon-chain/blockchain/service.go b/beacon-chain/blockchain/service.go index f7bef4a0752f..7b1cddc397e3 100644 --- a/beacon-chain/blockchain/service.go +++ b/beacon-chain/blockchain/service.go @@ -103,9 +103,12 @@ type blobNotifier struct { // NewService instantiates a new block service instance that will // be registered into a running beacon node. func NewService(ctx context.Context, opts ...Option) (*Service, error) { - err := kzg.Start() - if err != nil { - return nil, errors.Wrap(err, "could not initialize go-kzg context") + var err error + if params.DenebEnabled() { + err = kzg.Start() + if err != nil { + return nil, errors.Wrap(err, "could not initialize go-kzg context") + } } ctx, cancel := context.WithCancel(ctx) bn := &blobNotifier{ diff --git a/config/params/config.go b/config/params/config.go index 925d62ffdd2e..4a9279c8cbff 100644 --- a/config/params/config.go +++ b/config/params/config.go @@ -2,6 +2,7 @@ package params import ( + "math" "time" "github.com/ethereum/go-ethereum/common" @@ -275,3 +276,10 @@ func (b *BeaconChainConfig) PreviousEpochAttestationsLength() uint64 { func (b *BeaconChainConfig) CurrentEpochAttestationsLength() uint64 { return uint64(b.SlotsPerEpoch.Mul(b.MaxAttestations)) } + +// DenebEnabled centralizes the check to determine if code paths +// that are specific to deneb should be allowed to execute. This will make it easier to find call sites that do this +// kind of check and remove them post-deneb. +func DenebEnabled() bool { + return BeaconConfig().DenebForkEpoch < math.MaxUint64 +}