Skip to content

Commit

Permalink
Update Goerli config for Deneb (#960)
Browse files Browse the repository at this point in the history
  • Loading branch information
jframe authored Jan 10, 2024
1 parent e0758a8 commit e9830b7
Show file tree
Hide file tree
Showing 17 changed files with 12 additions and 355 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# 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`.

### Bugs fixed
- 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private BeaconBlockBody randomBeaconBlockBody(final UInt64 slotNum) {
}
if (builder.supportsKzgCommitments()) {
builder.blobKzgCommitments(
SafeFuture.completedFuture(util.randomSszKzgCommitmentList()));
SafeFuture.completedFuture(util.randomBlobKzgCommitments()));
}
})
.join();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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");
}
Expand Down Expand Up @@ -424,27 +420,4 @@ private static SafeFuture<Bytes> 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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -47,7 +46,6 @@ public final class Eth2SigningRequestBodyBuilder {
private SyncAggregatorSelectionData syncAggregatorSelectionData;
private ContributionAndProof contributionAndProof;
private ValidatorRegistration validatorRegistration;
private BlobSidecar blobSidecar;

private Eth2SigningRequestBodyBuilder() {}

Expand Down Expand Up @@ -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,
Expand All @@ -155,7 +148,6 @@ public Eth2SigningRequestBody build() {
syncCommitteeMessage,
syncAggregatorSelectionData,
contributionAndProof,
validatorRegistration,
blobSidecar);
validatorRegistration);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ForkAndSpecMilestone> enabledMilestones = spec.getEnabledMilestones();
assertThat(enabledMilestones.size()).isEqualTo(5);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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;
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Loading

0 comments on commit e9830b7

Please sign in to comment.