From de0930563d1eb0bc41497e8ee5ac141da3ae887f Mon Sep 17 00:00:00 2001 From: Jason Frame Date: Wed, 10 Jan 2024 09:55:52 +1000 Subject: [PATCH 1/4] update teku to get deneb testnet config --- gradle/versions.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/versions.gradle b/gradle/versions.gradle index 274a930be..c36dd089e 100644 --- a/gradle/versions.gradle +++ b/gradle/versions.gradle @@ -90,7 +90,7 @@ dependencyManagement { dependency 'org.xipki.iaik:sunpkcs11-wrapper:1.4.10' - dependencySet(group: 'tech.pegasys.teku.internal', version: '23.10.0') { + dependencySet(group: 'tech.pegasys.teku.internal', version: '24.1.0') { entry ('bls') { exclude group: 'org.bouncycastle', name: 'bcprov-jdk15on' } From 4cc6e1a6e94590a0c7f627f9f4b8f77a4df0fdc6 Mon Sep 17 00:00:00 2001 From: Jason Frame Date: Wed, 10 Jan 2024 10:22:21 +1000 Subject: [PATCH 2/4] remove blob signing and kzg types --- .../dsl/utils/DataStructureUtilAdapter.java | 4 - .../dsl/utils/Eth2RequestUtils.java | 27 ------ .../utils/Eth2SigningRequestBodyBuilder.java | 10 +-- .../BlsBlobSidecarSigningAcceptanceTest.java | 68 --------------- .../signing/BlsSigningAcceptanceTest.java | 7 +- .../Eth2CustomNetworkFileAcceptanceTest.java | 6 +- .../subcommands/Eth2SubCommand.java | 2 +- .../core/service/http/ArtifactType.java | 3 +- .../http/SigningObjectMapperFactory.java | 11 --- .../handlers/signing/eth2/BlobSidecar.java | 68 --------------- .../eth2/Eth2SignForIdentifierHandler.java | 7 -- .../signing/eth2/Eth2SigningRequestBody.java | 3 +- .../http/handlers/signing/eth2/KZGProof.java | 86 ------------------- .../eth2/json/KZGProofDeserializer.java | 30 ------- .../signing/eth2/json/KZGProofSerializer.java | 31 ------- 15 files changed, 7 insertions(+), 356 deletions(-) delete mode 100644 acceptance-tests/src/test/java/tech/pegasys/web3signer/tests/signing/BlsBlobSidecarSigningAcceptanceTest.java delete mode 100644 core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/BlobSidecar.java delete mode 100644 core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/KZGProof.java delete mode 100644 core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/json/KZGProofDeserializer.java delete mode 100644 core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/json/KZGProofSerializer.java diff --git a/acceptance-tests/src/test/java/tech/pegasys/web3signer/dsl/utils/DataStructureUtilAdapter.java b/acceptance-tests/src/test/java/tech/pegasys/web3signer/dsl/utils/DataStructureUtilAdapter.java index 8b181171a..b6d431f89 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/web3signer/dsl/utils/DataStructureUtilAdapter.java +++ b/acceptance-tests/src/test/java/tech/pegasys/web3signer/dsl/utils/DataStructureUtilAdapter.java @@ -104,10 +104,6 @@ private BeaconBlockBody randomBeaconBlockBody(final UInt64 slotNum) { builder.blsToExecutionChanges( randomSignedBlsToExecutionChangesList(spec.atSlot(slotNum))); } - if (builder.supportsKzgCommitments()) { - builder.blobKzgCommitments( - SafeFuture.completedFuture(util.randomSszKzgCommitmentList())); - } }) .join(); } diff --git a/acceptance-tests/src/test/java/tech/pegasys/web3signer/dsl/utils/Eth2RequestUtils.java b/acceptance-tests/src/test/java/tech/pegasys/web3signer/dsl/utils/Eth2RequestUtils.java index f2e44ca2b..42f04ee7a 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/web3signer/dsl/utils/Eth2RequestUtils.java +++ b/acceptance-tests/src/test/java/tech/pegasys/web3signer/dsl/utils/Eth2RequestUtils.java @@ -13,7 +13,6 @@ package tech.pegasys.web3signer.dsl.utils; import static java.util.Collections.emptyList; -import static tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.BlobSidecar.fromInternalBlobSidecar; import static tech.pegasys.web3signer.core.util.DepositSigningRootUtil.computeDomain; import tech.pegasys.teku.api.schema.AggregateAndProof; @@ -34,7 +33,6 @@ import tech.pegasys.teku.spec.SpecMilestone; import tech.pegasys.teku.spec.TestSpecFactory; import tech.pegasys.teku.spec.constants.Domain; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecar; import tech.pegasys.teku.spec.datastructures.operations.versions.altair.ContributionAndProof; import tech.pegasys.teku.spec.datastructures.operations.versions.altair.SyncAggregatorSelectionData; import tech.pegasys.teku.spec.datastructures.operations.versions.altair.SyncCommitteeContribution; @@ -115,8 +113,6 @@ public static Eth2SigningRequestBody createCannedRequest(final ArtifactType arti return createSyncCommitteeContributionAndProofRequest(); case VALIDATOR_REGISTRATION: return createValidatorRegistrationRequest(); - case BLOB_SIDECAR: - return createBlobSidecarRequest(); default: throw new IllegalStateException("Unknown eth2 signing type"); } @@ -424,27 +420,4 @@ private static SafeFuture signingRootFromSyncCommitteeUtils( return SafeFuture.of( () -> createSigningRoot.apply(ALTAIR_SPEC.getSyncCommitteeUtilRequired(slot))); } - - public static Eth2SigningRequestBody createBlobSidecarRequest() { - final Spec spec = TestSpecFactory.createMinimal(SpecMilestone.DENEB); - final tech.pegasys.teku.spec.datastructures.state.ForkInfo tekuForkInfo = - Eth2RequestUtils.forkInfo().asInternalForkInfo(); - final Fork tekuFork = new Fork(tekuForkInfo.getFork()); - final tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.ForkInfo forkInfo = - new tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.ForkInfo( - tekuFork, tekuForkInfo.getGenesisValidatorsRoot()); - final Bytes signingRoot; - - // generate random blobsidecar - final BlobSidecar tekuBlobSidecar = new DataStructureUtil(spec).randomBlobSidecar(); - signingRoot = - new SigningRootUtil(spec).signingRootForBlobSidecar(tekuBlobSidecar, tekuForkInfo); - - return Eth2SigningRequestBodyBuilder.anEth2SigningRequestBody() - .withType(ArtifactType.BLOB_SIDECAR) - .withSigningRoot(signingRoot) - .withForkInfo(forkInfo) - .withBlobSidecar(fromInternalBlobSidecar(tekuBlobSidecar)) - .build(); - } } diff --git a/acceptance-tests/src/test/java/tech/pegasys/web3signer/dsl/utils/Eth2SigningRequestBodyBuilder.java b/acceptance-tests/src/test/java/tech/pegasys/web3signer/dsl/utils/Eth2SigningRequestBodyBuilder.java index 7c86c2703..072a863b4 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/web3signer/dsl/utils/Eth2SigningRequestBodyBuilder.java +++ b/acceptance-tests/src/test/java/tech/pegasys/web3signer/dsl/utils/Eth2SigningRequestBodyBuilder.java @@ -19,7 +19,6 @@ import tech.pegasys.teku.api.schema.altair.ContributionAndProof; import tech.pegasys.web3signer.core.service.http.ArtifactType; import tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.AggregationSlot; -import tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.BlobSidecar; import tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.BlockRequest; import tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.DepositMessage; import tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.Eth2SigningRequestBody; @@ -47,7 +46,6 @@ public final class Eth2SigningRequestBodyBuilder { private SyncAggregatorSelectionData syncAggregatorSelectionData; private ContributionAndProof contributionAndProof; private ValidatorRegistration validatorRegistration; - private BlobSidecar blobSidecar; private Eth2SigningRequestBodyBuilder() {} @@ -134,11 +132,6 @@ public Eth2SigningRequestBodyBuilder withValidatorRegistration( return this; } - public Eth2SigningRequestBodyBuilder withBlobSidecar(BlobSidecar blobSidecar) { - this.blobSidecar = blobSidecar; - return this; - } - public Eth2SigningRequestBody build() { return new Eth2SigningRequestBody( type, @@ -155,7 +148,6 @@ public Eth2SigningRequestBody build() { syncCommitteeMessage, syncAggregatorSelectionData, contributionAndProof, - validatorRegistration, - blobSidecar); + validatorRegistration); } } diff --git a/acceptance-tests/src/test/java/tech/pegasys/web3signer/tests/signing/BlsBlobSidecarSigningAcceptanceTest.java b/acceptance-tests/src/test/java/tech/pegasys/web3signer/tests/signing/BlsBlobSidecarSigningAcceptanceTest.java deleted file mode 100644 index fe0a957d3..000000000 --- a/acceptance-tests/src/test/java/tech/pegasys/web3signer/tests/signing/BlsBlobSidecarSigningAcceptanceTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2023 ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package tech.pegasys.web3signer.tests.signing; - -import static io.restassured.http.ContentType.JSON; -import static org.assertj.core.api.Assertions.assertThat; - -import tech.pegasys.teku.bls.BLS; -import tech.pegasys.teku.bls.BLSKeyPair; -import tech.pegasys.teku.bls.BLSPublicKey; -import tech.pegasys.teku.bls.BLSSecretKey; -import tech.pegasys.teku.spec.SpecMilestone; -import tech.pegasys.teku.spec.networks.Eth2Network; -import tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.Eth2SigningRequestBody; -import tech.pegasys.web3signer.dsl.utils.Eth2RequestUtils; -import tech.pegasys.web3signer.dsl.utils.MetadataFileHelpers; -import tech.pegasys.web3signer.signing.KeyType; - -import java.nio.file.Path; - -import com.fasterxml.jackson.core.JsonProcessingException; -import io.restassured.response.Response; -import org.apache.tuweni.bytes.Bytes; -import org.apache.tuweni.bytes.Bytes32; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -public class BlsBlobSidecarSigningAcceptanceTest extends SigningAcceptanceTestBase { - - private static final String PRIVATE_KEY = - "3ee2224386c82ffea477e2adf28a2929f5c349165a4196158c7f3a2ecca40f35"; - private static final MetadataFileHelpers METADATA_FILE_HELPERS = new MetadataFileHelpers(); - private static final BLSSecretKey KEY = - BLSSecretKey.fromBytes(Bytes32.fromHexString(PRIVATE_KEY)); - private static final BLSKeyPair KEY_PAIR = new BLSKeyPair(KEY); - private static final BLSPublicKey PUBLIC_KEY = KEY_PAIR.getPublicKey(); - - @BeforeEach - void init() { - final String configFilename = PUBLIC_KEY.toString().substring(2); - final Path keyConfigFile = testDirectory.resolve(configFilename + ".yaml"); - METADATA_FILE_HELPERS.createUnencryptedYamlFileAt(keyConfigFile, PRIVATE_KEY, KeyType.BLS); - - setupEth2Signer(Eth2Network.MINIMAL, SpecMilestone.DENEB); - } - - @Test - public void signBlobSidecar() throws JsonProcessingException { - final Eth2SigningRequestBody request = Eth2RequestUtils.createBlobSidecarRequest(); - - final Response response = signer.eth2Sign(KEY_PAIR.getPublicKey().toString(), request, JSON); - final Bytes signature = verifyAndGetSignatureResponse(response, JSON); - - final Bytes expectedSignature = - BLS.sign(KEY_PAIR.getSecretKey(), request.signingRoot()).toBytesCompressed(); - assertThat(signature).isEqualTo(expectedSignature); - } -} diff --git a/acceptance-tests/src/test/java/tech/pegasys/web3signer/tests/signing/BlsSigningAcceptanceTest.java b/acceptance-tests/src/test/java/tech/pegasys/web3signer/tests/signing/BlsSigningAcceptanceTest.java index 5bcf5ad60..0ff16ba0c 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/web3signer/tests/signing/BlsSigningAcceptanceTest.java +++ b/acceptance-tests/src/test/java/tech/pegasys/web3signer/tests/signing/BlsSigningAcceptanceTest.java @@ -260,8 +260,7 @@ public void failsIfSigningRootDoesNotMatchSigningData(final ArtifactType artifac request.syncCommitteeMessage(), request.syncAggregatorSelectionData(), request.contributionAndProof(), - request.validatorRegistration(), - request.blobSidecar()); + request.validatorRegistration()); final Response response = signer.eth2Sign(KEY_PAIR.getPublicKey().toString(), requestWithMismatchedSigningRoot); @@ -299,8 +298,7 @@ public void ableToSignWithoutSigningRootField(final ContentType acceptableConten request.syncCommitteeMessage(), request.syncAggregatorSelectionData(), request.contributionAndProof(), - request.validatorRegistration(), - request.blobSidecar()); + request.validatorRegistration()); final Response response = signer.eth2Sign( @@ -345,7 +343,6 @@ private void setupMinimalWeb3Signer(final ArtifactType artifactType) { switch (artifactType) { case BLOCK_V2, SYNC_COMMITTEE_MESSAGE, SYNC_COMMITTEE_SELECTION_PROOF, SYNC_COMMITTEE_CONTRIBUTION_AND_PROOF -> setupEth2Signer( Eth2Network.MINIMAL, SpecMilestone.ALTAIR); - case BLOB_SIDECAR -> setupEth2Signer(Eth2Network.MINIMAL, SpecMilestone.DENEB); default -> setupEth2Signer(Eth2Network.MINIMAL, SpecMilestone.PHASE0); } } diff --git a/acceptance-tests/src/test/java/tech/pegasys/web3signer/tests/signing/Eth2CustomNetworkFileAcceptanceTest.java b/acceptance-tests/src/test/java/tech/pegasys/web3signer/tests/signing/Eth2CustomNetworkFileAcceptanceTest.java index ffe891b17..1552cb3f9 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/web3signer/tests/signing/Eth2CustomNetworkFileAcceptanceTest.java +++ b/acceptance-tests/src/test/java/tech/pegasys/web3signer/tests/signing/Eth2CustomNetworkFileAcceptanceTest.java @@ -65,11 +65,7 @@ void setup() { @Test void signAndVerifyBlockV2SignatureForAllEnabledMilestones() throws Exception { - final Spec spec = - SpecFactory.create( - NETWORK_CONFIG_PATH.toString(), - specConfigBuilder -> - specConfigBuilder.denebBuilder(denebBuilder -> denebBuilder.kzgNoop(true))); + final Spec spec = SpecFactory.create(NETWORK_CONFIG_PATH.toString()); final List enabledMilestones = spec.getEnabledMilestones(); assertThat(enabledMilestones.size()).isEqualTo(5); diff --git a/commandline/src/main/java/tech/pegasys/web3signer/commandline/subcommands/Eth2SubCommand.java b/commandline/src/main/java/tech/pegasys/web3signer/commandline/subcommands/Eth2SubCommand.java index af0891880..cbf3f1e00 100644 --- a/commandline/src/main/java/tech/pegasys/web3signer/commandline/subcommands/Eth2SubCommand.java +++ b/commandline/src/main/java/tech/pegasys/web3signer/commandline/subcommands/Eth2SubCommand.java @@ -184,7 +184,7 @@ private void logNetworkSpecInformation() { private Eth2NetworkConfiguration createEth2NetworkConfig() { Eth2NetworkConfiguration.Builder builder = Eth2NetworkConfiguration.builder(); - builder.applyNetworkDefaults(network).kzgNoop(true); + builder.applyNetworkDefaults(network); if (altairForkEpoch != null) { builder.altairForkEpoch(altairForkEpoch); } diff --git a/core/src/main/java/tech/pegasys/web3signer/core/service/http/ArtifactType.java b/core/src/main/java/tech/pegasys/web3signer/core/service/http/ArtifactType.java index d4f0982a6..b9c99f6cb 100644 --- a/core/src/main/java/tech/pegasys/web3signer/core/service/http/ArtifactType.java +++ b/core/src/main/java/tech/pegasys/web3signer/core/service/http/ArtifactType.java @@ -24,6 +24,5 @@ public enum ArtifactType { SYNC_COMMITTEE_MESSAGE, SYNC_COMMITTEE_SELECTION_PROOF, SYNC_COMMITTEE_CONTRIBUTION_AND_PROOF, - VALIDATOR_REGISTRATION, - BLOB_SIDECAR + VALIDATOR_REGISTRATION } diff --git a/core/src/main/java/tech/pegasys/web3signer/core/service/http/SigningObjectMapperFactory.java b/core/src/main/java/tech/pegasys/web3signer/core/service/http/SigningObjectMapperFactory.java index 9864d1f87..0243dce4d 100644 --- a/core/src/main/java/tech/pegasys/web3signer/core/service/http/SigningObjectMapperFactory.java +++ b/core/src/main/java/tech/pegasys/web3signer/core/service/http/SigningObjectMapperFactory.java @@ -14,7 +14,6 @@ import tech.pegasys.teku.api.schema.BLSPubKey; import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.api.schema.KZGCommitment; import tech.pegasys.teku.infrastructure.bytes.Bytes20; import tech.pegasys.teku.infrastructure.bytes.Bytes4; import tech.pegasys.teku.infrastructure.jackson.deserializers.bytes.Bytes32Deserializer; @@ -31,18 +30,13 @@ import tech.pegasys.teku.provider.BLSPubKeySerializer; import tech.pegasys.teku.provider.BLSSignatureDeserializer; import tech.pegasys.teku.provider.BLSSignatureSerializer; -import tech.pegasys.teku.provider.KZGCommitmentDeserializer; -import tech.pegasys.teku.provider.KZGCommitmentSerializer; import tech.pegasys.teku.provider.SszBitvectorSerializer; import tech.pegasys.web3signer.common.JacksonSerializers.HexDeserialiser; import tech.pegasys.web3signer.common.JacksonSerializers.HexSerialiser; import tech.pegasys.web3signer.common.JacksonSerializers.StringUInt64Deserializer; import tech.pegasys.web3signer.common.JacksonSerializers.StringUInt64Serialiser; import tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.BlockRequest; -import tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.KZGProof; import tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.json.BlockRequestDeserializer; -import tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.json.KZGProofDeserializer; -import tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.json.KZGProofSerializer; import tech.pegasys.web3signer.signing.config.metadata.parser.SigningMetadataModule; import tech.pegasys.web3signer.signing.config.metadata.parser.SigningMetadataModule.Bytes32Serializer; @@ -104,11 +98,6 @@ private Module web3SignerMappers() { module.addDeserializer(Bytes20.class, new SigningMetadataModule.Bytes20Deserializer()); module.addSerializer(Bytes20.class, new SigningMetadataModule.Bytes20Serializer()); - module.addSerializer(KZGCommitment.class, new KZGCommitmentSerializer()); - module.addDeserializer(KZGCommitment.class, new KZGCommitmentDeserializer()); - - module.addSerializer(KZGProof.class, new KZGProofSerializer()); - module.addDeserializer(KZGProof.class, new KZGProofDeserializer()); return module; } diff --git a/core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/BlobSidecar.java b/core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/BlobSidecar.java deleted file mode 100644 index f6c720893..000000000 --- a/core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/BlobSidecar.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2023 ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package tech.pegasys.web3signer.core.service.http.handlers.signing.eth2; - -import tech.pegasys.teku.api.schema.KZGCommitment; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlindedBlobSidecarSchema; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.annotations.VisibleForTesting; -import org.apache.tuweni.bytes.Bytes32; - -/** - * Json representation of BlindedBlobSidecar and BlobSidecar. The blob_root is the "hash tree root" - * of BlobSidecar's blob - */ -public record BlobSidecar( - @JsonProperty("block_root") Bytes32 blockRoot, - @JsonProperty("index") UInt64 index, - @JsonProperty("slot") UInt64 slot, - @JsonProperty("block_parent_root") Bytes32 blockParentRoot, - @JsonProperty("proposer_index") UInt64 proposerIndex, - @JsonProperty("blob_root") Bytes32 blobRoot, - @JsonProperty("kzg_commitment") KZGCommitment kzgCommitment, - @JsonProperty("kzg_proof") KZGProof kzgProof) { - - public tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlindedBlobSidecar - asInternalBlindedBlobSidecar(final SpecVersion spec) { - final BlindedBlobSidecarSchema blindedBlobSidecarSchema = - spec.getSchemaDefinitions().toVersionDeneb().orElseThrow().getBlindedBlobSidecarSchema(); - return new tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlindedBlobSidecar( - blindedBlobSidecarSchema, - blockRoot, - index, - slot, - blockParentRoot, - proposerIndex, - blobRoot, - kzgCommitment.asInternalKZGCommitment(), - kzgProof.asInternalKZGProof()); - } - - @VisibleForTesting - public static BlobSidecar fromInternalBlobSidecar( - final tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecar sidecar) { - return new BlobSidecar( - sidecar.getBlockRoot(), - sidecar.getIndex(), - sidecar.getSlot(), - sidecar.getBlockParentRoot(), - sidecar.getProposerIndex(), - // convert blob to hash tree root to make it assignable to W3S BlobSidecar - sidecar.getBlob().hashTreeRoot(), - new KZGCommitment(sidecar.getKZGCommitment()), - new KZGProof(sidecar.getKZGProof())); - } -} diff --git a/core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/Eth2SignForIdentifierHandler.java b/core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/Eth2SignForIdentifierHandler.java index 15a64f7de..544e87afe 100644 --- a/core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/Eth2SignForIdentifierHandler.java +++ b/core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/Eth2SignForIdentifierHandler.java @@ -317,13 +317,6 @@ private Bytes computeSigningRoot(final Eth2SigningRequestBody body) { checkArgument(validatorRegistration != null, "ValidatorRegistration is required"); return signingRootUtil.signingRootForValidatorRegistration( validatorRegistration.asInternalValidatorRegistration()); - case BLOB_SIDECAR: - // handles both blinded/blob sidecar - final BlobSidecar blobSidecar = body.blobSidecar(); - checkArgument(blobSidecar != null, "BlobSidecar is required"); - return signingRootUtil.signingRootForBlindedBlobSidecar( - blobSidecar.asInternalBlindedBlobSidecar(eth2Spec.atSlot(blobSidecar.slot())), - body.forkInfo().asInternalForkInfo()); default: throw new IllegalStateException("Signing root unimplemented for type " + body.type()); diff --git a/core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/Eth2SigningRequestBody.java b/core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/Eth2SigningRequestBody.java index 256946287..281f3cae3 100644 --- a/core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/Eth2SigningRequestBody.java +++ b/core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/Eth2SigningRequestBody.java @@ -39,5 +39,4 @@ public record Eth2SigningRequestBody( @JsonProperty("sync_aggregator_selection_data") SyncAggregatorSelectionData syncAggregatorSelectionData, @JsonProperty("contribution_and_proof") ContributionAndProof contributionAndProof, - @JsonProperty("validator_registration") ValidatorRegistration validatorRegistration, - @JsonProperty("blob_sidecar") BlobSidecar blobSidecar) {} + @JsonProperty("validator_registration") ValidatorRegistration validatorRegistration) {} diff --git a/core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/KZGProof.java b/core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/KZGProof.java deleted file mode 100644 index b6470c06c..000000000 --- a/core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/KZGProof.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2023 ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package tech.pegasys.web3signer.core.service.http.handlers.signing.eth2; - -import static com.google.common.base.Preconditions.checkArgument; - -import java.util.Objects; - -import org.apache.tuweni.bytes.Bytes; - -public class KZGProof { - /** The number of bytes in this value - i.e. 48 */ - private static final int SIZE = 48; - - private final Bytes bytes; - - public KZGProof(final Bytes bytes) { - checkArgument( - bytes.size() == SIZE, - "Bytes%s should be %s bytes, but was %s bytes.", - SIZE, - SIZE, - bytes.size()); - this.bytes = bytes; - } - - public KZGProof(final tech.pegasys.teku.kzg.KZGProof kzgProof) { - this(kzgProof.toSSZBytes()); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final KZGProof other = (KZGProof) o; - return bytes.equals(other.bytes); - } - - @Override - public int hashCode() { - return Objects.hash(bytes); - } - - @Override - public String toString() { - return bytes.toString(); - } - - public static KZGProof fromHexString(final String value) { - try { - return new KZGProof(tech.pegasys.teku.kzg.KZGProof.fromHexString(value)); - } catch (IllegalArgumentException e) { - throw new IllegalArgumentException("KZGProof " + value + " is invalid: " + e.getMessage(), e); - } - } - - public String toHexString() { - return bytes.toHexString(); - } - - public Bytes toBytes() { - return bytes; - } - - public static KZGProof empty() { - return new KZGProof(Bytes.wrap(new byte[SIZE])); - } - - public tech.pegasys.teku.kzg.KZGProof asInternalKZGProof() { - return tech.pegasys.teku.kzg.KZGProof.fromSSZBytes(bytes); - } -} diff --git a/core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/json/KZGProofDeserializer.java b/core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/json/KZGProofDeserializer.java deleted file mode 100644 index 74e21dcb4..000000000 --- a/core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/json/KZGProofDeserializer.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2023 ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.json; - -import tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.KZGProof; - -import java.io.IOException; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonDeserializer; -import org.apache.tuweni.bytes.Bytes; - -public class KZGProofDeserializer extends JsonDeserializer { - @Override - public KZGProof deserialize(final JsonParser p, final DeserializationContext ignore) - throws IOException { - return new KZGProof(Bytes.fromHexString(p.getValueAsString())); - } -} diff --git a/core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/json/KZGProofSerializer.java b/core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/json/KZGProofSerializer.java deleted file mode 100644 index e212f2d79..000000000 --- a/core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/json/KZGProofSerializer.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2023 ConsenSys AG. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.json; - -import tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.KZGProof; - -import java.io.IOException; -import java.util.Locale; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; - -public class KZGProofSerializer extends JsonSerializer { - @Override - public void serialize( - final KZGProof value, final JsonGenerator gen, final SerializerProvider serializers) - throws IOException { - gen.writeString(value.toHexString().toLowerCase(Locale.ROOT)); - } -} From d689315e721791984d455feab25c79abecee3cd3 Mon Sep 17 00:00:00 2001 From: Jason Frame Date: Wed, 10 Jan 2024 10:29:10 +1000 Subject: [PATCH 3/4] update changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fb3d4d9d..83559346e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog -## Next release +## 24.1.0 + ### Upcoming Breaking Changes - `--Xworker-pool-size` cli option will be removed in a future release. This option has been replaced with `--vertx-worker-pool-size`. @@ -8,6 +9,7 @@ - Update reactor-netty-http to fix CVE-2023-34062 ### Features Added +- Add Deneb configuration for Goerli [#960](https://github.com/Consensys/web3signer/pull/960) ## 23.11.0 ### Upcoming Breaking Changes From 3ea0c8d0197aea6cdb0c442732d6e89dab9c3cb9 Mon Sep 17 00:00:00 2001 From: Jason Frame Date: Wed, 10 Jan 2024 11:11:53 +1000 Subject: [PATCH 4/4] include kzg commitments in block for ATs --- .../web3signer/dsl/utils/DataStructureUtilAdapter.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/acceptance-tests/src/test/java/tech/pegasys/web3signer/dsl/utils/DataStructureUtilAdapter.java b/acceptance-tests/src/test/java/tech/pegasys/web3signer/dsl/utils/DataStructureUtilAdapter.java index b6d431f89..23c68f187 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/web3signer/dsl/utils/DataStructureUtilAdapter.java +++ b/acceptance-tests/src/test/java/tech/pegasys/web3signer/dsl/utils/DataStructureUtilAdapter.java @@ -104,6 +104,10 @@ private BeaconBlockBody randomBeaconBlockBody(final UInt64 slotNum) { builder.blsToExecutionChanges( randomSignedBlsToExecutionChangesList(spec.atSlot(slotNum))); } + if (builder.supportsKzgCommitments()) { + builder.blobKzgCommitments( + SafeFuture.completedFuture(util.randomBlobKzgCommitments())); + } }) .join(); }