Skip to content

Commit 2716df1

Browse files
authored
Merge of #8344
2 parents b57d046 + bc301da commit 2716df1

File tree

5 files changed

+150
-38
lines changed

5 files changed

+150
-38
lines changed

beacon_node/beacon_chain/src/data_column_verification.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,22 @@ mod test {
850850
.build();
851851
harness.advance_slot();
852852

853+
// Check block generator timestamp conversion sanity.
854+
{
855+
let exec_block_generator = harness.execution_block_generator();
856+
assert_eq!(
857+
exec_block_generator
858+
.timestamp_to_slot_post_capella(exec_block_generator.osaka_time.unwrap()),
859+
0
860+
);
861+
assert_eq!(
862+
exec_block_generator.timestamp_to_slot_post_capella(
863+
exec_block_generator.osaka_time.unwrap() + harness.spec.seconds_per_slot
864+
),
865+
1
866+
);
867+
}
868+
853869
let verify_fn = |column_sidecar: DataColumnSidecar<E>| {
854870
GossipVerifiedDataColumn::<_>::new_for_block_publishing(
855871
column_sidecar.into(),

beacon_node/execution_layer/src/test_utils/execution_block_generator.rs

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use types::{
2121
Blob, ChainSpec, EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadBellatrix,
2222
ExecutionPayloadCapella, ExecutionPayloadDeneb, ExecutionPayloadElectra, ExecutionPayloadFulu,
2323
ExecutionPayloadGloas, ExecutionPayloadHeader, FixedBytesExtended, ForkName, Hash256,
24-
KzgProofs, Transaction, Transactions, Uint256,
24+
KzgProofs, Slot, Transaction, Transactions, Uint256,
2525
};
2626

2727
use super::DEFAULT_TERMINAL_BLOCK;
@@ -265,6 +265,37 @@ impl<E: EthSpec> ExecutionBlockGenerator<E> {
265265
ForkName::Bellatrix
266266
}
267267

268+
/// Get the timestamp at which `fork` activates.
269+
///
270+
/// This function will panic if the `fork` is not enabled or is `<= ForkName::Bellatrix`.
271+
pub fn get_fork_timestamp_post_capella(&self, fork: ForkName) -> u64 {
272+
match fork {
273+
ForkName::Gloas => self.amsterdam_time,
274+
ForkName::Fulu => self.osaka_time,
275+
ForkName::Electra => self.prague_time,
276+
ForkName::Deneb => self.cancun_time,
277+
ForkName::Capella => self.shanghai_time,
278+
_ => panic!("only the Capella fork or later is supported"),
279+
}
280+
.unwrap_or_else(|| panic!("fork is {fork} but no corresponding timestamp is set"))
281+
}
282+
283+
/// This is a slightly nasty method for converting timestamps to slots, but it will suffice
284+
/// until we can plumb through a slot clock.
285+
pub fn timestamp_to_slot_post_capella(&self, timestamp: u64) -> Slot {
286+
let fork = self.get_fork_at_timestamp(timestamp);
287+
let fork_epoch = self.spec.fork_epoch(fork).unwrap();
288+
let fork_timestamp = self.get_fork_timestamp_post_capella(fork);
289+
290+
// Number of slots since fork.
291+
let slot_offset = timestamp
292+
.checked_sub(fork_timestamp)
293+
.expect("timestamp should be >= fork timestamp")
294+
/ self.spec.seconds_per_slot;
295+
296+
fork_epoch.start_slot(E::slots_per_epoch()) + Slot::new(slot_offset)
297+
}
298+
268299
pub fn execution_block_by_number(&self, number: u64) -> Option<ExecutionBlock> {
269300
self.block_by_number(number)
270301
.map(|block| block.as_execution_block(self.terminal_total_difficulty))
@@ -734,9 +765,10 @@ impl<E: EthSpec> ExecutionBlockGenerator<E> {
734765
if fork_name.deneb_enabled() {
735766
// get random number between 0 and Max Blobs
736767
let mut rng = self.rng.lock();
737-
// TODO(EIP-7892): see FIXME below
738-
// FIXME: this will break with BPO forks. This function needs to calculate the epoch based on block timestamp..
739-
let max_blobs = self.spec.max_blobs_per_block_within_fork(fork_name) as usize;
768+
let epoch = self
769+
.timestamp_to_slot_post_capella(execution_payload.timestamp())
770+
.epoch(E::slots_per_epoch());
771+
let max_blobs = self.spec.max_blobs_per_block(epoch) as usize;
740772
let num_blobs = rng.random_range(self.min_blobs_count..=max_blobs);
741773
let (bundle, transactions) = generate_blobs(num_blobs, fork_name)?;
742774
for tx in Vec::from(transactions) {

common/eth2_network_config/built_in_network_configs/mainnet/config.yaml

Lines changed: 67 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ PRESET_BASE: 'mainnet'
66
# Free-form short name of the network that this configuration applies to - known
77
# canonical network names include:
88
# * 'mainnet' - there can be only one
9+
# * 'sepolia' - testnet
910
# * 'holesky' - testnet
11+
# * 'hoodi' - testnet
1012
# Must match the regex: [a-z0-9\-]
1113
CONFIG_NAME: 'mainnet'
1214

@@ -52,23 +54,37 @@ ELECTRA_FORK_VERSION: 0x05000000
5254
ELECTRA_FORK_EPOCH: 364032 # May 7, 2025, 10:05:11am UTC
5355
# Fulu
5456
FULU_FORK_VERSION: 0x06000000
55-
FULU_FORK_EPOCH: 18446744073709551615
57+
FULU_FORK_EPOCH: 411392 # December 3, 2025, 09:49:11pm UTC
5658
# Gloas
5759
GLOAS_FORK_VERSION: 0x07000000
5860
GLOAS_FORK_EPOCH: 18446744073709551615
5961

6062
# Time parameters
6163
# ---------------------------------------------------------------
62-
# 12 seconds
64+
# 12 seconds (*deprecated*)
6365
SECONDS_PER_SLOT: 12
66+
# 12000 milliseconds
67+
SLOT_DURATION_MS: 12000
6468
# 14 (estimate from Eth1 mainnet)
6569
SECONDS_PER_ETH1_BLOCK: 14
66-
# 2**8 (= 256) epochs ~27 hours
70+
# 2**8 (= 256) epochs
6771
MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256
68-
# 2**8 (= 256) epochs ~27 hours
72+
# 2**8 (= 256) epochs
6973
SHARD_COMMITTEE_PERIOD: 256
70-
# 2**11 (= 2,048) Eth1 blocks ~8 hours
74+
# 2**11 (= 2,048) Eth1 blocks
7175
ETH1_FOLLOW_DISTANCE: 2048
76+
# 1667 basis points, ~17% of SLOT_DURATION_MS
77+
PROPOSER_REORG_CUTOFF_BPS: 1667
78+
# 3333 basis points, ~33% of SLOT_DURATION_MS
79+
ATTESTATION_DUE_BPS: 3333
80+
# 6667 basis points, ~67% of SLOT_DURATION_MS
81+
AGGREGATE_DUE_BPS: 6667
82+
83+
# Altair
84+
# 3333 basis points, ~33% of SLOT_DURATION_MS
85+
SYNC_MESSAGE_DUE_BPS: 3333
86+
# 6667 basis points, ~67% of SLOT_DURATION_MS
87+
CONTRIBUTION_DUE_BPS: 6667
7288

7389
# Validator cycle
7490
# ---------------------------------------------------------------
@@ -78,13 +94,21 @@ INACTIVITY_SCORE_BIAS: 4
7894
INACTIVITY_SCORE_RECOVERY_RATE: 16
7995
# 2**4 * 10**9 (= 16,000,000,000) Gwei
8096
EJECTION_BALANCE: 16000000000
81-
# 2**2 (= 4)
97+
# 2**2 (= 4) validators
8298
MIN_PER_EPOCH_CHURN_LIMIT: 4
8399
# 2**16 (= 65,536)
84100
CHURN_LIMIT_QUOTIENT: 65536
85-
# [New in Deneb:EIP7514] 2**3 (= 8)
101+
102+
# Deneb
103+
# 2**3 (= 8) (*deprecated*)
86104
MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT: 8
87105

106+
# Electra
107+
# 2**7 * 10**9 (= 128,000,000,000) Gwei
108+
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 128000000000
109+
# 2**8 * 10**9 (= 256,000,000,000) Gwei
110+
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: 256000000000
111+
88112
# Fork choice
89113
# ---------------------------------------------------------------
90114
# 40%
@@ -93,7 +117,7 @@ PROPOSER_SCORE_BOOST: 40
93117
REORG_HEAD_WEIGHT_THRESHOLD: 20
94118
# 160%
95119
REORG_PARENT_WEIGHT_THRESHOLD: 160
96-
# `2` epochs
120+
# 2 epochs
97121
REORG_MAX_EPOCHS_SINCE_FINALIZATION: 2
98122

99123
# Deposit contract
@@ -105,64 +129,79 @@ DEPOSIT_CONTRACT_ADDRESS: 0x00000000219ab540356cBB839Cbe05303d7705Fa
105129

106130
# Networking
107131
# ---------------------------------------------------------------
108-
# `10 * 2**20` (= 10485760, 10 MiB)
132+
# 10 * 2**20 (= 10,485,760) bytes, 10 MiB
109133
MAX_PAYLOAD_SIZE: 10485760
110-
# `2**10` (= 1024)
134+
# 2**10 (= 1,024) blocks
111135
MAX_REQUEST_BLOCKS: 1024
112-
# `2**8` (= 256)
136+
# 2**8 (= 256) epochs
113137
EPOCHS_PER_SUBNET_SUBSCRIPTION: 256
114-
# `MIN_VALIDATOR_WITHDRAWABILITY_DELAY + CHURN_LIMIT_QUOTIENT // 2` (= 33024, ~5 months)
138+
# MIN_VALIDATOR_WITHDRAWABILITY_DELAY + CHURN_LIMIT_QUOTIENT // 2 (= 33,024) epochs
115139
MIN_EPOCHS_FOR_BLOCK_REQUESTS: 33024
116140
# 5s
117141
TTFB_TIMEOUT: 5
118142
# 10s
119143
RESP_TIMEOUT: 10
144+
# 2**5 (= 32) slots
120145
ATTESTATION_PROPAGATION_SLOT_RANGE: 32
121146
# 500ms
122147
MAXIMUM_GOSSIP_CLOCK_DISPARITY: 500
123148
MESSAGE_DOMAIN_INVALID_SNAPPY: 0x00000000
124149
MESSAGE_DOMAIN_VALID_SNAPPY: 0x01000000
125150
# 2 subnets per node
126151
SUBNETS_PER_NODE: 2
127-
# 2**8 (= 64)
152+
# 2**6 (= 64) subnets
128153
ATTESTATION_SUBNET_COUNT: 64
154+
# 0 bits
129155
ATTESTATION_SUBNET_EXTRA_BITS: 0
130-
# ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS
156+
# ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS (= 6 + 0) bits
131157
ATTESTATION_SUBNET_PREFIX_BITS: 6
132158
ATTESTATION_SUBNET_SHUFFLING_PREFIX_BITS: 3
133159

134160
# Deneb
135-
# `2**7` (=128)
161+
# 2**7 (= 128) blocks
136162
MAX_REQUEST_BLOCKS_DENEB: 128
137-
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK
138-
MAX_REQUEST_BLOB_SIDECARS: 768
139-
# `2**12` (= 4096 epochs, ~18 days)
163+
# 2**12 (= 4,096) epochs
140164
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096
141-
# `6`
165+
# 6 subnets
142166
BLOB_SIDECAR_SUBNET_COUNT: 6
143-
# `uint64(6)`
167+
# 6 blobs
144168
MAX_BLOBS_PER_BLOCK: 6
169+
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK (= 128 * 6) sidecars
170+
MAX_REQUEST_BLOB_SIDECARS: 768
145171

146172
# Electra
147-
# 2**7 * 10**9 (= 128,000,000,000)
148-
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 128000000000
149-
# 2**8 * 10**9 (= 256,000,000,000)
150-
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: 256000000000
151-
# `9`
173+
# 9 subnets
152174
BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: 9
153-
# `uint64(9)`
175+
# 9 blobs
154176
MAX_BLOBS_PER_BLOCK_ELECTRA: 9
155-
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_ELECTRA
177+
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_ELECTRA (= 128 * 9) sidecars
156178
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: 1152
157179

158180
# Fulu
181+
# 2**7 (= 128) groups
159182
NUMBER_OF_CUSTODY_GROUPS: 128
183+
# 2**7 (= 128) subnets
160184
DATA_COLUMN_SIDECAR_SUBNET_COUNT: 128
185+
# MAX_REQUEST_BLOCKS_DENEB * NUMBER_OF_COLUMNS (= 128 * 128) sidecars
161186
MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384
187+
# 2**3 (= 8) samples
162188
SAMPLES_PER_SLOT: 8
189+
# 2**2 (= 4) sidecars
163190
CUSTODY_REQUIREMENT: 4
191+
# 2**3 (= 8) sidecars
164192
VALIDATOR_CUSTODY_REQUIREMENT: 8
193+
# 2**5 * 10**9 (= 32,000,000,000) Gwei
165194
BALANCE_PER_ADDITIONAL_CUSTODY_GROUP: 32000000000
195+
# 2**12 (= 4,096) epochs
166196
MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS: 4096
167197

168-
# Gloas
198+
# Blob Scheduling
199+
# ---------------------------------------------------------------
200+
201+
BLOB_SCHEDULE:
202+
- EPOCH: 412672 # December 9, 2025, 02:21:11pm UTC
203+
MAX_BLOBS_PER_BLOCK: 15
204+
- EPOCH: 419072 # January 7, 2026, 01:01:11am UTC
205+
MAX_BLOBS_PER_BLOCK: 21
206+
207+
# Gloas

consensus/types/presets/gnosis/electra.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: 16
4141

4242
# Withdrawals processing
4343
# ---------------------------------------------------------------
44-
# 2**3 ( = 8) pending withdrawals
45-
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 8
44+
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 6
4645

4746
# Pending deposits processing
4847
# ---------------------------------------------------------------

consensus/types/src/chain_spec.rs

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,18 @@ pub struct ChainSpec {
8787
*/
8888
pub genesis_delay: u64,
8989
pub seconds_per_slot: u64,
90+
pub slot_duration_ms: u64,
9091
pub min_attestation_inclusion_delay: u64,
9192
pub min_seed_lookahead: Epoch,
9293
pub max_seed_lookahead: Epoch,
9394
pub min_epochs_to_inactivity_penalty: u64,
9495
pub min_validator_withdrawability_delay: Epoch,
9596
pub shard_committee_period: u64,
97+
pub proposer_reorg_cutoff_bps: u64,
98+
pub attestation_due_bps: u64,
99+
pub aggregate_due_bps: u64,
100+
pub sync_message_due_bps: u64,
101+
pub contribution_due_bps: u64,
96102

97103
/*
98104
* Reward and penalty quotients
@@ -964,12 +970,18 @@ impl ChainSpec {
964970
*/
965971
genesis_delay: 604800, // 7 days
966972
seconds_per_slot: 12,
973+
slot_duration_ms: 12000,
967974
min_attestation_inclusion_delay: 1,
968975
min_seed_lookahead: Epoch::new(1),
969976
max_seed_lookahead: Epoch::new(4),
970977
min_epochs_to_inactivity_penalty: 4,
971978
min_validator_withdrawability_delay: Epoch::new(256),
972979
shard_committee_period: 256,
980+
proposer_reorg_cutoff_bps: 1667,
981+
attestation_due_bps: 3333,
982+
aggregate_due_bps: 6667,
983+
sync_message_due_bps: 3333,
984+
contribution_due_bps: 6667,
973985

974986
/*
975987
* Reward and penalty quotients
@@ -1098,7 +1110,7 @@ impl ChainSpec {
10981110
* Fulu hard fork params
10991111
*/
11001112
fulu_fork_version: [0x06, 0x00, 0x00, 0x00],
1101-
fulu_fork_epoch: None,
1113+
fulu_fork_epoch: Some(Epoch::new(411392)),
11021114
custody_requirement: 4,
11031115
number_of_custody_groups: 128,
11041116
data_column_sidecar_subnet_count: 128,
@@ -1158,7 +1170,16 @@ impl ChainSpec {
11581170
/*
11591171
* Networking Fulu specific
11601172
*/
1161-
blob_schedule: BlobSchedule::default(),
1173+
blob_schedule: BlobSchedule::new(vec![
1174+
BlobParameters {
1175+
epoch: Epoch::new(412672),
1176+
max_blobs_per_block: 15,
1177+
},
1178+
BlobParameters {
1179+
epoch: Epoch::new(419072),
1180+
max_blobs_per_block: 21,
1181+
},
1182+
]),
11621183
min_epochs_for_data_column_sidecars_requests:
11631184
default_min_epochs_for_data_column_sidecars_requests(),
11641185
max_data_columns_by_root_request: default_data_columns_by_root_request(),
@@ -1310,12 +1331,18 @@ impl ChainSpec {
13101331
*/
13111332
genesis_delay: 6000, // 100 minutes
13121333
seconds_per_slot: 5,
1334+
slot_duration_ms: 5000,
13131335
min_attestation_inclusion_delay: 1,
13141336
min_seed_lookahead: Epoch::new(1),
13151337
max_seed_lookahead: Epoch::new(4),
13161338
min_epochs_to_inactivity_penalty: 4,
13171339
min_validator_withdrawability_delay: Epoch::new(256),
13181340
shard_committee_period: 256,
1341+
proposer_reorg_cutoff_bps: 1667,
1342+
attestation_due_bps: 3333,
1343+
aggregate_due_bps: 6667,
1344+
sync_message_due_bps: 3333,
1345+
contribution_due_bps: 6667,
13191346

13201347
/*
13211348
* Reward and penalty quotients
@@ -1429,8 +1456,7 @@ impl ChainSpec {
14291456
.expect("pow does not overflow"),
14301457
whistleblower_reward_quotient_electra: u64::checked_pow(2, 12)
14311458
.expect("pow does not overflow"),
1432-
max_pending_partials_per_withdrawals_sweep: u64::checked_pow(2, 3)
1433-
.expect("pow does not overflow"),
1459+
max_pending_partials_per_withdrawals_sweep: 6,
14341460
min_per_epoch_churn_limit_electra: option_wrapper(|| {
14351461
u64::checked_pow(2, 7)?.checked_mul(u64::checked_pow(10, 9)?)
14361462
})

0 commit comments

Comments
 (0)