mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-23 06:44:35 +00:00
Update to superstruct v0.4.1 (#2886)
## Proposed Changes Update `superstruct` to bring in @realbigsean's fixes necessary for MEV-compatible private beacon block types (a la #2795). The refactoring is due to another change in superstruct that allows partial getters to be auto-generated.
This commit is contained in:
@@ -1099,6 +1099,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
.message()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.ok()
|
||||
.map(|ep| ep.block_hash),
|
||||
})
|
||||
})
|
||||
@@ -2602,7 +2603,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
}
|
||||
|
||||
// Register sync aggregate with validator monitor
|
||||
if let Some(sync_aggregate) = block.body().sync_aggregate() {
|
||||
if let Ok(sync_aggregate) = block.body().sync_aggregate() {
|
||||
// `SyncCommittee` for the sync_aggregate should correspond to the duty slot
|
||||
let duty_epoch = block.slot().epoch(T::EthSpec::slots_per_epoch());
|
||||
let sync_committee = self.sync_committee_at_epoch(duty_epoch)?;
|
||||
@@ -2643,7 +2644,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
block.body().attestations().len() as f64,
|
||||
);
|
||||
|
||||
if let Some(sync_aggregate) = block.body().sync_aggregate() {
|
||||
if let Ok(sync_aggregate) = block.body().sync_aggregate() {
|
||||
metrics::set_gauge(
|
||||
&metrics::BLOCK_SYNC_AGGREGATE_SET_BITS,
|
||||
sync_aggregate.num_set_bits() as i64,
|
||||
@@ -3241,6 +3242,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
.message()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.ok()
|
||||
.map(|ep| ep.block_hash);
|
||||
let is_merge_transition_complete = is_merge_transition_complete(&new_head.beacon_state);
|
||||
|
||||
@@ -3528,6 +3530,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
.message()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.ok()
|
||||
.map(|ep| ep.block_hash)
|
||||
.unwrap_or_else(Hash256::zero);
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ pub fn validate_execution_payload_for_gossip<T: BeaconChainTypes>(
|
||||
chain: &BeaconChain<T>,
|
||||
) -> Result<(), BlockError<T::EthSpec>> {
|
||||
// Only apply this validation if this is a merge beacon block.
|
||||
if let Some(execution_payload) = block.body().execution_payload() {
|
||||
if let Ok(execution_payload) = block.body().execution_payload() {
|
||||
// This logic should match `is_execution_enabled`. We use only the execution block hash of
|
||||
// the parent here in order to avoid loading the parent state during gossip verification.
|
||||
|
||||
@@ -289,6 +289,7 @@ pub async fn prepare_execution_payload<T: BeaconChainTypes>(
|
||||
.message()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.ok()
|
||||
.map(|ep| ep.block_hash)
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user