Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanBratanov committed Sep 10, 2024
1 parent 21b2421 commit 0851dee
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,33 +79,9 @@ protected void validate() {
checkNotNull(payloadAttestations, "payloadAttestations must be specified");
}

@Override
protected Boolean isBlinded() {
return super.isBlinded() || blindedSchema != null;
}

@Override
public BeaconBlockBody build() {
validate();
if (isBlinded()) {
final BlindedBeaconBlockBodySchemaEip7732Impl schema =
getAndValidateSchema(true, BlindedBeaconBlockBodySchemaEip7732Impl.class);
return new BlindedBeaconBlockBodyEip7732Impl(
schema,
new SszSignature(randaoReveal),
eth1Data,
SszBytes32.of(graffiti),
proposerSlashings,
attesterSlashings,
attestations,
deposits,
voluntaryExits,
syncAggregate,
getBlsToExecutionChanges(),
signedExecutionPayloadHeader,
payloadAttestations);
}

final BeaconBlockBodySchemaEip7732Impl schema =
getAndValidateSchema(false, BeaconBlockBodySchemaEip7732Impl.class);
return new BeaconBlockBodyEip7732Impl(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ public SafeFuture<SignedBlockAndState> createNewBlock(
builder.blobKzgCommitments(
kzgCommitments.orElseGet(dataStructureUtil::emptyBlobKzgCommitments));
}
// EIP7732 TODO:
if (builder.supportsSignedExecutionPayloadHeader()) {
final SchemaDefinitionsEip7732 schemaDefinitionsEip7732 =
SchemaDefinitionsEip7732.required(spec.atSlot(newSlot).getSchemaDefinitions());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import tech.pegasys.teku.networking.eth2.peers.Eth2Peer;
import tech.pegasys.teku.networking.eth2.rpc.core.RpcException;
import tech.pegasys.teku.networking.eth2.rpc.core.RpcException.DeserializationFailedException;
import tech.pegasys.teku.networking.eth2.rpc.core.RpcException.LengthOutOfBoundsException;
import tech.pegasys.teku.networking.eth2.rpc.core.RpcException.UnrecognizedContextBytesException;
import tech.pegasys.teku.networking.p2p.peer.DisconnectReason;
import tech.pegasys.teku.networking.p2p.peer.PeerDisconnectedException;
Expand Down Expand Up @@ -244,8 +245,11 @@ public void requestBlockByRange_withDisparateVersionsEnabled_requestNextSpecBloc
assertThat(res).isCompletedExceptionally();
assertThatThrownBy(res::get)
.hasCauseInstanceOf(RpcException.class)
.hasRootCauseInstanceOf(DeserializationFailedException.class)
.hasMessageContaining("Failed to deserialize payload");
.satisfies(
ex ->
assertThat(ex.getCause())
.isInstanceOfAny(
DeserializationFailedException.class, LengthOutOfBoundsException.class));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,23 +498,9 @@ private void scheduleValidatorsDuties(
validators,
validatorIndexProvider));

final DutyLoader<?> payloadDutyLoader =
new RetryingDutyLoader<>(
asyncRunner,
new PayloadAttestationDutyLoader(
validatorApiChannel,
dependentRoot ->
new SlotBasedScheduledDuties<>(
payloadAttestationDutyFactory,
dependentRoot,
validatorDutyMetrics::performDutyWithMetrics),
validators,
validatorIndexProvider));
validatorTimingChannels.add(new BlockDutyScheduler(metricsSystem, blockDutyLoader, spec));
validatorTimingChannels.add(
new AttestationDutyScheduler(metricsSystem, attestationDutyLoader, spec));
validatorTimingChannels.add(
new PayloadAttestationDutyScheduler(metricsSystem, payloadDutyLoader, spec));
validatorTimingChannels.add(validatorLoader.getSlashingProtectionLogger());

if (spec.isMilestoneSupported(SpecMilestone.ALTAIR)) {
Expand Down Expand Up @@ -545,6 +531,24 @@ private void scheduleValidatorsDuties(
});
validatorRegistrator.ifPresent(validatorTimingChannels::add);
}

if (spec.isMilestoneSupported(SpecMilestone.EIP7732)) {
final DutyLoader<?> payloadDutyLoader =
new RetryingDutyLoader<>(
asyncRunner,
new PayloadAttestationDutyLoader(
validatorApiChannel,
dependentRoot ->
new SlotBasedScheduledDuties<>(
payloadAttestationDutyFactory,
dependentRoot,
validatorDutyMetrics::performDutyWithMetrics),
validators,
validatorIndexProvider));
validatorTimingChannels.add(
new PayloadAttestationDutyScheduler(metricsSystem, payloadDutyLoader, spec));
}

addValidatorCountMetric(metricsSystem, validators);
final ValidatorStatusLogger validatorStatusLogger = new ValidatorStatusLogger(validators);
validatorStatusProvider.subscribeValidatorStatusesUpdates(
Expand Down

0 comments on commit 0851dee

Please sign in to comment.