Skip to content

Unknown block for envelope#8992

Merged
mergify[bot] merged 6 commits intosigp:unstablefrom
eserilev:unknown-block-for-envelope
Mar 17, 2026
Merged

Unknown block for envelope#8992
mergify[bot] merged 6 commits intosigp:unstablefrom
eserilev:unknown-block-for-envelope

Conversation

@eserilev
Copy link
Member

Issue Addressed

Add a queue that allows us to reprocess an envelope when it arrives over gossip references a unknown block root. When the block is finally imported, we immediately reprocess the queued envelope.

Note that we don't trigger a block lookup sync. Incoming attestations for this block root will already trigger a lookup for us. I think thats good enough

@eserilev eserilev requested a review from jxs as a code owner March 16, 2026 08:03
@eserilev eserilev added ready-for-review The code is ready for review gloas labels Mar 16, 2026
Copy link
Member

@pawanjay176 pawanjay176 left a comment

Choose a reason for hiding this comment

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

Looks good as a whole.
Just a suggestion, curious what you think. I'm also not fully sure what's a good way to avoid DoS

}

// Check to ensure this won't over-fill the queue.
if self.awaiting_envelopes_per_root.len() >= MAXIMUM_QUEUED_ENVELOPES {
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit unsure of this mechanism.

When we are adding stuff to this queue, the envelope hasn't gone through any kind of verification, so we could potentially get DoS'd with garbage envelopes even before the block comes in and fill up this queue.

The awaiting_envelopes_per_root container currently is behaving in a FIFO manner. I wonder if the better mechanism is to do LIFO where we evict older entries to make space for newer entries. I don't think that completely protects us from dos but its harder to dos if it becomes timing dependent.
For a later TODO, We should probably do some lightweight pre-validation when we receive an envelope (check builder signature for e.g)

Copy link
Member Author

Choose a reason for hiding this comment

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

ive switched the queue to LIFO and added a TODO about performing early sig verification checks

work_queues.delayed_block_queue.push(work, work_id)
}
Work::DelayedImportEnvelope { .. } => {
work_queues.delayed_block_queue.push(work, work_id)
Copy link
Member

Choose a reason for hiding this comment

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

Thoughts on having a different queue here for delayed envelopes?

Copy link
Member Author

@eserilev eserilev Mar 17, 2026

Choose a reason for hiding this comment

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

i introduced a new delayed_envelope_queue

Copy link
Member

@michaelsproul michaelsproul left a comment

Choose a reason for hiding this comment

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

Looks good, nice clean impl. Just had one small question

@michaelsproul
Copy link
Member

We need something like this for blocks where their parent envelope is unknown too, right?

@mergify
Copy link

mergify bot commented Mar 17, 2026

Some required checks have failed. Could you please take a look @eserilev? 🙏

@mergify mergify bot added waiting-on-author The reviewer has suggested changes and awaits thier implementation. and removed ready-for-review The code is ready for review labels Mar 17, 2026
@eserilev eserilev added ready-for-review The code is ready for review and removed waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels Mar 17, 2026
Copy link
Member

@michaelsproul michaelsproul left a comment

Choose a reason for hiding this comment

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

Looks good, let's ship

@michaelsproul michaelsproul added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review labels Mar 17, 2026
@mergify mergify bot added the queued label Mar 17, 2026
@mergify
Copy link

mergify bot commented Mar 17, 2026

Merge Queue Status

This pull request spent 28 minutes 20 seconds in the queue, including 26 minutes 5 seconds running CI.

Required conditions to merge

mergify bot added a commit that referenced this pull request Mar 17, 2026
@mergify mergify bot merged commit 17d183e into sigp:unstable Mar 17, 2026
37 checks passed
@mergify mergify bot removed the queued label Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gloas ready-for-merge This PR is ready to merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants