Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(block-producer): order batches within a block #572

Merged
merged 2 commits into from
Dec 10, 2024

Conversation

Mirko-von-Leipzig
Copy link
Contributor

@Mirko-von-Leipzig Mirko-von-Leipzig commented Dec 9, 2024

As mentioned in this comment, this PR makes it clear that batches within a block have a given order. This intention signaling is improved by using a vector instead of a map (with accidental ordering). As alluded to in this comment from #397.

The current batch selection strategy just selects an arbitrary available root batch. A root batch by definition is one who's parents have already been selected previously; or in other words dependency order is enforced within the selection process.

The set of batches is then consumed in order by the block builder. Though it does use a BTreeMap which makes this a bit opaque (the keys form a sort of FIFO so ordering is kept), and I guess more or less implies that the ordering is accidental and not necessarily intentional.

This issue is technically complete but I'll create a PR changing the BTreeMap to a Vec so that this ordering is made more clear.

Closes #397.

Copy link
Contributor

@bobbinth bobbinth 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! Thank you! I left a couple of small comments inline.

crates/block-producer/src/mempool/mod.rs Show resolved Hide resolved
@Mirko-von-Leipzig Mirko-von-Leipzig force-pushed the mirko/refactor/order-batches branch from 6138c57 to b07c9e8 Compare December 10, 2024 07:10
@Mirko-von-Leipzig Mirko-von-Leipzig merged commit aaaef51 into next Dec 10, 2024
8 checks passed
@Mirko-von-Leipzig Mirko-von-Leipzig deleted the mirko/refactor/order-batches branch December 10, 2024 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants