Skip to content

Conversation

benaadams
Copy link
Member

@benaadams benaadams commented Mar 20, 2025

Resolves #8399

As raised by @nerolation in research post https://ethresear.ch/t/max-blobs-flag-economic-perspective/21798

@dataalways https://x.com/Data_Always/status/1902697542086721671

And also in the research paper https://arxiv.org/pdf/2502.12966

Blob inclusion is sub-optimal for the builder not taking into account priority fee and packing

Changes

  • Solve the 0/1 Knapsack problem to produce optimal blob packing; taking into account tx premium gas (which isn't paid on blobs perse)

Examples from mainnet

6 blobs -> 5 blobs -> 4 blobs; with premium fees to block producer going up x8.8 times

image

Switch to higher paying blobs

image

Switch to better paying blobs even if count drops (limited space to include blobs)

image

Better paying 3 blobs selected over 6 blobs; which causes count to drop to 3 (as max is 6, so the 6 blob tx can't be included as would take to 9)

image

Types of changes

What types of changes does your code introduce?

  • Optimization

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Copy link
Contributor

@Scooletz Scooletz left a comment

Choose a reason for hiding this comment

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

Minors

@benaadams benaadams requested a review from Scooletz March 21, 2025 10:02
Copy link
Contributor

@Scooletz Scooletz left a comment

Choose a reason for hiding this comment

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

Much better tests now with a stable random, a few cases and a non-trivial distribution of blob fees.

@benaadams benaadams merged commit d83f130 into master Mar 21, 2025
80 checks passed
@benaadams benaadams deleted the blob-packing branch March 21, 2025 11:57
@benaadams benaadams changed the title Pack blobs optimally during block production Pack blobs optimally by aggregate fees Apr 9, 2025
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.

Blob packing in block production is not optimal
4 participants