From e8eee85145eb39bf9f040875e0cf6a8f792788ab Mon Sep 17 00:00:00 2001 From: Justin Traglia <95511699+jtraglia@users.noreply.github.com> Date: Mon, 15 Apr 2024 17:47:43 -0500 Subject: [PATCH] Fix minor nits in new electra state changes (#8194) Co-authored-by: Paul Harris --- .../teku/api/schema/electra/PendingConsolidation.java | 2 +- .../api/schema/electra/PendingPartialWithdrawal.java | 2 +- .../state/beaconstate/common/BeaconStateFields.java | 1 - .../versions/electra/MutableBeaconStateElectra.java | 10 +++++----- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/PendingConsolidation.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/PendingConsolidation.java index cdf90d4400c..820a07c435d 100644 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/PendingConsolidation.java +++ b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/PendingConsolidation.java @@ -47,7 +47,7 @@ public PendingConsolidation( spec.getSchemaDefinitions().toVersionElectra(); if (schemaDefinitionsElectra.isEmpty()) { throw new IllegalArgumentException( - "Could not create PendingBalanceDeposit for pre-electra spec"); + "Could not create PendingConsolidation for pre-electra spec"); } return schemaDefinitionsElectra .get() diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/PendingPartialWithdrawal.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/PendingPartialWithdrawal.java index 96f295c84d2..716b5c43c7d 100644 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/PendingPartialWithdrawal.java +++ b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/PendingPartialWithdrawal.java @@ -53,7 +53,7 @@ public PendingPartialWithdrawal( spec.getSchemaDefinitions().toVersionElectra(); if (schemaDefinitionsElectra.isEmpty()) { throw new IllegalArgumentException( - "Could not create PendingBalanceDeposit for pre-electra spec"); + "Could not create PendingPartialWithdrawal for pre-electra spec"); } return schemaDefinitionsElectra .get() diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/state/beaconstate/common/BeaconStateFields.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/state/beaconstate/common/BeaconStateFields.java index aeed13192f9..a5f5fe94b32 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/state/beaconstate/common/BeaconStateFields.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/state/beaconstate/common/BeaconStateFields.java @@ -71,7 +71,6 @@ public enum BeaconStateFields implements SszFieldName { HISTORICAL_SUMMARIES, // Electra fields DEPOSIT_RECEIPTS_START_INDEX, - DEPOSIT_BALANCE_TO_CONSUME, EXIT_BALANCE_TO_CONSUME, EARLIEST_EXIT_EPOCH, diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/state/beaconstate/versions/electra/MutableBeaconStateElectra.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/state/beaconstate/versions/electra/MutableBeaconStateElectra.java index 7db3042e85e..73e1c02effc 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/state/beaconstate/versions/electra/MutableBeaconStateElectra.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/state/beaconstate/versions/electra/MutableBeaconStateElectra.java @@ -37,17 +37,17 @@ static MutableBeaconStateElectra required(final MutableBeaconState state) { @Override BeaconStateElectra commitChanges(); + @Override + default Optional toMutableVersionElectra() { + return Optional.of(this); + } + default void setDepositReceiptsStartIndex(final UInt64 depositReceiptsStartIndex) { final int fieldIndex = getSchema().getFieldIndex(BeaconStateFields.DEPOSIT_RECEIPTS_START_INDEX); set(fieldIndex, SszUInt64.of(depositReceiptsStartIndex)); } - @Override - default Optional toMutableVersionElectra() { - return Optional.of(this); - } - default void setDepositBalanceToConsume(final UInt64 depositBalanceToConsume) { final int fieldIndex = getSchema().getFieldIndex(BeaconStateFields.DEPOSIT_BALANCE_TO_CONSUME); set(fieldIndex, SszUInt64.of(depositBalanceToConsume));