Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add electra updated preset values #18

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ static SpecConfigElectra required(final SpecConfig specConfig) {

int getMaxExecutionLayerExits();

int getMaxAttesterSlashingsElectra();

int getMaxAttestationsElectra();

@Override
Optional<SpecConfigElectra> toVersionElectra();
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,24 @@ public class SpecConfigElectraImpl extends DelegatingSpecConfigDeneb implements

private final int maxDepositReceiptsPerPayload;
private final int maxExecutionLayerExits;
private final int maxAttesterSlashingsElectra;
private final int maxAttestationsElectra;

public SpecConfigElectraImpl(
final SpecConfigDeneb specConfig,
final Bytes4 electraForkVersion,
final UInt64 electraForkEpoch,
final int maxDepositReceiptsPerPayload,
final int maxExecutionLayerExits) {
final int maxExecutionLayerExits,
final int maxAttesterSlashingsElectra,
final int maxAttestationsElectra) {
super(specConfig);
this.electraForkVersion = electraForkVersion;
this.electraForkEpoch = electraForkEpoch;
this.maxDepositReceiptsPerPayload = maxDepositReceiptsPerPayload;
this.maxExecutionLayerExits = maxExecutionLayerExits;
this.maxAttesterSlashingsElectra = maxAttesterSlashingsElectra;
this.maxAttestationsElectra = maxAttestationsElectra;
}

@Override
Expand All @@ -59,6 +65,16 @@ public int getMaxExecutionLayerExits() {
return maxExecutionLayerExits;
}

@Override
public int getMaxAttesterSlashingsElectra() {
return maxAttesterSlashingsElectra;
}

@Override
public int getMaxAttestationsElectra() {
return maxAttestationsElectra;
}

@Override
public Optional<SpecConfigElectra> toVersionElectra() {
return Optional.of(this);
Expand All @@ -77,7 +93,9 @@ public boolean equals(final Object o) {
&& Objects.equals(electraForkVersion, that.electraForkVersion)
&& Objects.equals(electraForkEpoch, that.electraForkEpoch)
&& maxDepositReceiptsPerPayload == that.maxDepositReceiptsPerPayload
&& maxExecutionLayerExits == that.maxExecutionLayerExits;
&& maxExecutionLayerExits == that.maxExecutionLayerExits
&& maxAttesterSlashingsElectra == that.maxAttesterSlashingsElectra
&& maxAttestationsElectra == that.maxAttestationsElectra;
}

@Override
Expand All @@ -87,6 +105,8 @@ public int hashCode() {
electraForkVersion,
electraForkEpoch,
maxDepositReceiptsPerPayload,
maxExecutionLayerExits);
maxDepositReceiptsPerPayload,
maxAttesterSlashingsElectra,
maxAttestationsElectra);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public class ElectraBuilder implements ForkConfigBuilder<SpecConfigDeneb, SpecCo
private UInt64 electraForkEpoch;
private Integer maxDepositReceiptsPerPayload;
private Integer maxExecutionLayerExits;
private Integer maxAttesterSlashingsElectra;
private Integer maxAttestationsElectra;

ElectraBuilder() {}

Expand All @@ -42,7 +44,9 @@ public SpecConfigElectra build(final SpecConfigDeneb specConfig) {
electraForkVersion,
electraForkEpoch,
maxDepositReceiptsPerPayload,
maxExecutionLayerExits);
maxExecutionLayerExits,
maxAttesterSlashingsElectra,
maxAttestationsElectra);
}

