Skip to content

Commit 943f08f

Browse files
committed
txpool: EIP-3860 should only apply to create transactions (#10609)
This fixes Issue #10607
1 parent 68d2101 commit 943f08f

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

erigon-lib/txpool/pool.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -833,10 +833,8 @@ func toBlobs(_blobs [][]byte) []gokzg4844.Blob {
833833

834834
func (p *TxPool) validateTx(txn *types.TxSlot, isLocal bool, stateCache kvcache.CacheView) txpoolcfg.DiscardReason {
835835
isShanghai := p.isShanghai() || p.isAgra()
836-
if isShanghai {
837-
if txn.DataLen > fixedgas.MaxInitCodeSize {
838-
return txpoolcfg.InitCodeTooLarge
839-
}
836+
if isShanghai && txn.Creation && txn.DataLen > fixedgas.MaxInitCodeSize {
837+
return txpoolcfg.InitCodeTooLarge // EIP-3860
840838
}
841839
if txn.Type == types.BlobTxType {
842840
if !p.isCancun() {

erigon-lib/txpool/pool_test.go

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -652,26 +652,43 @@ func TestShanghaiValidateTx(t *testing.T) {
652652
expected txpoolcfg.DiscardReason
653653
dataLen int
654654
isShanghai bool
655+
creation bool
655656
}{
656657
"no shanghai": {
657658
expected: txpoolcfg.Success,
658659
dataLen: 32,
659660
isShanghai: false,
661+
creation: true,
660662
},
661663
"shanghai within bounds": {
662664
expected: txpoolcfg.Success,
663665
dataLen: 32,
664666
isShanghai: true,
667+
creation: true,
665668
},
666-
"shanghai exactly on bound": {
669+
"shanghai exactly on bound - create tx": {
667670
expected: txpoolcfg.Success,
668671
dataLen: fixedgas.MaxInitCodeSize,
669672
isShanghai: true,
673+
creation: true,
670674
},
671-
"shanghai one over bound": {
675+
"shanghai one over bound - create tx": {
672676
expected: txpoolcfg.InitCodeTooLarge,
673677
dataLen: fixedgas.MaxInitCodeSize + 1,
674678
isShanghai: true,
679+
creation: true,
680+
},
681+
"shanghai exactly on bound - calldata tx": {
682+
expected: txpoolcfg.Success,
683+
dataLen: fixedgas.MaxInitCodeSize,
684+
isShanghai: true,
685+
creation: false,
686+
},
687+
"shanghai one over bound - calldata tx": {
688+
expected: txpoolcfg.Success,
689+
dataLen: fixedgas.MaxInitCodeSize + 1,
690+
isShanghai: true,
691+
creation: false,
675692
},
676693
}
677694

@@ -708,7 +725,7 @@ func TestShanghaiValidateTx(t *testing.T) {
708725
FeeCap: *uint256.NewInt(21000),
709726
Gas: 500000,
710727
SenderID: 0,
711-
Creation: true,
728+
Creation: test.creation,
712729
}
713730

714731
txns := types.TxSlots{

0 commit comments

Comments
 (0)