Skip to content

Commit

Permalink
Merge branch 'master' into graffiti-management
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyeh committed Apr 17, 2024
2 parents f3e014b + caf58d7 commit cf19ffb
Show file tree
Hide file tree
Showing 60 changed files with 684 additions and 810 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ the [releases page](https://github.com/Consensys/teku/releases).
- Added `peers_direction_current` libp2p metric to track the number of peers by direction (inbound and outbound).
- Deposit tree snapshots will be loaded from database as a default unless custom snapshot has been provided.
- Added hidden option `--Xdeposit-contract-logs-syncing-enabled` to allow disabling the syncing of the deposit contract logs from the EL. This is useful when running a non-validating node. It is advisable to be used alongside with `--Xeth1-missing-deposits-event-logging-enabled=false` to avoid unnecessary logging of missing deposits.
- Updated the bootnodes for Chiado and Gnosis networks
- Updated the bootnodes for Chiado and Gnosis networks.
- Added hidden option `--Xp2p-dumps-to-file-enabled` to enable saving p2p dumps to file.

### Bug Fixes
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title" : "ExecutionLayerExit",
"title" : "ExecutionLayerWithdrawalRequest",
"type" : "object",
"required" : [ "source_address", "validator_pubkey" ],
"required" : [ "source_address", "validator_pubkey", "amount" ],
"properties" : {
"source_address" : {
"type" : "string",
Expand All @@ -14,6 +14,12 @@
"pattern" : "^0x[a-fA-F0-9]{2,}$",
"description" : "Bytes48 hexadecimal",
"format" : "bytes"
},
"amount" : {
"type" : "string",
"description" : "unsigned 64 bit integer",
"example" : "1",
"format" : "uint64"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title" : "ExecutionPayloadElectra",
"type" : "object",
"required" : [ "parent_hash", "fee_recipient", "state_root", "receipts_root", "logs_bloom", "prev_randao", "block_number", "gas_limit", "gas_used", "timestamp", "extra_data", "base_fee_per_gas", "block_hash", "transactions", "withdrawals", "blob_gas_used", "excess_blob_gas", "deposit_receipts", "exits" ],
"required" : [ "parent_hash", "fee_recipient", "state_root", "receipts_root", "logs_bloom", "prev_randao", "block_number", "gas_limit", "gas_used", "timestamp", "extra_data", "base_fee_per_gas", "block_hash", "transactions", "withdrawals", "blob_gas_used", "excess_blob_gas", "deposit_receipts", "withdrawal_requests" ],
"properties" : {
"parent_hash" : {
"type" : "string",
Expand Down Expand Up @@ -114,10 +114,10 @@
"$ref" : "#/components/schemas/DepositReceipt"
}
},
"exits" : {
"withdrawal_requests" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/ExecutionLayerExit"
"$ref" : "#/components/schemas/ExecutionLayerWithdrawalRequest"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title" : "ExecutionPayloadHeaderElectra",
"type" : "object",
"required" : [ "parent_hash", "fee_recipient", "state_root", "receipts_root", "logs_bloom", "prev_randao", "block_number", "gas_limit", "gas_used", "timestamp", "extra_data", "base_fee_per_gas", "block_hash", "transactions_root", "withdrawals_root", "blob_gas_used", "excess_blob_gas", "deposit_receipts_root", "exits_root" ],
"required" : [ "parent_hash", "fee_recipient", "state_root", "receipts_root", "logs_bloom", "prev_randao", "block_number", "gas_limit", "gas_used", "timestamp", "extra_data", "base_fee_per_gas", "block_hash", "transactions_root", "withdrawals_root", "blob_gas_used", "excess_blob_gas", "deposit_receipts_root", "withdrawal_requests_root" ],
"properties" : {
"parent_hash" : {
"type" : "string",
Expand Down Expand Up @@ -111,7 +111,7 @@
"example" : "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
"format" : "byte"
},
"exits_root" : {
"withdrawal_requests_root" : {
"type" : "string",
"description" : "Bytes32 hexadecimal",
"example" : "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
"blob_gas_used": "4476638188903342311",
"excess_blob_gas": "4521255257228650249",
"deposit_receipts_root": "0xc7dab83ea972daeec7b1385f04b22e210f708323c38b84160159653a163f259e",
"exits_root": "0x8e77ca3ec98f3c20e7e802dd8917f1b9fc66866da0310ae878d59ae1871cfffd"
"withdrawal_requests_root": "0x8e77ca3ec98f3c20e7e802dd8917f1b9fc66866da0310ae878d59ae1871cfffd"
},
"bls_to_execution_changes": [
{
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,43 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import tech.pegasys.teku.bls.BLSPublicKey;
import tech.pegasys.teku.ethereum.execution.types.Eth1Address;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionLayerExitSchema;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionLayerWithdrawalRequestSchema;

public class ExecutionLayerExit {
public class ExecutionLayerWithdrawalRequest {

@JsonProperty("source_address")
private final Eth1Address sourceAddress;

@JsonProperty("validator_pubkey")
private final BLSPublicKey validatorPublicKey;

public ExecutionLayerExit(
@JsonProperty("amount")
private final UInt64 amount;

public ExecutionLayerWithdrawalRequest(
@JsonProperty("source_address") final Eth1Address sourceAddress,
@JsonProperty("validator_pubkey") final BLSPublicKey validatorPublicKey) {
@JsonProperty("validator_pubkey") final BLSPublicKey validatorPublicKey,
@JsonProperty("amount") final UInt64 amount) {
this.sourceAddress = sourceAddress;
this.validatorPublicKey = validatorPublicKey;
this.amount = amount;
}

public ExecutionLayerExit(
final tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionLayerExit
executionLayerExit) {
public ExecutionLayerWithdrawalRequest(
final tech.pegasys.teku.spec.datastructures.execution.versions.electra
.ExecutionLayerWithdrawalRequest
executionLayerWithdrawalRequest) {
this.sourceAddress =
Eth1Address.fromBytes(executionLayerExit.getSourceAddress().getWrappedBytes());
this.validatorPublicKey = executionLayerExit.getValidatorPublicKey();
Eth1Address.fromBytes(executionLayerWithdrawalRequest.getSourceAddress().getWrappedBytes());
this.validatorPublicKey = executionLayerWithdrawalRequest.getValidatorPublicKey();
this.amount = executionLayerWithdrawalRequest.getAmount();
}

public final tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionLayerExit
asInternalExecutionLayerExit(final ExecutionLayerExitSchema schema) {
return schema.create(sourceAddress, validatorPublicKey);
public final tech.pegasys.teku.spec.datastructures.execution.versions.electra
.ExecutionLayerWithdrawalRequest
asInternalExecutionLayerWithdrawalRequest(
final ExecutionLayerWithdrawalRequestSchema schema) {
return schema.create(sourceAddress, validatorPublicKey, amount);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public class ExecutionPayloadElectra extends ExecutionPayloadDeneb implements Ex
@JsonProperty("deposit_receipts")
public final List<DepositReceipt> depositReceipts;

@JsonProperty("exits")
public final List<ExecutionLayerExit> exits;
@JsonProperty("withdrawal_requests")
public final List<ExecutionLayerWithdrawalRequest> withdrawalRequests;

@JsonCreator
public ExecutionPayloadElectra(
Expand All @@ -56,7 +56,8 @@ public ExecutionPayloadElectra(
@JsonProperty("blob_gas_used") final UInt64 blobGasUsed,
@JsonProperty("excess_blob_gas") final UInt64 excessBlobGas,
@JsonProperty("deposit_receipts") final List<DepositReceipt> depositReceipts,
@JsonProperty("exits") final List<ExecutionLayerExit> exits) {
@JsonProperty("withdrawal_requests")
final List<ExecutionLayerWithdrawalRequest> withdrawalRequests) {
super(
parentHash,
feeRecipient,
Expand All @@ -76,7 +77,7 @@ public ExecutionPayloadElectra(
blobGasUsed,
excessBlobGas);
this.depositReceipts = depositReceipts;
this.exits = exits;
this.withdrawalRequests = withdrawalRequests;
}

public ExecutionPayloadElectra(
Expand All @@ -86,9 +87,9 @@ public ExecutionPayloadElectra(
executionPayload.toVersionElectra().orElseThrow().getDepositReceipts().stream()
.map(DepositReceipt::new)
.toList();
this.exits =
executionPayload.toVersionElectra().orElseThrow().getExits().stream()
.map(ExecutionLayerExit::new)
this.withdrawalRequests =
executionPayload.toVersionElectra().orElseThrow().getWithdrawalRequests().stream()
.map(ExecutionLayerWithdrawalRequest::new)
.toList();
}

Expand All @@ -105,13 +106,14 @@ protected ExecutionPayloadBuilder applyToBuilder(
depositReceipt.asInternalDepositReceipt(
executionPayloadSchema.getDepositReceiptSchemaRequired()))
.toList())
.exits(
.withdrawalRequests(
() ->
exits.stream()
withdrawalRequests.stream()
.map(
exit ->
exit.asInternalExecutionLayerExit(
executionPayloadSchema.getExecutionLayerExitSchemaRequired()))
exit.asInternalExecutionLayerWithdrawalRequest(
executionPayloadSchema
.getExecutionLayerWithdrawalRequestSchemaRequired()))
.toList());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public class ExecutionPayloadHeaderElectra extends ExecutionPayloadHeaderDeneb {
@JsonProperty("deposit_receipts_root")
public final Bytes32 depositReceiptsRoot;

@JsonProperty("exits_root")
public final Bytes32 exitsRoot;
@JsonProperty("withdrawal_requests_root")
public final Bytes32 withdrawalRequestsRoot;

@JsonCreator
public ExecutionPayloadHeaderElectra(
Expand All @@ -53,7 +53,7 @@ public ExecutionPayloadHeaderElectra(
@JsonProperty("blob_gas_used") final UInt64 blobGasUsed,
@JsonProperty("excess_blob_gas") final UInt64 excessBlobGas,
@JsonProperty("deposit_receipts_root") final Bytes32 depositReceiptsRoot,
@JsonProperty("exits_root") final Bytes32 exitsRoot) {
@JsonProperty("withdrawal_requests_root") final Bytes32 withdrawalRequestsRoot) {
super(
parentHash,
feeRecipient,
Expand All @@ -73,7 +73,7 @@ public ExecutionPayloadHeaderElectra(
blobGasUsed,
excessBlobGas);
this.depositReceiptsRoot = depositReceiptsRoot;
this.exitsRoot = exitsRoot;
this.withdrawalRequestsRoot = withdrawalRequestsRoot;
}

public ExecutionPayloadHeaderElectra(final ExecutionPayloadHeader executionPayloadHeader) {
Expand All @@ -97,7 +97,8 @@ public ExecutionPayloadHeaderElectra(final ExecutionPayloadHeader executionPaylo
executionPayloadHeader.toVersionDeneb().orElseThrow().getExcessBlobGas());
this.depositReceiptsRoot =
executionPayloadHeader.toVersionElectra().orElseThrow().getDepositReceiptsRoot();
this.exitsRoot = executionPayloadHeader.toVersionElectra().orElseThrow().getExitsRoot();
this.withdrawalRequestsRoot =
executionPayloadHeader.toVersionElectra().orElseThrow().getWithdrawalRequestsRoot();
}

@Override
Expand All @@ -124,7 +125,7 @@ public ExecutionPayloadHeader asInternalExecutionPayloadHeader(
.blobGasUsed(() -> blobGasUsed)
.excessBlobGas(() -> excessBlobGas)
.depositReceiptsRoot(() -> depositReceiptsRoot)
.exitsRoot(() -> exitsRoot));
.withdrawalRequestsRoot(() -> withdrawalRequestsRoot));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.electra.BeaconBlockBodySchemaElectra;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadSummary;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositReceipt;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionLayerExit;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionLayerWithdrawalRequest;
import tech.pegasys.teku.spec.datastructures.operations.Attestation;
import tech.pegasys.teku.spec.datastructures.operations.AttesterSlashing;
import tech.pegasys.teku.spec.datastructures.operations.Deposit;
Expand Down Expand Up @@ -154,19 +154,21 @@ public void processDepositReceipt(
}

@Override
public void processExecutionLayerExit(
final MutableBeaconState state, final ExecutionLayerExit executionLayerExit)
public void processExecutionLayerWithdrawalRequest(
final MutableBeaconState state,
final ExecutionLayerWithdrawalRequest executionLayerWithdrawalRequest)
throws BlockProcessingException {
final SszList<ExecutionLayerExit> exits =
final SszList<ExecutionLayerWithdrawalRequest> withdrawalRequests =
BeaconBlockBodySchemaElectra.required(beaconBlockBodySchema)
.getExecutionPayloadSchema()
.getExecutionLayerExitsSchemaRequired()
.of(executionLayerExit);
.getExecutionLayerWithdrawalRequestsSchemaRequired()
.of(executionLayerWithdrawalRequest);
final Supplier<ValidatorExitContext> validatorExitContextSupplier =
spec.atSlot(state.getSlot())
.beaconStateMutators()
.createValidatorExitContextSupplier(state);
spec.getBlockProcessor(state.getSlot())
.processExecutionLayerExits(state, exits, validatorExitContextSupplier);
.processExecutionLayerWithdrawalRequests(
state, withdrawalRequests, validatorExitContextSupplier);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair.SyncAggregate;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadSummary;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositReceipt;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionLayerExit;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionLayerWithdrawalRequest;
import tech.pegasys.teku.spec.datastructures.operations.Attestation;
import tech.pegasys.teku.spec.datastructures.operations.AttesterSlashing;
import tech.pegasys.teku.spec.datastructures.operations.Deposit;
Expand Down Expand Up @@ -68,6 +68,7 @@ void processWithdrawals(MutableBeaconState state, ExecutionPayloadSummary payloa
void processDepositReceipt(final MutableBeaconState state, final DepositReceipt depositReceipt)
throws BlockProcessingException;

void processExecutionLayerExit(MutableBeaconState state, ExecutionLayerExit executionLayerExit)
void processExecutionLayerWithdrawalRequest(
MutableBeaconState state, ExecutionLayerWithdrawalRequest executionLayerWithdrawalRequest)
throws BlockProcessingException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair.SyncAggregate;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositReceipt;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionLayerExit;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionLayerWithdrawalRequest;
import tech.pegasys.teku.spec.datastructures.operations.Attestation;
import tech.pegasys.teku.spec.datastructures.operations.AttesterSlashing;
import tech.pegasys.teku.spec.datastructures.operations.Deposit;
Expand Down Expand Up @@ -75,7 +75,7 @@ private enum Operation {
BLS_TO_EXECUTION_CHANGE,
WITHDRAWAL,
DEPOSIT_RECEIPT,
EXECUTION_LAYER_EXIT
EXECUTION_LAYER_WITHDRAWAL_REQUEST
}

public static final ImmutableMap<String, TestExecutor> OPERATIONS_TEST_TYPES =
Expand Down Expand Up @@ -120,9 +120,10 @@ private enum Operation {
"operations/deposit_receipt",
new OperationsTestExecutor<>("deposit_receipt.ssz_snappy", Operation.DEPOSIT_RECEIPT))
.put(
"operations/execution_layer_exit",
"operations/execution_layer_withdrawal_request",
new OperationsTestExecutor<>(
"execution_layer_exit.ssz_snappy", Operation.EXECUTION_LAYER_EXIT))
"execution_layer_withdrawal_request.ssz_snappy",
Operation.EXECUTION_LAYER_WITHDRAWAL_REQUEST))
.build();

private final String dataFileName;
Expand Down Expand Up @@ -310,7 +311,8 @@ private void processOperation(
case BLS_TO_EXECUTION_CHANGE -> processBlsToExecutionChange(testDefinition, state, processor);
case WITHDRAWAL -> processWithdrawal(testDefinition, state, processor);
case DEPOSIT_RECEIPT -> processDepositReceipt(testDefinition, state, processor);
case EXECUTION_LAYER_EXIT -> processExecutionLayerExit(testDefinition, state, processor);
case EXECUTION_LAYER_WITHDRAWAL_REQUEST -> processExecutionLayerWithdrawalRequest(
testDefinition, state, processor);
default -> throw new UnsupportedOperationException(
"Operation " + operation + " not implemented in OperationTestExecutor");
}
Expand Down Expand Up @@ -348,14 +350,14 @@ private void processDepositReceipt(
processor.processDepositReceipt(state, depositReceipt);
}

private void processExecutionLayerExit(
private void processExecutionLayerWithdrawalRequest(
final TestDefinition testDefinition,
final MutableBeaconState state,
final OperationProcessor processor)
throws BlockProcessingException {
final ExecutionLayerExit executionLayerExit =
loadSsz(testDefinition, dataFileName, ExecutionLayerExit.SSZ_SCHEMA);
processor.processExecutionLayerExit(state, executionLayerExit);
final ExecutionLayerWithdrawalRequest executionLayerWithdrawalRequest =
loadSsz(testDefinition, dataFileName, ExecutionLayerWithdrawalRequest.SSZ_SCHEMA);
processor.processExecutionLayerWithdrawalRequest(state, executionLayerWithdrawalRequest);
}

private SignedVoluntaryExit loadVoluntaryExit(final TestDefinition testDefinition) {
Expand Down Expand Up @@ -422,7 +424,7 @@ public void checkBlockInclusionValidation(
EXECUTION_PAYLOAD,
WITHDRAWAL,
DEPOSIT_RECEIPT,
EXECUTION_LAYER_EXIT -> {}
EXECUTION_LAYER_WITHDRAWAL_REQUEST -> {}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,9 @@ public void newPayloadV4_shouldBuildRequestAndResponseSuccessfully() {
assertThat(executionPayloadV4Parameter.get("depositReceipts"))
.asInstanceOf(InstanceOfAssertFactories.LIST)
.hasSameSizeAs(executionPayloadV4.depositReceipts);
assertThat(executionPayloadV4Parameter.get("exits"))
assertThat(executionPayloadV4Parameter.get("withdrawalRequests"))
.asInstanceOf(InstanceOfAssertFactories.LIST)
.hasSameSizeAs(executionPayloadV4.exits);
.hasSameSizeAs(executionPayloadV4.withdrawalRequests);
assertThat(((List<Object>) requestData.get("params")).get(1))
.asInstanceOf(LIST)
.containsExactlyElementsOf(
Expand Down
Loading

0 comments on commit cf19ffb

Please sign in to comment.