From 71c1d7c84e27cc9d25542516340662d61aa89183 Mon Sep 17 00:00:00 2001 From: MariusVanDerWijden Date: Mon, 7 Jul 2025 18:59:01 +0200 Subject: [PATCH] core/txpool/blobpool: migrate blobpool --- core/txpool/blobpool/blobpool.go | 33 +++----------------------------- 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/core/txpool/blobpool/blobpool.go b/core/txpool/blobpool/blobpool.go index 699bb9fb65..ad3b63f2a1 100644 --- a/core/txpool/blobpool/blobpool.go +++ b/core/txpool/blobpool/blobpool.go @@ -358,35 +358,6 @@ func (p *BlobPool) Filter(tx *types.Transaction) bool { return tx.Type() == types.BlobTxType } -// migrateBilly migrates the blob data from one billy instance to another one -// with a different slotter. -func migrateBilly(path string, maxBlobs int) error { - oldSlotter := newSlotter(maxBlobs) - newSlotter := newSlotterEIP7594(maxBlobs) - // Open the new billy instance - newStore, err := billy.Open(billy.Options{Path: path, Repair: true}, newSlotter, nil) - if err != nil { - return err - } - // Iterate over the old billy instance and copy the data to the new instance - var indexingErr error - index := func(key uint64, size uint32, data []byte) { - _, indexingErr = newStore.Put(data) - } - oldStore, err := billy.Open(billy.Options{Path: path, Repair: true}, oldSlotter, index) - if err != nil { - return err - } - if indexingErr != nil { - return indexingErr - } - // TODO (MariusVanDerWijden) - // remove the old shelves here - oldStore.Close() - newStore.Close() - return nil -} - // Init sets the gas price needed to keep a transaction in the pool and the chain // head to allow balance / nonce checks. The transaction journal will be loaded // from disk and filtered based on the provided starting settings. @@ -425,9 +396,11 @@ func (p *BlobPool) Init(gasTip uint64, head *types.Header, reserver txpool.Reser // 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 { - if err := migrateBilly(queuedir, eip4844.LatestMaxBlobsPerBlock(p.chain.Config())); err != nil { + newSlotter := newSlotterEIP7594(eip4844.LatestMaxBlobsPerBlock(p.chain.Config())) + if err := billy.Migrate(billy.Options{Path: queuedir, Repair: true}, slotter, newSlotter); err != nil { return err } + } slotter = newSlotterEIP7594(eip4844.LatestMaxBlobsPerBlock(p.chain.Config())) }