Skip to content

Conversation

@alessandromazza98
Copy link
Contributor

This PR adds the latest_barrier method to the CheckpointExt trait with a default implementation.

This is an helper method that returns the latest barrier checkpoint in the history of this checkpoint, if any. It returns None if no barrier checkpoint is found in the history.

Copy link
Member

@julio4 julio4 left a comment

Choose a reason for hiding this comment

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

Curious to know in which case you are using this method?
history_staging could be related

@alessandromazza98
Copy link
Contributor Author

alessandromazza98 commented Dec 9, 2025

Curious to know in which case you are using this method? history_staging could be related

this method is definitely not 100% needed, meaning that I can already obtain that data without this helper method, but it's very helpful so that I don't have to perform this operation manually when I need it.

The history_staging is similar but it returns a Span including all history from latest barrier. But latest_barrier returns the specific barrier Checkpoint. This is useful when I know that I saved something in the context of the barrier checkpoint and I want to grab it.

an example, inside the build_payload fn of the Platform trait:

if let Some(latest_barrier) = payload.latest_barrier() {
	// clone is cheap because it's mostly Arc
	if let Some(built_payload) =
		latest_barrier.context().maybe_built_payload.clone()
	{
		return Ok(built_payload);
	}
}
// ... rest of the code

@julio4 julio4 merged commit 9502979 into flashbots:main Dec 9, 2025
4 checks passed
@alessandromazza98 alessandromazza98 deleted the ale/feat-checkpoint branch December 9, 2025 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants