Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into ep-final-ethereum-module
Browse files Browse the repository at this point in the history
# Conflicts:
#	ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/blocks/blockbody/versions/electra/BeaconBlockBodyElectraImpl.java
  • Loading branch information
gfukushima committed Apr 19, 2024
2 parents 1fdce39 + 845959a commit 664c4a8
Show file tree
Hide file tree
Showing 37 changed files with 742 additions and 78 deletions.
12 changes: 2 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ commands:
name: "Publish Docker Images"
command: |
docker login --username "${DOCKER_USER_RW}" --password "${DOCKER_PASSWORD_RW}"
./gradlew --no-daemon --parallel "-Pbranch=${CIRCLE_BRANCH} -PincludeCommitHash=<< pipeline.parameters.include_commit_hash >>" uploadDocker
./gradlew --no-daemon --parallel "-Pbranch=${CIRCLE_BRANCH} -PincludeCommitHashInDockerTag=<< pipeline.parameters.include_commit_hash_in_docker_tag >>" uploadDocker
notify:
description: "Notify Slack"
Expand All @@ -159,7 +159,7 @@ commands:
only_for_branches: 'master'

parameters:
include_commit_hash:
include_commit_hash_in_docker_tag:
type: boolean
default: false

Expand Down Expand Up @@ -437,10 +437,6 @@ jobs:
- notify

publishDockerAmd64:
parameters:
include_commit_hash:
type: boolean
default: false
executor: machine_executor_amd64
steps:
- prepare
Expand All @@ -451,10 +447,6 @@ jobs:
- notify

publishDockerArm64:
parameters:
include_commit_hash:
type: boolean
default: false
executor: machine_executor_arm64
steps:
- prepare
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair.SyncAggregate;
import tech.pegasys.teku.spec.datastructures.blocks.versions.deneb.SignedBlockContents;
import tech.pegasys.teku.spec.datastructures.builder.BuilderPayload;
import tech.pegasys.teku.spec.datastructures.consolidations.SignedConsolidation;
import tech.pegasys.teku.spec.datastructures.execution.BlobsBundle;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadContext;
Expand Down Expand Up @@ -1193,6 +1194,9 @@ private static class CapturingBeaconBlockBodyBuilder implements BeaconBlockBodyB
protected ExecutionPayloadHeader executionPayloadHeader;
protected SszList<SszKZGCommitment> blobKzgCommitments;

@SuppressWarnings("unused")
protected SszList<SignedConsolidation> consolidations;

public CapturingBeaconBlockBodyBuilder(final boolean supportsKzgCommitments) {
this.supportsKzgCommitments = supportsKzgCommitments;
}
Expand Down Expand Up @@ -1298,6 +1302,13 @@ public BeaconBlockBodyBuilder blobKzgCommitments(
return this;
}

@Override
public BeaconBlockBodyBuilder consolidations(
final SszList<SignedConsolidation> consolidations) {
this.consolidations = consolidations;
return this;
}

