mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-21 14:58:31 +00:00
Clarify name of on_valid_payload_envelope_received
This commit is contained in:
@@ -502,7 +502,7 @@ impl ForkChoiceTestDefinition {
|
||||
}
|
||||
Operation::ProcessExecutionPayload { block_root } => {
|
||||
fork_choice
|
||||
.on_execution_payload(block_root)
|
||||
.on_valid_payload_envelope_received(block_root)
|
||||
.unwrap_or_else(|e| {
|
||||
panic!(
|
||||
"on_execution_payload op at index {} returned error: {}",
|
||||
|
||||
@@ -768,12 +768,10 @@ impl ProtoArray {
|
||||
Ok(!has_equivocation)
|
||||
}
|
||||
|
||||
/// Process an execution payload for a Gloas block.
|
||||
/// Process a valid execution payload envelope for a Gloas block.
|
||||
///
|
||||
/// Sets `payload_received` to true, which makes `is_payload_timely` and
|
||||
/// `is_payload_data_available` return true regardless of PTC votes.
|
||||
/// This maps to `store.payload_states[root] = state` in the spec.
|
||||
pub fn on_valid_execution_payload(&mut self, block_root: Hash256) -> Result<(), Error> {
|
||||
/// Sets `payload_received` to true.
|
||||
pub fn on_valid_payload_envelope_received(&mut self, block_root: Hash256) -> Result<(), Error> {
|
||||
let index = *self
|
||||
.indices
|
||||
.get(&block_root)
|
||||
@@ -809,6 +807,8 @@ impl ProtoArray {
|
||||
|
||||
/// Updates the `verified_node_index` and all ancestors to have validated execution payloads.
|
||||
///
|
||||
/// This function is a no-op if called for a Gloas block.
|
||||
///
|
||||
/// Returns an error if:
|
||||
///
|
||||
/// - The `verified_node_index` is unknown.
|
||||
@@ -852,18 +852,10 @@ impl ProtoArray {
|
||||
});
|
||||
}
|
||||
},
|
||||
// Gloas nodes don't carry `ExecutionStatus`. Mark the validated
|
||||
// block as payload-received so that `is_payload_timely` /
|
||||
// `is_payload_data_available` and `index == 1` attestations work.
|
||||
ProtoNode::V29(node) => {
|
||||
if index == verified_node_index {
|
||||
node.payload_received = true;
|
||||
}
|
||||
if let Some(parent_index) = node.parent {
|
||||
parent_index
|
||||
} else {
|
||||
return Ok(());
|
||||
}
|
||||
// Gloas nodes should not be marked valid by this function, which exists only
|
||||
// for pre-Gloas fork choice.
|
||||
ProtoNode::V29(_) => {
|
||||
return Ok(());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -874,6 +866,7 @@ impl ProtoArray {
|
||||
/// Invalidate zero or more blocks, as specified by the `InvalidationOperation`.
|
||||
///
|
||||
/// See the documentation of `InvalidationOperation` for usage.
|
||||
// TODO(gloas): this needs some tests for the mixed Gloas/pre-Gloas case.
|
||||
pub fn propagate_execution_payload_invalidation<E: EthSpec>(
|
||||
&mut self,
|
||||
op: &InvalidationOperation,
|
||||
|
||||
@@ -567,11 +567,18 @@ impl ProtoArrayForkChoice {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn on_execution_payload(&mut self, block_root: Hash256) -> Result<(), String> {
|
||||
/// Mark a Gloas payload envelope as valid and received.
|
||||
///
|
||||
/// This must only be called for valid Gloas payloads.
|
||||
pub fn on_valid_payload_envelope_received(
|
||||
&mut self,
|
||||
block_root: Hash256,
|
||||
) -> Result<(), String> {
|
||||
self.proto_array
|
||||
.on_valid_execution_payload(block_root)
|
||||
.on_valid_payload_envelope_received(block_root)
|
||||
.map_err(|e| format!("Failed to process execution payload: {:?}", e))
|
||||
}
|
||||
|
||||
/// See `ProtoArray::propagate_execution_payload_validation` for documentation.
|
||||
pub fn process_execution_payload_validation(
|
||||
&mut self,
|
||||
|
||||
Reference in New Issue
Block a user