core/txpool/blobpool: disallow legacy sidecar after osaka (#32534)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run

This PR removes the conversion of legacy sidecars after Osaka and instead rejects them to the pool.

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
This commit is contained in:
maskpp 2025-09-10 11:15:47 +08:00 committed by GitHub
parent ca6e2d141b
commit 5cc443609f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 34 deletions

View file

@ -1408,31 +1408,6 @@ func (p *BlobPool) AvailableBlobs(vhashes []common.Hash) int {
return available
}
// convertSidecar converts the legacy sidecar in the submitted transactions
// if Osaka fork has been activated.
func (p *BlobPool) convertSidecar(txs []*types.Transaction) ([]*types.Transaction, []error) {
head := p.chain.CurrentBlock()
if !p.chain.Config().IsOsaka(head.Number, head.Time) {
return txs, make([]error, len(txs))
}
var errs []error
for _, tx := range txs {
sidecar := tx.BlobTxSidecar()
if sidecar == nil {
errs = append(errs, errors.New("missing sidecar in blob transaction"))
continue
}
if sidecar.Version == types.BlobSidecarVersion0 {
if err := sidecar.ToV1(); err != nil {
errs = append(errs, err)
continue
}
}
errs = append(errs, nil)
}
return txs, errs
}
// Add inserts a set of blob transactions into the pool if they pass validation (both
// consensus validity and pool restrictions).
//
@ -1440,14 +1415,10 @@ func (p *BlobPool) convertSidecar(txs []*types.Transaction) ([]*types.Transactio
// related to the add is finished. Only use this during tests for determinism.
func (p *BlobPool) Add(txs []*types.Transaction, sync bool) []error {
var (
errs []error
errs = make([]error, len(txs))
adds = make([]*types.Transaction, 0, len(txs))
)
txs, errs = p.convertSidecar(txs)
for i, tx := range txs {
if errs[i] != nil {
continue
}
errs[i] = p.add(tx)
if errs[i] == nil {
adds = append(adds, tx.WithoutBlobTxSidecar())

View file

@ -1691,8 +1691,7 @@ func TestAdd(t *testing.T) {
}
}
// Tests that adding the transactions with legacy sidecar and expect them to
// be converted to new format correctly.
// Tests adding transactions with legacy sidecars are correctly rejected.
func TestAddLegacyBlobTx(t *testing.T) {
var (
key1, _ = crypto.GenerateKey()
@ -1726,8 +1725,8 @@ func TestAddLegacyBlobTx(t *testing.T) {
)
errs := pool.Add([]*types.Transaction{tx1, tx2, tx3}, true)
for _, err := range errs {
if err != nil {
t.Fatalf("failed to add tx: %v", err)
if err == nil {
t.Fatalf("expected tx add to fail")
}
}
verifyPoolInternals(t, pool)