diff --git a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/Eth2ReferenceTestCase.java b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/Eth2ReferenceTestCase.java index 3a6cbe9132e..89c765f7acc 100644 --- a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/Eth2ReferenceTestCase.java +++ b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/Eth2ReferenceTestCase.java @@ -61,9 +61,7 @@ public abstract class Eth2ReferenceTestCase { .build(); private final ImmutableMap MERGE_TEST_TYPES = - ImmutableMap.builder() - .putAll(RewardsTestExecutorPhase0.REWARDS_TEST_TYPES) - .build(); + ImmutableMap.builder().putAll(ALTAIR_TEST_TYPES).build(); protected void runReferenceTest(final TestDefinition testDefinition) throws Throwable { setConstants(testDefinition.getConfigName()); diff --git a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/ManualReferenceTestRunner.java b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/ManualReferenceTestRunner.java index 0e4974c9cbb..ff596a598b0 100644 --- a/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/ManualReferenceTestRunner.java +++ b/eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/ManualReferenceTestRunner.java @@ -59,7 +59,6 @@ static Stream loadReferenceTests() throws IOException { testDefinition -> SPEC.isBlank() || testDefinition.getConfigName().equalsIgnoreCase(SPEC)) .filter(testDefinition -> testDefinition.getTestType().startsWith(TEST_TYPE)) - .filter(testDefinition -> testDefinition.getDisplayName().contains("merge")) .map(testDefinition -> Arguments.of(testDefinition.getDisplayName(), testDefinition)); } } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/DelegatingSpecConfig.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/DelegatingSpecConfig.java index 549162a22bf..e9275ea3b7b 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/DelegatingSpecConfig.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/DelegatingSpecConfig.java @@ -14,7 +14,6 @@ package tech.pegasys.teku.spec.config; import java.util.Map; -import java.util.Optional; import org.apache.tuweni.bytes.Bytes; import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.ssz.type.Bytes4; @@ -290,14 +289,4 @@ public int getDepositNetworkId() { public Bytes getDepositContractAddress() { return specConfig.getDepositContractAddress(); } - - @Override - public Optional toVersionAltair() { - return specConfig.toVersionAltair(); - } - - @Override - public Optional toVersionMerge() { - return specConfig.toVersionMerge(); - } } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/DelegatingSpecConfigAltair.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/DelegatingSpecConfigAltair.java new file mode 100644 index 00000000000..477cc211a85 --- /dev/null +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/DelegatingSpecConfigAltair.java @@ -0,0 +1,83 @@ +/* + * Copyright 2021 ConsenSys AG. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package tech.pegasys.teku.spec.config; + +import java.util.Optional; +import tech.pegasys.teku.infrastructure.unsigned.UInt64; +import tech.pegasys.teku.ssz.type.Bytes4; + +public class DelegatingSpecConfigAltair extends DelegatingSpecConfig implements SpecConfigAltair { + + private final SpecConfigAltair specConfigAltair; + + public DelegatingSpecConfigAltair(final SpecConfigAltair specConfig) { + super(specConfig); + this.specConfigAltair = specConfig; + } + + @Override + public Bytes4 getAltairForkVersion() { + return specConfigAltair.getAltairForkVersion(); + } + + @Override + public UInt64 getAltairForkEpoch() { + return specConfigAltair.getAltairForkEpoch(); + } + + @Override + public UInt64 getInactivityPenaltyQuotientAltair() { + return specConfigAltair.getInactivityPenaltyQuotientAltair(); + } + + @Override + public int getMinSlashingPenaltyQuotientAltair() { + return specConfigAltair.getMinSlashingPenaltyQuotientAltair(); + } + + @Override + public int getProportionalSlashingMultiplierAltair() { + return specConfigAltair.getProportionalSlashingMultiplierAltair(); + } + + @Override + public int getSyncCommitteeSize() { + return specConfigAltair.getSyncCommitteeSize(); + } + + @Override + public UInt64 getInactivityScoreBias() { + return specConfigAltair.getInactivityScoreBias(); + } + + @Override + public UInt64 getInactivityScoreRecoveryRate() { + return specConfigAltair.getInactivityScoreRecoveryRate(); + } + + @Override + public int getEpochsPerSyncCommitteePeriod() { + return specConfigAltair.getEpochsPerSyncCommitteePeriod(); + } + + @Override + public int getMinSyncCommitteeParticipants() { + return specConfigAltair.getMinSyncCommitteeParticipants(); + } + + @Override + public Optional toVersionAltair() { + return Optional.of(this); + } +} diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigAltair.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigAltair.java index f321b2c56ac..63ed6f201a8 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigAltair.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigAltair.java @@ -13,59 +13,13 @@ package tech.pegasys.teku.spec.config; -import java.util.Objects; import java.util.Optional; import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.ssz.type.Bytes4; -public class SpecConfigAltair extends DelegatingSpecConfig { +public interface SpecConfigAltair extends SpecConfig { - // Updated penalties - private final UInt64 inactivityPenaltyQuotientAltair; - private final int minSlashingPenaltyQuotientAltair; - private final int proportionalSlashingMultiplierAltair; - - // Misc - private final int syncCommitteeSize; - private final UInt64 inactivityScoreBias; - private final UInt64 inactivityScoreRecoveryRate; - - // Time - private final int epochsPerSyncCommitteePeriod; - - // Fork - private final Bytes4 altairForkVersion; - private final UInt64 altairForkEpoch; - - // Sync protocol - private final int minSyncCommitteeParticipants; - - public SpecConfigAltair( - final SpecConfig specConfig, - final UInt64 inactivityPenaltyQuotientAltair, - final int altairMinSlashingPenaltyQuotient, - final int proportionalSlashingMultiplierAltair, - final int syncCommitteeSize, - final UInt64 inactivityScoreBias, - final UInt64 inactivityScoreRecoveryRate, - final int epochsPerSyncCommitteePeriod, - final Bytes4 altairForkVersion, - final UInt64 altairForkEpoch, - final int minSyncCommitteeParticipants) { - super(specConfig); - this.inactivityPenaltyQuotientAltair = inactivityPenaltyQuotientAltair; - this.minSlashingPenaltyQuotientAltair = altairMinSlashingPenaltyQuotient; - this.proportionalSlashingMultiplierAltair = proportionalSlashingMultiplierAltair; - this.syncCommitteeSize = syncCommitteeSize; - this.inactivityScoreBias = inactivityScoreBias; - this.inactivityScoreRecoveryRate = inactivityScoreRecoveryRate; - this.epochsPerSyncCommitteePeriod = epochsPerSyncCommitteePeriod; - this.altairForkVersion = altairForkVersion; - this.altairForkEpoch = altairForkEpoch; - this.minSyncCommitteeParticipants = minSyncCommitteeParticipants; - } - - public static SpecConfigAltair required(final SpecConfig specConfig) { + static SpecConfigAltair required(SpecConfig specConfig) { return specConfig .toVersionAltair() .orElseThrow( @@ -75,82 +29,26 @@ public static SpecConfigAltair required(final SpecConfig specConfig) { + specConfig.getClass().getSimpleName())); } - public Bytes4 getAltairForkVersion() { - return altairForkVersion; - } - - public UInt64 getAltairForkEpoch() { - return altairForkEpoch; - } - - public UInt64 getInactivityPenaltyQuotientAltair() { - return inactivityPenaltyQuotientAltair; - } + Bytes4 getAltairForkVersion(); - public int getMinSlashingPenaltyQuotientAltair() { - return minSlashingPenaltyQuotientAltair; - } + UInt64 getAltairForkEpoch(); - public int getProportionalSlashingMultiplierAltair() { - return proportionalSlashingMultiplierAltair; - } + UInt64 getInactivityPenaltyQuotientAltair(); - public int getSyncCommitteeSize() { - return syncCommitteeSize; - } + int getMinSlashingPenaltyQuotientAltair(); - public UInt64 getInactivityScoreBias() { - return inactivityScoreBias; - } + int getProportionalSlashingMultiplierAltair(); - public UInt64 getInactivityScoreRecoveryRate() { - return inactivityScoreRecoveryRate; - } + int getSyncCommitteeSize(); - public int getEpochsPerSyncCommitteePeriod() { - return epochsPerSyncCommitteePeriod; - } + UInt64 getInactivityScoreBias(); - public int getMinSyncCommitteeParticipants() { - return minSyncCommitteeParticipants; - } + UInt64 getInactivityScoreRecoveryRate(); - @Override - public Optional toVersionAltair() { - return Optional.of(this); - } + int getEpochsPerSyncCommitteePeriod(); - @Override - public boolean equals(final Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - final SpecConfigAltair that = (SpecConfigAltair) o; - return Objects.equals(specConfig, that.specConfig) - && minSlashingPenaltyQuotientAltair == that.minSlashingPenaltyQuotientAltair - && proportionalSlashingMultiplierAltair == that.proportionalSlashingMultiplierAltair - && syncCommitteeSize == that.syncCommitteeSize - && Objects.equals(inactivityScoreBias, that.inactivityScoreBias) - && Objects.equals(inactivityScoreRecoveryRate, that.inactivityScoreRecoveryRate) - && epochsPerSyncCommitteePeriod == that.epochsPerSyncCommitteePeriod - && minSyncCommitteeParticipants == that.minSyncCommitteeParticipants - && Objects.equals(inactivityPenaltyQuotientAltair, that.inactivityPenaltyQuotientAltair) - && Objects.equals(altairForkVersion, that.altairForkVersion) - && Objects.equals(altairForkEpoch, that.altairForkEpoch); - } + int getMinSyncCommitteeParticipants(); @Override - public int hashCode() { - return Objects.hash( - specConfig, - inactivityPenaltyQuotientAltair, - minSlashingPenaltyQuotientAltair, - proportionalSlashingMultiplierAltair, - syncCommitteeSize, - inactivityScoreBias, - inactivityScoreRecoveryRate, - epochsPerSyncCommitteePeriod, - altairForkVersion, - altairForkEpoch, - minSyncCommitteeParticipants); - } + Optional toVersionAltair(); } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigAltairImpl.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigAltairImpl.java new file mode 100644 index 00000000000..78e2fd016af --- /dev/null +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigAltairImpl.java @@ -0,0 +1,156 @@ +/* + * Copyright 2021 ConsenSys AG. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package tech.pegasys.teku.spec.config; + +import java.util.Objects; +import java.util.Optional; +import tech.pegasys.teku.infrastructure.unsigned.UInt64; +import tech.pegasys.teku.ssz.type.Bytes4; + +public class SpecConfigAltairImpl extends DelegatingSpecConfig implements SpecConfigAltair { + + // Updated penalties + private final UInt64 inactivityPenaltyQuotientAltair; + private final int minSlashingPenaltyQuotientAltair; + private final int proportionalSlashingMultiplierAltair; + + // Misc + private final int syncCommitteeSize; + private final UInt64 inactivityScoreBias; + private final UInt64 inactivityScoreRecoveryRate; + + // Time + private final int epochsPerSyncCommitteePeriod; + + // Fork + private final Bytes4 altairForkVersion; + private final UInt64 altairForkEpoch; + + // Sync protocol + private final int minSyncCommitteeParticipants; + + public SpecConfigAltairImpl( + final SpecConfig specConfig, + final UInt64 inactivityPenaltyQuotientAltair, + final int altairMinSlashingPenaltyQuotient, + final int proportionalSlashingMultiplierAltair, + final int syncCommitteeSize, + final UInt64 inactivityScoreBias, + final UInt64 inactivityScoreRecoveryRate, + final int epochsPerSyncCommitteePeriod, + final Bytes4 altairForkVersion, + final UInt64 altairForkEpoch, + final int minSyncCommitteeParticipants) { + super(specConfig); + this.inactivityPenaltyQuotientAltair = inactivityPenaltyQuotientAltair; + this.minSlashingPenaltyQuotientAltair = altairMinSlashingPenaltyQuotient; + this.proportionalSlashingMultiplierAltair = proportionalSlashingMultiplierAltair; + this.syncCommitteeSize = syncCommitteeSize; + this.inactivityScoreBias = inactivityScoreBias; + this.inactivityScoreRecoveryRate = inactivityScoreRecoveryRate; + this.epochsPerSyncCommitteePeriod = epochsPerSyncCommitteePeriod; + this.altairForkVersion = altairForkVersion; + this.altairForkEpoch = altairForkEpoch; + this.minSyncCommitteeParticipants = minSyncCommitteeParticipants; + } + + @Override + public Bytes4 getAltairForkVersion() { + return altairForkVersion; + } + + @Override + public UInt64 getAltairForkEpoch() { + return altairForkEpoch; + } + + @Override + public UInt64 getInactivityPenaltyQuotientAltair() { + return inactivityPenaltyQuotientAltair; + } + + @Override + public int getMinSlashingPenaltyQuotientAltair() { + return minSlashingPenaltyQuotientAltair; + } + + @Override + public int getProportionalSlashingMultiplierAltair() { + return proportionalSlashingMultiplierAltair; + } + + @Override + public int getSyncCommitteeSize() { + return syncCommitteeSize; + } + + @Override + public UInt64 getInactivityScoreBias() { + return inactivityScoreBias; + } + + @Override + public UInt64 getInactivityScoreRecoveryRate() { + return inactivityScoreRecoveryRate; + } + + @Override + public int getEpochsPerSyncCommitteePeriod() { + return epochsPerSyncCommitteePeriod; + } + + @Override + public int getMinSyncCommitteeParticipants() { + return minSyncCommitteeParticipants; + } + + @Override + public Optional toVersionAltair() { + return Optional.of(this); + } + + @Override + public boolean equals(final Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + final SpecConfigAltairImpl that = (SpecConfigAltairImpl) o; + return Objects.equals(specConfig, that.specConfig) + && minSlashingPenaltyQuotientAltair == that.minSlashingPenaltyQuotientAltair + && proportionalSlashingMultiplierAltair == that.proportionalSlashingMultiplierAltair + && syncCommitteeSize == that.syncCommitteeSize + && Objects.equals(inactivityScoreBias, that.inactivityScoreBias) + && Objects.equals(inactivityScoreRecoveryRate, that.inactivityScoreRecoveryRate) + && epochsPerSyncCommitteePeriod == that.epochsPerSyncCommitteePeriod + && minSyncCommitteeParticipants == that.minSyncCommitteeParticipants + && Objects.equals(inactivityPenaltyQuotientAltair, that.inactivityPenaltyQuotientAltair) + && Objects.equals(altairForkVersion, that.altairForkVersion) + && Objects.equals(altairForkEpoch, that.altairForkEpoch); + } + + @Override + public int hashCode() { + return Objects.hash( + specConfig, + inactivityPenaltyQuotientAltair, + minSlashingPenaltyQuotientAltair, + proportionalSlashingMultiplierAltair, + syncCommitteeSize, + inactivityScoreBias, + inactivityScoreRecoveryRate, + epochsPerSyncCommitteePeriod, + altairForkVersion, + altairForkEpoch, + minSyncCommitteeParticipants); + } +} diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigBuilder.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigBuilder.java index 176553c8220..6a4695aa86a 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigBuilder.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigBuilder.java @@ -158,10 +158,11 @@ public SpecConfig build() { depositContractAddress); if (altairBuilder.isPresent()) { - config = altairBuilder.get().build(config); - } - if (mergeBuilder.isPresent()) { - config = mergeBuilder.get().build(config); + final SpecConfigAltair altairConfig = altairBuilder.get().build(config); + config = altairConfig; + if (mergeBuilder.isPresent()) { + config = mergeBuilder.get().build(altairConfig); + } } return config; } @@ -570,7 +571,7 @@ public class AltairBuilder { private AltairBuilder() {} SpecConfigAltair build(final SpecConfig specConfig) { - return new SpecConfigAltair( + return new SpecConfigAltairImpl( specConfig, inactivityPenaltyQuotientAltair, minSlashingPenaltyQuotientAltair, @@ -683,7 +684,7 @@ public class MergeBuilder { private MergeBuilder() {} - SpecConfigMerge build(final SpecConfig specConfig) { + SpecConfigMerge build(final SpecConfigAltair specConfig) { return new SpecConfigMerge( specConfig, mergeForkVersion, diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigMerge.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigMerge.java index 5fb3c9b74ba..825afb96422 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigMerge.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/config/SpecConfigMerge.java @@ -20,7 +20,7 @@ import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.ssz.type.Bytes4; -public class SpecConfigMerge extends DelegatingSpecConfig { +public class SpecConfigMerge extends DelegatingSpecConfigAltair { // Fork private final Bytes4 mergeForkVersion; @@ -31,7 +31,7 @@ public class SpecConfigMerge extends DelegatingSpecConfig { private final UInt256 minAnchorPowBlockDifficulty; public SpecConfigMerge( - SpecConfig specConfig, + SpecConfigAltair specConfig, Bytes4 mergeForkVersion, UInt64 mergeForkEpoch, UInt64 targetSecondsToMerge, diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/state/beaconstate/BeaconStateSchema.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/state/beaconstate/BeaconStateSchema.java index b53dac1b1fd..636ae9581cd 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/state/beaconstate/BeaconStateSchema.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/state/beaconstate/BeaconStateSchema.java @@ -91,6 +91,10 @@ default SyncCommitteeSchema getCurrentSyncCommitteeSchemaOrThrow() { return (SyncCommitteeSchema) getSchemaOrThrow(BeaconStateFields.CURRENT_SYNC_COMMITTEE); } + default SyncCommitteeSchema getNextSyncCommitteeSchemaOrThrow() { + return (SyncCommitteeSchema) getSchemaOrThrow(BeaconStateFields.NEXT_SYNC_COMMITTEE); + } + private SszSchema getSchemaOrThrow(final BeaconStateFields field) { final String fieldName = field.name(); final int fieldIndex = getFieldIndex(fieldName); diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/altair/helpers/BeaconStateAccessorsAltair.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/altair/helpers/BeaconStateAccessorsAltair.java index ea7a3d5b3f9..f7dc15d8f33 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/altair/helpers/BeaconStateAccessorsAltair.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/altair/helpers/BeaconStateAccessorsAltair.java @@ -36,7 +36,6 @@ import tech.pegasys.teku.spec.datastructures.state.Validator; import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState; import tech.pegasys.teku.spec.datastructures.state.beaconstate.MutableBeaconState; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.altair.BeaconStateSchemaAltair; import tech.pegasys.teku.spec.datastructures.type.SszPublicKey; import tech.pegasys.teku.spec.logic.common.helpers.BeaconStateAccessors; import tech.pegasys.teku.spec.logic.common.helpers.MiscHelpers; @@ -146,8 +145,9 @@ public SyncCommittee getNextSyncCommittee(final BeaconState state) { .collect(toList()); final BLSPublicKey aggregatePubkey = BLSPublicKey.aggregate(pubkeys); - return ((BeaconStateSchemaAltair) state.getSchema()) - .getNextSyncCommitteeSchema() + return state + .getBeaconStateSchema() + .getNextSyncCommitteeSchemaOrThrow() .create( pubkeys.stream().map(SszPublicKey::new).collect(toList()), new SszPublicKey(aggregatePubkey)); diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/merge/SpecLogicMerge.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/merge/SpecLogicMerge.java index a3e8d6598a3..74032c71bc2 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/merge/SpecLogicMerge.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/merge/SpecLogicMerge.java @@ -20,8 +20,6 @@ import tech.pegasys.teku.spec.datastructures.forkchoice.TransitionStore; import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState; import tech.pegasys.teku.spec.logic.common.AbstractSpecLogic; -import tech.pegasys.teku.spec.logic.common.helpers.BeaconStateAccessors; -import tech.pegasys.teku.spec.logic.common.helpers.BeaconStateMutators; import tech.pegasys.teku.spec.logic.common.helpers.MergeTransitionHelpers; import tech.pegasys.teku.spec.logic.common.helpers.PowBlock; import tech.pegasys.teku.spec.logic.common.helpers.Predicates; @@ -34,6 +32,7 @@ import tech.pegasys.teku.spec.logic.common.util.ForkChoiceUtil; import tech.pegasys.teku.spec.logic.common.util.SyncCommitteeUtil; import tech.pegasys.teku.spec.logic.common.util.ValidatorsUtil; +import tech.pegasys.teku.spec.logic.versions.altair.helpers.BeaconStateMutatorsAltair; import tech.pegasys.teku.spec.logic.versions.altair.statetransition.epoch.EpochProcessorAltair; import tech.pegasys.teku.spec.logic.versions.altair.statetransition.epoch.ValidatorStatusFactoryAltair; import tech.pegasys.teku.spec.logic.versions.merge.block.BlockProcessorMerge; @@ -54,8 +53,8 @@ public class SpecLogicMerge extends AbstractSpecLogic { private SpecLogicMerge( final Predicates predicates, final MiscHelpersMerge miscHelpers, - final BeaconStateAccessors beaconStateAccessors, - final BeaconStateMutators beaconStateMutators, + final BeaconStateAccessorsMerge beaconStateAccessors, + final BeaconStateMutatorsAltair beaconStateMutators, final OperationSignatureVerifier operationSignatureVerifier, final ValidatorsUtil validatorsUtil, final BeaconStateUtil beaconStateUtil, @@ -101,8 +100,8 @@ public static SpecLogicMerge create( final MiscHelpersMerge miscHelpers = new MiscHelpersMerge(config); final BeaconStateAccessorsMerge beaconStateAccessors = new BeaconStateAccessorsMerge(config, predicates, miscHelpers); - final BeaconStateMutators beaconStateMutators = - new BeaconStateMutators(config, miscHelpers, beaconStateAccessors); + final BeaconStateMutatorsAltair beaconStateMutators = + new BeaconStateMutatorsAltair(config, miscHelpers, beaconStateAccessors); // Operation validaton final OperationSignatureVerifier operationSignatureVerifier = diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/merge/block/BlockProcessorMerge.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/merge/block/BlockProcessorMerge.java index 866a6a5adb5..df337701a75 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/merge/block/BlockProcessorMerge.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/merge/block/BlockProcessorMerge.java @@ -26,7 +26,6 @@ import tech.pegasys.teku.spec.cache.IndexedAttestationCache; import tech.pegasys.teku.spec.config.SpecConfigMerge; import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair.SyncAggregate; import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.merge.BeaconBlockBodyMerge; import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload; import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeader; @@ -96,13 +95,6 @@ public static BlockProcessorMerge required(BlockProcessor blockProcessor) { return (BlockProcessorMerge) blockProcessor; } - @Override - public void processSyncAggregate( - MutableBeaconState state, SyncAggregate syncAggregate, BLSSignatureVerifier signatureVerifier) - throws BlockProcessingException { - throw new UnsupportedOperationException("No SyncCommittee in merge"); - } - @Override public void processBlock( MutableBeaconState genericState, diff --git a/ethereum/spec/src/test/java/tech/pegasys/teku/spec/config/SpecConfigAltairTest.java b/ethereum/spec/src/test/java/tech/pegasys/teku/spec/config/SpecConfigAltairTest.java index 2bd33733989..d64f998db66 100644 --- a/ethereum/spec/src/test/java/tech/pegasys/teku/spec/config/SpecConfigAltairTest.java +++ b/ethereum/spec/src/test/java/tech/pegasys/teku/spec/config/SpecConfigAltairTest.java @@ -69,7 +69,7 @@ public void equals_phase0ConfigDiffer() { private SpecConfigAltair createRandomAltairConfig(final SpecConfig phase0Config, final int seed) { final DataStructureUtil dataStructureUtil = new DataStructureUtil(seed, spec); - return new SpecConfigAltair( + return new SpecConfigAltairImpl( phase0Config, dataStructureUtil.randomUInt64(), dataStructureUtil.randomPositiveInt(), diff --git a/ethereum/spec/src/test/java/tech/pegasys/teku/spec/config/SpecConfigAssertions.java b/ethereum/spec/src/test/java/tech/pegasys/teku/spec/config/SpecConfigAssertions.java index d2aa8515ae3..6dbb2d4ef89 100644 --- a/ethereum/spec/src/test/java/tech/pegasys/teku/spec/config/SpecConfigAssertions.java +++ b/ethereum/spec/src/test/java/tech/pegasys/teku/spec/config/SpecConfigAssertions.java @@ -28,7 +28,7 @@ static void assertAllPhase0FieldsSet(final SpecConfig config) throws Exception { } static void assertAllAltairFieldsSet(final SpecConfig config) throws Exception { - assertAllFieldsSet(config, SpecConfigAltair.class); + assertAllFieldsSet(config, SpecConfigAltairImpl.class); } static void assertAllMergeFieldsSet(final SpecConfig config) throws Exception {