Skip to content

Commit 38790c9

Browse files
authored
Merge of #8688
2 parents 33e41d3 + f9e5b4c commit 38790c9

File tree

20 files changed

+471
-69
lines changed

20 files changed

+471
-69
lines changed

beacon_node/beacon_chain/tests/store_tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,7 @@ async fn proposer_shuffling_root_consistency_at_fork_boundary() {
13641364
}
13651365

13661366
#[tokio::test]
1367+
#[allow(clippy::large_stack_frames)]
13671368
async fn proposer_shuffling_changing_with_lookahead() {
13681369
let initial_blocks = E::slots_per_epoch() * 4 - 1;
13691370

common/eth2_network_config/built_in_network_configs/mainnet/config.yaml

Lines changed: 57 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH: 18446744073709551615
2222

2323
# Genesis
2424
# ---------------------------------------------------------------
25-
# `2**14` (= 16,384)
25+
# 2**14 (= 16,384) validators
2626
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 16384
2727
# Dec 1, 2020, 12pm UTC
2828
MIN_GENESIS_TIME: 1606824000
29-
# Mainnet initial fork version, recommend altering for testnets
29+
# Initial fork version for mainnet
3030
GENESIS_FORK_VERSION: 0x00000000
31-
# 604800 seconds (7 days)
31+
# 7 * 24 * 3,600 (= 604,800) seconds, 7 days
3232
GENESIS_DELAY: 604800
3333

3434
# Forking
@@ -39,25 +39,34 @@ GENESIS_DELAY: 604800
3939

4040
# Altair
4141
ALTAIR_FORK_VERSION: 0x01000000
42-
ALTAIR_FORK_EPOCH: 74240 # Oct 27, 2021, 10:56:23am UTC
42+
ALTAIR_FORK_EPOCH: 74240 # Oct 27, 2021, 10:56:23am UTC
4343
# Bellatrix
4444
BELLATRIX_FORK_VERSION: 0x02000000
45-
BELLATRIX_FORK_EPOCH: 144896 # Sept 6, 2022, 11:34:47am UTC
45+
BELLATRIX_FORK_EPOCH: 144896 # Sept 6, 2022, 11:34:47am UTC
4646
# Capella
4747
CAPELLA_FORK_VERSION: 0x03000000
48-
CAPELLA_FORK_EPOCH: 194048 # April 12, 2023, 10:27:35pm UTC
48+
CAPELLA_FORK_EPOCH: 194048 # April 12, 2023, 10:27:35pm UTC
4949
# Deneb
5050
DENEB_FORK_VERSION: 0x04000000
51-
DENEB_FORK_EPOCH: 269568 # March 13, 2024, 01:55:35pm UTC
51+
DENEB_FORK_EPOCH: 269568 # March 13, 2024, 01:55:35pm UTC
5252
# Electra
5353
ELECTRA_FORK_VERSION: 0x05000000
54-
ELECTRA_FORK_EPOCH: 364032 # May 7, 2025, 10:05:11am UTC
54+
ELECTRA_FORK_EPOCH: 364032 # May 7, 2025, 10:05:11am UTC
5555
# Fulu
5656
FULU_FORK_VERSION: 0x06000000
57-
FULU_FORK_EPOCH: 411392 # December 3, 2025, 09:49:11pm UTC
57+
FULU_FORK_EPOCH: 411392 # December 3, 2025, 09:49:11pm UTC
5858
# Gloas
59-
GLOAS_FORK_VERSION: 0x07000000
59+
GLOAS_FORK_VERSION: 0x07000000 # temporary stub
6060
GLOAS_FORK_EPOCH: 18446744073709551615
61+
# EIP7441
62+
EIP7441_FORK_VERSION: 0x08000000 # temporary stub
63+
EIP7441_FORK_EPOCH: 18446744073709551615
64+
# EIP7805
65+
EIP7805_FORK_VERSION: 0x0a000000 # temporary stub
66+
EIP7805_FORK_EPOCH: 18446744073709551615
67+
# EIP7928
68+
EIP7928_FORK_VERSION: 0x0b000000 # temporary stub
69+
EIP7928_FORK_EPOCH: 18446744073709551615
6170

6271
# Time parameters
6372
# ---------------------------------------------------------------
@@ -86,6 +95,28 @@ SYNC_MESSAGE_DUE_BPS: 3333
8695
# 6667 basis points, ~67% of SLOT_DURATION_MS
8796
CONTRIBUTION_DUE_BPS: 6667
8897

98+
# Gloas
99+
# 2**12 (= 4,096) epochs
100+
MIN_BUILDER_WITHDRAWABILITY_DELAY: 4096
101+
# 2500 basis points, 25% of SLOT_DURATION_MS
102+
ATTESTATION_DUE_BPS_GLOAS: 2500
103+
# 5000 basis points, 50% of SLOT_DURATION_MS
104+
AGGREGATE_DUE_BPS_GLOAS: 5000
105+
# 2500 basis points, 25% of SLOT_DURATION_MS
106+
SYNC_MESSAGE_DUE_BPS_GLOAS: 2500
107+
# 5000 basis points, 50% of SLOT_DURATION_MS
108+
CONTRIBUTION_DUE_BPS_GLOAS: 5000
109+
# 7500 basis points, 75% of SLOT_DURATION_MS
110+
PAYLOAD_ATTESTATION_DUE_BPS: 7500
111+
112+
# EIP7805
113+
# 7500 basis points, 75% of SLOT_DURATION_MS
114+
VIEW_FREEZE_CUTOFF_BPS: 7500
115+
# 6667 basis points, ~67% of SLOT_DURATION_MS
116+
INCLUSION_LIST_SUBMISSION_DUE_BPS: 6667
117+
# 9167 basis points, ~92% of SLOT_DURATION_MS
118+
PROPOSER_INCLUSION_LIST_CUTOFF_BPS: 9167
119+
89120
# Validator cycle
90121
# ---------------------------------------------------------------
91122
# 2**2 (= 4)
@@ -137,10 +168,6 @@ MAX_REQUEST_BLOCKS: 1024
137168
EPOCHS_PER_SUBNET_SUBSCRIPTION: 256
138169
# MIN_VALIDATOR_WITHDRAWABILITY_DELAY + CHURN_LIMIT_QUOTIENT // 2 (= 33,024) epochs
139170
MIN_EPOCHS_FOR_BLOCK_REQUESTS: 33024
140-
# 5s
141-
TTFB_TIMEOUT: 5
142-
# 10s
143-
RESP_TIMEOUT: 10
144171
# 2**5 (= 32) slots
145172
ATTESTATION_PROPAGATION_SLOT_RANGE: 32
146173
# 500ms
@@ -154,9 +181,7 @@ ATTESTATION_SUBNET_COUNT: 64
154181
# 0 bits
155182
ATTESTATION_SUBNET_EXTRA_BITS: 0
156183
# ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS (= 6 + 0) bits
157-
# computed at runtime
158184
ATTESTATION_SUBNET_PREFIX_BITS: 6
159-
ATTESTATION_SUBNET_SHUFFLING_PREFIX_BITS: 3
160185

161186
# Deneb
162187
# 2**7 (= 128) blocks
@@ -196,6 +221,22 @@ BALANCE_PER_ADDITIONAL_CUSTODY_GROUP: 32000000000
196221
# 2**12 (= 4,096) epochs
197222
MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS: 4096
198223

224+
# Gloas
225+
# 2**7 (= 128) payloads
226+
MAX_REQUEST_PAYLOADS: 128
227+
228+
# EIP7441
229+
# 2**8 (= 256) epochs
230+
EPOCHS_PER_SHUFFLING_PHASE: 256
231+
# 2**1 (= 2) epochs
232+
PROPOSER_SELECTION_GAP: 2
233+
234+
# EIP7805
235+
# 2**4 (= 16) inclusion lists
236+
MAX_REQUEST_INCLUSION_LIST: 16
237+
# 2**13 (= 8,192) bytes
238+
MAX_BYTES_PER_INCLUSION_LIST: 8192
239+
199240
# Blob Scheduling
200241
# ---------------------------------------------------------------
201242

@@ -204,5 +245,3 @@ BLOB_SCHEDULE:
204245
MAX_BLOBS_PER_BLOCK: 15
205246
- EPOCH: 419072 # January 7, 2026, 01:01:11am UTC
206247
MAX_BLOBS_PER_BLOCK: 21
207-
208-
# Gloas

consensus/state_processing/src/upgrade/gloas.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use bls::Hash256;
21
use milhouse::{List, Vector};
32
use ssz_types::BitVector;
43
use std::mem;
4+
use typenum::Unsigned;
55
use types::{
66
BeaconState, BeaconStateError as Error, BeaconStateGloas, BuilderPendingPayment, ChainSpec,
77
EthSpec, ExecutionPayloadBid, Fork,
@@ -88,15 +88,23 @@ pub fn upgrade_state_to_gloas<E: EthSpec>(
8888
pending_deposits: pre.pending_deposits.clone(),
8989
pending_partial_withdrawals: pre.pending_partial_withdrawals.clone(),
9090
pending_consolidations: pre.pending_consolidations.clone(),
91+
proposer_lookahead: mem::take(&mut pre.proposer_lookahead),
9192
// Gloas
92-
execution_payload_availability: BitVector::default(), // All bits set to false initially
93+
builders: List::default(),
94+
next_withdrawal_builder_index: 0,
95+
// All bits set to true per spec:
96+
// execution_payload_availability = [0b1 for _ in range(SLOTS_PER_HISTORICAL_ROOT)]
97+
execution_payload_availability: BitVector::from_bytes(
98+
vec![0xFFu8; E::SlotsPerHistoricalRoot::to_usize() / 8].into(),
99+
)
100+
.map_err(|_| Error::InvalidBitfield)?,
93101
builder_pending_payments: Vector::new(vec![
94102
BuilderPendingPayment::default();
95103
E::builder_pending_payments_limit()
96104
])?,
97105
builder_pending_withdrawals: List::default(), // Empty list initially,
98106
latest_block_hash: pre.latest_execution_payload_header.block_hash,
99-
latest_withdrawals_root: Hash256::default(),
107+
payload_expected_withdrawals: List::default(),
100108
// Caches
101109
total_active_balance: pre.total_active_balance,
102110
progressive_balances_cache: mem::take(&mut pre.progressive_balances_cache),
@@ -105,7 +113,6 @@ pub fn upgrade_state_to_gloas<E: EthSpec>(
105113
exit_cache: mem::take(&mut pre.exit_cache),
106114
slashings_cache: mem::take(&mut pre.slashings_cache),
107115
epoch_cache: mem::take(&mut pre.epoch_cache),
108-
proposer_lookahead: mem::take(&mut pre.proposer_lookahead),
109116
});
110117
Ok(post)
111118
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,23 @@
11
# Mainnet preset - Gloas
2+
3+
# Misc
4+
# ---------------------------------------------------------------
5+
# 2**9 (= 512) validators
6+
PTC_SIZE: 512
7+
8+
# Max operations per block
9+
# ---------------------------------------------------------------
10+
# 2**2 (= 4) attestations
11+
MAX_PAYLOAD_ATTESTATIONS: 4
12+
13+
# State list lengths
14+
# ---------------------------------------------------------------
15+
# 2**40 (= 1,099,511,627,776) builder spots
16+
BUILDER_REGISTRY_LIMIT: 1099511627776
17+
# 2**20 (= 1,048,576) builder pending withdrawals
18+
BUILDER_PENDING_WITHDRAWALS_LIMIT: 1048576
19+
20+
# Withdrawals processing
21+
# ---------------------------------------------------------------
22+
# 2**14 (= 16,384) builders
23+
MAX_BUILDERS_PER_WITHDRAWALS_SWEEP: 16384
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,23 @@
11
# Minimal preset - Gloas
2+
3+
# Misc
4+
# ---------------------------------------------------------------
5+
# [customized] 2**1 (= 2) validators
6+
PTC_SIZE: 2
7+
8+
# Max operations per block
9+
# ---------------------------------------------------------------
10+
# 2**2 (= 4) attestations
11+
MAX_PAYLOAD_ATTESTATIONS: 4
12+
13+
# State list lengths
14+
# ---------------------------------------------------------------
15+
# 2**40 (= 1,099,511,627,776) builder spots
16+
BUILDER_REGISTRY_LIMIT: 1099511627776
17+
# 2**20 (= 1,048,576) builder pending withdrawals
18+
BUILDER_PENDING_WITHDRAWALS_LIMIT: 1048576
19+
20+
# Withdrawals processing
21+
# ---------------------------------------------------------------
22+
# [customized] 2**4 (= 16) builders
23+
MAX_BUILDERS_PER_WITHDRAWALS_SWEEP: 16

consensus/types/src/attestation/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ mod payload_attestation;
1111
mod payload_attestation_data;
1212
mod payload_attestation_message;
1313
mod pending_attestation;
14+
mod ptc;
1415
mod selection_proof;
1516
mod shuffling_id;
1617
mod signed_aggregate_and_proof;
@@ -36,6 +37,7 @@ pub use payload_attestation::PayloadAttestation;
3637
pub use payload_attestation_data::PayloadAttestationData;
3738
pub use payload_attestation_message::PayloadAttestationMessage;
3839
pub use pending_attestation::PendingAttestation;
40+
pub use ptc::PTC;
3941
pub use selection_proof::SelectionProof;
4042
pub use shuffling_id::AttestationShufflingId;
4143
pub use signed_aggregate_and_proof::{

consensus/types/src/attestation/payload_attestation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use bls::AggregateSignature;
55
use context_deserialize::context_deserialize;
66
use educe::Educe;
77
use serde::{Deserialize, Serialize};
8-
use ssz::BitList;
8+
use ssz::BitVector;
99
use ssz_derive::{Decode, Encode};
1010
use test_random_derive::TestRandom;
1111
use tree_hash_derive::TreeHash;
@@ -17,7 +17,7 @@ use tree_hash_derive::TreeHash;
1717
#[educe(PartialEq, Hash)]
1818
#[context_deserialize(ForkName)]
1919
pub struct PayloadAttestation<E: EthSpec> {
20-
pub aggregation_bits: BitList<E::PTCSize>,
20+
pub aggregation_bits: BitVector<E::PTCSize>,
2121
pub data: PayloadAttestationData,
2222
pub signature: AggregateSignature,
2323
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
use crate::EthSpec;
2+
use ssz_types::FixedVector;
3+
4+
#[derive(Clone, Debug, PartialEq)]
5+
pub struct PTC<E: EthSpec>(pub FixedVector<usize, E::PTCSize>);
6+
7+
impl<'a, E: EthSpec> IntoIterator for &'a PTC<E> {
8+
type Item = &'a usize;
9+
type IntoIter = std::slice::Iter<'a, usize>;
10+
11+
fn into_iter(self) -> Self::IntoIter {
12+
self.0.iter()
13+
}
14+
}
15+
16+
impl<E: EthSpec> IntoIterator for PTC<E> {
17+
type Item = usize;
18+
type IntoIter = std::vec::IntoIter<usize>;
19+
20+
fn into_iter(self) -> Self::IntoIter {
21+
self.0.into_iter()
22+
}
23+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
use crate::test_utils::TestRandom;
2+
use crate::{Address, Epoch};
3+
use bls::PublicKeyBytes;
4+
use serde::{Deserialize, Serialize};
5+
use ssz_derive::{Decode, Encode};
6+
use test_random_derive::TestRandom;
7+
use tree_hash_derive::TreeHash;
8+
9+
pub type BuilderIndex = u64;
10+
11+
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
12+
#[derive(
13+
Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Encode, Decode, TestRandom, TreeHash,
14+
)]
15+
pub struct Builder {
16+
pub pubkey: PublicKeyBytes,
17+
#[serde(with = "serde_utils::quoted_u8")]
18+
pub version: u8,
19+
pub execution_address: Address,
20+
#[serde(with = "serde_utils::quoted_u64")]
21+
pub balance: u64,
22+
pub deposit_epoch: Epoch,
23+
pub withdrawable_epoch: Epoch,
24+
}

consensus/types/src/builder/builder_pending_withdrawal.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::test_utils::TestRandom;
2-
use crate::{Address, Epoch, ForkName};
2+
use crate::{Address, ForkName};
33
use context_deserialize::context_deserialize;
44
use serde::{Deserialize, Serialize};
55
use ssz_derive::{Decode, Encode};
@@ -29,7 +29,6 @@ pub struct BuilderPendingWithdrawal {
2929
pub amount: u64,
3030
#[serde(with = "serde_utils::quoted_u64")]
3131
pub builder_index: u64,
32-
pub withdrawable_epoch: Epoch,
3332
}
3433

3534
#[cfg(test)]

0 commit comments

Comments
 (0)