Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ allprojects {
}

def nightly = System.getenv("NIGHTLY") != null
def refTestVersion = nightly ? "nightly" : "v1.7.0-alpha.8"
def refTestVersion = nightly ? "nightly" : "v1.7.0-alpha.9"
def blsRefTestVersion = 'v0.1.2'
def slashingProtectionInterchangeRefTestVersion = 'v5.3.0'
def refTestBaseUrl = 'https://github.com/ethereum/consensus-specs/releases/download'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,12 @@ public class ForkChoiceTestExecutor implements TestExecutor {
.put("fork_choice/ex_ante", new ForkChoiceTestExecutor())
.put("fork_choice/reorg", new ForkChoiceTestExecutor())
.put("fork_choice/on_block", new ForkChoiceTestExecutor())
.put(
"fork_choice/on_attestation",
IGNORE_TESTS) // TODO: https://github.com/Consensys/teku/issues/10773
.put("fork_choice/on_merge_block", IGNORE_TESTS) // TTD Logic is deprecated
.put("fork_choice/withholding", new ForkChoiceTestExecutor())
.put("sync/optimistic", new ForkChoiceTestExecutor())
.put("fork_choice/should_override_forkchoice_update", new ForkChoiceTestExecutor())
.put("fork_choice/get_proposer_head", new ForkChoiceTestExecutor())
.put("fork_choice/deposit_with_reorg", new ForkChoiceTestExecutor())
.put("fork_choice/get_parent_payload_status", new ForkChoiceTestExecutor())
Expand Down Expand Up @@ -645,21 +647,6 @@ private void applyChecks(
.isEqualTo(expectedProposerHead);
}

case "should_override_forkchoice_update" -> {
final Map<String, Boolean> shouldOverrideForkChoiceUpdateCheck = get(checks, checkType);
final boolean expectedResult = shouldOverrideForkChoiceUpdateCheck.get("result");
final boolean expectedValidatorIsConnected =
shouldOverrideForkChoiceUpdateCheck.get("validator_is_connected");
final boolean shouldOverrideChainHead =
recentChainData.shouldOverrideForkChoiceUpdate(
recentChainData.getBestBlockRoot().orElseThrow(),
recentChainData.getHeadSlot());
assertThat(shouldOverrideChainHead).isEqualTo(expectedResult);
// We've currently only handled the validatorIsConnected 'true' case in reftests,
// lets validate we're dealing with that and don't have to extend tests further.
assertThat(expectedValidatorIsConnected).isTrue();
}

case "viable_for_head_roots_and_weights" -> {
final List<Map<String, Object>> viableHeadRootsAndWeightsData = get(checks, checkType);
final Map<Bytes32, UInt64> viableHeadRootsAndWeights =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Optional;
import java.util.Set;
import org.apache.tuweni.bytes.Bytes32;
import org.opentest4j.TestAbortedException;
import tech.pegasys.teku.bls.BLSSignatureVerifier;
import tech.pegasys.teku.ethtests.finder.TestDefinition;
import tech.pegasys.teku.infrastructure.async.eventthread.InlineEventThread;
Expand Down Expand Up @@ -65,8 +66,18 @@

public class GossipBeaconBlockTestExecutor implements TestExecutor {

private final List<?> testsToSkip;

public GossipBeaconBlockTestExecutor(final String... testsToSkip) {
this.testsToSkip = List.of(testsToSkip);
}

@Override
public void runTest(final TestDefinition testDefinition) throws Throwable {
if (testsToSkip.contains(testDefinition.getTestName())) {
throw new TestAbortedException(
"Test " + testDefinition.getDisplayName() + " has been ignored");
}

final GossipBeaconBlockMetaData metaData =
loadYaml(testDefinition, "meta.yaml", GossipBeaconBlockMetaData.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,17 @@ public class GossipTests {
.put("networking/gossip_beacon_aggregate_and_proof", TestExecutor.IGNORE_TESTS)
.put("networking/gossip_beacon_attestation", TestExecutor.IGNORE_TESTS)
.put("networking/gossip_blob_sidecar", TestExecutor.IGNORE_TESTS)
.put("networking/gossip_data_column_sidecar", TestExecutor.IGNORE_TESTS)
.put("networking/gossip_partial_data_column_sidecar", TestExecutor.IGNORE_TESTS)
.put(
"networking/gossip_bls_to_execution_change",
new GossipBlsToExecutionChangeTestExecutor(
"gossip_bls_to_execution_change__ignore_pre_capella"))
.put("networking/gossip_beacon_block", new GossipBeaconBlockTestExecutor())
// TODO: https://github.com/Consensys/teku/issues/10781
.put(
"networking/gossip_beacon_block",
new GossipBeaconBlockTestExecutor(
"gossip_beacon_block__valid_at_blob_parameters_limit"))
.put(
"networking/gossip_sync_committee_contribution_and_proof",
new GossipSyncCommitteeContributionAndProofTestExecutor())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,20 @@ private static Stream<TestDefinition> findTestTypes(final Path specDirectory) th
List.of(),
List.of(
// TODO-GLOAS: the following tests require equivocation
// see https://github.com/Consensys/teku/issues/10608)
// see https://github.com/Consensys/teku/issues/10608
"gloas - minimal - fork_choice/reorg - include_votes_another_empty_chain_with_enough_ffg_votes_previous_epoch",
"gloas - minimal - fork_choice/reorg - simple_attempted_reorg_without_enough_ffg_votes")),
"gloas - minimal - fork_choice/reorg - simple_attempted_reorg_without_enough_ffg_votes",
"gloas - minimal - fork_choice/reorg - include_votes_another_empty_chain_with_enough_ffg_votes_current_epoch",
"gloas - minimal - fork_choice/reorg - include_votes_another_empty_chain_without_enough_ffg_votes_current_epoch",
// TODO-GLOAS: potentially requires the proposer boost changes
// https://github.com/Consensys/teku/pull/10783
"altair - minimal - fork_choice/on_block - justified_update_always_if_better",
"altair - minimal - fork_choice/get_head - voting_source_beyond_two_epoch",
"altair - minimal - fork_choice/on_block - justified_update_not_realized_finality",
// TODO: Will be fixed in a new consensus-specs release see
// https://discordapp.com/channels/595666850260713488/1511390998456963304
"fulu - minimal - transition/core",
"fulu - mainnet - transition/core")),
new MerkleProofTestFinder())
.flatMap(unchecked(finder -> finder.findTests(fork, spec, testsPath)));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,6 @@ public static Bytes uint256ToBytes(final UInt256 number) {
return Bytes32.leftPad(intBytes);
}

public static int intPlusMaxIntCapped(final int a, final int b) {
final UInt64 sum = UInt64.valueOf(a).plus(b);
if (sum.isLessThanOrEqualTo(UInt64.valueOf(Integer.MAX_VALUE))) {
return sum.intValue();
}
return Integer.MAX_VALUE;
}

public static int floorLog2(final int n) {
checkArgument(n >= 0, "Cannot calculate floorLog2 of negative number");
return 31 - Integer.numberOfLeadingZeros(n);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,25 +87,22 @@ public ExecutionRequestsProcessorElectra(
public void processDepositRequests(
final MutableBeaconState state, final List<DepositRequest> depositRequests) {
final MutableBeaconStateElectra stateElectra = MutableBeaconStateElectra.required(state);
final SszMutableList<PendingDeposit> pendingDeposits = stateElectra.getPendingDeposits();
final PendingDeposit.PendingDepositSchema pendingDepositSchema =
schemaDefinitions.getPendingDepositSchema();
for (DepositRequest depositRequest : depositRequests) {
final SszMutableList<PendingDeposit> pendingDeposits = stateElectra.getPendingDeposits();
if (stateElectra
.getDepositRequestsStartIndex()
.equals(SpecConfigElectra.UNSET_DEPOSIT_REQUESTS_START_INDEX)) {
stateElectra.setDepositRequestsStartIndex(depositRequest.getIndex());
}

final PendingDeposit deposit =
schemaDefinitions
.getPendingDepositSchema()
.create(
new SszPublicKey(depositRequest.getPubkey()),
SszBytes32.of(depositRequest.getWithdrawalCredentials()),
SszUInt64.of(depositRequest.getAmount()),
new SszSignature(depositRequest.getSignature()),
SszUInt64.of(state.getSlot()));
pendingDeposits.append(deposit);
;
pendingDeposits.append(
pendingDepositSchema.create(
new SszPublicKey(depositRequest.getPubkey()),
SszBytes32.of(depositRequest.getWithdrawalCredentials()),
SszUInt64.of(depositRequest.getAmount()),
new SszSignature(depositRequest.getSignature()),
SszUInt64.of(state.getSlot())));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import tech.pegasys.teku.spec.datastructures.state.Validator;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconStateCache;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.MutableBeaconState;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.electra.BeaconStateElectra;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.electra.MutableBeaconStateElectra;
import tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingConsolidation;
import tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingDeposit;
Expand Down Expand Up @@ -234,12 +235,7 @@ public void processPendingDeposits(final MutableBeaconState state) {

for (final PendingDeposit deposit : stateElectra.getPendingDeposits()) {
// Do not process deposit requests if Eth1 bridge deposits are not yet applied.
final boolean isDepositRequest = deposit.getSlot().isGreaterThan(GENESIS_SLOT);
final boolean hasPendingEth1BridgeDeposits =
stateElectra
.getEth1DepositIndex()
.isLessThan(stateElectra.getDepositRequestsStartIndex());
if (isDepositRequest && hasPendingEth1BridgeDeposits) {
if (mustWaitForEth1BridgeDeposits(deposit, stateElectra)) {
break;
}

Expand Down Expand Up @@ -304,6 +300,14 @@ public void processPendingDeposits(final MutableBeaconState state) {
}
}

public boolean mustWaitForEth1BridgeDeposits(
final PendingDeposit deposit, final BeaconStateElectra state) {
// Is deposit request
return deposit.getSlot().isGreaterThan(GENESIS_SLOT)
// There are pending Eth1 bridge deposits
&& state.getEth1DepositIndex().isLessThan(state.getDepositRequestsStartIndex());
}

/** process_pending_consolidations */
@Override
public void processPendingConsolidations(final MutableBeaconState state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import tech.pegasys.teku.spec.logic.versions.electra.weaksubjectivity.WeakSubjectivityCalculatorElectra;
import tech.pegasys.teku.spec.logic.versions.electra.withdrawals.WithdrawalsHelpersElectra;
import tech.pegasys.teku.spec.logic.versions.fulu.block.BlockProcessorFulu;
import tech.pegasys.teku.spec.logic.versions.fulu.execution.ExecutionRequestsProcessorFulu;
import tech.pegasys.teku.spec.logic.versions.fulu.forktransition.FuluStateUpgrade;
import tech.pegasys.teku.spec.logic.versions.fulu.helpers.BeaconStateAccessorsFulu;
import tech.pegasys.teku.spec.logic.versions.fulu.helpers.MiscHelpersFulu;
Expand Down Expand Up @@ -186,8 +187,8 @@ public static SpecLogicFulu create(
final WithdrawalsHelpersElectra withdrawalsHelpers =
new WithdrawalsHelpersElectra(
schemaDefinitions, miscHelpers, config, predicates, beaconStateMutators);
final ExecutionRequestsProcessorElectra executionRequestsProcessor =
new ExecutionRequestsProcessorElectra(
final ExecutionRequestsProcessorFulu executionRequestsProcessor =
new ExecutionRequestsProcessorFulu(
schemaDefinitions,
miscHelpers,
config,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@

package tech.pegasys.teku.spec.logic.versions.fulu.block;

import static com.google.common.base.Preconditions.checkArgument;

import tech.pegasys.teku.infrastructure.ssz.SszList;
import tech.pegasys.teku.spec.config.SpecConfigElectra;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionRequestsDataCodec;
import tech.pegasys.teku.spec.datastructures.operations.Deposit;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.MutableBeaconState;
import tech.pegasys.teku.spec.logic.common.helpers.Predicates;
import tech.pegasys.teku.spec.logic.common.operations.OperationSignatureVerifier;
import tech.pegasys.teku.spec.logic.common.operations.validation.OperationValidator;
Expand Down Expand Up @@ -75,4 +81,18 @@ public int getMaxBlobsPerBlock(final BeaconState state) {
.getBlobParameters(miscHelpers.computeEpochAtSlot(state.getSlot()))
.maxBlobsPerBlock();
}

// modified to remove support for the former deposit mechanism.
@Override
protected void verifyOutstandingDepositsAreProcessed(
final BeaconState state, final BeaconBlockBody body) {
checkArgument(
body.getDeposits().isEmpty(),
"process_operations: Verify that former deposit mechanism has been disabled");
}

@Override
public void processDeposits(final MutableBeaconState state, final SszList<Deposit> deposits) {
// NOOP
}
Comment thread
cursor[bot] marked this conversation as resolved.
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright Consensys Software Inc., 2026
*
* 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.logic.versions.fulu.execution;

import java.util.List;
import tech.pegasys.teku.infrastructure.ssz.SszMutableList;
import tech.pegasys.teku.infrastructure.ssz.primitive.SszBytes32;
import tech.pegasys.teku.infrastructure.ssz.primitive.SszUInt64;
import tech.pegasys.teku.spec.config.SpecConfigFulu;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequest;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.MutableBeaconState;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.electra.MutableBeaconStateElectra;
import tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingDeposit;
import tech.pegasys.teku.spec.datastructures.type.SszPublicKey;
import tech.pegasys.teku.spec.datastructures.type.SszSignature;
import tech.pegasys.teku.spec.logic.common.util.ValidatorsUtil;
import tech.pegasys.teku.spec.logic.versions.electra.execution.ExecutionRequestsProcessorElectra;
import tech.pegasys.teku.spec.logic.versions.electra.helpers.BeaconStateMutatorsElectra;
import tech.pegasys.teku.spec.logic.versions.electra.helpers.PredicatesElectra;
import tech.pegasys.teku.spec.logic.versions.fulu.helpers.BeaconStateAccessorsFulu;
import tech.pegasys.teku.spec.logic.versions.fulu.helpers.MiscHelpersFulu;
import tech.pegasys.teku.spec.schemas.SchemaDefinitionsFulu;

public class ExecutionRequestsProcessorFulu extends ExecutionRequestsProcessorElectra {

public ExecutionRequestsProcessorFulu(
final SchemaDefinitionsFulu schemaDefinitions,
final MiscHelpersFulu miscHelpers,
final SpecConfigFulu specConfig,
final PredicatesElectra predicates,
final ValidatorsUtil validatorsUtil,
final BeaconStateMutatorsElectra beaconStateMutators,
final BeaconStateAccessorsFulu beaconStateAccessors) {
super(
schemaDefinitions,
miscHelpers,
specConfig,
predicates,
validatorsUtil,
beaconStateMutators,
beaconStateAccessors);
}

/*
The function `process_deposit_request` is modified to remove support for the former deposit mechanism.
*/
@Override
public void processDepositRequests(
final MutableBeaconState state, final List<DepositRequest> depositRequests) {
final MutableBeaconStateElectra stateElectra = MutableBeaconStateElectra.required(state);
final SszMutableList<PendingDeposit> pendingDeposits = stateElectra.getPendingDeposits();
final PendingDeposit.PendingDepositSchema pendingDepositSchema =
schemaDefinitions.getPendingDepositSchema();
for (DepositRequest depositRequest : depositRequests) {
pendingDeposits.append(
pendingDepositSchema.create(
new SszPublicKey(depositRequest.getPubkey()),
SszBytes32.of(depositRequest.getWithdrawalCredentials()),
SszUInt64.of(depositRequest.getAmount()),
new SszSignature(depositRequest.getSignature()),
SszUInt64.of(state.getSlot())));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ public Optional<MiscHelpersFulu> toVersionFulu() {
return Optional.of(this);
}

// modified to remove support for the former deposit mechanism
@Override
public boolean isFormerDepositMechanismDisabled(final BeaconState state) {
return true;
}

// compute_fork_digest
public Bytes4 computeForkDigest(final Bytes32 genesisValidatorsRoot, final UInt64 epoch) {
final Bytes4 forkVersion = computeForkVersion(epoch);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.config.SpecConfigFulu;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.MutableBeaconState;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.electra.BeaconStateElectra;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.fulu.MutableBeaconStateFulu;
import tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingDeposit;
import tech.pegasys.teku.spec.logic.common.helpers.BeaconStateMutators;
import tech.pegasys.teku.spec.logic.common.statetransition.epoch.status.ValidatorStatusFactory;
import tech.pegasys.teku.spec.logic.common.util.BeaconStateUtil;
Expand Down Expand Up @@ -59,6 +61,13 @@ public EpochProcessorFulu(
this.schemaDefinitionsFulu = SchemaDefinitionsFulu.required(schemaDefinitions);
}

// modified to remove support for the former deposit mechanism
@Override
public boolean mustWaitForEth1BridgeDeposits(
final PendingDeposit deposit, final BeaconStateElectra state) {
return false;
}

/** process_proposer_lookahead */
@Override
public void processProposerLookahead(final MutableBeaconState state) {
Expand Down
Loading
Loading