Skip to content

Commit

Permalink
move providers in dedicated package
Browse files Browse the repository at this point in the history
  • Loading branch information
tbenr committed Sep 16, 2024
1 parent 4868490 commit f1a14b8
Show file tree
Hide file tree
Showing 24 changed files with 100 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,28 @@
import java.util.List;
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.config.SpecConfig;
import tech.pegasys.teku.spec.schemas.providers.AggregateAndProofSchemaProvider;
import tech.pegasys.teku.spec.schemas.providers.AttestationSchemaProvider;
import tech.pegasys.teku.spec.schemas.providers.AttesterShlashingSchemaProvider;
import tech.pegasys.teku.spec.schemas.providers.AttnetsENRFieldSchemaProvider;
import tech.pegasys.teku.spec.schemas.providers.BeaconBlockBodySchemaProvider;
import tech.pegasys.teku.spec.schemas.providers.BeaconBlockSchemaProvider;
import tech.pegasys.teku.spec.schemas.providers.BeaconBlocksByRootRequestMessageSchemaProvider;
import tech.pegasys.teku.spec.schemas.providers.BeaconStateSchemaProvider;
import tech.pegasys.teku.spec.schemas.providers.BlindedBeaconBlockBodySchemaProvider;
import tech.pegasys.teku.spec.schemas.providers.BlindedBeaconBlockSchemaProvider;
import tech.pegasys.teku.spec.schemas.providers.BlobKzgCommitmentsSchemaProvider;
import tech.pegasys.teku.spec.schemas.providers.BlsToExecutionChangeSchemaProvider;
import tech.pegasys.teku.spec.schemas.providers.ExecutionPayloadHeaderSchemaProvider;
import tech.pegasys.teku.spec.schemas.providers.ExecutionPayloadSchemaProvider;
import tech.pegasys.teku.spec.schemas.providers.HistoricalBatchSchemaProvider;
import tech.pegasys.teku.spec.schemas.providers.IndexedAttestationSchemaProvider;
import tech.pegasys.teku.spec.schemas.providers.MetadataMessageSchemaProvider;
import tech.pegasys.teku.spec.schemas.providers.SignedAggregateAndProofSchemaProvider;
import tech.pegasys.teku.spec.schemas.providers.SignedBeaconBlockSchemaProvider;
import tech.pegasys.teku.spec.schemas.providers.SignedBlindedBeaconBlockSchemaProvider;
import tech.pegasys.teku.spec.schemas.providers.SignedBlsToExecutionChangeSchemaProvider;
import tech.pegasys.teku.spec.schemas.providers.SyncnetsENRFieldSchemaProvider;

