Skip to content

Commit

Permalink
Cleanup JsonProvider and unused serializers (Consensys#8689)
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Harris <paul.harris@consensys.net>
  • Loading branch information
rolfyone authored and tbenr committed Oct 14, 2024
1 parent 0a7ff20 commit 95e0d06
Show file tree
Hide file tree
Showing 20 changed files with 6 additions and 1,307 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,27 @@

package tech.pegasys.teku.api;

import tech.pegasys.teku.api.schema.BLSSignature;
import tech.pegasys.teku.api.schema.BeaconBlock;
import tech.pegasys.teku.api.schema.BeaconBlockBody;
import tech.pegasys.teku.api.schema.BeaconState;
import tech.pegasys.teku.api.schema.SignedBeaconBlock;
import tech.pegasys.teku.api.schema.altair.BeaconBlockAltair;
import tech.pegasys.teku.api.schema.altair.BeaconBlockBodyAltair;
import tech.pegasys.teku.api.schema.altair.BeaconStateAltair;
import tech.pegasys.teku.api.schema.bellatrix.BeaconBlockBellatrix;
import tech.pegasys.teku.api.schema.bellatrix.BeaconBlockBodyBellatrix;
import tech.pegasys.teku.api.schema.bellatrix.BeaconStateBellatrix;
import tech.pegasys.teku.api.schema.bellatrix.BlindedBeaconBlockBodyBellatrix;
import tech.pegasys.teku.api.schema.bellatrix.BlindedBlockBellatrix;
import tech.pegasys.teku.api.schema.capella.BeaconBlockBodyCapella;
import tech.pegasys.teku.api.schema.capella.BeaconBlockCapella;
import tech.pegasys.teku.api.schema.capella.BeaconStateCapella;
import tech.pegasys.teku.api.schema.capella.BlindedBeaconBlockBodyCapella;
import tech.pegasys.teku.api.schema.capella.BlindedBlockCapella;
import tech.pegasys.teku.api.schema.deneb.BeaconBlockBodyDeneb;
import tech.pegasys.teku.api.schema.deneb.BeaconBlockDeneb;
import tech.pegasys.teku.api.schema.deneb.BeaconStateDeneb;
import tech.pegasys.teku.api.schema.deneb.BlindedBeaconBlockBodyDeneb;
import tech.pegasys.teku.api.schema.deneb.BlindedBlockDeneb;
import tech.pegasys.teku.api.schema.electra.BeaconBlockBodyElectra;
import tech.pegasys.teku.api.schema.electra.BeaconBlockElectra;
import tech.pegasys.teku.api.schema.electra.BeaconStateElectra;
import tech.pegasys.teku.api.schema.electra.BlindedBeaconBlockBodyElectra;
import tech.pegasys.teku.api.schema.electra.BlindedBlockElectra;
import tech.pegasys.teku.api.schema.phase0.BeaconBlockPhase0;
import tech.pegasys.teku.api.schema.phase0.BeaconStatePhase0;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.Spec;
import tech.pegasys.teku.spec.SpecMilestone;

Expand All @@ -59,21 +49,6 @@ public SchemaObjectProvider(final Spec spec) {
this.spec = spec;
}

public SignedBeaconBlock getSignedBeaconBlock(
final tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock internalBlock) {

return new SignedBeaconBlock(
getBeaconBlock(internalBlock.getMessage()), new BLSSignature(internalBlock.getSignature()));
}

public SignedBeaconBlock getSignedBlindedBeaconBlock(
final tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock internalBlock) {

return new SignedBeaconBlock(
getBlindedBlock(internalBlock.getMessage()),
new BLSSignature(internalBlock.getSignature()));
}

public BeaconBlock getBeaconBlock(
final tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock block) {
return getBeaconBlock(block, spec.atSlot(block.getSlot()).getMilestone());
Expand Down Expand Up @@ -244,17 +219,4 @@ private BlindedBeaconBlockBodyElectra getBlindedBlockBodyElectra(
tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.electra
.BlindedBeaconBlockBodyElectra.required(body));
}

public BeaconState getBeaconState(
final tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState state) {
final UInt64 slot = state.getSlot();
return switch (spec.atSlot(slot).getMilestone()) {
case PHASE0 -> new BeaconStatePhase0(state);
case ALTAIR -> new BeaconStateAltair(state);
case BELLATRIX -> new BeaconStateBellatrix(state);
case CAPELLA -> new BeaconStateCapella(state);
case DENEB -> new BeaconStateDeneb(state);
case ELECTRA -> new BeaconStateElectra(state);
};
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* @deprecated As of release 2024.09.00, api.schema is not maintained any longer.
*/
@Deprecated
package tech.pegasys.teku.api.schema;

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 95e0d06

Please sign in to comment.