Skip to content

Commit

Permalink
Remove unused methods on ExecutionPayloadBuilder (Consensys#8718)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucassaldanha authored and tbenr committed Oct 14, 2024
1 parent 0c0ba93 commit 9a2c8c3
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 137 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
import tech.pegasys.teku.infrastructure.bytes.Bytes20;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.datastructures.execution.versions.capella.Withdrawal;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ConsolidationRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequest;

public interface ExecutionPayloadBuilder {
ExecutionPayloadBuilder parentHash(Bytes32 parentHash);
Expand Down Expand Up @@ -60,13 +57,5 @@ public interface ExecutionPayloadBuilder {

ExecutionPayloadBuilder excessBlobGas(Supplier<UInt64> excessBlobGasSupplier);

ExecutionPayloadBuilder depositRequests(Supplier<List<DepositRequest>> depositRequestsSupplier);

ExecutionPayloadBuilder withdrawalRequests(
Supplier<List<WithdrawalRequest>> withdrawalRequestsSupplier);

ExecutionPayloadBuilder consolidationRequests(
Supplier<List<ConsolidationRequest>> consolidationRequestsSupplier);

ExecutionPayload build();
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadBuilder;
import tech.pegasys.teku.spec.datastructures.execution.versions.capella.Withdrawal;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ConsolidationRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequest;

public class ExecutionPayloadBuilderBellatrix implements ExecutionPayloadBuilder {
private ExecutionPayloadSchemaBellatrix schema;
Expand Down Expand Up @@ -155,24 +152,6 @@ public ExecutionPayloadBuilder excessBlobGas(final Supplier<UInt64> excessBlobGa
return this;
}

@Override
public ExecutionPayloadBuilder depositRequests(
final Supplier<List<DepositRequest>> depositRequestsSupplier) {
return this;
}

@Override
public ExecutionPayloadBuilder withdrawalRequests(
final Supplier<List<WithdrawalRequest>> withdrawalRequestsSupplier) {
return this;
}

@Override
public ExecutionPayloadBuilder consolidationRequests(
final Supplier<List<ConsolidationRequest>> consolidationRequestsSupplier) {
return this;
}

protected void validateSchema() {
checkNotNull(schema, "schema must be specified");
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,9 @@
import tech.pegasys.teku.spec.datastructures.execution.GetPayloadResponse;
import tech.pegasys.teku.spec.datastructures.execution.NewPayloadRequest;
import tech.pegasys.teku.spec.datastructures.execution.PowBlock;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequest;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState;
import tech.pegasys.teku.spec.datastructures.type.SszKZGCommitment;
import tech.pegasys.teku.spec.datastructures.util.BlobsUtil;
import tech.pegasys.teku.spec.datastructures.util.DepositRequestsUtil;
import tech.pegasys.teku.spec.logic.versions.deneb.types.VersionedHash;
import tech.pegasys.teku.spec.schemas.SchemaDefinitions;
import tech.pegasys.teku.spec.schemas.SchemaDefinitionsBellatrix;
Expand All @@ -80,8 +78,6 @@ public class ExecutionLayerChannelStub implements ExecutionLayerChannel {
private static final ClientVersion STUB_CLIENT_VERSION =
new ClientVersion("SB", ExecutionLayerChannel.STUB_ENDPOINT_PREFIX, "0.0.0", Bytes4.ZERO);

private static final boolean GENERATE_DEPOSIT_REQUESTS = false;

private final TimeProvider timeProvider;
private final Map<Bytes32, PowBlock> knownBlocks = new ConcurrentHashMap<>();
private final Map<Bytes32, PayloadStatus> knownPosBlocks = new ConcurrentHashMap<>();
Expand All @@ -90,7 +86,6 @@ public class ExecutionLayerChannelStub implements ExecutionLayerChannel {
private final Set<Bytes32> requestedPowBlocks = new HashSet<>();
private final Spec spec;
private final BlobsUtil blobsUtil;
private final DepositRequestsUtil depositRequestsUtil;
private final Random random = new Random();

private PayloadStatus payloadStatus = PayloadStatus.VALID;
Expand Down Expand Up @@ -134,7 +129,6 @@ public ExecutionLayerChannelStub(
kzg = KZG.NOOP;
}
this.blobsUtil = new BlobsUtil(spec, kzg);
this.depositRequestsUtil = new DepositRequestsUtil(spec);
}

public ExecutionLayerChannelStub(
Expand Down Expand Up @@ -290,10 +284,7 @@ public SafeFuture<GetPayloadResponse> engineGetPayload(
.transactions(transactions)
.withdrawals(() -> payloadAttributes.getWithdrawals().orElse(List.of()))
.blobGasUsed(() -> UInt64.ZERO)
.excessBlobGas(() -> UInt64.ZERO)
.depositRequests(() -> generateDepositRequests(state))
.withdrawalRequests(List::of)
.consolidationRequests(List::of));
.excessBlobGas(() -> UInt64.ZERO));

// we assume all blocks are produced locally
lastValidBlock =
Expand Down Expand Up @@ -612,18 +603,4 @@ private Bytes generateBlobsAndTransaction(

return blobsUtil.generateRawBlobTransactionFromKzgCommitments(commitments);
}

private List<DepositRequest> generateDepositRequests(final BeaconState state) {
return spec.atSlot(state.getSlot())
.getConfig()
.toVersionElectra()
.map(
__ -> {
if (GENERATE_DEPOSIT_REQUESTS) {
return depositRequestsUtil.generateDepositRequests(state);
}
return List.<DepositRequest>of();
})
.orElse(List.of());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,7 @@ private ExecutionPayload createExecutionPayload(
.transactions(transactions.orElse(Collections.emptyList()))
.withdrawals(List::of)
.blobGasUsed(() -> UInt64.ZERO)
.excessBlobGas(() -> UInt64.ZERO)
.depositRequests(List::of)
.withdrawalRequests(List::of)
.consolidationRequests(List::of));
.excessBlobGas(() -> UInt64.ZERO));
}

private Boolean isMergeTransitionComplete(final BeaconState state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -697,10 +697,7 @@ public ExecutionPayload randomExecutionPayload(
.transactions(randomExecutionPayloadTransactions())
.withdrawals(this::randomExecutionPayloadWithdrawals)
.blobGasUsed(this::randomUInt64)
.excessBlobGas(this::randomUInt64)
.depositRequests(this::randomDepositRequests)
.withdrawalRequests(this::randomWithdrawalRequests)
.consolidationRequests(this::randomConsolidationRequests);
.excessBlobGas(this::randomUInt64);
builderModifier.accept(executionPayloadBuilder);
});
}
Expand Down

0 comments on commit 9a2c8c3

Please sign in to comment.