@Override
public BeaconBlockBody build() {
return null;
Expand Down
22 changes: 8 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -532,24 +532,16 @@ def executableAndArg = System.getProperty('os.name').toLowerCase().contains('win
task distDocker {
dependsOn dockerDistUntar
def dockerBuildVersion = 'develop'

if (project.hasProperty('includeCommitHash') && project.property('includeCommitHash').toBoolean()) {
def commitHash = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = commitHash
}
dockerBuildVersion += '-' + commitHash
}

doLast {
def includeCommitHashInDockerTag = project.hasProperty('includeCommitHashInDockerTag') && project.property('includeCommitHashInDockerTag').toBoolean()
def commitHashTag = includeCommitHashInDockerTag ? '-' + grgit.head().getAbbreviatedId() : ''
for (def variant in dockerJdkVariants) {
copy {
from file("${projectDir}/docker/${variant}/Dockerfile")
into(dockerBuildDir)
}
exec {
def image = "${dockerImage}:${dockerBuildVersion}-${variant}"
def image = "${dockerImage}:${dockerBuildVersion}-${variant}${commitHashTag}"
workingDir dockerBuildDir
executable executableAndArg[0]
args executableAndArg[1], "docker build --pull --build-arg BUILD_DATE=${buildTime()} --build-arg VERSION=${dockerBuildVersion} --build-arg VCS_REF=${getCheckedOutGitCommitHash()} -t ${image} ."
Expand All @@ -558,7 +550,7 @@ task distDocker {
// tag the "default" (which is the variant in the zero position)
exec {
executable executableAndArg[0]
args executableAndArg[1], "docker tag ${dockerImage}:${dockerBuildVersion}-${dockerJdkVariants[0]} ${dockerImage}:${dockerBuildVersion}"
args executableAndArg[1], "docker tag ${dockerImage}:${dockerBuildVersion}-${dockerJdkVariants[0]}${commitHashTag} ${dockerImage}:${dockerBuildVersion}${commitHashTag}"
}
}
}
Expand All @@ -580,12 +572,14 @@ task uploadDocker {
}

doLast {
def includeCommitHashInDockerTag = project.hasProperty('includeCommitHashInDockerTag') && project.property('includeCommitHashInDockerTag').toBoolean()
def commitHashTag = includeCommitHashInDockerTag ? '-' + grgit.head().getAbbreviatedId() : ''
for (def variant in dockerJdkVariants) {
def tags = ""
versionPrefixes.forEach { prefix -> tags += "-t ${dockerImage}:${prefix.trim()}-${variant}-${architecture} "}
versionPrefixes.forEach { prefix -> tags += "-t ${dockerImage}:${prefix.trim()}-${variant}-${architecture}${commitHashTag} "}

if (variant == dockerJdkVariants[0]) {
versionPrefixes.forEach { prefix -> tags += "-t ${dockerImage}:${prefix.trim()}-${architecture} "}
versionPrefixes.forEach { prefix -> tags += "-t ${dockerImage}:${prefix.trim()}-${architecture}${commitHashTag} "}
}

copy {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title" : "BeaconBlockBodyElectra",
"type" : "object",
"required" : [ "randao_reveal", "eth1_data", "graffiti", "proposer_slashings", "attester_slashings", "attestations", "deposits", "voluntary_exits", "sync_aggregate", "execution_payload", "bls_to_execution_changes", "blob_kzg_commitments" ],
"required" : [ "randao_reveal", "eth1_data", "graffiti", "proposer_slashings", "attester_slashings", "attestations", "deposits", "voluntary_exits", "sync_aggregate", "execution_payload", "bls_to_execution_changes", "blob_kzg_commitments", "consolidations" ],
"properties" : {
"randao_reveal" : {
"type" : "string",
Expand Down Expand Up @@ -68,6 +68,12 @@
"description" : "Bytes48 hexadecimal",
"format" : "bytes"
}
},
"consolidations" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/SignedConsolidation"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title" : "BlindedBlockBodyElectra",
"type" : "object",
"required" : [ "randao_reveal", "eth1_data", "graffiti", "proposer_slashings", "attester_slashings", "attestations", "deposits", "voluntary_exits", "sync_aggregate", "execution_payload_header", "bls_to_execution_changes", "blob_kzg_commitments" ],
"required" : [ "randao_reveal", "eth1_data", "graffiti", "proposer_slashings", "attester_slashings", "attestations", "deposits", "voluntary_exits", "sync_aggregate", "execution_payload_header", "bls_to_execution_changes", "blob_kzg_commitments", "consolidations" ],
"properties" : {
"randao_reveal" : {
"type" : "string",
Expand Down Expand Up @@ -68,6 +68,12 @@
"description" : "Bytes48 hexadecimal",
"format" : "bytes"
}
},
"consolidations" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/SignedConsolidation"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"title" : "Consolidation",
"type" : "object",
"required" : [ "source_index", "target_index", "epoch" ],
"properties" : {
"source_index" : {
"type" : "string",
"description" : "unsigned 64 bit integer",
"example" : "1",
"format" : "uint64"
},
"target_index" : {
"type" : "string",
"description" : "unsigned 64 bit integer",
"example" : "1",
"format" : "uint64"
},
"epoch" : {
"type" : "string",
"description" : "unsigned 64 bit integer",
"example" : "1",
"format" : "uint64"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"title" : "SignedConsolidation",
"type" : "object",
"required" : [ "message", "signature" ],
"properties" : {
"message" : {
"$ref" : "#/components/schemas/Consolidation"
},
"signature" : {
"type" : "string",
"pattern" : "^0x[a-fA-F0-9]{2,}$",
"description" : "SSZ hexadecimal",
"format" : "bytes"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@
"0x23b34c422f5dc8f657e44bec0e51ab2840981d2ca63caaa51da14231033a661656d833a140f1279e0a1e40020f4c8be2",
"0xea4f5e424f7a2a28771b166a93b66dc12d8f207683e22f77941d78d8741740768f79e18451ce86d434d576fdbaf45f2f",
"0xfd705842efc5096d6c5e7d95673f828e34921f0839ab5831c29ebba04e78f7002799a7e34b2f67c27bedb9a981bcc315"
]
],
"consolidations": []
}
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.tuweni.bytes.Bytes32;
import tech.pegasys.teku.api.schema.Attestation;
import tech.pegasys.teku.api.schema.AttesterSlashing;
Expand Down Expand Up @@ -48,6 +49,9 @@ public class BeaconBlockBodyElectra extends BeaconBlockBodyAltair {
@JsonProperty("blob_kzg_commitments")
public final List<KZGCommitment> blobKZGCommitments;

@JsonProperty("consolidations")
public final List<SignedConsolidation> consolidations;

@JsonCreator
public BeaconBlockBodyElectra(
@JsonProperty("randao_reveal") final BLSSignature randaoReveal,
Expand All @@ -62,7 +66,8 @@ public BeaconBlockBodyElectra(
@JsonProperty("execution_payload") final ExecutionPayloadElectra executionPayload,
@JsonProperty("bls_to_execution_changes")
final List<SignedBlsToExecutionChange> blsToExecutionChanges,
@JsonProperty("blob_kzg_commitments") final List<KZGCommitment> blobKZGCommitments) {
@JsonProperty("blob_kzg_commitments") final List<KZGCommitment> blobKZGCommitments,
@JsonProperty("consolidations") final List<SignedConsolidation> consolidations) {
super(
randaoReveal,
eth1Data,
Expand All @@ -79,6 +84,7 @@ public BeaconBlockBodyElectra(
this.blsToExecutionChanges = blsToExecutionChanges;
checkNotNull(blobKZGCommitments, "blobKZGCommitments is required for Electra blocks");
this.blobKZGCommitments = blobKZGCommitments;
this.consolidations = consolidations;
}

public BeaconBlockBodyElectra(
Expand All @@ -100,6 +106,10 @@ public BeaconBlockBodyElectra(
.map(SszKZGCommitment::getKZGCommitment)
.map(KZGCommitment::new)
.toList();
this.consolidations =
message.getConsolidations().stream()
.map(SignedConsolidation::new)
.collect(Collectors.toList());
}

@Override
Expand All @@ -115,6 +125,8 @@ public BeaconBlockBody asInternalBeaconBlockBody(final SpecVersion spec) {
getBeaconBlockBodySchema(spec).getBlsToExecutionChangesSchema();
final SszListSchema<SszKZGCommitment, ?> blobKZGCommitmentsSchema =
getBeaconBlockBodySchema(spec).getBlobKzgCommitmentsSchema();
final SszListSchema<tech.pegasys.teku.spec.datastructures.consolidations.SignedConsolidation, ?>
signedConsolidationSchema = getBeaconBlockBodySchema(spec).getConsolidationsSchema();
return super.asInternalBeaconBlockBody(
spec,
builder -> {
Expand All @@ -128,6 +140,10 @@ public BeaconBlockBody asInternalBeaconBlockBody(final SpecVersion spec) {
.map(KZGCommitment::asInternalKZGCommitment)
.map(SszKZGCommitment::new)
.collect(blobKZGCommitmentsSchema.collector()));
builder.consolidations(
this.consolidations.stream()
.map(b -> b.asInternalSignedConsolidation(spec))
.collect(signedConsolidationSchema.collector()));
return SafeFuture.COMPLETE;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.tuweni.bytes.Bytes32;
import tech.pegasys.teku.api.schema.Attestation;
import tech.pegasys.teku.api.schema.AttesterSlashing;
Expand Down Expand Up @@ -49,6 +50,9 @@ public class BlindedBeaconBlockBodyElectra extends BeaconBlockBodyAltair {
@JsonProperty("blob_kzg_commitments")
public final List<KZGCommitment> blobKZGCommitments;

@JsonProperty("consolidations")
public final List<SignedConsolidation> consolidations;

@JsonCreator
public BlindedBeaconBlockBodyElectra(
@JsonProperty("randao_reveal") final BLSSignature randaoReveal,
Expand All @@ -64,7 +68,8 @@ public BlindedBeaconBlockBodyElectra(
final ExecutionPayloadHeaderElectra executionPayloadHeader,
@JsonProperty("bls_to_execution_changes")
final List<SignedBlsToExecutionChange> blsToExecutionChanges,
@JsonProperty("blob_kzg_commitments") final List<KZGCommitment> blobKZGCommitments) {
@JsonProperty("blob_kzg_commitments") final List<KZGCommitment> blobKZGCommitments,
@JsonProperty("consolidations") final List<SignedConsolidation> consolidations) {
super(
randaoReveal,
eth1Data,
Expand All @@ -83,6 +88,8 @@ public BlindedBeaconBlockBodyElectra(
this.blsToExecutionChanges = blsToExecutionChanges;
checkNotNull(blobKZGCommitments, "blobKZGCommitments is required for Electra blinded blocks");
this.blobKZGCommitments = blobKZGCommitments;

this.consolidations = consolidations;
}

public BlindedBeaconBlockBodyElectra(
Expand All @@ -99,6 +106,10 @@ public BlindedBeaconBlockBodyElectra(
.map(SszKZGCommitment::getKZGCommitment)
.map(KZGCommitment::new)
.toList();
this.consolidations =
blockBody.getConsolidations().stream()
.map(SignedConsolidation::new)
.collect(Collectors.toList());
}

@Override
Expand All @@ -125,6 +136,9 @@ public BeaconBlockBody asInternalBeaconBlockBody(final SpecVersion spec) {
final SszListSchema<SszKZGCommitment, ?> blobKZGCommitmentsSchema =
getBeaconBlockBodySchema(spec).getBlobKzgCommitmentsSchema();

final SszListSchema<tech.pegasys.teku.spec.datastructures.consolidations.SignedConsolidation, ?>
signedConsolidationSchema = getBeaconBlockBodySchema(spec).getConsolidationsSchema();

return super.asInternalBeaconBlockBody(
spec,
builder -> {
Expand All @@ -140,6 +154,10 @@ public BeaconBlockBody asInternalBeaconBlockBody(final SpecVersion spec) {
.map(KZGCommitment::asInternalKZGCommitment)
.map(SszKZGCommitment::new)
.collect(blobKZGCommitmentsSchema.collector()));
builder.consolidations(
this.consolidations.stream()
.map(b -> b.asInternalSignedConsolidation(spec))
.collect(signedConsolidationSchema.collector()));
return SafeFuture.COMPLETE;
});
}
Expand Down
Loading

0 comments on commit 664c4a8

Please sign in to comment.