diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/node/GetPeers.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/node/GetPeers.java index 98bc8f9ad7f..8d8282a03dd 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/node/GetPeers.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/node/GetPeers.java @@ -27,8 +27,8 @@ import tech.pegasys.teku.api.DataProvider; import tech.pegasys.teku.api.NetworkDataProvider; import tech.pegasys.teku.api.peer.Eth2PeerWithEnr; -import tech.pegasys.teku.api.response.v1.node.Direction; -import tech.pegasys.teku.api.response.v1.node.State; +import tech.pegasys.teku.api.provider.Direction; +import tech.pegasys.teku.api.provider.State; import tech.pegasys.teku.infrastructure.json.types.DeserializableTypeDefinition; import tech.pegasys.teku.infrastructure.json.types.SerializableTypeDefinition; import tech.pegasys.teku.infrastructure.restapi.endpoints.EndpointMetadata; diff --git a/data/provider/src/main/java/tech/pegasys/teku/api/ChainDataProvider.java b/data/provider/src/main/java/tech/pegasys/teku/api/ChainDataProvider.java index b71aeb33673..5905559cb2d 100644 --- a/data/provider/src/main/java/tech/pegasys/teku/api/ChainDataProvider.java +++ b/data/provider/src/main/java/tech/pegasys/teku/api/ChainDataProvider.java @@ -14,7 +14,7 @@ package tech.pegasys.teku.api; import static java.util.Collections.emptyList; -import static tech.pegasys.teku.api.response.v1.beacon.ValidatorResponse.getValidatorStatus; +import static tech.pegasys.teku.api.response.ValidatorStatusUtil.getValidatorStatus; import static tech.pegasys.teku.infrastructure.unsigned.UInt64.ONE; import static tech.pegasys.teku.infrastructure.unsigned.UInt64.ZERO; import static tech.pegasys.teku.spec.config.SpecConfig.FAR_FUTURE_EPOCH; @@ -44,8 +44,8 @@ import tech.pegasys.teku.api.migrated.StateSyncCommitteesData; import tech.pegasys.teku.api.migrated.StateValidatorBalanceData; import tech.pegasys.teku.api.migrated.SyncCommitteeRewardData; +import tech.pegasys.teku.api.provider.GenesisData; import tech.pegasys.teku.api.response.ValidatorStatus; -import tech.pegasys.teku.api.response.v1.beacon.GenesisData; import tech.pegasys.teku.api.rewards.EpochAttestationRewardsCalculator; import tech.pegasys.teku.api.stateselector.StateSelectorFactory; import tech.pegasys.teku.bls.BLSPublicKey; diff --git a/data/provider/src/main/java/tech/pegasys/teku/api/NetworkDataProvider.java b/data/provider/src/main/java/tech/pegasys/teku/api/NetworkDataProvider.java index 465f698569e..69d23840255 100644 --- a/data/provider/src/main/java/tech/pegasys/teku/api/NetworkDataProvider.java +++ b/data/provider/src/main/java/tech/pegasys/teku/api/NetworkDataProvider.java @@ -18,9 +18,9 @@ import java.util.function.Function; import org.apache.tuweni.units.bigints.UInt256; import tech.pegasys.teku.api.peer.Eth2PeerWithEnr; -import tech.pegasys.teku.api.response.v1.node.Direction; -import tech.pegasys.teku.api.response.v1.node.Peer; -import tech.pegasys.teku.api.response.v1.node.State; +import tech.pegasys.teku.api.provider.Direction; +import tech.pegasys.teku.api.provider.Peer; +import tech.pegasys.teku.api.provider.State; import tech.pegasys.teku.ethereum.json.types.node.PeerCount; import tech.pegasys.teku.ethereum.json.types.node.PeerCountBuilder; import tech.pegasys.teku.infrastructure.unsigned.UInt64; diff --git a/data/provider/src/test/java/tech/pegasys/teku/api/ChainDataProviderTest.java b/data/provider/src/test/java/tech/pegasys/teku/api/ChainDataProviderTest.java index 613c5d4ad7d..c292bd7ba30 100644 --- a/data/provider/src/test/java/tech/pegasys/teku/api/ChainDataProviderTest.java +++ b/data/provider/src/test/java/tech/pegasys/teku/api/ChainDataProviderTest.java @@ -55,8 +55,8 @@ import tech.pegasys.teku.api.migrated.BlockRewardData; import tech.pegasys.teku.api.migrated.StateSyncCommitteesData; import tech.pegasys.teku.api.migrated.SyncCommitteeRewardData; +import tech.pegasys.teku.api.provider.GenesisData; import tech.pegasys.teku.api.response.ValidatorStatus; -import tech.pegasys.teku.api.response.v1.beacon.GenesisData; import tech.pegasys.teku.infrastructure.async.SafeFuture; import tech.pegasys.teku.infrastructure.async.SafeFutureAssert; import tech.pegasys.teku.infrastructure.bytes.Bytes20; diff --git a/data/provider/src/test/java/tech/pegasys/teku/api/ChainDataProviderTestPhase0.java b/data/provider/src/test/java/tech/pegasys/teku/api/ChainDataProviderTestPhase0.java index ad0cb98e358..d4640c0eec2 100644 --- a/data/provider/src/test/java/tech/pegasys/teku/api/ChainDataProviderTestPhase0.java +++ b/data/provider/src/test/java/tech/pegasys/teku/api/ChainDataProviderTestPhase0.java @@ -47,8 +47,8 @@ import tech.pegasys.teku.api.migrated.BlockHeadersResponse; import tech.pegasys.teku.api.migrated.StateSyncCommitteesData; import tech.pegasys.teku.api.migrated.SyncCommitteeRewardData; +import tech.pegasys.teku.api.provider.GenesisData; import tech.pegasys.teku.api.response.ValidatorStatus; -import tech.pegasys.teku.api.response.v1.beacon.GenesisData; import tech.pegasys.teku.infrastructure.async.SafeFuture; import tech.pegasys.teku.infrastructure.bytes.Bytes4; import tech.pegasys.teku.infrastructure.unsigned.UInt64; diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/exceptions/PublicKeyException.java b/data/serializer/src/main/java/tech/pegasys/teku/api/exceptions/PublicKeyException.java index 97c9665e6e0..a47b17c389b 100644 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/exceptions/PublicKeyException.java +++ b/data/serializer/src/main/java/tech/pegasys/teku/api/exceptions/PublicKeyException.java @@ -18,8 +18,4 @@ public class PublicKeyException extends RuntimeException { public PublicKeyException(final String message, final Throwable cause) { super(message, cause); } - - public PublicKeyException(final String err) { - super(err); - } } diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/Direction.java b/data/serializer/src/main/java/tech/pegasys/teku/api/provider/Direction.java similarity index 93% rename from data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/Direction.java rename to data/serializer/src/main/java/tech/pegasys/teku/api/provider/Direction.java index 6bd54e9b9aa..dbba2e9ec21 100644 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/Direction.java +++ b/data/serializer/src/main/java/tech/pegasys/teku/api/provider/Direction.java @@ -11,7 +11,7 @@ * specific language governing permissions and limitations under the License. */ -package tech.pegasys.teku.api.response.v1.node; +package tech.pegasys.teku.api.provider; @SuppressWarnings("JavaCase") public enum Direction { diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GenesisData.java b/data/serializer/src/main/java/tech/pegasys/teku/api/provider/GenesisData.java similarity index 90% rename from data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GenesisData.java rename to data/serializer/src/main/java/tech/pegasys/teku/api/provider/GenesisData.java index 37ae5be843e..5aa3c905ba3 100644 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GenesisData.java +++ b/data/serializer/src/main/java/tech/pegasys/teku/api/provider/GenesisData.java @@ -11,10 +11,7 @@ * specific language governing permissions and limitations under the License. */ -package tech.pegasys.teku.api.response.v1.beacon; - -import static tech.pegasys.teku.api.schema.SchemaConstants.EXAMPLE_BYTES32; -import static tech.pegasys.teku.api.schema.SchemaConstants.PATTERN_BYTES32; +package tech.pegasys.teku.api.provider; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -35,7 +32,10 @@ public class GenesisData { public final UInt64 genesisTime; @JsonProperty("genesis_validators_root") - @Schema(type = "string", example = EXAMPLE_BYTES32, pattern = PATTERN_BYTES32) + @Schema( + type = "string", + example = "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", + pattern = "^0x[a-fA-F0-9]{64}$") public final Bytes32 genesisValidatorsRoot; @JsonProperty("genesis_fork_version") diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/Peer.java b/data/serializer/src/main/java/tech/pegasys/teku/api/provider/Peer.java similarity index 98% rename from data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/Peer.java rename to data/serializer/src/main/java/tech/pegasys/teku/api/provider/Peer.java index 71e5a215b90..8bcdfb254ad 100644 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/Peer.java +++ b/data/serializer/src/main/java/tech/pegasys/teku/api/provider/Peer.java @@ -11,7 +11,7 @@ * specific language governing permissions and limitations under the License. */ -package tech.pegasys.teku.api.response.v1.node; +package tech.pegasys.teku.api.provider; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/State.java b/data/serializer/src/main/java/tech/pegasys/teku/api/provider/State.java similarity index 93% rename from data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/State.java rename to data/serializer/src/main/java/tech/pegasys/teku/api/provider/State.java index 8877e2bc2db..0f60a2163f6 100644 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/State.java +++ b/data/serializer/src/main/java/tech/pegasys/teku/api/provider/State.java @@ -11,7 +11,7 @@ * specific language governing permissions and limitations under the License. */ -package tech.pegasys.teku.api.response.v1.node; +package tech.pegasys.teku.api.provider; @SuppressWarnings("JavaCase") public enum State { diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/ValidatorStatusUtil.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/ValidatorStatusUtil.java new file mode 100644 index 00000000000..2db66e33736 --- /dev/null +++ b/data/serializer/src/main/java/tech/pegasys/teku/api/response/ValidatorStatusUtil.java @@ -0,0 +1,64 @@ +/* + * 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.api.response; + +import tech.pegasys.teku.infrastructure.unsigned.UInt64; +import tech.pegasys.teku.spec.datastructures.state.Validator; +import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState; + +public class ValidatorStatusUtil { + public static ValidatorStatus getValidatorStatus( + final BeaconState state, + final Integer validatorIndex, + final UInt64 epoch, + final UInt64 farFutureEpoch) { + return getValidatorStatus(epoch, state.getValidators().get(validatorIndex), farFutureEpoch); + } + + public static ValidatorStatus getValidatorStatus( + final UInt64 epoch, final Validator validator, final UInt64 farFutureEpoch) { + // pending + if (validator.getActivationEpoch().isGreaterThan(epoch)) { + return validator.getActivationEligibilityEpoch().equals(farFutureEpoch) + ? ValidatorStatus.pending_initialized + : ValidatorStatus.pending_queued; + } + // active + if (validator.getActivationEpoch().isLessThanOrEqualTo(epoch) + && epoch.isLessThan(validator.getExitEpoch())) { + if (validator.getExitEpoch().equals(farFutureEpoch)) { + return ValidatorStatus.active_ongoing; + } + return validator.isSlashed() + ? ValidatorStatus.active_slashed + : ValidatorStatus.active_exiting; + } + + // exited + if (validator.getExitEpoch().isLessThanOrEqualTo(epoch) + && epoch.isLessThan(validator.getWithdrawableEpoch())) { + return validator.isSlashed() + ? ValidatorStatus.exited_slashed + : ValidatorStatus.exited_unslashed; + } + + // withdrawal + if (validator.getWithdrawableEpoch().isLessThanOrEqualTo(epoch)) { + return validator.getEffectiveBalance().isGreaterThan(UInt64.ZERO) + ? ValidatorStatus.withdrawal_possible + : ValidatorStatus.withdrawal_done; + } + throw new IllegalStateException("Unable to determine validator status"); + } +} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/BlockHeader.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/BlockHeader.java deleted file mode 100644 index 3d9bbd49ebb..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/BlockHeader.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import static tech.pegasys.teku.api.schema.SchemaConstants.EXAMPLE_BYTES32; -import static tech.pegasys.teku.api.schema.SchemaConstants.PATTERN_BYTES32; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.MoreObjects; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.api.schema.BeaconBlockHeader; -import tech.pegasys.teku.api.schema.SignedBeaconBlockHeader; -import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock; - -public class BlockHeader { - @Schema(type = "string", example = EXAMPLE_BYTES32, pattern = PATTERN_BYTES32) - public final Bytes32 root; - - public final boolean canonical; - public final SignedBeaconBlockHeader header; - - @JsonCreator - public BlockHeader( - @JsonProperty("root") final Bytes32 root, - @JsonProperty("canonical") final boolean canonical, - @JsonProperty("header") final SignedBeaconBlockHeader header) { - this.root = root; - this.canonical = canonical; - this.header = header; - } - - public BlockHeader(final SignedBeaconBlock signedBeaconBlock, final boolean canonical) { - this.root = signedBeaconBlock.getRoot(); - this.canonical = canonical; - this.header = - new SignedBeaconBlockHeader( - new BeaconBlockHeader( - signedBeaconBlock.getSlot(), - signedBeaconBlock.getMessage().getProposerIndex(), - signedBeaconBlock.getParentRoot(), - signedBeaconBlock.getStateRoot(), - signedBeaconBlock.getBodyRoot()), - new BLSSignature(signedBeaconBlock.getSignature())); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final BlockHeader that = (BlockHeader) o; - return canonical == that.canonical - && Objects.equals(root, that.root) - && Objects.equals(header, that.header); - } - - @Override - public int hashCode() { - return Objects.hash(root, canonical, header); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("root", root) - .add("canonical", canonical) - .add("header", header) - .toString(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/EpochCommitteeResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/EpochCommitteeResponse.java deleted file mode 100644 index 23a0a16bbfc..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/EpochCommitteeResponse.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import static tech.pegasys.teku.api.schema.SchemaConstants.EXAMPLE_UINT64; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.Objects; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.List; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.infrastructure.unsigned.UInt64Util; -import tech.pegasys.teku.spec.datastructures.state.CommitteeAssignment; - -public class EpochCommitteeResponse { - @JsonProperty("index") - @Schema(type = "string", example = EXAMPLE_UINT64, description = "Index of committee") - public final UInt64 index; - - @JsonProperty("slot") - @Schema( - type = "string", - example = EXAMPLE_UINT64, - description = "The slot at which the committee has to attest.") - public final UInt64 slot; - - @JsonProperty("validators") - @ArraySchema(schema = @Schema(type = "string", example = EXAMPLE_UINT64)) - public final List validators; - - public EpochCommitteeResponse(final CommitteeAssignment committeeAssignment) { - this.slot = committeeAssignment.slot(); - this.index = committeeAssignment.committeeIndex(); - this.validators = UInt64Util.intToUInt64List(committeeAssignment.committee()); - } - - @JsonCreator - public EpochCommitteeResponse( - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("index") final UInt64 index, - @JsonProperty("validators") final List validators) { - this.slot = slot; - this.index = index; - this.validators = validators; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof EpochCommitteeResponse)) { - return false; - } - EpochCommitteeResponse that = (EpochCommitteeResponse) o; - return Objects.equal(index, that.index) - && Objects.equal(slot, that.slot) - && Objects.equal(validators, that.validators); - } - - @Override - public int hashCode() { - return Objects.hashCode(index, slot, validators); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/FinalityCheckpointsResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/FinalityCheckpointsResponse.java deleted file mode 100644 index ba5dae36a80..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/FinalityCheckpointsResponse.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.MoreObjects; -import java.util.Objects; -import tech.pegasys.teku.api.schema.Checkpoint; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState; - -@SuppressWarnings("JavaCase") -public class FinalityCheckpointsResponse { - @JsonProperty("previous_justified") - public final Checkpoint previous_justified; - - @JsonProperty("current_justified") - public final Checkpoint current_justified; - - @JsonProperty("finalized") - public final Checkpoint finalized; - - @JsonCreator - public FinalityCheckpointsResponse( - final @JsonProperty("previous_justified") Checkpoint previous_justified, - final @JsonProperty("current_justified") Checkpoint current_justified, - final @JsonProperty("finalized") Checkpoint finalized) { - this.previous_justified = previous_justified; - this.current_justified = current_justified; - this.finalized = finalized; - } - - public static FinalityCheckpointsResponse fromState(final BeaconState state) { - if (state.getFinalizedCheckpoint().getEpoch().equals(UInt64.ZERO)) { - return new FinalityCheckpointsResponse(Checkpoint.EMPTY, Checkpoint.EMPTY, Checkpoint.EMPTY); - } - return new FinalityCheckpointsResponse( - new Checkpoint(state.getPreviousJustifiedCheckpoint()), - new Checkpoint(state.getCurrentJustifiedCheckpoint()), - new Checkpoint(state.getFinalizedCheckpoint())); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final FinalityCheckpointsResponse that = (FinalityCheckpointsResponse) o; - return Objects.equals(previous_justified, that.previous_justified) - && Objects.equals(current_justified, that.current_justified) - && Objects.equals(finalized, that.finalized); - } - - @Override - public int hashCode() { - return Objects.hash(previous_justified, current_justified, finalized); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("previous_justified", previous_justified) - .add("current_justified", current_justified) - .add("finalized", finalized) - .toString(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetBlockHeadersResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetBlockHeadersResponse.java deleted file mode 100644 index 4efe938b8cd..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetBlockHeadersResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -@SuppressWarnings("JavaCase") -public class GetBlockHeadersResponse { - @JsonProperty("execution_optimistic") - public final boolean execution_optimistic; - - @JsonProperty("data") - public final List data; - - @JsonCreator - public GetBlockHeadersResponse( - @JsonProperty("execution_optimistic") final boolean executionOptimistic, - @JsonProperty("data") final List data) { - this.execution_optimistic = executionOptimistic; - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetBlockResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetBlockResponse.java deleted file mode 100644 index 655740526a0..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetBlockResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import tech.pegasys.teku.api.schema.SignedBeaconBlock; - -public class GetBlockResponse { - public final SignedBeaconBlock data; - - @JsonCreator - public GetBlockResponse(@JsonProperty("data") final SignedBeaconBlock data) { - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetBlockRootResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetBlockRootResponse.java deleted file mode 100644 index 358cc4abe82..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetBlockRootResponse.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import tech.pegasys.teku.api.schema.Root; - -@SuppressWarnings("JavaCase") -public class GetBlockRootResponse { - - @JsonProperty("execution_optimistic") - public final boolean execution_optimistic; - - @JsonProperty("data") - public final Root data; - - @JsonCreator - public GetBlockRootResponse( - @JsonProperty("data") final Root data, - @JsonProperty("execution_optimistic") final boolean executionOptimistic) { - this.data = data; - this.execution_optimistic = executionOptimistic; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetGenesisResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetGenesisResponse.java deleted file mode 100644 index 7fe23d8e97d..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetGenesisResponse.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - -public class GetGenesisResponse { - @JsonProperty("data") - public final GenesisData data; - - @JsonCreator - public GetGenesisResponse(@JsonProperty("data") final GenesisData data) { - this.data = data; - } - - public GenesisData getData() { - return data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetHashTreeRootResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetHashTreeRootResponse.java deleted file mode 100644 index 10767e5e6a1..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetHashTreeRootResponse.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import tech.pegasys.teku.api.schema.Root; - -public class GetHashTreeRootResponse { - - @JsonProperty("data") - public final Root data; - - @JsonCreator - public GetHashTreeRootResponse(@JsonProperty("data") final Root data) { - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetProposerSlashingsResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetProposerSlashingsResponse.java deleted file mode 100644 index b73ad4eca17..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetProposerSlashingsResponse.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import tech.pegasys.teku.api.schema.ProposerSlashing; - -public class GetProposerSlashingsResponse { - @JsonProperty("data") - public final List data; - - @JsonCreator - public GetProposerSlashingsResponse(@JsonProperty("data") final List data) { - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateCommitteesResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateCommitteesResponse.java deleted file mode 100644 index f6e5d8b443f..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateCommitteesResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -@SuppressWarnings("JavaCase") -public class GetStateCommitteesResponse { - @JsonProperty("execution_optimistic") - public final boolean execution_optimistic; - - @JsonProperty("data") - public final List data; - - @JsonCreator - public GetStateCommitteesResponse( - @JsonProperty("execution_optimistic") final boolean executionOptimistic, - @JsonProperty("data") final List data) { - this.execution_optimistic = executionOptimistic; - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateFinalityCheckpointsResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateFinalityCheckpointsResponse.java deleted file mode 100644 index 66eb2d8677b..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateFinalityCheckpointsResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - -@SuppressWarnings("JavaCase") -public class GetStateFinalityCheckpointsResponse { - - @JsonProperty("execution_optimistic") - public final boolean execution_optimistic; - - @JsonProperty("data") - public final FinalityCheckpointsResponse data; - - @JsonCreator - public GetStateFinalityCheckpointsResponse( - @JsonProperty("execution_optimistic") final boolean executionOptimistic, - @JsonProperty("data") final FinalityCheckpointsResponse data) { - this.execution_optimistic = executionOptimistic; - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateForkResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateForkResponse.java deleted file mode 100644 index 7339f32f965..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateForkResponse.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import tech.pegasys.teku.api.schema.Fork; - -@SuppressWarnings("JavaCase") -public class GetStateForkResponse { - @JsonProperty("execution_optimistic") - public final boolean execution_optimistic; - - @JsonProperty("data") - public final Fork data; - - @JsonCreator - public GetStateForkResponse( - @JsonProperty("execution_optimistic") final boolean executionOptimistic, - @JsonProperty("data") final Fork data) { - this.execution_optimistic = executionOptimistic; - this.data = data; - } - - public Fork getData() { - return data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateRootResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateRootResponse.java deleted file mode 100644 index 58ba5b256ab..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateRootResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import tech.pegasys.teku.api.schema.Root; - -@SuppressWarnings("JavaCase") -public class GetStateRootResponse { - @JsonProperty("execution_optimistic") - public final boolean execution_optimistic; - - @JsonProperty("data") - public final Root data; - - @JsonCreator - public GetStateRootResponse( - @JsonProperty("execution_optimistic") final boolean executionOptimistic, - @JsonProperty("data") final Root data) { - this.execution_optimistic = executionOptimistic; - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateSyncCommitteesResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateSyncCommitteesResponse.java deleted file mode 100644 index 99a622d5e97..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateSyncCommitteesResponse.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - -@SuppressWarnings("JavaCase") -public class GetStateSyncCommitteesResponse { - @JsonProperty("execution_optimistic") - public final boolean execution_optimistic; - - public final StateSyncCommittees data; - - @JsonCreator - public GetStateSyncCommitteesResponse( - @JsonProperty("execution_optimistic") final boolean executionOptimistic, - @JsonProperty("data") final StateSyncCommittees data) { - this.execution_optimistic = executionOptimistic; - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateValidatorBalancesResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateValidatorBalancesResponse.java deleted file mode 100644 index d7f7e6c3a78..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateValidatorBalancesResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -@SuppressWarnings("JavaCase") -public class GetStateValidatorBalancesResponse { - @JsonProperty("execution_optimistic") - public final boolean execution_optimistic; - - @JsonProperty("data") - public final List data; - - @JsonCreator - public GetStateValidatorBalancesResponse( - @JsonProperty("execution_optimistic") final boolean executionOptimistic, - @JsonProperty("data") final List data) { - this.execution_optimistic = executionOptimistic; - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateValidatorResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateValidatorResponse.java deleted file mode 100644 index ae44674494a..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateValidatorResponse.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - -@SuppressWarnings("JavaCase") -public class GetStateValidatorResponse { - @JsonProperty("execution_optimistic") - public final boolean execution_optimistic; - - @JsonProperty("data") - public final ValidatorResponse data; - - @JsonCreator - public GetStateValidatorResponse( - @JsonProperty("execution_optimistic") final boolean executionOptimistic, - @JsonProperty("data") final ValidatorResponse data) { - this.execution_optimistic = executionOptimistic; - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateValidatorsResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateValidatorsResponse.java deleted file mode 100644 index 9ec909b4561..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetStateValidatorsResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -@SuppressWarnings("JavaCase") -public class GetStateValidatorsResponse { - @JsonProperty("execution_optimistic") - public final boolean execution_optimistic; - - @JsonProperty("data") - public final List data; - - @JsonCreator - public GetStateValidatorsResponse( - @JsonProperty("execution_optimistic") final boolean executionOptimistic, - @JsonProperty("data") final List data) { - this.execution_optimistic = executionOptimistic; - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetVoluntaryExitsResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetVoluntaryExitsResponse.java deleted file mode 100644 index 867740c7149..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/GetVoluntaryExitsResponse.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import tech.pegasys.teku.api.schema.SignedVoluntaryExit; - -public class GetVoluntaryExitsResponse { - @JsonProperty("data") - public final List data; - - @JsonCreator - public GetVoluntaryExitsResponse(@JsonProperty("data") final List data) { - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/PostDataFailure.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/PostDataFailure.java deleted file mode 100644 index 470b6d2c0d1..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/PostDataFailure.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -public class PostDataFailure { - @Schema(type = "string", format = "uint64") - public final UInt64 index; - - public final String message; - - @JsonCreator - public PostDataFailure( - @JsonProperty("index") final UInt64 index, @JsonProperty("message") final String message) { - this.index = index; - this.message = message; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final PostDataFailure that = (PostDataFailure) o; - return Objects.equals(index, that.index) && Objects.equals(message, that.message); - } - - @Override - public int hashCode() { - return Objects.hash(index, message); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/PostDataFailureResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/PostDataFailureResponse.java deleted file mode 100644 index 68b6d59c409..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/PostDataFailureResponse.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.List; -import java.util.Objects; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -public class PostDataFailureResponse { - @Schema(type = "string", format = "uint64") - public final UInt64 code; - - public final String message; - public final List failures; - - @JsonCreator - public PostDataFailureResponse( - @JsonProperty("code") final int code, - @JsonProperty("message") final String message, - @JsonProperty("failures") final List failures) { - this.code = UInt64.valueOf(code); - this.message = message; - this.failures = failures; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final PostDataFailureResponse that = (PostDataFailureResponse) o; - return Objects.equals(code, that.code) - && Objects.equals(message, that.message) - && Objects.equals(failures, that.failures); - } - - @Override - public int hashCode() { - return Objects.hash(code, message, failures); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/StateSyncCommittees.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/StateSyncCommittees.java deleted file mode 100644 index a8f5992cfdd..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/StateSyncCommittees.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import static tech.pegasys.teku.api.schema.SchemaConstants.EXAMPLE_UINT64; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.MoreObjects; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.List; -import java.util.Objects; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -public class StateSyncCommittees { - @JsonProperty("validators") - @ArraySchema(schema = @Schema(type = "string", example = EXAMPLE_UINT64)) - public final List validators; - - // so that swagger can list as [[String]], the getter will be what reflection picks up - // and the actual variable storing as uint64 will be ignored - @JsonProperty("validator_aggregates") - public List> getValidatorAggregates() { - return validatorAggregates.stream() - .map(e -> e.stream().map(UInt64::toString).toList()) - .toList(); - } - - @JsonIgnore public final List> validatorAggregates; - - @JsonCreator - public StateSyncCommittees( - @JsonProperty("validators") final List validators, - @JsonProperty("validator_aggregates") final List> validatorAggregates) { - this.validators = validators; - this.validatorAggregates = validatorAggregates; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final StateSyncCommittees that = (StateSyncCommittees) o; - return Objects.equals(validators, that.validators) - && Objects.equals(validatorAggregates, that.validatorAggregates); - } - - @Override - public int hashCode() { - return Objects.hash(validators, validatorAggregates); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("validators", validators) - .add("validatorAggregates", validatorAggregates) - .toString(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/ValidatorBalanceResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/ValidatorBalanceResponse.java deleted file mode 100644 index e1b083868ee..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/ValidatorBalanceResponse.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import static tech.pegasys.teku.api.schema.SchemaConstants.EXAMPLE_UINT64; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Optional; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState; - -public class ValidatorBalanceResponse { - @JsonProperty("index") - @Schema( - type = "string", - example = EXAMPLE_UINT64, - description = "Index of validator in validator registry.") - public final UInt64 index; - - @JsonProperty("balance") - @Schema( - type = "string", - example = EXAMPLE_UINT64, - description = "Current validator balance in gwei.") - public final UInt64 balance; - - @JsonCreator - public ValidatorBalanceResponse( - @JsonProperty("index") final UInt64 index, @JsonProperty("balance") final UInt64 balance) { - this.index = index; - this.balance = balance; - } - - public static Optional fromState( - final BeaconState state, final Integer index) { - if (index >= state.getValidators().size()) { - return Optional.empty(); - } - return Optional.of( - new ValidatorBalanceResponse(UInt64.valueOf(index), state.getBalances().getElement(index))); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof ValidatorBalanceResponse)) { - return false; - } - ValidatorBalanceResponse that = (ValidatorBalanceResponse) o; - return Objects.equal(index, that.index) && Objects.equal(balance, that.balance); - } - - @Override - public int hashCode() { - return Objects.hashCode(index, balance); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this).add("index", index).add("balance", balance).toString(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/ValidatorResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/ValidatorResponse.java deleted file mode 100644 index 2b508be4760..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/beacon/ValidatorResponse.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * 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.api.response.v1.beacon; - -import static tech.pegasys.teku.api.schema.SchemaConstants.EXAMPLE_UINT64; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.MoreObjects; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import java.util.Optional; -import tech.pegasys.teku.api.response.ValidatorStatus; -import tech.pegasys.teku.api.schema.Validator; -import tech.pegasys.teku.bls.BLSPublicKey; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState; - -public class ValidatorResponse { - - @JsonProperty("index") - @Schema( - type = "string", - example = EXAMPLE_UINT64, - description = "Index of validator in validator registry.") - public final UInt64 index; - - @JsonProperty("balance") - @Schema( - type = "string", - example = EXAMPLE_UINT64, - description = "Current validator balance in gwei.") - public final UInt64 balance; - - @JsonProperty("status") - public final ValidatorStatus status; - - @JsonProperty("validator") - public final Validator validator; - - @JsonCreator - public ValidatorResponse( - @JsonProperty("index") final UInt64 index, - @JsonProperty("balance") final UInt64 balance, - @JsonProperty("status") final ValidatorStatus status, - @JsonProperty("validator") final Validator validator) { - this.index = index; - this.balance = balance; - this.status = status; - this.validator = validator; - } - - public static Optional fromState( - final BeaconState state, - final Integer index, - final UInt64 epoch, - final UInt64 farFutureEpoch) { - if (index >= state.getValidators().size()) { - return Optional.empty(); - } - tech.pegasys.teku.spec.datastructures.state.Validator validatorInternal = - state.getValidators().get(index); - return Optional.of( - new ValidatorResponse( - UInt64.valueOf(index), - state.getBalances().getElement(index), - getValidatorStatus(epoch, validatorInternal, farFutureEpoch), - new Validator(validatorInternal))); - } - - public static ValidatorStatus getValidatorStatus( - final BeaconState state, - final Integer validatorIndex, - final UInt64 epoch, - final UInt64 farFutureEpoch) { - return getValidatorStatus(epoch, state.getValidators().get(validatorIndex), farFutureEpoch); - } - - public static ValidatorStatus getValidatorStatus( - final UInt64 epoch, - final tech.pegasys.teku.spec.datastructures.state.Validator validator, - final UInt64 farFutureEpoch) { - // pending - if (validator.getActivationEpoch().isGreaterThan(epoch)) { - return validator.getActivationEligibilityEpoch().equals(farFutureEpoch) - ? ValidatorStatus.pending_initialized - : ValidatorStatus.pending_queued; - } - // active - if (validator.getActivationEpoch().isLessThanOrEqualTo(epoch) - && epoch.isLessThan(validator.getExitEpoch())) { - if (validator.getExitEpoch().equals(farFutureEpoch)) { - return ValidatorStatus.active_ongoing; - } - return validator.isSlashed() - ? ValidatorStatus.active_slashed - : ValidatorStatus.active_exiting; - } - - // exited - if (validator.getExitEpoch().isLessThanOrEqualTo(epoch) - && epoch.isLessThan(validator.getWithdrawableEpoch())) { - return validator.isSlashed() - ? ValidatorStatus.exited_slashed - : ValidatorStatus.exited_unslashed; - } - - // withdrawal - if (validator.getWithdrawableEpoch().isLessThanOrEqualTo(epoch)) { - return validator.getEffectiveBalance().isGreaterThan(UInt64.ZERO) - ? ValidatorStatus.withdrawal_possible - : ValidatorStatus.withdrawal_done; - } - throw new IllegalStateException("Unable to determine validator status"); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final ValidatorResponse that = (ValidatorResponse) o; - return Objects.equals(index, that.index) - && Objects.equals(balance, that.balance) - && status == that.status - && Objects.equals(validator, that.validator); - } - - @JsonIgnore - public Integer getIndex() { - return index.intValue(); - } - - @JsonIgnore - public BLSPublicKey getPublicKey() { - return validator.pubkey.asBLSPublicKey(); - } - - @JsonIgnore - public ValidatorStatus getStatus() { - return status; - } - - @Override - public int hashCode() { - return Objects.hash(index, balance, status, validator); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("index", index) - .add("balance", balance) - .add("status", status) - .add("validator", validator) - .toString(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/config/DepositContract.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/config/DepositContract.java deleted file mode 100644 index 527aa0bbeb2..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/config/DepositContract.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.api.response.v1.config; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -@SuppressWarnings("JavaCase") -public class DepositContract { - @Schema(type = "string", format = "uint64") - public final UInt64 chain_id; - - public final String address; - - @JsonCreator - public DepositContract( - @JsonProperty("chain_id") final UInt64 chain_id, - @JsonProperty("address") final String address) { - this.chain_id = chain_id; - this.address = address; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/config/GetDepositContractResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/config/GetDepositContractResponse.java deleted file mode 100644 index 722417ec7bf..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/config/GetDepositContractResponse.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.api.response.v1.config; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -public class GetDepositContractResponse { - public final DepositContract data; - - @JsonCreator - public GetDepositContractResponse(@JsonProperty("data") final DepositContract data) { - this.data = data; - } - - public GetDepositContractResponse(final int depositChainId, final String depositContractAddress) { - this.data = new DepositContract(UInt64.valueOf(depositChainId), depositContractAddress); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/config/GetForkScheduleResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/config/GetForkScheduleResponse.java deleted file mode 100644 index 269058a1ef6..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/config/GetForkScheduleResponse.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.api.response.v1.config; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import tech.pegasys.teku.api.schema.Fork; - -public class GetForkScheduleResponse { - public final List data; - - @JsonCreator - public GetForkScheduleResponse(@JsonProperty("data") final List data) { - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/GetPeerCountResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/GetPeerCountResponse.java deleted file mode 100644 index cfaea17334a..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/GetPeerCountResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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.api.response.v1.node; - -import java.util.List; -import java.util.Objects; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -public class GetPeerCountResponse { - public final PeerCount data; - - public GetPeerCountResponse(final PeerCount data) { - this.data = data; - } - - public static GetPeerCountResponse create(final List peers) { - int disconnected = 0; - int connecting = 0; - int connected = 0; - int disconnecting = 0; - - for (Peer peer : peers) { - switch (peer.state) { - case disconnected: - disconnected++; - break; - case connecting: - connecting++; - break; - case connected: - connected++; - break; - case disconnecting: - disconnecting++; - break; - default: - break; - } - } - - return new GetPeerCountResponse( - new PeerCount( - UInt64.valueOf(disconnected), - UInt64.valueOf(connecting), - UInt64.valueOf(connected), - UInt64.valueOf(disconnecting))); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final GetPeerCountResponse that = (GetPeerCountResponse) o; - return Objects.equals(data, that.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/Identity.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/Identity.java deleted file mode 100644 index bef32c4b58d..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/Identity.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * 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.api.response.v1.node; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.List; -import java.util.Objects; -import tech.pegasys.teku.api.schema.Metadata; - -public class Identity { - @JsonProperty("peer_id") - @Schema( - description = - "Cryptographic hash of a peer’s public key. " - + "[Read more](https://docs.libp2p.io/concepts/peer-id/)", - example = "QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N") - public final String peerId; - - @JsonProperty("enr") - @Schema( - description = "Ethereum node record. [Read more](https://eips.ethereum.org/EIPS/eip-778)", - example = - "enr:-IS4QHCYrYZbAKWCBRlAy5zzaDZXJBGkcnh4MHcBFZntXNFrdvJjX04jRzjzCBOonrkTfj499S" - + "ZuOh8R33Ls8RRcy5wBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2_oxVtw0RW_QAdpzBQA8yWM0xOIN1ZHCCdl8") - public final String enr; - - @JsonProperty("p2p_addresses") - @ArraySchema( - arraySchema = - @Schema( - type = "string", - description = - "Node's addresses on which eth2 rpc requests are served. " - + "[Read more](https://docs.libp2p.io/reference/glossary/#multiaddr)", - example = "/ip4/7.7.7.7/tcp/4242/p2p/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N")) - public final List p2pAddresses; - - @JsonProperty("discovery_addresses") - @ArraySchema( - arraySchema = - @Schema( - type = "string", - description = - "Node's addresses on which is listening for discv5 requests. " - + "[Read more](https://docs.libp2p.io/reference/glossary/#multiaddr)", - example = "/ip4/7.7.7.7/tcp/4242/p2p/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N")) - public final List discoveryAddresses; - - @JsonProperty("metadata") - public final Metadata metadata; - - @JsonCreator - public Identity( - @JsonProperty("peer_id") final String peerId, - @JsonProperty("enr") final String enr, - @JsonProperty("p2p_addresses") final List p2pAddresses, - @JsonProperty("discovery_addresses") final List discoveryAddresses, - @JsonProperty("metadata") final Metadata metadata) { - this.peerId = peerId; - this.enr = enr; - this.p2pAddresses = p2pAddresses; - this.discoveryAddresses = discoveryAddresses; - this.metadata = metadata; - } - - public String getPeerId() { - return peerId; - } - - public String getEnr() { - return enr; - } - - public List getP2pAddresses() { - return p2pAddresses; - } - - public List getDiscoveryAddresses() { - return discoveryAddresses; - } - - public Metadata getMetadata() { - return metadata; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final Identity identity = (Identity) o; - return Objects.equals(peerId, identity.peerId) - && Objects.equals(enr, identity.enr) - && Objects.equals(p2pAddresses, identity.p2pAddresses) - && Objects.equals(discoveryAddresses, identity.discoveryAddresses) - && Objects.equals(metadata, identity.metadata); - } - - @Override - public int hashCode() { - return Objects.hash(peerId, enr, p2pAddresses, discoveryAddresses, metadata); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/IdentityResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/IdentityResponse.java deleted file mode 100644 index e938bc35937..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/IdentityResponse.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.api.response.v1.node; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - -public class IdentityResponse { - public final Identity data; - - @JsonCreator - public IdentityResponse(@JsonProperty("data") final Identity data) { - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/Meta.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/Meta.java deleted file mode 100644 index ed295452e57..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/Meta.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.api.response.v1.node; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.MoreObjects; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -public class Meta { - @JsonProperty("count") - @Schema(type = "number", description = "Total number of items") - public final UInt64 count; - - @JsonCreator - public Meta(@JsonProperty("count") final UInt64 count) { - this.count = count; - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this).add("count", count).toString(); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Meta meta = (Meta) o; - return Objects.equals(count, meta.count); - } - - @Override - public int hashCode() { - return Objects.hash(count); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/PeerCount.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/PeerCount.java deleted file mode 100644 index 4e86743fc50..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/PeerCount.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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.api.response.v1.node; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.MoreObjects; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -public class PeerCount { - @Schema(type = "string", format = "uint64") - public final UInt64 disconnected; - - @Schema(type = "string", format = "uint64") - public final UInt64 connecting; - - @Schema(type = "string", format = "uint64") - public final UInt64 connected; - - @Schema(type = "string", format = "uint64") - public final UInt64 disconnecting; - - @JsonCreator - public PeerCount( - @JsonProperty("disconnected") final UInt64 disconnected, - @JsonProperty("connecting") final UInt64 connecting, - @JsonProperty("connected") final UInt64 connected, - @JsonProperty("disconnecting") final UInt64 disconnecting) { - this.disconnected = disconnected; - this.connecting = connecting; - this.connected = connected; - this.disconnecting = disconnecting; - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("disconnected", disconnected) - .add("connecting", connecting) - .add("connected", connected) - .add("disconnecting", disconnecting) - .toString(); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final PeerCount peerCount = (PeerCount) o; - return Objects.equals(disconnected, peerCount.disconnected) - && Objects.equals(connecting, peerCount.connecting) - && Objects.equals(connected, peerCount.connected) - && Objects.equals(disconnecting, peerCount.disconnecting); - } - - @Override - public int hashCode() { - return Objects.hash(disconnected, connecting, connected, disconnecting); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/PeerResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/PeerResponse.java deleted file mode 100644 index 9e50ee1f0ad..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/PeerResponse.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.api.response.v1.node; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.Objects; - -public class PeerResponse { - @JsonProperty("data") - public final Peer data; - - @JsonCreator - public PeerResponse(@JsonProperty("data") final Peer data) { - this.data = data; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final PeerResponse that = (PeerResponse) o; - return Objects.equals(data, that.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/PeersResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/PeersResponse.java deleted file mode 100644 index fa787839452..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/PeersResponse.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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.api.response.v1.node; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import java.util.Objects; - -public class PeersResponse { - public final List data; - public final Meta meta; - - @JsonCreator - public PeersResponse( - @JsonProperty("data") final List data, @JsonProperty("meta") final Meta meta) { - this.data = data; - this.meta = meta; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final PeersResponse that = (PeersResponse) o; - return Objects.equals(data, that.data) && Objects.equals(meta, that.meta); - } - - @Override - public int hashCode() { - return Objects.hash(data, meta); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/Syncing.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/Syncing.java deleted file mode 100644 index c2e63010e0b..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/Syncing.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * 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.api.response.v1.node; - -import static tech.pegasys.teku.api.schema.SchemaConstants.PATTERN_UINT64; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.MoreObjects; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Syncing { - @JsonProperty("head_slot") - @Schema(type = "string", pattern = PATTERN_UINT64, description = "Beacon node's head slot") - public final UInt64 headSlot; - - @JsonProperty("sync_distance") - @Schema( - type = "string", - pattern = PATTERN_UINT64, - description = "How many slots node needs to process to reach head. 0 if synced.") - public final UInt64 syncDistance; - - @JsonProperty("is_syncing") - @Schema( - type = "boolean", - description = "Set to true if the node is syncing, false if the node is synced.") - public final boolean isSyncing; - - @JsonProperty("is_optimistic") - @Schema( - type = "boolean", - description = "Set to true if the node is optimistically fetching blocks.") - public final Boolean isOptimistic; - - @JsonProperty("el_offline") - @Schema(type = "boolean", description = "Set to true if the execution client is offline.") - public final Boolean elOffline; - - public Syncing( - final UInt64 headSlot, - final UInt64 syncDistance, - final boolean isSyncing, - final boolean elOffline) { - this(headSlot, syncDistance, isSyncing, false, elOffline); - } - - @JsonCreator - public Syncing( - @JsonProperty("head_slot") final UInt64 headSlot, - @JsonProperty("sync_distance") final UInt64 syncDistance, - @JsonProperty("is_syncing") final boolean isSyncing, - @JsonProperty("is_optimistic") final boolean isOptimistic, - @JsonProperty("el_offline") final boolean elOffline) { - this.headSlot = headSlot; - this.syncDistance = syncDistance; - this.isSyncing = isSyncing; - this.isOptimistic = isOptimistic; - this.elOffline = elOffline; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final Syncing syncing = (Syncing) o; - return isSyncing == syncing.isSyncing - && Objects.equals(headSlot, syncing.headSlot) - && Objects.equals(syncDistance, syncing.syncDistance) - && Objects.equals(isOptimistic, syncing.isOptimistic) - && Objects.equals(elOffline, syncing.elOffline); - } - - @Override - public int hashCode() { - return Objects.hash(headSlot, syncDistance, isSyncing, isOptimistic, elOffline); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("headSlot", headSlot) - .add("syncDistance", syncDistance) - .add("isSyncing", isSyncing) - .add("isOptimistic", isOptimistic) - .add("elOffline", elOffline) - .toString(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/SyncingResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/SyncingResponse.java deleted file mode 100644 index 6adc2b5f0b8..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/SyncingResponse.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.api.response.v1.node; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.Objects; - -public class SyncingResponse { - public final Syncing data; - - @JsonCreator - public SyncingResponse(@JsonProperty("data") final Syncing data) { - this.data = data; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final SyncingResponse that = (SyncingResponse) o; - return Objects.equals(data, that.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/Version.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/Version.java deleted file mode 100644 index 30a65325b5f..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/Version.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.api.response.v1.node; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; - -public class Version { - @JsonProperty("version") - @Schema( - description = - "A string which uniquely identifies the client implementation and its version; " - + "similar to [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3).", - example = "teku/v0.12.6-dev-994997f8/osx-x86_64/adoptopenjdk-java-11") - public final String version; - - @JsonCreator - public Version(@JsonProperty("version") final String version) { - this.version = version; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final Version version1 = (Version) o; - return Objects.equals(version, version1.version); - } - - @Override - public int hashCode() { - return Objects.hash(version); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/VersionResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/VersionResponse.java deleted file mode 100644 index ca61a8b7430..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/node/VersionResponse.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.api.response.v1.node; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.Objects; - -public class VersionResponse { - public final Version data; - - @JsonCreator - public VersionResponse(@JsonProperty("data") final Version data) { - this.data = data; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final VersionResponse that = (VersionResponse) o; - return Objects.equals(data, that.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/DepositTreeSnapshot.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/DepositTreeSnapshot.java deleted file mode 100644 index 91680a60f2c..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/DepositTreeSnapshot.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.api.response.v1.teku; - -import static tech.pegasys.teku.api.schema.SchemaConstants.EXAMPLE_BYTES32; -import static tech.pegasys.teku.api.schema.SchemaConstants.PATTERN_BYTES32; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.List; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -public class DepositTreeSnapshot { - @JsonProperty("finalized") - @ArraySchema( - schema = @Schema(type = "string", example = EXAMPLE_BYTES32, pattern = PATTERN_BYTES32), - arraySchema = @Schema(description = "List of finalized nodes in deposit tree")) - public List finalized; - - @JsonProperty("deposit_root") - @Schema( - type = "string", - example = EXAMPLE_BYTES32, - pattern = PATTERN_BYTES32, - description = "Root of finalized deposits") - public Bytes32 depositRoot; - - @JsonProperty("deposit_count") - @Schema( - type = "string", - format = "uint64", - example = "1", - description = "Number of deposits stored in the snapshot") - public UInt64 depositCount; - - @JsonProperty("execution_block_hash") - @Schema( - type = "string", - example = EXAMPLE_BYTES32, - pattern = PATTERN_BYTES32, - description = - "Hash of the execution block containing the highest index deposit stored in the snapshot") - public Bytes32 executionBlockHash; - - @JsonProperty("execution_block_height") - @Schema( - type = "string", - format = "uint64", - example = "1", - description = - "Height of the execution block in canonical chain containing the highest index deposit stored in the snapshot") - public UInt64 executionBlockHeight; - - @JsonCreator - public DepositTreeSnapshot( - @JsonProperty("finalized") final List finalized, - @JsonProperty("deposit_root") final Bytes32 depositRoot, - @JsonProperty("deposit_count") final UInt64 depositCount, - @JsonProperty("execution_block_hash") final Bytes32 executionBlockHash, - @JsonProperty("execution_block_height") final UInt64 executionBlockHeight) { - this.finalized = finalized; - this.depositRoot = depositRoot; - this.depositCount = depositCount; - this.executionBlockHash = executionBlockHash; - this.executionBlockHeight = executionBlockHeight; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/DepositWithIndex.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/DepositWithIndex.java deleted file mode 100644 index 9411efc1d51..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/DepositWithIndex.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.api.response.v1.teku; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import tech.pegasys.teku.api.schema.DepositData; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -public class DepositWithIndex { - @Schema(type = "string", format = "uint64") - public final UInt64 index; - - public final DepositData data; - - public DepositWithIndex( - @JsonProperty("index") final UInt64 index, @JsonProperty("data") final DepositData data) { - this.index = index; - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/Eth1DataWithVotesSchema.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/Eth1DataWithVotesSchema.java deleted file mode 100644 index eec9c26d203..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/Eth1DataWithVotesSchema.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.api.response.v1.teku; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import tech.pegasys.teku.api.schema.Eth1Data; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -public class Eth1DataWithVotesSchema { - @JsonProperty("eth1_data") - public Eth1Data eth1Data; - - @JsonProperty("votes") - @Schema(type = "string", format = "uint64") - public UInt64 votes; - - @JsonCreator - public Eth1DataWithVotesSchema( - @JsonProperty("eth1_data") final Eth1Data eth1Data, - @JsonProperty("votes") final UInt64 votes) { - this.eth1Data = eth1Data; - this.votes = votes; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/Eth1VotingSummarySchema.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/Eth1VotingSummarySchema.java deleted file mode 100644 index d14e1fb2cfd..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/Eth1VotingSummarySchema.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.api.response.v1.teku; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.List; -import tech.pegasys.teku.api.schema.Eth1Data; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -public class Eth1VotingSummarySchema { - @JsonProperty("state_eth1_data") - public Eth1Data stateEth1Data; - - @JsonProperty("eth1_data_votes") - public List eth1DataVotes; - - @JsonProperty("votes_required") - @Schema(type = "string", format = "uint64") - public UInt64 votesRequired; - - @JsonProperty("voting_period_slots") - @Schema(type = "string", format = "uint64") - public UInt64 votingPeriodSlots; - - @JsonProperty("voting_period_slots_left") - @Schema(type = "string", format = "uint64") - public UInt64 votingPeriodSlotsLeft; - - @JsonCreator - public Eth1VotingSummarySchema( - final @JsonProperty("state_eth1_data") Eth1Data stateEth1Data, - final @JsonProperty("eth1_data_votes") List eth1DataVotes, - final @JsonProperty("votes_required") UInt64 votesRequired, - final @JsonProperty("voting_period_slots") UInt64 votingPeriodSlots, - final @JsonProperty("voting_period_slots_left") UInt64 votingPeriodSlotsLeft) { - this.stateEth1Data = stateEth1Data; - this.eth1DataVotes = eth1DataVotes; - this.votesRequired = votesRequired; - this.votingPeriodSlots = votingPeriodSlots; - this.votingPeriodSlotsLeft = votingPeriodSlotsLeft; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetAllBlocksAtSlotResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetAllBlocksAtSlotResponse.java deleted file mode 100644 index faa72e4b360..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetAllBlocksAtSlotResponse.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.api.response.v1.teku; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.Set; -import tech.pegasys.teku.api.schema.SignedBeaconBlockWithRoot; -import tech.pegasys.teku.api.schema.Version; - -public class GetAllBlocksAtSlotResponse { - private final Version version; - - private final Set data; - - public Set getData() { - return data; - } - - public Version getVersion() { - return version; - } - - @JsonCreator - public GetAllBlocksAtSlotResponse( - @JsonProperty("version") final Version version, - @JsonProperty("data") final Set data) { - this.version = version; - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetDepositSnapshotResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetDepositSnapshotResponse.java deleted file mode 100644 index 881dc396c01..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetDepositSnapshotResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.api.response.v1.teku; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - -public class GetDepositSnapshotResponse { - - public DepositTreeSnapshot data; - - @JsonCreator - public GetDepositSnapshotResponse(@JsonProperty("data") final DepositTreeSnapshot data) { - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetDepositsResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetDepositsResponse.java deleted file mode 100644 index 6d968567f0b..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetDepositsResponse.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.api.response.v1.teku; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import java.util.Objects; - -public class GetDepositsResponse { - public final List data; - - @JsonCreator - public GetDepositsResponse(@JsonProperty("data") final List data) { - this.data = data; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GetDepositsResponse that = (GetDepositsResponse) o; - return Objects.equals(data, that.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetEth1DataCacheResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetEth1DataCacheResponse.java deleted file mode 100644 index aa50ab84925..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetEth1DataCacheResponse.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.api.response.v1.teku; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import tech.pegasys.teku.api.schema.Eth1Data; - -public class GetEth1DataCacheResponse { - - public final List data; - - @JsonCreator - public GetEth1DataCacheResponse(@JsonProperty("data") final List data) { - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetEth1DataResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetEth1DataResponse.java deleted file mode 100644 index d88577780c5..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetEth1DataResponse.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.api.response.v1.teku; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import tech.pegasys.teku.api.schema.Eth1Data; - -public class GetEth1DataResponse { - - public final Eth1Data data; - - @JsonCreator - public GetEth1DataResponse(@JsonProperty("data") final Eth1Data data) { - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetEth1VotingSummaryResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetEth1VotingSummaryResponse.java deleted file mode 100644 index e9cb3b75ae5..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetEth1VotingSummaryResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.api.response.v1.teku; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - -public class GetEth1VotingSummaryResponse { - - public Eth1VotingSummarySchema data; - - @JsonCreator - public GetEth1VotingSummaryResponse(@JsonProperty("data") final Eth1VotingSummarySchema data) { - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetPeerScoresResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetPeerScoresResponse.java deleted file mode 100644 index 16cc640163e..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetPeerScoresResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.api.response.v1.teku; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -public class GetPeerScoresResponse { - public final List data; - - @JsonCreator - public GetPeerScoresResponse(@JsonProperty("data") final List data) { - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetProposersDataResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetProposersDataResponse.java deleted file mode 100644 index a16b4fd9508..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/GetProposersDataResponse.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.api.response.v1.teku; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Map; - -@SuppressWarnings("JavaCase") -public class GetProposersDataResponse { - @Schema(implementation = ProposerDataSchema.class) - private final Map data; - - @JsonCreator - public GetProposersDataResponse(@JsonProperty("data") final Map proposers_data) { - this.data = proposers_data; - } - - public Map getData() { - return data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/PeerScore.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/PeerScore.java deleted file mode 100644 index 8804fbce8ae..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/PeerScore.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.api.response.v1.teku; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_NULL) -public class PeerScore { - - @JsonProperty("peer_id") - @Schema( - type = "string", - description = - "Cryptographic hash of a peer’s public key. " - + "'[Read more](https://docs.libp2p.io/concepts/peer-id/)", - example = "QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N") - public final String peerId; - - @JsonProperty("gossip_score") - @Schema( - type = "string", - format = "number", - description = "Gossip score for the associated peer.", - example = "1.2") - public final Double gossipScore; - - @JsonCreator - public PeerScore( - @JsonProperty("peer_id") final String peerId, - @JsonProperty("gossip_score") final Double gossipScore) { - this.peerId = peerId; - this.gossipScore = gossipScore; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof PeerScore)) { - return false; - } - PeerScore peerScore = (PeerScore) o; - return Objects.equals(peerId, peerScore.peerId) - && Objects.equals(gossipScore, peerScore.gossipScore); - } - - @Override - public int hashCode() { - return Objects.hash(peerId, gossipScore); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/PreparedProposerInfoSchema.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/PreparedProposerInfoSchema.java deleted file mode 100644 index bd5f3ba6024..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/PreparedProposerInfoSchema.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.api.response.v1.teku; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES20; -import static tech.pegasys.teku.api.schema.SchemaConstants.PATTERN_BYTES20; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import tech.pegasys.teku.infrastructure.bytes.Bytes20; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -@SuppressWarnings("JavaCase") -public class PreparedProposerInfoSchema { - - @Schema(type = "string", format = "uint64") - @JsonProperty("proposer_index") - UInt64 proposer_index; - - @Schema( - type = "string", - format = "byte", - pattern = PATTERN_BYTES20, - description = DESCRIPTION_BYTES20) - @JsonProperty("fee_recipient") - Bytes20 fee_recipient; - - @Schema(type = "string", format = "uint64") - @JsonProperty("expiry_slot") - UInt64 expiry_slot; -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/ProposerDataSchema.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/ProposerDataSchema.java deleted file mode 100644 index ce44b331031..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/ProposerDataSchema.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.api.response.v1.teku; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Schema; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -@SuppressWarnings("JavaCase") -public class ProposerDataSchema { - - @ArraySchema(schema = @Schema(implementation = PreparedProposerInfoSchema.class)) - @JsonProperty("prepared_proposers") - UInt64 proposer_index; - - @ArraySchema(schema = @Schema(implementation = RegisteredValidatorInfoSchema.class)) - @JsonProperty("registered_validators") - UInt64 registered_validators; -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/RegisteredValidatorInfoSchema.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/RegisteredValidatorInfoSchema.java deleted file mode 100644 index 368bbc0ac7a..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/teku/RegisteredValidatorInfoSchema.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.api.response.v1.teku; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES20; -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES48; -import static tech.pegasys.teku.api.schema.SchemaConstants.EXAMPLE_PUBKEY; -import static tech.pegasys.teku.api.schema.SchemaConstants.PATTERN_BYTES20; -import static tech.pegasys.teku.api.schema.SchemaConstants.PATTERN_PUBKEY; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import tech.pegasys.teku.api.schema.BLSPubKey; -import tech.pegasys.teku.infrastructure.bytes.Bytes20; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -@SuppressWarnings("JavaCase") -public class RegisteredValidatorInfoSchema { - - @Schema(type = "string", format = "uint64") - @JsonProperty("proposer_index") - UInt64 proposer_index; - - @Schema( - type = "string", - pattern = PATTERN_PUBKEY, - example = EXAMPLE_PUBKEY, - description = DESCRIPTION_BYTES48) - @JsonProperty("pubkey") - BLSPubKey pubkey; - - @Schema( - type = "string", - format = "byte", - pattern = PATTERN_BYTES20, - description = DESCRIPTION_BYTES20) - @JsonProperty("fee_recipient") - Bytes20 fee_recipient; - - @Schema(type = "string", format = "uint64") - @JsonProperty("gas_limit") - UInt64 gas_limit; - - @Schema(type = "string", format = "uint64") - @JsonProperty("timestamp") - UInt64 timestamp; - - @Schema(type = "string", format = "uint64") - @JsonProperty("expiry_slot") - UInt64 expiry_slot; -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/validator/GetNewBlindedBlockResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/validator/GetNewBlindedBlockResponse.java deleted file mode 100644 index fdf9e8611eb..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/validator/GetNewBlindedBlockResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.api.response.v1.validator; - -import tech.pegasys.teku.api.schema.Version; -import tech.pegasys.teku.api.schema.interfaces.UnsignedBlindedBlock; - -public class GetNewBlindedBlockResponse { - public final Version version; - public final UnsignedBlindedBlock data; - - public GetNewBlindedBlockResponse(final Version version, final UnsignedBlindedBlock data) { - this.version = version; - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/validator/GetNewBlockResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/validator/GetNewBlockResponse.java deleted file mode 100644 index 596f4a553a6..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/validator/GetNewBlockResponse.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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.api.response.v1.validator; - -import tech.pegasys.teku.api.schema.BeaconBlock; -import tech.pegasys.teku.api.schema.interfaces.UnsignedBlock; - -public class GetNewBlockResponse { - public final UnsignedBlock data; - - public GetNewBlockResponse(final BeaconBlock data) { - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/validator/PostValidatorLivenessResponse.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/validator/PostValidatorLivenessResponse.java deleted file mode 100644 index 03c22ef4f99..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/validator/PostValidatorLivenessResponse.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.api.response.v1.validator; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -public class PostValidatorLivenessResponse { - - public final List data; - - @JsonCreator - public PostValidatorLivenessResponse(@JsonProperty("data") final List data) { - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/validator/ValidatorLiveness.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/validator/ValidatorLiveness.java deleted file mode 100644 index e5c5557b8ed..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v1/validator/ValidatorLiveness.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.api.response.v1.validator; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.MoreObjects; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -public class ValidatorLiveness { - @Schema(type = "string", format = "uint64") - public final UInt64 index; - - @JsonProperty("is_live") - public final boolean isLive; - - @JsonCreator - public ValidatorLiveness( - @JsonProperty("index") final UInt64 index, @JsonProperty("is_live") final boolean isLive) { - this.index = index; - this.isLive = isLive; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final ValidatorLiveness that = (ValidatorLiveness) o; - return isLive == that.isLive && Objects.equals(index, that.index); - } - - @Override - public int hashCode() { - return Objects.hash(index, isLive); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this).add("index", index).add("isLive", isLive).toString(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v2/beacon/GetBlockResponseV2.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v2/beacon/GetBlockResponseV2.java deleted file mode 100644 index 6c7189990f2..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v2/beacon/GetBlockResponseV2.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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.api.response.v2.beacon; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import tech.pegasys.teku.api.schema.SignedBeaconBlock; -import tech.pegasys.teku.api.schema.Version; -import tech.pegasys.teku.api.schema.altair.SignedBeaconBlockAltair; -import tech.pegasys.teku.api.schema.bellatrix.SignedBeaconBlockBellatrix; -import tech.pegasys.teku.api.schema.capella.SignedBeaconBlockCapella; -import tech.pegasys.teku.api.schema.deneb.SignedBeaconBlockDeneb; -import tech.pegasys.teku.api.schema.electra.SignedBeaconBlockElectra; -import tech.pegasys.teku.api.schema.interfaces.SignedBlock; -import tech.pegasys.teku.api.schema.phase0.SignedBeaconBlockPhase0; - -@SuppressWarnings("JavaCase") -public class GetBlockResponseV2 { - - private final Version version; - - @JsonProperty("execution_optimistic") - public final boolean execution_optimistic; - - @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.EXTERNAL_PROPERTY, - property = "version") - @JsonSubTypes({ - @JsonSubTypes.Type(value = SignedBeaconBlockPhase0.class, name = "phase0"), - @JsonSubTypes.Type(value = SignedBeaconBlockAltair.class, name = "altair"), - @JsonSubTypes.Type(value = SignedBeaconBlockBellatrix.class, name = "bellatrix"), - @JsonSubTypes.Type(value = SignedBeaconBlockCapella.class, name = "capella"), - @JsonSubTypes.Type(value = SignedBeaconBlockDeneb.class, name = "deneb"), - @JsonSubTypes.Type(value = SignedBeaconBlockElectra.class, name = "electra") - }) - public final SignedBlock data; - - public Version getVersion() { - return version; - } - - public SignedBlock getData() { - return data; - } - - @JsonCreator - public GetBlockResponseV2( - @JsonProperty("version") final Version version, - @JsonProperty("execution_optimistic") final boolean executionOptimistic, - @JsonProperty("data") final SignedBeaconBlock data) { - this.version = version; - this.execution_optimistic = executionOptimistic; - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v2/debug/GetStateResponseV2.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v2/debug/GetStateResponseV2.java deleted file mode 100644 index d418cf14e21..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v2/debug/GetStateResponseV2.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.api.response.v2.debug; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import tech.pegasys.teku.api.schema.Version; -import tech.pegasys.teku.api.schema.interfaces.State; - -@SuppressWarnings("JavaCase") -public class GetStateResponseV2 { - - public final Version version; - - @JsonProperty("execution_optimistic") - public final boolean execution_optimistic; - - @JsonProperty("data") - public final State data; - - @JsonCreator - public GetStateResponseV2( - @JsonProperty("version") final Version version, - @JsonProperty("execution_optimistic") final boolean executionOptimistic, - @JsonProperty("data") final State data) { - this.version = version; - this.execution_optimistic = executionOptimistic; - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v2/validator/GetNewBlockResponseV2.java b/data/serializer/src/main/java/tech/pegasys/teku/api/response/v2/validator/GetNewBlockResponseV2.java deleted file mode 100644 index 75d459d73d9..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/response/v2/validator/GetNewBlockResponseV2.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.api.response.v2.validator; - -import tech.pegasys.teku.api.schema.Version; -import tech.pegasys.teku.api.schema.interfaces.UnsignedBlock; - -public class GetNewBlockResponseV2 { - - public final Version version; - public final UnsignedBlock data; - - public GetNewBlockResponseV2(final Version version, final UnsignedBlock data) { - this.version = version; - this.data = data; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/AggregateAndProof.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/AggregateAndProof.java deleted file mode 100644 index 9137327b2f1..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/AggregateAndProof.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES96; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.SpecVersion; - -@SuppressWarnings("JavaCase") -public class AggregateAndProof { - - @Schema(type = "string", format = "uint64") - public final UInt64 aggregator_index; - - public final Attestation aggregate; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96) - public final BLSSignature selection_proof; - - @JsonCreator - public AggregateAndProof( - @JsonProperty("aggregator_index") final UInt64 aggregator_index, - @JsonProperty("aggregate") final Attestation aggregate, - @JsonProperty("selection_proof") final BLSSignature selection_proof) { - this.aggregator_index = aggregator_index; - this.aggregate = aggregate; - this.selection_proof = selection_proof; - } - - public AggregateAndProof( - final tech.pegasys.teku.spec.datastructures.operations.AggregateAndProof aggregateAndProof) { - aggregator_index = aggregateAndProof.getIndex(); - aggregate = new Attestation(aggregateAndProof.getAggregate()); - selection_proof = new BLSSignature(aggregateAndProof.getSelectionProof()); - } - - public tech.pegasys.teku.spec.datastructures.operations.AggregateAndProof - asInternalAggregateAndProof(final Spec spec) { - return asInternalAggregateAndProof(spec.atSlot(aggregate.data.slot)); - } - - public tech.pegasys.teku.spec.datastructures.operations.AggregateAndProof - asInternalAggregateAndProof(final SpecVersion specVersion) { - return specVersion - .getSchemaDefinitions() - .getAggregateAndProofSchema() - .create( - aggregator_index, - aggregate.asInternalAttestation(specVersion), - selection_proof.asInternalBLSSignature()); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Attestation.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Attestation.java deleted file mode 100644 index 71a306852a1..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Attestation.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES96; -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES_SSZ; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import java.util.function.Supplier; -import org.apache.tuweni.bytes.Bytes; -import tech.pegasys.teku.infrastructure.ssz.SszData; -import tech.pegasys.teku.infrastructure.ssz.collections.SszBitvector; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.operations.AttestationSchema; - -@SuppressWarnings("JavaCase") -public class Attestation { - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES_SSZ) - public final Bytes aggregation_bits; - - public final AttestationData data; - - @JsonInclude(Include.NON_NULL) - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES_SSZ) - public final Bytes committee_bits; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96) - public final BLSSignature signature; - - public Attestation( - final tech.pegasys.teku.spec.datastructures.operations.Attestation attestation) { - this.aggregation_bits = attestation.getAggregationBits().sszSerialize(); - this.data = new AttestationData(attestation.getData()); - this.committee_bits = attestation.getCommitteeBits().map(SszData::sszSerialize).orElse(null); - this.signature = new BLSSignature(attestation.getAggregateSignature()); - } - - @JsonCreator - public Attestation( - @JsonProperty("aggregation_bits") final Bytes aggregation_bits, - @JsonProperty("data") final AttestationData data, - @JsonProperty("committee_bits") final Bytes committee_bits, - @JsonProperty("signature") final BLSSignature signature) { - this.aggregation_bits = aggregation_bits; - this.data = data; - this.committee_bits = committee_bits; - this.signature = signature; - } - - public tech.pegasys.teku.spec.datastructures.operations.Attestation asInternalAttestation( - final Spec spec) { - return asInternalAttestation(spec.atSlot(data.slot)); - } - - public tech.pegasys.teku.spec.datastructures.operations.Attestation asInternalAttestation( - final SpecVersion specVersion) { - final AttestationSchema attestationSchema = - specVersion.getSchemaDefinitions().getAttestationSchema(); - return attestationSchema.create( - attestationSchema.getAggregationBitsSchema().sszDeserialize(aggregation_bits), - data.asInternalAttestationData(), - signature.asInternalBLSSignature(), - attestationSchema - .getCommitteeBitsSchema() - .map( - committeeBits -> - (Supplier) () -> committeeBits.sszDeserialize(committee_bits)) - .orElse(() -> null)); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof Attestation)) { - return false; - } - Attestation that = (Attestation) o; - return Objects.equals(aggregation_bits, that.aggregation_bits) - && Objects.equals(data, that.data) - && Objects.equals(committee_bits, that.committee_bits) - && Objects.equals(signature, that.signature); - } - - @Override - public int hashCode() { - return Objects.hash(aggregation_bits, data, committee_bits, signature); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/AttestationData.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/AttestationData.java deleted file mode 100644 index 3613d082388..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/AttestationData.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES32; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -@SuppressWarnings("JavaCase") -public class AttestationData { - @Schema(type = "string", format = "uint64") - public final UInt64 slot; - - @Schema(type = "string", format = "uint64") - public final UInt64 index; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32) - public final Bytes32 beacon_block_root; - - public final Checkpoint source; - public final Checkpoint target; - - @JsonCreator - public AttestationData( - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("index") final UInt64 index, - @JsonProperty("beacon_block_root") final Bytes32 beacon_block_root, - @JsonProperty("source") final Checkpoint source, - @JsonProperty("target") final Checkpoint target) { - this.slot = slot; - this.index = index; - this.beacon_block_root = beacon_block_root; - this.source = source; - this.target = target; - } - - public AttestationData( - final tech.pegasys.teku.spec.datastructures.operations.AttestationData data) { - this.slot = data.getSlot(); - this.index = data.getIndex(); - this.beacon_block_root = data.getBeaconBlockRoot(); - this.source = new Checkpoint(data.getSource()); - this.target = new Checkpoint(data.getTarget()); - } - - public tech.pegasys.teku.spec.datastructures.operations.AttestationData - asInternalAttestationData() { - tech.pegasys.teku.spec.datastructures.state.Checkpoint src = source.asInternalCheckpoint(); - tech.pegasys.teku.spec.datastructures.state.Checkpoint tgt = target.asInternalCheckpoint(); - - return new tech.pegasys.teku.spec.datastructures.operations.AttestationData( - slot, index, beacon_block_root, src, tgt); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof AttestationData)) { - return false; - } - AttestationData that = (AttestationData) o; - return Objects.equals(slot, that.slot) - && Objects.equals(index, that.index) - && Objects.equals(beacon_block_root, that.beacon_block_root) - && Objects.equals(source, that.source) - && Objects.equals(target, that.target); - } - - @Override - public int hashCode() { - return Objects.hash(slot, index, beacon_block_root, source, target); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/AttesterSlashing.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/AttesterSlashing.java deleted file mode 100644 index 28f03ee691e..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/AttesterSlashing.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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.api.schema; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.Objects; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.operations.AttesterSlashingSchema; - -@SuppressWarnings("JavaCase") -public class AttesterSlashing { - public final IndexedAttestation attestation_1; - public final IndexedAttestation attestation_2; - - public AttesterSlashing( - final tech.pegasys.teku.spec.datastructures.operations.AttesterSlashing attesterSlashing) { - this.attestation_1 = new IndexedAttestation(attesterSlashing.getAttestation1()); - this.attestation_2 = new IndexedAttestation(attesterSlashing.getAttestation2()); - } - - @JsonCreator - public AttesterSlashing( - @JsonProperty("attestation_1") final IndexedAttestation attestation_1, - @JsonProperty("attestation_2") final IndexedAttestation attestation_2) { - this.attestation_1 = attestation_1; - this.attestation_2 = attestation_2; - } - - public tech.pegasys.teku.spec.datastructures.operations.AttesterSlashing - asInternalAttesterSlashing(final Spec spec) { - return asInternalAttesterSlashing(spec.atSlot(attestation_1.data.slot)); - } - - public tech.pegasys.teku.spec.datastructures.operations.AttesterSlashing - asInternalAttesterSlashing(final SpecVersion spec) { - final AttesterSlashingSchema attesterSlashingSchema = - spec.getSchemaDefinitions().getAttesterSlashingSchema(); - return attesterSlashingSchema.create( - attestation_1.asInternalIndexedAttestation(spec), - attestation_2.asInternalIndexedAttestation(spec)); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof AttesterSlashing that)) { - return false; - } - return Objects.equals(attestation_1, that.attestation_1) - && Objects.equals(attestation_2, that.attestation_2); - } - - @Override - public int hashCode() { - return Objects.hash(attestation_1, attestation_2); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/BLSPubKey.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/BLSPubKey.java deleted file mode 100644 index 87b379beee3..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/BLSPubKey.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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.api.schema; - -import static com.google.common.base.Preconditions.checkArgument; - -import java.util.Objects; -import org.apache.tuweni.bytes.Bytes; -import org.apache.tuweni.bytes.Bytes48; -import tech.pegasys.teku.api.exceptions.PublicKeyException; -import tech.pegasys.teku.bls.BLSPublicKey; - -@SuppressWarnings("JavaCase") -public class BLSPubKey { - /** The number of bytes in this value - i.e. 48 */ - private static final int SIZE = 48; - - private final Bytes bytes; - - public BLSPubKey(final Bytes bytes) { - checkArgument( - bytes.size() == SIZE, - "Bytes%s should be %s bytes, but was %s bytes.", - SIZE, - SIZE, - bytes.size()); - this.bytes = bytes; - } - - public BLSPubKey(final BLSPublicKey publicKey) { - this(publicKey.toSSZBytes()); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final BLSPubKey BLSSignature = (BLSPubKey) o; - return bytes.equals(BLSSignature.bytes); - } - - @Override - public int hashCode() { - return Objects.hash(bytes); - } - - @Override - public String toString() { - return bytes.toString(); - } - - public static BLSPubKey fromHexString(final String value) { - try { - return new BLSPubKey(BLSPublicKey.fromBytesCompressedValidate(Bytes48.fromHexString(value))); - } catch (IllegalArgumentException e) { - throw new PublicKeyException("Public key " + value + " is invalid: " + e.getMessage(), e); - } - } - - public String toHexString() { - return bytes.toHexString(); - } - - public Bytes toBytes() { - return bytes; - } - - public static BLSPubKey empty() { - return new BLSPubKey(Bytes.wrap(new byte[SIZE])); - } - - public BLSPublicKey asBLSPublicKey() { - return BLSPublicKey.fromSSZBytes(bytes); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/BLSSignature.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/BLSSignature.java deleted file mode 100644 index 6629c99917f..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/BLSSignature.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.api.schema; - -import static com.google.common.base.Preconditions.checkArgument; - -import java.util.Objects; -import org.apache.tuweni.bytes.Bytes; -import tech.pegasys.teku.bls.BLSConstants; - -public class BLSSignature { - /** The number of bytes in this value - i.e. 96 */ - private static final int SIZE = BLSConstants.BLS_SIGNATURE_SIZE; - - private final Bytes bytes; - - public BLSSignature(final Bytes bytes) { - checkArgument( - bytes.size() == SIZE, - "Bytes%s should be %s bytes, but was %s bytes.", - SIZE, - SIZE, - bytes.size()); - this.bytes = bytes; - } - - public BLSSignature(final tech.pegasys.teku.bls.BLSSignature signature) { - this(signature.toBytesCompressed()); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final BLSSignature blsSignature = (BLSSignature) o; - return bytes.equals(blsSignature.bytes); - } - - @Override - public int hashCode() { - return Objects.hash(bytes); - } - - @Override - public String toString() { - return bytes.toString(); - } - - public static BLSSignature fromHexString(final String value) { - return new BLSSignature(Bytes.fromHexString(value)); - } - - public String toHexString() { - return bytes.toHexString(); - } - - public static BLSSignature empty() { - return new BLSSignature(tech.pegasys.teku.bls.BLSSignature.empty()); - } - - public final Bytes getBytes() { - return bytes; - } - - public tech.pegasys.teku.bls.BLSSignature asInternalBLSSignature() { - return tech.pegasys.teku.bls.BLSSignature.fromBytesCompressed(bytes); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/BeaconBlock.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/BeaconBlock.java deleted file mode 100644 index 380b170342e..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/BeaconBlock.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES32; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.interfaces.UnsignedBlindedBlock; -import tech.pegasys.teku.api.schema.interfaces.UnsignedBlock; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockSchema; - -@SuppressWarnings("JavaCase") -public class BeaconBlock implements UnsignedBlock, UnsignedBlindedBlock { - @Schema(type = "string", format = "uint64") - public final UInt64 slot; - - @Schema(type = "string", format = "uint64") - public final UInt64 proposer_index; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32) - public final Bytes32 parent_root; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32) - public final Bytes32 state_root; - - protected final BeaconBlockBody body; - - public BeaconBlockBody getBody() { - return body; - } - - protected BeaconBlock(final tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock message) { - this.slot = message.getSlot(); - this.proposer_index = message.getProposerIndex(); - this.parent_root = message.getParentRoot(); - this.state_root = message.getStateRoot(); - this.body = new BeaconBlockBody(message.getBody()); - } - - @JsonCreator - public BeaconBlock( - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("proposer_index") final UInt64 proposer_index, - @JsonProperty("parent_root") final Bytes32 parent_root, - @JsonProperty("state_root") final Bytes32 state_root, - @JsonProperty("body") final BeaconBlockBody body) { - this.slot = slot; - this.proposer_index = proposer_index; - this.parent_root = parent_root; - this.state_root = state_root; - this.body = body; - } - - public BeaconBlockSchema getBeaconBlockSchema(final SpecVersion spec) { - return spec.getSchemaDefinitions().getBeaconBlockSchema(); - } - - public tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock asInternalBeaconBlock( - final Spec spec) { - final SpecVersion specVersion = spec.atSlot(slot); - return getBeaconBlockSchema(spec.atSlot(slot)) - .create( - slot, - proposer_index, - parent_root, - state_root, - body.asInternalBeaconBlockBody(specVersion)); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof BeaconBlock)) { - return false; - } - BeaconBlock that = (BeaconBlock) o; - return Objects.equals(slot, that.slot) - && Objects.equals(proposer_index, that.proposer_index) - && Objects.equals(parent_root, that.parent_root) - && Objects.equals(state_root, that.state_root) - && Objects.equals(body, that.body); - } - - @Override - public int hashCode() { - return Objects.hash(slot, proposer_index, parent_root, state_root, body); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/BeaconBlockBody.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/BeaconBlockBody.java deleted file mode 100644 index 0f68cb67b50..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/BeaconBlockBody.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES32; -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES96; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.infrastructure.async.SafeFuture; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBodyBuilder; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBodySchema; - -@SuppressWarnings("JavaCase") -public class BeaconBlockBody { - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96) - public final BLSSignature randao_reveal; - - public final Eth1Data eth1_data; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32) - public final Bytes32 graffiti; - - public final List proposer_slashings; - public final List attester_slashings; - public final List attestations; - public final List deposits; - public final List voluntary_exits; - - @JsonCreator - public BeaconBlockBody( - @JsonProperty("randao_reveal") final BLSSignature randao_reveal, - @JsonProperty("eth1_data") final Eth1Data eth1_data, - @JsonProperty("graffiti") final Bytes32 graffiti, - @JsonProperty("proposer_slashings") final List proposer_slashings, - @JsonProperty("attester_slashings") final List attester_slashings, - @JsonProperty("attestations") final List attestations, - @JsonProperty("deposits") final List deposits, - @JsonProperty("voluntary_exits") final List voluntary_exits) { - this.randao_reveal = randao_reveal; - this.eth1_data = eth1_data; - this.graffiti = graffiti; - this.proposer_slashings = proposer_slashings; - this.attester_slashings = attester_slashings; - this.attestations = attestations; - this.deposits = deposits; - this.voluntary_exits = voluntary_exits; - } - - public BeaconBlockBody( - final tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody body) { - this.randao_reveal = new BLSSignature(body.getRandaoReveal().toSSZBytes()); - this.eth1_data = new Eth1Data(body.getEth1Data()); - this.graffiti = body.getGraffiti(); - this.proposer_slashings = - body.getProposerSlashings().stream().map(ProposerSlashing::new).toList(); - this.attester_slashings = - body.getAttesterSlashings().stream().map(AttesterSlashing::new).toList(); - this.attestations = body.getAttestations().stream().map(Attestation::new).toList(); - this.deposits = body.getDeposits().stream().map(Deposit::new).toList(); - this.voluntary_exits = body.getVoluntaryExits().stream().map(SignedVoluntaryExit::new).toList(); - } - - public tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody - asInternalBeaconBlockBody( - final SpecVersion spec, - final Function> builderRef) { - final BeaconBlockBodySchema schema = getBeaconBlockBodySchema(spec); - return schema - .createBlockBody( - builder -> - SafeFuture.allOf( - builderRef.apply(builder), - SafeFuture.of( - () -> - builder - .randaoReveal(randao_reveal.asInternalBLSSignature()) - .eth1Data( - new tech.pegasys.teku.spec.datastructures.blocks.Eth1Data( - eth1_data.deposit_root, - eth1_data.deposit_count, - eth1_data.block_hash)) - .graffiti(graffiti) - .attestations( - attestations.stream() - .map(attestation -> attestation.asInternalAttestation(spec)) - .collect(schema.getAttestationsSchema().collector())) - .proposerSlashings( - proposer_slashings.stream() - .map(ProposerSlashing::asInternalProposerSlashing) - .collect(schema.getProposerSlashingsSchema().collector())) - .attesterSlashings( - attester_slashings.stream() - .map(slashing -> slashing.asInternalAttesterSlashing(spec)) - .collect(schema.getAttesterSlashingsSchema().collector())) - .deposits( - deposits.stream() - .map(Deposit::asInternalDeposit) - .collect(schema.getDepositsSchema().collector())) - .voluntaryExits( - voluntary_exits.stream() - .map(SignedVoluntaryExit::asInternalSignedVoluntaryExit) - .collect(schema.getVoluntaryExitsSchema().collector()))))) - .join(); - } - - @JsonIgnore - public boolean isBlinded() { - return false; - } - - public BeaconBlockBodySchema getBeaconBlockBodySchema(final SpecVersion spec) { - return spec.getSchemaDefinitions().getBeaconBlockBodySchema(); - } - - public tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody - asInternalBeaconBlockBody(final SpecVersion spec) { - return asInternalBeaconBlockBody(spec, (builder) -> SafeFuture.COMPLETE); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof BeaconBlockBody)) { - return false; - } - BeaconBlockBody that = (BeaconBlockBody) o; - return Objects.equals(randao_reveal, that.randao_reveal) - && Objects.equals(eth1_data, that.eth1_data) - && Objects.equals(graffiti, that.graffiti) - && Objects.equals(proposer_slashings, that.proposer_slashings) - && Objects.equals(attester_slashings, that.attester_slashings) - && Objects.equals(attestations, that.attestations) - && Objects.equals(deposits, that.deposits) - && Objects.equals(voluntary_exits, that.voluntary_exits); - } - - @Override - public int hashCode() { - return Objects.hash( - randao_reveal, - eth1_data, - graffiti, - proposer_slashings, - attester_slashings, - attestations, - deposits, - voluntary_exits); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/BeaconBlockHeader.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/BeaconBlockHeader.java deleted file mode 100644 index 062f467e280..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/BeaconBlockHeader.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES32; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.MoreObjects; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -@SuppressWarnings("JavaCase") -public class BeaconBlockHeader { - @Schema(type = "string", format = "uint64") - public final UInt64 slot; - - @Schema(type = "string", format = "uint64") - public final UInt64 proposer_index; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32) - public final Bytes32 parent_root; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32) - public final Bytes32 state_root; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32) - public final Bytes32 body_root; - - @JsonCreator - public BeaconBlockHeader( - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("proposer_index") final UInt64 proposer_index, - @JsonProperty("parent_root") final Bytes32 parent_root, - @JsonProperty("state_root") final Bytes32 state_root, - @JsonProperty("body_root") final Bytes32 body_root) { - this.slot = slot; - this.proposer_index = proposer_index; - this.parent_root = parent_root; - this.state_root = state_root; - this.body_root = body_root; - } - - public BeaconBlockHeader( - final tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockHeader header) { - this.slot = header.getSlot(); - this.proposer_index = header.getProposerIndex(); - this.parent_root = header.getParentRoot(); - this.state_root = header.getStateRoot(); - this.body_root = header.getBodyRoot(); - } - - public tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockHeader - asInternalBeaconBlockHeader() { - return new tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockHeader( - slot, proposer_index, parent_root, state_root, body_root); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final BeaconBlockHeader that = (BeaconBlockHeader) o; - return Objects.equals(slot, that.slot) - && Objects.equals(proposer_index, that.proposer_index) - && Objects.equals(parent_root, that.parent_root) - && Objects.equals(state_root, that.state_root) - && Objects.equals(body_root, that.body_root); - } - - @Override - public int hashCode() { - return Objects.hash(slot, proposer_index, parent_root, state_root, body_root); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("slot", slot) - .add("proposer_index", proposer_index) - .add("parent_root", parent_root) - .add("state_root", state_root) - .add("body_root", body_root) - .toString(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/BeaconState.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/BeaconState.java deleted file mode 100644 index 8a27a05288d..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/BeaconState.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES32; -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES_SSZ; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.List; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.interfaces.State; -import tech.pegasys.teku.infrastructure.ssz.collections.SszBitvector; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockAndState; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconStateSchema; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.MutableBeaconState; - -@SuppressWarnings("JavaCase") -public abstract class BeaconState implements State { - @Schema(type = "string", format = "uint64") - public final UInt64 genesis_time; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32) - public final Bytes32 genesis_validators_root; - - @Schema(type = "string", format = "uint64") - public final UInt64 slot; - - public final Fork fork; - public final BeaconBlockHeader latest_block_header; - - @ArraySchema( - schema = @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32)) - public final List block_roots; - - @ArraySchema( - schema = @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32)) - public final List state_roots; - - @ArraySchema( - schema = @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32)) - public final List historical_roots; - - public final Eth1Data eth1_data; - public final List eth1_data_votes; - - @Schema(type = "string", format = "uint64") - public final UInt64 eth1_deposit_index; - - public final List validators; - - @ArraySchema(schema = @Schema(type = "string", format = "uint64")) - public final List balances; - - @ArraySchema( - schema = @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32)) - public final List randao_mixes; - - @ArraySchema(schema = @Schema(type = "string", format = "uint64")) - public final List slashings; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES_SSZ) - public final SszBitvector justification_bits; - - public final Checkpoint previous_justified_checkpoint; - public final Checkpoint current_justified_checkpoint; - public final Checkpoint finalized_checkpoint; - - @JsonCreator - protected BeaconState( - @JsonProperty("genesis_time") final UInt64 genesis_time, - @JsonProperty("genesis_validators_root") final Bytes32 genesis_validators_root, - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("fork") final Fork fork, - @JsonProperty("latest_block_header") final BeaconBlockHeader latest_block_header, - @JsonProperty("block_roots") final List block_roots, - @JsonProperty("state_roots") final List state_roots, - @JsonProperty("historical_roots") final List historical_roots, - @JsonProperty("eth1_data") final Eth1Data eth1_data, - @JsonProperty("eth1_data_votes") final List eth1_data_votes, - @JsonProperty("eth1_deposit_index") final UInt64 eth1_deposit_index, - @JsonProperty("validators") final List validators, - @JsonProperty("balances") final List balances, - @JsonProperty("randao_mixes") final List randao_mixes, - @JsonProperty("slashings") final List slashings, - @JsonProperty("justification_bits") final SszBitvector justification_bits, - @JsonProperty("previous_justified_checkpoint") final Checkpoint previous_justified_checkpoint, - @JsonProperty("current_justified_checkpoint") final Checkpoint current_justified_checkpoint, - @JsonProperty("finalized_checkpoint") final Checkpoint finalized_checkpoint) { - this.genesis_time = genesis_time; - this.genesis_validators_root = genesis_validators_root; - this.slot = slot; - this.fork = fork; - this.latest_block_header = latest_block_header; - this.block_roots = block_roots; - this.state_roots = state_roots; - this.historical_roots = historical_roots; - this.eth1_data = eth1_data; - this.eth1_data_votes = eth1_data_votes; - this.eth1_deposit_index = eth1_deposit_index; - this.validators = validators; - this.balances = balances; - this.randao_mixes = randao_mixes; - this.slashings = slashings; - this.justification_bits = justification_bits; - this.previous_justified_checkpoint = previous_justified_checkpoint; - this.current_justified_checkpoint = current_justified_checkpoint; - this.finalized_checkpoint = finalized_checkpoint; - } - - protected BeaconState(final BeaconBlockAndState blockAndState) { - this(blockAndState.getState()); - } - - protected BeaconState( - final tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState beaconState) { - this.genesis_time = beaconState.getGenesisTime(); - this.genesis_validators_root = beaconState.getGenesisValidatorsRoot(); - this.slot = beaconState.getSlot(); - this.fork = new Fork(beaconState.getFork()); - this.latest_block_header = new BeaconBlockHeader(beaconState.getLatestBlockHeader()); - this.block_roots = beaconState.getBlockRoots().asListUnboxed(); - this.state_roots = beaconState.getStateRoots().asListUnboxed(); - this.historical_roots = beaconState.getHistoricalRoots().asListUnboxed(); - this.eth1_data = new Eth1Data(beaconState.getEth1Data()); - this.eth1_data_votes = beaconState.getEth1DataVotes().stream().map(Eth1Data::new).toList(); - this.eth1_deposit_index = beaconState.getEth1DepositIndex(); - this.validators = beaconState.getValidators().stream().map(Validator::new).toList(); - this.balances = beaconState.getBalances().asListUnboxed(); - this.randao_mixes = beaconState.getRandaoMixes().asListUnboxed(); - this.slashings = beaconState.getSlashings().asListUnboxed(); - this.justification_bits = beaconState.getJustificationBits(); - this.previous_justified_checkpoint = - new Checkpoint(beaconState.getPreviousJustifiedCheckpoint()); - this.current_justified_checkpoint = new Checkpoint(beaconState.getCurrentJustifiedCheckpoint()); - this.finalized_checkpoint = new Checkpoint(beaconState.getFinalizedCheckpoint()); - } - - public tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState asInternalBeaconState( - final Spec spec) { - final BeaconStateSchema schema = - spec.atSlot(slot).getSchemaDefinitions().getBeaconStateSchema(); - return schema - .createEmpty() - .updated( - state -> { - state.setGenesisTime(genesis_time); - state.setGenesisValidatorsRoot(genesis_validators_root); - state.setSlot(slot); - state.setFork(fork.asInternalFork()); - state.setLatestBlockHeader(latest_block_header.asInternalBeaconBlockHeader()); - state.getBlockRoots().setAllElements(block_roots); - state.getStateRoots().setAllElements(state_roots); - state.getHistoricalRoots().setAllElements(historical_roots); - state.setEth1Data(eth1_data.asInternalEth1Data()); - state - .getEth1DataVotes() - .setAll(eth1_data_votes.stream().map(Eth1Data::asInternalEth1Data).toList()); - state.setEth1DepositIndex(eth1_deposit_index); - state - .getValidators() - .setAll(validators.stream().map(Validator::asInternalValidator).toList()); - state.getBalances().setAllElements(balances); - state.getRandaoMixes().setAllElements(randao_mixes); - state.getSlashings().setAllElements(slashings); - SszBitvector newJustificationBits = - schema.getJustificationBitsSchema().ofBits(justification_bits.getAllSetBits()); - state.setJustificationBits(newJustificationBits); - state.setPreviousJustifiedCheckpoint( - previous_justified_checkpoint.asInternalCheckpoint()); - state.setCurrentJustifiedCheckpoint( - current_justified_checkpoint.asInternalCheckpoint()); - state.setFinalizedCheckpoint(finalized_checkpoint.asInternalCheckpoint()); - - applyAdditionalFields(state, spec.atSlot(state.getSlot())); - }); - } - - protected abstract void applyAdditionalFields( - final MutableBeaconState state, final SpecVersion specVersion); -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Checkpoint.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Checkpoint.java deleted file mode 100644 index 7f321452844..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Checkpoint.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES32; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; -import io.swagger.v3.oas.annotations.media.Schema; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -public class Checkpoint { - public static final Checkpoint EMPTY = new Checkpoint(UInt64.ZERO, Bytes32.ZERO); - - @Schema(type = "string", format = "uint64") - public final UInt64 epoch; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32) - public final Bytes32 root; - - public Checkpoint(final tech.pegasys.teku.spec.datastructures.state.Checkpoint checkpoint) { - this.epoch = checkpoint.getEpoch(); - this.root = checkpoint.getRoot(); - } - - @JsonCreator - public Checkpoint( - @JsonProperty("epoch") final UInt64 epoch, @JsonProperty("root") final Bytes32 root) { - this.epoch = epoch; - this.root = root; - } - - public tech.pegasys.teku.spec.datastructures.state.Checkpoint asInternalCheckpoint() { - return new tech.pegasys.teku.spec.datastructures.state.Checkpoint(epoch, root); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof Checkpoint)) { - return false; - } - Checkpoint that = (Checkpoint) o; - return Objects.equal(epoch, that.epoch) && Objects.equal(root, that.root); - } - - @Override - public int hashCode() { - return Objects.hashCode(epoch, root); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this).add("epoch", epoch).add("root", root).toString(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Deposit.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Deposit.java deleted file mode 100644 index a182b0af1df..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Deposit.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES32; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.List; -import java.util.Objects; -import org.apache.tuweni.bytes.Bytes32; - -public class Deposit { - @ArraySchema( - schema = @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32)) - public final List proof; - - public final DepositData data; - - public Deposit(final tech.pegasys.teku.spec.datastructures.operations.Deposit deposit) { - this.proof = deposit.getProof().streamUnboxed().toList(); - this.data = new DepositData(deposit.getData()); - } - - @JsonCreator - public Deposit( - @JsonProperty("proof") final List proof, - @JsonProperty("data") final DepositData data) { - this.proof = proof; - this.data = data; - } - - public tech.pegasys.teku.spec.datastructures.operations.Deposit asInternalDeposit() { - return new tech.pegasys.teku.spec.datastructures.operations.Deposit( - tech.pegasys.teku.spec.datastructures.operations.Deposit.SSZ_SCHEMA - .getProofSchema() - .of(proof), - data.asInternalDepositData()); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof Deposit)) { - return false; - } - Deposit deposit = (Deposit) o; - return Objects.equals(proof, deposit.proof) && Objects.equals(data, deposit.data); - } - - @Override - public int hashCode() { - return Objects.hash(proof, data); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/DepositData.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/DepositData.java deleted file mode 100644 index 1c402835de9..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/DepositData.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES32; -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES48; -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES96; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.bls.BLSPublicKey; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -@SuppressWarnings("JavaCase") -public class DepositData { - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES48) - public final BLSPubKey pubkey; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32) - public final Bytes32 withdrawal_credentials; - - @Schema(type = "string", format = "uint64") - public final UInt64 amount; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96) - public final BLSSignature signature; - - public DepositData( - final tech.pegasys.teku.spec.datastructures.operations.DepositData depositData) { - this.pubkey = new BLSPubKey(depositData.getPubkey().toSSZBytes()); - this.withdrawal_credentials = depositData.getWithdrawalCredentials(); - this.amount = depositData.getAmount(); - this.signature = new BLSSignature(depositData.getSignature()); - } - - public DepositData( - @JsonProperty("pubkey") final BLSPubKey pubkey, - @JsonProperty("withdrawal_credentials") final Bytes32 withdrawal_credentials, - @JsonProperty("amount") final UInt64 amount, - @JsonProperty("signature") final BLSSignature signature) { - this.pubkey = pubkey; - this.withdrawal_credentials = withdrawal_credentials; - this.amount = amount; - this.signature = signature; - } - - public tech.pegasys.teku.spec.datastructures.operations.DepositData asInternalDepositData() { - return new tech.pegasys.teku.spec.datastructures.operations.DepositData( - BLSPublicKey.fromSSZBytes(pubkey.toBytes()), - withdrawal_credentials, - amount, - signature.asInternalBLSSignature()); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof DepositData)) { - return false; - } - DepositData that = (DepositData) o; - return Objects.equals(pubkey, that.pubkey) - && Objects.equals(withdrawal_credentials, that.withdrawal_credentials) - && Objects.equals(amount, that.amount) - && Objects.equals(signature, that.signature); - } - - @Override - public int hashCode() { - return Objects.hash(pubkey, withdrawal_credentials, amount, signature); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Eth1Data.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Eth1Data.java deleted file mode 100644 index 1b8c9e55b8e..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Eth1Data.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES32; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -@SuppressWarnings("JavaCase") -public class Eth1Data { - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32) - public final Bytes32 deposit_root; - - @Schema(type = "string", format = "uint64") - public final UInt64 deposit_count; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32) - public final Bytes32 block_hash; - - public Eth1Data(final tech.pegasys.teku.spec.datastructures.blocks.Eth1Data eth1Data) { - deposit_count = eth1Data.getDepositCount(); - deposit_root = eth1Data.getDepositRoot(); - block_hash = eth1Data.getBlockHash(); - } - - @JsonCreator - public Eth1Data( - @JsonProperty("deposit_root") final Bytes32 deposit_root, - @JsonProperty("deposit_count") final UInt64 deposit_count, - @JsonProperty("block_hash") final Bytes32 block_hash) { - this.deposit_root = deposit_root; - this.deposit_count = deposit_count; - this.block_hash = block_hash; - } - - public tech.pegasys.teku.spec.datastructures.blocks.Eth1Data asInternalEth1Data() { - return new tech.pegasys.teku.spec.datastructures.blocks.Eth1Data( - deposit_root, deposit_count, block_hash); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof Eth1Data)) { - return false; - } - Eth1Data eth1Data = (Eth1Data) o; - return Objects.equals(deposit_root, eth1Data.deposit_root) - && Objects.equals(deposit_count, eth1Data.deposit_count) - && Objects.equals(block_hash, eth1Data.block_hash); - } - - @Override - public int hashCode() { - return Objects.hash(deposit_root, deposit_count, block_hash); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/ExecutionPayload.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/ExecutionPayload.java deleted file mode 100644 index 58bd233de74..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/ExecutionPayload.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.api.schema; - -import java.util.Optional; -import tech.pegasys.teku.api.schema.bellatrix.ExecutionPayloadBellatrix; -import tech.pegasys.teku.api.schema.capella.ExecutionPayloadCapella; -import tech.pegasys.teku.api.schema.deneb.ExecutionPayloadDeneb; - -public interface ExecutionPayload { - - default Optional toVersionBellatrix() { - return Optional.empty(); - } - - default Optional toVersionCapella() { - return Optional.empty(); - } - - default Optional toVersionDeneb() { - return Optional.empty(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/ExecutionPayloadHeader.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/ExecutionPayloadHeader.java deleted file mode 100644 index 2d21ee509c8..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/ExecutionPayloadHeader.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.api.schema; - -import java.util.Optional; -import tech.pegasys.teku.api.schema.bellatrix.ExecutionPayloadHeaderBellatrix; -import tech.pegasys.teku.api.schema.capella.ExecutionPayloadHeaderCapella; -import tech.pegasys.teku.api.schema.deneb.ExecutionPayloadHeaderDeneb; -import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeaderSchema; - -public interface ExecutionPayloadHeader { - tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeader - asInternalExecutionPayloadHeader(ExecutionPayloadHeaderSchema schema); - - default Optional toVersionBellatrix() { - return Optional.empty(); - } - - default Optional toVersionCapella() { - return Optional.empty(); - } - - default Optional toVersionDeneb() { - return Optional.empty(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Fork.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Fork.java deleted file mode 100644 index 2ca5e718d8d..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Fork.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES4; -import static tech.pegasys.teku.api.schema.SchemaConstants.PATTERN_BYTES4; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.MoreObjects; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import tech.pegasys.teku.infrastructure.bytes.Bytes4; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -@SuppressWarnings("JavaCase") -public class Fork { - @Schema(type = "string", pattern = PATTERN_BYTES4, description = DESCRIPTION_BYTES4) - public Bytes4 previous_version; - - @Schema(type = "string", pattern = PATTERN_BYTES4, description = DESCRIPTION_BYTES4) - public Bytes4 current_version; - - @Schema(type = "string") - public UInt64 epoch; - - @JsonCreator - public Fork( - @JsonProperty("previous_version") final Bytes4 previous_version, - @JsonProperty("current_version") final Bytes4 current_version, - @JsonProperty("epoch") final UInt64 epoch) { - this.previous_version = previous_version; - this.current_version = current_version; - this.epoch = epoch; - } - - public Fork(final tech.pegasys.teku.spec.datastructures.state.Fork fork) { - this.previous_version = fork.getPreviousVersion(); - this.current_version = fork.getCurrentVersion(); - this.epoch = fork.getEpoch(); - } - - public tech.pegasys.teku.spec.datastructures.state.Fork asInternalFork() { - return new tech.pegasys.teku.spec.datastructures.state.Fork( - previous_version, current_version, epoch); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final Fork fork = (Fork) o; - return Objects.equals(previous_version, fork.previous_version) - && Objects.equals(current_version, fork.current_version) - && Objects.equals(epoch, fork.epoch); - } - - @Override - public int hashCode() { - return Objects.hash(previous_version, current_version, epoch); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("previous_version", previous_version) - .add("current_version", current_version) - .add("epoch", epoch) - .toString(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/IndexedAttestation.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/IndexedAttestation.java deleted file mode 100644 index e458e555320..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/IndexedAttestation.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES96; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.List; -import java.util.Objects; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.operations.IndexedAttestationSchema; - -@SuppressWarnings("JavaCase") -public class IndexedAttestation { - @ArraySchema(schema = @Schema(type = "string", format = "uint64")) - public final List attesting_indices; - - public final AttestationData data; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96) - public final BLSSignature signature; - - public IndexedAttestation( - final tech.pegasys.teku.spec.datastructures.operations.IndexedAttestation - indexedAttestation) { - this.attesting_indices = indexedAttestation.getAttestingIndices().streamUnboxed().toList(); - this.data = new AttestationData(indexedAttestation.getData()); - this.signature = new BLSSignature(indexedAttestation.getSignature()); - } - - @JsonCreator - public IndexedAttestation( - @JsonProperty("attesting_indices") final List attesting_indices, - @JsonProperty("data") final AttestationData data, - @JsonProperty("signature") final BLSSignature signature) { - this.attesting_indices = attesting_indices; - this.data = data; - this.signature = signature; - } - - public tech.pegasys.teku.spec.datastructures.operations.IndexedAttestation - asInternalIndexedAttestation(final Spec spec) { - return asInternalIndexedAttestation(spec.atSlot(data.slot)); - } - - public tech.pegasys.teku.spec.datastructures.operations.IndexedAttestation - asInternalIndexedAttestation(final SpecVersion spec) { - final IndexedAttestationSchema indexedAttestationSchema = - spec.getSchemaDefinitions().getIndexedAttestationSchema(); - return indexedAttestationSchema.create( - indexedAttestationSchema.getAttestingIndicesSchema().of(attesting_indices), - data.asInternalAttestationData(), - signature.asInternalBLSSignature()); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof IndexedAttestation that)) { - return false; - } - return Objects.equals(attesting_indices, that.attesting_indices) - && Objects.equals(data, that.data) - && Objects.equals(signature, that.signature); - } - - @Override - public int hashCode() { - return Objects.hash(attesting_indices, data, signature); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/KZGCommitment.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/KZGCommitment.java deleted file mode 100644 index ee914b16e2f..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/KZGCommitment.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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.api.schema; - -import static com.google.common.base.Preconditions.checkArgument; - -import java.util.Objects; -import org.apache.tuweni.bytes.Bytes; - -public class KZGCommitment { - /** The number of bytes in this value - i.e. 48 */ - private static final int SIZE = 48; - - private final Bytes bytes; - - public KZGCommitment(final Bytes bytes) { - checkArgument( - bytes.size() == SIZE, - "Bytes%s should be %s bytes, but was %s bytes.", - SIZE, - SIZE, - bytes.size()); - this.bytes = bytes; - } - - public KZGCommitment(final tech.pegasys.teku.kzg.KZGCommitment kzgCommitment) { - this(kzgCommitment.toSSZBytes()); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final KZGCommitment other = (KZGCommitment) o; - return bytes.equals(other.bytes); - } - - @Override - public int hashCode() { - return Objects.hash(bytes); - } - - @Override - public String toString() { - return bytes.toString(); - } - - public static KZGCommitment fromHexString(final String value) { - try { - return new KZGCommitment(tech.pegasys.teku.kzg.KZGCommitment.fromHexString(value)); - } catch (IllegalArgumentException e) { - throw new IllegalArgumentException( - "KZGCommitment " + value + " is invalid: " + e.getMessage(), e); - } - } - - public String toHexString() { - return bytes.toHexString(); - } - - public Bytes toBytes() { - return bytes; - } - - public static KZGCommitment empty() { - return new KZGCommitment(Bytes.wrap(new byte[SIZE])); - } - - public tech.pegasys.teku.kzg.KZGCommitment asInternalKZGCommitment() { - return tech.pegasys.teku.kzg.KZGCommitment.fromSSZBytes(bytes); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/KZGProof.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/KZGProof.java deleted file mode 100644 index a8229f15b05..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/KZGProof.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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.api.schema; - -import static com.google.common.base.Preconditions.checkArgument; - -import java.util.Objects; -import org.apache.tuweni.bytes.Bytes; - -public class KZGProof { - /** The number of bytes in this value - i.e. 48 */ - private static final int SIZE = 48; - - private final Bytes bytes; - - public KZGProof(final Bytes bytes) { - checkArgument( - bytes.size() == SIZE, - "Bytes%s should be %s bytes, but was %s bytes.", - SIZE, - SIZE, - bytes.size()); - this.bytes = bytes; - } - - public KZGProof(final tech.pegasys.teku.kzg.KZGProof kzgProof) { - this(kzgProof.toSSZBytes()); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final KZGProof other = (KZGProof) o; - return bytes.equals(other.bytes); - } - - @Override - public int hashCode() { - return Objects.hash(bytes); - } - - @Override - public String toString() { - return bytes.toString(); - } - - public static KZGProof fromHexString(final String value) { - try { - return new KZGProof(tech.pegasys.teku.kzg.KZGProof.fromHexString(value)); - } catch (IllegalArgumentException e) { - throw new IllegalArgumentException("KZGProof " + value + " is invalid: " + e.getMessage(), e); - } - } - - public String toHexString() { - return bytes.toHexString(); - } - - public Bytes toBytes() { - return bytes; - } - - public static KZGProof empty() { - return new KZGProof(Bytes.wrap(new byte[SIZE])); - } - - public tech.pegasys.teku.kzg.KZGProof asInternalKZGProof() { - return tech.pegasys.teku.kzg.KZGProof.fromSSZBytes(bytes); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/LogLevel.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/LogLevel.java deleted file mode 100644 index 8ef53415650..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/LogLevel.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.api.schema; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import java.util.Optional; -import org.apache.logging.log4j.Level; - -public class LogLevel { - - private final Level level; - private String[] logFilter; - - @JsonCreator - public LogLevel(@JsonProperty("level") final String level) { - this.level = Level.valueOf(level); - } - - @JsonSetter("log_filter") - public void setLogFilter(final String[] logFilter) { - this.logFilter = logFilter; - } - - public Level getLevel() { - return level; - } - - @JsonGetter("level") - public String getLevelAsString() { - return level.toString(); - } - - @JsonGetter("log_filter") - public Optional getLogFilter() { - return Optional.ofNullable(logFilter); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Metadata.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Metadata.java deleted file mode 100644 index 586a8c07399..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Metadata.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.PATTERN_UINT64; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Locale; -import java.util.Objects; -import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.metadata.MetadataMessage; -import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.metadata.versions.altair.MetadataMessageAltair; - -@Schema( - description = - "Based on eth2 [Metadata object]" - + "(https://github.com/ethereum/consensus-specs/blob/v0.12.2/specs/phase0/p2p-interface.md#metadata)") -public class Metadata { - @JsonProperty("seq_number") - @Schema( - type = "string", - pattern = PATTERN_UINT64, - description = - "Uint64 starting at 0 used to version the node's metadata. " - + "If any other field in the local MetaData changes, the node MUST increment seq_number by 1.") - public final String sequenceNumber; - - @JsonProperty("attnets") - @Schema( - type = "string", - pattern = "^0x[a-fA-F0-9]{2,}$", - description = - "Bitvector representing the node's persistent attestation subnet subscriptions.") - public final String attestationSubnetSubscriptions; - - @JsonProperty("syncnets") - @Schema( - type = "string", - pattern = "^0x[a-fA-F0-9]{2,}$", - description = - "Bitvector representing the node's persistent attestation subnet subscriptions.") - @JsonInclude(JsonInclude.Include.NON_NULL) - public final String syncCommitteeSubscriptions; - - @JsonCreator - public Metadata( - @JsonProperty("seq_number") final String sequenceNumber, - @JsonProperty("attnets") final String attestationSubnetSubscriptions, - @JsonProperty("syncnets") final String syncCommitteeSubscriptions) { - this.sequenceNumber = sequenceNumber; - this.attestationSubnetSubscriptions = attestationSubnetSubscriptions; - this.syncCommitteeSubscriptions = syncCommitteeSubscriptions; - } - - public Metadata(final MetadataMessage metadataMessage) { - this.sequenceNumber = metadataMessage.getSeqNumber().toString(); - this.attestationSubnetSubscriptions = - metadataMessage.getAttnets().sszSerialize().toHexString().toLowerCase(Locale.ROOT); - if (metadataMessage instanceof MetadataMessageAltair) { - this.syncCommitteeSubscriptions = - ((MetadataMessageAltair) metadataMessage) - .getSyncnets() - .sszSerialize() - .toHexString() - .toLowerCase(Locale.ROOT); - } else { - this.syncCommitteeSubscriptions = null; - } - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final Metadata metadata = (Metadata) o; - return Objects.equals(sequenceNumber, metadata.sequenceNumber) - && Objects.equals(attestationSubnetSubscriptions, metadata.attestationSubnetSubscriptions) - && Objects.equals(syncCommitteeSubscriptions, metadata.syncCommitteeSubscriptions); - } - - @Override - public int hashCode() { - return Objects.hash(sequenceNumber, attestationSubnetSubscriptions, syncCommitteeSubscriptions); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/PendingAttestation.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/PendingAttestation.java deleted file mode 100644 index 4fb9aedb60c..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/PendingAttestation.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES_SSZ; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import org.apache.tuweni.bytes.Bytes; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.datastructures.state.PendingAttestation.PendingAttestationSchema; - -@SuppressWarnings("JavaCase") -public class PendingAttestation { - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES_SSZ) - public final Bytes aggregation_bits; - - public final AttestationData data; - - @Schema(type = "string", format = "uint64") - public final UInt64 inclusion_delay; - - @Schema(type = "string", format = "uint64") - public final UInt64 proposer_index; - - @JsonCreator - public PendingAttestation( - @JsonProperty("aggregation_bits") final Bytes aggregation_bits, - @JsonProperty("data") final AttestationData data, - @JsonProperty("inclusion_delay") final UInt64 inclusion_delay, - @JsonProperty("proposer_index") final UInt64 proposer_index) { - this.aggregation_bits = aggregation_bits; - this.data = data; - this.inclusion_delay = inclusion_delay; - this.proposer_index = proposer_index; - } - - public PendingAttestation( - final tech.pegasys.teku.spec.datastructures.state.PendingAttestation pendingAttestation) { - this.aggregation_bits = pendingAttestation.getAggregationBits().sszSerialize(); - this.data = new AttestationData(pendingAttestation.getData()); - this.inclusion_delay = pendingAttestation.getInclusionDelay(); - this.proposer_index = pendingAttestation.getProposerIndex(); - } - - public tech.pegasys.teku.spec.datastructures.state.PendingAttestation - asInternalPendingAttestation(final PendingAttestationSchema pendingAttestationSchema) { - return pendingAttestationSchema.create( - pendingAttestationSchema.getAggregationBitfieldSchema().sszDeserialize(aggregation_bits), - data.asInternalAttestationData(), - inclusion_delay, - proposer_index); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof PendingAttestation)) { - return false; - } - PendingAttestation that = (PendingAttestation) o; - return Objects.equals(aggregation_bits, that.aggregation_bits) - && Objects.equals(data, that.data) - && Objects.equals(inclusion_delay, that.inclusion_delay) - && Objects.equals(proposer_index, that.proposer_index); - } - - @Override - public int hashCode() { - return Objects.hash(aggregation_bits, data, inclusion_delay, proposer_index); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/ProposerSlashing.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/ProposerSlashing.java deleted file mode 100644 index 0d0ca4db104..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/ProposerSlashing.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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.api.schema; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.Objects; - -@SuppressWarnings("JavaCase") -public class ProposerSlashing { - public final SignedBeaconBlockHeader signed_header_1; - public final SignedBeaconBlockHeader signed_header_2; - - public ProposerSlashing( - final tech.pegasys.teku.spec.datastructures.operations.ProposerSlashing proposerSlashing) { - signed_header_1 = new SignedBeaconBlockHeader(proposerSlashing.getHeader1()); - signed_header_2 = new SignedBeaconBlockHeader(proposerSlashing.getHeader2()); - } - - @JsonCreator - public ProposerSlashing( - @JsonProperty("signed_header_1") final SignedBeaconBlockHeader header_1, - @JsonProperty("signed_header_2") final SignedBeaconBlockHeader header_2) { - this.signed_header_1 = header_1; - this.signed_header_2 = header_2; - } - - public tech.pegasys.teku.spec.datastructures.operations.ProposerSlashing - asInternalProposerSlashing() { - return new tech.pegasys.teku.spec.datastructures.operations.ProposerSlashing( - signed_header_1.asInternalSignedBeaconBlockHeader(), - signed_header_2.asInternalSignedBeaconBlockHeader()); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof ProposerSlashing)) { - return false; - } - ProposerSlashing that = (ProposerSlashing) o; - return Objects.equals(signed_header_1, that.signed_header_1) - && Objects.equals(signed_header_2, that.signed_header_2); - } - - @Override - public int hashCode() { - return Objects.hash(signed_header_1, signed_header_2); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Root.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Root.java deleted file mode 100644 index c7dd95d157c..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Root.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES32; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.Objects; -import io.swagger.v3.oas.annotations.media.Schema; -import org.apache.tuweni.bytes.Bytes32; - -public class Root { - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32) - public final Bytes32 root; - - @JsonCreator - public Root(@JsonProperty("root") final Bytes32 root) { - this.root = root; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof Root)) { - return false; - } - Root root1 = (Root) o; - return Objects.equal(root, root1.root); - } - - @Override - public int hashCode() { - return Objects.hashCode(root); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/SchemaConstants.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/SchemaConstants.java deleted file mode 100644 index 0f622b79528..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/SchemaConstants.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.api.schema; - -public class SchemaConstants { - public static final String DESCRIPTION_BYTES32 = "Bytes32 hexadecimal"; - public static final String DESCRIPTION_BYTES4 = "Bytes4 hexadecimal"; - public static final String DESCRIPTION_BYTES96 = "Bytes96 hexadecimal"; - public static final String DESCRIPTION_BYTES48 = "Bytes48 hexadecimal"; - public static final String DESCRIPTION_BYTES20 = "Bytes20 hexadecimal"; - public static final String DESCRIPTION_BYTES_SSZ = "SSZ hexadecimal"; - public static final String DESCRIPTION_EXECUTION_ADDRESS = - "An address on the execution (Ethereum 1) network."; - - public static final String PATTERN_UINT64 = "^0-9+$"; - public static final String PATTERN_PUBKEY = "^0x[a-fA-F0-9]{96}$"; - public static final String PATTERN_BYTES4 = "^0x[a-fA-F0-9]{8}$"; - public static final String PATTERN_BYTES32 = "^0x[a-fA-F0-9]{64}$"; - public static final String PATTERN_BYTES20 = "^0x[a-fA-F0-9]{40}$"; - public static final String PATTERN_EXECUTION_ADDRESS = PATTERN_BYTES20; - - public static final String EXAMPLE_PUBKEY = - "0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a"; - public static final String EXAMPLE_BYTES32 = - "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"; - public static final String EXAMPLE_UINT64 = "1"; - public static final String EXAMPLE_UINT8 = "1"; - public static final String EXAMPLE_EXECUTION_ADDRESS = - "0xabcf8e0d4e9587369b2301d0790347320302cc09"; -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/SignedAggregateAndProof.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/SignedAggregateAndProof.java deleted file mode 100644 index 63c22385828..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/SignedAggregateAndProof.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES96; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.SpecVersion; - -public class SignedAggregateAndProof { - - public final AggregateAndProof message; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96) - public final BLSSignature signature; - - @JsonCreator - public SignedAggregateAndProof( - @JsonProperty("message") final AggregateAndProof message, - @JsonProperty("signature") final BLSSignature signature) { - this.message = message; - this.signature = signature; - } - - public SignedAggregateAndProof( - final tech.pegasys.teku.spec.datastructures.operations.SignedAggregateAndProof - signedAggregateAndProof) { - this.message = new AggregateAndProof(signedAggregateAndProof.getMessage()); - this.signature = new BLSSignature(signedAggregateAndProof.getSignature()); - } - - public tech.pegasys.teku.spec.datastructures.operations.SignedAggregateAndProof - asInternalSignedAggregateAndProof(final Spec spec) { - final SpecVersion specVersion = spec.atSlot(message.aggregate.data.slot); - return specVersion - .getSchemaDefinitions() - .getSignedAggregateAndProofSchema() - .create( - message.asInternalAggregateAndProof(specVersion), signature.asInternalBLSSignature()); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/SignedBeaconBlock.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/SignedBeaconBlock.java deleted file mode 100644 index c36488b0cba..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/SignedBeaconBlock.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES96; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import java.util.Optional; -import java.util.function.Supplier; -import java.util.stream.Stream; -import tech.pegasys.teku.api.schema.altair.SignedBeaconBlockAltair; -import tech.pegasys.teku.api.schema.bellatrix.SignedBeaconBlockBellatrix; -import tech.pegasys.teku.api.schema.bellatrix.SignedBlindedBeaconBlockBellatrix; -import tech.pegasys.teku.api.schema.capella.SignedBeaconBlockCapella; -import tech.pegasys.teku.api.schema.capella.SignedBlindedBeaconBlockCapella; -import tech.pegasys.teku.api.schema.deneb.SignedBeaconBlockDeneb; -import tech.pegasys.teku.api.schema.deneb.SignedBlindedBeaconBlockDeneb; -import tech.pegasys.teku.api.schema.electra.SignedBeaconBlockElectra; -import tech.pegasys.teku.api.schema.electra.SignedBlindedBeaconBlockElectra; -import tech.pegasys.teku.api.schema.interfaces.SignedBlock; -import tech.pegasys.teku.api.schema.phase0.SignedBeaconBlockPhase0; -import tech.pegasys.teku.spec.Spec; - -public class SignedBeaconBlock implements SignedBlock { - private final BeaconBlock message; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96) - public final BLSSignature signature; - - public BeaconBlock getMessage() { - return message; - } - - protected SignedBeaconBlock( - final tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock internalBlock) { - this.signature = new BLSSignature(internalBlock.getSignature()); - this.message = new BeaconBlock(internalBlock.getMessage()); - } - - @JsonCreator - public SignedBeaconBlock( - @JsonProperty("message") final BeaconBlock message, - @JsonProperty("signature") final BLSSignature signature) { - this.message = message; - this.signature = signature; - } - - public static SignedBeaconBlock create( - final tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock internalBlock) { - tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody beaconBlock = - internalBlock.getMessage().getBody(); - - return Stream.of( - () -> - beaconBlock - .toBlindedVersionElectra() - .map(__ -> new SignedBlindedBeaconBlockElectra(internalBlock)), - () -> - beaconBlock - .toVersionElectra() - .map(__ -> new SignedBeaconBlockElectra(internalBlock)), - () -> - beaconBlock - .toBlindedVersionDeneb() - .map(__ -> new SignedBlindedBeaconBlockDeneb(internalBlock)), - () -> beaconBlock.toVersionDeneb().map(__ -> new SignedBeaconBlockDeneb(internalBlock)), - () -> - beaconBlock - .toBlindedVersionCapella() - .map(__ -> new SignedBlindedBeaconBlockCapella(internalBlock)), - () -> - beaconBlock - .toVersionCapella() - .map(__ -> new SignedBeaconBlockCapella(internalBlock)), - () -> - beaconBlock - .toBlindedVersionBellatrix() - .map(__ -> new SignedBlindedBeaconBlockBellatrix(internalBlock)), - () -> - beaconBlock - .toVersionBellatrix() - .map(__ -> new SignedBeaconBlockBellatrix(internalBlock)), - () -> - beaconBlock.toVersionAltair().map(__ -> new SignedBeaconBlockAltair(internalBlock)), - (Supplier>) - () -> Optional.of(new SignedBeaconBlockPhase0(internalBlock))) - .map(Supplier::get) - .flatMap(Optional::stream) - .findFirst() - .orElseThrow(); - } - - public tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock asInternalSignedBeaconBlock( - final Spec spec) { - final tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock beaconBlock = - getMessage().asInternalBeaconBlock(spec); - return tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock.create( - spec, beaconBlock, signature.asInternalBLSSignature()); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof SignedBeaconBlock)) { - return false; - } - SignedBeaconBlock that = (SignedBeaconBlock) o; - return Objects.equals(message, that.message) && Objects.equals(signature, that.signature); - } - - @Override - public int hashCode() { - return Objects.hash(message, signature); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/SignedBeaconBlockHeader.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/SignedBeaconBlockHeader.java deleted file mode 100644 index f2621f321e6..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/SignedBeaconBlockHeader.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES96; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.MoreObjects; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; - -public class SignedBeaconBlockHeader { - public final BeaconBlockHeader message; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96) - public final BLSSignature signature; - - public SignedBeaconBlockHeader( - final tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlockHeader signedHeader) { - this.message = new BeaconBlockHeader(signedHeader.getMessage()); - this.signature = new BLSSignature(signedHeader.getSignature()); - } - - @JsonCreator - public SignedBeaconBlockHeader( - @JsonProperty("message") final BeaconBlockHeader message, - @JsonProperty("signature") final BLSSignature signature) { - this.message = message; - this.signature = signature; - } - - public tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlockHeader - asInternalSignedBeaconBlockHeader() { - return new tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlockHeader( - message.asInternalBeaconBlockHeader(), signature.asInternalBLSSignature()); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final SignedBeaconBlockHeader that = (SignedBeaconBlockHeader) o; - return Objects.equals(message, that.message) && Objects.equals(signature, that.signature); - } - - @Override - public int hashCode() { - return Objects.hash(message, signature); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("message", message) - .add("signature", signature) - .toString(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/SignedBeaconBlockWithRoot.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/SignedBeaconBlockWithRoot.java deleted file mode 100644 index a22f0a4d8d9..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/SignedBeaconBlockWithRoot.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES32; - -import io.swagger.v3.oas.annotations.media.Schema; -import org.apache.tuweni.bytes.Bytes32; - -public class SignedBeaconBlockWithRoot extends SignedBeaconBlock { - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32) - private final Bytes32 root; - - public SignedBeaconBlockWithRoot( - final tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock internalBlock) { - super(internalBlock); - root = internalBlock.getRoot(); - } - - public Bytes32 getRoot() { - return root; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/SignedVoluntaryExit.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/SignedVoluntaryExit.java deleted file mode 100644 index 28b2ac58bd0..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/SignedVoluntaryExit.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES96; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; - -public class SignedVoluntaryExit { - public final VoluntaryExit message; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96) - public final BLSSignature signature; - - public SignedVoluntaryExit( - final tech.pegasys.teku.spec.datastructures.operations.SignedVoluntaryExit - signedVoluntaryExit) { - this.signature = new BLSSignature(signedVoluntaryExit.getSignature()); - this.message = new VoluntaryExit(signedVoluntaryExit.getMessage()); - } - - public SignedVoluntaryExit( - @JsonProperty("message") final VoluntaryExit message, - @JsonProperty("signature") final BLSSignature signature) { - this.message = message; - this.signature = signature; - } - - public SignedVoluntaryExit( - final tech.pegasys.teku.spec.datastructures.operations.VoluntaryExit message, - final tech.pegasys.teku.bls.BLSSignature signature) { - this.message = new VoluntaryExit(message); - this.signature = new BLSSignature(signature); - } - - public tech.pegasys.teku.spec.datastructures.operations.SignedVoluntaryExit - asInternalSignedVoluntaryExit() { - return new tech.pegasys.teku.spec.datastructures.operations.SignedVoluntaryExit( - message.asInternalVoluntaryExit(), signature.asInternalBLSSignature()); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof SignedVoluntaryExit)) { - return false; - } - SignedVoluntaryExit that = (SignedVoluntaryExit) o; - return Objects.equals(message, that.message) && Objects.equals(signature, that.signature); - } - - @Override - public int hashCode() { - return Objects.hash(message, signature); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/SubnetSubscription.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/SubnetSubscription.java deleted file mode 100644 index 349b51d966e..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/SubnetSubscription.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.api.schema; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -@SuppressWarnings("JavaCase") -public class SubnetSubscription { - - public final int subnet_id; - - @Schema(type = "string", format = "uint64") - public final UInt64 unsubscription_slot; - - @JsonCreator - public SubnetSubscription( - @JsonProperty("subnet_id") final int subnet_id, - @JsonProperty("unsubscription_slot") final UInt64 unsubscription_slot) { - this.subnet_id = subnet_id; - this.unsubscription_slot = unsubscription_slot; - } - - public tech.pegasys.teku.spec.datastructures.validator.SubnetSubscription - asInternalSubnetSubscription() { - return new tech.pegasys.teku.spec.datastructures.validator.SubnetSubscription( - subnet_id, unsubscription_slot); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Validator.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Validator.java deleted file mode 100644 index b50e0cbc7a9..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Validator.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES48; -import static tech.pegasys.teku.api.schema.SchemaConstants.EXAMPLE_BYTES32; -import static tech.pegasys.teku.api.schema.SchemaConstants.EXAMPLE_PUBKEY; -import static tech.pegasys.teku.api.schema.SchemaConstants.EXAMPLE_UINT64; -import static tech.pegasys.teku.api.schema.SchemaConstants.PATTERN_BYTES32; -import static tech.pegasys.teku.api.schema.SchemaConstants.PATTERN_PUBKEY; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.MoreObjects; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -@SuppressWarnings("JavaCase") -public class Validator { - @Schema( - type = "string", - pattern = PATTERN_PUBKEY, - example = EXAMPLE_PUBKEY, - description = DESCRIPTION_BYTES48) - public final BLSPubKey pubkey; - - @Schema( - type = "string", - pattern = PATTERN_BYTES32, - example = EXAMPLE_BYTES32, - description = "Root of withdrawal credentials") - public final Bytes32 withdrawal_credentials; - - @Schema(type = "string", example = EXAMPLE_UINT64, description = "Balance at stake in Gwei.") - public final UInt64 effective_balance; - - public final boolean slashed; - - @Schema( - type = "string", - example = EXAMPLE_UINT64, - description = "When criteria for activation were met.") - public final UInt64 activation_eligibility_epoch; - - @Schema( - type = "string", - example = EXAMPLE_UINT64, - description = "Epoch when validator activated. 'FAR_FUTURE_EPOCH' if not activated.") - public final UInt64 activation_epoch; - - @Schema( - type = "string", - example = EXAMPLE_UINT64, - description = "Epoch when validator exited. 'FAR_FUTURE_EPOCH' if not exited.") - public final UInt64 exit_epoch; - - @Schema( - type = "string", - example = EXAMPLE_UINT64, - description = - "When validator can withdraw or transfer funds. 'FAR_FUTURE_EPOCH' if not defined.") - public final UInt64 withdrawable_epoch; - - @JsonCreator - public Validator( - @JsonProperty("pubkey") final BLSPubKey pubkey, - @JsonProperty("withdrawal_credentials") final Bytes32 withdrawal_credentials, - @JsonProperty("effective_balance") final UInt64 effective_balance, - @JsonProperty("slashed") final boolean slashed, - @JsonProperty("activation_eligibility_epoch") final UInt64 activation_eligibility_epoch, - @JsonProperty("activation_epoch") final UInt64 activation_epoch, - @JsonProperty("exit_epoch") final UInt64 exit_epoch, - @JsonProperty("withdrawable_epoch") final UInt64 withdrawable_epoch) { - this.pubkey = pubkey; - this.withdrawal_credentials = withdrawal_credentials; - this.effective_balance = effective_balance; - this.slashed = slashed; - this.activation_eligibility_epoch = activation_eligibility_epoch; - this.activation_epoch = activation_epoch; - this.exit_epoch = exit_epoch; - this.withdrawable_epoch = withdrawable_epoch; - } - - public Validator(final tech.pegasys.teku.spec.datastructures.state.Validator validator) { - this.pubkey = new BLSPubKey(validator.getPubkeyBytes()); - this.withdrawal_credentials = validator.getWithdrawalCredentials(); - this.effective_balance = validator.getEffectiveBalance(); - this.slashed = validator.isSlashed(); - this.activation_eligibility_epoch = validator.getActivationEligibilityEpoch(); - this.activation_epoch = validator.getActivationEpoch(); - this.exit_epoch = validator.getExitEpoch(); - this.withdrawable_epoch = validator.getWithdrawableEpoch(); - } - - public tech.pegasys.teku.spec.datastructures.state.Validator asInternalValidator() { - return new tech.pegasys.teku.spec.datastructures.state.Validator( - pubkey.asBLSPublicKey().toBytesCompressed(), - withdrawal_credentials, - effective_balance, - slashed, - activation_eligibility_epoch, - activation_epoch, - exit_epoch, - withdrawable_epoch); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final Validator validator = (Validator) o; - return slashed == validator.slashed - && Objects.equals(pubkey, validator.pubkey) - && Objects.equals(withdrawal_credentials, validator.withdrawal_credentials) - && Objects.equals(effective_balance, validator.effective_balance) - && Objects.equals(activation_eligibility_epoch, validator.activation_eligibility_epoch) - && Objects.equals(activation_epoch, validator.activation_epoch) - && Objects.equals(exit_epoch, validator.exit_epoch) - && Objects.equals(withdrawable_epoch, validator.withdrawable_epoch); - } - - @Override - public int hashCode() { - return Objects.hash( - pubkey, - withdrawal_credentials, - effective_balance, - slashed, - activation_eligibility_epoch, - activation_epoch, - exit_epoch, - withdrawable_epoch); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("pubkey", pubkey) - .add("withdrawal_credentials", withdrawal_credentials) - .add("effective_balance", effective_balance) - .add("slashed", slashed) - .add("activation_eligibility_epoch", activation_eligibility_epoch) - .add("activation_epoch", activation_epoch) - .add("exit_epoch", exit_epoch) - .add("withdrawable_epoch", withdrawable_epoch) - .toString(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Version.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Version.java deleted file mode 100644 index a23d273a2b5..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/Version.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.api.schema; - -import tech.pegasys.teku.spec.SpecMilestone; - -@SuppressWarnings("JavaCase") -public enum Version { - phase0, - altair, - bellatrix, - capella, - deneb, - electra, - fulu; - - public static Version fromMilestone(final SpecMilestone milestone) { - return switch (milestone) { - case PHASE0 -> phase0; - case ALTAIR -> altair; - case BELLATRIX -> bellatrix; - case CAPELLA -> capella; - case DENEB -> deneb; - case ELECTRA -> electra; - case FULU -> fulu; - }; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/VoluntaryExit.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/VoluntaryExit.java deleted file mode 100644 index 137dd276597..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/VoluntaryExit.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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.api.schema; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -@SuppressWarnings("JavaCase") -public class VoluntaryExit { - @Schema(type = "string", format = "uint64") - public final UInt64 epoch; - - @Schema(type = "string", format = "uint64") - public final UInt64 validator_index; - - public VoluntaryExit( - final tech.pegasys.teku.spec.datastructures.operations.VoluntaryExit voluntaryExit) { - this.epoch = voluntaryExit.getEpoch(); - this.validator_index = voluntaryExit.getValidatorIndex(); - } - - @JsonCreator - public VoluntaryExit( - @JsonProperty("epoch") final UInt64 epoch, - @JsonProperty("validator_index") final UInt64 validator_index) { - this.epoch = epoch; - this.validator_index = validator_index; - } - - public tech.pegasys.teku.spec.datastructures.operations.VoluntaryExit asInternalVoluntaryExit() { - return new tech.pegasys.teku.spec.datastructures.operations.VoluntaryExit( - epoch, validator_index); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof VoluntaryExit)) { - return false; - } - VoluntaryExit that = (VoluntaryExit) o; - return Objects.equals(epoch, that.epoch) - && Objects.equals(validator_index, that.validator_index); - } - - @Override - public int hashCode() { - return Objects.hash(epoch, validator_index); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/BeaconBlockAltair.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/BeaconBlockAltair.java deleted file mode 100644 index ae9fe10ba75..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/BeaconBlockAltair.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.api.schema.altair; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.BeaconBlock; -import tech.pegasys.teku.api.schema.interfaces.UnsignedBlock; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.schemas.SchemaDefinitionsAltair; - -@SuppressWarnings("JavaCase") -public class BeaconBlockAltair extends BeaconBlock implements UnsignedBlock { - - public BeaconBlockAltair(final tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock message) { - super( - message.getSlot(), - message.getProposerIndex(), - message.getParentRoot(), - message.getStateRoot(), - new BeaconBlockBodyAltair(message.getBody().toVersionAltair().orElseThrow())); - } - - @Override - public tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock asInternalBeaconBlock( - final Spec spec) { - final SpecVersion specVersion = spec.atSlot(slot); - return SchemaDefinitionsAltair.required(specVersion.getSchemaDefinitions()) - .getBeaconBlockSchema() - .create( - slot, - proposer_index, - parent_root, - state_root, - body.asInternalBeaconBlockBody(specVersion)); - } - - @JsonProperty("body") - @Override - public BeaconBlockBodyAltair getBody() { - return (BeaconBlockBodyAltair) body; - } - - @JsonCreator - public BeaconBlockAltair( - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("proposer_index") final UInt64 proposer_index, - @JsonProperty("parent_root") final Bytes32 parent_root, - @JsonProperty("state_root") final Bytes32 state_root, - @JsonProperty("body") final BeaconBlockBodyAltair body) { - super(slot, proposer_index, parent_root, state_root, body); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/BeaconBlockBodyAltair.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/BeaconBlockBodyAltair.java deleted file mode 100644 index 68ab28e9785..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/BeaconBlockBodyAltair.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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.api.schema.altair; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import java.util.function.Function; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.Attestation; -import tech.pegasys.teku.api.schema.AttesterSlashing; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.api.schema.BeaconBlockBody; -import tech.pegasys.teku.api.schema.Deposit; -import tech.pegasys.teku.api.schema.Eth1Data; -import tech.pegasys.teku.api.schema.ProposerSlashing; -import tech.pegasys.teku.api.schema.SignedVoluntaryExit; -import tech.pegasys.teku.infrastructure.async.SafeFuture; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBodyBuilder; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair.BeaconBlockBodySchemaAltair; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair.SyncAggregateSchema; - -@SuppressWarnings("JavaCase") -public class BeaconBlockBodyAltair extends BeaconBlockBody { - @JsonProperty("sync_aggregate") - public final SyncAggregate syncAggregate; - - @JsonCreator - public BeaconBlockBodyAltair( - @JsonProperty("randao_reveal") final BLSSignature randao_reveal, - @JsonProperty("eth1_data") final Eth1Data eth1_data, - @JsonProperty("graffiti") final Bytes32 graffiti, - @JsonProperty("proposer_slashings") final List proposer_slashings, - @JsonProperty("attester_slashings") final List attester_slashings, - @JsonProperty("attestations") final List attestations, - @JsonProperty("deposits") final List deposits, - @JsonProperty("voluntary_exits") final List voluntary_exits, - @JsonProperty("sync_aggregate") final SyncAggregate sync_aggregate) { - super( - randao_reveal, - eth1_data, - graffiti, - proposer_slashings, - attester_slashings, - attestations, - deposits, - voluntary_exits); - checkNotNull(sync_aggregate, "Sync Aggregate is required for altair blocks"); - this.syncAggregate = sync_aggregate; - } - - public BeaconBlockBodyAltair( - final tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair - .BeaconBlockBodyAltair - message) { - super(message); - this.syncAggregate = new SyncAggregate(message.getSyncAggregate()); - checkNotNull(syncAggregate, "Sync Aggregate is required for altair blocks"); - } - - @Override - public BeaconBlockBodySchemaAltair getBeaconBlockBodySchema(final SpecVersion spec) { - return (BeaconBlockBodySchemaAltair) spec.getSchemaDefinitions().getBeaconBlockBodySchema(); - } - - @Override - public tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody - asInternalBeaconBlockBody( - final SpecVersion spec, - final Function> builderRef) { - final SyncAggregateSchema syncAggregateSchema = - getBeaconBlockBodySchema(spec).getSyncAggregateSchema(); - return super.asInternalBeaconBlockBody( - spec, - builder -> - SafeFuture.allOf( - builderRef.apply(builder), - SafeFuture.of( - () -> - builder.syncAggregate( - syncAggregateSchema.create( - syncAggregateSchema - .getSyncCommitteeBitsSchema() - .fromBytes(syncAggregate.syncCommitteeBits) - .getAllSetBits(), - syncAggregate.syncCommitteeSignature.asInternalBLSSignature()))))); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/BeaconStateAltair.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/BeaconStateAltair.java deleted file mode 100644 index 12b2b296ca2..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/BeaconStateAltair.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * 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.api.schema.altair; - -import static tech.pegasys.teku.api.schema.SchemaConstants.EXAMPLE_UINT64; -import static tech.pegasys.teku.api.schema.SchemaConstants.EXAMPLE_UINT8; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; -import org.apache.tuweni.bytes.Bytes; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.BeaconBlockHeader; -import tech.pegasys.teku.api.schema.BeaconState; -import tech.pegasys.teku.api.schema.Checkpoint; -import tech.pegasys.teku.api.schema.Eth1Data; -import tech.pegasys.teku.api.schema.Fork; -import tech.pegasys.teku.api.schema.Validator; -import tech.pegasys.teku.api.schema.interfaces.State; -import tech.pegasys.teku.infrastructure.ssz.SszList; -import tech.pegasys.teku.infrastructure.ssz.collections.SszBitvector; -import tech.pegasys.teku.infrastructure.ssz.primitive.SszByte; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.state.SyncCommittee.SyncCommitteeSchema; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.MutableBeaconState; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.altair.BeaconStateSchemaAltair; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.altair.MutableBeaconStateAltair; - -@SuppressWarnings("JavaCase") -public class BeaconStateAltair extends BeaconState implements State { - @ArraySchema(schema = @Schema(type = "string", example = EXAMPLE_UINT8)) - public final byte[] previous_epoch_participation; - - @ArraySchema(schema = @Schema(type = "string", example = EXAMPLE_UINT8)) - public final byte[] current_epoch_participation; - - @JsonProperty("inactivity_scores") - @ArraySchema(schema = @Schema(type = "string", example = EXAMPLE_UINT64)) - public final List inactivity_scores; - - public final SyncCommittee current_sync_committee; - public final SyncCommittee next_sync_committee; - - @JsonCreator - public BeaconStateAltair( - @JsonProperty("genesis_time") final UInt64 genesis_time, - @JsonProperty("genesis_validators_root") final Bytes32 genesis_validators_root, - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("fork") final Fork fork, - @JsonProperty("latest_block_header") final BeaconBlockHeader latest_block_header, - @JsonProperty("block_roots") final List block_roots, - @JsonProperty("state_roots") final List state_roots, - @JsonProperty("historical_roots") final List historical_roots, - @JsonProperty("eth1_data") final Eth1Data eth1_data, - @JsonProperty("eth1_data_votes") final List eth1_data_votes, - @JsonProperty("eth1_deposit_index") final UInt64 eth1_deposit_index, - @JsonProperty("validators") final List validators, - @JsonProperty("balances") final List balances, - @JsonProperty("randao_mixes") final List randao_mixes, - @JsonProperty("slashings") final List slashings, - @JsonProperty("previous_epoch_participation") final byte[] previous_epoch_participation, - @JsonProperty("current_epoch_participation") final byte[] current_epoch_participation, - @JsonProperty("justification_bits") final SszBitvector justification_bits, - @JsonProperty("previous_justified_checkpoint") final Checkpoint previous_justified_checkpoint, - @JsonProperty("current_justified_checkpoint") final Checkpoint current_justified_checkpoint, - @JsonProperty("finalized_checkpoint") final Checkpoint finalized_checkpoint, - @JsonProperty("inactivity_scores") final List inactivity_scores, - @JsonProperty("current_sync_committee") final SyncCommittee current_sync_committee, - @JsonProperty("next_sync_committee") final SyncCommittee next_sync_committee) { - super( - genesis_time, - genesis_validators_root, - slot, - fork, - latest_block_header, - block_roots, - state_roots, - historical_roots, - eth1_data, - eth1_data_votes, - eth1_deposit_index, - validators, - balances, - randao_mixes, - slashings, - justification_bits, - previous_justified_checkpoint, - current_justified_checkpoint, - finalized_checkpoint); - this.previous_epoch_participation = previous_epoch_participation; - this.current_epoch_participation = current_epoch_participation; - this.inactivity_scores = inactivity_scores; - this.current_sync_committee = current_sync_committee; - this.next_sync_committee = next_sync_committee; - } - - public BeaconStateAltair( - final tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState beaconState) { - super(beaconState); - final tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.altair.BeaconStateAltair - altair = beaconState.toVersionAltair().orElseThrow(); - this.previous_epoch_participation = toByteArray(altair.getPreviousEpochParticipation()); - this.current_epoch_participation = toByteArray(altair.getCurrentEpochParticipation()); - this.inactivity_scores = altair.getInactivityScores().asListUnboxed(); - this.current_sync_committee = new SyncCommittee(altair.getCurrentSyncCommittee()); - this.next_sync_committee = new SyncCommittee(altair.getNextSyncCommittee()); - } - - @Override - protected void applyAdditionalFields( - final MutableBeaconState state, final SpecVersion specVersion) { - state - .toMutableVersionAltair() - .ifPresent( - beaconStateAltair -> { - final SyncCommitteeSchema syncCommitteeSchema = - BeaconStateSchemaAltair.required(beaconStateAltair.getBeaconStateSchema()) - .getCurrentSyncCommitteeSchema(); - applyAltairFields(beaconStateAltair, syncCommitteeSchema, this); - }); - } - - public static void applyAltairFields( - final MutableBeaconStateAltair state, - final SyncCommitteeSchema syncCommitteeSchema, - final BeaconStateAltair instance) { - final SszList previousEpochParticipation = - state - .getPreviousEpochParticipation() - .getSchema() - .sszDeserialize(Bytes.wrap(instance.previous_epoch_participation)); - final SszList currentEpochParticipation = - state - .getCurrentEpochParticipation() - .getSchema() - .sszDeserialize(Bytes.wrap(instance.current_epoch_participation)); - - state.setPreviousEpochParticipation(previousEpochParticipation); - state.setCurrentEpochParticipation(currentEpochParticipation); - state.getInactivityScores().setAllElements(instance.inactivity_scores); - - state.setCurrentSyncCommittee( - instance.current_sync_committee.asInternalSyncCommittee(syncCommitteeSchema)); - state.setNextSyncCommittee( - instance.next_sync_committee.asInternalSyncCommittee(syncCommitteeSchema)); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final BeaconStateAltair that = (BeaconStateAltair) o; - return Arrays.equals(previous_epoch_participation, that.previous_epoch_participation) - && Arrays.equals(current_epoch_participation, that.current_epoch_participation) - && Objects.equals(inactivity_scores, that.inactivity_scores) - && Objects.equals(current_sync_committee, that.current_sync_committee) - && Objects.equals(next_sync_committee, that.next_sync_committee); - } - - @Override - public int hashCode() { - int result = - Objects.hash( - System.identityHashCode(this), - inactivity_scores, - current_sync_committee, - next_sync_committee); - result = 31 * result + Arrays.hashCode(previous_epoch_participation); - result = 31 * result + Arrays.hashCode(current_epoch_participation); - return result; - } - - private byte[] toByteArray(final SszList byteList) { - final byte[] array = new byte[byteList.size()]; - for (int i = 0; i < array.length; i++) { - array[i] = byteList.get(i).get(); - } - return array; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/ContributionAndProof.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/ContributionAndProof.java deleted file mode 100644 index 4dd69c193d0..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/ContributionAndProof.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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.api.schema.altair; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES96; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -public class ContributionAndProof { - @JsonProperty("aggregator_index") - @Schema(type = "string", format = "uint64") - public final UInt64 aggregatorIndex; - - @JsonProperty("selection_proof") - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96) - public final BLSSignature selectionProof; - - @JsonProperty("contribution") - public final SyncCommitteeContribution contribution; - - @JsonCreator - public ContributionAndProof( - @JsonProperty("aggregator_index") final UInt64 aggregatorIndex, - @JsonProperty("selection_proof") final BLSSignature selectionProof, - @JsonProperty("contribution") final SyncCommitteeContribution contribution) { - this.aggregatorIndex = aggregatorIndex; - this.selectionProof = selectionProof; - this.contribution = contribution; - } - - public ContributionAndProof( - final tech.pegasys.teku.spec.datastructures.operations.versions.altair.ContributionAndProof - contributionAndProof) { - this( - contributionAndProof.getAggregatorIndex(), - new BLSSignature(contributionAndProof.getSelectionProof()), - new SyncCommitteeContribution(contributionAndProof.getContribution())); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final ContributionAndProof that = (ContributionAndProof) o; - return Objects.equals(aggregatorIndex, that.aggregatorIndex) - && Objects.equals(selectionProof, that.selectionProof) - && Objects.equals(contribution, that.contribution); - } - - @Override - public int hashCode() { - return Objects.hash(aggregatorIndex, selectionProof, contribution); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/SignedBeaconBlockAltair.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/SignedBeaconBlockAltair.java deleted file mode 100644 index c9c4c28a58b..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/SignedBeaconBlockAltair.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.api.schema.altair; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.api.schema.SignedBeaconBlock; -import tech.pegasys.teku.api.schema.interfaces.SignedBlock; - -public class SignedBeaconBlockAltair extends SignedBeaconBlock implements SignedBlock { - private final BeaconBlockAltair message; - - public SignedBeaconBlockAltair( - final tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock internalBlock) { - super(internalBlock); - this.message = new BeaconBlockAltair(internalBlock.getMessage()); - } - - @Override - public BeaconBlockAltair getMessage() { - return message; - } - - @JsonCreator - public SignedBeaconBlockAltair( - @JsonProperty("message") final BeaconBlockAltair message, - @JsonProperty("signature") final BLSSignature signature) { - super(message, signature); - this.message = message; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/SignedContributionAndProof.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/SignedContributionAndProof.java deleted file mode 100644 index dee88572145..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/SignedContributionAndProof.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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.api.schema.altair; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES96; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import tech.pegasys.teku.api.schema.BLSSignature; - -public class SignedContributionAndProof { - - @JsonProperty("message") - public final ContributionAndProof message; - - @JsonProperty("signature") - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96) - public final BLSSignature signature; - - @JsonCreator - public SignedContributionAndProof( - @JsonProperty("message") final ContributionAndProof message, - @JsonProperty("signature") final BLSSignature signature) { - this.message = message; - this.signature = signature; - } - - public SignedContributionAndProof( - final tech.pegasys.teku.spec.datastructures.operations.versions.altair - .SignedContributionAndProof - proof) { - this.message = new ContributionAndProof(proof.getMessage()); - this.signature = new BLSSignature(proof.getSignature()); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final SignedContributionAndProof that = (SignedContributionAndProof) o; - return Objects.equals(message, that.message) && Objects.equals(signature, that.signature); - } - - @Override - public int hashCode() { - return Objects.hash(message, signature); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/SyncAggregate.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/SyncAggregate.java deleted file mode 100644 index 85bacb8759d..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/SyncAggregate.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.api.schema.altair; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES96; -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES_SSZ; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import org.apache.tuweni.bytes.Bytes; -import tech.pegasys.teku.api.schema.BLSSignature; - -public class SyncAggregate { - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES_SSZ) - @JsonProperty("sync_committee_bits") - public Bytes syncCommitteeBits; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96) - @JsonProperty("sync_committee_signature") - public final BLSSignature syncCommitteeSignature; - - @JsonCreator - public SyncAggregate( - @JsonProperty("sync_committee_bits") final Bytes syncCommitteeBits, - @JsonProperty("sync_committee_signature") final BLSSignature syncCommitteeSignature) { - this.syncCommitteeBits = syncCommitteeBits; - this.syncCommitteeSignature = syncCommitteeSignature; - } - - public SyncAggregate( - final tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.altair.SyncAggregate - aggregate) { - this.syncCommitteeSignature = - new BLSSignature(aggregate.getSyncCommitteeSignature().getSignature()); - this.syncCommitteeBits = aggregate.getSyncCommitteeBits().sszSerialize(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/SyncCommittee.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/SyncCommittee.java deleted file mode 100644 index 4039b090057..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/SyncCommittee.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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.api.schema.altair; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES48; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.List; -import java.util.Objects; -import tech.pegasys.teku.api.schema.BLSPubKey; -import tech.pegasys.teku.spec.datastructures.state.SyncCommittee.SyncCommitteeSchema; -import tech.pegasys.teku.spec.datastructures.type.SszPublicKey; - -public class SyncCommittee { - @JsonProperty("pubkeys") - @ArraySchema( - schema = @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES48)) - public final List pubkeys; - - @JsonProperty("aggregate_pubkey") - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES48) - public final BLSPubKey aggregatePubkey; - - @JsonCreator - public SyncCommittee( - @JsonProperty("pubkeys") final List pubkeys, - @JsonProperty("aggregate_pubkey") final BLSPubKey aggregatePubkey) { - this.pubkeys = pubkeys; - this.aggregatePubkey = aggregatePubkey; - } - - public SyncCommittee(final tech.pegasys.teku.spec.datastructures.state.SyncCommittee committee) { - pubkeys = - committee.getPubkeys().asList().stream() - .map(k -> new BLSPubKey(k.getBLSPublicKey())) - .toList(); - aggregatePubkey = new BLSPubKey(committee.getAggregatePubkey().getBLSPublicKey()); - } - - public tech.pegasys.teku.spec.datastructures.state.SyncCommittee asInternalSyncCommittee( - final SyncCommitteeSchema schema) { - SszPublicKey aggregate = new SszPublicKey(aggregatePubkey.asBLSPublicKey()); - List committee = - pubkeys.stream().map(key -> new SszPublicKey(key.asBLSPublicKey())).toList(); - return schema.create(committee, aggregate); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof SyncCommittee)) { - return false; - } - SyncCommittee that = (SyncCommittee) o; - return Objects.equals(pubkeys, that.pubkeys) - && Objects.equals(aggregatePubkey, that.aggregatePubkey); - } - - @Override - public int hashCode() { - return Objects.hash(pubkeys, aggregatePubkey); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/SyncCommitteeContribution.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/SyncCommitteeContribution.java deleted file mode 100644 index 1d5e7fa2b9a..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/SyncCommitteeContribution.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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.api.schema.altair; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES32; -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES96; -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES_SSZ; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import org.apache.tuweni.bytes.Bytes; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.infrastructure.ssz.collections.SszBitvector; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.datastructures.operations.versions.altair.SyncCommitteeContributionSchema; -import tech.pegasys.teku.spec.schemas.SchemaDefinitionsAltair; - -public class SyncCommitteeContribution { - @JsonProperty("slot") - @Schema(type = "string", format = "uint64") - public final UInt64 slot; - - @JsonProperty("beacon_block_root") - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32) - public final Bytes32 beaconBlockRoot; - - @JsonProperty("subcommittee_index") - @Schema(type = "string", format = "uint64") - public final UInt64 subcommitteeIndex; - - @JsonProperty("aggregation_bits") - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES_SSZ) - public final Bytes aggregationBits; - - @JsonProperty("signature") - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96) - public final BLSSignature signature; - - @JsonCreator - public SyncCommitteeContribution( - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("beacon_block_root") final Bytes32 beaconBlockRoot, - @JsonProperty("subcommittee_index") final UInt64 subcommitteeIndex, - @JsonProperty("aggregation_bits") final Bytes aggregationBits, - @JsonProperty("signature") final BLSSignature signature) { - this.slot = slot; - this.beaconBlockRoot = beaconBlockRoot; - this.subcommitteeIndex = subcommitteeIndex; - this.aggregationBits = aggregationBits; - this.signature = signature; - } - - public SyncCommitteeContribution( - final tech.pegasys.teku.spec.datastructures.operations.versions.altair - .SyncCommitteeContribution - contribution) { - this( - contribution.getSlot(), - contribution.getBeaconBlockRoot(), - contribution.getSubcommitteeIndex(), - contribution.getAggregationBits().sszSerialize(), - new BLSSignature(contribution.getSignature())); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final SyncCommitteeContribution that = (SyncCommitteeContribution) o; - return Objects.equals(slot, that.slot) - && Objects.equals(beaconBlockRoot, that.beaconBlockRoot) - && Objects.equals(subcommitteeIndex, that.subcommitteeIndex) - && Objects.equals(aggregationBits, that.aggregationBits) - && Objects.equals(signature, that.signature); - } - - @Override - public int hashCode() { - return Objects.hash(slot, beaconBlockRoot, subcommitteeIndex, aggregationBits, signature); - } - - public static tech.pegasys.teku.spec.datastructures.operations.versions.altair - .SyncCommitteeContribution - asInternalSyncCommitteeContribution( - final Spec spec, final SyncCommitteeContribution syncCommitteeContribution) { - final SchemaDefinitionsAltair altairDefinitions = - SchemaDefinitionsAltair.required( - spec.atSlot(syncCommitteeContribution.slot).getSchemaDefinitions()); - final SyncCommitteeContributionSchema syncCommitteeContributionSchema = - altairDefinitions.getSyncCommitteeContributionSchema(); - - final SszBitvector aggregationBitsVector = - syncCommitteeContributionSchema - .getAggregationBitsSchema() - .fromBytes(syncCommitteeContribution.aggregationBits); - return spec.getSyncCommitteeUtilRequired(syncCommitteeContribution.slot) - .createSyncCommitteeContribution( - syncCommitteeContribution.slot, - syncCommitteeContribution.beaconBlockRoot, - syncCommitteeContribution.subcommitteeIndex, - aggregationBitsVector.getAllSetBits(), - syncCommitteeContribution.signature.asInternalBLSSignature()); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/SyncCommitteeMessage.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/SyncCommitteeMessage.java deleted file mode 100644 index e27e3797869..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/SyncCommitteeMessage.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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.api.schema.altair; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES32; -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES96; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import java.util.Optional; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.schemas.SchemaDefinitionsAltair; - -public class SyncCommitteeMessage { - @Schema(type = "string", format = "uint64") - @JsonProperty("slot") - public final UInt64 slot; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32) - @JsonProperty("beacon_block_root") - public final Bytes32 beaconBlockRoot; - - @Schema(type = "string", format = "uint64") - @JsonProperty("validator_index") - public final UInt64 validatorIndex; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96) - @JsonProperty("signature") - public final BLSSignature signature; - - @JsonCreator - public SyncCommitteeMessage( - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("beacon_block_root") final Bytes32 beaconBlockRoot, - @JsonProperty("validator_index") final UInt64 validatorIndex, - @JsonProperty("signature") final BLSSignature signature) { - this.slot = slot; - this.beaconBlockRoot = beaconBlockRoot; - this.validatorIndex = validatorIndex; - this.signature = signature; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final SyncCommitteeMessage that = (SyncCommitteeMessage) o; - return Objects.equals(slot, that.slot) - && Objects.equals(beaconBlockRoot, that.beaconBlockRoot) - && Objects.equals(validatorIndex, that.validatorIndex) - && Objects.equals(signature, that.signature); - } - - @Override - public int hashCode() { - return Objects.hash(slot, beaconBlockRoot, validatorIndex, signature); - } - - public Optional< - tech.pegasys.teku.spec.datastructures.operations.versions.altair.SyncCommitteeMessage> - asInternalCommitteeSignature(final Spec spec) { - final Optional maybeSchema = - spec.atSlot(slot).getSchemaDefinitions().toVersionAltair(); - if (maybeSchema.isEmpty()) { - final String message = - String.format( - "Could not create sync committee signature at phase0 slot %s for validator %s", - slot, validatorIndex); - throw new IllegalArgumentException(message); - } - return maybeSchema.map( - schema -> - schema - .getSyncCommitteeMessageSchema() - .create(slot, beaconBlockRoot, validatorIndex, signature.asInternalBLSSignature())); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/SyncCommitteeSubnetSubscription.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/SyncCommitteeSubnetSubscription.java deleted file mode 100644 index a6360c0f0bd..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/altair/SyncCommitteeSubnetSubscription.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.api.schema.altair; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.List; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -public class SyncCommitteeSubnetSubscription { - @JsonProperty("validator_index") - @Schema(type = "string", format = "uint64") - public final UInt64 validatorIndex; - - @JsonProperty("sync_committee_indices") - @ArraySchema(schema = @Schema(type = "string", format = "uint64")) - public final List syncCommitteeIndices; - - @JsonProperty("until_epoch") - @Schema( - type = "string", - format = "uint64", - description = - "The final epoch (exclusive value) that the specified validator requires the subscription for.") - public final UInt64 untilEpoch; - - @JsonCreator - public SyncCommitteeSubnetSubscription( - @JsonProperty("validator_index") final UInt64 validatorIndex, - @JsonProperty("sync_committee_indices") final List syncCommitteeIndices, - @JsonProperty("until_epoch") final UInt64 untilEpoch) { - this.validatorIndex = validatorIndex; - this.syncCommitteeIndices = syncCommitteeIndices; - this.untilEpoch = untilEpoch; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/BeaconBlockBellatrix.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/BeaconBlockBellatrix.java deleted file mode 100644 index a438a72d04c..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/BeaconBlockBellatrix.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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.api.schema.bellatrix; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.altair.BeaconBlockAltair; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock; -import tech.pegasys.teku.spec.schemas.SchemaDefinitionsBellatrix; - -public class BeaconBlockBellatrix extends BeaconBlockAltair { - - public BeaconBlockBellatrix(final BeaconBlock message) { - super( - message.getSlot(), - message.getProposerIndex(), - message.getParentRoot(), - message.getStateRoot(), - new BeaconBlockBodyBellatrix(message.getBody().toVersionBellatrix().orElseThrow())); - } - - @Override - public BeaconBlock asInternalBeaconBlock(final Spec spec) { - final SpecVersion specVersion = spec.atSlot(slot); - return SchemaDefinitionsBellatrix.required(specVersion.getSchemaDefinitions()) - .getBeaconBlockSchema() - .create( - slot, - proposer_index, - parent_root, - state_root, - body.asInternalBeaconBlockBody(specVersion)); - } - - @JsonProperty("body") - @Override - public BeaconBlockBodyBellatrix getBody() { - return (BeaconBlockBodyBellatrix) body; - } - - @JsonCreator - public BeaconBlockBellatrix( - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("proposer_index") final UInt64 proposerIndex, - @JsonProperty("parent_root") final Bytes32 parentRoot, - @JsonProperty("state_root") final Bytes32 stateRoot, - @JsonProperty("body") final BeaconBlockBodyBellatrix body) { - super(slot, proposerIndex, parentRoot, stateRoot, body); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/BeaconBlockBodyBellatrix.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/BeaconBlockBodyBellatrix.java deleted file mode 100644 index 907aeeb31a9..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/BeaconBlockBodyBellatrix.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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.api.schema.bellatrix; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import java.util.function.Function; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.Attestation; -import tech.pegasys.teku.api.schema.AttesterSlashing; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.api.schema.Deposit; -import tech.pegasys.teku.api.schema.Eth1Data; -import tech.pegasys.teku.api.schema.ProposerSlashing; -import tech.pegasys.teku.api.schema.SignedVoluntaryExit; -import tech.pegasys.teku.api.schema.altair.BeaconBlockBodyAltair; -import tech.pegasys.teku.api.schema.altair.SyncAggregate; -import tech.pegasys.teku.infrastructure.async.SafeFuture; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBodyBuilder; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.bellatrix.BeaconBlockBodySchemaBellatrix; - -public class BeaconBlockBodyBellatrix extends BeaconBlockBodyAltair { - @JsonProperty("execution_payload") - public final ExecutionPayloadBellatrix executionPayload; - - @JsonCreator - public BeaconBlockBodyBellatrix( - @JsonProperty("randao_reveal") final BLSSignature randaoReveal, - @JsonProperty("eth1_data") final Eth1Data eth1Data, - @JsonProperty("graffiti") final Bytes32 graffiti, - @JsonProperty("proposer_slashings") final List proposerSlashings, - @JsonProperty("attester_slashings") final List attesterSlashings, - @JsonProperty("attestations") final List attestations, - @JsonProperty("deposits") final List deposits, - @JsonProperty("voluntary_exits") final List voluntaryExits, - @JsonProperty("sync_aggregate") final SyncAggregate syncAggregate, - @JsonProperty("execution_payload") final ExecutionPayloadBellatrix executionPayload) { - super( - randaoReveal, - eth1Data, - graffiti, - proposerSlashings, - attesterSlashings, - attestations, - deposits, - voluntaryExits, - syncAggregate); - checkNotNull(executionPayload, "Execution Payload is required for bellatrix blocks"); - this.executionPayload = executionPayload; - } - - public BeaconBlockBodyBellatrix( - final tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.bellatrix - .BeaconBlockBodyBellatrix - message) { - super(message); - checkNotNull( - message.getExecutionPayload(), "Execution Payload is required for bellatrix blocks"); - this.executionPayload = new ExecutionPayloadBellatrix(message.getExecutionPayload()); - } - - @Override - public BeaconBlockBodySchemaBellatrix getBeaconBlockBodySchema(final SpecVersion spec) { - return (BeaconBlockBodySchemaBellatrix) - spec.getSchemaDefinitions().getBeaconBlockBodySchema(); - } - - @Override - public BeaconBlockBody asInternalBeaconBlockBody( - final SpecVersion spec, final Function> builderRef) { - return super.asInternalBeaconBlockBody( - spec, - builder -> - SafeFuture.allOf( - builderRef.apply(builder), - SafeFuture.of( - () -> - builder.executionPayload( - executionPayload.asInternalExecutionPayload(spec))))); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/BeaconPreparableProposer.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/BeaconPreparableProposer.java deleted file mode 100644 index ec55254f8f2..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/BeaconPreparableProposer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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.api.schema.bellatrix; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_EXECUTION_ADDRESS; -import static tech.pegasys.teku.api.schema.SchemaConstants.EXAMPLE_EXECUTION_ADDRESS; -import static tech.pegasys.teku.api.schema.SchemaConstants.EXAMPLE_UINT64; -import static tech.pegasys.teku.api.schema.SchemaConstants.PATTERN_EXECUTION_ADDRESS; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import tech.pegasys.teku.ethereum.execution.types.Eth1Address; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -@SuppressWarnings("JavaCase") -public class BeaconPreparableProposer { - @JsonProperty("validator_index") - @Schema(type = "string", format = "uint64", example = EXAMPLE_UINT64) - public final UInt64 validator_index; - - @JsonProperty("fee_recipient") - @Schema( - type = "string", - pattern = PATTERN_EXECUTION_ADDRESS, - example = EXAMPLE_EXECUTION_ADDRESS, - description = DESCRIPTION_EXECUTION_ADDRESS) - public final Eth1Address fee_recipient; - - @JsonCreator - public BeaconPreparableProposer( - final @JsonProperty("validator_index") UInt64 validator_index, - final @JsonProperty("fee_recipient") Eth1Address fee_recipient) { - this.validator_index = validator_index; - this.fee_recipient = fee_recipient; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/BeaconStateBellatrix.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/BeaconStateBellatrix.java deleted file mode 100644 index 4137e8de9b3..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/BeaconStateBellatrix.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * 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.api.schema.bellatrix; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import java.util.Objects; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.BeaconBlockHeader; -import tech.pegasys.teku.api.schema.Checkpoint; -import tech.pegasys.teku.api.schema.Eth1Data; -import tech.pegasys.teku.api.schema.Fork; -import tech.pegasys.teku.api.schema.Validator; -import tech.pegasys.teku.api.schema.altair.BeaconStateAltair; -import tech.pegasys.teku.api.schema.altair.SyncCommittee; -import tech.pegasys.teku.infrastructure.ssz.collections.SszBitvector; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.execution.versions.bellatrix.ExecutionPayloadHeaderSchemaBellatrix; -import tech.pegasys.teku.spec.datastructures.state.SyncCommittee.SyncCommitteeSchema; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.MutableBeaconState; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.bellatrix.BeaconStateSchemaBellatrix; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.bellatrix.MutableBeaconStateBellatrix; - -public class BeaconStateBellatrix extends BeaconStateAltair { - - @JsonProperty("latest_execution_payload_header") - public ExecutionPayloadHeaderBellatrix latestExecutionPayloadHeader; - - @JsonCreator - public BeaconStateBellatrix( - @JsonProperty("genesis_time") final UInt64 genesisTime, - @JsonProperty("genesis_validators_root") final Bytes32 genesisValidatorsRoot, - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("fork") final Fork fork, - @JsonProperty("latest_block_header") final BeaconBlockHeader latestBlockHeader, - @JsonProperty("block_roots") final List blockRoots, - @JsonProperty("state_roots") final List stateRoots, - @JsonProperty("historical_roots") final List historicalRoots, - @JsonProperty("eth1_data") final Eth1Data eth1Data, - @JsonProperty("eth1_data_votes") final List eth1DataVotes, - @JsonProperty("eth1_deposit_index") final UInt64 eth1DepositIndex, - @JsonProperty("validators") final List validators, - @JsonProperty("balances") final List balances, - @JsonProperty("randao_mixes") final List randaoMixes, - @JsonProperty("slashings") final List slashings, - @JsonProperty("previous_epoch_participation") final byte[] previousEpochParticipation, - @JsonProperty("current_epoch_participation") final byte[] currentEpochParticipation, - @JsonProperty("justification_bits") final SszBitvector justificationBits, - @JsonProperty("previous_justified_checkpoint") final Checkpoint previousJustifiedCheckpoint, - @JsonProperty("current_justified_checkpoint") final Checkpoint currentJustifiedCheckpoint, - @JsonProperty("finalized_checkpoint") final Checkpoint finalizedCheckpoint, - @JsonProperty("inactivity_scores") final List inactivityScores, - @JsonProperty("current_sync_committee") final SyncCommittee currentSyncCommittee, - @JsonProperty("next_sync_committee") final SyncCommittee nextSyncCommittee, - @JsonProperty("latest_execution_payload_header") - final ExecutionPayloadHeaderBellatrix latestExecutionPayloadHeader) { - super( - genesisTime, - genesisValidatorsRoot, - slot, - fork, - latestBlockHeader, - blockRoots, - stateRoots, - historicalRoots, - eth1Data, - eth1DataVotes, - eth1DepositIndex, - validators, - balances, - randaoMixes, - slashings, - previousEpochParticipation, - currentEpochParticipation, - justificationBits, - previousJustifiedCheckpoint, - currentJustifiedCheckpoint, - finalizedCheckpoint, - inactivityScores, - currentSyncCommittee, - nextSyncCommittee); - this.latestExecutionPayloadHeader = latestExecutionPayloadHeader; - } - - @Override - protected void applyAdditionalFields( - final MutableBeaconState state, final SpecVersion specVersion) { - state - .toMutableVersionBellatrix() - .ifPresent( - beaconStateBellatrix -> - applyBellatrixFields( - beaconStateBellatrix, - BeaconStateSchemaBellatrix.required(state.getBeaconStateSchema()) - .getCurrentSyncCommitteeSchema(), - BeaconStateSchemaBellatrix.required(beaconStateBellatrix.getBeaconStateSchema()) - .getLastExecutionPayloadHeaderSchema(), - this)); - } - - public static void applyBellatrixFields( - final MutableBeaconStateBellatrix state, - final SyncCommitteeSchema syncCommitteeSchema, - final ExecutionPayloadHeaderSchemaBellatrix executionPayloadHeaderSchema, - final BeaconStateBellatrix instance) { - BeaconStateAltair.applyAltairFields(state, syncCommitteeSchema, instance); - - state.setLatestExecutionPayloadHeader( - instance.latestExecutionPayloadHeader.asInternalExecutionPayloadHeader( - executionPayloadHeaderSchema)); - } - - public BeaconStateBellatrix(final BeaconState beaconState) { - super(beaconState); - final tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.bellatrix - .BeaconStateBellatrix - bellatrix = beaconState.toVersionBellatrix().orElseThrow(); - this.latestExecutionPayloadHeader = - new ExecutionPayloadHeaderBellatrix(bellatrix.getLatestExecutionPayloadHeader()); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof BeaconStateBellatrix)) { - return false; - } - if (!super.equals(o)) { - return false; - } - BeaconStateBellatrix that = (BeaconStateBellatrix) o; - return Objects.equals(latestExecutionPayloadHeader, that.latestExecutionPayloadHeader); - } - - @Override - public int hashCode() { - return Objects.hash(super.hashCode(), latestExecutionPayloadHeader); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/BlindedBeaconBlockBodyBellatrix.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/BlindedBeaconBlockBodyBellatrix.java deleted file mode 100644 index ac6fd3c473c..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/BlindedBeaconBlockBodyBellatrix.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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.api.schema.bellatrix; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.Attestation; -import tech.pegasys.teku.api.schema.AttesterSlashing; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.api.schema.Deposit; -import tech.pegasys.teku.api.schema.Eth1Data; -import tech.pegasys.teku.api.schema.ProposerSlashing; -import tech.pegasys.teku.api.schema.SignedVoluntaryExit; -import tech.pegasys.teku.api.schema.altair.BeaconBlockBodyAltair; -import tech.pegasys.teku.api.schema.altair.SyncAggregate; -import tech.pegasys.teku.infrastructure.async.SafeFuture; -import tech.pegasys.teku.spec.SpecVersion; -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.BlindedBeaconBlockBodySchemaBellatrix; -import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeaderSchema; - -public class BlindedBeaconBlockBodyBellatrix extends BeaconBlockBodyAltair { - @JsonProperty("execution_payload_header") - public final ExecutionPayloadHeaderBellatrix executionPayloadHeader; - - @JsonCreator - public BlindedBeaconBlockBodyBellatrix( - @JsonProperty("randao_reveal") final BLSSignature randaoReveal, - @JsonProperty("eth1_data") final Eth1Data eth1Data, - @JsonProperty("graffiti") final Bytes32 graffiti, - @JsonProperty("proposer_slashings") final List proposerSlashings, - @JsonProperty("attester_slashings") final List attesterSlashings, - @JsonProperty("attestations") final List attestations, - @JsonProperty("deposits") final List deposits, - @JsonProperty("voluntary_exits") final List voluntaryExits, - @JsonProperty("sync_aggregate") final SyncAggregate syncAggregate, - @JsonProperty("execution_payload_header") - final ExecutionPayloadHeaderBellatrix executionPayloadHeader) { - super( - randaoReveal, - eth1Data, - graffiti, - proposerSlashings, - attesterSlashings, - attestations, - deposits, - voluntaryExits, - syncAggregate); - checkNotNull( - executionPayloadHeader, - "Execution Payload Header is required for bellatrix blinded blocks"); - this.executionPayloadHeader = executionPayloadHeader; - } - - public BlindedBeaconBlockBodyBellatrix( - final tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.bellatrix - .BlindedBeaconBlockBodyBellatrix - blockBody) { - super(blockBody); - this.executionPayloadHeader = - new ExecutionPayloadHeaderBellatrix(blockBody.getExecutionPayloadHeader()); - } - - public BlindedBeaconBlockBodyBellatrix(final BeaconBlockBodyBellatrix blockBody) { - super(blockBody); - this.executionPayloadHeader = - new ExecutionPayloadHeaderBellatrix(blockBody.getExecutionPayload()); - } - - @Override - public BlindedBeaconBlockBodySchemaBellatrix getBeaconBlockBodySchema(final SpecVersion spec) { - return (BlindedBeaconBlockBodySchemaBellatrix) - spec.getSchemaDefinitions().getBlindedBeaconBlockBodySchema(); - } - - @Override - public boolean isBlinded() { - return true; - } - - @Override - public BeaconBlockBody asInternalBeaconBlockBody(final SpecVersion spec) { - - final ExecutionPayloadHeaderSchema executionPayloadHeaderSchema = - getBeaconBlockBodySchema(spec).getExecutionPayloadHeaderSchema(); - - return super.asInternalBeaconBlockBody( - spec, - builder -> { - builder.executionPayloadHeader( - executionPayloadHeader.asInternalExecutionPayloadHeader( - executionPayloadHeaderSchema)); - return SafeFuture.COMPLETE; - }); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/BlindedBlockBellatrix.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/BlindedBlockBellatrix.java deleted file mode 100644 index 19ca5fc796d..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/BlindedBlockBellatrix.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.api.schema.bellatrix; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.altair.BeaconBlockAltair; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock; -import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockSchema; - -public class BlindedBlockBellatrix extends BeaconBlockAltair { - - public BlindedBlockBellatrix(final BeaconBlock message) { - super( - message.getSlot(), - message.getProposerIndex(), - message.getParentRoot(), - message.getStateRoot(), - new BlindedBeaconBlockBodyBellatrix( - message.getBody().toBlindedVersionBellatrix().orElseThrow())); - } - - @Override - public BeaconBlockSchema getBeaconBlockSchema(final SpecVersion spec) { - return spec.getSchemaDefinitions().getBlindedBeaconBlockSchema(); - } - - @Override - public BeaconBlock asInternalBeaconBlock(final Spec spec) { - final SpecVersion specVersion = spec.atSlot(slot); - return getBeaconBlockSchema(specVersion) - .create( - slot, - proposer_index, - parent_root, - state_root, - body.asInternalBeaconBlockBody(specVersion)); - } - - @JsonProperty("body") - @Override - public BlindedBeaconBlockBodyBellatrix getBody() { - return (BlindedBeaconBlockBodyBellatrix) body; - } - - @JsonCreator - public BlindedBlockBellatrix( - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("proposer_index") final UInt64 proposerIndex, - @JsonProperty("parent_root") final Bytes32 parentRoot, - @JsonProperty("state_root") final Bytes32 stateRoot, - @JsonProperty("body") final BlindedBeaconBlockBodyBellatrix body) { - super(slot, proposerIndex, parentRoot, stateRoot, body); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/ExecutionPayloadBellatrix.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/ExecutionPayloadBellatrix.java deleted file mode 100644 index fe9e23f1193..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/ExecutionPayloadBellatrix.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * 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.api.schema.bellatrix; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.MoreObjects; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import org.apache.tuweni.bytes.Bytes; -import org.apache.tuweni.bytes.Bytes32; -import org.apache.tuweni.units.bigints.UInt256; -import tech.pegasys.teku.api.schema.ExecutionPayload; -import tech.pegasys.teku.infrastructure.bytes.Bytes20; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadBuilder; -import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadSchema; -import tech.pegasys.teku.spec.datastructures.execution.Transaction; -import tech.pegasys.teku.spec.schemas.SchemaDefinitionsBellatrix; - -public class ExecutionPayloadBellatrix extends ExecutionPayloadCommon implements ExecutionPayload { - - @ArraySchema(schema = @Schema(type = "string", format = "byte")) - public final List transactions; - - @JsonCreator - public ExecutionPayloadBellatrix( - final @JsonProperty("parent_hash") Bytes32 parentHash, - final @JsonProperty("fee_recipient") Bytes20 feeRecipient, - final @JsonProperty("state_root") Bytes32 stateRoot, - final @JsonProperty("receipts_root") Bytes32 receiptsRoot, - final @JsonProperty("logs_bloom") Bytes logsBloom, - final @JsonProperty("prev_randao") Bytes32 prevRandao, - final @JsonProperty("block_number") UInt64 blockNumber, - final @JsonProperty("gas_limit") UInt64 gasLimit, - final @JsonProperty("gas_used") UInt64 gasUsed, - final @JsonProperty("timestamp") UInt64 timestamp, - final @JsonProperty("extra_data") Bytes extraData, - final @JsonProperty("base_fee_per_gas") UInt256 baseFeePerGas, - final @JsonProperty("block_hash") Bytes32 blockHash, - final @JsonProperty("transactions") List transactions) { - super( - parentHash, - feeRecipient, - stateRoot, - receiptsRoot, - logsBloom, - prevRandao, - blockNumber, - gasLimit, - gasUsed, - timestamp, - extraData, - baseFeePerGas, - blockHash); - this.transactions = transactions != null ? transactions : Collections.emptyList(); - } - - public ExecutionPayloadBellatrix( - final tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload executionPayload) { - super( - executionPayload.getParentHash(), - executionPayload.getFeeRecipient(), - executionPayload.getStateRoot(), - executionPayload.getReceiptsRoot(), - executionPayload.getLogsBloom(), - executionPayload.getPrevRandao(), - executionPayload.getBlockNumber(), - executionPayload.getGasLimit(), - executionPayload.getGasUsed(), - executionPayload.getTimestamp(), - executionPayload.getExtraData(), - executionPayload.getBaseFeePerGas(), - executionPayload.getBlockHash()); - this.transactions = - executionPayload.getTransactions().stream().map(Transaction::getBytes).toList(); - } - - public tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload - asInternalExecutionPayload(final Spec spec, final UInt64 slot) { - return asInternalExecutionPayload(spec.atSlot(slot)); - } - - public tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload - asInternalExecutionPayload(final SpecVersion spec) { - final Optional maybeSchema = - spec.getSchemaDefinitions().toVersionBellatrix(); - - if (maybeSchema.isEmpty()) { - throw new IllegalArgumentException( - "Could not create execution payload at pre-bellatrix slot"); - } - - final ExecutionPayloadSchema executionPayloadSchema = - maybeSchema.get().getExecutionPayloadSchema(); - return executionPayloadSchema.createExecutionPayload( - builder -> applyToBuilder(executionPayloadSchema, builder)); - } - - protected ExecutionPayloadBuilder applyToBuilder( - final ExecutionPayloadSchema executionPayloadSchema, - final ExecutionPayloadBuilder builder) { - return builder - .parentHash(parentHash) - .feeRecipient(feeRecipient) - .stateRoot(stateRoot) - .receiptsRoot(receiptsRoot) - .logsBloom(logsBloom) - .prevRandao(prevRandao) - .blockNumber(blockNumber) - .gasLimit(gasLimit) - .gasUsed(gasUsed) - .timestamp(timestamp) - .extraData(extraData) - .baseFeePerGas(baseFeePerGas) - .blockHash(blockHash) - .transactions(transactions); - } - - @Override - public Optional toVersionBellatrix() { - return Optional.of(this); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - if (!super.equals(o)) { - return false; - } - final ExecutionPayloadBellatrix that = (ExecutionPayloadBellatrix) o; - return Objects.equals(transactions, that.transactions); - } - - @Override - public int hashCode() { - return Objects.hash(super.hashCode(), transactions); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("parentHash", parentHash) - .add("feeRecipient", feeRecipient) - .add("stateRoot", stateRoot) - .add("receiptsRoot", receiptsRoot) - .add("logsBloom", logsBloom) - .add("prevRandao", prevRandao) - .add("blockNumber", blockNumber) - .add("gasLimit", gasLimit) - .add("gasUsed", gasUsed) - .add("timestamp", timestamp) - .add("extraData", extraData) - .add("baseFeePerGas", baseFeePerGas) - .add("blockHash", blockHash) - .add("transactions", transactions) - .toString(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/ExecutionPayloadCommon.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/ExecutionPayloadCommon.java deleted file mode 100644 index d3a7cb9f868..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/ExecutionPayloadCommon.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * 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.api.schema.bellatrix; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES20; -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES32; -import static tech.pegasys.teku.api.schema.SchemaConstants.PATTERN_BYTES20; -import static tech.pegasys.teku.api.schema.SchemaConstants.PATTERN_BYTES32; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.MoreObjects; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import org.apache.tuweni.bytes.Bytes; -import org.apache.tuweni.bytes.Bytes32; -import org.apache.tuweni.units.bigints.UInt256; -import tech.pegasys.teku.infrastructure.bytes.Bytes20; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -public abstract class ExecutionPayloadCommon { - - @JsonProperty("parent_hash") - @Schema( - type = "string", - format = "byte", - pattern = PATTERN_BYTES32, - description = DESCRIPTION_BYTES32) - public final Bytes32 parentHash; - - @JsonProperty("fee_recipient") - @Schema( - type = "string", - format = "byte", - pattern = PATTERN_BYTES20, - description = DESCRIPTION_BYTES20) - public final Bytes20 feeRecipient; - - @JsonProperty("state_root") - @Schema( - type = "string", - format = "byte", - pattern = PATTERN_BYTES32, - description = DESCRIPTION_BYTES32) - public final Bytes32 stateRoot; - - @JsonProperty("receipts_root") - @Schema( - type = "string", - format = "byte", - pattern = PATTERN_BYTES32, - description = DESCRIPTION_BYTES32) - public final Bytes32 receiptsRoot; - - @JsonProperty("logs_bloom") - @Schema(type = "string", format = "byte") - public final Bytes logsBloom; - - @JsonProperty("prev_randao") - @Schema( - type = "string", - format = "byte", - pattern = PATTERN_BYTES32, - description = DESCRIPTION_BYTES32) - public final Bytes32 prevRandao; - - @JsonProperty("block_number") - @Schema(type = "string", format = "uint64") - public final UInt64 blockNumber; - - @JsonProperty("gas_limit") - @Schema(type = "string", format = "uint64") - public final UInt64 gasLimit; - - @JsonProperty("gas_used") - @Schema(type = "string", format = "uint64") - public final UInt64 gasUsed; - - @Schema(type = "string", format = "uint64") - public final UInt64 timestamp; - - @JsonProperty("extra_data") - @Schema(type = "string", format = "byte") - public final Bytes extraData; - - @JsonProperty("base_fee_per_gas") - @Schema(type = "string", format = "uint256") - public final UInt256 baseFeePerGas; - - @JsonProperty("block_hash") - @Schema( - type = "string", - format = "byte", - pattern = PATTERN_BYTES32, - description = DESCRIPTION_BYTES32) - public final Bytes32 blockHash; - - public ExecutionPayloadCommon( - final @JsonProperty("parent_hash") Bytes32 parentHash, - final @JsonProperty("fee_recipient") Bytes20 feeRecipient, - final @JsonProperty("state_root") Bytes32 stateRoot, - final @JsonProperty("receipts_root") Bytes32 receiptsRoot, - final @JsonProperty("logs_bloom") Bytes logsBloom, - final @JsonProperty("prev_randao") Bytes32 prevRandao, - final @JsonProperty("block_number") UInt64 blockNumber, - final @JsonProperty("gas_limit") UInt64 gasLimit, - final @JsonProperty("gas_used") UInt64 gasUsed, - final @JsonProperty("timestamp") UInt64 timestamp, - final @JsonProperty("extra_data") Bytes extraData, - final @JsonProperty("base_fee_per_gas") UInt256 baseFeePerGas, - final @JsonProperty("block_hash") Bytes32 blockHash) { - this.parentHash = parentHash; - this.feeRecipient = feeRecipient; - this.stateRoot = stateRoot; - this.receiptsRoot = receiptsRoot; - this.logsBloom = logsBloom; - this.prevRandao = prevRandao; - this.blockNumber = blockNumber; - this.gasLimit = gasLimit; - this.gasUsed = gasUsed; - this.timestamp = timestamp; - this.extraData = extraData; - this.baseFeePerGas = baseFeePerGas; - this.blockHash = blockHash; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final ExecutionPayloadCommon that = (ExecutionPayloadCommon) o; - return Objects.equals(parentHash, that.parentHash) - && Objects.equals(feeRecipient, that.feeRecipient) - && Objects.equals(stateRoot, that.stateRoot) - && Objects.equals(receiptsRoot, that.receiptsRoot) - && Objects.equals(logsBloom, that.logsBloom) - && Objects.equals(prevRandao, that.prevRandao) - && Objects.equals(blockNumber, that.blockNumber) - && Objects.equals(gasLimit, that.gasLimit) - && Objects.equals(gasUsed, that.gasUsed) - && Objects.equals(timestamp, that.timestamp) - && Objects.equals(extraData, that.extraData) - && Objects.equals(baseFeePerGas, that.baseFeePerGas) - && Objects.equals(blockHash, that.blockHash); - } - - @Override - public int hashCode() { - return Objects.hash( - parentHash, - feeRecipient, - stateRoot, - receiptsRoot, - logsBloom, - prevRandao, - blockNumber, - gasLimit, - gasUsed, - timestamp, - extraData, - baseFeePerGas, - blockHash); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("parentHash", parentHash) - .add("feeRecipient", feeRecipient) - .add("stateRoot", stateRoot) - .add("receiptsRoot", receiptsRoot) - .add("logsBloom", logsBloom) - .add("prevRandao", prevRandao) - .add("blockNumber", blockNumber) - .add("gasLimit", gasLimit) - .add("gasUsed", gasUsed) - .add("timestamp", timestamp) - .add("extraData", extraData) - .add("baseFeePerGas", baseFeePerGas) - .add("blockHash", blockHash) - .toString(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/ExecutionPayloadHeaderBellatrix.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/ExecutionPayloadHeaderBellatrix.java deleted file mode 100644 index ee0d49477ef..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/ExecutionPayloadHeaderBellatrix.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * 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.api.schema.bellatrix; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES32; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.MoreObjects; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import java.util.Optional; -import org.apache.tuweni.bytes.Bytes; -import org.apache.tuweni.bytes.Bytes32; -import org.apache.tuweni.units.bigints.UInt256; -import tech.pegasys.teku.api.schema.ExecutionPayloadHeader; -import tech.pegasys.teku.infrastructure.bytes.Bytes20; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload; -import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeaderSchema; - -public class ExecutionPayloadHeaderBellatrix extends ExecutionPayloadCommon - implements ExecutionPayloadHeader { - - @JsonProperty("transactions_root") - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32) - public final Bytes32 transactionsRoot; - - @JsonCreator - public ExecutionPayloadHeaderBellatrix( - final @JsonProperty("parent_hash") Bytes32 parentHash, - final @JsonProperty("fee_recipient") Bytes20 feeRecipient, - final @JsonProperty("state_root") Bytes32 stateRoot, - final @JsonProperty("receipts_root") Bytes32 receiptsRoot, - final @JsonProperty("logs_bloom") Bytes logsBloom, - final @JsonProperty("prev_randao") Bytes32 prevRandao, - final @JsonProperty("block_number") UInt64 blockNumber, - final @JsonProperty("gas_limit") UInt64 gasLimit, - final @JsonProperty("gas_used") UInt64 gasUsed, - final @JsonProperty("timestamp") UInt64 timestamp, - final @JsonProperty("extra_data") Bytes extraData, - final @JsonProperty("base_fee_per_gas") UInt256 baseFeePerGas, - final @JsonProperty("block_hash") Bytes32 blockHash, - final @JsonProperty("transactions_root") Bytes32 transactionsRoot) { - super( - parentHash, - feeRecipient, - stateRoot, - receiptsRoot, - logsBloom, - prevRandao, - blockNumber, - gasLimit, - gasUsed, - timestamp, - extraData, - baseFeePerGas, - blockHash); - this.transactionsRoot = transactionsRoot; - } - - public ExecutionPayloadHeaderBellatrix( - final tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeader - executionPayloadHeader) { - super( - executionPayloadHeader.getParentHash(), - executionPayloadHeader.getFeeRecipient(), - executionPayloadHeader.getStateRoot(), - executionPayloadHeader.getReceiptsRoot(), - executionPayloadHeader.getLogsBloom(), - executionPayloadHeader.getPrevRandao(), - executionPayloadHeader.getBlockNumber(), - executionPayloadHeader.getGasLimit(), - executionPayloadHeader.getGasUsed(), - executionPayloadHeader.getTimestamp(), - executionPayloadHeader.getExtraData(), - executionPayloadHeader.getBaseFeePerGas(), - executionPayloadHeader.getBlockHash()); - this.transactionsRoot = executionPayloadHeader.getTransactionsRoot(); - } - - public ExecutionPayloadHeaderBellatrix(final ExecutionPayload executionPayload) { - super( - executionPayload.getParentHash(), - executionPayload.getFeeRecipient(), - executionPayload.getStateRoot(), - executionPayload.getReceiptsRoot(), - executionPayload.getLogsBloom(), - executionPayload.getPrevRandao(), - executionPayload.getBlockNumber(), - executionPayload.getGasLimit(), - executionPayload.getGasUsed(), - executionPayload.getTimestamp(), - executionPayload.getExtraData(), - executionPayload.getBaseFeePerGas(), - executionPayload.getBlockHash()); - this.transactionsRoot = executionPayload.getTransactions().hashTreeRoot(); - } - - @Override - public tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeader - asInternalExecutionPayloadHeader(final ExecutionPayloadHeaderSchema schema) { - return schema.createExecutionPayloadHeader( - payloadBuilder -> - payloadBuilder - .parentHash(parentHash) - .feeRecipient(feeRecipient) - .stateRoot(stateRoot) - .receiptsRoot(receiptsRoot) - .logsBloom(logsBloom) - .prevRandao(prevRandao) - .blockNumber(blockNumber) - .gasLimit(gasLimit) - .gasUsed(gasUsed) - .timestamp(timestamp) - .extraData(extraData) - .baseFeePerGas(baseFeePerGas) - .blockHash(blockHash) - .transactionsRoot(transactionsRoot)); - } - - @Override - public Optional toVersionBellatrix() { - return Optional.of(this); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - if (!super.equals(o)) { - return false; - } - final ExecutionPayloadHeaderBellatrix that = (ExecutionPayloadHeaderBellatrix) o; - return Objects.equals(transactionsRoot, that.transactionsRoot); - } - - @Override - public int hashCode() { - return Objects.hash(super.hashCode(), transactionsRoot); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("parentHash", parentHash) - .add("feeRecipient", feeRecipient) - .add("stateRoot", stateRoot) - .add("receiptsRoot", receiptsRoot) - .add("logsBloom", logsBloom) - .add("prevRandao", prevRandao) - .add("blockNumber", blockNumber) - .add("gasLimit", gasLimit) - .add("gasUsed", gasUsed) - .add("timestamp", timestamp) - .add("extraData", extraData) - .add("baseFeePerGas", baseFeePerGas) - .add("blockHash", blockHash) - .add("transactionsRoot", transactionsRoot) - .toString(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/SignedBeaconBlockBellatrix.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/SignedBeaconBlockBellatrix.java deleted file mode 100644 index ad979e67be9..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/SignedBeaconBlockBellatrix.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.api.schema.bellatrix; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.api.schema.SignedBeaconBlock; -import tech.pegasys.teku.api.schema.interfaces.SignedBlock; - -public class SignedBeaconBlockBellatrix extends SignedBeaconBlock implements SignedBlock { - private final BeaconBlockBellatrix message; - - public SignedBeaconBlockBellatrix( - final tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock internalBlock) { - super(internalBlock); - this.message = new BeaconBlockBellatrix(internalBlock.getMessage()); - } - - @Override - public BeaconBlockBellatrix getMessage() { - return message; - } - - @JsonCreator - public SignedBeaconBlockBellatrix( - @JsonProperty("message") final BeaconBlockBellatrix message, - @JsonProperty("signature") final BLSSignature signature) { - super(message, signature); - this.message = message; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/SignedBlindedBeaconBlockBellatrix.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/SignedBlindedBeaconBlockBellatrix.java deleted file mode 100644 index 078a1f89f22..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/bellatrix/SignedBlindedBeaconBlockBellatrix.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.api.schema.bellatrix; - -import static com.google.common.base.Preconditions.checkArgument; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.api.schema.SignedBeaconBlock; -import tech.pegasys.teku.api.schema.interfaces.SignedBlock; - -public class SignedBlindedBeaconBlockBellatrix extends SignedBeaconBlock implements SignedBlock { - private final BlindedBlockBellatrix message; - - public SignedBlindedBeaconBlockBellatrix( - final tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock internalBlock) { - super(internalBlock); - checkArgument( - internalBlock.getMessage().getBody().isBlinded(), "requires a signed blinded beacon block"); - this.message = new BlindedBlockBellatrix(internalBlock.getMessage()); - } - - @Override - public BlindedBlockBellatrix getMessage() { - return message; - } - - @JsonCreator - public SignedBlindedBeaconBlockBellatrix( - @JsonProperty("message") final BlindedBlockBellatrix message, - @JsonProperty("signature") final BLSSignature signature) { - super(message, signature); - this.message = message; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/BeaconBlockBodyCapella.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/BeaconBlockBodyCapella.java deleted file mode 100644 index edd96192d7c..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/BeaconBlockBodyCapella.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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.api.schema.capella; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.Attestation; -import tech.pegasys.teku.api.schema.AttesterSlashing; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.api.schema.Deposit; -import tech.pegasys.teku.api.schema.Eth1Data; -import tech.pegasys.teku.api.schema.ProposerSlashing; -import tech.pegasys.teku.api.schema.SignedVoluntaryExit; -import tech.pegasys.teku.api.schema.altair.BeaconBlockBodyAltair; -import tech.pegasys.teku.api.schema.altair.SyncAggregate; -import tech.pegasys.teku.infrastructure.async.SafeFuture; -import tech.pegasys.teku.infrastructure.ssz.schema.SszListSchema; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.capella.BeaconBlockBodySchemaCapella; - -public class BeaconBlockBodyCapella extends BeaconBlockBodyAltair { - - @JsonProperty("execution_payload") - public final ExecutionPayloadCapella executionPayload; - - @JsonProperty("bls_to_execution_changes") - public final List blsToExecutionChanges; - - @JsonCreator - public BeaconBlockBodyCapella( - @JsonProperty("randao_reveal") final BLSSignature randaoReveal, - @JsonProperty("eth1_data") final Eth1Data eth1Data, - @JsonProperty("graffiti") final Bytes32 graffiti, - @JsonProperty("proposer_slashings") final List proposerSlashings, - @JsonProperty("attester_slashings") final List attesterSlashings, - @JsonProperty("attestations") final List attestations, - @JsonProperty("deposits") final List deposits, - @JsonProperty("voluntary_exits") final List voluntaryExits, - @JsonProperty("sync_aggregate") final SyncAggregate syncAggregate, - @JsonProperty("execution_payload") final ExecutionPayloadCapella executionPayload, - @JsonProperty("bls_to_execution_changes") - final List blsToExecutionChanges) { - super( - randaoReveal, - eth1Data, - graffiti, - proposerSlashings, - attesterSlashings, - attestations, - deposits, - voluntaryExits, - syncAggregate); - checkNotNull(executionPayload, "Execution Payload is required for capella blocks"); - this.executionPayload = executionPayload; - checkNotNull(blsToExecutionChanges, "BlsToExecutionChanges is required for capella blocks"); - this.blsToExecutionChanges = blsToExecutionChanges; - } - - public BeaconBlockBodyCapella( - final tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.capella - .BeaconBlockBodyCapella - message) { - super(message); - checkNotNull(message.getExecutionPayload(), "Execution Payload is required for capella blocks"); - this.executionPayload = new ExecutionPayloadCapella(message.getExecutionPayload()); - checkNotNull( - message.getBlsToExecutionChanges(), "BlsToExecutionChanges is required for capella blocks"); - this.blsToExecutionChanges = - message.getBlsToExecutionChanges().stream().map(SignedBlsToExecutionChange::new).toList(); - } - - @Override - public BeaconBlockBodySchemaCapella getBeaconBlockBodySchema(final SpecVersion spec) { - return (BeaconBlockBodySchemaCapella) spec.getSchemaDefinitions().getBeaconBlockBodySchema(); - } - - @Override - public BeaconBlockBody asInternalBeaconBlockBody(final SpecVersion spec) { - final SszListSchema< - tech.pegasys.teku.spec.datastructures.operations.SignedBlsToExecutionChange, ?> - blsToExecutionChangesSchema = - getBeaconBlockBodySchema(spec).getBlsToExecutionChangesSchema(); - - return super.asInternalBeaconBlockBody( - spec, - builder -> { - builder.executionPayload(executionPayload.asInternalExecutionPayload(spec)); - builder.blsToExecutionChanges( - this.blsToExecutionChanges.stream() - .map(b -> b.asInternalSignedBlsToExecutionChange(spec)) - .collect(blsToExecutionChangesSchema.collector())); - return SafeFuture.COMPLETE; - }); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/BeaconBlockCapella.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/BeaconBlockCapella.java deleted file mode 100644 index 848ab6c4471..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/BeaconBlockCapella.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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.api.schema.capella; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.altair.BeaconBlockAltair; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock; -import tech.pegasys.teku.spec.schemas.SchemaDefinitionsCapella; - -public class BeaconBlockCapella extends BeaconBlockAltair { - - public BeaconBlockCapella(final BeaconBlock message) { - super( - message.getSlot(), - message.getProposerIndex(), - message.getParentRoot(), - message.getStateRoot(), - new BeaconBlockBodyCapella(message.getBody().toVersionCapella().orElseThrow())); - } - - @Override - public BeaconBlock asInternalBeaconBlock(final Spec spec) { - final SpecVersion specVersion = spec.atSlot(slot); - return SchemaDefinitionsCapella.required(specVersion.getSchemaDefinitions()) - .getBeaconBlockSchema() - .create( - slot, - proposer_index, - parent_root, - state_root, - body.asInternalBeaconBlockBody(specVersion)); - } - - @JsonProperty("body") - @Override - public BeaconBlockBodyCapella getBody() { - return (BeaconBlockBodyCapella) body; - } - - @JsonCreator - public BeaconBlockCapella( - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("proposer_index") final UInt64 proposerIndex, - @JsonProperty("parent_root") final Bytes32 parentRoot, - @JsonProperty("state_root") final Bytes32 stateRoot, - @JsonProperty("body") final BeaconBlockBodyCapella body) { - super(slot, proposerIndex, parentRoot, stateRoot, body); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/BeaconStateCapella.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/BeaconStateCapella.java deleted file mode 100644 index 2ab2d60a752..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/BeaconStateCapella.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * 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.api.schema.capella; - -import static tech.pegasys.teku.api.schema.SchemaConstants.EXAMPLE_UINT64; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.List; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.BeaconBlockHeader; -import tech.pegasys.teku.api.schema.Checkpoint; -import tech.pegasys.teku.api.schema.Eth1Data; -import tech.pegasys.teku.api.schema.Fork; -import tech.pegasys.teku.api.schema.Validator; -import tech.pegasys.teku.api.schema.altair.BeaconStateAltair; -import tech.pegasys.teku.api.schema.altair.SyncCommittee; -import tech.pegasys.teku.infrastructure.ssz.collections.SszBitvector; -import tech.pegasys.teku.infrastructure.ssz.schema.SszListSchema; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.execution.versions.capella.ExecutionPayloadHeaderSchemaCapella; -import tech.pegasys.teku.spec.datastructures.state.SyncCommittee.SyncCommitteeSchema; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.MutableBeaconState; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.capella.BeaconStateSchemaCapella; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.capella.MutableBeaconStateCapella; - -public class BeaconStateCapella extends BeaconStateAltair { - - @JsonProperty("latest_execution_payload_header") - public ExecutionPayloadHeaderCapella latestExecutionPayloadHeader; - - @JsonProperty("next_withdrawal_index") - @Schema(type = "string", example = EXAMPLE_UINT64) - public final UInt64 nextWithdrawalIndex; - - @JsonProperty("next_withdrawal_validator_index") - @Schema(type = "string", example = EXAMPLE_UINT64) - public final UInt64 nextWithdrawalValidatorIndex; - - @JsonProperty("historical_summaries") - public final List historicalSummaries; - - public BeaconStateCapella( - @JsonProperty("genesis_time") final UInt64 genesisTime, - @JsonProperty("genesis_validators_root") final Bytes32 genesisValidatorsRoot, - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("fork") final Fork fork, - @JsonProperty("latest_block_header") final BeaconBlockHeader latestBlockHeader, - @JsonProperty("block_roots") final List blockRoots, - @JsonProperty("state_roots") final List stateRoots, - @JsonProperty("historical_roots") final List historicalRoots, - @JsonProperty("eth1_data") final Eth1Data eth1Data, - @JsonProperty("eth1_data_votes") final List eth1DataVotes, - @JsonProperty("eth1_deposit_index") final UInt64 eth1DepositIndex, - @JsonProperty("validators") final List validators, - @JsonProperty("balances") final List balances, - @JsonProperty("randao_mixes") final List randaoMixes, - @JsonProperty("slashings") final List slashings, - @JsonProperty("previous_epoch_participation") final byte[] previousEpochParticipation, - @JsonProperty("current_epoch_participation") final byte[] currentEpochParticipation, - @JsonProperty("justification_bits") final SszBitvector justificationBits, - @JsonProperty("previous_justified_checkpoint") final Checkpoint previousJustifiedCheckpoint, - @JsonProperty("current_justified_checkpoint") final Checkpoint currentJustifiedCheckpoint, - @JsonProperty("finalized_checkpoint") final Checkpoint finalizedCheckpoint, - @JsonProperty("inactivity_scores") final List inactivityScores, - @JsonProperty("current_sync_committee") final SyncCommittee currentSyncCommittee, - @JsonProperty("next_sync_committee") final SyncCommittee nextSyncCommittee, - @JsonProperty("latest_execution_payload_header") - final ExecutionPayloadHeaderCapella latestExecutionPayloadHeader, - @JsonProperty("next_withdrawal_index") final UInt64 nextWithdrawalIndex, - @JsonProperty("next_withdrawal_validator_index") final UInt64 nextWithdrawalValidatorIndex, - @JsonProperty("historical_summaries") final List historicalSummaries) { - super( - genesisTime, - genesisValidatorsRoot, - slot, - fork, - latestBlockHeader, - blockRoots, - stateRoots, - historicalRoots, - eth1Data, - eth1DataVotes, - eth1DepositIndex, - validators, - balances, - randaoMixes, - slashings, - previousEpochParticipation, - currentEpochParticipation, - justificationBits, - previousJustifiedCheckpoint, - currentJustifiedCheckpoint, - finalizedCheckpoint, - inactivityScores, - currentSyncCommittee, - nextSyncCommittee); - this.latestExecutionPayloadHeader = latestExecutionPayloadHeader; - this.nextWithdrawalIndex = nextWithdrawalIndex; - this.nextWithdrawalValidatorIndex = nextWithdrawalValidatorIndex; - this.historicalSummaries = historicalSummaries; - } - - public BeaconStateCapella(final BeaconState beaconState) { - super(beaconState); - final tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.capella - .BeaconStateCapella - capella = beaconState.toVersionCapella().orElseThrow(); - this.latestExecutionPayloadHeader = - new ExecutionPayloadHeaderCapella(capella.getLatestExecutionPayloadHeader()); - this.nextWithdrawalIndex = capella.getNextWithdrawalIndex(); - this.nextWithdrawalValidatorIndex = capella.getNextWithdrawalValidatorIndex(); - this.historicalSummaries = - capella.getHistoricalSummaries().stream().map(HistoricalSummary::new).toList(); - } - - @Override - protected void applyAdditionalFields( - final MutableBeaconState state, final SpecVersion specVersion) { - state - .toMutableVersionCapella() - .ifPresent( - mutableBeaconStateCapella -> - applyCapellaFields( - specVersion, - mutableBeaconStateCapella, - BeaconStateSchemaCapella.required( - mutableBeaconStateCapella.getBeaconStateSchema()) - .getCurrentSyncCommitteeSchema(), - BeaconStateSchemaCapella.required( - mutableBeaconStateCapella.getBeaconStateSchema()) - .getLastExecutionPayloadHeaderSchema(), - BeaconStateSchemaCapella.required( - mutableBeaconStateCapella.getBeaconStateSchema()) - .getHistoricalSummariesSchema(), - this)); - } - - protected static void applyCapellaFields( - final SpecVersion specVersion, - final MutableBeaconStateCapella state, - final SyncCommitteeSchema syncCommitteeSchema, - final ExecutionPayloadHeaderSchemaCapella executionPayloadHeaderSchema, - final SszListSchema< - tech.pegasys.teku.spec.datastructures.state.versions.capella.HistoricalSummary, ?> - historicalSummariesSchema, - final BeaconStateCapella instance) { - - BeaconStateAltair.applyAltairFields(state, syncCommitteeSchema, instance); - - state.setLatestExecutionPayloadHeader( - executionPayloadHeaderSchema.createExecutionPayloadHeader( - builder -> - builder - .parentHash(instance.latestExecutionPayloadHeader.parentHash) - .feeRecipient(instance.latestExecutionPayloadHeader.feeRecipient) - .stateRoot(instance.latestExecutionPayloadHeader.stateRoot) - .receiptsRoot(instance.latestExecutionPayloadHeader.receiptsRoot) - .logsBloom(instance.latestExecutionPayloadHeader.logsBloom) - .prevRandao(instance.latestExecutionPayloadHeader.prevRandao) - .blockNumber(instance.latestExecutionPayloadHeader.blockNumber) - .gasLimit(instance.latestExecutionPayloadHeader.gasLimit) - .gasUsed(instance.latestExecutionPayloadHeader.gasUsed) - .timestamp(instance.latestExecutionPayloadHeader.timestamp) - .extraData(instance.latestExecutionPayloadHeader.extraData) - .baseFeePerGas(instance.latestExecutionPayloadHeader.baseFeePerGas) - .blockHash(instance.latestExecutionPayloadHeader.blockHash) - .transactionsRoot(instance.latestExecutionPayloadHeader.transactionsRoot) - .withdrawalsRoot(() -> instance.latestExecutionPayloadHeader.withdrawalsRoot))); - - state.setNextWithdrawalIndex(instance.nextWithdrawalIndex); - state.setNextWithdrawalValidatorIndex(instance.nextWithdrawalValidatorIndex); - state.setHistoricalSummaries( - historicalSummariesSchema.createFromElements( - instance.historicalSummaries.stream() - .map( - historicalSummary -> historicalSummary.asInternalHistoricalSummary(specVersion)) - .toList())); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/BlindedBeaconBlockBodyCapella.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/BlindedBeaconBlockBodyCapella.java deleted file mode 100644 index f50664926c6..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/BlindedBeaconBlockBodyCapella.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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.api.schema.capella; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.Attestation; -import tech.pegasys.teku.api.schema.AttesterSlashing; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.api.schema.Deposit; -import tech.pegasys.teku.api.schema.Eth1Data; -import tech.pegasys.teku.api.schema.ProposerSlashing; -import tech.pegasys.teku.api.schema.SignedVoluntaryExit; -import tech.pegasys.teku.api.schema.altair.BeaconBlockBodyAltair; -import tech.pegasys.teku.api.schema.altair.SyncAggregate; -import tech.pegasys.teku.infrastructure.async.SafeFuture; -import tech.pegasys.teku.infrastructure.ssz.schema.SszListSchema; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.capella.BlindedBeaconBlockBodySchemaCapella; -import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeaderSchema; - -public class BlindedBeaconBlockBodyCapella extends BeaconBlockBodyAltair { - - @JsonProperty("execution_payload_header") - public final ExecutionPayloadHeaderCapella executionPayloadHeader; - - @JsonProperty("bls_to_execution_changes") - public final List blsToExecutionChanges; - - @JsonCreator - public BlindedBeaconBlockBodyCapella( - @JsonProperty("randao_reveal") final BLSSignature randaoReveal, - @JsonProperty("eth1_data") final Eth1Data eth1Data, - @JsonProperty("graffiti") final Bytes32 graffiti, - @JsonProperty("proposer_slashings") final List proposerSlashings, - @JsonProperty("attester_slashings") final List attesterSlashings, - @JsonProperty("attestations") final List attestations, - @JsonProperty("deposits") final List deposits, - @JsonProperty("voluntary_exits") final List voluntaryExits, - @JsonProperty("sync_aggregate") final SyncAggregate syncAggregate, - @JsonProperty("execution_payload_header") - final ExecutionPayloadHeaderCapella executionPayloadHeader, - @JsonProperty("bls_to_execution_changes") - final List blsToExecutionChanges) { - super( - randaoReveal, - eth1Data, - graffiti, - proposerSlashings, - attesterSlashings, - attestations, - deposits, - voluntaryExits, - syncAggregate); - checkNotNull( - executionPayloadHeader, "Execution Payload Header is required for capella blinded blocks"); - this.executionPayloadHeader = executionPayloadHeader; - checkNotNull( - blsToExecutionChanges, "bls_to_execution_changes is required for capella blinded blocks"); - this.blsToExecutionChanges = blsToExecutionChanges; - } - - public BlindedBeaconBlockBodyCapella( - final tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.capella - .BlindedBeaconBlockBodyCapella - blockBody) { - super(blockBody); - this.executionPayloadHeader = - new ExecutionPayloadHeaderCapella(blockBody.getExecutionPayloadHeader()); - this.blsToExecutionChanges = - blockBody.getBlsToExecutionChanges().stream().map(SignedBlsToExecutionChange::new).toList(); - } - - @Override - public BlindedBeaconBlockBodySchemaCapella getBeaconBlockBodySchema(final SpecVersion spec) { - return (BlindedBeaconBlockBodySchemaCapella) - spec.getSchemaDefinitions().getBlindedBeaconBlockBodySchema(); - } - - @Override - public boolean isBlinded() { - return true; - } - - @Override - public BeaconBlockBody asInternalBeaconBlockBody(final SpecVersion spec) { - - final ExecutionPayloadHeaderSchema executionPayloadHeaderSchema = - getBeaconBlockBodySchema(spec).getExecutionPayloadHeaderSchema(); - - final SszListSchema< - tech.pegasys.teku.spec.datastructures.operations.SignedBlsToExecutionChange, ?> - blsToExecutionChangesSchema = getBeaconBlockBodySchema(spec).getBlsToExecutionChanges(); - - return super.asInternalBeaconBlockBody( - spec, - builder -> { - builder.executionPayloadHeader( - executionPayloadHeader.asInternalExecutionPayloadHeader( - executionPayloadHeaderSchema)); - builder.blsToExecutionChanges( - this.blsToExecutionChanges.stream() - .map(b -> b.asInternalSignedBlsToExecutionChange(spec)) - .collect(blsToExecutionChangesSchema.collector())); - return SafeFuture.COMPLETE; - }); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/BlindedBlockCapella.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/BlindedBlockCapella.java deleted file mode 100644 index 43dc083a560..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/BlindedBlockCapella.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.api.schema.capella; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.altair.BeaconBlockAltair; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock; -import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockSchema; - -public class BlindedBlockCapella extends BeaconBlockAltair { - - public BlindedBlockCapella(final BeaconBlock message) { - super( - message.getSlot(), - message.getProposerIndex(), - message.getParentRoot(), - message.getStateRoot(), - new BlindedBeaconBlockBodyCapella( - message.getBody().toBlindedVersionCapella().orElseThrow())); - } - - @Override - public BeaconBlockSchema getBeaconBlockSchema(final SpecVersion spec) { - return spec.getSchemaDefinitions().getBlindedBeaconBlockSchema(); - } - - @Override - public BeaconBlock asInternalBeaconBlock(final Spec spec) { - final SpecVersion specVersion = spec.atSlot(slot); - return getBeaconBlockSchema(specVersion) - .create( - slot, - proposer_index, - parent_root, - state_root, - body.asInternalBeaconBlockBody(specVersion)); - } - - @JsonProperty("body") - @Override - public BlindedBeaconBlockBodyCapella getBody() { - return (BlindedBeaconBlockBodyCapella) body; - } - - @JsonCreator - public BlindedBlockCapella( - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("proposer_index") final UInt64 proposerIndex, - @JsonProperty("parent_root") final Bytes32 parentRoot, - @JsonProperty("state_root") final Bytes32 stateRoot, - @JsonProperty("body") final BlindedBeaconBlockBodyCapella body) { - super(slot, proposerIndex, parentRoot, stateRoot, body); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/BlsToExecutionChange.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/BlsToExecutionChange.java deleted file mode 100644 index c99ec968aaa..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/BlsToExecutionChange.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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.api.schema.capella; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES20; -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES48; -import static tech.pegasys.teku.api.schema.SchemaConstants.EXAMPLE_PUBKEY; -import static tech.pegasys.teku.api.schema.SchemaConstants.PATTERN_BYTES20; -import static tech.pegasys.teku.api.schema.SchemaConstants.PATTERN_PUBKEY; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Optional; -import tech.pegasys.teku.api.schema.BLSPubKey; -import tech.pegasys.teku.infrastructure.bytes.Bytes20; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.schemas.SchemaDefinitionsCapella; - -public class BlsToExecutionChange { - - @JsonProperty("validator_index") - @Schema(type = "string", format = "uint64") - public final UInt64 validatorIndex; - - @JsonProperty("from_bls_pubkey") - @Schema( - type = "string", - pattern = PATTERN_PUBKEY, - example = EXAMPLE_PUBKEY, - description = DESCRIPTION_BYTES48) - public final BLSPubKey fromBlsPubkey; - - @JsonProperty("to_execution_address") - @Schema( - type = "string", - format = "byte", - pattern = PATTERN_BYTES20, - description = DESCRIPTION_BYTES20) - public final Bytes20 toExecutionAddress; - - @JsonCreator - public BlsToExecutionChange( - @JsonProperty("validator_index") final UInt64 validatorIndex, - @JsonProperty("from_bls_pubkey") final BLSPubKey fromBlsPubkey, - @JsonProperty("to_execution_address") final Bytes20 toExecutionAddress) { - this.validatorIndex = validatorIndex; - this.fromBlsPubkey = fromBlsPubkey; - this.toExecutionAddress = toExecutionAddress; - } - - public BlsToExecutionChange( - final tech.pegasys.teku.spec.datastructures.operations.BlsToExecutionChange - blsToExecutionChanges) { - this.validatorIndex = blsToExecutionChanges.getValidatorIndex(); - this.fromBlsPubkey = new BLSPubKey(blsToExecutionChanges.getFromBlsPubkey()); - this.toExecutionAddress = blsToExecutionChanges.getToExecutionAddress(); - } - - public tech.pegasys.teku.spec.datastructures.operations.BlsToExecutionChange - asInternalBlsToExecutionChange(final SpecVersion spec) { - final Optional schemaDefinitionsCapella = - spec.getSchemaDefinitions().toVersionCapella(); - - if (schemaDefinitionsCapella.isEmpty()) { - throw new IllegalArgumentException( - "Could not create BlsToExecutionChange for non-capella spec"); - } - - return schemaDefinitionsCapella - .get() - .getBlsToExecutionChangeSchema() - .create(validatorIndex, fromBlsPubkey.asBLSPublicKey(), toExecutionAddress); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/ExecutionPayloadCapella.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/ExecutionPayloadCapella.java deleted file mode 100644 index 46c2a5426e8..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/ExecutionPayloadCapella.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * 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.api.schema.capella; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.MoreObjects; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import org.apache.tuweni.bytes.Bytes; -import org.apache.tuweni.bytes.Bytes32; -import org.apache.tuweni.units.bigints.UInt256; -import tech.pegasys.teku.api.schema.ExecutionPayload; -import tech.pegasys.teku.api.schema.bellatrix.ExecutionPayloadBellatrix; -import tech.pegasys.teku.infrastructure.bytes.Bytes20; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadBuilder; -import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadSchema; - -public class ExecutionPayloadCapella extends ExecutionPayloadBellatrix implements ExecutionPayload { - - @JsonProperty("withdrawals") - @ArraySchema(schema = @Schema(type = "string", format = "byte")) - public final List withdrawals; - - @JsonCreator - public ExecutionPayloadCapella( - final @JsonProperty("parent_hash") Bytes32 parentHash, - final @JsonProperty("fee_recipient") Bytes20 feeRecipient, - final @JsonProperty("state_root") Bytes32 stateRoot, - final @JsonProperty("receipts_root") Bytes32 receiptsRoot, - final @JsonProperty("logs_bloom") Bytes logsBloom, - final @JsonProperty("prev_randao") Bytes32 prevRandao, - final @JsonProperty("block_number") UInt64 blockNumber, - final @JsonProperty("gas_limit") UInt64 gasLimit, - final @JsonProperty("gas_used") UInt64 gasUsed, - final @JsonProperty("timestamp") UInt64 timestamp, - final @JsonProperty("extra_data") Bytes extraData, - final @JsonProperty("base_fee_per_gas") UInt256 baseFeePerGas, - final @JsonProperty("block_hash") Bytes32 blockHash, - final @JsonProperty("transactions") List transactions, - final @JsonProperty("withdrawals") List withdrawals) { - super( - parentHash, - feeRecipient, - stateRoot, - receiptsRoot, - logsBloom, - prevRandao, - blockNumber, - gasLimit, - gasUsed, - timestamp, - extraData, - baseFeePerGas, - blockHash, - transactions); - this.withdrawals = withdrawals != null ? withdrawals : Collections.emptyList(); - } - - public ExecutionPayloadCapella( - final tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload executionPayload) { - super(executionPayload); - this.withdrawals = - executionPayload.getOptionalWithdrawals().orElseThrow().stream() - .map(Withdrawal::new) - .toList(); - } - - @Override - protected ExecutionPayloadBuilder applyToBuilder( - final ExecutionPayloadSchema executionPayloadSchema, - final ExecutionPayloadBuilder builder) { - return super.applyToBuilder(executionPayloadSchema, builder) - .withdrawals( - () -> - withdrawals.stream() - .map( - withdrawal -> - withdrawal.asInternalWithdrawal( - executionPayloadSchema.getWithdrawalSchemaRequired())) - .toList()); - } - - @Override - public Optional toVersionCapella() { - return Optional.of(this); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - if (!super.equals(o)) { - return false; - } - final ExecutionPayloadCapella that = (ExecutionPayloadCapella) o; - return Objects.equals(withdrawals, that.withdrawals); - } - - @Override - public int hashCode() { - return Objects.hash(super.hashCode(), withdrawals); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("parentHash", parentHash) - .add("feeRecipient", feeRecipient) - .add("stateRoot", stateRoot) - .add("receiptsRoot", receiptsRoot) - .add("logsBloom", logsBloom) - .add("prevRandao", prevRandao) - .add("blockNumber", blockNumber) - .add("gasLimit", gasLimit) - .add("gasUsed", gasUsed) - .add("timestamp", timestamp) - .add("extraData", extraData) - .add("baseFeePerGas", baseFeePerGas) - .add("blockHash", blockHash) - .add("transactions", transactions) - .add("withdrawals", withdrawals) - .toString(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/ExecutionPayloadHeaderCapella.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/ExecutionPayloadHeaderCapella.java deleted file mode 100644 index 94a60b2c801..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/ExecutionPayloadHeaderCapella.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * 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.api.schema.capella; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES32; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.MoreObjects; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Objects; -import java.util.Optional; -import org.apache.tuweni.bytes.Bytes; -import org.apache.tuweni.bytes.Bytes32; -import org.apache.tuweni.units.bigints.UInt256; -import tech.pegasys.teku.api.schema.bellatrix.ExecutionPayloadHeaderBellatrix; -import tech.pegasys.teku.infrastructure.bytes.Bytes20; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeader; - -public class ExecutionPayloadHeaderCapella extends ExecutionPayloadHeaderBellatrix { - - @JsonProperty("withdrawals_root") - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32) - public final Bytes32 withdrawalsRoot; - - @JsonCreator - public ExecutionPayloadHeaderCapella( - final @JsonProperty("parent_hash") Bytes32 parentHash, - final @JsonProperty("fee_recipient") Bytes20 feeRecipient, - final @JsonProperty("state_root") Bytes32 stateRoot, - final @JsonProperty("receipts_root") Bytes32 receiptsRoot, - final @JsonProperty("logs_bloom") Bytes logsBloom, - final @JsonProperty("prev_randao") Bytes32 prevRandao, - final @JsonProperty("block_number") UInt64 blockNumber, - final @JsonProperty("gas_limit") UInt64 gasLimit, - final @JsonProperty("gas_used") UInt64 gasUsed, - final @JsonProperty("timestamp") UInt64 timestamp, - final @JsonProperty("extra_data") Bytes extraData, - final @JsonProperty("base_fee_per_gas") UInt256 baseFeePerGas, - final @JsonProperty("block_hash") Bytes32 blockHash, - final @JsonProperty("transactions_root") Bytes32 transactionsRoot, - final @JsonProperty("withdrawals_root") Bytes32 withdrawalsRoot) { - super( - parentHash, - feeRecipient, - stateRoot, - receiptsRoot, - logsBloom, - prevRandao, - blockNumber, - gasLimit, - gasUsed, - timestamp, - extraData, - baseFeePerGas, - blockHash, - transactionsRoot); - this.withdrawalsRoot = withdrawalsRoot; - } - - public ExecutionPayloadHeaderCapella(final ExecutionPayloadHeader executionPayloadHeader) { - super( - executionPayloadHeader.getParentHash(), - executionPayloadHeader.getFeeRecipient(), - executionPayloadHeader.getStateRoot(), - executionPayloadHeader.getReceiptsRoot(), - executionPayloadHeader.getLogsBloom(), - executionPayloadHeader.getPrevRandao(), - executionPayloadHeader.getBlockNumber(), - executionPayloadHeader.getGasLimit(), - executionPayloadHeader.getGasUsed(), - executionPayloadHeader.getTimestamp(), - executionPayloadHeader.getExtraData(), - executionPayloadHeader.getBaseFeePerGas(), - executionPayloadHeader.getBlockHash(), - executionPayloadHeader.getTransactionsRoot()); - this.withdrawalsRoot = executionPayloadHeader.getOptionalWithdrawalsRoot().orElseThrow(); - } - - @Override - public Optional toVersionCapella() { - return Optional.of(this); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - if (!super.equals(o)) { - return false; - } - final ExecutionPayloadHeaderCapella that = (ExecutionPayloadHeaderCapella) o; - return Objects.equals(withdrawalsRoot, that.withdrawalsRoot); - } - - @Override - public int hashCode() { - return Objects.hash(super.hashCode(), withdrawalsRoot); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("parentHash", parentHash) - .add("feeRecipient", feeRecipient) - .add("stateRoot", stateRoot) - .add("receiptsRoot", receiptsRoot) - .add("logsBloom", logsBloom) - .add("prevRandao", prevRandao) - .add("blockNumber", blockNumber) - .add("gasLimit", gasLimit) - .add("gasUsed", gasUsed) - .add("timestamp", timestamp) - .add("extraData", extraData) - .add("baseFeePerGas", baseFeePerGas) - .add("blockHash", blockHash) - .add("transactionsRoot", transactionsRoot) - .add("withdrawalsRoot", withdrawalsRoot) - .toString(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/HistoricalSummary.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/HistoricalSummary.java deleted file mode 100644 index 663a98eecb2..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/HistoricalSummary.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.api.schema.capella; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES32; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Optional; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.infrastructure.ssz.primitive.SszBytes32; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.schemas.SchemaDefinitionsCapella; - -public class HistoricalSummary { - - @JsonProperty("block_summary_root") - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32) - public final Bytes32 blockSummaryRoot; - - @JsonProperty("state_summary_root") - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES32) - public final Bytes32 stateSummaryRoot; - - public HistoricalSummary( - @JsonProperty("block_summary_root") final Bytes32 blockSummaryRoot, - @JsonProperty("state_summary_root") final Bytes32 stateSummaryRoot) { - this.blockSummaryRoot = blockSummaryRoot; - this.stateSummaryRoot = stateSummaryRoot; - } - - public HistoricalSummary( - final tech.pegasys.teku.spec.datastructures.state.versions.capella.HistoricalSummary - internalSummary) { - this.blockSummaryRoot = internalSummary.getBlockSummaryRoot().get(); - this.stateSummaryRoot = internalSummary.getStateSummaryRoot().get(); - } - - public tech.pegasys.teku.spec.datastructures.state.versions.capella.HistoricalSummary - asInternalHistoricalSummary(final SpecVersion spec) { - final Optional schemaDefinitionsCapella = - spec.getSchemaDefinitions().toVersionCapella(); - if (schemaDefinitionsCapella.isEmpty()) { - throw new IllegalArgumentException("Could not create HistoricalSummary for pre-capella spec"); - } - return schemaDefinitionsCapella - .get() - .getHistoricalSummarySchema() - .create(SszBytes32.of(blockSummaryRoot), SszBytes32.of(stateSummaryRoot)); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/SignedBeaconBlockCapella.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/SignedBeaconBlockCapella.java deleted file mode 100644 index 3ec75da8624..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/SignedBeaconBlockCapella.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.api.schema.capella; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.api.schema.SignedBeaconBlock; -import tech.pegasys.teku.api.schema.interfaces.SignedBlock; - -public class SignedBeaconBlockCapella extends SignedBeaconBlock implements SignedBlock { - private final BeaconBlockCapella message; - - public SignedBeaconBlockCapella( - final tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock internalBlock) { - super(internalBlock); - this.message = new BeaconBlockCapella(internalBlock.getMessage()); - } - - @Override - public BeaconBlockCapella getMessage() { - return message; - } - - @JsonCreator - public SignedBeaconBlockCapella( - @JsonProperty("message") final BeaconBlockCapella message, - @JsonProperty("signature") final BLSSignature signature) { - super(message, signature); - this.message = message; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/SignedBlindedBeaconBlockCapella.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/SignedBlindedBeaconBlockCapella.java deleted file mode 100644 index 76b7a67916b..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/SignedBlindedBeaconBlockCapella.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.api.schema.capella; - -import static com.google.common.base.Preconditions.checkArgument; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.api.schema.SignedBeaconBlock; -import tech.pegasys.teku.api.schema.interfaces.SignedBlock; - -public class SignedBlindedBeaconBlockCapella extends SignedBeaconBlock implements SignedBlock { - private final BlindedBlockCapella message; - - public SignedBlindedBeaconBlockCapella( - final tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock internalBlock) { - super(internalBlock); - checkArgument( - internalBlock.getMessage().getBody().isBlinded(), "requires a signed blinded beacon block"); - this.message = new BlindedBlockCapella(internalBlock.getMessage()); - } - - @Override - public BlindedBlockCapella getMessage() { - return message; - } - - @JsonCreator - public SignedBlindedBeaconBlockCapella( - @JsonProperty("message") final BlindedBlockCapella message, - @JsonProperty("signature") final BLSSignature signature) { - super(message, signature); - this.message = message; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/SignedBlsToExecutionChange.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/SignedBlsToExecutionChange.java deleted file mode 100644 index 6b40a1f494a..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/SignedBlsToExecutionChange.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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.api.schema.capella; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES96; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Optional; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.schemas.SchemaDefinitionsCapella; - -public class SignedBlsToExecutionChange { - - @JsonProperty("message") - public final BlsToExecutionChange message; - - @JsonProperty("signature") - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96) - public final BLSSignature signature; - - @JsonCreator - public SignedBlsToExecutionChange( - @JsonProperty("message") final BlsToExecutionChange message, - @JsonProperty("signature") final BLSSignature signature) { - this.message = message; - this.signature = signature; - } - - public SignedBlsToExecutionChange( - final tech.pegasys.teku.spec.datastructures.operations.SignedBlsToExecutionChange - signedBlsToExecutionChanges) { - this.message = new BlsToExecutionChange(signedBlsToExecutionChanges.getMessage()); - this.signature = new BLSSignature(signedBlsToExecutionChanges.getSignature()); - } - - public tech.pegasys.teku.spec.datastructures.operations.SignedBlsToExecutionChange - asInternalSignedBlsToExecutionChange(final SpecVersion spec) { - final Optional schemaDefinitionsCapella = - spec.getSchemaDefinitions().toVersionCapella(); - - if (schemaDefinitionsCapella.isEmpty()) { - throw new IllegalArgumentException( - "Could not create BlsToExecutionChange for non-capella spec"); - } - - return schemaDefinitionsCapella - .get() - .getSignedBlsToExecutionChangeSchema() - .create(message.asInternalBlsToExecutionChange(spec), signature.asInternalBLSSignature()); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/Withdrawal.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/Withdrawal.java deleted file mode 100644 index c901bc7c88a..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/capella/Withdrawal.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.api.schema.capella; - -import com.fasterxml.jackson.annotation.JsonProperty; -import tech.pegasys.teku.ethereum.execution.types.Eth1Address; -import tech.pegasys.teku.infrastructure.bytes.Bytes20; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.datastructures.execution.versions.capella.WithdrawalSchema; - -public class Withdrawal { - - @JsonProperty("index") - private final UInt64 index; - - @JsonProperty("validator_index") - private final UInt64 validatorIndex; - - @JsonProperty("address") - private final Eth1Address address; - - @JsonProperty("amount") - private final UInt64 amount; - - public Withdrawal( - @JsonProperty("index") final UInt64 index, - @JsonProperty("validator_index") final UInt64 validatorIndex, - @JsonProperty("address") final Eth1Address address, - @JsonProperty("amount") final UInt64 amount) { - this.index = index; - this.validatorIndex = validatorIndex; - this.address = address; - this.amount = amount; - } - - public Withdrawal( - final tech.pegasys.teku.spec.datastructures.execution.versions.capella.Withdrawal - withdrawal) { - this.index = withdrawal.getIndex(); - this.validatorIndex = withdrawal.getValidatorIndex(); - this.address = Eth1Address.fromBytes(withdrawal.getAddress().getWrappedBytes()); - this.amount = withdrawal.getAmount(); - } - - public tech.pegasys.teku.spec.datastructures.execution.versions.capella.Withdrawal - asInternalWithdrawal(final WithdrawalSchema schema) { - return schema.create(index, validatorIndex, new Bytes20(address.getWrappedBytes()), amount); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BeaconBlockBodyDeneb.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BeaconBlockBodyDeneb.java deleted file mode 100644 index cf955f3116a..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BeaconBlockBodyDeneb.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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.api.schema.deneb; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.Attestation; -import tech.pegasys.teku.api.schema.AttesterSlashing; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.api.schema.Deposit; -import tech.pegasys.teku.api.schema.Eth1Data; -import tech.pegasys.teku.api.schema.KZGCommitment; -import tech.pegasys.teku.api.schema.ProposerSlashing; -import tech.pegasys.teku.api.schema.SignedVoluntaryExit; -import tech.pegasys.teku.api.schema.altair.BeaconBlockBodyAltair; -import tech.pegasys.teku.api.schema.altair.SyncAggregate; -import tech.pegasys.teku.api.schema.capella.SignedBlsToExecutionChange; -import tech.pegasys.teku.infrastructure.async.SafeFuture; -import tech.pegasys.teku.infrastructure.ssz.schema.SszListSchema; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.deneb.BeaconBlockBodySchemaDeneb; -import tech.pegasys.teku.spec.datastructures.type.SszKZGCommitment; - -public class BeaconBlockBodyDeneb extends BeaconBlockBodyAltair { - - @JsonProperty("execution_payload") - public final ExecutionPayloadDeneb executionPayload; - - @JsonProperty("bls_to_execution_changes") - public final List blsToExecutionChanges; - - @JsonProperty("blob_kzg_commitments") - public final List blobKZGCommitments; - - @JsonCreator - public BeaconBlockBodyDeneb( - @JsonProperty("randao_reveal") final BLSSignature randaoReveal, - @JsonProperty("eth1_data") final Eth1Data eth1Data, - @JsonProperty("graffiti") final Bytes32 graffiti, - @JsonProperty("proposer_slashings") final List proposerSlashings, - @JsonProperty("attester_slashings") final List attesterSlashings, - @JsonProperty("attestations") final List attestations, - @JsonProperty("deposits") final List deposits, - @JsonProperty("voluntary_exits") final List voluntaryExits, - @JsonProperty("sync_aggregate") final SyncAggregate syncAggregate, - @JsonProperty("execution_payload") final ExecutionPayloadDeneb executionPayload, - @JsonProperty("bls_to_execution_changes") - final List blsToExecutionChanges, - @JsonProperty("blob_kzg_commitments") final List blobKZGCommitments) { - super( - randaoReveal, - eth1Data, - graffiti, - proposerSlashings, - attesterSlashings, - attestations, - deposits, - voluntaryExits, - syncAggregate); - checkNotNull(executionPayload, "Execution Payload is required for Deneb blocks"); - this.executionPayload = executionPayload; - checkNotNull(blsToExecutionChanges, "BlsToExecutionChanges is required for Deneb blocks"); - this.blsToExecutionChanges = blsToExecutionChanges; - checkNotNull(blobKZGCommitments, "blobKZGCommitments is required for Deneb blocks"); - this.blobKZGCommitments = blobKZGCommitments; - } - - public BeaconBlockBodyDeneb( - final tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.deneb - .BeaconBlockBodyDeneb - message) { - super(message); - checkNotNull(message.getExecutionPayload(), "Execution Payload is required for Deneb blocks"); - this.executionPayload = new ExecutionPayloadDeneb(message.getExecutionPayload()); - checkNotNull( - message.getBlsToExecutionChanges(), "BlsToExecutionChanges are required for Deneb blocks"); - this.blsToExecutionChanges = - message.getBlsToExecutionChanges().stream().map(SignedBlsToExecutionChange::new).toList(); - checkNotNull( - message.getBlobKzgCommitments(), "BlobKzgCommitments are required for Deneb blocks"); - this.blobKZGCommitments = - message.getBlobKzgCommitments().stream() - .map(SszKZGCommitment::getKZGCommitment) - .map(KZGCommitment::new) - .toList(); - } - - @Override - public BeaconBlockBodySchemaDeneb getBeaconBlockBodySchema(final SpecVersion spec) { - return (BeaconBlockBodySchemaDeneb) spec.getSchemaDefinitions().getBeaconBlockBodySchema(); - } - - @Override - public BeaconBlockBody asInternalBeaconBlockBody(final SpecVersion spec) { - final SszListSchema< - tech.pegasys.teku.spec.datastructures.operations.SignedBlsToExecutionChange, ?> - blsToExecutionChangesSchema = - getBeaconBlockBodySchema(spec).getBlsToExecutionChangesSchema(); - final SszListSchema blobKZGCommitmentsSchema = - getBeaconBlockBodySchema(spec).getBlobKzgCommitmentsSchema(); - return super.asInternalBeaconBlockBody( - spec, - builder -> { - builder.executionPayload(executionPayload.asInternalExecutionPayload(spec)); - builder.blsToExecutionChanges( - this.blsToExecutionChanges.stream() - .map(b -> b.asInternalSignedBlsToExecutionChange(spec)) - .collect(blsToExecutionChangesSchema.collector())); - builder.blobKzgCommitments( - this.blobKZGCommitments.stream() - .map(KZGCommitment::asInternalKZGCommitment) - .map(SszKZGCommitment::new) - .collect(blobKZGCommitmentsSchema.collector())); - return SafeFuture.COMPLETE; - }); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BeaconBlockDeneb.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BeaconBlockDeneb.java deleted file mode 100644 index 3c61cdaec96..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BeaconBlockDeneb.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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.api.schema.deneb; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.altair.BeaconBlockAltair; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock; -import tech.pegasys.teku.spec.schemas.SchemaDefinitionsDeneb; - -public class BeaconBlockDeneb extends BeaconBlockAltair { - - public BeaconBlockDeneb(final BeaconBlock message) { - super( - message.getSlot(), - message.getProposerIndex(), - message.getParentRoot(), - message.getStateRoot(), - new BeaconBlockBodyDeneb(message.getBody().toVersionDeneb().orElseThrow())); - } - - @Override - public BeaconBlock asInternalBeaconBlock(final Spec spec) { - final SpecVersion specVersion = spec.atSlot(slot); - return SchemaDefinitionsDeneb.required(specVersion.getSchemaDefinitions()) - .getBeaconBlockSchema() - .create( - slot, - proposer_index, - parent_root, - state_root, - body.asInternalBeaconBlockBody(specVersion)); - } - - @JsonProperty("body") - @Override - public BeaconBlockBodyDeneb getBody() { - return (BeaconBlockBodyDeneb) body; - } - - @JsonCreator - public BeaconBlockDeneb( - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("proposer_index") final UInt64 proposerIndex, - @JsonProperty("parent_root") final Bytes32 parentRoot, - @JsonProperty("state_root") final Bytes32 stateRoot, - @JsonProperty("body") final BeaconBlockBodyDeneb body) { - super(slot, proposerIndex, parentRoot, stateRoot, body); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BeaconStateDeneb.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BeaconStateDeneb.java deleted file mode 100644 index 4d7ef4d8c66..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BeaconStateDeneb.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * 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.api.schema.deneb; - -import static tech.pegasys.teku.api.schema.SchemaConstants.EXAMPLE_UINT64; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.List; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.BeaconBlockHeader; -import tech.pegasys.teku.api.schema.Checkpoint; -import tech.pegasys.teku.api.schema.Eth1Data; -import tech.pegasys.teku.api.schema.Fork; -import tech.pegasys.teku.api.schema.Validator; -import tech.pegasys.teku.api.schema.altair.BeaconStateAltair; -import tech.pegasys.teku.api.schema.altair.SyncCommittee; -import tech.pegasys.teku.api.schema.capella.HistoricalSummary; -import tech.pegasys.teku.infrastructure.ssz.collections.SszBitvector; -import tech.pegasys.teku.infrastructure.ssz.schema.SszListSchema; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.ExecutionPayloadHeaderSchemaDeneb; -import tech.pegasys.teku.spec.datastructures.state.SyncCommittee.SyncCommitteeSchema; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.MutableBeaconState; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.deneb.BeaconStateSchemaDeneb; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.deneb.MutableBeaconStateDeneb; - -public class BeaconStateDeneb extends BeaconStateAltair { - - @JsonProperty("latest_execution_payload_header") - public final ExecutionPayloadHeaderDeneb latestExecutionPayloadHeader; - - @JsonProperty("next_withdrawal_index") - @Schema(type = "string", example = EXAMPLE_UINT64) - public final UInt64 nextWithdrawalIndex; - - @JsonProperty("next_withdrawal_validator_index") - @Schema(type = "string", example = EXAMPLE_UINT64) - public final UInt64 nextWithdrawalValidatorIndex; - - @JsonProperty("historical_summaries") - public final List historicalSummaries; - - public BeaconStateDeneb( - @JsonProperty("genesis_time") final UInt64 genesisTime, - @JsonProperty("genesis_validators_root") final Bytes32 genesisValidatorsRoot, - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("fork") final Fork fork, - @JsonProperty("latest_block_header") final BeaconBlockHeader latestBlockHeader, - @JsonProperty("block_roots") final List blockRoots, - @JsonProperty("state_roots") final List stateRoots, - @JsonProperty("historical_roots") final List historicalRoots, - @JsonProperty("eth1_data") final Eth1Data eth1Data, - @JsonProperty("eth1_data_votes") final List eth1DataVotes, - @JsonProperty("eth1_deposit_index") final UInt64 eth1DepositIndex, - @JsonProperty("validators") final List validators, - @JsonProperty("balances") final List balances, - @JsonProperty("randao_mixes") final List randaoMixes, - @JsonProperty("slashings") final List slashings, - @JsonProperty("previous_epoch_participation") final byte[] previousEpochParticipation, - @JsonProperty("current_epoch_participation") final byte[] currentEpochParticipation, - @JsonProperty("justification_bits") final SszBitvector justificationBits, - @JsonProperty("previous_justified_checkpoint") final Checkpoint previousJustifiedCheckpoint, - @JsonProperty("current_justified_checkpoint") final Checkpoint currentJustifiedCheckpoint, - @JsonProperty("finalized_checkpoint") final Checkpoint finalizedCheckpoint, - @JsonProperty("inactivity_scores") final List inactivityScores, - @JsonProperty("current_sync_committee") final SyncCommittee currentSyncCommittee, - @JsonProperty("next_sync_committee") final SyncCommittee nextSyncCommittee, - @JsonProperty("latest_execution_payload_header") - final ExecutionPayloadHeaderDeneb latestExecutionPayloadHeader, - @JsonProperty("next_withdrawal_index") final UInt64 nextWithdrawalIndex, - @JsonProperty("next_withdrawal_validator_index") final UInt64 nextWithdrawalValidatorIndex, - @JsonProperty("historical_summaries") final List historicalSummaries) { - super( - genesisTime, - genesisValidatorsRoot, - slot, - fork, - latestBlockHeader, - blockRoots, - stateRoots, - historicalRoots, - eth1Data, - eth1DataVotes, - eth1DepositIndex, - validators, - balances, - randaoMixes, - slashings, - previousEpochParticipation, - currentEpochParticipation, - justificationBits, - previousJustifiedCheckpoint, - currentJustifiedCheckpoint, - finalizedCheckpoint, - inactivityScores, - currentSyncCommittee, - nextSyncCommittee); - this.latestExecutionPayloadHeader = latestExecutionPayloadHeader; - this.nextWithdrawalIndex = nextWithdrawalIndex; - this.nextWithdrawalValidatorIndex = nextWithdrawalValidatorIndex; - this.historicalSummaries = historicalSummaries; - } - - public BeaconStateDeneb(final BeaconState beaconState) { - super(beaconState); - final tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.deneb.BeaconStateDeneb - deneb = beaconState.toVersionDeneb().orElseThrow(); - this.latestExecutionPayloadHeader = - new ExecutionPayloadHeaderDeneb(deneb.getLatestExecutionPayloadHeader()); - this.nextWithdrawalIndex = deneb.getNextWithdrawalIndex(); - this.nextWithdrawalValidatorIndex = deneb.getNextWithdrawalValidatorIndex(); - this.historicalSummaries = - deneb.getHistoricalSummaries().stream().map(HistoricalSummary::new).toList(); - } - - @Override - protected void applyAdditionalFields( - final MutableBeaconState state, final SpecVersion specVersion) { - state - .toMutableVersionDeneb() - .ifPresent( - mutableBeaconStateDeneb -> - applyDenebFields( - specVersion, - mutableBeaconStateDeneb, - BeaconStateSchemaDeneb.required(mutableBeaconStateDeneb.getBeaconStateSchema()) - .getCurrentSyncCommitteeSchema(), - BeaconStateSchemaDeneb.required(mutableBeaconStateDeneb.getBeaconStateSchema()) - .getLastExecutionPayloadHeaderSchema(), - BeaconStateSchemaDeneb.required(mutableBeaconStateDeneb.getBeaconStateSchema()) - .getHistoricalSummariesSchema(), - this)); - } - - protected static void applyDenebFields( - final SpecVersion specVersion, - final MutableBeaconStateDeneb state, - final SyncCommitteeSchema syncCommitteeSchema, - final ExecutionPayloadHeaderSchemaDeneb executionPayloadHeaderSchema, - final SszListSchema< - tech.pegasys.teku.spec.datastructures.state.versions.capella.HistoricalSummary, ?> - historicalSummariesSchema, - final BeaconStateDeneb instance) { - - BeaconStateAltair.applyAltairFields(state, syncCommitteeSchema, instance); - - state.setLatestExecutionPayloadHeader( - instance.latestExecutionPayloadHeader.asInternalExecutionPayloadHeader( - executionPayloadHeaderSchema)); - - state.setNextWithdrawalIndex(instance.nextWithdrawalIndex); - state.setNextWithdrawalValidatorIndex(instance.nextWithdrawalValidatorIndex); - state.setHistoricalSummaries( - historicalSummariesSchema.createFromElements( - instance.historicalSummaries.stream() - .map( - historicalSummary -> historicalSummary.asInternalHistoricalSummary(specVersion)) - .toList())); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BlindedBeaconBlockBodyDeneb.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BlindedBeaconBlockBodyDeneb.java deleted file mode 100644 index 99245629d69..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BlindedBeaconBlockBodyDeneb.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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.api.schema.deneb; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.Attestation; -import tech.pegasys.teku.api.schema.AttesterSlashing; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.api.schema.Deposit; -import tech.pegasys.teku.api.schema.Eth1Data; -import tech.pegasys.teku.api.schema.KZGCommitment; -import tech.pegasys.teku.api.schema.ProposerSlashing; -import tech.pegasys.teku.api.schema.SignedVoluntaryExit; -import tech.pegasys.teku.api.schema.altair.BeaconBlockBodyAltair; -import tech.pegasys.teku.api.schema.altair.SyncAggregate; -import tech.pegasys.teku.api.schema.capella.SignedBlsToExecutionChange; -import tech.pegasys.teku.infrastructure.async.SafeFuture; -import tech.pegasys.teku.infrastructure.ssz.schema.SszListSchema; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.deneb.BlindedBeaconBlockBodySchemaDeneb; -import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeaderSchema; -import tech.pegasys.teku.spec.datastructures.type.SszKZGCommitment; - -public class BlindedBeaconBlockBodyDeneb extends BeaconBlockBodyAltair { - - @JsonProperty("execution_payload_header") - public final ExecutionPayloadHeaderDeneb executionPayloadHeader; - - @JsonProperty("bls_to_execution_changes") - public final List blsToExecutionChanges; - - @JsonProperty("blob_kzg_commitments") - public final List blobKZGCommitments; - - @JsonCreator - public BlindedBeaconBlockBodyDeneb( - @JsonProperty("randao_reveal") final BLSSignature randaoReveal, - @JsonProperty("eth1_data") final Eth1Data eth1Data, - @JsonProperty("graffiti") final Bytes32 graffiti, - @JsonProperty("proposer_slashings") final List proposerSlashings, - @JsonProperty("attester_slashings") final List attesterSlashings, - @JsonProperty("attestations") final List attestations, - @JsonProperty("deposits") final List deposits, - @JsonProperty("voluntary_exits") final List voluntaryExits, - @JsonProperty("sync_aggregate") final SyncAggregate syncAggregate, - @JsonProperty("execution_payload_header") - final ExecutionPayloadHeaderDeneb executionPayloadHeader, - @JsonProperty("bls_to_execution_changes") - final List blsToExecutionChanges, - @JsonProperty("blob_kzg_commitments") final List blobKZGCommitments) { - super( - randaoReveal, - eth1Data, - graffiti, - proposerSlashings, - attesterSlashings, - attestations, - deposits, - voluntaryExits, - syncAggregate); - checkNotNull( - executionPayloadHeader, "Execution Payload Header is required for Deneb blinded blocks"); - this.executionPayloadHeader = executionPayloadHeader; - checkNotNull( - blsToExecutionChanges, "blsToExecutionChanges is required for Deneb blinded blocks"); - this.blsToExecutionChanges = blsToExecutionChanges; - checkNotNull(blobKZGCommitments, "blobKZGCommitments is required for Deneb blinded blocks"); - this.blobKZGCommitments = blobKZGCommitments; - } - - public BlindedBeaconBlockBodyDeneb( - final tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.deneb - .BlindedBeaconBlockBodyDeneb - blockBody) { - super(blockBody); - this.executionPayloadHeader = - new ExecutionPayloadHeaderDeneb(blockBody.getExecutionPayloadHeader()); - this.blsToExecutionChanges = - blockBody.getBlsToExecutionChanges().stream().map(SignedBlsToExecutionChange::new).toList(); - this.blobKZGCommitments = - blockBody.getBlobKzgCommitments().stream() - .map(SszKZGCommitment::getKZGCommitment) - .map(KZGCommitment::new) - .toList(); - } - - @Override - public BlindedBeaconBlockBodySchemaDeneb getBeaconBlockBodySchema(final SpecVersion spec) { - return (BlindedBeaconBlockBodySchemaDeneb) - spec.getSchemaDefinitions().getBlindedBeaconBlockBodySchema(); - } - - @Override - public boolean isBlinded() { - return true; - } - - @Override - public BeaconBlockBody asInternalBeaconBlockBody(final SpecVersion spec) { - - final ExecutionPayloadHeaderSchema executionPayloadHeaderSchema = - getBeaconBlockBodySchema(spec).getExecutionPayloadHeaderSchema(); - - final SszListSchema< - tech.pegasys.teku.spec.datastructures.operations.SignedBlsToExecutionChange, ?> - blsToExecutionChangesSchema = getBeaconBlockBodySchema(spec).getBlsToExecutionChanges(); - - final SszListSchema blobKZGCommitmentsSchema = - getBeaconBlockBodySchema(spec).getBlobKzgCommitmentsSchema(); - - return super.asInternalBeaconBlockBody( - spec, - builder -> { - builder.executionPayloadHeader( - executionPayloadHeader.asInternalExecutionPayloadHeader( - executionPayloadHeaderSchema)); - builder.blsToExecutionChanges( - this.blsToExecutionChanges.stream() - .map(b -> b.asInternalSignedBlsToExecutionChange(spec)) - .collect(blsToExecutionChangesSchema.collector())); - builder.blobKzgCommitments( - this.blobKZGCommitments.stream() - .map(KZGCommitment::asInternalKZGCommitment) - .map(SszKZGCommitment::new) - .collect(blobKZGCommitmentsSchema.collector())); - return SafeFuture.COMPLETE; - }); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BlindedBlockDeneb.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BlindedBlockDeneb.java deleted file mode 100644 index 936e20ab079..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/BlindedBlockDeneb.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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.api.schema.deneb; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.altair.BeaconBlockAltair; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock; -import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockSchema; - -public class BlindedBlockDeneb extends BeaconBlockAltair { - - public BlindedBlockDeneb(final BeaconBlock message) { - super( - message.getSlot(), - message.getProposerIndex(), - message.getParentRoot(), - message.getStateRoot(), - new BlindedBeaconBlockBodyDeneb(message.getBody().toBlindedVersionDeneb().orElseThrow())); - } - - @Override - public BeaconBlockSchema getBeaconBlockSchema(final SpecVersion spec) { - return spec.getSchemaDefinitions().getBlindedBeaconBlockSchema(); - } - - @Override - public BeaconBlock asInternalBeaconBlock(final Spec spec) { - final SpecVersion specVersion = spec.atSlot(slot); - return getBeaconBlockSchema(specVersion) - .create( - slot, - proposer_index, - parent_root, - state_root, - body.asInternalBeaconBlockBody(specVersion)); - } - - @JsonProperty("body") - @Override - public BlindedBeaconBlockBodyDeneb getBody() { - return (BlindedBeaconBlockBodyDeneb) body; - } - - @JsonCreator - public BlindedBlockDeneb( - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("proposer_index") final UInt64 proposerIndex, - @JsonProperty("parent_root") final Bytes32 parentRoot, - @JsonProperty("state_root") final Bytes32 stateRoot, - @JsonProperty("body") final BlindedBeaconBlockBodyDeneb body) { - super(slot, proposerIndex, parentRoot, stateRoot, body); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/ExecutionPayloadDeneb.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/ExecutionPayloadDeneb.java deleted file mode 100644 index 34aa9585d03..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/ExecutionPayloadDeneb.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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.api.schema.deneb; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.MoreObjects; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import org.apache.tuweni.bytes.Bytes; -import org.apache.tuweni.bytes.Bytes32; -import org.apache.tuweni.units.bigints.UInt256; -import tech.pegasys.teku.api.schema.ExecutionPayload; -import tech.pegasys.teku.api.schema.capella.ExecutionPayloadCapella; -import tech.pegasys.teku.api.schema.capella.Withdrawal; -import tech.pegasys.teku.infrastructure.bytes.Bytes20; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadBuilder; -import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadSchema; - -public class ExecutionPayloadDeneb extends ExecutionPayloadCapella implements ExecutionPayload { - - @JsonProperty("blob_gas_used") - public final UInt64 blobGasUsed; - - @JsonProperty("excess_blob_gas") - public final UInt64 excessBlobGas; - - @JsonCreator - public ExecutionPayloadDeneb( - @JsonProperty("parent_hash") final Bytes32 parentHash, - @JsonProperty("fee_recipient") final Bytes20 feeRecipient, - @JsonProperty("state_root") final Bytes32 stateRoot, - @JsonProperty("receipts_root") final Bytes32 receiptsRoot, - @JsonProperty("logs_bloom") final Bytes logsBloom, - @JsonProperty("prev_randao") final Bytes32 prevRandao, - @JsonProperty("block_number") final UInt64 blockNumber, - @JsonProperty("gas_limit") final UInt64 gasLimit, - @JsonProperty("gas_used") final UInt64 gasUsed, - @JsonProperty("timestamp") final UInt64 timestamp, - @JsonProperty("extra_data") final Bytes extraData, - @JsonProperty("base_fee_per_gas") final UInt256 baseFeePerGas, - @JsonProperty("block_hash") final Bytes32 blockHash, - @JsonProperty("transactions") final List transactions, - @JsonProperty("withdrawals") final List withdrawals, - @JsonProperty("blob_gas_used") final UInt64 blobGasUsed, - @JsonProperty("excess_blob_gas") final UInt64 excessBlobGas) { - super( - parentHash, - feeRecipient, - stateRoot, - receiptsRoot, - logsBloom, - prevRandao, - blockNumber, - gasLimit, - gasUsed, - timestamp, - extraData, - baseFeePerGas, - blockHash, - transactions, - withdrawals); - this.blobGasUsed = blobGasUsed; - this.excessBlobGas = excessBlobGas; - } - - public ExecutionPayloadDeneb( - final tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload executionPayload) { - super(executionPayload); - this.blobGasUsed = executionPayload.toVersionDeneb().orElseThrow().getBlobGasUsed(); - this.excessBlobGas = executionPayload.toVersionDeneb().orElseThrow().getExcessBlobGas(); - } - - @Override - protected ExecutionPayloadBuilder applyToBuilder( - final ExecutionPayloadSchema executionPayloadSchema, - final ExecutionPayloadBuilder builder) { - return super.applyToBuilder(executionPayloadSchema, builder) - .blobGasUsed(() -> blobGasUsed) - .excessBlobGas(() -> excessBlobGas); - } - - @Override - public Optional toVersionDeneb() { - return Optional.of(this); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof ExecutionPayloadDeneb)) { - return false; - } - if (!super.equals(o)) { - return false; - } - final ExecutionPayloadDeneb that = (ExecutionPayloadDeneb) o; - return Objects.equals(blobGasUsed, that.blobGasUsed) - && Objects.equals(excessBlobGas, that.excessBlobGas); - } - - @Override - public int hashCode() { - return Objects.hash(super.hashCode(), blobGasUsed, excessBlobGas); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("parentHash", parentHash) - .add("feeRecipient", feeRecipient) - .add("stateRoot", stateRoot) - .add("receiptsRoot", receiptsRoot) - .add("logsBloom", logsBloom) - .add("prevRandao", prevRandao) - .add("blockNumber", blockNumber) - .add("gasLimit", gasLimit) - .add("gasUsed", gasUsed) - .add("timestamp", timestamp) - .add("extraData", extraData) - .add("baseFeePerGas", baseFeePerGas) - .add("blockHash", blockHash) - .add("transactions", transactions) - .add("withdrawals", withdrawals) - .add("blobGasUsed", blobGasUsed) - .add("excessBlobGas", excessBlobGas) - .toString(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/ExecutionPayloadHeaderDeneb.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/ExecutionPayloadHeaderDeneb.java deleted file mode 100644 index 43d685d2d01..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/ExecutionPayloadHeaderDeneb.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * 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.api.schema.deneb; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.MoreObjects; -import java.util.Objects; -import java.util.Optional; -import org.apache.tuweni.bytes.Bytes; -import org.apache.tuweni.bytes.Bytes32; -import org.apache.tuweni.units.bigints.UInt256; -import tech.pegasys.teku.api.schema.capella.ExecutionPayloadHeaderCapella; -import tech.pegasys.teku.infrastructure.bytes.Bytes20; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeader; -import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeaderSchema; - -public class ExecutionPayloadHeaderDeneb extends ExecutionPayloadHeaderCapella { - - @JsonProperty("blob_gas_used") - public final UInt64 blobGasUsed; - - @JsonProperty("excess_blob_gas") - public final UInt64 excessBlobGas; - - @JsonCreator - public ExecutionPayloadHeaderDeneb( - @JsonProperty("parent_hash") final Bytes32 parentHash, - @JsonProperty("fee_recipient") final Bytes20 feeRecipient, - @JsonProperty("state_root") final Bytes32 stateRoot, - @JsonProperty("receipts_root") final Bytes32 receiptsRoot, - @JsonProperty("logs_bloom") final Bytes logsBloom, - @JsonProperty("prev_randao") final Bytes32 prevRandao, - @JsonProperty("block_number") final UInt64 blockNumber, - @JsonProperty("gas_limit") final UInt64 gasLimit, - @JsonProperty("gas_used") final UInt64 gasUsed, - @JsonProperty("timestamp") final UInt64 timestamp, - @JsonProperty("extra_data") final Bytes extraData, - @JsonProperty("base_fee_per_gas") final UInt256 baseFeePerGas, - @JsonProperty("block_hash") final Bytes32 blockHash, - @JsonProperty("transactions_root") final Bytes32 transactionsRoot, - @JsonProperty("withdrawals_root") final Bytes32 withdrawalsRoot, - @JsonProperty("blob_gas_used") final UInt64 blobGasUsed, - @JsonProperty("excess_blob_gas") final UInt64 excessBlobGas) { - super( - parentHash, - feeRecipient, - stateRoot, - receiptsRoot, - logsBloom, - prevRandao, - blockNumber, - gasLimit, - gasUsed, - timestamp, - extraData, - baseFeePerGas, - blockHash, - transactionsRoot, - withdrawalsRoot); - this.blobGasUsed = blobGasUsed; - this.excessBlobGas = excessBlobGas; - } - - public ExecutionPayloadHeaderDeneb(final ExecutionPayloadHeader executionPayloadHeader) { - super( - executionPayloadHeader.getParentHash(), - executionPayloadHeader.getFeeRecipient(), - executionPayloadHeader.getStateRoot(), - executionPayloadHeader.getReceiptsRoot(), - executionPayloadHeader.getLogsBloom(), - executionPayloadHeader.getPrevRandao(), - executionPayloadHeader.getBlockNumber(), - executionPayloadHeader.getGasLimit(), - executionPayloadHeader.getGasUsed(), - executionPayloadHeader.getTimestamp(), - executionPayloadHeader.getExtraData(), - executionPayloadHeader.getBaseFeePerGas(), - executionPayloadHeader.getBlockHash(), - executionPayloadHeader.getTransactionsRoot(), - executionPayloadHeader.getOptionalWithdrawalsRoot().orElseThrow()); - this.blobGasUsed = executionPayloadHeader.toVersionDeneb().orElseThrow().getBlobGasUsed(); - this.excessBlobGas = executionPayloadHeader.toVersionDeneb().orElseThrow().getExcessBlobGas(); - } - - @Override - public ExecutionPayloadHeader asInternalExecutionPayloadHeader( - final ExecutionPayloadHeaderSchema schema) { - return schema.createExecutionPayloadHeader( - payloadBuilder -> - payloadBuilder - .parentHash(parentHash) - .feeRecipient(feeRecipient) - .stateRoot(stateRoot) - .receiptsRoot(receiptsRoot) - .logsBloom(logsBloom) - .prevRandao(prevRandao) - .blockNumber(blockNumber) - .gasLimit(gasLimit) - .gasUsed(gasUsed) - .timestamp(timestamp) - .extraData(extraData) - .baseFeePerGas(baseFeePerGas) - .blockHash(blockHash) - .transactionsRoot(transactionsRoot) - .withdrawalsRoot(() -> withdrawalsRoot) - .blobGasUsed(() -> blobGasUsed) - .excessBlobGas(() -> excessBlobGas)); - } - - @Override - public Optional toVersionDeneb() { - return Optional.of(this); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof ExecutionPayloadHeaderDeneb)) { - return false; - } - if (!super.equals(o)) { - return false; - } - final ExecutionPayloadHeaderDeneb that = (ExecutionPayloadHeaderDeneb) o; - return Objects.equals(blobGasUsed, that.blobGasUsed) - && Objects.equals(excessBlobGas, that.excessBlobGas); - } - - @Override - public int hashCode() { - return Objects.hash(super.hashCode(), blobGasUsed, excessBlobGas); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("parentHash", parentHash) - .add("feeRecipient", feeRecipient) - .add("stateRoot", stateRoot) - .add("receiptsRoot", receiptsRoot) - .add("logsBloom", logsBloom) - .add("prevRandao", prevRandao) - .add("blockNumber", blockNumber) - .add("gasLimit", gasLimit) - .add("gasUsed", gasUsed) - .add("timestamp", timestamp) - .add("extraData", extraData) - .add("baseFeePerGas", baseFeePerGas) - .add("blockHash", blockHash) - .add("transactionsRoot", transactionsRoot) - .add("withdrawalsRoot", withdrawalsRoot) - .add("blobGasUsed", blobGasUsed) - .add("excessBlobGas", excessBlobGas) - .toString(); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/SignedBeaconBlockDeneb.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/SignedBeaconBlockDeneb.java deleted file mode 100644 index a67830d0449..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/SignedBeaconBlockDeneb.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.api.schema.deneb; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.api.schema.SignedBeaconBlock; -import tech.pegasys.teku.api.schema.interfaces.SignedBlock; - -public class SignedBeaconBlockDeneb extends SignedBeaconBlock implements SignedBlock { - private final BeaconBlockDeneb message; - - public SignedBeaconBlockDeneb( - final tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock internalBlock) { - super(internalBlock); - this.message = new BeaconBlockDeneb(internalBlock.getMessage()); - } - - @Override - public BeaconBlockDeneb getMessage() { - return message; - } - - @JsonCreator - public SignedBeaconBlockDeneb( - @JsonProperty("message") final BeaconBlockDeneb message, - @JsonProperty("signature") final BLSSignature signature) { - super(message, signature); - this.message = message; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/SignedBlindedBeaconBlockDeneb.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/SignedBlindedBeaconBlockDeneb.java deleted file mode 100644 index 3f878f97eb6..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/deneb/SignedBlindedBeaconBlockDeneb.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.api.schema.deneb; - -import static com.google.common.base.Preconditions.checkArgument; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.api.schema.SignedBeaconBlock; -import tech.pegasys.teku.api.schema.interfaces.SignedBlock; - -public class SignedBlindedBeaconBlockDeneb extends SignedBeaconBlock implements SignedBlock { - private final BlindedBlockDeneb message; - - public SignedBlindedBeaconBlockDeneb( - final tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock internalBlock) { - super(internalBlock); - checkArgument( - internalBlock.getMessage().getBody().isBlinded(), "requires a signed blinded beacon block"); - this.message = new BlindedBlockDeneb(internalBlock.getMessage()); - } - - @Override - public BlindedBlockDeneb getMessage() { - return message; - } - - @JsonCreator - public SignedBlindedBeaconBlockDeneb( - @JsonProperty("message") final BlindedBlockDeneb message, - @JsonProperty("signature") final BLSSignature signature) { - super(message, signature); - this.message = message; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/BeaconBlockBodyElectra.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/BeaconBlockBodyElectra.java deleted file mode 100644 index 6bede7180d3..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/BeaconBlockBodyElectra.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * 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.api.schema.electra; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.Attestation; -import tech.pegasys.teku.api.schema.AttesterSlashing; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.api.schema.Deposit; -import tech.pegasys.teku.api.schema.Eth1Data; -import tech.pegasys.teku.api.schema.KZGCommitment; -import tech.pegasys.teku.api.schema.ProposerSlashing; -import tech.pegasys.teku.api.schema.SignedVoluntaryExit; -import tech.pegasys.teku.api.schema.altair.BeaconBlockBodyAltair; -import tech.pegasys.teku.api.schema.altair.SyncAggregate; -import tech.pegasys.teku.api.schema.capella.SignedBlsToExecutionChange; -import tech.pegasys.teku.api.schema.deneb.ExecutionPayloadDeneb; -import tech.pegasys.teku.infrastructure.async.SafeFuture; -import tech.pegasys.teku.infrastructure.ssz.schema.SszListSchema; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.electra.BeaconBlockBodySchemaElectra; -import tech.pegasys.teku.spec.datastructures.type.SszKZGCommitment; -import tech.pegasys.teku.spec.schemas.SchemaDefinitionsElectra; - -public class BeaconBlockBodyElectra extends BeaconBlockBodyAltair { - - @JsonProperty("execution_payload") - public final ExecutionPayloadDeneb executionPayload; - - @JsonProperty("bls_to_execution_changes") - public final List blsToExecutionChanges; - - @JsonProperty("blob_kzg_commitments") - public final List blobKZGCommitments; - - @JsonProperty("execution_requests") - public final ExecutionRequests executionRequests; - - @JsonCreator - public BeaconBlockBodyElectra( - @JsonProperty("randao_reveal") final BLSSignature randaoReveal, - @JsonProperty("eth1_data") final Eth1Data eth1Data, - @JsonProperty("graffiti") final Bytes32 graffiti, - @JsonProperty("proposer_slashings") final List proposerSlashings, - @JsonProperty("attester_slashings") final List attesterSlashings, - @JsonProperty("attestations") final List attestations, - @JsonProperty("deposits") final List deposits, - @JsonProperty("voluntary_exits") final List voluntaryExits, - @JsonProperty("sync_aggregate") final SyncAggregate syncAggregate, - @JsonProperty("execution_payload") final ExecutionPayloadDeneb executionPayload, - @JsonProperty("bls_to_execution_changes") - final List blsToExecutionChanges, - @JsonProperty("blob_kzg_commitments") final List blobKZGCommitments, - @JsonProperty("execution_requests") final ExecutionRequests executionRequests) { - super( - randaoReveal, - eth1Data, - graffiti, - proposerSlashings, - attesterSlashings, - attestations, - deposits, - voluntaryExits, - syncAggregate); - checkNotNull(executionPayload, "ExecutionPayload is required for Electra blocks"); - this.executionPayload = executionPayload; - checkNotNull(blsToExecutionChanges, "BlsToExecutionChanges is required for Electra blocks"); - this.blsToExecutionChanges = blsToExecutionChanges; - checkNotNull(blobKZGCommitments, "BlobKZGCommitments is required for Electra blocks"); - this.blobKZGCommitments = blobKZGCommitments; - checkNotNull(executionRequests, "ExecutionRequests is required for Electra blocks"); - this.executionRequests = executionRequests; - } - - public BeaconBlockBodyElectra( - final tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.electra - .BeaconBlockBodyElectra - message) { - super(message); - checkNotNull(message.getExecutionPayload(), "ExecutionPayload is required for Electra blocks"); - this.executionPayload = new ExecutionPayloadDeneb(message.getExecutionPayload()); - checkNotNull( - message.getBlsToExecutionChanges(), "BlsToExecutionChanges is required for Electra blocks"); - this.blsToExecutionChanges = - message.getBlsToExecutionChanges().stream().map(SignedBlsToExecutionChange::new).toList(); - checkNotNull( - message.getBlobKzgCommitments(), "BlobKzgCommitments is required for Electra blocks"); - this.blobKZGCommitments = - message.getBlobKzgCommitments().stream() - .map(SszKZGCommitment::getKZGCommitment) - .map(KZGCommitment::new) - .toList(); - checkNotNull( - message.getExecutionRequests(), "ExecutionRequests is required for Electra blocks"); - this.executionRequests = new ExecutionRequests(message.getExecutionRequests()); - } - - @Override - public BeaconBlockBodySchemaElectra getBeaconBlockBodySchema(final SpecVersion spec) { - return (BeaconBlockBodySchemaElectra) spec.getSchemaDefinitions().getBeaconBlockBodySchema(); - } - - @Override - public BeaconBlockBody asInternalBeaconBlockBody(final SpecVersion spec) { - final SszListSchema< - tech.pegasys.teku.spec.datastructures.operations.SignedBlsToExecutionChange, ?> - blsToExecutionChangesSchema = - getBeaconBlockBodySchema(spec).getBlsToExecutionChangesSchema(); - final SszListSchema blobKZGCommitmentsSchema = - getBeaconBlockBodySchema(spec).getBlobKzgCommitmentsSchema(); - return super.asInternalBeaconBlockBody( - spec, - builder -> { - builder.executionPayload(executionPayload.asInternalExecutionPayload(spec)); - builder.blsToExecutionChanges( - this.blsToExecutionChanges.stream() - .map(b -> b.asInternalSignedBlsToExecutionChange(spec)) - .collect(blsToExecutionChangesSchema.collector())); - builder.blobKzgCommitments( - this.blobKZGCommitments.stream() - .map(KZGCommitment::asInternalKZGCommitment) - .map(SszKZGCommitment::new) - .collect(blobKZGCommitmentsSchema.collector())); - builder.executionRequests( - this.executionRequests.asInternalConsolidationRequest( - SchemaDefinitionsElectra.required(spec.getSchemaDefinitions()) - .getExecutionRequestsSchema())); - - return SafeFuture.COMPLETE; - }); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/BeaconBlockElectra.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/BeaconBlockElectra.java deleted file mode 100644 index 0bafbe1f335..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/BeaconBlockElectra.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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.api.schema.electra; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.altair.BeaconBlockAltair; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock; -import tech.pegasys.teku.spec.schemas.SchemaDefinitionsElectra; - -public class BeaconBlockElectra extends BeaconBlockAltair { - - public BeaconBlockElectra(final BeaconBlock message) { - super( - message.getSlot(), - message.getProposerIndex(), - message.getParentRoot(), - message.getStateRoot(), - new BeaconBlockBodyElectra(message.getBody().toVersionElectra().orElseThrow())); - } - - @Override - public BeaconBlock asInternalBeaconBlock(final Spec spec) { - final SpecVersion specVersion = spec.atSlot(slot); - return SchemaDefinitionsElectra.required(specVersion.getSchemaDefinitions()) - .getBeaconBlockSchema() - .create( - slot, - proposer_index, - parent_root, - state_root, - body.asInternalBeaconBlockBody(specVersion)); - } - - @JsonProperty("body") - @Override - public BeaconBlockBodyElectra getBody() { - return (BeaconBlockBodyElectra) body; - } - - @JsonCreator - public BeaconBlockElectra( - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("proposer_index") final UInt64 proposerIndex, - @JsonProperty("parent_root") final Bytes32 parentRoot, - @JsonProperty("state_root") final Bytes32 stateRoot, - @JsonProperty("body") final BeaconBlockBodyElectra body) { - super(slot, proposerIndex, parentRoot, stateRoot, body); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/BeaconStateElectra.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/BeaconStateElectra.java deleted file mode 100644 index ba7049a0a93..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/BeaconStateElectra.java +++ /dev/null @@ -1,282 +0,0 @@ -/* - * 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.api.schema.electra; - -import static tech.pegasys.teku.api.schema.SchemaConstants.EXAMPLE_UINT64; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.List; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.BeaconBlockHeader; -import tech.pegasys.teku.api.schema.Checkpoint; -import tech.pegasys.teku.api.schema.Eth1Data; -import tech.pegasys.teku.api.schema.Fork; -import tech.pegasys.teku.api.schema.Validator; -import tech.pegasys.teku.api.schema.altair.BeaconStateAltair; -import tech.pegasys.teku.api.schema.altair.SyncCommittee; -import tech.pegasys.teku.api.schema.capella.HistoricalSummary; -import tech.pegasys.teku.api.schema.deneb.ExecutionPayloadHeaderDeneb; -import tech.pegasys.teku.infrastructure.ssz.collections.SszBitvector; -import tech.pegasys.teku.infrastructure.ssz.schema.SszListSchema; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.ExecutionPayloadHeaderSchemaDeneb; -import tech.pegasys.teku.spec.datastructures.state.SyncCommittee.SyncCommitteeSchema; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.MutableBeaconState; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.electra.BeaconStateSchemaElectra; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.electra.MutableBeaconStateElectra; - -public class BeaconStateElectra extends BeaconStateAltair { - - @JsonProperty("latest_execution_payload_header") - public final ExecutionPayloadHeaderDeneb latestExecutionPayloadHeader; - - @JsonProperty("next_withdrawal_index") - @Schema(type = "string", example = EXAMPLE_UINT64) - public final UInt64 nextWithdrawalIndex; - - @JsonProperty("next_withdrawal_validator_index") - @Schema(type = "string", example = EXAMPLE_UINT64) - public final UInt64 nextWithdrawalValidatorIndex; - - @JsonProperty("historical_summaries") - public final List historicalSummaries; - - @JsonProperty("deposit_requests_start_index") - public final UInt64 depositRequestsStartIndex; - - @JsonProperty("deposit_balance_to_consume") - public final UInt64 depositBalanceToConsume; - - @JsonProperty("exit_balance_to_consume") - public final UInt64 exitBalanceToConsume; - - @JsonProperty("earliest_exit_epoch") - public final UInt64 earliestExitEpoch; - - @JsonProperty("consolidation_balance_to_consume") - public final UInt64 consolidationBalanceToConsume; - - @JsonProperty("earliest_consolidation_epoch") - public final UInt64 earliestConsolidationEpoch; - - @JsonProperty("pending_deposits") - public final List pendingDeposits; - - @JsonProperty("pending_partial_withdrawals") - public final List pendingPartialWithdrawals; - - @JsonProperty("pending_consolidations") - public final List pendingConsolidations; - - public BeaconStateElectra( - @JsonProperty("genesis_time") final UInt64 genesisTime, - @JsonProperty("genesis_validators_root") final Bytes32 genesisValidatorsRoot, - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("fork") final Fork fork, - @JsonProperty("latest_block_header") final BeaconBlockHeader latestBlockHeader, - @JsonProperty("block_roots") final List blockRoots, - @JsonProperty("state_roots") final List stateRoots, - @JsonProperty("historical_roots") final List historicalRoots, - @JsonProperty("eth1_data") final Eth1Data eth1Data, - @JsonProperty("eth1_data_votes") final List eth1DataVotes, - @JsonProperty("eth1_deposit_index") final UInt64 eth1DepositIndex, - @JsonProperty("validators") final List validators, - @JsonProperty("balances") final List balances, - @JsonProperty("randao_mixes") final List randaoMixes, - @JsonProperty("slashings") final List slashings, - @JsonProperty("previous_epoch_participation") final byte[] previousEpochParticipation, - @JsonProperty("current_epoch_participation") final byte[] currentEpochParticipation, - @JsonProperty("justification_bits") final SszBitvector justificationBits, - @JsonProperty("previous_justified_checkpoint") final Checkpoint previousJustifiedCheckpoint, - @JsonProperty("current_justified_checkpoint") final Checkpoint currentJustifiedCheckpoint, - @JsonProperty("finalized_checkpoint") final Checkpoint finalizedCheckpoint, - @JsonProperty("inactivity_scores") final List inactivityScores, - @JsonProperty("current_sync_committee") final SyncCommittee currentSyncCommittee, - @JsonProperty("next_sync_committee") final SyncCommittee nextSyncCommittee, - @JsonProperty("latest_execution_payload_header") - final ExecutionPayloadHeaderDeneb latestExecutionPayloadHeader, - @JsonProperty("next_withdrawal_index") final UInt64 nextWithdrawalIndex, - @JsonProperty("next_withdrawal_validator_index") final UInt64 nextWithdrawalValidatorIndex, - @JsonProperty("historical_summaries") final List historicalSummaries, - @JsonProperty("deposit_requests_start_index") final UInt64 depositRequestsStartIndex, - @JsonProperty("deposit_balance_to_consume") final UInt64 depositBalanceToConsume, - @JsonProperty("exit_balance_to_consume") final UInt64 exitBalanceToConsume, - @JsonProperty("earliest_exit_epoch") final UInt64 earliestExitEpoch, - @JsonProperty("consolidation_balance_to_consume") final UInt64 consolidationBalanceToConsume, - @JsonProperty("earliest_consolidation_epoch") final UInt64 earliestConsolidationEpoch, - @JsonProperty("pending_deposits") final List pendingDeposits, - @JsonProperty("pending_partial_withdrawals") - final List pendingPartialWithdrawals, - @JsonProperty("pending_consolidations") - final List pendingConsolidations) { - super( - genesisTime, - genesisValidatorsRoot, - slot, - fork, - latestBlockHeader, - blockRoots, - stateRoots, - historicalRoots, - eth1Data, - eth1DataVotes, - eth1DepositIndex, - validators, - balances, - randaoMixes, - slashings, - previousEpochParticipation, - currentEpochParticipation, - justificationBits, - previousJustifiedCheckpoint, - currentJustifiedCheckpoint, - finalizedCheckpoint, - inactivityScores, - currentSyncCommittee, - nextSyncCommittee); - this.latestExecutionPayloadHeader = latestExecutionPayloadHeader; - this.nextWithdrawalIndex = nextWithdrawalIndex; - this.nextWithdrawalValidatorIndex = nextWithdrawalValidatorIndex; - this.historicalSummaries = historicalSummaries; - this.depositRequestsStartIndex = depositRequestsStartIndex; - this.depositBalanceToConsume = depositBalanceToConsume; - this.exitBalanceToConsume = exitBalanceToConsume; - this.earliestExitEpoch = earliestExitEpoch; - this.consolidationBalanceToConsume = consolidationBalanceToConsume; - this.earliestConsolidationEpoch = earliestConsolidationEpoch; - this.pendingDeposits = pendingDeposits; - this.pendingPartialWithdrawals = pendingPartialWithdrawals; - this.pendingConsolidations = pendingConsolidations; - } - - public BeaconStateElectra(final BeaconState beaconState) { - super(beaconState); - final tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.electra - .BeaconStateElectra - electra = beaconState.toVersionElectra().orElseThrow(); - - this.latestExecutionPayloadHeader = - new ExecutionPayloadHeaderDeneb(electra.getLatestExecutionPayloadHeader()); - this.nextWithdrawalIndex = electra.getNextWithdrawalIndex(); - this.nextWithdrawalValidatorIndex = electra.getNextWithdrawalValidatorIndex(); - this.historicalSummaries = - electra.getHistoricalSummaries().stream().map(HistoricalSummary::new).toList(); - this.depositRequestsStartIndex = electra.getDepositRequestsStartIndex(); - this.depositBalanceToConsume = electra.getDepositBalanceToConsume(); - this.exitBalanceToConsume = electra.getExitBalanceToConsume(); - this.earliestExitEpoch = electra.getEarliestExitEpoch(); - this.consolidationBalanceToConsume = electra.getConsolidationBalanceToConsume(); - this.earliestConsolidationEpoch = electra.getEarliestConsolidationEpoch(); - this.pendingDeposits = electra.getPendingDeposits().stream().map(PendingDeposit::new).toList(); - this.pendingPartialWithdrawals = - electra.getPendingPartialWithdrawals().stream().map(PendingPartialWithdrawal::new).toList(); - this.pendingConsolidations = - electra.getPendingConsolidations().stream().map(PendingConsolidation::new).toList(); - } - - @Override - protected void applyAdditionalFields( - final MutableBeaconState state, final SpecVersion specVersion) { - state - .toMutableVersionElectra() - .ifPresent( - mutableBeaconStateElectra -> - applyElectraFields( - specVersion, - mutableBeaconStateElectra, - BeaconStateSchemaElectra.required( - mutableBeaconStateElectra.getBeaconStateSchema()) - .getCurrentSyncCommitteeSchema(), - BeaconStateSchemaElectra.required( - mutableBeaconStateElectra.getBeaconStateSchema()) - .getLastExecutionPayloadHeaderSchema(), - BeaconStateSchemaElectra.required( - mutableBeaconStateElectra.getBeaconStateSchema()) - .getHistoricalSummariesSchema(), - BeaconStateSchemaElectra.required( - mutableBeaconStateElectra.getBeaconStateSchema()) - .getPendingDepositsSchema(), - BeaconStateSchemaElectra.required( - mutableBeaconStateElectra.getBeaconStateSchema()) - .getPendingPartialWithdrawalsSchema(), - BeaconStateSchemaElectra.required( - mutableBeaconStateElectra.getBeaconStateSchema()) - .getPendingConsolidationsSchema(), - this)); - } - - protected static void applyElectraFields( - final SpecVersion specVersion, - final MutableBeaconStateElectra state, - final SyncCommitteeSchema syncCommitteeSchema, - final ExecutionPayloadHeaderSchemaDeneb executionPayloadHeaderSchema, - final SszListSchema< - tech.pegasys.teku.spec.datastructures.state.versions.capella.HistoricalSummary, ?> - historicalSummariesSchema, - final SszListSchema< - tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingDeposit, ?> - pendingDepositsSchema, - final SszListSchema< - tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingPartialWithdrawal, - ?> - pendingPartialWithdrawalsSchema, - final SszListSchema< - tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingConsolidation, ?> - pendingConsolidationsSchema, - final BeaconStateElectra instance) { - - BeaconStateAltair.applyAltairFields(state, syncCommitteeSchema, instance); - - state.setLatestExecutionPayloadHeader( - instance.latestExecutionPayloadHeader.asInternalExecutionPayloadHeader( - executionPayloadHeaderSchema)); - - state.setNextWithdrawalIndex(instance.nextWithdrawalIndex); - state.setNextWithdrawalValidatorIndex(instance.nextWithdrawalValidatorIndex); - state.setHistoricalSummaries( - historicalSummariesSchema.createFromElements( - instance.historicalSummaries.stream() - .map( - historicalSummary -> historicalSummary.asInternalHistoricalSummary(specVersion)) - .toList())); - state.setDepositRequestsStartIndex(instance.depositRequestsStartIndex); - state.setDepositBalanceToConsume(instance.depositBalanceToConsume); - state.setExitBalanceToConsume(instance.exitBalanceToConsume); - state.setEarliestExitEpoch(instance.earliestExitEpoch); - state.setConsolidationBalanceToConsume(instance.consolidationBalanceToConsume); - state.setEarliestConsolidationEpoch(instance.earliestConsolidationEpoch); - state.setPendingDeposits( - pendingDepositsSchema.createFromElements( - instance.pendingDeposits.stream() - .map(pendingDeposit -> pendingDeposit.asInternalPendingDeposit(specVersion)) - .toList())); - state.setPendingPartialWithdrawals( - pendingPartialWithdrawalsSchema.createFromElements( - instance.pendingPartialWithdrawals.stream() - .map( - pendingPartialWithdrawal -> - pendingPartialWithdrawal.asInternalPendingPartialWithdrawal(specVersion)) - .toList())); - state.setPendingConsolidations( - pendingConsolidationsSchema.createFromElements( - instance.pendingConsolidations.stream() - .map( - pendingConsolidation -> - pendingConsolidation.asInternalPendingConsolidation(specVersion)) - .toList())); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/BlindedBeaconBlockBodyElectra.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/BlindedBeaconBlockBodyElectra.java deleted file mode 100644 index 7fee68848eb..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/BlindedBeaconBlockBodyElectra.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * 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.api.schema.electra; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.Attestation; -import tech.pegasys.teku.api.schema.AttesterSlashing; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.api.schema.Deposit; -import tech.pegasys.teku.api.schema.Eth1Data; -import tech.pegasys.teku.api.schema.KZGCommitment; -import tech.pegasys.teku.api.schema.ProposerSlashing; -import tech.pegasys.teku.api.schema.SignedVoluntaryExit; -import tech.pegasys.teku.api.schema.altair.BeaconBlockBodyAltair; -import tech.pegasys.teku.api.schema.altair.SyncAggregate; -import tech.pegasys.teku.api.schema.capella.SignedBlsToExecutionChange; -import tech.pegasys.teku.api.schema.deneb.ExecutionPayloadHeaderDeneb; -import tech.pegasys.teku.infrastructure.async.SafeFuture; -import tech.pegasys.teku.infrastructure.ssz.schema.SszListSchema; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.BeaconBlockBody; -import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.electra.BlindedBeaconBlockBodySchemaElectra; -import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeaderSchema; -import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionRequestsSchema; -import tech.pegasys.teku.spec.datastructures.type.SszKZGCommitment; - -public class BlindedBeaconBlockBodyElectra extends BeaconBlockBodyAltair { - - @JsonProperty("execution_payload_header") - public final ExecutionPayloadHeaderDeneb executionPayloadHeader; - - @JsonProperty("bls_to_execution_changes") - public final List blsToExecutionChanges; - - @JsonProperty("blob_kzg_commitments") - public final List blobKZGCommitments; - - @JsonProperty("execution_requests") - public final ExecutionRequests executionRequests; - - @JsonCreator - public BlindedBeaconBlockBodyElectra( - @JsonProperty("randao_reveal") final BLSSignature randaoReveal, - @JsonProperty("eth1_data") final Eth1Data eth1Data, - @JsonProperty("graffiti") final Bytes32 graffiti, - @JsonProperty("proposer_slashings") final List proposerSlashings, - @JsonProperty("attester_slashings") final List attesterSlashings, - @JsonProperty("attestations") final List attestations, - @JsonProperty("deposits") final List deposits, - @JsonProperty("voluntary_exits") final List voluntaryExits, - @JsonProperty("sync_aggregate") final SyncAggregate syncAggregate, - @JsonProperty("execution_payload_header") - final ExecutionPayloadHeaderDeneb executionPayloadHeader, - @JsonProperty("bls_to_execution_changes") - final List blsToExecutionChanges, - @JsonProperty("blob_kzg_commitments") final List blobKZGCommitments, - @JsonProperty("execution_requests") final ExecutionRequests executionRequests) { - super( - randaoReveal, - eth1Data, - graffiti, - proposerSlashings, - attesterSlashings, - attestations, - deposits, - voluntaryExits, - syncAggregate); - checkNotNull( - executionPayloadHeader, "ExecutionPayloadHeader is required for Electra blinded blocks"); - this.executionPayloadHeader = executionPayloadHeader; - checkNotNull( - blsToExecutionChanges, "BlsToExecutionChanges is required for Electra blinded blocks"); - this.blsToExecutionChanges = blsToExecutionChanges; - checkNotNull(blobKZGCommitments, "BlobKZGCommitments is required for Electra blinded blocks"); - this.blobKZGCommitments = blobKZGCommitments; - checkNotNull(executionRequests, "ExecutionRequests is required for Electra blinded blocks"); - this.executionRequests = executionRequests; - } - - public BlindedBeaconBlockBodyElectra( - final tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.electra - .BlindedBeaconBlockBodyElectra - blockBody) { - super(blockBody); - this.executionPayloadHeader = - new ExecutionPayloadHeaderDeneb(blockBody.getExecutionPayloadHeader()); - this.blsToExecutionChanges = - blockBody.getBlsToExecutionChanges().stream().map(SignedBlsToExecutionChange::new).toList(); - this.blobKZGCommitments = - blockBody.getBlobKzgCommitments().stream() - .map(SszKZGCommitment::getKZGCommitment) - .map(KZGCommitment::new) - .toList(); - this.executionRequests = new ExecutionRequests(blockBody.getExecutionRequests()); - } - - @Override - public BlindedBeaconBlockBodySchemaElectra getBeaconBlockBodySchema(final SpecVersion spec) { - return (BlindedBeaconBlockBodySchemaElectra) - spec.getSchemaDefinitions().getBlindedBeaconBlockBodySchema(); - } - - @Override - public boolean isBlinded() { - return true; - } - - @Override - public BeaconBlockBody asInternalBeaconBlockBody(final SpecVersion spec) { - - final ExecutionPayloadHeaderSchema executionPayloadHeaderSchema = - getBeaconBlockBodySchema(spec).getExecutionPayloadHeaderSchema(); - - final SszListSchema< - tech.pegasys.teku.spec.datastructures.operations.SignedBlsToExecutionChange, ?> - blsToExecutionChangesSchema = getBeaconBlockBodySchema(spec).getBlsToExecutionChanges(); - - final SszListSchema blobKZGCommitmentsSchema = - getBeaconBlockBodySchema(spec).getBlobKzgCommitmentsSchema(); - - final ExecutionRequestsSchema executionRequestsSchema = - getBeaconBlockBodySchema(spec).getExecutionRequestsSchema(); - - return super.asInternalBeaconBlockBody( - spec, - builder -> { - builder.executionPayloadHeader( - executionPayloadHeader.asInternalExecutionPayloadHeader( - executionPayloadHeaderSchema)); - builder.blsToExecutionChanges( - this.blsToExecutionChanges.stream() - .map(b -> b.asInternalSignedBlsToExecutionChange(spec)) - .collect(blsToExecutionChangesSchema.collector())); - builder.blobKzgCommitments( - this.blobKZGCommitments.stream() - .map(KZGCommitment::asInternalKZGCommitment) - .map(SszKZGCommitment::new) - .collect(blobKZGCommitmentsSchema.collector())); - builder.executionRequests( - this.executionRequests.asInternalConsolidationRequest(executionRequestsSchema)); - return SafeFuture.COMPLETE; - }); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/BlindedBlockElectra.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/BlindedBlockElectra.java deleted file mode 100644 index 143e440e9b5..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/BlindedBlockElectra.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.api.schema.electra; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.altair.BeaconBlockAltair; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock; -import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockSchema; - -public class BlindedBlockElectra extends BeaconBlockAltair { - - public BlindedBlockElectra(final BeaconBlock message) { - super( - message.getSlot(), - message.getProposerIndex(), - message.getParentRoot(), - message.getStateRoot(), - new BlindedBeaconBlockBodyElectra( - message.getBody().toBlindedVersionElectra().orElseThrow())); - } - - @Override - public BeaconBlockSchema getBeaconBlockSchema(final SpecVersion spec) { - return spec.getSchemaDefinitions().getBlindedBeaconBlockSchema(); - } - - @Override - public BeaconBlock asInternalBeaconBlock(final Spec spec) { - final SpecVersion specVersion = spec.atSlot(slot); - return getBeaconBlockSchema(specVersion) - .create( - slot, - proposer_index, - parent_root, - state_root, - body.asInternalBeaconBlockBody(specVersion)); - } - - @JsonProperty("body") - @Override - public BlindedBeaconBlockBodyElectra getBody() { - return (BlindedBeaconBlockBodyElectra) body; - } - - @JsonCreator - public BlindedBlockElectra( - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("proposer_index") final UInt64 proposerIndex, - @JsonProperty("parent_root") final Bytes32 parentRoot, - @JsonProperty("state_root") final Bytes32 stateRoot, - @JsonProperty("body") final BlindedBeaconBlockBodyElectra body) { - super(slot, proposerIndex, parentRoot, stateRoot, body); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/ConsolidationRequest.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/ConsolidationRequest.java deleted file mode 100644 index a4629e18146..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/ConsolidationRequest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.api.schema.electra; - -import com.fasterxml.jackson.annotation.JsonProperty; -import tech.pegasys.teku.bls.BLSPublicKey; -import tech.pegasys.teku.ethereum.execution.types.Eth1Address; -import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ConsolidationRequestSchema; - -public class ConsolidationRequest { - - @JsonProperty("source_address") - private final Eth1Address sourceAddress; - - @JsonProperty("source_pubkey") - private final BLSPublicKey sourcePubkey; - - @JsonProperty("target_pubkey") - private final BLSPublicKey targetPubkey; - - public ConsolidationRequest( - @JsonProperty("source_address") final Eth1Address sourceAddress, - @JsonProperty("source_pubkey") final BLSPublicKey sourcePubkey, - @JsonProperty("target_pubkey") final BLSPublicKey targetPubkey) { - this.sourceAddress = sourceAddress; - this.sourcePubkey = sourcePubkey; - this.targetPubkey = targetPubkey; - } - - public ConsolidationRequest( - final tech.pegasys.teku.spec.datastructures.execution.versions.electra.ConsolidationRequest - consolidationRequest) { - this.sourceAddress = - Eth1Address.fromBytes(consolidationRequest.getSourceAddress().getWrappedBytes()); - this.sourcePubkey = consolidationRequest.getSourcePubkey(); - this.targetPubkey = consolidationRequest.getTargetPubkey(); - } - - public final tech.pegasys.teku.spec.datastructures.execution.versions.electra.ConsolidationRequest - asInternalConsolidationRequest(final ConsolidationRequestSchema schema) { - return schema.create(sourceAddress, sourcePubkey, targetPubkey); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/DepositRequest.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/DepositRequest.java deleted file mode 100644 index 5d343529ad3..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/DepositRequest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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.api.schema.electra; - -import com.fasterxml.jackson.annotation.JsonProperty; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.BLSPubKey; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequestSchema; - -public class DepositRequest { - - @JsonProperty("pubkey") - private final BLSPubKey pubkey; - - @JsonProperty("withdrawal_credentials") - private final Bytes32 withdrawalCredentials; - - @JsonProperty("amount") - private final UInt64 amount; - - @JsonProperty("signature") - private final BLSSignature signature; - - @JsonProperty("index") - private final UInt64 index; - - public DepositRequest( - @JsonProperty("pubkey") final BLSPubKey pubkey, - @JsonProperty("withdrawal_credentials") final Bytes32 withdrawalCredentials, - @JsonProperty("amount") final UInt64 amount, - @JsonProperty("signature") final BLSSignature signature, - @JsonProperty("index") final UInt64 index) { - this.pubkey = pubkey; - this.withdrawalCredentials = withdrawalCredentials; - this.amount = amount; - this.signature = signature; - this.index = index; - } - - public DepositRequest( - final tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequest - depositRequest) { - this.pubkey = new BLSPubKey(depositRequest.getPubkey()); - this.withdrawalCredentials = depositRequest.getWithdrawalCredentials(); - this.amount = depositRequest.getAmount(); - this.signature = new BLSSignature(depositRequest.getSignature()); - this.index = depositRequest.getIndex(); - } - - public tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequest - asInternalDepositRequest(final DepositRequestSchema schema) { - return schema.create( - pubkey.asBLSPublicKey(), - withdrawalCredentials, - amount, - signature.asInternalBLSSignature(), - index); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/ExecutionRequests.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/ExecutionRequests.java deleted file mode 100644 index 2243a5fb3a5..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/ExecutionRequests.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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.api.schema.electra; - -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ConsolidationRequestSchema; -import tech.pegasys.teku.spec.datastructures.execution.versions.electra.DepositRequestSchema; -import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionRequestsSchema; -import tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequestSchema; - -public class ExecutionRequests { - - @JsonProperty("deposits") - private final List deposits; - - @JsonProperty("withdrawals") - private final List withdrawals; - - @JsonProperty("consolidations") - private final List consolidations; - - public ExecutionRequests( - @JsonProperty("deposits") final List deposits, - @JsonProperty("withdrawals") final List withdrawals, - @JsonProperty("consolidations") final List consolidations) { - this.deposits = deposits; - this.withdrawals = withdrawals; - this.consolidations = consolidations; - } - - public ExecutionRequests( - final tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionRequests - executionRequests) { - this.deposits = executionRequests.getDeposits().stream().map(DepositRequest::new).toList(); - this.withdrawals = - executionRequests.getWithdrawals().stream().map(WithdrawalRequest::new).toList(); - this.consolidations = - executionRequests.getConsolidations().stream().map(ConsolidationRequest::new).toList(); - } - - public final tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionRequests - asInternalConsolidationRequest(final ExecutionRequestsSchema schema) { - - final DepositRequestSchema depositSchema = - (DepositRequestSchema) schema.getDepositRequestsSchema().getElementSchema(); - final WithdrawalRequestSchema withdrawalSchema = - (WithdrawalRequestSchema) schema.getWithdrawalRequestsSchema().getElementSchema(); - final ConsolidationRequestSchema consolidationSchema = - (ConsolidationRequestSchema) schema.getConsolidationRequestsSchema().getElementSchema(); - - final List - depositsInternal = - deposits.stream() - .map(depositRequest -> depositRequest.asInternalDepositRequest(depositSchema)) - .toList(); - final List - withdrawalsInternal = - withdrawals.stream() - .map( - withdrawalRequest -> - withdrawalRequest.asInternalWithdrawalRequest(withdrawalSchema)) - .toList(); - final List< - tech.pegasys.teku.spec.datastructures.execution.versions.electra.ConsolidationRequest> - consolidationsInternal = - consolidations.stream() - .map( - consolidationRequest -> - consolidationRequest.asInternalConsolidationRequest(consolidationSchema)) - .toList(); - return schema.create(depositsInternal, withdrawalsInternal, consolidationsInternal); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/PendingConsolidation.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/PendingConsolidation.java deleted file mode 100644 index 24802b84ca8..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/PendingConsolidation.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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.api.schema.electra; - -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.Optional; -import tech.pegasys.teku.infrastructure.ssz.primitive.SszUInt64; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.schemas.SchemaDefinitionsElectra; - -public class PendingConsolidation { - @JsonProperty("source_index") - public final int sourceIndex; - - @JsonProperty("target_index") - public final int targetIndex; - - PendingConsolidation( - final @JsonProperty("source_index") int sourceIndex, - final @JsonProperty("target_index") int targetIndex) { - this.sourceIndex = sourceIndex; - this.targetIndex = targetIndex; - } - - public PendingConsolidation( - final tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingConsolidation - internalPendingConsolidation) { - this.sourceIndex = internalPendingConsolidation.getSourceIndex(); - this.targetIndex = internalPendingConsolidation.getTargetIndex(); - } - - public tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingConsolidation - asInternalPendingConsolidation(final SpecVersion spec) { - final Optional schemaDefinitionsElectra = - spec.getSchemaDefinitions().toVersionElectra(); - if (schemaDefinitionsElectra.isEmpty()) { - throw new IllegalArgumentException( - "Could not create PendingConsolidation for pre-electra spec"); - } - return schemaDefinitionsElectra - .get() - .getPendingConsolidationSchema() - .create( - SszUInt64.of(UInt64.valueOf(this.sourceIndex)), - SszUInt64.of(UInt64.valueOf(this.targetIndex))); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/PendingDeposit.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/PendingDeposit.java deleted file mode 100644 index 5a271ab6a4c..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/PendingDeposit.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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.api.schema.electra; - -import static tech.pegasys.teku.api.schema.SchemaConstants.DESCRIPTION_BYTES96; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import java.util.Optional; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.bls.BLSPublicKey; -import tech.pegasys.teku.infrastructure.ssz.primitive.SszBytes32; -import tech.pegasys.teku.infrastructure.ssz.primitive.SszUInt64; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.type.SszPublicKey; -import tech.pegasys.teku.spec.datastructures.type.SszSignature; -import tech.pegasys.teku.spec.schemas.SchemaDefinitionsElectra; - -public class PendingDeposit { - - @JsonProperty("pubkey") - private final BLSPublicKey publicKey; - - @JsonProperty("withdrawal_credentials") - private final Bytes32 withdrawalCredentials; - - @JsonProperty("amount") - public final UInt64 amount; - - @Schema(type = "string", format = "byte", description = DESCRIPTION_BYTES96) - public final BLSSignature signature; - - @JsonProperty("slot") - public final UInt64 slot; - - public PendingDeposit( - final @JsonProperty("pubkey") BLSPublicKey publicKey, - final @JsonProperty("withdrawal_credentials") Bytes32 withdrawalCredentials, - final @JsonProperty("amount") UInt64 amount, - final @JsonProperty("signature") BLSSignature signature, - final @JsonProperty("slot") UInt64 slot) { - this.publicKey = publicKey; - this.withdrawalCredentials = withdrawalCredentials; - this.amount = amount; - this.signature = signature; - this.slot = slot; - } - - public PendingDeposit( - final tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingDeposit - internalPendingDeposit) { - this.publicKey = internalPendingDeposit.getPublicKey(); - this.withdrawalCredentials = internalPendingDeposit.getWithdrawalCredentials(); - this.amount = internalPendingDeposit.getAmount(); - this.signature = new BLSSignature(internalPendingDeposit.getSignature()); - this.slot = internalPendingDeposit.getSlot(); - } - - public tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingDeposit - asInternalPendingDeposit(final SpecVersion spec) { - final Optional schemaDefinitionsElectra = - spec.getSchemaDefinitions().toVersionElectra(); - if (schemaDefinitionsElectra.isEmpty()) { - throw new IllegalArgumentException("Could not create PendingDeposit for pre-electra spec"); - } - return schemaDefinitionsElectra - .get() - .getPendingDepositSchema() - .create( - new SszPublicKey(publicKey), - SszBytes32.of(withdrawalCredentials), - SszUInt64.of(amount), - new SszSignature(signature.asInternalBLSSignature()), - SszUInt64.of(slot)); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/PendingPartialWithdrawal.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/PendingPartialWithdrawal.java deleted file mode 100644 index 23d854f8c20..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/PendingPartialWithdrawal.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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.api.schema.electra; - -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.Optional; -import tech.pegasys.teku.infrastructure.ssz.primitive.SszUInt64; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.schemas.SchemaDefinitionsElectra; - -public class PendingPartialWithdrawal { - @JsonProperty("validator_index") - public final int validatorIndex; - - @JsonProperty("amount") - public final UInt64 amount; - - @JsonProperty("withdrawable_epoch") - public final UInt64 withdrawableEpoch; - - public PendingPartialWithdrawal( - final @JsonProperty("validator_index") int validatorIndex, - final @JsonProperty("amount") UInt64 amount, - final @JsonProperty("withdrawable_epoch") UInt64 withdrawableEpoch) { - this.validatorIndex = validatorIndex; - this.amount = amount; - this.withdrawableEpoch = withdrawableEpoch; - } - - public PendingPartialWithdrawal( - final tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingPartialWithdrawal - pendingPartialWithdrawal) { - this.validatorIndex = pendingPartialWithdrawal.getValidatorIndex(); - this.amount = pendingPartialWithdrawal.getAmount(); - this.withdrawableEpoch = pendingPartialWithdrawal.getWithdrawableEpoch(); - } - - public tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingPartialWithdrawal - asInternalPendingPartialWithdrawal(final SpecVersion spec) { - final Optional schemaDefinitionsElectra = - spec.getSchemaDefinitions().toVersionElectra(); - if (schemaDefinitionsElectra.isEmpty()) { - throw new IllegalArgumentException( - "Could not create PendingPartialWithdrawal for pre-electra spec"); - } - return schemaDefinitionsElectra - .get() - .getPendingPartialWithdrawalSchema() - .create( - SszUInt64.of(UInt64.valueOf(this.validatorIndex)), - SszUInt64.of(this.amount), - SszUInt64.of(this.withdrawableEpoch)); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/SignedBeaconBlockElectra.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/SignedBeaconBlockElectra.java deleted file mode 100644 index 9743dd2ad3e..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/SignedBeaconBlockElectra.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.api.schema.electra; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.api.schema.SignedBeaconBlock; -import tech.pegasys.teku.api.schema.interfaces.SignedBlock; - -public class SignedBeaconBlockElectra extends SignedBeaconBlock implements SignedBlock { - private final BeaconBlockElectra message; - - public SignedBeaconBlockElectra( - final tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock internalBlock) { - super(internalBlock); - this.message = new BeaconBlockElectra(internalBlock.getMessage()); - } - - @Override - public BeaconBlockElectra getMessage() { - return message; - } - - @JsonCreator - public SignedBeaconBlockElectra( - @JsonProperty("message") final BeaconBlockElectra message, - @JsonProperty("signature") final BLSSignature signature) { - super(message, signature); - this.message = message; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/SignedBlindedBeaconBlockElectra.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/SignedBlindedBeaconBlockElectra.java deleted file mode 100644 index 4272f8cf647..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/SignedBlindedBeaconBlockElectra.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.api.schema.electra; - -import static com.google.common.base.Preconditions.checkArgument; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.api.schema.SignedBeaconBlock; -import tech.pegasys.teku.api.schema.interfaces.SignedBlock; - -public class SignedBlindedBeaconBlockElectra extends SignedBeaconBlock implements SignedBlock { - private final BlindedBlockElectra message; - - public SignedBlindedBeaconBlockElectra( - final tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock internalBlock) { - super(internalBlock); - checkArgument( - internalBlock.getMessage().getBody().isBlinded(), "requires a signed blinded beacon block"); - this.message = new BlindedBlockElectra(internalBlock.getMessage()); - } - - @Override - public BlindedBlockElectra getMessage() { - return message; - } - - @JsonCreator - public SignedBlindedBeaconBlockElectra( - @JsonProperty("message") final BlindedBlockElectra message, - @JsonProperty("signature") final BLSSignature signature) { - super(message, signature); - this.message = message; - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/WithdrawalRequest.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/WithdrawalRequest.java deleted file mode 100644 index 9de11573e21..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/electra/WithdrawalRequest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.api.schema.electra; - -import com.fasterxml.jackson.annotation.JsonProperty; -import tech.pegasys.teku.bls.BLSPublicKey; -import tech.pegasys.teku.ethereum.execution.types.Eth1Address; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequestSchema; - -public class WithdrawalRequest { - - @JsonProperty("source_address") - private final Eth1Address sourceAddress; - - @JsonProperty("validator_pubkey") - private final BLSPublicKey validatorPubkey; - - @JsonProperty("amount") - private final UInt64 amount; - - public WithdrawalRequest( - @JsonProperty("source_address") final Eth1Address sourceAddress, - @JsonProperty("validator_pubkey") final BLSPublicKey validatorPubkey, - @JsonProperty("amount") final UInt64 amount) { - this.sourceAddress = sourceAddress; - this.validatorPubkey = validatorPubkey; - this.amount = amount; - } - - public WithdrawalRequest( - final tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequest - withdrawalRequest) { - this.sourceAddress = - Eth1Address.fromBytes(withdrawalRequest.getSourceAddress().getWrappedBytes()); - this.validatorPubkey = withdrawalRequest.getValidatorPubkey(); - this.amount = withdrawalRequest.getAmount(); - } - - public final tech.pegasys.teku.spec.datastructures.execution.versions.electra.WithdrawalRequest - asInternalWithdrawalRequest(final WithdrawalRequestSchema schema) { - return schema.create(sourceAddress, validatorPubkey, amount); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/interfaces/SignedBlock.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/interfaces/SignedBlock.java deleted file mode 100644 index 13745dcc691..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/interfaces/SignedBlock.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.api.schema.interfaces; - -import io.swagger.v3.oas.annotations.media.Schema; -import tech.pegasys.teku.api.schema.altair.SignedBeaconBlockAltair; -import tech.pegasys.teku.api.schema.bellatrix.SignedBeaconBlockBellatrix; -import tech.pegasys.teku.api.schema.capella.SignedBeaconBlockCapella; -import tech.pegasys.teku.api.schema.deneb.SignedBeaconBlockDeneb; -import tech.pegasys.teku.api.schema.electra.SignedBeaconBlockElectra; -import tech.pegasys.teku.api.schema.phase0.SignedBeaconBlockPhase0; - -@Schema( - oneOf = { - SignedBeaconBlockPhase0.class, - SignedBeaconBlockAltair.class, - SignedBeaconBlockBellatrix.class, - SignedBeaconBlockCapella.class, - SignedBeaconBlockDeneb.class, - SignedBeaconBlockElectra.class - }) -public interface SignedBlock {} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/interfaces/State.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/interfaces/State.java deleted file mode 100644 index cea644824b9..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/interfaces/State.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.api.schema.interfaces; - -import io.swagger.v3.oas.annotations.media.Schema; -import tech.pegasys.teku.api.schema.altair.BeaconStateAltair; -import tech.pegasys.teku.api.schema.bellatrix.BeaconStateBellatrix; -import tech.pegasys.teku.api.schema.capella.BeaconStateCapella; -import tech.pegasys.teku.api.schema.deneb.BeaconStateDeneb; -import tech.pegasys.teku.api.schema.electra.BeaconStateElectra; -import tech.pegasys.teku.api.schema.phase0.BeaconStatePhase0; - -@Schema( - oneOf = { - BeaconStatePhase0.class, - BeaconStateAltair.class, - BeaconStateBellatrix.class, - BeaconStateCapella.class, - BeaconStateDeneb.class, - BeaconStateElectra.class - }) -public interface State {} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/interfaces/UnsignedBlindedBlock.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/interfaces/UnsignedBlindedBlock.java deleted file mode 100644 index a14a5ba03d2..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/interfaces/UnsignedBlindedBlock.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.api.schema.interfaces; - -import io.swagger.v3.oas.annotations.media.Schema; -import tech.pegasys.teku.api.schema.altair.BeaconBlockAltair; -import tech.pegasys.teku.api.schema.bellatrix.BlindedBlockBellatrix; -import tech.pegasys.teku.api.schema.capella.BlindedBlockCapella; -import tech.pegasys.teku.api.schema.deneb.BlindedBlockDeneb; -import tech.pegasys.teku.api.schema.electra.BlindedBlockElectra; -import tech.pegasys.teku.api.schema.phase0.BeaconBlockPhase0; - -@Schema( - oneOf = { - BeaconBlockPhase0.class, - BeaconBlockAltair.class, - BlindedBlockBellatrix.class, - BlindedBlockCapella.class, - BlindedBlockDeneb.class, - BlindedBlockElectra.class - }) -public interface UnsignedBlindedBlock {} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/interfaces/UnsignedBlock.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/interfaces/UnsignedBlock.java deleted file mode 100644 index ddd59680af1..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/interfaces/UnsignedBlock.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.api.schema.interfaces; - -import io.swagger.v3.oas.annotations.media.Schema; -import tech.pegasys.teku.api.schema.altair.BeaconBlockAltair; -import tech.pegasys.teku.api.schema.bellatrix.BeaconBlockBellatrix; -import tech.pegasys.teku.api.schema.capella.BeaconBlockCapella; -import tech.pegasys.teku.api.schema.deneb.BeaconBlockDeneb; -import tech.pegasys.teku.api.schema.electra.BeaconBlockElectra; -import tech.pegasys.teku.api.schema.phase0.BeaconBlockPhase0; - -@Schema( - oneOf = { - BeaconBlockPhase0.class, - BeaconBlockAltair.class, - BeaconBlockBellatrix.class, - BeaconBlockCapella.class, - BeaconBlockDeneb.class, - BeaconBlockElectra.class - }) -public interface UnsignedBlock {} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/package-info.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/package-info.java deleted file mode 100644 index 7a0ca0f4fc3..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/package-info.java +++ /dev/null @@ -1,5 +0,0 @@ -/** - * @deprecated As of release 2024.09.00, api.schema is not maintained any longer. - */ -@Deprecated -package tech.pegasys.teku.api.schema; diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/phase0/BeaconBlockPhase0.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/phase0/BeaconBlockPhase0.java deleted file mode 100644 index 86b62a4f6cc..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/phase0/BeaconBlockPhase0.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.api.schema.phase0; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.BeaconBlock; -import tech.pegasys.teku.api.schema.BeaconBlockBody; -import tech.pegasys.teku.api.schema.interfaces.UnsignedBlock; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; - -@SuppressWarnings("JavaCase") -public class BeaconBlockPhase0 extends BeaconBlock implements UnsignedBlock { - public BeaconBlockPhase0(final tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock message) { - super( - message.getSlot(), - message.getProposerIndex(), - message.getParentRoot(), - message.getStateRoot(), - new BeaconBlockBody(message.getBody())); - } - - @JsonCreator - public BeaconBlockPhase0( - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("proposer_index") final UInt64 proposer_index, - @JsonProperty("parent_root") final Bytes32 parent_root, - @JsonProperty("state_root") final Bytes32 state_root, - @JsonProperty("body") final BeaconBlockBody body) { - super(slot, proposer_index, parent_root, state_root, body); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/phase0/BeaconStatePhase0.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/phase0/BeaconStatePhase0.java deleted file mode 100644 index 2f8abbc1eb4..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/phase0/BeaconStatePhase0.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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.api.schema.phase0; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.api.schema.BeaconBlockHeader; -import tech.pegasys.teku.api.schema.BeaconState; -import tech.pegasys.teku.api.schema.Checkpoint; -import tech.pegasys.teku.api.schema.Eth1Data; -import tech.pegasys.teku.api.schema.Fork; -import tech.pegasys.teku.api.schema.PendingAttestation; -import tech.pegasys.teku.api.schema.Validator; -import tech.pegasys.teku.api.schema.interfaces.State; -import tech.pegasys.teku.infrastructure.ssz.collections.SszBitvector; -import tech.pegasys.teku.infrastructure.unsigned.UInt64; -import tech.pegasys.teku.spec.SpecVersion; -import tech.pegasys.teku.spec.datastructures.state.PendingAttestation.PendingAttestationSchema; -import tech.pegasys.teku.spec.datastructures.state.beaconstate.MutableBeaconState; - -@SuppressWarnings("JavaCase") -public class BeaconStatePhase0 extends BeaconState implements State { - public final List previous_epoch_attestations; - public final List current_epoch_attestations; - - @JsonCreator - public BeaconStatePhase0( - @JsonProperty("genesis_time") final UInt64 genesis_time, - @JsonProperty("genesis_validators_root") final Bytes32 genesis_validators_root, - @JsonProperty("slot") final UInt64 slot, - @JsonProperty("fork") final Fork fork, - @JsonProperty("latest_block_header") final BeaconBlockHeader latest_block_header, - @JsonProperty("block_roots") final List block_roots, - @JsonProperty("state_roots") final List state_roots, - @JsonProperty("historical_roots") final List historical_roots, - @JsonProperty("eth1_data") final Eth1Data eth1_data, - @JsonProperty("eth1_data_votes") final List eth1_data_votes, - @JsonProperty("eth1_deposit_index") final UInt64 eth1_deposit_index, - @JsonProperty("validators") final List validators, - @JsonProperty("balances") final List balances, - @JsonProperty("randao_mixes") final List randao_mixes, - @JsonProperty("slashings") final List slashings, - @JsonProperty("previous_epoch_attestations") - final List previous_epoch_attestations, - @JsonProperty("current_epoch_attestations") - final List current_epoch_attestations, - @JsonProperty("justification_bits") final SszBitvector justification_bits, - @JsonProperty("previous_justified_checkpoint") final Checkpoint previous_justified_checkpoint, - @JsonProperty("current_justified_checkpoint") final Checkpoint current_justified_checkpoint, - @JsonProperty("finalized_checkpoint") final Checkpoint finalized_checkpoint) { - super( - genesis_time, - genesis_validators_root, - slot, - fork, - latest_block_header, - block_roots, - state_roots, - historical_roots, - eth1_data, - eth1_data_votes, - eth1_deposit_index, - validators, - balances, - randao_mixes, - slashings, - justification_bits, - previous_justified_checkpoint, - current_justified_checkpoint, - finalized_checkpoint); - this.previous_epoch_attestations = previous_epoch_attestations; - this.current_epoch_attestations = current_epoch_attestations; - } - - public BeaconStatePhase0( - final tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState beaconState) { - super(beaconState); - // Optionally set phase0-specific versioned fields - final Optional< - tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.phase0 - .BeaconStatePhase0> - maybePhase0State = beaconState.toVersionPhase0(); - if (maybePhase0State.isPresent()) { - final tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.phase0 - .BeaconStatePhase0 - genesisState = maybePhase0State.get(); - this.previous_epoch_attestations = - genesisState.getPreviousEpochAttestations().stream() - .map(PendingAttestation::new) - .toList(); - this.current_epoch_attestations = - genesisState.getCurrentEpochAttestations().stream().map(PendingAttestation::new).toList(); - } else { - this.previous_epoch_attestations = null; - this.current_epoch_attestations = null; - } - } - - @Override - protected void applyAdditionalFields( - final MutableBeaconState state, final SpecVersion specVersion) { - state - .toMutableVersionPhase0() - .ifPresent( - mutableState -> { - final PendingAttestationSchema pendingAttestationSchema = - mutableState.getBeaconStateSchema().getPendingAttestationSchema(); - mutableState - .getPreviousEpochAttestations() - .setAll( - previous_epoch_attestations.stream() - .map( - pendingAttestation -> - pendingAttestation.asInternalPendingAttestation( - pendingAttestationSchema)) - .toList()); - mutableState - .getCurrentEpochAttestations() - .setAll( - current_epoch_attestations.stream() - .map( - pendingAttestation -> - pendingAttestation.asInternalPendingAttestation( - pendingAttestationSchema)) - .toList()); - }); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final BeaconStatePhase0 that = (BeaconStatePhase0) o; - return Objects.equals(previous_epoch_attestations, that.previous_epoch_attestations) - && Objects.equals(current_epoch_attestations, that.current_epoch_attestations); - } - - @Override - public int hashCode() { - return Objects.hash(previous_epoch_attestations, current_epoch_attestations); - } -} diff --git a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/phase0/SignedBeaconBlockPhase0.java b/data/serializer/src/main/java/tech/pegasys/teku/api/schema/phase0/SignedBeaconBlockPhase0.java deleted file mode 100644 index 465fc39dddb..00000000000 --- a/data/serializer/src/main/java/tech/pegasys/teku/api/schema/phase0/SignedBeaconBlockPhase0.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.api.schema.phase0; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import tech.pegasys.teku.api.schema.BLSSignature; -import tech.pegasys.teku.api.schema.BeaconBlock; -import tech.pegasys.teku.api.schema.SignedBeaconBlock; -import tech.pegasys.teku.api.schema.interfaces.SignedBlock; - -public class SignedBeaconBlockPhase0 extends SignedBeaconBlock implements SignedBlock { - - public SignedBeaconBlockPhase0( - final tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock internalBlock) { - super(internalBlock); - } - - @JsonCreator - public SignedBeaconBlockPhase0( - @JsonProperty("message") final BeaconBlock message, - @JsonProperty("signature") final BLSSignature signature) { - super(message, signature); - } -} diff --git a/data/serializer/src/test/java/tech/pegasys/teku/api/response/v1/EventTypeTest.java b/data/serializer/src/test/java/tech/pegasys/teku/api/response/EventTypeTest.java similarity index 93% rename from data/serializer/src/test/java/tech/pegasys/teku/api/response/v1/EventTypeTest.java rename to data/serializer/src/test/java/tech/pegasys/teku/api/response/EventTypeTest.java index 29aa4a6d9d9..ba05692a36a 100644 --- a/data/serializer/src/test/java/tech/pegasys/teku/api/response/v1/EventTypeTest.java +++ b/data/serializer/src/test/java/tech/pegasys/teku/api/response/EventTypeTest.java @@ -11,14 +11,13 @@ * specific language governing permissions and limitations under the License. */ -package tech.pegasys.teku.api.response.v1; +package tech.pegasys.teku.api.response; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; import java.util.List; import org.junit.jupiter.api.Test; -import tech.pegasys.teku.api.response.EventType; public class EventTypeTest { @Test diff --git a/data/serializer/src/test/java/tech/pegasys/teku/api/response/v1/beacon/ValidatorResponseTest.java b/data/serializer/src/test/java/tech/pegasys/teku/api/response/ValidatorStatusUtilTest.java similarity index 82% rename from data/serializer/src/test/java/tech/pegasys/teku/api/response/v1/beacon/ValidatorResponseTest.java rename to data/serializer/src/test/java/tech/pegasys/teku/api/response/ValidatorStatusUtilTest.java index 541bad62315..3918bd35a1d 100644 --- a/data/serializer/src/test/java/tech/pegasys/teku/api/response/v1/beacon/ValidatorResponseTest.java +++ b/data/serializer/src/test/java/tech/pegasys/teku/api/response/ValidatorStatusUtilTest.java @@ -11,7 +11,7 @@ * specific language governing permissions and limitations under the License. */ -package tech.pegasys.teku.api.response.v1.beacon; +package tech.pegasys.teku.api.response; import static org.assertj.core.api.Assertions.assertThat; import static tech.pegasys.teku.infrastructure.unsigned.UInt64.ONE; @@ -21,14 +21,13 @@ import org.apache.tuweni.bytes.Bytes32; import org.apache.tuweni.bytes.Bytes48; import org.junit.jupiter.api.Test; -import tech.pegasys.teku.api.response.ValidatorStatus; import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.spec.Spec; import tech.pegasys.teku.spec.TestSpecFactory; import tech.pegasys.teku.spec.datastructures.state.Validator; import tech.pegasys.teku.spec.util.DataStructureUtil; -public class ValidatorResponseTest { +public class ValidatorStatusUtilTest { private static final UInt64 ONE_HUNDRED = UInt64.valueOf(100); private static final UInt64 TWO_HUNDRED = UInt64.valueOf(200); private final Spec spec = TestSpecFactory.createMinimalPhase0(); @@ -39,45 +38,45 @@ public class ValidatorResponseTest { @Test void status_shouldBePendingInitialised() { final Validator validator = pendingValidator(TWO_HUNDRED, FAR_FUTURE_EPOCH); - assertThat(ValidatorResponse.getValidatorStatus(ONE_HUNDRED, validator, FAR_FUTURE_EPOCH)) + assertThat(ValidatorStatusUtil.getValidatorStatus(ONE_HUNDRED, validator, FAR_FUTURE_EPOCH)) .isEqualTo(ValidatorStatus.pending_initialized); } @Test void status_shouldBePendingQueued() { final Validator validator = pendingValidator(TWO_HUNDRED, TWO_HUNDRED); - assertThat(ValidatorResponse.getValidatorStatus(ONE_HUNDRED, validator, FAR_FUTURE_EPOCH)) + assertThat(ValidatorStatusUtil.getValidatorStatus(ONE_HUNDRED, validator, FAR_FUTURE_EPOCH)) .isEqualTo(ValidatorStatus.pending_queued); } @Test void status_shouldBeActiveOngoing() { final Validator validator = activeValidator(FAR_FUTURE_EPOCH, false); - assertThat(ValidatorResponse.getValidatorStatus(ZERO, validator, FAR_FUTURE_EPOCH)) + assertThat(ValidatorStatusUtil.getValidatorStatus(ZERO, validator, FAR_FUTURE_EPOCH)) .isEqualTo(ValidatorStatus.active_ongoing); } @Test void status_shouldBeActiveExiting() { final Validator validator = activeValidator(TWO_HUNDRED, false); - assertThat(ValidatorResponse.getValidatorStatus(ONE_HUNDRED, validator, FAR_FUTURE_EPOCH)) + assertThat(ValidatorStatusUtil.getValidatorStatus(ONE_HUNDRED, validator, FAR_FUTURE_EPOCH)) .isEqualTo(ValidatorStatus.active_exiting); } @Test void status_shouldBeActiveSlashed() { final Validator validator = activeValidator(TWO_HUNDRED, true); - assertThat(ValidatorResponse.getValidatorStatus(ONE_HUNDRED, validator, FAR_FUTURE_EPOCH)) + assertThat(ValidatorStatusUtil.getValidatorStatus(ONE_HUNDRED, validator, FAR_FUTURE_EPOCH)) .isEqualTo(ValidatorStatus.active_slashed); } @Test void status_shouldBeExitedUnslashed() { final Validator validator = exitedValidator(ONE_HUNDRED, TWO_HUNDRED, false); - assertThat(ValidatorResponse.getValidatorStatus(ONE_HUNDRED, validator, FAR_FUTURE_EPOCH)) + assertThat(ValidatorStatusUtil.getValidatorStatus(ONE_HUNDRED, validator, FAR_FUTURE_EPOCH)) .isEqualTo(ValidatorStatus.exited_unslashed); assertThat( - ValidatorResponse.getValidatorStatus( + ValidatorStatusUtil.getValidatorStatus( ONE_HUNDRED.plus(ONE), validator, FAR_FUTURE_EPOCH)) .isEqualTo(ValidatorStatus.exited_unslashed); } @@ -85,21 +84,21 @@ void status_shouldBeExitedUnslashed() { @Test void status_shouldBeExitedSlashed() { final Validator validator = exitedValidator(ONE_HUNDRED, TWO_HUNDRED, true); - assertThat(ValidatorResponse.getValidatorStatus(ONE_HUNDRED, validator, FAR_FUTURE_EPOCH)) + assertThat(ValidatorStatusUtil.getValidatorStatus(ONE_HUNDRED, validator, FAR_FUTURE_EPOCH)) .isEqualTo(ValidatorStatus.exited_slashed); } @Test void status_shouldBeWithdrawalPossible() { final Validator validator = withdrawalValidator(UInt64.valueOf("32000000000"), ONE_HUNDRED); - assertThat(ValidatorResponse.getValidatorStatus(ONE_HUNDRED, validator, FAR_FUTURE_EPOCH)) + assertThat(ValidatorStatusUtil.getValidatorStatus(ONE_HUNDRED, validator, FAR_FUTURE_EPOCH)) .isEqualTo(ValidatorStatus.withdrawal_possible); } @Test void status_shouldBeWithdrawalDone() { final Validator validator = withdrawalValidator(ZERO, ONE_HUNDRED); - assertThat(ValidatorResponse.getValidatorStatus(ONE_HUNDRED, validator, FAR_FUTURE_EPOCH)) + assertThat(ValidatorStatusUtil.getValidatorStatus(ONE_HUNDRED, validator, FAR_FUTURE_EPOCH)) .isEqualTo(ValidatorStatus.withdrawal_done); } diff --git a/data/serializer/src/test/java/tech/pegasys/teku/api/schema/Eth1DataTest.java b/data/serializer/src/test/java/tech/pegasys/teku/api/schema/Eth1DataTest.java deleted file mode 100644 index ec2be71bce2..00000000000 --- a/data/serializer/src/test/java/tech/pegasys/teku/api/schema/Eth1DataTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.api.schema; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.junit.jupiter.api.Test; -import tech.pegasys.teku.spec.TestSpecFactory; -import tech.pegasys.teku.spec.util.DataStructureUtil; - -public class Eth1DataTest { - private final DataStructureUtil dataStructureUtil = - new DataStructureUtil(TestSpecFactory.createDefault()); - private final tech.pegasys.teku.spec.datastructures.blocks.Eth1Data eth1DataInternal = - dataStructureUtil.randomEth1Data(); - - @Test - public void shouldConvertToInternalObject() { - final Eth1Data eth1Data = new Eth1Data(eth1DataInternal); - assertThat(eth1Data.asInternalEth1Data()).isEqualTo(eth1DataInternal); - } -} diff --git a/data/serializer/src/test/java/tech/pegasys/teku/api/schema/ForkTest.java b/data/serializer/src/test/java/tech/pegasys/teku/api/schema/ForkTest.java deleted file mode 100644 index ad9da160fa4..00000000000 --- a/data/serializer/src/test/java/tech/pegasys/teku/api/schema/ForkTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.api.schema; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.junit.jupiter.api.Test; -import tech.pegasys.teku.spec.TestSpecFactory; -import tech.pegasys.teku.spec.util.DataStructureUtil; - -public class ForkTest { - private final DataStructureUtil dataStructureUtil = - new DataStructureUtil(TestSpecFactory.createDefault()); - private final tech.pegasys.teku.spec.datastructures.state.Fork forkInternal = - dataStructureUtil.randomFork(); - - @Test - public void shouldConvertToInternalObject() { - Fork fork = new Fork(forkInternal); - assertThat(fork.asInternalFork()).isEqualTo(forkInternal); - } -} diff --git a/data/serializer/src/test/java/tech/pegasys/teku/api/schema/LogLevelTest.java b/data/serializer/src/test/java/tech/pegasys/teku/api/schema/LogLevelTest.java deleted file mode 100644 index c767d4b6a73..00000000000 --- a/data/serializer/src/test/java/tech/pegasys/teku/api/schema/LogLevelTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.api.schema; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -import org.apache.logging.log4j.Level; -import org.junit.jupiter.api.Test; - -public class LogLevelTest { - - @Test - public void shouldAcceptDebugLogLevelInUpperCase() { - final LogLevel level = new LogLevel("INFO"); - - assertThat(level.getLevel()).isEqualTo(Level.INFO); - } - - @Test - public void shouldAcceptDebugLogLevelInLowerCase() { - final LogLevel level = new LogLevel("info"); - - assertThat(level.getLevel()).isEqualTo(Level.INFO); - } - - @Test - public void shouldExceptionWhenLogLevelInvalid() { - - assertThatThrownBy(() -> new LogLevel("I'm an invalid log level")) - .isInstanceOf(IllegalArgumentException.class) - .hasMessageContaining("Unknown level constant [I'M AN INVALID LOG LEVEL]."); - } -} diff --git a/data/serializer/src/test/java/tech/pegasys/teku/api/schema/PendingAttestationTest.java b/data/serializer/src/test/java/tech/pegasys/teku/api/schema/PendingAttestationTest.java deleted file mode 100644 index e913e5c0632..00000000000 --- a/data/serializer/src/test/java/tech/pegasys/teku/api/schema/PendingAttestationTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.api.schema; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.junit.jupiter.api.Test; -import tech.pegasys.teku.spec.Spec; -import tech.pegasys.teku.spec.TestSpecFactory; -import tech.pegasys.teku.spec.util.DataStructureUtil; - -public class PendingAttestationTest { - private final Spec spec = TestSpecFactory.createMinimalPhase0(); - private final DataStructureUtil dataStructureUtil = new DataStructureUtil(spec); - private final tech.pegasys.teku.spec.datastructures.state.PendingAttestation attestationInternal = - dataStructureUtil.randomPendingAttestation(); - - @Test - public void shouldConvertToInternalObject() { - final PendingAttestation pendingAttestation = new PendingAttestation(attestationInternal); - assertThat(pendingAttestation.asInternalPendingAttestation(attestationInternal.getSchema())) - .isEqualTo(attestationInternal); - } -} diff --git a/data/serializer/src/test/java/tech/pegasys/teku/api/schema/SignedBeaconBlockTest.java b/data/serializer/src/test/java/tech/pegasys/teku/api/schema/SignedBeaconBlockTest.java deleted file mode 100644 index f208821bd76..00000000000 --- a/data/serializer/src/test/java/tech/pegasys/teku/api/schema/SignedBeaconBlockTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.api.schema; - -import static tech.pegasys.teku.infrastructure.ssz.SszDataAssert.assertThatSszData; - -import org.junit.jupiter.api.TestTemplate; -import tech.pegasys.teku.spec.TestSpecContext; -import tech.pegasys.teku.spec.TestSpecInvocationContextProvider.SpecContext; - -@TestSpecContext(allMilestones = true) -class SignedBeaconBlockTest { - - @TestTemplate - public void shouldConvertSchemaToInternalCorrectly(final SpecContext ctx) { - - final tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock internalBlock = - ctx.getDataStructureUtil().randomSignedBeaconBlock(1); - final SignedBeaconBlock apiBlock = SignedBeaconBlock.create(internalBlock); - assertThatSszData(apiBlock.asInternalSignedBeaconBlock(ctx.getSpec())) - .isEqualByAllMeansTo(internalBlock); - } -} diff --git a/data/serializer/src/test/java/tech/pegasys/teku/api/schema/ValidatorTest.java b/data/serializer/src/test/java/tech/pegasys/teku/api/schema/ValidatorTest.java deleted file mode 100644 index 6e28227a0ee..00000000000 --- a/data/serializer/src/test/java/tech/pegasys/teku/api/schema/ValidatorTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.api.schema; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.junit.jupiter.api.Test; -import tech.pegasys.teku.spec.TestSpecFactory; -import tech.pegasys.teku.spec.util.DataStructureUtil; - -public class ValidatorTest { - private final DataStructureUtil dataStructureUtil = - new DataStructureUtil(TestSpecFactory.createDefault()); - private final tech.pegasys.teku.spec.datastructures.state.Validator validatorInternal = - dataStructureUtil.randomValidator(); - - @Test - public void shouldConvertToInternalObject() { - final Validator validator = new Validator(validatorInternal); - assertThat(validator.asInternalValidator()).isEqualTo(validatorInternal); - } -} diff --git a/ethereum/json-types/src/main/java/tech/pegasys/teku/ethereum/json/types/beacon/StateValidatorData.java b/ethereum/json-types/src/main/java/tech/pegasys/teku/ethereum/json/types/beacon/StateValidatorData.java index 2fabd12cdcd..0edfb1bd7cc 100644 --- a/ethereum/json-types/src/main/java/tech/pegasys/teku/ethereum/json/types/beacon/StateValidatorData.java +++ b/ethereum/json-types/src/main/java/tech/pegasys/teku/ethereum/json/types/beacon/StateValidatorData.java @@ -16,7 +16,7 @@ import java.util.Objects; import java.util.Optional; import tech.pegasys.teku.api.response.ValidatorStatus; -import tech.pegasys.teku.api.response.v1.beacon.ValidatorResponse; +import tech.pegasys.teku.api.response.ValidatorStatusUtil; import tech.pegasys.teku.bls.BLSPublicKey; import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.spec.datastructures.state.Validator; @@ -43,7 +43,7 @@ public static Optional fromState( new StateValidatorData( UInt64.valueOf(index), state.getBalances().getElement(index), - ValidatorResponse.getValidatorStatus(epoch, validatorInternal, farFutureEpoch), + ValidatorStatusUtil.getValidatorStatus(epoch, validatorInternal, farFutureEpoch), validatorInternal); return Optional.of(data); }