Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@
import tech.pegasys.teku.statetransition.util.FutureItems;
import tech.pegasys.teku.statetransition.util.PendingPool;
import tech.pegasys.teku.statetransition.util.PoolFactory;
import tech.pegasys.teku.statetransition.validation.BlockGossipValidator;
import tech.pegasys.teku.statetransition.validation.BlockValidator;
import tech.pegasys.teku.statetransition.validation.GossipValidationHelper;
import tech.pegasys.teku.statetransition.validation.block.BlockGossipValidator;
import tech.pegasys.teku.statetransition.validation.block.EquivocationChecker;
import tech.pegasys.teku.storage.api.FinalizedCheckpointChannel;
import tech.pegasys.teku.storage.client.MemoryOnlyRecentChainData;
import tech.pegasys.teku.storage.client.RecentChainData;
Expand Down Expand Up @@ -133,7 +134,8 @@ public static SyncingNodeManager create(
new BlockGossipValidator(
spec,
new GossipValidationHelper(spec, recentChainData),
receivedBlockEventsChannelPublisher);
receivedBlockEventsChannelPublisher,
new EquivocationChecker());
final BlockValidator blockValidator = new BlockValidator(blockGossipValidator);

final TimeProvider timeProvider = new SystemTimeProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.validator.BroadcastValidationLevel;
import tech.pegasys.teku.spec.logic.common.statetransition.results.BlockImportResult;
import tech.pegasys.teku.statetransition.validation.block.BlockGossipValidator;

public interface BlockBroadcastValidator {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.validator.BroadcastValidationLevel;
import tech.pegasys.teku.spec.logic.common.statetransition.results.BlockImportResult;
import tech.pegasys.teku.statetransition.validation.BlockGossipValidator.EquivocationCheckResult;
import tech.pegasys.teku.statetransition.validation.block.BlockGossipValidator;
import tech.pegasys.teku.statetransition.validation.block.EquivocationChecker;

class BlockBroadcastValidatorImpl implements BlockBroadcastValidator {
private final BlockGossipValidator blockGossipValidator;
Expand Down Expand Up @@ -171,6 +172,6 @@ private void buildValidationPipeline(final SignedBeaconBlock block) {
private boolean isEquivocatingBlock(final SignedBeaconBlock block, final boolean markAsReceived) {
return blockGossipValidator
.performBlockEquivocationCheck(markAsReceived, block)
.equals(EquivocationCheckResult.EQUIVOCATING_BLOCK_FOR_SLOT_PROPOSER);
.equals(EquivocationChecker.EquivocationCheckResult.EQUIVOCATING_BLOCK_FOR_SLOT_PROPOSER);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import tech.pegasys.teku.infrastructure.async.SafeFuture;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.validator.BroadcastValidationLevel;
import tech.pegasys.teku.statetransition.validation.block.BlockGossipValidator;

public class BlockValidator {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright Consensys Software Inc., 2025
*
* 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.statetransition.validation;

import java.util.Optional;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState;

public interface StatefulValidationRule {

/**
* Performs a single validation check on a block.
*
* @param block The block being validated.
* @param parentState The state of the parent block.
* @return An Optional containing an InternalValidationResult if the rule fails. Returns
* Optional.empty() if the rule passes.
*/
Optional<InternalValidationResult> validate(SignedBeaconBlock block, BeaconState parentState);
}
Loading
Loading