Skip to content

Commit

Permalink
spotless
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel Fukushima <[email protected]>
  • Loading branch information
gfukushima committed Feb 12, 2025
1 parent 0ba8662 commit e6b4df6
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ private void processUpgrade(final TestDefinition testDefinition, final MetaData
final BLSSignatureVerifier signatureVerifier =
metadata.blsSetting == 2 ? BLSSignatureVerifier.NO_OP : BLSSignatureVerifier.SIMPLE;
result =
spec.processBlock(
result, block, signatureVerifier, Optional.empty(), Optional.empty());
spec.processBlock(result, block, signatureVerifier, Optional.empty(), Optional.empty());
} catch (final StateTransitionException e) {
Assertions.fail(
"Failed to process block " + i + " at slot " + block.getSlot() + ": " + e.getMessage(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@

import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import java.util.function.Supplier;
import tech.pegasys.teku.bls.BLSSignatureVerifier;
import tech.pegasys.teku.spec.Spec;
import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockSummary;
import tech.pegasys.teku.spec.datastructures.blocks.SlotAndBlockRoot;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBodySchema;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair.SyncAggregate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockSummary;
import tech.pegasys.teku.spec.datastructures.blocks.SlotAndBlockRoot;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair.SyncAggregate;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadSummary;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlockUnblinder;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBlockContainer;
import tech.pegasys.teku.spec.datastructures.blocks.SlotAndBlockRoot;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBodyBuilder;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeader;
import tech.pegasys.teku.spec.datastructures.execution.versions.capella.Withdrawal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import java.util.function.Supplier;
import javax.annotation.CheckReturnValue;
import org.apache.logging.log4j.LogManager;
Expand All @@ -45,7 +44,6 @@
import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockSummary;
import tech.pegasys.teku.spec.datastructures.blocks.Eth1Data;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.blocks.SlotAndBlockRoot;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ConsolidationRequest;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequest;
Expand Down Expand Up @@ -180,7 +178,7 @@ public BeaconState processAndValidateBlock(
indexedAttestationCache,
signatureVerifier,
payloadExecutor,
inclusionList);
inclusionList);

BlockValidationResult blockValidationResult =
validateBlockPostProcessing(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import java.util.function.Supplier;
import tech.pegasys.teku.bls.BLSPublicKey;
import tech.pegasys.teku.bls.BLSSignatureVerifier;
Expand All @@ -27,7 +26,6 @@
import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockSummary;
import tech.pegasys.teku.spec.datastructures.blocks.Eth1Data;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.blocks.SlotAndBlockRoot;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair.SyncAggregate;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeader;
Expand Down Expand Up @@ -60,33 +58,33 @@ public interface BlockProcessor {
Optional<OperationInvalidReason> validateAttestation(BeaconState state, AttestationData data);

BeaconState processAndValidateBlock(
SignedBeaconBlock signedBlock,
BeaconState blockSlotState,
IndexedAttestationCache indexedAttestationCache,
Optional<? extends OptimisticExecutionPayloadExecutor> payloadExecutor,
Optional<List<InclusionList>> inclusionList)
SignedBeaconBlock signedBlock,
BeaconState blockSlotState,
IndexedAttestationCache indexedAttestationCache,
Optional<? extends OptimisticExecutionPayloadExecutor> payloadExecutor,
Optional<List<InclusionList>> inclusionList)
throws StateTransitionException;

/**
* Processes the given block on top of {@code blockSlotState} and optionally validates the block
*
* @param signedBlock The block to be processed
* @param blockSlotState The preState on which this block should be processed, this preState must
* already be advanced to the block's slot
* @param signedBlock The block to be processed
* @param blockSlotState The preState on which this block should be processed, this preState must
* already be advanced to the block's slot
* @param indexedAttestationCache A cache of indexed attestations
* @param signatureVerifier The signature verifier to use
* @param payloadExecutor the optimistic payload executor to begin execution with
* @param inclusionLists The inclusion lists for the block
* @param signatureVerifier The signature verifier to use
* @param payloadExecutor the optimistic payload executor to begin execution with
* @param inclusionLists The inclusion lists for the block
* @return The post state after processing the block on top of {@code blockSlotState}
* @throws StateTransitionException If the block is invalid or cannot be processed
*/
BeaconState processAndValidateBlock(
SignedBeaconBlock signedBlock,
BeaconState blockSlotState,
IndexedAttestationCache indexedAttestationCache,
BLSSignatureVerifier signatureVerifier,
Optional<? extends OptimisticExecutionPayloadExecutor> payloadExecutor,
Optional<List<InclusionList>> inclusionLists)
SignedBeaconBlock signedBlock,
BeaconState blockSlotState,
IndexedAttestationCache indexedAttestationCache,
BLSSignatureVerifier signatureVerifier,
Optional<? extends OptimisticExecutionPayloadExecutor> payloadExecutor,
Optional<List<InclusionList>> inclusionLists)
throws StateTransitionException;

BeaconState processUnsignedBlock(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import org.apache.tuweni.bytes.Bytes32;
import tech.pegasys.teku.bls.BLSPublicKey;
import tech.pegasys.teku.bls.BLSSignature;
Expand All @@ -39,7 +38,6 @@
import tech.pegasys.teku.spec.config.SpecConfigAltair;
import tech.pegasys.teku.spec.constants.Domain;
import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock;
import tech.pegasys.teku.spec.datastructures.blocks.SlotAndBlockRoot;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair.BeaconBlockBodyAltair;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair.SyncAggregate;
Expand Down Expand Up @@ -130,12 +128,7 @@ public void processBlock(
final BeaconBlockBodyAltair blockBody = BeaconBlockBodyAltair.required(block.getBody());

super.processBlock(
state,
block,
indexedAttestationCache,
signatureVerifier,
payloadExecutor,
inclusionLists);
state, block, indexedAttestationCache, signatureVerifier, payloadExecutor, inclusionLists);
processSyncAggregate(state, blockBody.getSyncAggregate(), signatureVerifier);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@

import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import tech.pegasys.teku.bls.BLSSignatureVerifier;
import tech.pegasys.teku.infrastructure.ssz.SszList;
import tech.pegasys.teku.spec.cache.IndexedAttestationCache;
import tech.pegasys.teku.spec.config.SpecConfigBellatrix;
import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock;
import tech.pegasys.teku.spec.datastructures.blocks.SlotAndBlockRoot;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.bellatrix.BeaconBlockBodyBellatrix;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.bellatrix.BlindedBeaconBlockBodyBellatrix;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Supplier;
import javax.annotation.CheckReturnValue;
import org.apache.tuweni.bytes.Bytes;
Expand All @@ -32,7 +31,6 @@
import tech.pegasys.teku.spec.cache.IndexedAttestationCache;
import tech.pegasys.teku.spec.config.SpecConfigCapella;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.blocks.SlotAndBlockRoot;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeader;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadSummary;
Expand Down Expand Up @@ -108,8 +106,7 @@ public void executionProcessing(
final ExecutionPayloadHeader executionPayloadHeader =
extractExecutionPayloadHeader(beaconBlockBody);
processWithdrawals(genericState, executionPayloadHeader);
super.executionProcessing(
genericState, beaconBlockBody, payloadExecutor, inclusionLists);
super.executionProcessing(genericState, beaconBlockBody, payloadExecutor, inclusionLists);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@

import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import org.apache.tuweni.bytes.Bytes32;
import tech.pegasys.teku.infrastructure.ssz.SszList;
import tech.pegasys.teku.spec.config.SpecConfigDeneb;
import tech.pegasys.teku.spec.datastructures.blocks.SlotAndBlockRoot;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload;
import tech.pegasys.teku.spec.datastructures.execution.NewPayloadRequest;
Expand Down Expand Up @@ -86,8 +84,7 @@ public void validateExecutionPayload(
throw new BlockProcessingException(
"Number of kzg commitments in block exceeds max blobs per block");
}
super.validateExecutionPayload(
genericState, beaconBlockBody, payloadExecutor, inclusionLists);
super.validateExecutionPayload(genericState, beaconBlockBody, payloadExecutor, inclusionLists);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@

import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import org.apache.tuweni.bytes.Bytes32;
import tech.pegasys.teku.infrastructure.ssz.SszList;
import tech.pegasys.teku.spec.config.SpecConfigElectra;
import tech.pegasys.teku.spec.datastructures.blocks.SlotAndBlockRoot;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload;
import tech.pegasys.teku.spec.datastructures.execution.NewPayloadRequest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.IntStream;
import org.apache.logging.log4j.LogManager;
Expand All @@ -41,7 +40,6 @@
import tech.pegasys.teku.spec.cache.IndexedAttestationCache;
import tech.pegasys.teku.spec.config.SpecConfig;
import tech.pegasys.teku.spec.config.SpecConfigElectra;
import tech.pegasys.teku.spec.datastructures.blocks.SlotAndBlockRoot;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadSummary;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@

import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import tech.pegasys.teku.bls.BLSSignatureVerifier;
import tech.pegasys.teku.infrastructure.ssz.SszList;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.config.SpecConfig;
import tech.pegasys.teku.spec.datastructures.blocks.SlotAndBlockRoot;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair.SyncAggregate;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,8 @@ private SafeFuture<BlockImportResult> onBlock(
blobSidecarManager.createAvailabilityChecker(block);

blobSidecarsAvailabilityChecker.initiateDataAvailabilityCheck();
final SlotAndBlockRoot blockAndSlot = new SlotAndBlockRoot(block.getSlot(), block.hashTreeRoot());
final SlotAndBlockRoot blockAndSlot =
new SlotAndBlockRoot(block.getSlot(), block.hashTreeRoot());
final Optional<List<InclusionList>> inclusionLists = store.getInclusionList(blockAndSlot);

final BeaconState postState;
Expand All @@ -450,8 +451,7 @@ private SafeFuture<BlockImportResult> onBlock(
blockSlotState.get(),
indexedAttestationCache,
Optional.of(payloadExecutor),
inclusionLists
);
inclusionLists);
} catch (final StateTransitionException e) {
final BlockImportResult result = BlockImportResult.failedStateTransition(e);
reportInvalidBlock(block, result);
Expand Down

0 comments on commit e6b4df6

Please sign in to comment.