Skip to content
1 change: 1 addition & 0 deletions beacon_node/beacon_chain/tests/store_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,7 @@ async fn proposer_shuffling_root_consistency_at_fork_boundary() {
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH: 18446744073709551615

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

# Forking
Expand All @@ -39,25 +39,34 @@ GENESIS_DELAY: 604800

# Altair
ALTAIR_FORK_VERSION: 0x01000000
ALTAIR_FORK_EPOCH: 74240 # Oct 27, 2021, 10:56:23am UTC
ALTAIR_FORK_EPOCH: 74240 # Oct 27, 2021, 10:56:23am UTC
# Bellatrix
BELLATRIX_FORK_VERSION: 0x02000000
BELLATRIX_FORK_EPOCH: 144896 # Sept 6, 2022, 11:34:47am UTC
BELLATRIX_FORK_EPOCH: 144896 # Sept 6, 2022, 11:34:47am UTC
# Capella
CAPELLA_FORK_VERSION: 0x03000000
CAPELLA_FORK_EPOCH: 194048 # April 12, 2023, 10:27:35pm UTC
CAPELLA_FORK_EPOCH: 194048 # April 12, 2023, 10:27:35pm UTC
# Deneb
DENEB_FORK_VERSION: 0x04000000
DENEB_FORK_EPOCH: 269568 # March 13, 2024, 01:55:35pm UTC
DENEB_FORK_EPOCH: 269568 # March 13, 2024, 01:55:35pm UTC
# Electra
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_FORK_VERSION: 0x06000000
FULU_FORK_EPOCH: 411392 # December 3, 2025, 09:49:11pm UTC
FULU_FORK_EPOCH: 411392 # December 3, 2025, 09:49:11pm UTC
# Gloas
GLOAS_FORK_VERSION: 0x07000000
GLOAS_FORK_VERSION: 0x07000000 # temporary stub
GLOAS_FORK_EPOCH: 18446744073709551615
# EIP7441
EIP7441_FORK_VERSION: 0x08000000 # temporary stub
EIP7441_FORK_EPOCH: 18446744073709551615
# EIP7805
EIP7805_FORK_VERSION: 0x0a000000 # temporary stub
EIP7805_FORK_EPOCH: 18446744073709551615
# EIP7928
EIP7928_FORK_VERSION: 0x0b000000 # temporary stub
EIP7928_FORK_EPOCH: 18446744073709551615

# Time parameters
# ---------------------------------------------------------------
Expand Down Expand Up @@ -86,6 +95,28 @@ SYNC_MESSAGE_DUE_BPS: 3333
# 6667 basis points, ~67% of SLOT_DURATION_MS
CONTRIBUTION_DUE_BPS: 6667

# Gloas
# 2**12 (= 4,096) epochs
MIN_BUILDER_WITHDRAWABILITY_DELAY: 4096
# 2500 basis points, 25% of SLOT_DURATION_MS
ATTESTATION_DUE_BPS_GLOAS: 2500
# 5000 basis points, 50% of SLOT_DURATION_MS
AGGREGATE_DUE_BPS_GLOAS: 5000
# 2500 basis points, 25% of SLOT_DURATION_MS
SYNC_MESSAGE_DUE_BPS_GLOAS: 2500
# 5000 basis points, 50% of SLOT_DURATION_MS
CONTRIBUTION_DUE_BPS_GLOAS: 5000
# 7500 basis points, 75% of SLOT_DURATION_MS
PAYLOAD_ATTESTATION_DUE_BPS: 7500

# EIP7805
# 7500 basis points, 75% of SLOT_DURATION_MS
VIEW_FREEZE_CUTOFF_BPS: 7500
# 6667 basis points, ~67% of SLOT_DURATION_MS
INCLUSION_LIST_SUBMISSION_DUE_BPS: 6667
# 9167 basis points, ~92% of SLOT_DURATION_MS
PROPOSER_INCLUSION_LIST_CUTOFF_BPS: 9167

# Validator cycle
# ---------------------------------------------------------------
# 2**2 (= 4)
Expand Down Expand Up @@ -137,10 +168,6 @@ MAX_REQUEST_BLOCKS: 1024
EPOCHS_PER_SUBNET_SUBSCRIPTION: 256
# MIN_VALIDATOR_WITHDRAWABILITY_DELAY + CHURN_LIMIT_QUOTIENT // 2 (= 33,024) epochs
MIN_EPOCHS_FOR_BLOCK_REQUESTS: 33024
# 5s
TTFB_TIMEOUT: 5
# 10s
RESP_TIMEOUT: 10
# 2**5 (= 32) slots
ATTESTATION_PROPAGATION_SLOT_RANGE: 32
# 500ms
Expand All @@ -154,9 +181,7 @@ ATTESTATION_SUBNET_COUNT: 64
# 0 bits
ATTESTATION_SUBNET_EXTRA_BITS: 0
# ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS (= 6 + 0) bits
# computed at runtime
ATTESTATION_SUBNET_PREFIX_BITS: 6
ATTESTATION_SUBNET_SHUFFLING_PREFIX_BITS: 3

# Deneb
# 2**7 (= 128) blocks
Expand Down Expand Up @@ -196,6 +221,22 @@ BALANCE_PER_ADDITIONAL_CUSTODY_GROUP: 32000000000
# 2**12 (= 4,096) epochs
MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS: 4096

# Gloas
# 2**7 (= 128) payloads
MAX_REQUEST_PAYLOADS: 128

# EIP7441
# 2**8 (= 256) epochs
EPOCHS_PER_SHUFFLING_PHASE: 256
# 2**1 (= 2) epochs
PROPOSER_SELECTION_GAP: 2

# EIP7805
# 2**4 (= 16) inclusion lists
MAX_REQUEST_INCLUSION_LIST: 16
# 2**13 (= 8,192) bytes
MAX_BYTES_PER_INCLUSION_LIST: 8192

# Blob Scheduling
# ---------------------------------------------------------------

Expand All @@ -204,5 +245,3 @@ BLOB_SCHEDULE:
MAX_BLOBS_PER_BLOCK: 15
- EPOCH: 419072 # January 7, 2026, 01:01:11am UTC
MAX_BLOBS_PER_BLOCK: 21

# Gloas
15 changes: 11 additions & 4 deletions consensus/state_processing/src/upgrade/gloas.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use bls::Hash256;
use milhouse::{List, Vector};
use ssz_types::BitVector;
use std::mem;
use typenum::Unsigned;
use types::{
BeaconState, BeaconStateError as Error, BeaconStateGloas, BuilderPendingPayment, ChainSpec,
EthSpec, ExecutionPayloadBid, Fork,
Expand Down Expand Up @@ -88,15 +88,23 @@ pub fn upgrade_state_to_gloas<E: EthSpec>(
pending_deposits: pre.pending_deposits.clone(),
pending_partial_withdrawals: pre.pending_partial_withdrawals.clone(),
pending_consolidations: pre.pending_consolidations.clone(),
proposer_lookahead: mem::take(&mut pre.proposer_lookahead),
// Gloas
execution_payload_availability: BitVector::default(), // All bits set to false initially
builders: List::default(),
next_withdrawal_builder_index: 0,
// All bits set to true per spec:
// execution_payload_availability = [0b1 for _ in range(SLOTS_PER_HISTORICAL_ROOT)]
execution_payload_availability: BitVector::from_bytes(
vec![0xFFu8; E::SlotsPerHistoricalRoot::to_usize() / 8].into(),
)
.map_err(|_| Error::InvalidBitfield)?,
builder_pending_payments: Vector::new(vec![
BuilderPendingPayment::default();
E::builder_pending_payments_limit()
])?,
builder_pending_withdrawals: List::default(), // Empty list initially,
latest_block_hash: pre.latest_execution_payload_header.block_hash,
latest_withdrawals_root: Hash256::default(),
payload_expected_withdrawals: List::default(),
// Caches
total_active_balance: pre.total_active_balance,
progressive_balances_cache: mem::take(&mut pre.progressive_balances_cache),
Expand All @@ -105,7 +113,6 @@ pub fn upgrade_state_to_gloas<E: EthSpec>(
exit_cache: mem::take(&mut pre.exit_cache),
slashings_cache: mem::take(&mut pre.slashings_cache),
epoch_cache: mem::take(&mut pre.epoch_cache),
proposer_lookahead: mem::take(&mut pre.proposer_lookahead),
});
Ok(post)
}
22 changes: 22 additions & 0 deletions consensus/types/presets/mainnet/gloas.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
# Mainnet preset - Gloas

# Misc
# ---------------------------------------------------------------
# 2**9 (= 512) validators
PTC_SIZE: 512

# Max operations per block
# ---------------------------------------------------------------
# 2**2 (= 4) attestations
MAX_PAYLOAD_ATTESTATIONS: 4

# State list lengths
# ---------------------------------------------------------------
# 2**40 (= 1,099,511,627,776) builder spots
BUILDER_REGISTRY_LIMIT: 1099511627776
# 2**20 (= 1,048,576) builder pending withdrawals
BUILDER_PENDING_WITHDRAWALS_LIMIT: 1048576

# Withdrawals processing
# ---------------------------------------------------------------
# 2**14 (= 16,384) builders
MAX_BUILDERS_PER_WITHDRAWALS_SWEEP: 16384
22 changes: 22 additions & 0 deletions consensus/types/presets/minimal/gloas.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
# Minimal preset - Gloas

# Misc
# ---------------------------------------------------------------
# [customized] 2**1 (= 2) validators
PTC_SIZE: 2

# Max operations per block
# ---------------------------------------------------------------
# 2**2 (= 4) attestations
MAX_PAYLOAD_ATTESTATIONS: 4

# State list lengths
# ---------------------------------------------------------------
# 2**40 (= 1,099,511,627,776) builder spots
BUILDER_REGISTRY_LIMIT: 1099511627776
# 2**20 (= 1,048,576) builder pending withdrawals
BUILDER_PENDING_WITHDRAWALS_LIMIT: 1048576

# Withdrawals processing
# ---------------------------------------------------------------
# [customized] 2**4 (= 16) builders
MAX_BUILDERS_PER_WITHDRAWALS_SWEEP: 16
2 changes: 2 additions & 0 deletions consensus/types/src/attestation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mod payload_attestation;
mod payload_attestation_data;
mod payload_attestation_message;
mod pending_attestation;
mod ptc;
mod selection_proof;
mod shuffling_id;
mod signed_aggregate_and_proof;
Expand All @@ -36,6 +37,7 @@ pub use payload_attestation::PayloadAttestation;
pub use payload_attestation_data::PayloadAttestationData;
pub use payload_attestation_message::PayloadAttestationMessage;
pub use pending_attestation::PendingAttestation;
pub use ptc::PTC;
pub use selection_proof::SelectionProof;
pub use shuffling_id::AttestationShufflingId;
pub use signed_aggregate_and_proof::{
Expand Down
4 changes: 2 additions & 2 deletions consensus/types/src/attestation/payload_attestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use bls::AggregateSignature;
use context_deserialize::context_deserialize;
use educe::Educe;
use serde::{Deserialize, Serialize};
use ssz::BitList;
use ssz::BitVector;
use ssz_derive::{Decode, Encode};
use test_random_derive::TestRandom;
use tree_hash_derive::TreeHash;
Expand All @@ -17,7 +17,7 @@ use tree_hash_derive::TreeHash;
#[educe(PartialEq, Hash)]
#[context_deserialize(ForkName)]
pub struct PayloadAttestation<E: EthSpec> {
pub aggregation_bits: BitList<E::PTCSize>,
pub aggregation_bits: BitVector<E::PTCSize>,
pub data: PayloadAttestationData,
pub signature: AggregateSignature,
}
Expand Down
23 changes: 23 additions & 0 deletions consensus/types/src/attestation/ptc.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use crate::EthSpec;
use ssz_types::FixedVector;

#[derive(Clone, Debug, PartialEq)]
pub struct PTC<E: EthSpec>(pub FixedVector<usize, E::PTCSize>);

impl<'a, E: EthSpec> IntoIterator for &'a PTC<E> {
type Item = &'a usize;
type IntoIter = std::slice::Iter<'a, usize>;

fn into_iter(self) -> Self::IntoIter {
self.0.iter()
}
}

impl<E: EthSpec> IntoIterator for PTC<E> {
type Item = usize;
type IntoIter = std::vec::IntoIter<usize>;

fn into_iter(self) -> Self::IntoIter {
self.0.into_iter()
}
}
24 changes: 24 additions & 0 deletions consensus/types/src/builder/builder.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use crate::test_utils::TestRandom;
use crate::{Address, Epoch};
use bls::PublicKeyBytes;
use serde::{Deserialize, Serialize};
use ssz_derive::{Decode, Encode};
use test_random_derive::TestRandom;
use tree_hash_derive::TreeHash;

pub type BuilderIndex = u64;

#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(
Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Encode, Decode, TestRandom, TreeHash,
)]
pub struct Builder {
pub pubkey: PublicKeyBytes,
#[serde(with = "serde_utils::quoted_u8")]
pub version: u8,
pub execution_address: Address,
#[serde(with = "serde_utils::quoted_u64")]
pub balance: u64,
pub deposit_epoch: Epoch,
pub withdrawable_epoch: Epoch,
}
3 changes: 1 addition & 2 deletions consensus/types/src/builder/builder_pending_withdrawal.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::test_utils::TestRandom;
use crate::{Address, Epoch, ForkName};
use crate::{Address, ForkName};
use context_deserialize::context_deserialize;
use serde::{Deserialize, Serialize};
use ssz_derive::{Decode, Encode};
Expand Down Expand Up @@ -29,7 +29,6 @@ pub struct BuilderPendingWithdrawal {
pub amount: u64,
#[serde(with = "serde_utils::quoted_u64")]
pub builder_index: u64,
pub withdrawable_epoch: Epoch,
}

#[cfg(test)]
Expand Down
2 changes: 2 additions & 0 deletions consensus/types/src/builder/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
mod builder;
mod builder_bid;
mod builder_pending_payment;
mod builder_pending_withdrawal;

pub use builder::{Builder, BuilderIndex};
pub use builder_bid::{
BuilderBid, BuilderBidBellatrix, BuilderBidCapella, BuilderBidDeneb, BuilderBidElectra,
BuilderBidFulu, SignedBuilderBid,
Expand Down
Loading