mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 04:37:13 +00:00
fix(focil): record inclusion list satisfaction on envelope import
The payload_inclusion_list_satisfaction map in fork choice was never being populated. This meant should_extend_payload always returned false, causing the Empty/Full tiebreaker to always favor Empty — resulting in payload envelopes being orphaned even when they satisfied the inclusion list. After importing a valid execution payload envelope, check whether its transactions satisfy the cached inclusion list entries for that slot and record the result in fork choice. This allows the tiebreaker to correctly favor Full when the IL is satisfied.
This commit is contained in:
@@ -255,6 +255,30 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
.on_valid_payload_envelope_received(block_root)
|
.on_valid_payload_envelope_received(block_root)
|
||||||
.map_err(|e| EnvelopeError::InternalError(format!("{e:?}")))?;
|
.map_err(|e| EnvelopeError::InternalError(format!("{e:?}")))?;
|
||||||
|
|
||||||
|
// Check if the envelope's payload satisfies the inclusion list for this slot.
|
||||||
|
// This is used by fork choice's `should_extend_payload` tiebreaker to decide
|
||||||
|
// whether Full or Empty wins when weights are equal.
|
||||||
|
let il_slot = signed_envelope.message().slot();
|
||||||
|
let il_satisfied = {
|
||||||
|
let il_cache = self.inclusion_list_cache.read();
|
||||||
|
if let Some(il_transactions) =
|
||||||
|
il_cache.get_inclusion_list_transactions(il_slot, false)
|
||||||
|
{
|
||||||
|
let envelope_message = signed_envelope.message();
|
||||||
|
let payload = envelope_message.payload();
|
||||||
|
let payload_transactions = payload.transactions();
|
||||||
|
let payload_tx_set: std::collections::HashSet<_> =
|
||||||
|
payload_transactions.iter().collect();
|
||||||
|
il_transactions.iter().all(|tx| payload_tx_set.contains(tx))
|
||||||
|
} else {
|
||||||
|
// No inclusion list for this slot — considered satisfied
|
||||||
|
true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fork_choice
|
||||||
|
.record_payload_inclusion_list_satisfaction(block_root, il_satisfied);
|
||||||
|
|
||||||
// TODO(gloas) emit SSE event if the payload became the new head payload
|
// TODO(gloas) emit SSE event if the payload became the new head payload
|
||||||
|
|
||||||
// It is important NOT to return errors here before the database commit, because the envelope
|
// It is important NOT to return errors here before the database commit, because the envelope
|
||||||
|
|||||||
Reference in New Issue
Block a user