Skip to content

Commit bd68143

Browse files
jimmygchenmichaelsproulshane-mooreethDreamer
committed
Updated consensus types for gloas 1.7.0-alpha.1.
Co-authored-by: Michael Sproul <michael@sigmaprime.io> Co-authored-by: shane-moore <skm1790@gmail.com> Co-authored-by: ethDreamer <37123614+ethdreamer@users.noreply.github.com>
1 parent 33e41d3 commit bd68143

File tree

24 files changed

+644
-98
lines changed

24 files changed

+644
-98
lines changed

beacon_node/operation_pool/src/bls_to_execution_changes.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,18 @@ impl<E: EthSpec> BlsToExecutionChanges<E> {
113113
.validators()
114114
.get(validator_index as usize)
115115
.is_none_or(|validator| {
116-
let prune = validator.has_execution_withdrawal_credential(spec)
117-
&& head_block
118-
.message()
119-
.body()
120-
.bls_to_execution_changes()
121-
.map_or(true, |recent_changes| {
122-
!recent_changes
123-
.iter()
124-
.any(|c| c.message.validator_index == validator_index)
125-
});
116+
let prune = validator.has_execution_withdrawal_credential(
117+
spec,
118+
head_state.fork_name_unchecked(),
119+
) && head_block
120+
.message()
121+
.body()
122+
.bls_to_execution_changes()
123+
.map_or(true, |recent_changes| {
124+
!recent_changes
125+
.iter()
126+
.any(|c| c.message.validator_index == validator_index)
127+
});
126128
if prune {
127129
validator_indices_pruned.push(validator_index);
128130
}

beacon_node/operation_pool/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,12 @@ impl<E: EthSpec> OperationPool<E> {
582582
address_change.signature_is_still_valid(&state.fork())
583583
&& state
584584
.get_validator(address_change.as_inner().message.validator_index as usize)
585-
.is_ok_and(|validator| !validator.has_execution_withdrawal_credential(spec))
585+
.is_ok_and(|validator| {
586+
!validator.has_execution_withdrawal_credential(
587+
spec,
588+
state.fork_name_unchecked(),
589+
)
590+
})
586591
},
587592
|address_change| address_change.as_inner().clone(),
588593
E::MaxBlsToExecutionChanges::to_usize(),

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/per_block_processing.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ pub fn get_expected_withdrawals<E: EthSpec>(
566566
index: withdrawal_index,
567567
validator_index: withdrawal.validator_index,
568568
address: validator
569-
.get_execution_withdrawal_address(spec)
569+
.get_execution_withdrawal_address(spec, state.fork_name_unchecked())
570570
.ok_or(BeaconStateError::NonExecutionAddressWithdrawalCredential)?,
571571
amount: withdrawable_balance,
572572
});
@@ -603,7 +603,7 @@ pub fn get_expected_withdrawals<E: EthSpec>(
603603
index: withdrawal_index,
604604
validator_index,
605605
address: validator
606-
.get_execution_withdrawal_address(spec)
606+
.get_execution_withdrawal_address(spec, fork_name)
607607
.ok_or(BlockProcessingError::WithdrawalCredentialsInvalid)?,
608608
amount: balance,
609609
});
@@ -613,7 +613,7 @@ pub fn get_expected_withdrawals<E: EthSpec>(
613613
index: withdrawal_index,
614614
validator_index,
615615
address: validator
616-
.get_execution_withdrawal_address(spec)
616+
.get_execution_withdrawal_address(spec, fork_name)
617617
.ok_or(BlockProcessingError::WithdrawalCredentialsInvalid)?,
618618
amount: balance.safe_sub(validator.get_max_effective_balance(spec, fork_name))?,
619619
});

consensus/state_processing/src/per_block_processing/process_operations.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,10 @@ pub fn process_withdrawal_requests<E: EthSpec>(
514514

515515
let validator = state.get_validator(validator_index)?;
516516
// Verify withdrawal credentials
517-
let has_correct_credential = validator.has_execution_withdrawal_credential(spec);
517+
let has_correct_credential =
518+
validator.has_execution_withdrawal_credential(spec, state.fork_name_unchecked());
518519
let is_correct_source_address = validator
519-
.get_execution_withdrawal_address(spec)
520+
.get_execution_withdrawal_address(spec, state.fork_name_unchecked())
520521
.map(|addr| addr == request.source_address)
521522
.unwrap_or(false);
522523

@@ -561,7 +562,7 @@ pub fn process_withdrawal_requests<E: EthSpec>(
561562
.safe_add(pending_balance_to_withdraw)?;
562563

563564
// Only allow partial withdrawals with compounding withdrawal credentials
564-
if validator.has_compounding_withdrawal_credential(spec)
565+
if validator.has_compounding_withdrawal_credential(spec, state.fork_name_unchecked())
565566
&& has_sufficient_effective_balance
566567
&& has_excess_balance
567568
{
@@ -730,7 +731,9 @@ pub fn process_consolidation_request<E: EthSpec>(
730731

731732
let source_validator = state.get_validator(source_index)?;
732733
// Verify the source withdrawal credentials
733-
if let Some(withdrawal_address) = source_validator.get_execution_withdrawal_address(spec) {
734+
if let Some(withdrawal_address) =
735+
source_validator.get_execution_withdrawal_address(spec, state.fork_name_unchecked())
736+
{
734737
if withdrawal_address != consolidation_request.source_address {
735738
return Ok(());
736739
}
@@ -741,7 +744,7 @@ pub fn process_consolidation_request<E: EthSpec>(
741744

742745
let target_validator = state.get_validator(target_index)?;
743746
// Verify the target has compounding withdrawal credentials
744-
if !target_validator.has_compounding_withdrawal_credential(spec) {
747+
if !target_validator.has_compounding_withdrawal_credential(spec, state.fork_name_unchecked()) {
745748
return Ok(());
746749
}
747750

consensus/state_processing/src/upgrade/electra.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub fn upgrade_to_electra<E: EthSpec>(
8282
// Ensure early adopters of compounding credentials go through the activation churn
8383
let validators = post.validators().clone();
8484
for (index, validator) in validators.iter().enumerate() {
85-
if validator.has_compounding_withdrawal_credential(spec) {
85+
if validator.has_compounding_withdrawal_credential(spec, post.fork_name_unchecked()) {
8686
post.queue_excess_active_balance(index, spec)?;
8787
}
8888
}

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+
.expect("SlotsPerHistoricalRoot is always divisible by 8"),
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::{

0 commit comments

Comments
 (0)