diff --git a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/altair/fork/ForkUpgradeTestExecutor.java b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/altair/fork/ForkUpgradeTestExecutor.java index ca3584bb4fa..5b718b1babb 100644 --- a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/altair/fork/ForkUpgradeTestExecutor.java +++ b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/altair/fork/ForkUpgradeTestExecutor.java @@ -29,6 +29,7 @@ import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.bellatrix.BeaconStateSchemaBellatrix; import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.capella.BeaconStateSchemaCapella; import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.deneb.BeaconStateSchemaDeneb; +import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.electra.BeaconStateSchemaElectra; import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.phase0.BeaconStateSchemaPhase0; import tech.pegasys.teku.spec.logic.common.forktransition.StateUpgrade; @@ -65,6 +66,10 @@ private void processUpgrade(final TestDefinition testDefinition, final SpecMiles BeaconStateSchemaDeneb.create( previousMilestoneSpecVersion.getConfig(), previousMilestoneSpecVersion.getSchemaDefinitions().getSchemaRegistry()); + case EIP7732 -> + BeaconStateSchemaElectra.create( + previousMilestoneSpecVersion.getConfig(), + previousMilestoneSpecVersion.getSchemaDefinitions().getSchemaRegistry()); default -> throw new IllegalStateException( "Unhandled fork upgrade for test " diff --git a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/altair/fork/TransitionTestExecutor.java b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/altair/fork/TransitionTestExecutor.java index 94bfc6711ed..aff8fe3a7c9 100644 --- a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/altair/fork/TransitionTestExecutor.java +++ b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/altair/fork/TransitionTestExecutor.java @@ -76,6 +76,14 @@ private void processUpgrade(final TestDefinition testDefinition, final MetaData .capellaBuilder(c -> c.capellaForkEpoch(UInt64.ZERO)) .denebBuilder(d -> d.denebForkEpoch(UInt64.ZERO)) .electraBuilder(e -> e.electraForkEpoch(forkEpoch)); + case EIP7732 -> + builder + .altairBuilder(a -> a.altairForkEpoch(UInt64.ZERO)) + .bellatrixBuilder(b -> b.bellatrixForkEpoch(UInt64.ZERO)) + .capellaBuilder(c -> c.capellaForkEpoch(UInt64.ZERO)) + .denebBuilder(d -> d.denebForkEpoch(UInt64.ZERO)) + .electraBuilder(e -> e.electraForkEpoch(UInt64.ZERO)) + .eip7732Builder(e -> e.eip7732ForkEpoch(forkEpoch)); default -> throw new IllegalStateException( "Unhandled fork transition for test " diff --git a/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/methods/BlobSidecarsByRangeListenerValidatingProxyTest.java b/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/methods/BlobSidecarsByRangeListenerValidatingProxyTest.java index b351fc0308a..1fa29ac698f 100644 --- a/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/methods/BlobSidecarsByRangeListenerValidatingProxyTest.java +++ b/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/methods/BlobSidecarsByRangeListenerValidatingProxyTest.java @@ -32,6 +32,7 @@ import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.kzg.KZG; import tech.pegasys.teku.networking.eth2.peers.Eth2Peer; +import tech.pegasys.teku.networking.eth2.rpc.beaconchain.methods.BlobSidecarsResponseInvalidResponseException.InvalidResponseType; import tech.pegasys.teku.networking.p2p.rpc.RpcResponseListener; import tech.pegasys.teku.spec.Spec; import tech.pegasys.teku.spec.TestSpecContext; @@ -68,6 +69,7 @@ void setUp(final SpecContext specContext) { case CAPELLA -> throw new IllegalArgumentException("Capella is an unsupported milestone"); case DENEB -> TestSpecFactory.createMinimalWithDenebForkEpoch(currentForkEpoch); case ELECTRA -> TestSpecFactory.createMinimalWithElectraForkEpoch(currentForkEpoch); + case EIP7732 -> TestSpecFactory.createMinimalWithEip7732ForkEpoch(currentForkEpoch); }; currentForkFirstSlot = spec.computeStartSlotAtEpoch(currentForkEpoch); dataStructureUtil = new DataStructureUtil(spec); @@ -95,10 +97,7 @@ void blobSidecarFailsKzgVerification() { assertThatThrownBy(result::get) .hasCauseExactlyInstanceOf(BlobSidecarsResponseInvalidResponseException.class); assertThatThrownBy(result::get) - .hasMessageContaining( - BlobSidecarsResponseInvalidResponseException.InvalidResponseType - .BLOB_SIDECAR_KZG_VERIFICATION_FAILED - .describe()); + .hasMessageContaining(InvalidResponseType.BLOB_SIDECAR_KZG_VERIFICATION_FAILED.describe()); } @TestTemplate @@ -120,9 +119,7 @@ void blobSidecarFailsInclusionProofVerification() { .hasCauseExactlyInstanceOf(BlobSidecarsResponseInvalidResponseException.class); assertThatThrownBy(result::get) .hasMessageContaining( - BlobSidecarsResponseInvalidResponseException.InvalidResponseType - .BLOB_SIDECAR_INCLUSION_PROOF_VERIFICATION_FAILED - .describe()); + InvalidResponseType.BLOB_SIDECAR_INCLUSION_PROOF_VERIFICATION_FAILED.describe()); } @TestTemplate @@ -142,10 +139,7 @@ void blobSidecarSlotSmallerThanFromSlot() { assertThatThrownBy(result::get) .hasCauseExactlyInstanceOf(BlobSidecarsResponseInvalidResponseException.class); assertThatThrownBy(result::get) - .hasMessageContaining( - BlobSidecarsResponseInvalidResponseException.InvalidResponseType - .BLOB_SIDECAR_SLOT_NOT_IN_RANGE - .describe()); + .hasMessageContaining(InvalidResponseType.BLOB_SIDECAR_SLOT_NOT_IN_RANGE.describe()); } @TestTemplate @@ -222,10 +216,7 @@ void blobSidecarSlotGreaterThanToSlot() { assertThatThrownBy(result::get) .hasCauseExactlyInstanceOf(BlobSidecarsResponseInvalidResponseException.class); assertThatThrownBy(result::get) - .hasMessageContaining( - BlobSidecarsResponseInvalidResponseException.InvalidResponseType - .BLOB_SIDECAR_SLOT_NOT_IN_RANGE - .describe()); + .hasMessageContaining(InvalidResponseType.BLOB_SIDECAR_SLOT_NOT_IN_RANGE.describe()); } @TestTemplate @@ -250,10 +241,7 @@ void blobSidecarParentRootDoesNotMatch() { assertThatThrownBy(result::get) .hasCauseExactlyInstanceOf(BlobSidecarsResponseInvalidResponseException.class); assertThatThrownBy(result::get) - .hasMessageContaining( - BlobSidecarsResponseInvalidResponseException.InvalidResponseType - .BLOB_SIDECAR_UNKNOWN_PARENT - .describe()); + .hasMessageContaining(InvalidResponseType.BLOB_SIDECAR_UNKNOWN_PARENT.describe()); } @TestTemplate @@ -285,10 +273,7 @@ void blobSidecarIndexIsGreaterOrEqualThanMaxBlobs() { assertThatThrownBy(result::get) .hasCauseExactlyInstanceOf(BlobSidecarsResponseInvalidResponseException.class); assertThatThrownBy(result::get) - .hasMessageContaining( - BlobSidecarsResponseInvalidResponseException.InvalidResponseType - .BLOB_SIDECAR_UNEXPECTED_INDEX - .describe()); + .hasMessageContaining(InvalidResponseType.BLOB_SIDECAR_UNEXPECTED_INDEX.describe()); } @TestTemplate @@ -314,10 +299,7 @@ void blobSidecarIndexIsInTheSameBlockButNotNext() { assertThatThrownBy(result::get) .hasCauseExactlyInstanceOf(BlobSidecarsResponseInvalidResponseException.class); assertThatThrownBy(result::get) - .hasMessageContaining( - BlobSidecarsResponseInvalidResponseException.InvalidResponseType - .BLOB_SIDECAR_UNEXPECTED_INDEX - .describe()); + .hasMessageContaining(InvalidResponseType.BLOB_SIDECAR_UNEXPECTED_INDEX.describe()); } @TestTemplate @@ -361,10 +343,7 @@ void firstBlobSidecarIndexIsINotZero() { assertThatThrownBy(result::get) .hasCauseExactlyInstanceOf(BlobSidecarsResponseInvalidResponseException.class); assertThatThrownBy(result::get) - .hasMessageContaining( - BlobSidecarsResponseInvalidResponseException.InvalidResponseType - .BLOB_SIDECAR_UNEXPECTED_INDEX - .describe()); + .hasMessageContaining(InvalidResponseType.BLOB_SIDECAR_UNEXPECTED_INDEX.describe()); } @TestTemplate @@ -391,10 +370,7 @@ void firstBlobSidecarIndexInNextBlockIsNotZero() { assertThatThrownBy(result::get) .hasCauseExactlyInstanceOf(BlobSidecarsResponseInvalidResponseException.class); assertThatThrownBy(result::get) - .hasMessageContaining( - BlobSidecarsResponseInvalidResponseException.InvalidResponseType - .BLOB_SIDECAR_UNEXPECTED_INDEX - .describe()); + .hasMessageContaining(InvalidResponseType.BLOB_SIDECAR_UNEXPECTED_INDEX.describe()); } @TestTemplate @@ -418,9 +394,6 @@ void blobSidecarUnexpectedSlot() { assertThatThrownBy(result::get) .hasCauseExactlyInstanceOf(BlobSidecarsResponseInvalidResponseException.class); assertThatThrownBy(result::get) - .hasMessageContaining( - BlobSidecarsResponseInvalidResponseException.InvalidResponseType - .BLOB_SIDECAR_UNEXPECTED_SLOT - .describe()); + .hasMessageContaining(InvalidResponseType.BLOB_SIDECAR_UNEXPECTED_SLOT.describe()); } } diff --git a/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/methods/BlobSidecarsByRangeMessageHandlerTest.java b/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/methods/BlobSidecarsByRangeMessageHandlerTest.java index 89c11a20986..2ffb2c52acd 100644 --- a/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/methods/BlobSidecarsByRangeMessageHandlerTest.java +++ b/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/methods/BlobSidecarsByRangeMessageHandlerTest.java @@ -44,15 +44,17 @@ import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.networking.eth2.peers.Eth2Peer; import tech.pegasys.teku.networking.eth2.peers.RequestApproval; +import tech.pegasys.teku.networking.eth2.peers.RequestApproval.RequestApprovalBuilder; import tech.pegasys.teku.networking.eth2.rpc.beaconchain.BeaconChainMethodIds; import tech.pegasys.teku.networking.eth2.rpc.core.ResponseCallback; import tech.pegasys.teku.networking.eth2.rpc.core.RpcException; +import tech.pegasys.teku.networking.eth2.rpc.core.RpcException.ResourceUnavailableException; import tech.pegasys.teku.networking.eth2.rpc.core.encodings.RpcEncoding; import tech.pegasys.teku.spec.Spec; import tech.pegasys.teku.spec.SpecMilestone; import tech.pegasys.teku.spec.TestSpecContext; import tech.pegasys.teku.spec.TestSpecFactory; -import tech.pegasys.teku.spec.TestSpecInvocationContextProvider; +import tech.pegasys.teku.spec.TestSpecInvocationContextProvider.SpecContext; import tech.pegasys.teku.spec.config.SpecConfigDeneb; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecar; import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock; @@ -68,7 +70,7 @@ public class BlobSidecarsByRangeMessageHandlerTest { private static final RequestApproval ZERO_OBJECTS_REQUEST_APPROVAL = - new RequestApproval.RequestApprovalBuilder().timeSeconds(ZERO).objectsCount(0).build(); + new RequestApprovalBuilder().timeSeconds(ZERO).objectsCount(0).build(); private static final RpcEncoding RPC_ENCODING = RpcEncoding.createSszSnappyEncoding( TestSpecFactory.createDefault().getNetworkingConfig().getMaxChunkSize()); @@ -87,8 +89,7 @@ public class BlobSidecarsByRangeMessageHandlerTest { private final String protocolId = BeaconChainMethodIds.getBlobSidecarsByRangeMethodId(1, RPC_ENCODING); private final Optional allowedObjectsRequest = - Optional.of( - new RequestApproval.RequestApprovalBuilder().objectsCount(100).timeSeconds(ZERO).build()); + Optional.of(new RequestApprovalBuilder().objectsCount(100).timeSeconds(ZERO).build()); private SpecMilestone specMilestone; private Spec spec; @@ -99,7 +100,7 @@ public class BlobSidecarsByRangeMessageHandlerTest { private UInt64 startSlot; @BeforeEach - public void setUp(final TestSpecInvocationContextProvider.SpecContext specContext) { + public void setUp(final SpecContext specContext) { specMilestone = specContext.getSpecMilestone(); spec = switch (specContext.getSpecMilestone()) { @@ -110,6 +111,7 @@ public void setUp(final TestSpecInvocationContextProvider.SpecContext specContex case CAPELLA -> throw new IllegalArgumentException("Capella is an unsupported milestone"); case DENEB -> TestSpecFactory.createMinimalWithDenebForkEpoch(currentForkEpoch); case ELECTRA -> TestSpecFactory.createMinimalWithElectraForkEpoch(currentForkEpoch); + case EIP7732 -> TestSpecFactory.createMinimalWithEip7732ForkEpoch(currentForkEpoch); }; dataStructureUtil = new DataStructureUtil(spec); @@ -231,8 +233,7 @@ public void shouldSendResourceUnavailableIfBlobSidecarsAreNotAvailable() { // available from epoch 5010 verify(listener) .completeWithErrorResponse( - new RpcException.ResourceUnavailableException( - "Requested blob sidecars are not available.")); + new ResourceUnavailableException("Requested blob sidecars are not available.")); } @TestTemplate diff --git a/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/methods/BlobSidecarsByRootListenerValidatingProxyTest.java b/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/methods/BlobSidecarsByRootListenerValidatingProxyTest.java index fee98545ed5..6ce7bd642a2 100644 --- a/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/methods/BlobSidecarsByRootListenerValidatingProxyTest.java +++ b/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/methods/BlobSidecarsByRootListenerValidatingProxyTest.java @@ -30,11 +30,12 @@ import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.kzg.KZG; import tech.pegasys.teku.networking.eth2.peers.Eth2Peer; +import tech.pegasys.teku.networking.eth2.rpc.beaconchain.methods.BlobSidecarsResponseInvalidResponseException.InvalidResponseType; import tech.pegasys.teku.networking.p2p.rpc.RpcResponseListener; import tech.pegasys.teku.spec.Spec; import tech.pegasys.teku.spec.TestSpecContext; import tech.pegasys.teku.spec.TestSpecFactory; -import tech.pegasys.teku.spec.TestSpecInvocationContextProvider; +import tech.pegasys.teku.spec.TestSpecInvocationContextProvider.SpecContext; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecar; import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock; import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.BlobIdentifier; @@ -57,7 +58,7 @@ public class BlobSidecarsByRootListenerValidatingProxyTest { private BlobSidecarsByRootListenerValidatingProxy listenerWrapper; @BeforeEach - void setUp(final TestSpecInvocationContextProvider.SpecContext specContext) { + void setUp(final SpecContext specContext) { spec = switch (specContext.getSpecMilestone()) { case PHASE0 -> throw new IllegalArgumentException("Phase0 is an unsupported milestone"); @@ -67,6 +68,7 @@ void setUp(final TestSpecInvocationContextProvider.SpecContext specContext) { case CAPELLA -> throw new IllegalArgumentException("Capella is an unsupported milestone"); case DENEB -> TestSpecFactory.createMinimalWithDenebForkEpoch(currentForkEpoch); case ELECTRA -> TestSpecFactory.createMinimalWithElectraForkEpoch(currentForkEpoch); + case EIP7732 -> TestSpecFactory.createMinimalWithEip7732ForkEpoch(currentForkEpoch); }; dataStructureUtil = new DataStructureUtil(spec); currentForkFirstSlot = spec.computeStartSlotAtEpoch(currentForkEpoch); @@ -140,10 +142,7 @@ void blobSidecarIdentifierNotRequested() { assertThatThrownBy(result::get) .hasCauseExactlyInstanceOf(BlobSidecarsResponseInvalidResponseException.class); assertThatThrownBy(result::get) - .hasMessageContaining( - BlobSidecarsResponseInvalidResponseException.InvalidResponseType - .BLOB_SIDECAR_UNEXPECTED_IDENTIFIER - .describe()); + .hasMessageContaining(InvalidResponseType.BLOB_SIDECAR_UNEXPECTED_IDENTIFIER.describe()); } @TestTemplate @@ -166,10 +165,7 @@ void blobSidecarFailsKzgVerification() { assertThatThrownBy(result::get) .hasCauseExactlyInstanceOf(BlobSidecarsResponseInvalidResponseException.class); assertThatThrownBy(result::get) - .hasMessageContaining( - BlobSidecarsResponseInvalidResponseException.InvalidResponseType - .BLOB_SIDECAR_KZG_VERIFICATION_FAILED - .describe()); + .hasMessageContaining(InvalidResponseType.BLOB_SIDECAR_KZG_VERIFICATION_FAILED.describe()); } @TestTemplate @@ -193,8 +189,6 @@ void blobSidecarFailsInclusionProofVerification() { .hasCauseExactlyInstanceOf(BlobSidecarsResponseInvalidResponseException.class); assertThatThrownBy(result::get) .hasMessageContaining( - BlobSidecarsResponseInvalidResponseException.InvalidResponseType - .BLOB_SIDECAR_INCLUSION_PROOF_VERIFICATION_FAILED - .describe()); + InvalidResponseType.BLOB_SIDECAR_INCLUSION_PROOF_VERIFICATION_FAILED.describe()); } } diff --git a/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/methods/BlobSidecarsByRootMessageHandlerTest.java b/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/methods/BlobSidecarsByRootMessageHandlerTest.java index 8374d9ab8d6..5204f35f50a 100644 --- a/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/methods/BlobSidecarsByRootMessageHandlerTest.java +++ b/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/methods/BlobSidecarsByRootMessageHandlerTest.java @@ -40,6 +40,7 @@ import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.networking.eth2.peers.Eth2Peer; import tech.pegasys.teku.networking.eth2.peers.RequestApproval; +import tech.pegasys.teku.networking.eth2.peers.RequestApproval.RequestApprovalBuilder; import tech.pegasys.teku.networking.eth2.rpc.beaconchain.BeaconChainMethodIds; import tech.pegasys.teku.networking.eth2.rpc.core.ResponseCallback; import tech.pegasys.teku.networking.eth2.rpc.core.RpcException; @@ -48,7 +49,7 @@ import tech.pegasys.teku.spec.SpecMilestone; import tech.pegasys.teku.spec.TestSpecContext; import tech.pegasys.teku.spec.TestSpecFactory; -import tech.pegasys.teku.spec.TestSpecInvocationContextProvider; +import tech.pegasys.teku.spec.TestSpecInvocationContextProvider.SpecContext; import tech.pegasys.teku.spec.config.SpecConfigDeneb; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecar; import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock; @@ -71,8 +72,7 @@ public class BlobSidecarsByRootMessageHandlerTest { private final ArgumentCaptor rpcExceptionCaptor = ArgumentCaptor.forClass(RpcException.class); private final Optional allowedObjectsRequest = - Optional.of( - new RequestApproval.RequestApprovalBuilder().objectsCount(100).timeSeconds(ZERO).build()); + Optional.of(new RequestApprovalBuilder().objectsCount(100).timeSeconds(ZERO).build()); @SuppressWarnings("unchecked") private final ResponseCallback callback = mock(ResponseCallback.class); @@ -91,7 +91,7 @@ public class BlobSidecarsByRootMessageHandlerTest { private Spec spec; @BeforeEach - public void setup(final TestSpecInvocationContextProvider.SpecContext specContext) { + public void setup(final SpecContext specContext) { specMilestone = specContext.getSpecMilestone(); spec = switch (specContext.getSpecMilestone()) { @@ -102,6 +102,7 @@ public void setup(final TestSpecInvocationContextProvider.SpecContext specContex case CAPELLA -> throw new IllegalArgumentException("Capella is an unsupported milestone"); case DENEB -> TestSpecFactory.createMinimalWithDenebForkEpoch(currentForkEpoch); case ELECTRA -> TestSpecFactory.createMinimalWithElectraForkEpoch(currentForkEpoch); + case EIP7732 -> TestSpecFactory.createMinimalWithEip7732ForkEpoch(currentForkEpoch); }; dataStructureUtil = new DataStructureUtil(spec); messageSchema = diff --git a/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/methods/BlobSidecarsByRootValidatorTest.java b/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/methods/BlobSidecarsByRootValidatorTest.java index b176a7a8f11..a5deff375a9 100644 --- a/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/methods/BlobSidecarsByRootValidatorTest.java +++ b/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/rpc/beaconchain/methods/BlobSidecarsByRootValidatorTest.java @@ -28,10 +28,11 @@ import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.kzg.KZG; import tech.pegasys.teku.networking.eth2.peers.Eth2Peer; +import tech.pegasys.teku.networking.eth2.rpc.beaconchain.methods.BlobSidecarsResponseInvalidResponseException.InvalidResponseType; import tech.pegasys.teku.spec.Spec; import tech.pegasys.teku.spec.TestSpecContext; import tech.pegasys.teku.spec.TestSpecFactory; -import tech.pegasys.teku.spec.TestSpecInvocationContextProvider; +import tech.pegasys.teku.spec.TestSpecInvocationContextProvider.SpecContext; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecar; import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock; import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.BlobIdentifier; @@ -50,7 +51,7 @@ public class BlobSidecarsByRootValidatorTest { private UInt64 currentForkFirstSlot; @BeforeEach - void setUp(final TestSpecInvocationContextProvider.SpecContext specContext) { + void setUp(final SpecContext specContext) { spec = switch (specContext.getSpecMilestone()) { case PHASE0 -> throw new IllegalArgumentException("Phase0 is an unsupported milestone"); @@ -60,6 +61,7 @@ void setUp(final TestSpecInvocationContextProvider.SpecContext specContext) { case CAPELLA -> throw new IllegalArgumentException("Capella is an unsupported milestone"); case DENEB -> TestSpecFactory.createMinimalWithDenebForkEpoch(currentForkEpoch); case ELECTRA -> TestSpecFactory.createMinimalWithElectraForkEpoch(currentForkEpoch); + case EIP7732 -> TestSpecFactory.createMinimalWithEip7732ForkEpoch(currentForkEpoch); }; currentForkFirstSlot = spec.computeStartSlotAtEpoch(currentForkEpoch); dataStructureUtil = new DataStructureUtil(spec); @@ -90,10 +92,7 @@ void blobSidecarIdentifierNotRequested() { validator = new BlobSidecarsByRootValidator(peer, spec, kzg, List.of(blobIdentifier2_0)); assertThatThrownBy(() -> validator.validate(blobSidecar1_0)) .isExactlyInstanceOf(BlobSidecarsResponseInvalidResponseException.class) - .hasMessageContaining( - BlobSidecarsResponseInvalidResponseException.InvalidResponseType - .BLOB_SIDECAR_UNEXPECTED_IDENTIFIER - .describe()); + .hasMessageContaining(InvalidResponseType.BLOB_SIDECAR_UNEXPECTED_IDENTIFIER.describe()); } @TestTemplate @@ -108,10 +107,7 @@ void blobSidecarFailsKzgVerification() { validator = new BlobSidecarsByRootValidator(peer, spec, kzg, List.of(blobIdentifier1_0)); assertThatThrownBy(() -> validator.validate(blobSidecar1_0)) .isExactlyInstanceOf(BlobSidecarsResponseInvalidResponseException.class) - .hasMessageContaining( - BlobSidecarsResponseInvalidResponseException.InvalidResponseType - .BLOB_SIDECAR_KZG_VERIFICATION_FAILED - .describe()); + .hasMessageContaining(InvalidResponseType.BLOB_SIDECAR_KZG_VERIFICATION_FAILED.describe()); } @TestTemplate @@ -127,9 +123,7 @@ void blobSidecarFailsInclusionProofVerification() { assertThatThrownBy(() -> validator.validate(blobSidecar1_0_modified)) .isExactlyInstanceOf(BlobSidecarsResponseInvalidResponseException.class) .hasMessageContaining( - BlobSidecarsResponseInvalidResponseException.InvalidResponseType - .BLOB_SIDECAR_INCLUSION_PROOF_VERIFICATION_FAILED - .describe()); + InvalidResponseType.BLOB_SIDECAR_INCLUSION_PROOF_VERIFICATION_FAILED.describe()); } @TestTemplate @@ -144,10 +138,7 @@ void blobSidecarResponseWithDuplicateSidecar() { assertDoesNotThrow(() -> validator.validate(blobSidecar1_0)); assertThatThrownBy(() -> validator.validate(blobSidecar1_0)) .isExactlyInstanceOf(BlobSidecarsResponseInvalidResponseException.class) - .hasMessageContaining( - BlobSidecarsResponseInvalidResponseException.InvalidResponseType - .BLOB_SIDECAR_UNEXPECTED_IDENTIFIER - .describe()); + .hasMessageContaining(InvalidResponseType.BLOB_SIDECAR_UNEXPECTED_IDENTIFIER.describe()); } public static BlobSidecar breakInclusionProof(final BlobSidecar blobSidecar) {