From 9f00f4113a7aa9e4ac471c11b3403442a6458cd0 Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Fri, 27 Oct 2023 16:46:31 +0100 Subject: [PATCH] try to speed build --- .../spec/executionlayer/ExecutionLayerChannelStub.java | 8 +++++++- .../spec/logic/versions/deneb/helpers/KzgResolver.java | 2 +- .../tech/pegasys/teku/spec/generator/ChainBuilder.java | 10 +--------- .../kzg/src/main/java/tech/pegasys/teku/kzg/KZG.java | 4 +++- .../services/beaconchain/BeaconChainController.java | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/executionlayer/ExecutionLayerChannelStub.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/executionlayer/ExecutionLayerChannelStub.java index e2afbebe165..92a44ec3ffd 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/executionlayer/ExecutionLayerChannelStub.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/executionlayer/ExecutionLayerChannelStub.java @@ -108,7 +108,13 @@ public ExecutionLayerChannelStub( this.transitionEmulationEnabled = enableTransitionEmulation; this.terminalBlockHashInTTDMode = terminalBlockHashInTTDMode.orElse(Bytes32.fromHexStringLenient("0x01")); - this.blobsUtil = new BlobsUtil(spec, KZG.INSTANCE); + final KZG kzg; + if (spec.isMilestoneSupported(SpecMilestone.DENEB)) { + kzg = KZG.getInstance(); + } else { + kzg = KZG.NOOP; + } + this.blobsUtil = new BlobsUtil(spec, kzg); } public ExecutionLayerChannelStub( diff --git a/ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/logic/versions/deneb/helpers/KzgResolver.java b/ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/logic/versions/deneb/helpers/KzgResolver.java index 14b75b00b1a..d14e7ba6db4 100644 --- a/ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/logic/versions/deneb/helpers/KzgResolver.java +++ b/ethereum/spec/src/property-test/java/tech/pegasys/teku/spec/logic/versions/deneb/helpers/KzgResolver.java @@ -51,7 +51,7 @@ private KZG getKzgWithTrustedSetup() { private static class KzgAutoLoadFree implements Store.CloseOnReset { - private final KZG kzg = KZG.INSTANCE; + private final KZG kzg = KZG.getInstance(); private KzgAutoLoadFree() { TrustedSetupLoader.loadTrustedSetupForTests(kzg); diff --git a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/generator/ChainBuilder.java b/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/generator/ChainBuilder.java index d37b43a81b9..839cb1f603f 100644 --- a/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/generator/ChainBuilder.java +++ b/ethereum/spec/src/testFixtures/java/tech/pegasys/teku/spec/generator/ChainBuilder.java @@ -44,7 +44,6 @@ import tech.pegasys.teku.kzg.KZG; import tech.pegasys.teku.kzg.KZGCommitment; import tech.pegasys.teku.kzg.KZGProof; -import tech.pegasys.teku.kzg.trusted_setups.TrustedSetupLoader; import tech.pegasys.teku.spec.Spec; import tech.pegasys.teku.spec.SpecMilestone; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.Blob; @@ -108,14 +107,7 @@ private ChainBuilder( final Optional maybeEarliestBlobSidecarSlot) { this.spec = spec; this.validatorKeys = validatorKeys; - final KZG kzg; - if (spec.isMilestoneSupported(SpecMilestone.DENEB)) { - kzg = KZG.INSTANCE; - TrustedSetupLoader.loadTrustedSetupForTests(kzg); - } else { - kzg = KZG.NOOP; - } - blobsUtil = new BlobsUtil(spec, kzg); + blobsUtil = new BlobsUtil(spec, KZG.NOOP); attestationGenerator = new AttestationGenerator(spec, validatorKeys); attesterSlashingGenerator = new AttesterSlashingGenerator(spec, validatorKeys); blockProposalTestUtil = new BlockProposalTestUtil(spec); diff --git a/infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/KZG.java b/infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/KZG.java index cbf909d3cd4..eacb60e4089 100644 --- a/infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/KZG.java +++ b/infrastructure/kzg/src/main/java/tech/pegasys/teku/kzg/KZG.java @@ -22,7 +22,9 @@ */ public interface KZG { - KZG INSTANCE = CKZG4844.getInstance(); + static KZG getInstance() { + return CKZG4844.getInstance(); + } KZG NOOP = new KZG() { diff --git a/services/beaconchain/src/main/java/tech/pegasys/teku/services/beaconchain/BeaconChainController.java b/services/beaconchain/src/main/java/tech/pegasys/teku/services/beaconchain/BeaconChainController.java index d7773c50be9..0334a6e895e 100644 --- a/services/beaconchain/src/main/java/tech/pegasys/teku/services/beaconchain/BeaconChainController.java +++ b/services/beaconchain/src/main/java/tech/pegasys/teku/services/beaconchain/BeaconChainController.java @@ -473,7 +473,7 @@ protected void initExecutionLayer() { protected void initKzg() { if (spec.isMilestoneSupported(SpecMilestone.DENEB)) { - kzg = KZG.INSTANCE; + kzg = KZG.getInstance(); final String trustedSetupFile = beaconConfig .eth2NetworkConfig()