public ElectraBuilder electraForkEpoch(final UInt64 electraForkEpoch) {
Expand All @@ -69,6 +73,18 @@ public ElectraBuilder maxExecutionLayerExits(final Integer maxExecutionLayerExit
return this;
}

public ElectraBuilder maxAttesterSlashingsElectra(final Integer maxAttesterSlashingsElectra) {
checkNotNull(maxAttesterSlashingsElectra);
this.maxAttesterSlashingsElectra = maxAttesterSlashingsElectra;
return this;
}

public ElectraBuilder maxAttestationsElectra(final Integer maxAttestationsElectra) {
checkNotNull(maxAttestationsElectra);
this.maxAttestationsElectra = maxAttestationsElectra;
return this;
}

@Override
public void validate() {
if (electraForkEpoch == null) {
Expand All @@ -91,6 +107,8 @@ public Map<String, Object> getValidationMap() {
constants.put("electraForkEpoch", electraForkEpoch);
constants.put("electraForkVersion", electraForkVersion);
constants.put("maxDepositReceiptsPerPayload", maxDepositReceiptsPerPayload);
constants.put("maxAttesterSlashingsElectra", maxAttesterSlashingsElectra);
constants.put("maxAttestationsElectra", maxAttestationsElectra);

return constants;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,12 @@ public static BeaconBlockBodySchemaElectraImpl create(
ProposerSlashing.SSZ_SCHEMA, specConfig.getMaxProposerSlashings())),
namedSchema(
BlockBodyFields.ATTESTER_SLASHINGS,
SszListSchema.create(attesterSlashingSchema, specConfig.getMaxAttesterSlashings())),
SszListSchema.create(
attesterSlashingSchema, specConfig.getMaxAttesterSlashingsElectra())),
namedSchema(
BlockBodyFields.ATTESTATIONS,
SszListSchema.create(
new AttestationSchema(specConfig), specConfig.getMaxAttestations())),
new AttestationSchema(specConfig), specConfig.getMaxAttestationsElectra())),
namedSchema(
BlockBodyFields.DEPOSITS,
SszListSchema.create(Deposit.SSZ_SCHEMA, specConfig.getMaxDeposits())),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,12 @@ public static BlindedBeaconBlockBodySchemaElectraImpl create(
ProposerSlashing.SSZ_SCHEMA, specConfig.getMaxProposerSlashings())),
namedSchema(
BlockBodyFields.ATTESTER_SLASHINGS,
SszListSchema.create(attesterSlashingSchema, specConfig.getMaxAttesterSlashings())),
SszListSchema.create(
attesterSlashingSchema, specConfig.getMaxAttesterSlashingsElectra())),
namedSchema(
BlockBodyFields.ATTESTATIONS,
SszListSchema.create(
new AttestationSchema(specConfig), specConfig.getMaxAttestations())),
new AttestationSchema(specConfig), specConfig.getMaxAttestationsElectra())),
namedSchema(
BlockBodyFields.DEPOSITS,
SszListSchema.create(Deposit.SSZ_SCHEMA, specConfig.getMaxDeposits())),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,11 @@
# 2**13 (= 8192) receipts
MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD: 8192
# 2**4 (= 16) exits
MAX_EXECUTION_LAYER_EXITS: 16
MAX_EXECUTION_LAYER_EXITS: 16

# Updated max operations per block
# ---------------------------------------------------------------
# 2**0 (= 1)
MAX_ATTESTER_SLASHINGS_ELECTRA: 1
# 2**3 (= 8)
MAX_ATTESTATIONS_ELECTRA: 8
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,11 @@
# [customized]
MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD: 4
# 2**4 (= 16) exits
MAX_EXECUTION_LAYER_EXITS: 16
MAX_EXECUTION_LAYER_EXITS: 16

# Updated max operations per block
# ---------------------------------------------------------------
# 2**0 (= 1)
MAX_ATTESTER_SLASHINGS_ELECTRA: 1
# 2**3 (= 8)
MAX_ATTESTATIONS_ELECTRA: 8
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,11 @@ MAX_EXECUTION_LAYER_EXITS: 16
# Execution
# ---------------------------------------------------------------
# [customized]
MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD: 4
MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD: 4

# Updated max operations per block
# ---------------------------------------------------------------
# 2**0 (= 1)
MAX_ATTESTER_SLASHINGS_ELECTRA: 1
# 2**3 (= 8)
MAX_ATTESTATIONS_ELECTRA: 8
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ private SpecConfigElectra createRandomElectraConfig(
dataStructureUtil.randomBytes4(),
dataStructureUtil.randomUInt64(999_999),
dataStructureUtil.randomPositiveInt(16),
dataStructureUtil.randomPositiveInt(16)) {};
dataStructureUtil.randomPositiveInt(16),
dataStructureUtil.randomPositiveInt(1),
dataStructureUtil.randomPositiveInt(8)) {};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Minimal preset - Electra

# Updated max operations per block
# ---------------------------------------------------------------
# 2**0 (= 1)
MAX_ATTESTER_SLASHINGS_ELECTRA: 1
# 2**3 (= 8)
MAX_ATTESTATIONS_ELECTRA: 8