Skip to content

Commit

Permalink
Updated presets for EIP-6110
Browse files Browse the repository at this point in the history
  • Loading branch information
lucassaldanha committed Oct 5, 2024
1 parent 234f711 commit 3714320
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static SpecConfigElectra required(final SpecConfig specConfig) {

UInt64 getMaxEffectiveBalanceElectra();

int getPendingBalanceDepositsLimit();
int getPendingDepositsLimit();

int getPendingPartialWithdrawalsLimit();

Expand All @@ -64,6 +64,8 @@ static SpecConfigElectra required(final SpecConfig specConfig) {

int getMaxPendingPartialsPerWithdrawalsSweep();

int getMaxPendingDepositsPerEpoch();

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

private final UInt64 minActivationBalance;
private final UInt64 maxEffectiveBalanceElectra;
private final int pendingBalanceDepositsLimit;
private final int pendingDepositsLimit;
private final int pendingPartialWithdrawalsLimit;
private final int pendingConsolidationsLimit;
private final int minSlashingPenaltyQuotientElectra;
Expand All @@ -38,6 +38,7 @@ public class SpecConfigElectraImpl extends DelegatingSpecConfigDeneb implements
private final int maxDepositRequestsPerPayload;
private final int maxWithdrawalRequestsPerPayload;
private final int maxPendingPartialsPerWithdrawalsSweep;
private final int maxPendingDepositsPerEpoch;

public SpecConfigElectraImpl(
final SpecConfigDeneb specConfig,
Expand All @@ -46,7 +47,7 @@ public SpecConfigElectraImpl(
final UInt64 minPerEpochChurnLimitElectra,
final UInt64 minActivationBalance,
final UInt64 maxEffectiveBalanceElectra,
final int pendingBalanceDepositsLimit,
final int pendingDepositsLimit,
final int pendingPartialWithdrawalsLimit,
final int pendingConsolidationsLimit,
final int minSlashingPenaltyQuotientElectra,
Expand All @@ -56,14 +57,15 @@ public SpecConfigElectraImpl(
final int maxConsolidationRequestsPerPayload,
final int maxDepositRequestsPerPayload,
final int maxWithdrawalRequestsPerPayload,
final int maxPendingPartialsPerWithdrawalsSweep) {
final int maxPendingPartialsPerWithdrawalsSweep,
final int maxPendingDepositsPerEpoch) {
super(specConfig);
this.electraForkVersion = electraForkVersion;
this.electraForkEpoch = electraForkEpoch;
this.minPerEpochChurnLimitElectra = minPerEpochChurnLimitElectra;
this.minActivationBalance = minActivationBalance;
this.maxEffectiveBalanceElectra = maxEffectiveBalanceElectra;
this.pendingBalanceDepositsLimit = pendingBalanceDepositsLimit;
this.pendingDepositsLimit = pendingDepositsLimit;
this.pendingPartialWithdrawalsLimit = pendingPartialWithdrawalsLimit;
this.pendingConsolidationsLimit = pendingConsolidationsLimit;
this.minSlashingPenaltyQuotientElectra = minSlashingPenaltyQuotientElectra;
Expand All @@ -74,6 +76,7 @@ public SpecConfigElectraImpl(
this.maxDepositRequestsPerPayload = maxDepositRequestsPerPayload;
this.maxWithdrawalRequestsPerPayload = maxWithdrawalRequestsPerPayload;
this.maxPendingPartialsPerWithdrawalsSweep = maxPendingPartialsPerWithdrawalsSweep;
this.maxPendingDepositsPerEpoch = maxPendingDepositsPerEpoch;
}

@Override
Expand Down Expand Up @@ -102,8 +105,8 @@ public UInt64 getMaxEffectiveBalanceElectra() {
}

@Override
public int getPendingBalanceDepositsLimit() {
return pendingBalanceDepositsLimit;
public int getPendingDepositsLimit() {
return pendingDepositsLimit;
}

@Override
Expand Down Expand Up @@ -156,6 +159,11 @@ public int getMaxPendingPartialsPerWithdrawalsSweep() {
return maxPendingPartialsPerWithdrawalsSweep;
}

@Override
public int getMaxPendingDepositsPerEpoch() {
return maxPendingDepositsPerEpoch;
}

@Override
public Optional<SpecConfigElectra> toVersionElectra() {
return Optional.of(this);
Expand All @@ -176,7 +184,7 @@ public boolean equals(final Object o) {
&& Objects.equals(minPerEpochChurnLimitElectra, that.minPerEpochChurnLimitElectra)
&& Objects.equals(minActivationBalance, that.minActivationBalance)
&& Objects.equals(maxEffectiveBalanceElectra, that.maxEffectiveBalanceElectra)
&& pendingBalanceDepositsLimit == that.pendingBalanceDepositsLimit
&& pendingDepositsLimit == that.pendingDepositsLimit
&& pendingPartialWithdrawalsLimit == that.pendingPartialWithdrawalsLimit
&& pendingConsolidationsLimit == that.pendingConsolidationsLimit
&& minSlashingPenaltyQuotientElectra == that.minSlashingPenaltyQuotientElectra
Expand All @@ -186,7 +194,8 @@ public boolean equals(final Object o) {
&& maxConsolidationRequestsPerPayload == that.maxConsolidationRequestsPerPayload
&& maxDepositRequestsPerPayload == that.maxDepositRequestsPerPayload
&& maxWithdrawalRequestsPerPayload == that.maxWithdrawalRequestsPerPayload
&& maxPendingPartialsPerWithdrawalsSweep == that.maxPendingPartialsPerWithdrawalsSweep;
&& maxPendingPartialsPerWithdrawalsSweep == that.maxPendingPartialsPerWithdrawalsSweep
&& maxPendingDepositsPerEpoch == that.maxPendingDepositsPerEpoch;
}

@Override
Expand All @@ -198,7 +207,7 @@ public int hashCode() {
minPerEpochChurnLimitElectra,
minActivationBalance,
maxEffectiveBalanceElectra,
pendingBalanceDepositsLimit,
pendingDepositsLimit,
pendingPartialWithdrawalsLimit,
pendingConsolidationsLimit,
minSlashingPenaltyQuotientElectra,
Expand All @@ -208,6 +217,7 @@ public int hashCode() {
maxConsolidationRequestsPerPayload,
maxDepositRequestsPerPayload,
maxWithdrawalRequestsPerPayload,
maxPendingPartialsPerWithdrawalsSweep);
maxPendingPartialsPerWithdrawalsSweep,
maxPendingDepositsPerEpoch);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class ElectraBuilder implements ForkConfigBuilder<SpecConfigDeneb, SpecCo
private UInt64 minPerEpochChurnLimitElectra;
private UInt64 minActivationBalance;
private UInt64 maxEffectiveBalanceElectra;
private Integer pendingBalanceDepositsLimit;
private Integer pendingDepositsLimit;
private Integer pendingPartialWithdrawalsLimit;
private Integer pendingConsolidationsLimit;
private Integer minSlashingPenaltyQuotientElectra;
Expand All @@ -45,6 +45,7 @@ public class ElectraBuilder implements ForkConfigBuilder<SpecConfigDeneb, SpecCo
private Integer maxDepositRequestsPerPayload;
private Integer maxWithdrawalRequestsPerPayload;
private Integer maxPendingPartialsPerWithdrawalsSweep;
private Integer maxPendingDepositsPerEpoch;

ElectraBuilder() {}

Expand All @@ -57,7 +58,7 @@ public SpecConfigElectra build(final SpecConfigDeneb specConfig) {
minPerEpochChurnLimitElectra,
minActivationBalance,
maxEffectiveBalanceElectra,
pendingBalanceDepositsLimit,
pendingDepositsLimit,
pendingPartialWithdrawalsLimit,
pendingConsolidationsLimit,
minSlashingPenaltyQuotientElectra,
Expand All @@ -67,7 +68,8 @@ public SpecConfigElectra build(final SpecConfigDeneb specConfig) {
maxConsolidationRequestsPerPayload,
maxDepositRequestsPerPayload,
maxWithdrawalRequestsPerPayload,
maxPendingPartialsPerWithdrawalsSweep);
maxPendingPartialsPerWithdrawalsSweep,
maxPendingDepositsPerEpoch);
}

public ElectraBuilder electraForkEpoch(final UInt64 electraForkEpoch) {
Expand Down Expand Up @@ -100,9 +102,9 @@ public ElectraBuilder maxEffectiveBalanceElectra(final UInt64 maxEffectiveBalanc
return this;
}

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

Expand Down Expand Up @@ -172,6 +174,12 @@ public ElectraBuilder maxPendingPartialsPerWithdrawalsSweep(
return this;
}

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

@Override
public void validate() {
if (electraForkEpoch == null) {
Expand All @@ -196,7 +204,7 @@ public Map<String, Object> getValidationMap() {
constants.put("minPerEpochChurnLimitElectra", minPerEpochChurnLimitElectra);
constants.put("minActivationBalance", minActivationBalance);
constants.put("maxEffectiveBalanceElectra", maxEffectiveBalanceElectra);
constants.put("pendingBalanceDepositsLimit", pendingBalanceDepositsLimit);
constants.put("pendingDepositsLimit", pendingDepositsLimit);
constants.put("pendingPartialWithdrawalsLimit", pendingPartialWithdrawalsLimit);
constants.put("pendingConsolidationsLimit", pendingConsolidationsLimit);
constants.put("minSlashingPenaltyQuotientElectra", minSlashingPenaltyQuotientElectra);
Expand All @@ -207,6 +215,7 @@ public Map<String, Object> getValidationMap() {
constants.put("maxDepositRequestsPerPayload", maxDepositRequestsPerPayload);
constants.put("maxWithdrawalRequestsPerPayload", maxWithdrawalRequestsPerPayload);
constants.put("maxPendingPartialsPerWithdrawalsSweep", maxPendingPartialsPerWithdrawalsSweep);
constants.put("maxPendingDepositsPerEpoch", maxPendingDepositsPerEpoch);

return constants;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ private static List<SszField> getUniqueFields(final SpecConfig specConfig) {
BeaconStateFields.PENDING_BALANCE_DEPOSITS,
() ->
SszListSchema.create(
pendingBalanceDepositSchema,
specConfigElectra.getPendingBalanceDepositsLimit()));
pendingBalanceDepositSchema, specConfigElectra.getPendingDepositsLimit()));
final SszField pendingPartialWithdrawalsField =
new SszField(
PENDING_PARTIAL_WITHDRAWALS_INDEX,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ MAX_EFFECTIVE_BALANCE_ELECTRA: 2048000000000
# State list lengths
# ---------------------------------------------------------------
# `uint64(2**27)` (= 134,217,728)
PENDING_BALANCE_DEPOSITS_LIMIT: 134217728
PENDING_DEPOSITS_LIMIT: 134217728
# `uint64(2**27)` (= 134,217,728)
PENDING_PARTIAL_WITHDRAWALS_LIMIT: 134217728
# `uint64(2**18)` (= 262,144)
Expand Down Expand Up @@ -42,4 +42,9 @@ MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: 16
# Withdrawals processing
# ---------------------------------------------------------------
# 2**3 ( = 8) pending withdrawals
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 8
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 8

# Pending deposits processing
# ---------------------------------------------------------------
# 2**4 ( = 4) pending deposits
MAX_PENDING_DEPOSITS_PER_EPOCH: 16
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ MAX_EFFECTIVE_BALANCE_ELECTRA: 2048000000000
# State list lengths
# ---------------------------------------------------------------
# `uint64(2**27)` (= 134,217,728)
PENDING_BALANCE_DEPOSITS_LIMIT: 134217728
PENDING_DEPOSITS_LIMIT: 134217728
# [customized] `uint64(2**6)` (= 64)
PENDING_PARTIAL_WITHDRAWALS_LIMIT: 64
# [customized] `uint64(2**6)` (= 64)
Expand Down Expand Up @@ -42,4 +42,9 @@ MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: 2
# Withdrawals processing
# ---------------------------------------------------------------
# 2**0 ( = 1) pending withdrawals
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 1
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 1

# Pending deposits processing
# ---------------------------------------------------------------
# 2**4 ( = 4) pending deposits
MAX_PENDING_DEPOSITS_PER_EPOCH: 16
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ MAX_EFFECTIVE_BALANCE_ELECTRA: 2048000000000
# State list lengths
# ---------------------------------------------------------------
# `uint64(2**27)` (= 134,217,728)
PENDING_BALANCE_DEPOSITS_LIMIT: 134217728
PENDING_DEPOSITS_LIMIT: 134217728
# [customized] `uint64(2**6)` (= 64)
PENDING_PARTIAL_WITHDRAWALS_LIMIT: 64
# [customized] `uint64(2**6)` (= 64)
Expand Down Expand Up @@ -42,4 +42,9 @@ MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: 2
# Withdrawals processing
# ---------------------------------------------------------------
# 2**0 ( = 1) pending withdrawals
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 1
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 1

# Pending deposits processing
# ---------------------------------------------------------------
# 2**4 ( = 4) pending deposits
MAX_PENDING_DEPOSITS_PER_EPOCH: 16
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ private SpecConfigElectra createRandomElectraConfig(
dataStructureUtil.randomPositiveInt(1),
dataStructureUtil.randomPositiveInt(8192),
dataStructureUtil.randomPositiveInt(16),
dataStructureUtil.randomPositiveInt(8)) {};
dataStructureUtil.randomPositiveInt(8),
dataStructureUtil.randomPositiveInt(16)) {};
}
}

0 comments on commit 3714320

Please sign in to comment.