Skip to content
Merged
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
9 changes: 6 additions & 3 deletions beacon_node/store/src/partial_beacon_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,11 @@ where
)]
pub latest_execution_payload_header: ExecutionPayloadHeaderFulu<E>,

#[superstruct(only(Gloas), partial_getter(rename = "latest_execution_bid_gloas"))]
pub latest_execution_bid: ExecutionBid,
#[superstruct(
only(Gloas),
partial_getter(rename = "latest_execution_payload_bid_gloas")
)]
pub latest_execution_payload_bid: ExecutionPayloadBid,

// Capella
#[superstruct(only(Capella, Deneb, Electra, Fulu, Gloas))]
Expand Down Expand Up @@ -480,7 +483,7 @@ impl<E: EthSpec> TryInto<BeaconState<E>> for PartialBeaconState<E> {
current_sync_committee,
next_sync_committee,
inactivity_scores,
latest_execution_bid,
latest_execution_payload_bid,
next_withdrawal_index,
next_withdrawal_validator_index,
deposit_requests_start_index,
Expand Down
4 changes: 2 additions & 2 deletions consensus/state_processing/src/upgrade/gloas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use bls::Hash256;
use std::mem;
use types::{
BeaconState, BeaconStateError as Error, BeaconStateGloas, BitVector, BuilderPendingPayment,
ChainSpec, EthSpec, ExecutionBid, Fork, List, Vector,
ChainSpec, EthSpec, ExecutionPayloadBid, Fork, List, Vector,
};

/// Transform a `Fulu` state into a `Gloas` state.
Expand Down Expand Up @@ -68,7 +68,7 @@ pub fn upgrade_state_to_gloas<E: EthSpec>(
current_sync_committee: pre.current_sync_committee.clone(),
next_sync_committee: pre.next_sync_committee.clone(),
// Execution Bid
latest_execution_bid: ExecutionBid::default(),
latest_execution_payload_bid: ExecutionPayloadBid::default(),
// Capella
next_withdrawal_index: pre.next_withdrawal_index,
next_withdrawal_validator_index: pre.next_withdrawal_validator_index,
Expand Down
2 changes: 1 addition & 1 deletion consensus/types/src/beacon_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ impl<E: EthSpec, Payload: AbstractExecPayload<E>> EmptyBlock for BeaconBlockGloa
voluntary_exits: VariableList::empty(),
sync_aggregate: SyncAggregate::empty(),
bls_to_execution_changes: VariableList::empty(),
signed_execution_bid: SignedExecutionBid::empty(),
signed_execution_payload_bid: SignedExecutionPayloadBid::empty(),
payload_attestations: VariableList::empty(),
_phantom: PhantomData,
},
Expand Down
10 changes: 5 additions & 5 deletions consensus/types/src/beacon_block_body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ pub struct BeaconBlockBody<E: EthSpec, Payload: AbstractExecPayload<E> = FullPay
#[superstruct(only(Electra, Fulu))]
pub execution_requests: ExecutionRequests<E>,
#[superstruct(only(Gloas))]
pub signed_execution_bid: SignedExecutionBid,
pub signed_execution_payload_bid: SignedExecutionPayloadBid,
#[superstruct(only(Gloas))]
pub payload_attestations: VariableList<PayloadAttestation<E>, E::MaxPayloadAttestations>,
#[superstruct(only(Base, Altair, Gloas))]
Expand Down Expand Up @@ -533,7 +533,7 @@ impl<E: EthSpec> From<BeaconBlockBodyGloas<E, BlindedPayload<E>>>
voluntary_exits,
sync_aggregate,
bls_to_execution_changes,
signed_execution_bid,
signed_execution_payload_bid,
payload_attestations,
_phantom,
} = body;
Expand All @@ -549,7 +549,7 @@ impl<E: EthSpec> From<BeaconBlockBodyGloas<E, BlindedPayload<E>>>
voluntary_exits,
sync_aggregate,
bls_to_execution_changes,
signed_execution_bid,
signed_execution_payload_bid,
payload_attestations,
_phantom: PhantomData,
}
Expand Down Expand Up @@ -867,7 +867,7 @@ impl<E: EthSpec> From<BeaconBlockBodyGloas<E, FullPayload<E>>>
voluntary_exits,
sync_aggregate,
bls_to_execution_changes,
signed_execution_bid,
signed_execution_payload_bid,
payload_attestations,
_phantom,
} = body;
Expand All @@ -884,7 +884,7 @@ impl<E: EthSpec> From<BeaconBlockBodyGloas<E, FullPayload<E>>>
voluntary_exits,
sync_aggregate,
bls_to_execution_changes,
signed_execution_bid,
signed_execution_payload_bid,
payload_attestations,
_phantom: PhantomData,
},
Expand Down
4 changes: 2 additions & 2 deletions consensus/types/src/beacon_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ where
pub latest_execution_payload_header: ExecutionPayloadHeaderFulu<E>,
#[superstruct(only(Gloas))]
#[metastruct(exclude_from(tree_lists))]
pub latest_execution_bid: ExecutionBid,
pub latest_execution_payload_bid: ExecutionPayloadBid,
#[superstruct(only(Capella, Deneb, Electra, Fulu, Gloas), partial_getter(copy))]
#[serde(with = "serde_utils::quoted_u64")]
#[metastruct(exclude_from(tree_lists))]
Expand Down Expand Up @@ -2144,7 +2144,7 @@ impl<E: EthSpec> BeaconState<E> {
| BeaconState::Electra(_)
| BeaconState::Fulu(_) => true,
BeaconState::Gloas(state) => {
state.latest_execution_bid.block_hash == state.latest_block_hash
state.latest_execution_payload_bid.block_hash == state.latest_block_hash
}
}
}
Expand Down
21 changes: 0 additions & 21 deletions consensus/types/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1709,12 +1709,6 @@ pub struct Config {
#[serde(serialize_with = "serialize_fork_epoch")]
#[serde(deserialize_with = "deserialize_fork_epoch")]
pub gloas_fork_epoch: Option<MaybeQuoted<Epoch>>,
#[serde(default = "default_builder_payment_threshold_numerator")]
#[serde(with = "serde_utils::quoted_u64")]
pub builder_payment_threshold_numerator: u64,
#[serde(default = "default_builder_payment_threshold_denominator")]
#[serde(with = "serde_utils::quoted_u64")]
pub builder_payment_threshold_denominator: u64,

#[serde(with = "serde_utils::quoted_u64")]
seconds_per_slot: u64,
Expand Down Expand Up @@ -1878,14 +1872,6 @@ fn default_gloas_fork_version() -> [u8; 4] {
[0xff, 0xff, 0xff, 0xff]
}

fn default_builder_payment_threshold_numerator() -> u64 {
6
}

fn default_builder_payment_threshold_denominator() -> u64 {
10
}

/// Placeholder value: 2^256-2^10 (115792089237316195423570985008687907853269984665640564039457584007913129638912).
///
/// Taken from https://github.com/ethereum/consensus-specs/blob/d5e4828aecafaf1c57ef67a5f23c4ae7b08c5137/configs/mainnet.yaml#L15-L16
Expand Down Expand Up @@ -2190,9 +2176,6 @@ impl Config {
.gloas_fork_epoch
.map(|epoch| MaybeQuoted { value: epoch }),

builder_payment_threshold_numerator: spec.builder_payment_threshold_numerator,
builder_payment_threshold_denominator: spec.builder_payment_threshold_denominator,

seconds_per_slot: spec.seconds_per_slot,
seconds_per_eth1_block: spec.seconds_per_eth1_block,
min_validator_withdrawability_delay: spec.min_validator_withdrawability_delay,
Expand Down Expand Up @@ -2284,8 +2267,6 @@ impl Config {
fulu_fork_version,
gloas_fork_version,
gloas_fork_epoch,
builder_payment_threshold_numerator,
builder_payment_threshold_denominator,
seconds_per_slot,
seconds_per_eth1_block,
min_validator_withdrawability_delay,
Expand Down Expand Up @@ -2359,8 +2340,6 @@ impl Config {
fulu_fork_version,
gloas_fork_version,
gloas_fork_epoch: gloas_fork_epoch.map(|q| q.value),
builder_payment_threshold_numerator,
builder_payment_threshold_denominator,
seconds_per_slot,
seconds_per_eth1_block,
min_validator_withdrawability_delay,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ use tree_hash_derive::TreeHash;
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derivative(PartialEq, Hash)]
#[context_deserialize(ForkName)]
// This is what Potuz' spec calls an `ExecutionPayloadHeader` even though it's clearly a bid.
// https://github.com/ethereum/consensus-specs/blob/bba2c7be148d6d921d2ca5e1cc528f5daaf456d9/specs/gloas/beacon-chain.md#executionpayloadheader
pub struct ExecutionBid {
// https://github.com/ethereum/consensus-specs/blob/master/specs/gloas/beacon-chain.md#executionpayloadbid
pub struct ExecutionPayloadBid {
pub parent_block_hash: ExecutionBlockHash,
pub parent_block_root: Hash256,
pub block_hash: ExecutionBlockHash,
Expand All @@ -29,11 +28,11 @@ pub struct ExecutionBid {
pub blob_kzg_commitments_root: Hash256,
}

impl SignedRoot for ExecutionBid {}
impl SignedRoot for ExecutionPayloadBid {}

#[cfg(test)]
mod tests {
use super::*;

ssz_and_tree_hash_tests!(ExecutionBid);
ssz_and_tree_hash_tests!(ExecutionPayloadBid);
}
1 change: 1 addition & 0 deletions consensus/types/src/execution_payload_envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ pub struct ExecutionPayloadEnvelope<E: EthSpec> {
pub state_root: Hash256,
}

impl<E: EthSpec> SignedRoot for ExecutionPayloadEnvelope<E> {}
impl<'a, E: EthSpec> SignedRoot for ExecutionPayloadEnvelopeRef<'a, E> {}

impl<'a, E: EthSpec> ExecutionPayloadEnvelopeRef<'a, E> {
Expand Down
8 changes: 4 additions & 4 deletions consensus/types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ pub mod dumb_macros;
pub mod enr_fork_id;
pub mod eth1_data;
pub mod eth_spec;
pub mod execution_bid;
pub mod execution_block_hash;
pub mod execution_payload;
pub mod execution_payload_bid;
pub mod execution_payload_envelope;
pub mod execution_payload_header;
pub mod fork;
Expand Down Expand Up @@ -77,7 +77,7 @@ pub mod signed_beacon_block;
pub mod signed_beacon_block_header;
pub mod signed_bls_to_execution_change;
pub mod signed_contribution_and_proof;
pub mod signed_execution_bid;
pub mod signed_execution_payload_bid;
pub mod signed_execution_payload_envelope;
pub mod signed_voluntary_exit;
pub mod signing_data;
Expand Down Expand Up @@ -178,14 +178,14 @@ pub use crate::enr_fork_id::EnrForkId;
pub use crate::epoch_cache::{EpochCache, EpochCacheError, EpochCacheKey};
pub use crate::eth_spec::EthSpecId;
pub use crate::eth1_data::Eth1Data;
pub use crate::execution_bid::ExecutionBid;
pub use crate::execution_block_hash::ExecutionBlockHash;
pub use crate::execution_block_header::{EncodableExecutionBlockHeader, ExecutionBlockHeader};
pub use crate::execution_payload::{
ExecutionPayload, ExecutionPayloadBellatrix, ExecutionPayloadCapella, ExecutionPayloadDeneb,
ExecutionPayloadElectra, ExecutionPayloadFulu, ExecutionPayloadGloas, ExecutionPayloadRef,
Transaction, Transactions, Withdrawals,
};
pub use crate::execution_payload_bid::ExecutionPayloadBid;
pub use crate::execution_payload_envelope::{
ExecutionPayloadEnvelope, ExecutionPayloadEnvelopeGloas, ExecutionPayloadEnvelopeNextFork,
ExecutionPayloadEnvelopeRef,
Expand Down Expand Up @@ -266,7 +266,7 @@ pub use crate::signed_beacon_block::{
pub use crate::signed_beacon_block_header::SignedBeaconBlockHeader;
pub use crate::signed_bls_to_execution_change::SignedBlsToExecutionChange;
pub use crate::signed_contribution_and_proof::SignedContributionAndProof;
pub use crate::signed_execution_bid::SignedExecutionBid;
pub use crate::signed_execution_payload_bid::SignedExecutionPayloadBid;
pub use crate::signed_execution_payload_envelope::SignedExecutionPayloadEnvelope;
pub use crate::signed_voluntary_exit::SignedVoluntaryExit;
pub use crate::signing_data::{SignedRoot, SigningData};
Expand Down
2 changes: 1 addition & 1 deletion consensus/types/src/payload_attestation_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct PayloadAttestationMessage {
#[serde(with = "serde_utils::quoted_u64")]
pub validator_index: u64,
pub data: PayloadAttestationData,
pub signature: AggregateSignature,
pub signature: Signature,
}

#[cfg(test)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ use tree_hash_derive::TreeHash;
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derivative(PartialEq, Hash)]
#[context_deserialize(ForkName)]
// https://github.com/ethereum/consensus-specs/blob/bba2c7be148d6d921d2ca5e1cc528f5daaf456d9/specs/gloas/beacon-chain.md#signedexecutionpayloadheader
pub struct SignedExecutionBid {
pub message: ExecutionBid,
// https://github.com/ethereum/consensus-specs/blob/master/specs/gloas/beacon-chain.md#signedexecutionpayloadbid
pub struct SignedExecutionPayloadBid {
pub message: ExecutionPayloadBid,
pub signature: Signature,
}

impl SignedExecutionBid {
impl SignedExecutionPayloadBid {
pub fn empty() -> Self {
Self {
message: ExecutionBid::default(),
message: ExecutionPayloadBid::default(),
signature: Signature::empty(),
}
}
Expand All @@ -31,5 +31,5 @@ impl SignedExecutionBid {
mod tests {
use super::*;

ssz_and_tree_hash_tests!(SignedExecutionBid);
ssz_and_tree_hash_tests!(SignedExecutionPayloadBid);
}
20 changes: 20 additions & 0 deletions consensus/types/src/signed_execution_payload_envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,26 @@ pub struct SignedExecutionPayloadEnvelope<E: EthSpec> {
}

impl<E: EthSpec> SignedExecutionPayloadEnvelope<E> {
/// Create a new `SignedExecutionPayloadEnvelope` from an `ExecutionPayloadEnvelope` and `Signature`.
pub fn from_envelope(envelope: ExecutionPayloadEnvelope<E>, signature: Signature) -> Self {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is also not used so I would leave it out.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this helper is just used later in this VC block production PR here:
https://github.com/shane-moore/lighthouse/blob/4eac78c70d1b1cb046180d21b6f81ffa5d617d9a/validator_client/lighthouse_validator_store/src/lib.rs#L760-L784

perhaps I just add the from_envelope to that PR instead?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no that's fine we can leave this in then

match envelope {
ExecutionPayloadEnvelope::Gloas(message) => SignedExecutionPayloadEnvelope::Gloas(
signed_execution_payload_envelope::SignedExecutionPayloadEnvelopeGloas {
message,
signature,
},
),
ExecutionPayloadEnvelope::NextFork(message) => {
SignedExecutionPayloadEnvelope::NextFork(
signed_execution_payload_envelope::SignedExecutionPayloadEnvelopeNextFork {
message,
signature,
},
)
}
}
}

pub fn message(&self) -> ExecutionPayloadEnvelopeRef<'_, E> {
match self {
Self::Gloas(signed) => ExecutionPayloadEnvelopeRef::Gloas(&signed.message),
Expand Down
Loading