Skip to content

Commit

Permalink
rename stable beacon state classes
Browse files Browse the repository at this point in the history
  • Loading branch information
tbenr committed Jun 25, 2024
1 parent f34913e commit c421005
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected BeaconBlockBodySchemaElectraImpl(
executionPayloadSchema,
blsToExecutionChange,
blobKzgCommitments,
MAX_BEACON_BLOCK_BODY_FIELDS);
MAX_BEACON_BLOCK_BODY_FIELDS);
}

public static BeaconBlockBodySchemaElectraImpl create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import tech.pegasys.teku.infrastructure.ssz.SszProfile;

public interface StableBeaconState extends BeaconState, SszProfile {
public interface BeaconStateProfile extends BeaconState, SszProfile {

@Override
BeaconStateStableSchema<? extends BeaconState, ? extends MutableBeaconState>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
import tech.pegasys.teku.infrastructure.ssz.schema.SszProfileSchema;

public interface BeaconStateStableSchema<
T extends StableBeaconState, TMutable extends MutableBeaconState>
T extends BeaconStateProfile, TMutable extends MutableBeaconState>
extends BeaconStateSchema<T, TMutable>, SszProfileSchema<T> {}
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@
import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconStateCache;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconStateProfile;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconStateStableSchema;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.MutableBeaconState;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.StableBeaconState;

public abstract class AbstractStableBeaconState<TMutable extends MutableBeaconState>
extends SszProfileImpl implements StableBeaconState, BeaconStateCache {
public abstract class AbstractBeaconStateProfile<TMutable extends MutableBeaconState>
extends SszProfileImpl implements BeaconStateProfile, BeaconStateCache {

private final TransitionCaches transitionCaches;
private final SlotCaches slotCaches;

protected AbstractStableBeaconState(final BeaconStateStableSchema<?, ?> schema) {
protected AbstractBeaconStateProfile(final BeaconStateStableSchema<?, ?> schema) {
super(schema);
this.transitionCaches = TransitionCaches.createNewEmpty();
this.slotCaches = SlotCaches.createNewEmpty();
}

protected AbstractStableBeaconState(
protected AbstractBeaconStateProfile(
final SszProfileSchema<?> type,
final TreeNode backingNode,
final IntCache<SszData> cache,
Expand All @@ -51,7 +51,7 @@ protected AbstractStableBeaconState(
this.slotCaches = slotCaches;
}

protected AbstractStableBeaconState(
protected AbstractBeaconStateProfile(
final AbstractSszProfileSchema<? extends SszContainer> type, final TreeNode backingNode) {
super(type, backingNode);
this.transitionCaches = TransitionCaches.createNewEmpty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@
import tech.pegasys.teku.infrastructure.ssz.schema.impl.AbstractSszProfileSchema;
import tech.pegasys.teku.infrastructure.ssz.sos.SszField;
import tech.pegasys.teku.spec.config.SpecConfig;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconStateProfile;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconStateStableSchema;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.MutableBeaconState;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.StableBeaconState;

public abstract class AbstractBeaconStateStableProfileSchema<
T extends StableBeaconState, TMutable extends MutableBeaconState>
public abstract class AbstractBeaconStateProfileSchema<
T extends BeaconStateProfile, TMutable extends MutableBeaconState>
extends AbstractSszProfileSchema<T> implements BeaconStateStableSchema<T, TMutable> {
protected AbstractBeaconStateStableProfileSchema(
final String name, final List<SszField> allFields) {
protected AbstractBeaconStateProfileSchema(final String name, final List<SszField> allFields) {
super(
name,
SszStableContainerSchema.createForProfileOnly(
Expand All @@ -47,7 +46,7 @@ protected AbstractBeaconStateStableProfileSchema(
validateFields(allFields);
}

protected AbstractBeaconStateStableProfileSchema(
protected AbstractBeaconStateProfileSchema(
final String name, final List<SszField> uniqueFields, final SpecConfig specConfig) {
this(name, combineFields(BeaconStateFields.getCommonFields(specConfig), uniqueFields));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
import tech.pegasys.teku.infrastructure.ssz.primitive.SszUInt64;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.StableBeaconState;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconStateProfile;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.deneb.BeaconStateDeneb;
import tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingBalanceDeposit;
import tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingConsolidation;
import tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingPartialWithdrawal;

public interface BeaconStateElectra extends BeaconStateDeneb, StableBeaconState {
public interface BeaconStateElectra extends BeaconStateDeneb, BeaconStateProfile {
static BeaconStateElectra required(final BeaconState state) {
return state
.toVersionElectra()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import tech.pegasys.teku.infrastructure.ssz.tree.TreeNode;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconStateCache;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconStateStableSchema;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.common.AbstractStableBeaconState;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.common.AbstractBeaconStateProfile;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.common.SlotCaches;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.common.TransitionCaches;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.altair.ValidatorStatsAltair;

public class BeaconStateElectraImpl extends AbstractStableBeaconState<MutableBeaconStateElectra>
public class BeaconStateElectraImpl extends AbstractBeaconStateProfile<MutableBeaconStateElectra>
implements BeaconStateElectra, BeaconStateCache, ValidatorStatsAltair {

BeaconStateElectraImpl(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import tech.pegasys.teku.spec.datastructures.execution.versions.electra.ExecutionPayloadHeaderSchemaElectra;
import tech.pegasys.teku.spec.datastructures.state.SyncCommittee;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconStateSchema;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.common.AbstractBeaconStateStableProfileSchema;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.common.AbstractBeaconStateProfileSchema;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.common.BeaconStateFields;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.altair.BeaconStateSchemaAltair;
import tech.pegasys.teku.spec.datastructures.state.versions.capella.HistoricalSummary;
Expand All @@ -43,7 +43,7 @@
import tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingPartialWithdrawal;

public class BeaconStateSchemaElectra
extends AbstractBeaconStateStableProfileSchema<BeaconStateElectra, MutableBeaconStateElectra> {
extends AbstractBeaconStateProfileSchema<BeaconStateElectra, MutableBeaconStateElectra> {
public static final int DEPOSIT_REQUESTS_START_INDEX = 28;
public static final int DEPOSIT_BALANCE_TO_CONSUME_INDEX = 29;
public static final int EXIT_BALANCE_TO_CONSUME_INDEX = 30;
Expand Down

0 comments on commit c421005

Please sign in to comment.