Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 30 additions & 6 deletions block_producer/src/block_producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1407,12 +1407,36 @@ impl<P: Preset, W: Wait> BlockBuildContext<P, W> {
let mut exits = self.producer_context.voluntary_exits.lock().await;

let split_index = itertools::partition(exits.iter_mut(), |voluntary_exit| {
unphased::validate_voluntary_exit(
&self.producer_context.chain_config,
&self.producer_context.pubkey_cache,
&self.beacon_state,
*voluntary_exit,
)
match self.beacon_state.as_ref() {
BeaconState::Phase0(_)
| BeaconState::Altair(_)
| BeaconState::Bellatrix(_)
| BeaconState::Capella(_)
| BeaconState::Deneb(_) => unphased::validate_voluntary_exit(
&self.producer_context.chain_config,
&self.producer_context.pubkey_cache,
&self.beacon_state,
*voluntary_exit,
),
BeaconState::Electra(state) => electra::validate_voluntary_exit(
&self.producer_context.chain_config,
&self.producer_context.pubkey_cache,
state,
*voluntary_exit,
),
BeaconState::Fulu(state) => electra::validate_voluntary_exit(
&self.producer_context.chain_config,
&self.producer_context.pubkey_cache,
state,
*voluntary_exit,
),
BeaconState::Gloas(state) => gloas::validate_voluntary_exit(
&self.producer_context.chain_config,
&self.producer_context.pubkey_cache,
state,
*voluntary_exit,
),
}
.is_ok()
});

Expand Down
16 changes: 15 additions & 1 deletion http_api/src/full_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use types::{
bellatrix::primitives::Gas,
capella::consts::DOMAIN_BLS_TO_EXECUTION_CHANGE,
config::Config,
gloas::consts::{DOMAIN_BEACON_BUILDER, DOMAIN_PROPOSER_PREFERENCES, DOMAIN_PTC_ATTESTER},
nonstandard::Phase,
phase0::{
consts::{
Expand All @@ -36,7 +37,7 @@ use types::{
},
preset::{
AltairPreset, BellatrixPreset, CapellaPreset, DenebPreset, ElectraPreset, FuluPreset,
Phase0Preset, Preset,
GloasPreset, Phase0Preset, Preset,
},
};

Expand All @@ -59,6 +60,8 @@ pub struct FullConfig {
#[serde(flatten)]
fulu_preset: FuluPreset,
#[serde(flatten)]
gloas_preset: GloasPreset,
#[serde(flatten)]
config: Arc<Config>,

// The remaining fields represent constants.
Expand Down Expand Up @@ -151,6 +154,11 @@ pub struct FullConfig {
// Capella domain types
domain_bls_to_execution_change: DomainType,

// Gloas domain types
domain_beacon_builder: DomainType,
domain_ptc_attester: DomainType,
domain_proposer_preferences: DomainType,

// TODO(feature/deneb): Add constants from the Polynomial Commitments specification if needed.

// Builder constants
Expand Down Expand Up @@ -204,6 +212,7 @@ impl FullConfig {
deneb_preset: DenebPreset::new::<P>(),
electra_preset: ElectraPreset::new::<P>(),
fulu_preset: FuluPreset::new::<P>(),
gloas_preset: GloasPreset::new::<P>(),

// Phase 0 miscellaneous beacon chain constants
base_rewards_per_epoch: BASE_REWARDS_PER_EPOCH,
Expand Down Expand Up @@ -263,6 +272,11 @@ impl FullConfig {
// Capella domain types
domain_bls_to_execution_change: DOMAIN_BLS_TO_EXECUTION_CHANGE,

// Gloas domain types
domain_beacon_builder: DOMAIN_BEACON_BUILDER,
domain_ptc_attester: DOMAIN_PTC_ATTESTER,
domain_proposer_preferences: DOMAIN_PROPOSER_PREFERENCES,

// Builder constants
builder_proposal_delay_tolerance: BUILDER_PROPOSAL_DELAY_TOLERANCE,
domain_application_builder: DOMAIN_APPLICATION_BUILDER,
Expand Down
12 changes: 8 additions & 4 deletions transition_functions/src/gloas/state_transition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,17 @@ pub fn verify_signatures<P: Preset>(
// Voluntary exits

for voluntary_exit in &block.message.body.voluntary_exits {
let validator_index = voluntary_exit.message.validator_index;
let pubkey = if let Some(builder_index) = misc::maybe_builder_index(validator_index) {
state.builders.get(builder_index)?.pubkey
} else {
*accessors::public_key(state, validator_index)?
};

verifier.verify_singular(
voluntary_exit.message.signing_root(config, state),
voluntary_exit.signature,
pubkey_cache.get_or_insert(*accessors::public_key(
state,
voluntary_exit.message.validator_index,
)?)?,
pubkey_cache.get_or_insert(pubkey)?,
SignatureKind::VoluntaryExit,
)?;
}
Expand Down
1 change: 1 addition & 0 deletions types/src/gloas/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub const INTERVALS_PER_SLOT_GLOAS: NonZeroUsize = nonzero!(4_usize);
// Domain types
pub const DOMAIN_BEACON_BUILDER: DomainType = H32(hex!("0B000000"));
pub const DOMAIN_PTC_ATTESTER: DomainType = H32(hex!("0C000000"));
pub const DOMAIN_PROPOSER_PREFERENCES: DomainType = H32(hex!("0D000000"));

// Payload status
pub const PAYLOAD_STATUS_EMPTY: PayloadStatus = 0u8;
Expand Down
4 changes: 2 additions & 2 deletions types/src/preset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ pub struct GloasPreset {
#[serde(with = "serde_utils::string_or_native")]
ptc_size: NonZeroU64,
#[serde(with = "serde_utils::string_or_native")]
max_payload_attestation: u64,
max_payload_attestations: u64,
#[serde(with = "serde_utils::string_or_native")]
builder_registry_limit: NonZeroU64,
#[serde(with = "serde_utils::string_or_native")]
Expand All @@ -1113,7 +1113,7 @@ impl GloasPreset {
pub fn new<P: Preset>() -> Self {
Self {
ptc_size: P::PtcSize::non_zero(),
max_payload_attestation: P::MaxPayloadAttestation::U64,
max_payload_attestations: P::MaxPayloadAttestation::U64,
builder_registry_limit: P::BuilderRegistryLimit::non_zero(),
builder_pending_withdrawals_limit: P::BuilderPendingWithdrawalsLimit::U64,
max_builders_per_withdrawals_sweep: P::MAX_BUILDERS_PER_WITHDRAWALS_SWEEP,
Expand Down
Loading