Skip to content

Commit

Permalink
more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanBratanov committed Sep 12, 2024
1 parent 4932619 commit 71cc199
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import tech.pegasys.teku.bls.BLSPublicKey;
import tech.pegasys.teku.ethereum.performance.trackers.BlockProductionPerformance;
import tech.pegasys.teku.infrastructure.async.SafeFuture;
import tech.pegasys.teku.infrastructure.ssz.SszList;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.Spec;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadContext;
Expand All @@ -26,6 +27,7 @@
import tech.pegasys.teku.spec.datastructures.execution.GetPayloadResponse;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconStateCache;
import tech.pegasys.teku.spec.datastructures.type.SszKZGCommitment;
import tech.pegasys.teku.spec.executionlayer.ExecutionLayerBlockProductionManager;
import tech.pegasys.teku.spec.schemas.SchemaDefinitionsEip7732;
import tech.pegasys.teku.statetransition.forkchoice.ForkChoiceNotifier;
Expand Down Expand Up @@ -57,9 +59,10 @@ public SafeFuture<ExecutionPayloadHeader> createUnsignedHeader(
if (maybeBuilderIndex.isEmpty()) {
return SafeFuture.failedFuture(
new IllegalArgumentException(
"There is no index assigned to a builder with a public key " + builderPublicKey));
"There is no validator index assigned to a builder with a public key "
+ builderPublicKey));
}
final int builderIndex = maybeBuilderIndex.get();
final UInt64 builderIndex = UInt64.valueOf(maybeBuilderIndex.get());
return forkChoiceNotifier
.getPayloadId(parentRoot, slot)
.thenCompose(
Expand Down Expand Up @@ -89,11 +92,17 @@ public SafeFuture<ExecutionPayloadHeader> createUnsignedHeader(

private ExecutionPayloadHeader createLocalBid(
final UInt64 slot,
final int builderIndex,
final UInt64 builderIndex,
final Bytes32 parentRoot,
final ExecutionPayloadContext executionPayloadContext,
final GetPayloadResponse getPayloadResponse) {
return SchemaDefinitionsEip7732.required(spec.atSlot(slot).getSchemaDefinitions())
final SchemaDefinitionsEip7732 schemaDefinitions =
SchemaDefinitionsEip7732.required(spec.atSlot(slot).getSchemaDefinitions());
final SszList<SszKZGCommitment> blobKzgCommitments =
schemaDefinitions
.getBlobKzgCommitmentsSchema()
.createFromBlobsBundle(getPayloadResponse.getBlobsBundle().orElseThrow());
return schemaDefinitions
.getExecutionPayloadHeaderSchema()
.createExecutionPayloadHeader(
builder ->
Expand All @@ -102,11 +111,11 @@ private ExecutionPayloadHeader createLocalBid(
.parentBlockRoot(() -> parentRoot)
.blockHash(getPayloadResponse.getExecutionPayload().getBlockHash())
.gasLimit(getPayloadResponse.getExecutionPayload().getGasLimit())
.builderIndex(() -> UInt64.valueOf(builderIndex))
.builderIndex(() -> builderIndex)
.slot(() -> slot)
.value(
() ->
UInt64.valueOf(getPayloadResponse.getExecutionPayloadValue().toLong()))
.blobKzgCommitmentsRoot(() -> Bytes32.ZERO));
.blobKzgCommitmentsRoot(blobKzgCommitments::hashTreeRoot));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import tech.pegasys.teku.infrastructure.ssz.primitive.SszBit;
import tech.pegasys.teku.infrastructure.ssz.primitive.SszBytes32;
import tech.pegasys.teku.infrastructure.ssz.primitive.SszUInt64;
import tech.pegasys.teku.infrastructure.ssz.schema.SszListSchema;
import tech.pegasys.teku.infrastructure.ssz.schema.SszPrimitiveSchemas;
import tech.pegasys.teku.infrastructure.ssz.schema.SszSchema;
import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode;
Expand Down Expand Up @@ -67,12 +66,6 @@ public ExecutionPayloadEnvelope create(
stateRoot);
}

@SuppressWarnings("unchecked")
public SszListSchema<SszKZGCommitment, ?> getBlobKzgCommitmentsSchema() {
return (SszListSchema<SszKZGCommitment, ?>)
getChildSchema(getFieldIndex("blob_kzg_commitments"));
}

@Override
public ExecutionPayloadEnvelope createFromBackingNode(final TreeNode node) {
return new ExecutionPayloadEnvelope(this, node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public int getBlobSidecarKzgCommitmentGeneralizedIndex(final UInt64 blobSidecarI
.getBlobKzgCommitmentsRootGeneralizedIndex();
final long commitmentGeneralizedIndex =
schemaDefinitions
.getExecutionPayloadEnvelopeSchema()
.getBlobKzgCommitmentsSchema()
.getChildGeneralizedIndex(blobSidecarIndex.longValue());
return (int)
Expand Down

0 comments on commit 71cc199

Please sign in to comment.