mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-01 05:37:05 +00:00
Gloas alpha spec 8 (#9315)
https://github.com/ethereum/consensus-specs/releases/tag/v1.7.0-alpha.8 Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu> Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
@@ -640,6 +640,9 @@ impl ProtoArrayForkChoice {
|
||||
.map_err(|e| {
|
||||
format!("process_payload_attestation: data availability set failed: {e:?}")
|
||||
})?;
|
||||
v29.ptc_participation
|
||||
.set(ptc_index, true)
|
||||
.map_err(|e| format!("process_payload_attestation: participation set failed: {e:?}"))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -1006,6 +1009,33 @@ impl ProtoArrayForkChoice {
|
||||
})
|
||||
}
|
||||
|
||||
/// Called by the proposer to decide whether to build on the full or empty
|
||||
/// parent. Returns false if the PTC has voted the data as unavailable.
|
||||
pub fn should_build_on_full<E: EthSpec>(
|
||||
&self,
|
||||
block_root: &Hash256,
|
||||
parent_payload_status: PayloadStatus,
|
||||
) -> Result<bool, String> {
|
||||
let block_index = self
|
||||
.proto_array
|
||||
.indices
|
||||
.get(block_root)
|
||||
.ok_or_else(|| format!("Unknown block root: {block_root:?}"))?;
|
||||
let proto_node = self
|
||||
.proto_array
|
||||
.nodes
|
||||
.get(*block_index)
|
||||
.ok_or_else(|| format!("Missing node at index: {block_index}"))?;
|
||||
let fc_node = IndexedForkChoiceNode {
|
||||
root: proto_node.root(),
|
||||
proto_node_index: *block_index,
|
||||
payload_status: parent_payload_status,
|
||||
};
|
||||
self.proto_array
|
||||
.should_build_on_full::<E>(&fc_node, proto_node)
|
||||
.map_err(|e| format!("{e:?}"))
|
||||
}
|
||||
|
||||
/// Returns whether the proposer should extend the parent's execution payload chain.
|
||||
///
|
||||
/// This checks timeliness, data availability, and proposer boost conditions per the spec.
|
||||
|
||||
Reference in New Issue
Block a user