Skip to content

Commit

Permalink
Remove old execution requests from execution payload (#8707)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtraglia authored Oct 11, 2024
1 parent 493322a commit 5380f95
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,5 @@ public interface ExecutionPayloadHeaderBuilder {

ExecutionPayloadHeaderBuilder excessBlobGas(Supplier<UInt64> excessBlobGasSupplier);

ExecutionPayloadHeaderBuilder depositRequestsRoot(Supplier<Bytes32> depositRequestsRootSupplier);

ExecutionPayloadHeaderBuilder withdrawalRequestsRoot(
Supplier<Bytes32> withdrawalRequestsRootSupplier);

ExecutionPayloadHeaderBuilder consolidationRequestsRoot(
Supplier<Bytes32> consolidationRequestsRootSupplier);

ExecutionPayloadHeader build();
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,24 +152,6 @@ public ExecutionPayloadHeaderBuilder excessBlobGas(final Supplier<UInt64> excess
return this;
}

@Override
public ExecutionPayloadHeaderBuilder depositRequestsRoot(
final Supplier<Bytes32> depositRequestsRootSupplier) {
return this;
}

@Override
public ExecutionPayloadHeaderBuilder withdrawalRequestsRoot(
final Supplier<Bytes32> withdrawalRequestsRootSupplier) {
return this;
}

@Override
public ExecutionPayloadHeaderBuilder consolidationRequestsRoot(
final Supplier<Bytes32> consolidationRequestsRootSupplier) {
return this;
}

protected void validateSchema() {
checkNotNull(schema, "schema must be specified");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,8 @@ private ExecutionPayloadHeader mockExecutionPayloadHeader() {
// Capella
b.withdrawalsRoot(() -> Bytes32.ZERO);
// Deneb
b.excessBlobGas(() -> UInt64.ZERO);
b.blobGasUsed(() -> UInt64.ZERO);
// Electra
b.depositRequestsRoot(() -> Bytes32.ZERO);
b.withdrawalRequestsRoot(() -> Bytes32.ZERO);
b.consolidationRequestsRoot(() -> Bytes32.ZERO);
b.excessBlobGas(() -> UInt64.ZERO);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@

import java.util.Comparator;
import java.util.stream.IntStream;
import org.apache.tuweni.bytes.Bytes32;
import tech.pegasys.teku.infrastructure.ssz.SszMutableList;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.config.SpecConfigElectra;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeader;
import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.ExecutionPayloadHeaderDeneb;
import tech.pegasys.teku.spec.datastructures.state.Fork;
import tech.pegasys.teku.spec.datastructures.state.Validator;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState;
Expand Down Expand Up @@ -80,37 +77,8 @@ public BeaconStateElectra upgrade(final BeaconState preState) {
specConfig.getElectraForkVersion(),
epoch));

final ExecutionPayloadHeaderDeneb denebHeader =
preStateDeneb.getLatestExecutionPayloadHeader().toVersionDeneb().orElseThrow();
final ExecutionPayloadHeader upgradedExecutionPayloadHeader =
schemaDefinitions
.getExecutionPayloadHeaderSchema()
.createExecutionPayloadHeader(
builder ->
builder
.parentHash(denebHeader.getParentHash())
.feeRecipient(denebHeader.getFeeRecipient())
.stateRoot(denebHeader.getStateRoot())
.receiptsRoot(denebHeader.getReceiptsRoot())
.logsBloom(denebHeader.getLogsBloom())
.prevRandao(denebHeader.getPrevRandao())
.blockNumber(denebHeader.getBlockNumber())
.gasLimit(denebHeader.getGasLimit())
.gasUsed(denebHeader.getGasUsed())
.timestamp(denebHeader.getTimestamp())
.extraData(denebHeader.getExtraData())
.baseFeePerGas(denebHeader.getBaseFeePerGas())
.blockHash(denebHeader.getBlockHash())
.transactionsRoot(denebHeader.getTransactionsRoot())
.withdrawalsRoot(denebHeader::getWithdrawalsRoot)
.blobGasUsed(denebHeader::getBlobGasUsed)
.excessBlobGas(denebHeader::getExcessBlobGas)
.depositRequestsRoot(() -> Bytes32.ZERO)
.withdrawalRequestsRoot(() -> Bytes32.ZERO)
.consolidationRequestsRoot(() -> Bytes32.ZERO));

state.setLatestExecutionPayloadHeader(upgradedExecutionPayloadHeader);

state.setLatestExecutionPayloadHeader(
preStateDeneb.getLatestExecutionPayloadHeader());
state.setNextWithdrawalValidatorIndex(
preStateDeneb.getNextWithdrawalValidatorIndex());
state.setNextWithdrawalIndex(preStateDeneb.getNextWithdrawalIndex());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
package tech.pegasys.teku.spec.datastructures.interop;

import java.util.Collections;
import org.apache.tuweni.bytes.Bytes32;
import org.hyperledger.besu.config.GenesisConfigFile;
import org.hyperledger.besu.config.GenesisConfigOptions;
import org.hyperledger.besu.datatypes.Wei;
Expand Down Expand Up @@ -74,10 +73,6 @@ public static ExecutionPayloadHeader createPayloadForBesuGenesis(
.orElseThrow())
// New in Deneb
.blobGasUsed(() -> UInt64.ZERO)
.excessBlobGas(() -> UInt64.ZERO)
// New in Electra
.depositRequestsRoot(() -> Bytes32.ZERO)
.withdrawalRequestsRoot(() -> Bytes32.ZERO)
.consolidationRequestsRoot(() -> Bytes32.ZERO));
.excessBlobGas(() -> UInt64.ZERO));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -603,10 +603,7 @@ public ExecutionPayloadHeader randomExecutionPayloadHeader(
.transactionsRoot(randomBytes32())
.withdrawalsRoot(() -> withdrawalsRoot)
.blobGasUsed(this::randomUInt64)
.excessBlobGas(this::randomUInt64)
.depositRequestsRoot(this::randomBytes32)
.withdrawalRequestsRoot(this::randomBytes32)
.consolidationRequestsRoot(this::randomBytes32));
.excessBlobGas(this::randomUInt64));
}

public ExecutionPayloadHeader randomExecutionPayloadHeader(final SpecVersion specVersion) {
Expand Down

0 comments on commit 5380f95

Please sign in to comment.