Skip to content

Commit

Permalink
add new Electra config parameters (#8819)
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdi-aouadi authored Nov 5, 2024
1 parent d813213 commit fbfb8a2
Show file tree
Hide file tree
Showing 16 changed files with 193 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright Consensys Software Inc., 2024
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package tech.pegasys.teku.spec.config;

public interface NetworkingSpecConfigElectra extends NetworkingSpecConfigDeneb {
int getMaxRequestBlobSidecarsElectra();

int getBlobSidecarSubnetCountElectra();
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import tech.pegasys.teku.infrastructure.bytes.Bytes4;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;

public interface SpecConfigElectra extends SpecConfigDeneb {
public interface SpecConfigElectra extends SpecConfigDeneb, NetworkingSpecConfigElectra {

UInt64 UNSET_DEPOSIT_REQUESTS_START_INDEX = UInt64.MAX_VALUE;
UInt64 FULL_EXIT_REQUEST_AMOUNT = UInt64.ZERO;
Expand Down Expand Up @@ -66,6 +66,10 @@ static SpecConfigElectra required(final SpecConfig specConfig) {

int getMaxPendingDepositsPerEpoch();

int getMaxBlobsPerBlockElectra();

int getTargetBlobsPerBlockElectra();

@Override
Optional<SpecConfigElectra> toVersionElectra();
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public class SpecConfigElectraImpl extends DelegatingSpecConfigDeneb implements
private final int maxConsolidationRequestsPerPayload;
private final int maxPendingPartialsPerWithdrawalsSweep;
private final int maxPendingDepositsPerEpoch;
private final int maxBlobsPerBlockElectra;
private final int targetBlobsPerBlockElectra;
private final int maxRequestBlobSidecarsElectra;
private final int blobSidecarSubnetCountElectra;

public SpecConfigElectraImpl(
final SpecConfigDeneb specConfig,
Expand All @@ -58,7 +62,11 @@ public SpecConfigElectraImpl(
final int maxWithdrawalRequestsPerPayload,
final int maxConsolidationRequestsPerPayload,
final int maxPendingPartialsPerWithdrawalsSweep,
final int maxPendingDepositsPerEpoch) {
final int maxPendingDepositsPerEpoch,
final int maxBlobsPerBlockElectra,
final int targetBlobsPerBlockElectra,
final int maxRequestBlobSidecarsElectra,
final int blobSidecarSubnetCountElectra) {
super(specConfig);
this.electraForkVersion = electraForkVersion;
this.electraForkEpoch = electraForkEpoch;
Expand All @@ -77,6 +85,10 @@ public SpecConfigElectraImpl(
this.maxConsolidationRequestsPerPayload = maxConsolidationRequestsPerPayload;
this.maxPendingPartialsPerWithdrawalsSweep = maxPendingPartialsPerWithdrawalsSweep;
this.maxPendingDepositsPerEpoch = maxPendingDepositsPerEpoch;
this.maxBlobsPerBlockElectra = maxBlobsPerBlockElectra;
this.targetBlobsPerBlockElectra = targetBlobsPerBlockElectra;
this.maxRequestBlobSidecarsElectra = maxRequestBlobSidecarsElectra;
this.blobSidecarSubnetCountElectra = blobSidecarSubnetCountElectra;
}

@Override
Expand Down Expand Up @@ -164,6 +176,26 @@ public int getMaxPendingDepositsPerEpoch() {
return maxPendingDepositsPerEpoch;
}

@Override
public int getMaxBlobsPerBlockElectra() {
return maxBlobsPerBlockElectra;
}

@Override
public int getTargetBlobsPerBlockElectra() {
return targetBlobsPerBlockElectra;
}

@Override
public int getBlobSidecarSubnetCountElectra() {
return blobSidecarSubnetCountElectra;
}

@Override
public int getMaxRequestBlobSidecarsElectra() {
return maxRequestBlobSidecarsElectra;
}

@Override
public Optional<SpecConfigElectra> toVersionElectra() {
return Optional.of(this);
Expand Down Expand Up @@ -195,7 +227,11 @@ public boolean equals(final Object o) {
&& maxWithdrawalRequestsPerPayload == that.maxWithdrawalRequestsPerPayload
&& maxConsolidationRequestsPerPayload == that.maxConsolidationRequestsPerPayload
&& maxPendingPartialsPerWithdrawalsSweep == that.maxPendingPartialsPerWithdrawalsSweep
&& maxPendingDepositsPerEpoch == that.maxPendingDepositsPerEpoch;
&& maxPendingDepositsPerEpoch == that.maxPendingDepositsPerEpoch
&& maxBlobsPerBlockElectra == that.maxBlobsPerBlockElectra
&& targetBlobsPerBlockElectra == that.targetBlobsPerBlockElectra
&& maxRequestBlobSidecarsElectra == that.maxRequestBlobSidecarsElectra
&& blobSidecarSubnetCountElectra == that.blobSidecarSubnetCountElectra;
}

@Override
Expand All @@ -218,6 +254,10 @@ public int hashCode() {
maxWithdrawalRequestsPerPayload,
maxConsolidationRequestsPerPayload,
maxPendingPartialsPerWithdrawalsSweep,
maxPendingDepositsPerEpoch);
maxPendingDepositsPerEpoch,
maxBlobsPerBlockElectra,
targetBlobsPerBlockElectra,
maxRequestBlobSidecarsElectra,
blobSidecarSubnetCountElectra);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public class ElectraBuilder implements ForkConfigBuilder<SpecConfigDeneb, SpecCo
private Integer maxConsolidationRequestsPerPayload;
private Integer maxPendingPartialsPerWithdrawalsSweep;
private Integer maxPendingDepositsPerEpoch;
private Integer maxBlobsPerBlockElectra;
private Integer targetBlobsPerBlockElectra;
private Integer maxRequestBlobSidecarsElectra;
private Integer blobSidecarSubnetCountElectra;

ElectraBuilder() {}

Expand All @@ -70,7 +74,11 @@ public SpecConfigElectra build(final SpecConfigDeneb specConfig) {
maxWithdrawalRequestsPerPayload,
maxConsolidationRequestsPerPayload,
maxPendingPartialsPerWithdrawalsSweep,
maxPendingDepositsPerEpoch);
maxPendingDepositsPerEpoch,
maxBlobsPerBlockElectra,
targetBlobsPerBlockElectra,
maxRequestBlobSidecarsElectra,
blobSidecarSubnetCountElectra);
}

public ElectraBuilder electraForkVersion(final Bytes4 electraForkVersion) {
Expand Down Expand Up @@ -181,6 +189,30 @@ public ElectraBuilder maxPendingDepositsPerEpoch(final Integer maxPendingDeposit
return this;
}

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

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

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

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

@Override
public void validate() {
if (electraForkEpoch == null) {
Expand Down Expand Up @@ -217,6 +249,10 @@ public Map<String, Object> getValidationMap() {
constants.put("maxWithdrawalRequestsPerPayload", maxWithdrawalRequestsPerPayload);
constants.put("maxPendingPartialsPerWithdrawalsSweep", maxPendingPartialsPerWithdrawalsSweep);
constants.put("maxPendingDepositsPerEpoch", maxPendingDepositsPerEpoch);
constants.put("maxBlobsPerBlockElectra", maxBlobsPerBlockElectra);
constants.put("targetBlobsPerBlockElectra", targetBlobsPerBlockElectra);
constants.put("maxRequestBlobSidecarsElectra", maxRequestBlobSidecarsElectra);
constants.put("blobSidecarSubnetCountElectra", blobSidecarSubnetCountElectra);

return constants;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,11 @@ MAX_REQUEST_BLOB_SIDECARS: 768
# `2**14` (= 16384 epochs, ~15 days)
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 16384
# `6`
BLOB_SIDECAR_SUBNET_COUNT: 6
BLOB_SIDECAR_SUBNET_COUNT: 6

# Electra
MAX_BLOBS_PER_BLOCK_ELECTRA: 8
TARGET_BLOBS_PER_BLOCK_ELECTRA: 4
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_ELECTRA
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: 1024
BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: 8
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096
# `6`
BLOB_SIDECAR_SUBNET_COUNT: 6

# Electra
MAX_BLOBS_PER_BLOCK_ELECTRA: 8
TARGET_BLOBS_PER_BLOCK_ELECTRA: 4
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_ELECTRA
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: 1024
BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: 8

# [New in Electra:EIP7251]
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 128000000000 # 2**7 * 10**9 (= 128,000,000,000)
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: 256000000000 # 2**8 * 10**9 (= 256,000,000,000)
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,11 @@ MAX_REQUEST_BLOB_SIDECARS: 768
# `2**14` (= 16384 epochs, ~15 days)
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 16384
# `6`
BLOB_SIDECAR_SUBNET_COUNT: 6
BLOB_SIDECAR_SUBNET_COUNT: 6

# Electra
MAX_BLOBS_PER_BLOCK_ELECTRA: 8
TARGET_BLOBS_PER_BLOCK_ELECTRA: 4
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_ELECTRA
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: 1024
BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: 8
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,11 @@ MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096
# `6`
BLOB_SIDECAR_SUBNET_COUNT: 6
# `uint64(6)`
MAX_BLOBS_PER_BLOCK: 6
MAX_BLOBS_PER_BLOCK: 6

# Electra
MAX_BLOBS_PER_BLOCK_ELECTRA: 8
TARGET_BLOBS_PER_BLOCK_ELECTRA: 4
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_ELECTRA
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: 1024
BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: 8
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,11 @@ MAX_REQUEST_BLOB_SIDECARS: 768
# `2**12` (= 4096 epochs, ~18 days)
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096
# `6`
BLOB_SIDECAR_SUBNET_COUNT: 6
BLOB_SIDECAR_SUBNET_COUNT: 6

# Electra
MAX_BLOBS_PER_BLOCK_ELECTRA: 8
TARGET_BLOBS_PER_BLOCK_ELECTRA: 4
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_ELECTRA
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: 1024
BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: 8
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,10 @@ MAX_REQUEST_BLOB_SIDECARS: 768
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096
# `6`
BLOB_SIDECAR_SUBNET_COUNT: 6

# Electra
MAX_BLOBS_PER_BLOCK_ELECTRA: 8
TARGET_BLOBS_PER_BLOCK_ELECTRA: 4
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_ELECTRA
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: 1024
BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: 8
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096
# `6`
BLOB_SIDECAR_SUBNET_COUNT: 6

# Electra
MAX_BLOBS_PER_BLOCK_ELECTRA: 8
TARGET_BLOBS_PER_BLOCK_ELECTRA: 4
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_ELECTRA
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: 1024
BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: 8

# [New in Electra:EIP7251]
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 128000000000 # 2**7 * 10**9 (= 128,000,000,000)
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: 256000000000 # 2**8 * 10**9 (= 256,000,000,000)
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096
# `6`
BLOB_SIDECAR_SUBNET_COUNT: 6

# Electra
MAX_BLOBS_PER_BLOCK_ELECTRA: 8
TARGET_BLOBS_PER_BLOCK_ELECTRA: 4
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_ELECTRA
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: 1024
BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: 8

# [New in Electra:EIP7251]
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 64000000000 # 2**6 * 10**9 (= 64,000,000,000)
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: 128000000000 # 2**7 * 10**9 (= 128,000,000,000)
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,11 @@ MAX_REQUEST_BLOB_SIDECARS: 768
# `2**12` (= 4096 epochs, ~18 days)
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096
# `6`
BLOB_SIDECAR_SUBNET_COUNT: 6
BLOB_SIDECAR_SUBNET_COUNT: 6

# Electra
MAX_BLOBS_PER_BLOCK_ELECTRA: 8
TARGET_BLOBS_PER_BLOCK_ELECTRA: 4
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_ELECTRA
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: 1024
BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: 8
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096
# `6`
BLOB_SIDECAR_SUBNET_COUNT: 6

# Electra
MAX_BLOBS_PER_BLOCK_ELECTRA: 8
TARGET_BLOBS_PER_BLOCK_ELECTRA: 4
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_ELECTRA
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: 1024
BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: 8

# [New in Electra:EIP7251]
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 64000000000 # 2**6 * 10**9 (= 64,000,000,000)
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: 128000000000 # 2**7 * 10**9 (= 128,000,000,000)
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ private SpecConfigElectra createRandomElectraConfig(
dataStructureUtil.randomPositiveInt(8192),
dataStructureUtil.randomPositiveInt(16),
dataStructureUtil.randomPositiveInt(8),
dataStructureUtil.randomPositiveInt(16)) {};
dataStructureUtil.randomPositiveInt(16),
dataStructureUtil.randomPositiveInt(8),
dataStructureUtil.randomPositiveInt(4),
dataStructureUtil.randomPositiveInt(1024),
dataStructureUtil.randomPositiveInt(8)) {};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,11 @@ MAX_REQUEST_BLOB_SIDECARS: 768
# `2**12` (= 4096 epochs, ~18 days)
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096
# `6`
BLOB_SIDECAR_SUBNET_COUNT: 6
BLOB_SIDECAR_SUBNET_COUNT: 6

# Electra
MAX_BLOBS_PER_BLOCK_ELECTRA: 8
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_ELECTRA
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: 1024
BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: 8
TARGET_BLOBS_PER_BLOCK_ELECTRA: 4

0 comments on commit fbfb8a2

Please sign in to comment.