Skip to content

Conversation

@MariusVanDerWijden
Copy link
Member

@MariusVanDerWijden MariusVanDerWijden commented Jun 4, 2025

Implements a migration path for the blobpool slotter

@fjl fjl changed the title WIP: Peerdas slotter core/txpool/blobpool: peerdas slotter Jun 17, 2025
@MariusVanDerWijden MariusVanDerWijden changed the title core/txpool/blobpool: peerdas slotter core/txpool/blobpool: migrate billy for new slot size Jul 7, 2025
@MariusVanDerWijden MariusVanDerWijden changed the title core/txpool/blobpool: migrate billy for new slot size core/txpool/blobpool: migrate billy to new slot size Jul 7, 2025
// txBlobOverhead is an approximation of the overhead that an additional blob
// has on transaction size. This is added to the slotter to avoid
// tiny overflows causing all txs to move a shelf higher, wasting disk space.
txBlobOverhead = 2048
Copy link
Member

Choose a reason for hiding this comment

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

Just curious, is this a cautious estimate or based on a specific computation?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is an estimation based on specific computation :D
I computed the size of a bunch of blob transactions and found that the overhead is ~1300 bytes iirc. So 2048 kinda gives us a round estimate over that

Copy link
Member

@rjl493456442 rjl493456442 Jul 25, 2025

Choose a reason for hiding this comment

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

I think we should update this value.

The size of original proof is 48 bytes, while the new version cell proof is 128 * 48 = 6144, already beyond this constant.

Copy link
Member

Choose a reason for hiding this comment

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

Okay I bumped it to 6144, plus 64 of wiggle room.

if p.chain.Config().IsOsaka(head.Number, head.Time) {
// Check if we need to migrate our blob db to the new slotter
oldSlotSize := 135168
if os.Stat(filepath.Join(queuedir, fmt.Sprintf("bkt_%08d.bag", oldSlotSize))); err == nil {
Copy link
Member

Choose a reason for hiding this comment

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

These seems to be taking advantage of billy internals -- can we just open the db and use Infos() to get the current slot size?

Copy link
Member Author

Choose a reason for hiding this comment

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

We could, but that would mean we need to open the DB. I agree that this is not a super clean solution...

@fjl fjl added the osaka label Jul 10, 2025
@lightclient
Copy link
Member

@MariusVanDerWijden let me know what you think about this last commit. I think the best thing to do is probably make a PR to billy to improve the migration flow, but given the current interface it seems like this is the best we can do downstream without hard coding any billy-specific behavior.

@rjl493456442 rjl493456442 self-assigned this Jul 22, 2025
@lightclient lightclient force-pushed the peerdas-slotter branch 2 times, most recently from 76146a5 to 90502a0 Compare September 4, 2025 17:12
@lightclient
Copy link
Member

Okay I have updated the PR with a conversion step to convert v0 sidecars to v1 on startup. However, I wonder how useful this is since the code only runs on start up after Osaka has passed. So by the time this runs, I would guess most of the blobs actually do not have v0 sidecars.

@rjl493456442 since you made the initial comment, wdyt? Some other approaches we could take:

  1. migrate the DB once Osaka is scheduled, but don't convert sidecars
  2. do 1), but also convert the sidecars online after the fork passes (I shied away from this because of the comment in Clear() about how inefficient it is to iterate through all tx metas, but it could be done in another thread while yielding back locks throughout to not stop all progress.
  3. continue to migrate DB after Osaka passes on startup, but separately do online conversion like mentioned in 2).

Right now I'm leaning towards 2).

@lightclient
Copy link
Member

Updated in line with 2) as we discussed.

lightclient
lightclient previously approved these changes Sep 11, 2025
@MariusVanDerWijden
Copy link
Member Author

LGTM

@rjl493456442
Copy link
Member

[[ OLD GETH ]]
gary@dev:~/mount/eth-mainnet/geth/blobpool/limbo$ ls
bkt_00004096.bag  bkt_00266240.bag  bkt_00528384.bag  bkt_00790528.bag  bkt_01052672.bag  bkt_01314816.bag  bkt_01576960.bag  bkt_01839104.bag  bkt_02101248.bag
bkt_00135168.bag  bkt_00397312.bag  bkt_00659456.bag  bkt_00921600.bag  bkt_01183744.bag  bkt_01445888.bag  bkt_01708032.bag  bkt_01970176.bag  bkt_02232320.bag
gary@dev:~/mount/eth-mainnet/geth/blobpool/limbo$ ^C
gary@dev:~/mount/eth-mainnet/geth/blobpool/limbo$ ls

[[ AFTER MIGRATION ]]
bkt_00000008.bag  bkt_00141376.bag  bkt_00415936.bag  bkt_00690496.bag  bkt_00965056.bag  bkt_01239616.bag  bkt_01514176.bag  bkt_01788736.bag  bkt_02063296.bag  bkt_02337856.bag
bkt_00004096.bag  bkt_00278656.bag  bkt_00553216.bag  bkt_00827776.bag  bkt_01102336.bag  bkt_01376896.bag  bkt_01651456.bag  bkt_01926016.bag  bkt_02200576.bag
gary@dev:~/mount/eth-mainnet/geth/blobpool/limbo$ ls ../queue/
bkt_00000008.bag  bkt_00141376.bag  bkt_00415936.bag  bkt_00690496.bag  bkt_00965056.bag  bkt_01239616.bag  bkt_01514176.bag  bkt_01788736.bag  bkt_02063296.bag  bkt_02337856.bag
bkt_00004096.bag  bkt_00278656.bag  bkt_00553216.bag  bkt_00827776.bag  bkt_01102336.bag  bkt_01376896.bag  bkt_01651456.bag  bkt_01926016.bag  bkt_02200576.bag

rjl493456442 pushed a commit that referenced this pull request Sep 15, 2025
As a consequence of moving blob sidecar version migration code around,
we ended up building blocks with a mix of v0 and v1 blob transactions 
(different proof encoding in the sidecar).

This PR makes sure we are not building illegal blocks after Osaka. Blob 
migration is left for another PR.

Related issues and PRs:
- #31791
- #32347
- #31966
- #32235

---------

Signed-off-by: Csaba Kiraly <[email protected]>
@rjl493456442 rjl493456442 added this to the 1.16.4 milestone Sep 15, 2025
@rjl493456442 rjl493456442 merged commit df0bd89 into ethereum:master Sep 15, 2025
5 of 6 checks passed
Sahil-4555 pushed a commit to Sahil-4555/go-ethereum that referenced this pull request Oct 12, 2025
…32577)

As a consequence of moving blob sidecar version migration code around,
we ended up building blocks with a mix of v0 and v1 blob transactions 
(different proof encoding in the sidecar).

This PR makes sure we are not building illegal blocks after Osaka. Blob 
migration is left for another PR.

Related issues and PRs:
- ethereum#31791
- ethereum#32347
- ethereum#31966
- ethereum#32235

---------

Signed-off-by: Csaba Kiraly <[email protected]>
Sahil-4555 pushed a commit to Sahil-4555/go-ethereum that referenced this pull request Oct 12, 2025
Implements a migration path for the blobpool slotter

---------

Co-authored-by: lightclient <[email protected]>
Co-authored-by: lightclient <[email protected]>
Co-authored-by: Gary Rong <[email protected]>
billettc pushed a commit to streamingfast/go-ethereum that referenced this pull request Nov 12, 2025
Implements a migration path for the blobpool slotter

---------

Co-authored-by: lightclient <[email protected]>
Co-authored-by: lightclient <[email protected]>
Co-authored-by: Gary Rong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants