Add mainnet configs (#8344)

#8135

mainnet config PR: https://github.com/eth-clients/mainnet/pull/11


  


Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>

Co-Authored-By: Michael Sproul <michael@sigmaprime.io>

Co-Authored-By: Tan Chee Keong <tanck@sigmaprime.io>
This commit is contained in:
Eitan Seri-Levi
2025-11-02 22:53:13 -08:00
committed by GitHub
parent b57d046c4a
commit 25832e5862
5 changed files with 150 additions and 38 deletions

View File

@@ -850,6 +850,22 @@ mod test {
.build(); .build();
harness.advance_slot(); harness.advance_slot();
// Check block generator timestamp conversion sanity.
{
let exec_block_generator = harness.execution_block_generator();
assert_eq!(
exec_block_generator
.timestamp_to_slot_post_capella(exec_block_generator.osaka_time.unwrap()),
0
);
assert_eq!(
exec_block_generator.timestamp_to_slot_post_capella(
exec_block_generator.osaka_time.unwrap() + harness.spec.seconds_per_slot
),
1
);
}
let verify_fn = |column_sidecar: DataColumnSidecar<E>| { let verify_fn = |column_sidecar: DataColumnSidecar<E>| {
GossipVerifiedDataColumn::<_>::new_for_block_publishing( GossipVerifiedDataColumn::<_>::new_for_block_publishing(
column_sidecar.into(), column_sidecar.into(),

View File

@@ -21,7 +21,7 @@ use types::{
Blob, ChainSpec, EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadBellatrix, Blob, ChainSpec, EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadBellatrix,
ExecutionPayloadCapella, ExecutionPayloadDeneb, ExecutionPayloadElectra, ExecutionPayloadFulu, ExecutionPayloadCapella, ExecutionPayloadDeneb, ExecutionPayloadElectra, ExecutionPayloadFulu,
ExecutionPayloadGloas, ExecutionPayloadHeader, FixedBytesExtended, ForkName, Hash256, ExecutionPayloadGloas, ExecutionPayloadHeader, FixedBytesExtended, ForkName, Hash256,
KzgProofs, Transaction, Transactions, Uint256, KzgProofs, Slot, Transaction, Transactions, Uint256,
}; };
use super::DEFAULT_TERMINAL_BLOCK; use super::DEFAULT_TERMINAL_BLOCK;
@@ -265,6 +265,37 @@ impl<E: EthSpec> ExecutionBlockGenerator<E> {
ForkName::Bellatrix ForkName::Bellatrix
} }
/// Get the timestamp at which `fork` activates.
///
/// This function will panic if the `fork` is not enabled or is `<= ForkName::Bellatrix`.
pub fn get_fork_timestamp_post_capella(&self, fork: ForkName) -> u64 {
match fork {
ForkName::Gloas => self.amsterdam_time,
ForkName::Fulu => self.osaka_time,
ForkName::Electra => self.prague_time,
ForkName::Deneb => self.cancun_time,
ForkName::Capella => self.shanghai_time,
_ => panic!("only the Capella fork or later is supported"),
}
.unwrap_or_else(|| panic!("fork is {fork} but no corresponding timestamp is set"))
}
/// This is a slightly nasty method for converting timestamps to slots, but it will suffice
/// until we can plumb through a slot clock.
pub fn timestamp_to_slot_post_capella(&self, timestamp: u64) -> Slot {
let fork = self.get_fork_at_timestamp(timestamp);
let fork_epoch = self.spec.fork_epoch(fork).unwrap();
let fork_timestamp = self.get_fork_timestamp_post_capella(fork);
// Number of slots since fork.
let slot_offset = timestamp
.checked_sub(fork_timestamp)
.expect("timestamp should be >= fork timestamp")
/ self.spec.seconds_per_slot;
fork_epoch.start_slot(E::slots_per_epoch()) + Slot::new(slot_offset)
}
pub fn execution_block_by_number(&self, number: u64) -> Option<ExecutionBlock> { pub fn execution_block_by_number(&self, number: u64) -> Option<ExecutionBlock> {
self.block_by_number(number) self.block_by_number(number)
.map(|block| block.as_execution_block(self.terminal_total_difficulty)) .map(|block| block.as_execution_block(self.terminal_total_difficulty))
@@ -734,9 +765,10 @@ impl<E: EthSpec> ExecutionBlockGenerator<E> {
if fork_name.deneb_enabled() { if fork_name.deneb_enabled() {
// get random number between 0 and Max Blobs // get random number between 0 and Max Blobs
let mut rng = self.rng.lock(); let mut rng = self.rng.lock();
// TODO(EIP-7892): see FIXME below let epoch = self
// FIXME: this will break with BPO forks. This function needs to calculate the epoch based on block timestamp.. .timestamp_to_slot_post_capella(execution_payload.timestamp())
let max_blobs = self.spec.max_blobs_per_block_within_fork(fork_name) as usize; .epoch(E::slots_per_epoch());
let max_blobs = self.spec.max_blobs_per_block(epoch) as usize;
let num_blobs = rng.random_range(self.min_blobs_count..=max_blobs); let num_blobs = rng.random_range(self.min_blobs_count..=max_blobs);
let (bundle, transactions) = generate_blobs(num_blobs, fork_name)?; let (bundle, transactions) = generate_blobs(num_blobs, fork_name)?;
for tx in Vec::from(transactions) { for tx in Vec::from(transactions) {

View File

@@ -6,7 +6,9 @@ PRESET_BASE: 'mainnet'
# Free-form short name of the network that this configuration applies to - known # Free-form short name of the network that this configuration applies to - known
# canonical network names include: # canonical network names include:
# * 'mainnet' - there can be only one # * 'mainnet' - there can be only one
# * 'sepolia' - testnet
# * 'holesky' - testnet # * 'holesky' - testnet
# * 'hoodi' - testnet
# Must match the regex: [a-z0-9\-] # Must match the regex: [a-z0-9\-]
CONFIG_NAME: 'mainnet' CONFIG_NAME: 'mainnet'
@@ -52,23 +54,37 @@ ELECTRA_FORK_VERSION: 0x05000000
ELECTRA_FORK_EPOCH: 364032 # May 7, 2025, 10:05:11am UTC ELECTRA_FORK_EPOCH: 364032 # May 7, 2025, 10:05:11am UTC
# Fulu # Fulu
FULU_FORK_VERSION: 0x06000000 FULU_FORK_VERSION: 0x06000000
FULU_FORK_EPOCH: 18446744073709551615 FULU_FORK_EPOCH: 411392 # December 3, 2025, 09:49:11pm UTC
# Gloas # Gloas
GLOAS_FORK_VERSION: 0x07000000 GLOAS_FORK_VERSION: 0x07000000
GLOAS_FORK_EPOCH: 18446744073709551615 GLOAS_FORK_EPOCH: 18446744073709551615
# Time parameters # Time parameters
# --------------------------------------------------------------- # ---------------------------------------------------------------
# 12 seconds # 12 seconds (*deprecated*)
SECONDS_PER_SLOT: 12 SECONDS_PER_SLOT: 12
# 12000 milliseconds
SLOT_DURATION_MS: 12000
# 14 (estimate from Eth1 mainnet) # 14 (estimate from Eth1 mainnet)
SECONDS_PER_ETH1_BLOCK: 14 SECONDS_PER_ETH1_BLOCK: 14
# 2**8 (= 256) epochs ~27 hours # 2**8 (= 256) epochs
MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256 MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256
# 2**8 (= 256) epochs ~27 hours # 2**8 (= 256) epochs
SHARD_COMMITTEE_PERIOD: 256 SHARD_COMMITTEE_PERIOD: 256
# 2**11 (= 2,048) Eth1 blocks ~8 hours # 2**11 (= 2,048) Eth1 blocks
ETH1_FOLLOW_DISTANCE: 2048 ETH1_FOLLOW_DISTANCE: 2048
# 1667 basis points, ~17% of SLOT_DURATION_MS
PROPOSER_REORG_CUTOFF_BPS: 1667
# 3333 basis points, ~33% of SLOT_DURATION_MS
ATTESTATION_DUE_BPS: 3333
# 6667 basis points, ~67% of SLOT_DURATION_MS
AGGREGATE_DUE_BPS: 6667
# Altair
# 3333 basis points, ~33% of SLOT_DURATION_MS
SYNC_MESSAGE_DUE_BPS: 3333
# 6667 basis points, ~67% of SLOT_DURATION_MS
CONTRIBUTION_DUE_BPS: 6667
# Validator cycle # Validator cycle
# --------------------------------------------------------------- # ---------------------------------------------------------------
@@ -78,13 +94,21 @@ INACTIVITY_SCORE_BIAS: 4
INACTIVITY_SCORE_RECOVERY_RATE: 16 INACTIVITY_SCORE_RECOVERY_RATE: 16
# 2**4 * 10**9 (= 16,000,000,000) Gwei # 2**4 * 10**9 (= 16,000,000,000) Gwei
EJECTION_BALANCE: 16000000000 EJECTION_BALANCE: 16000000000
# 2**2 (= 4) # 2**2 (= 4) validators
MIN_PER_EPOCH_CHURN_LIMIT: 4 MIN_PER_EPOCH_CHURN_LIMIT: 4
# 2**16 (= 65,536) # 2**16 (= 65,536)
CHURN_LIMIT_QUOTIENT: 65536 CHURN_LIMIT_QUOTIENT: 65536
# [New in Deneb:EIP7514] 2**3 (= 8)
# Deneb
# 2**3 (= 8) (*deprecated*)
MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT: 8 MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT: 8
# Electra
# 2**7 * 10**9 (= 128,000,000,000) Gwei
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 128000000000
# 2**8 * 10**9 (= 256,000,000,000) Gwei
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: 256000000000
# Fork choice # Fork choice
# --------------------------------------------------------------- # ---------------------------------------------------------------
# 40% # 40%
@@ -93,7 +117,7 @@ PROPOSER_SCORE_BOOST: 40
REORG_HEAD_WEIGHT_THRESHOLD: 20 REORG_HEAD_WEIGHT_THRESHOLD: 20
# 160% # 160%
REORG_PARENT_WEIGHT_THRESHOLD: 160 REORG_PARENT_WEIGHT_THRESHOLD: 160
# `2` epochs # 2 epochs
REORG_MAX_EPOCHS_SINCE_FINALIZATION: 2 REORG_MAX_EPOCHS_SINCE_FINALIZATION: 2
# Deposit contract # Deposit contract
@@ -105,18 +129,19 @@ DEPOSIT_CONTRACT_ADDRESS: 0x00000000219ab540356cBB839Cbe05303d7705Fa
# Networking # Networking
# --------------------------------------------------------------- # ---------------------------------------------------------------
# `10 * 2**20` (= 10485760, 10 MiB) # 10 * 2**20 (= 10,485,760) bytes, 10 MiB
MAX_PAYLOAD_SIZE: 10485760 MAX_PAYLOAD_SIZE: 10485760
# `2**10` (= 1024) # 2**10 (= 1,024) blocks
MAX_REQUEST_BLOCKS: 1024 MAX_REQUEST_BLOCKS: 1024
# `2**8` (= 256) # 2**8 (= 256) epochs
EPOCHS_PER_SUBNET_SUBSCRIPTION: 256 EPOCHS_PER_SUBNET_SUBSCRIPTION: 256
# `MIN_VALIDATOR_WITHDRAWABILITY_DELAY + CHURN_LIMIT_QUOTIENT // 2` (= 33024, ~5 months) # MIN_VALIDATOR_WITHDRAWABILITY_DELAY + CHURN_LIMIT_QUOTIENT // 2 (= 33,024) epochs
MIN_EPOCHS_FOR_BLOCK_REQUESTS: 33024 MIN_EPOCHS_FOR_BLOCK_REQUESTS: 33024
# 5s # 5s
TTFB_TIMEOUT: 5 TTFB_TIMEOUT: 5
# 10s # 10s
RESP_TIMEOUT: 10 RESP_TIMEOUT: 10
# 2**5 (= 32) slots
ATTESTATION_PROPAGATION_SLOT_RANGE: 32 ATTESTATION_PROPAGATION_SLOT_RANGE: 32
# 500ms # 500ms
MAXIMUM_GOSSIP_CLOCK_DISPARITY: 500 MAXIMUM_GOSSIP_CLOCK_DISPARITY: 500
@@ -124,45 +149,59 @@ MESSAGE_DOMAIN_INVALID_SNAPPY: 0x00000000
MESSAGE_DOMAIN_VALID_SNAPPY: 0x01000000 MESSAGE_DOMAIN_VALID_SNAPPY: 0x01000000
# 2 subnets per node # 2 subnets per node
SUBNETS_PER_NODE: 2 SUBNETS_PER_NODE: 2
# 2**8 (= 64) # 2**6 (= 64) subnets
ATTESTATION_SUBNET_COUNT: 64 ATTESTATION_SUBNET_COUNT: 64
# 0 bits
ATTESTATION_SUBNET_EXTRA_BITS: 0 ATTESTATION_SUBNET_EXTRA_BITS: 0
# ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS # ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS (= 6 + 0) bits
ATTESTATION_SUBNET_PREFIX_BITS: 6 ATTESTATION_SUBNET_PREFIX_BITS: 6
ATTESTATION_SUBNET_SHUFFLING_PREFIX_BITS: 3 ATTESTATION_SUBNET_SHUFFLING_PREFIX_BITS: 3
# Deneb # Deneb
# `2**7` (=128) # 2**7 (= 128) blocks
MAX_REQUEST_BLOCKS_DENEB: 128 MAX_REQUEST_BLOCKS_DENEB: 128
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK # 2**12 (= 4,096) epochs
MAX_REQUEST_BLOB_SIDECARS: 768
# `2**12` (= 4096 epochs, ~18 days)
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096 MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096
# `6` # 6 subnets
BLOB_SIDECAR_SUBNET_COUNT: 6 BLOB_SIDECAR_SUBNET_COUNT: 6
# `uint64(6)` # 6 blobs
MAX_BLOBS_PER_BLOCK: 6 MAX_BLOBS_PER_BLOCK: 6
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK (= 128 * 6) sidecars
MAX_REQUEST_BLOB_SIDECARS: 768
# Electra # Electra
# 2**7 * 10**9 (= 128,000,000,000) # 9 subnets
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 128000000000
# 2**8 * 10**9 (= 256,000,000,000)
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: 256000000000
# `9`
BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: 9 BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: 9
# `uint64(9)` # 9 blobs
MAX_BLOBS_PER_BLOCK_ELECTRA: 9 MAX_BLOBS_PER_BLOCK_ELECTRA: 9
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_ELECTRA # MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_ELECTRA (= 128 * 9) sidecars
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: 1152 MAX_REQUEST_BLOB_SIDECARS_ELECTRA: 1152
# Fulu # Fulu
# 2**7 (= 128) groups
NUMBER_OF_CUSTODY_GROUPS: 128 NUMBER_OF_CUSTODY_GROUPS: 128
# 2**7 (= 128) subnets
DATA_COLUMN_SIDECAR_SUBNET_COUNT: 128 DATA_COLUMN_SIDECAR_SUBNET_COUNT: 128
# MAX_REQUEST_BLOCKS_DENEB * NUMBER_OF_COLUMNS (= 128 * 128) sidecars
MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384 MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384
# 2**3 (= 8) samples
SAMPLES_PER_SLOT: 8 SAMPLES_PER_SLOT: 8
# 2**2 (= 4) sidecars
CUSTODY_REQUIREMENT: 4 CUSTODY_REQUIREMENT: 4
# 2**3 (= 8) sidecars
VALIDATOR_CUSTODY_REQUIREMENT: 8 VALIDATOR_CUSTODY_REQUIREMENT: 8
# 2**5 * 10**9 (= 32,000,000,000) Gwei
BALANCE_PER_ADDITIONAL_CUSTODY_GROUP: 32000000000 BALANCE_PER_ADDITIONAL_CUSTODY_GROUP: 32000000000
# 2**12 (= 4,096) epochs
MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS: 4096 MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS: 4096
# Gloas # Blob Scheduling
# ---------------------------------------------------------------
BLOB_SCHEDULE:
- EPOCH: 412672 # December 9, 2025, 02:21:11pm UTC
MAX_BLOBS_PER_BLOCK: 15
- EPOCH: 419072 # January 7, 2026, 01:01:11am UTC
MAX_BLOBS_PER_BLOCK: 21
# Gloas

View File

@@ -41,8 +41,7 @@ MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: 16
# Withdrawals processing # Withdrawals processing
# --------------------------------------------------------------- # ---------------------------------------------------------------
# 2**3 ( = 8) pending withdrawals MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 6
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 8
# Pending deposits processing # Pending deposits processing
# --------------------------------------------------------------- # ---------------------------------------------------------------

View File

@@ -87,12 +87,18 @@ pub struct ChainSpec {
*/ */
pub genesis_delay: u64, pub genesis_delay: u64,
pub seconds_per_slot: u64, pub seconds_per_slot: u64,
pub slot_duration_ms: u64,
pub min_attestation_inclusion_delay: u64, pub min_attestation_inclusion_delay: u64,
pub min_seed_lookahead: Epoch, pub min_seed_lookahead: Epoch,
pub max_seed_lookahead: Epoch, pub max_seed_lookahead: Epoch,
pub min_epochs_to_inactivity_penalty: u64, pub min_epochs_to_inactivity_penalty: u64,
pub min_validator_withdrawability_delay: Epoch, pub min_validator_withdrawability_delay: Epoch,
pub shard_committee_period: u64, pub shard_committee_period: u64,
pub proposer_reorg_cutoff_bps: u64,
pub attestation_due_bps: u64,
pub aggregate_due_bps: u64,
pub sync_message_due_bps: u64,
pub contribution_due_bps: u64,
/* /*
* Reward and penalty quotients * Reward and penalty quotients
@@ -964,12 +970,18 @@ impl ChainSpec {
*/ */
genesis_delay: 604800, // 7 days genesis_delay: 604800, // 7 days
seconds_per_slot: 12, seconds_per_slot: 12,
slot_duration_ms: 12000,
min_attestation_inclusion_delay: 1, min_attestation_inclusion_delay: 1,
min_seed_lookahead: Epoch::new(1), min_seed_lookahead: Epoch::new(1),
max_seed_lookahead: Epoch::new(4), max_seed_lookahead: Epoch::new(4),
min_epochs_to_inactivity_penalty: 4, min_epochs_to_inactivity_penalty: 4,
min_validator_withdrawability_delay: Epoch::new(256), min_validator_withdrawability_delay: Epoch::new(256),
shard_committee_period: 256, shard_committee_period: 256,
proposer_reorg_cutoff_bps: 1667,
attestation_due_bps: 3333,
aggregate_due_bps: 6667,
sync_message_due_bps: 3333,
contribution_due_bps: 6667,
/* /*
* Reward and penalty quotients * Reward and penalty quotients
@@ -1098,7 +1110,7 @@ impl ChainSpec {
* Fulu hard fork params * Fulu hard fork params
*/ */
fulu_fork_version: [0x06, 0x00, 0x00, 0x00], fulu_fork_version: [0x06, 0x00, 0x00, 0x00],
fulu_fork_epoch: None, fulu_fork_epoch: Some(Epoch::new(411392)),
custody_requirement: 4, custody_requirement: 4,
number_of_custody_groups: 128, number_of_custody_groups: 128,
data_column_sidecar_subnet_count: 128, data_column_sidecar_subnet_count: 128,
@@ -1158,7 +1170,16 @@ impl ChainSpec {
/* /*
* Networking Fulu specific * Networking Fulu specific
*/ */
blob_schedule: BlobSchedule::default(), blob_schedule: BlobSchedule::new(vec![
BlobParameters {
epoch: Epoch::new(412672),
max_blobs_per_block: 15,
},
BlobParameters {
epoch: Epoch::new(419072),
max_blobs_per_block: 21,
},
]),
min_epochs_for_data_column_sidecars_requests: min_epochs_for_data_column_sidecars_requests:
default_min_epochs_for_data_column_sidecars_requests(), default_min_epochs_for_data_column_sidecars_requests(),
max_data_columns_by_root_request: default_data_columns_by_root_request(), max_data_columns_by_root_request: default_data_columns_by_root_request(),
@@ -1310,12 +1331,18 @@ impl ChainSpec {
*/ */
genesis_delay: 6000, // 100 minutes genesis_delay: 6000, // 100 minutes
seconds_per_slot: 5, seconds_per_slot: 5,
slot_duration_ms: 5000,
min_attestation_inclusion_delay: 1, min_attestation_inclusion_delay: 1,
min_seed_lookahead: Epoch::new(1), min_seed_lookahead: Epoch::new(1),
max_seed_lookahead: Epoch::new(4), max_seed_lookahead: Epoch::new(4),
min_epochs_to_inactivity_penalty: 4, min_epochs_to_inactivity_penalty: 4,
min_validator_withdrawability_delay: Epoch::new(256), min_validator_withdrawability_delay: Epoch::new(256),
shard_committee_period: 256, shard_committee_period: 256,
proposer_reorg_cutoff_bps: 1667,
attestation_due_bps: 3333,
aggregate_due_bps: 6667,
sync_message_due_bps: 3333,
contribution_due_bps: 6667,
/* /*
* Reward and penalty quotients * Reward and penalty quotients
@@ -1429,8 +1456,7 @@ impl ChainSpec {
.expect("pow does not overflow"), .expect("pow does not overflow"),
whistleblower_reward_quotient_electra: u64::checked_pow(2, 12) whistleblower_reward_quotient_electra: u64::checked_pow(2, 12)
.expect("pow does not overflow"), .expect("pow does not overflow"),
max_pending_partials_per_withdrawals_sweep: u64::checked_pow(2, 3) max_pending_partials_per_withdrawals_sweep: 6,
.expect("pow does not overflow"),
min_per_epoch_churn_limit_electra: option_wrapper(|| { min_per_epoch_churn_limit_electra: option_wrapper(|| {
u64::checked_pow(2, 7)?.checked_mul(u64::checked_pow(10, 9)?) u64::checked_pow(2, 7)?.checked_mul(u64::checked_pow(10, 9)?)
}) })