public class SchemaRegistryBuilder {
private final List<SchemaProvider<?>> providers = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.teku.spec.schemas;
package tech.pegasys.teku.spec.schemas.providers;

import static tech.pegasys.teku.spec.schemas.SchemaTypes.AGGREGATE_AND_PROOF_SCHEMA;
import static tech.pegasys.teku.spec.schemas.SchemaTypes.ATTESTATION_SCHEMA;
Expand All @@ -20,6 +20,8 @@
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.config.SpecConfig;
import tech.pegasys.teku.spec.datastructures.operations.AggregateAndProof.AggregateAndProofSchema;
import tech.pegasys.teku.spec.schemas.AbstractSchemaProvider;
import tech.pegasys.teku.spec.schemas.SchemaRegistry;

public class AggregateAndProofSchemaProvider
extends AbstractSchemaProvider<AggregateAndProofSchema> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.teku.spec.schemas;
package tech.pegasys.teku.spec.schemas.providers;

import static tech.pegasys.teku.spec.SpecMilestone.DENEB;
import static tech.pegasys.teku.spec.SpecMilestone.PHASE0;
Expand All @@ -24,6 +24,8 @@
import tech.pegasys.teku.spec.datastructures.operations.AttestationSchema;
import tech.pegasys.teku.spec.datastructures.operations.versions.electra.AttestationElectraSchema;
import tech.pegasys.teku.spec.datastructures.operations.versions.phase0.AttestationPhase0Schema;
import tech.pegasys.teku.spec.schemas.AbstractSchemaProvider;
import tech.pegasys.teku.spec.schemas.SchemaRegistry;

public class AttestationSchemaProvider
extends AbstractSchemaProvider<AttestationSchema<Attestation>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.teku.spec.schemas;
package tech.pegasys.teku.spec.schemas.providers;

import static tech.pegasys.teku.spec.SpecMilestone.DENEB;
import static tech.pegasys.teku.spec.SpecMilestone.PHASE0;
Expand All @@ -24,6 +24,9 @@
import tech.pegasys.teku.spec.datastructures.operations.AttesterSlashingSchema;
import tech.pegasys.teku.spec.datastructures.operations.versions.electra.AttesterSlashingElectraSchema;
import tech.pegasys.teku.spec.datastructures.operations.versions.phase0.AttesterSlashingPhase0Schema;
import tech.pegasys.teku.spec.schemas.AbstractSchemaProvider;
import tech.pegasys.teku.spec.schemas.SchemaRegistry;
import tech.pegasys.teku.spec.schemas.SchemaTypes;

public class AttesterShlashingSchemaProvider
extends AbstractSchemaProvider<AttesterSlashingSchema<AttesterSlashing>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.teku.spec.schemas;
package tech.pegasys.teku.spec.schemas.providers;

import static tech.pegasys.teku.spec.SpecMilestone.PHASE0;
import static tech.pegasys.teku.spec.schemas.SchemaTypes.ATTNETS_ENR_FIELD_SCHEMA;
Expand All @@ -21,10 +21,12 @@
import tech.pegasys.teku.infrastructure.ssz.schema.collections.SszBitvectorSchema;
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.config.SpecConfig;
import tech.pegasys.teku.spec.schemas.AbstractSchemaProvider;
import tech.pegasys.teku.spec.schemas.SchemaRegistry;

public class AttnetsENRFieldSchemaProvider
extends AbstractSchemaProvider<SszBitvectorSchema<SszBitvector>> {
AttnetsENRFieldSchemaProvider() {
public AttnetsENRFieldSchemaProvider() {
super(ATTNETS_ENR_FIELD_SCHEMA);
addMilestoneMapping(PHASE0, SpecMilestone.getHighestMilestone());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.teku.spec.schemas;
package tech.pegasys.teku.spec.schemas.providers;

import static tech.pegasys.teku.spec.schemas.SchemaTypes.BEACON_BLOCK_BODY_SCHEMA;

Expand All @@ -30,6 +30,8 @@
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.deneb.BeaconBlockBodySchemaDenebImpl;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.electra.BeaconBlockBodySchemaElectraImpl;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.phase0.BeaconBlockBodySchemaPhase0;
import tech.pegasys.teku.spec.schemas.AbstractSchemaProvider;
import tech.pegasys.teku.spec.schemas.SchemaRegistry;

public class BeaconBlockBodySchemaProvider
extends AbstractSchemaProvider<BeaconBlockBodySchema<? extends BeaconBlockBody>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.teku.spec.schemas;
package tech.pegasys.teku.spec.schemas.providers;

import static tech.pegasys.teku.spec.schemas.SchemaTypes.BEACON_BLOCK_BODY_SCHEMA;

import java.util.Set;
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.config.SpecConfig;
import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockSchema;
import tech.pegasys.teku.spec.schemas.AbstractSchemaProvider;
import tech.pegasys.teku.spec.schemas.SchemaRegistry;
import tech.pegasys.teku.spec.schemas.SchemaTypes;

public class BeaconBlockSchemaProvider extends AbstractSchemaProvider<BeaconBlockSchema> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.teku.spec.schemas;
package tech.pegasys.teku.spec.schemas.providers;

import static tech.pegasys.teku.spec.SpecMilestone.PHASE0;
import static tech.pegasys.teku.spec.schemas.SchemaTypes.BEACON_BLOCKS_BY_ROOT_REQUEST_MESSAGE_SCHEMA;
Expand All @@ -20,10 +20,12 @@
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.config.SpecConfig;
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.BeaconBlocksByRootRequestMessage.BeaconBlocksByRootRequestMessageSchema;
import tech.pegasys.teku.spec.schemas.AbstractSchemaProvider;
import tech.pegasys.teku.spec.schemas.SchemaRegistry;

public class BeaconBlocksByRootRequestMessageSchemaProvider
extends AbstractSchemaProvider<BeaconBlocksByRootRequestMessageSchema> {
BeaconBlocksByRootRequestMessageSchemaProvider() {
public BeaconBlocksByRootRequestMessageSchemaProvider() {
super(BEACON_BLOCKS_BY_ROOT_REQUEST_MESSAGE_SCHEMA);
addMilestoneMapping(PHASE0, SpecMilestone.getHighestMilestone());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.teku.spec.schemas;
package tech.pegasys.teku.spec.schemas.providers;

import java.util.Set;
import tech.pegasys.teku.spec.SpecMilestone;
Expand All @@ -25,6 +25,9 @@
import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.deneb.BeaconStateSchemaDeneb;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.electra.BeaconStateSchemaElectra;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.phase0.BeaconStateSchemaPhase0;
import tech.pegasys.teku.spec.schemas.AbstractSchemaProvider;
import tech.pegasys.teku.spec.schemas.SchemaRegistry;
import tech.pegasys.teku.spec.schemas.SchemaTypes;

public class BeaconStateSchemaProvider
extends AbstractSchemaProvider<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.teku.spec.schemas;
package tech.pegasys.teku.spec.schemas.providers;

import static tech.pegasys.teku.spec.SpecMilestone.BELLATRIX;
import static tech.pegasys.teku.spec.SpecMilestone.CAPELLA;
import static tech.pegasys.teku.spec.SpecMilestone.DENEB;
import static tech.pegasys.teku.spec.SpecMilestone.ELECTRA;
import static tech.pegasys.teku.spec.schemas.SchemaTypes.BLINDED_BEACON_BLOCK_BODY_SCHEMA;

import java.util.Set;
Expand All @@ -31,6 +27,8 @@
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.capella.BlindedBeaconBlockBodySchemaCapellaImpl;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.deneb.BlindedBeaconBlockBodySchemaDenebImpl;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.electra.BlindedBeaconBlockBodySchemaElectraImpl;
import tech.pegasys.teku.spec.schemas.AbstractSchemaProvider;
import tech.pegasys.teku.spec.schemas.SchemaRegistry;

public class BlindedBeaconBlockBodySchemaProvider
extends AbstractSchemaProvider<BlindedBeaconBlockBodySchemaBellatrix<?>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.teku.spec.schemas;
package tech.pegasys.teku.spec.schemas.providers;

import static tech.pegasys.teku.spec.schemas.SchemaTypes.BLINDED_BEACON_BLOCK_BODY_SCHEMA;
import static tech.pegasys.teku.spec.schemas.SchemaTypes.BLINDED_BEACON_BLOCK_SCHEMA;
Expand All @@ -20,6 +20,8 @@
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.config.SpecConfig;
import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockSchema;
import tech.pegasys.teku.spec.schemas.AbstractSchemaProvider;
import tech.pegasys.teku.spec.schemas.SchemaRegistry;

public class BlindedBeaconBlockSchemaProvider extends AbstractSchemaProvider<BeaconBlockSchema> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.teku.spec.schemas;
package tech.pegasys.teku.spec.schemas.providers;

import static tech.pegasys.teku.spec.schemas.SchemaTypes.BLOB_KZG_COMMITMENTS_SCHEMA;

Expand All @@ -20,6 +20,8 @@
import tech.pegasys.teku.spec.config.SpecConfig;
import tech.pegasys.teku.spec.config.SpecConfigDeneb;
import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobKzgCommitmentsSchema;
import tech.pegasys.teku.spec.schemas.AbstractSchemaProvider;
import tech.pegasys.teku.spec.schemas.SchemaRegistry;

public class BlobKzgCommitmentsSchemaProvider
extends AbstractSchemaProvider<BlobKzgCommitmentsSchema> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.teku.spec.schemas;
package tech.pegasys.teku.spec.schemas.providers;

import static tech.pegasys.teku.spec.SpecMilestone.CAPELLA;
import static tech.pegasys.teku.spec.schemas.SchemaTypes.BLS_TO_EXECUTION_CHANGE_SCHEMA;
Expand All @@ -20,6 +20,8 @@
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.config.SpecConfig;
import tech.pegasys.teku.spec.datastructures.operations.BlsToExecutionChangeSchema;
import tech.pegasys.teku.spec.schemas.AbstractSchemaProvider;
import tech.pegasys.teku.spec.schemas.SchemaRegistry;

public class BlsToExecutionChangeSchemaProvider
extends AbstractSchemaProvider<BlsToExecutionChangeSchema> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.teku.spec.schemas;
package tech.pegasys.teku.spec.schemas.providers;

import static tech.pegasys.teku.spec.SpecMilestone.BELLATRIX;
import static tech.pegasys.teku.spec.SpecMilestone.CAPELLA;
import static tech.pegasys.teku.spec.SpecMilestone.DENEB;
import static tech.pegasys.teku.spec.SpecMilestone.ELECTRA;
import static tech.pegasys.teku.spec.schemas.SchemaTypes.BEACON_STATE_SCHEMA;
import static tech.pegasys.teku.spec.schemas.SchemaTypes.EXECUTION_PAYLOAD_HEADER_SCHEMA;

Expand All @@ -29,6 +25,8 @@
import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.capella.BeaconStateSchemaCapella;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.deneb.BeaconStateSchemaDeneb;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.electra.BeaconStateSchemaElectra;
import tech.pegasys.teku.spec.schemas.AbstractSchemaProvider;
import tech.pegasys.teku.spec.schemas.SchemaRegistry;

public class ExecutionPayloadHeaderSchemaProvider
extends AbstractSchemaProvider<ExecutionPayloadHeaderSchema<? extends ExecutionPayloadHeader>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.teku.spec.schemas;
package tech.pegasys.teku.spec.schemas.providers;

import static tech.pegasys.teku.spec.SpecMilestone.BELLATRIX;
import static tech.pegasys.teku.spec.SpecMilestone.CAPELLA;
Expand All @@ -33,6 +33,8 @@
import tech.pegasys.teku.spec.datastructures.execution.versions.capella.ExecutionPayloadSchemaCapella;
import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.ExecutionPayloadSchemaDeneb;
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionPayloadSchemaElectra;
import tech.pegasys.teku.spec.schemas.AbstractSchemaProvider;
import tech.pegasys.teku.spec.schemas.SchemaRegistry;

public class ExecutionPayloadSchemaProvider
extends AbstractSchemaProvider<ExecutionPayloadSchema<? extends ExecutionPayload>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.teku.spec.schemas;
package tech.pegasys.teku.spec.schemas.providers;

import static tech.pegasys.teku.spec.SpecMilestone.PHASE0;
import static tech.pegasys.teku.spec.schemas.SchemaTypes.HISTORICAL_BATCH_SCHEMA;
Expand All @@ -20,9 +20,11 @@
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.config.SpecConfig;
import tech.pegasys.teku.spec.datastructures.state.HistoricalBatch.HistoricalBatchSchema;
import tech.pegasys.teku.spec.schemas.AbstractSchemaProvider;
import tech.pegasys.teku.spec.schemas.SchemaRegistry;

public class HistoricalBatchSchemaProvider extends AbstractSchemaProvider<HistoricalBatchSchema> {
HistoricalBatchSchemaProvider() {
public HistoricalBatchSchemaProvider() {
super(HISTORICAL_BATCH_SCHEMA);
addMilestoneMapping(PHASE0, SpecMilestone.getHighestMilestone());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.teku.spec.schemas;
package tech.pegasys.teku.spec.schemas.providers;

import static tech.pegasys.teku.spec.SpecMilestone.DENEB;
import static tech.pegasys.teku.spec.SpecMilestone.PHASE0;
Expand All @@ -23,6 +23,9 @@
import tech.pegasys.teku.spec.datastructures.operations.IndexedAttestationSchema;
import tech.pegasys.teku.spec.datastructures.operations.versions.electra.IndexedAttestationElectraSchema;
import tech.pegasys.teku.spec.datastructures.operations.versions.phase0.IndexedAttestationPhase0Schema;
import tech.pegasys.teku.spec.schemas.AbstractSchemaProvider;
import tech.pegasys.teku.spec.schemas.SchemaRegistry;
import tech.pegasys.teku.spec.schemas.SchemaTypes;

public class IndexedAttestationSchemaProvider
extends AbstractSchemaProvider<IndexedAttestationSchema<IndexedAttestation>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.teku.spec.schemas;
package tech.pegasys.teku.spec.schemas.providers;

import static tech.pegasys.teku.spec.SpecMilestone.ALTAIR;

Expand All @@ -22,6 +22,9 @@
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.metadata.MetadataMessageSchema;
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.metadata.versions.altair.MetadataMessageSchemaAltair;
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.metadata.versions.phase0.MetadataMessageSchemaPhase0;
import tech.pegasys.teku.spec.schemas.AbstractSchemaProvider;
import tech.pegasys.teku.spec.schemas.SchemaRegistry;
import tech.pegasys.teku.spec.schemas.SchemaTypes;

public class MetadataMessageSchemaProvider
extends AbstractSchemaProvider<MetadataMessageSchema<? extends MetadataMessage>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.teku.spec.schemas;
package tech.pegasys.teku.spec.schemas.providers;

import static tech.pegasys.teku.spec.schemas.SchemaTypes.AGGREGATE_AND_PROOF_SCHEMA;
import static tech.pegasys.teku.spec.schemas.SchemaTypes.SIGNED_AGGREGATE_AND_PROOF_SCHEMA;
Expand All @@ -20,6 +20,8 @@
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.config.SpecConfig;
import tech.pegasys.teku.spec.datastructures.operations.SignedAggregateAndProof.SignedAggregateAndProofSchema;
import tech.pegasys.teku.spec.schemas.AbstractSchemaProvider;
import tech.pegasys.teku.spec.schemas.SchemaRegistry;

public class SignedAggregateAndProofSchemaProvider
extends AbstractSchemaProvider<SignedAggregateAndProofSchema> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.teku.spec.schemas;
package tech.pegasys.teku.spec.schemas.providers;

import static tech.pegasys.teku.spec.schemas.SchemaTypes.BEACON_BLOCK_SCHEMA;
import static tech.pegasys.teku.spec.schemas.SchemaTypes.SIGNED_BEACON_BLOCK_SCHEMA;
Expand All @@ -20,6 +20,8 @@
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.config.SpecConfig;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlockSchema;
import tech.pegasys.teku.spec.schemas.AbstractSchemaProvider;
import tech.pegasys.teku.spec.schemas.SchemaRegistry;

public class SignedBeaconBlockSchemaProvider
extends AbstractSchemaProvider<SignedBeaconBlockSchema> {
Expand Down
Loading

0 comments on commit f1a14b8

Please sign in to comment.