Search in sources :

Example 1 with BeaconBlockBodyAltair

use of tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair.BeaconBlockBodyAltair in project teku by ConsenSys.

the class SyncCommitteePerformanceTrackerTest method withSyncAggregate.

private void withSyncAggregate(final int slot, final Integer... includedCommitteeIndices) {
    final SignedBeaconBlock signedBlock = mock(SignedBeaconBlock.class);
    final BeaconBlock block = mock(BeaconBlock.class);
    final BeaconBlockBodyAltair blockBody = mock(BeaconBlockBodyAltair.class);
    final SyncAggregate syncAggregate = ((BeaconBlockBodySchemaAltair) schemaDefinitionsAltair.getBeaconBlockBodySchema()).getSyncAggregateSchema().create(List.of(includedCommitteeIndices), BLSSignature.empty());
    when(signedBlock.getMessage()).thenReturn(block);
    when(block.getBody()).thenReturn(blockBody);
    when(blockBody.toVersionAltair()).thenReturn(Optional.of(blockBody));
    when(blockBody.getSyncAggregate()).thenReturn(syncAggregate);
    when(combinedChainDataClient.getBlockAtSlotExact(UInt64.valueOf(slot))).thenReturn(SafeFuture.completedFuture(Optional.of(signedBlock)));
}
Also used : BeaconBlockBodyAltair(tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair.BeaconBlockBodyAltair) SyncAggregate(tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair.SyncAggregate) BeaconBlock(tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock) SignedBeaconBlock(tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock) SignedBeaconBlock(tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock)

Example 2 with BeaconBlockBodyAltair

use of tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair.BeaconBlockBodyAltair in project teku by ConsenSys.

the class BlockProcessorAltair method processBlock.

@Override
public void processBlock(final MutableBeaconState genericState, final BeaconBlock block, final IndexedAttestationCache indexedAttestationCache, final BLSSignatureVerifier signatureVerifier, final OptimisticExecutionPayloadExecutor payloadExecutor) throws BlockProcessingException {
    final MutableBeaconStateAltair state = MutableBeaconStateAltair.required(genericState);
    final BeaconBlockBodyAltair blockBody = BeaconBlockBodyAltair.required(block.getBody());
    super.processBlock(state, block, indexedAttestationCache, signatureVerifier, payloadExecutor);
    processSyncAggregate(state, blockBody.getSyncAggregate(), signatureVerifier);
}
Also used : BeaconBlockBodyAltair(tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair.BeaconBlockBodyAltair) MutableBeaconStateAltair(tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.altair.MutableBeaconStateAltair)

Aggregations

BeaconBlockBodyAltair (tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair.BeaconBlockBodyAltair)2 BeaconBlock (tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock)1 SignedBeaconBlock (tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock)1 SyncAggregate (tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair.SyncAggregate)1 MutableBeaconStateAltair (tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.altair.MutableBeaconStateAltair)1