Skip to content

Commit 9471c44

Browse files
authored
txpool: EIP-3860 should only apply to create transactions (#10609)
This fixes Issue #10607
1 parent 5bbcc7a commit 9471c44

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

erigon-lib/txpool/pool.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -835,10 +835,8 @@ func toBlobs(_blobs [][]byte) []gokzg4844.Blob {
835835

836836
func (p *TxPool) validateTx(txn *types.TxSlot, isLocal bool, stateCache kvcache.CacheView) txpoolcfg.DiscardReason {
837837
isShanghai := p.isShanghai() || p.isAgra()
838-
if isShanghai {
839-
if txn.DataLen > fixedgas.MaxInitCodeSize {
840-
return txpoolcfg.InitCodeTooLarge
841-
}
838+
if isShanghai && txn.Creation && txn.DataLen > fixedgas.MaxInitCodeSize {
839+
return txpoolcfg.InitCodeTooLarge // EIP-3860
842840
}
843841
if txn.Type == types.BlobTxType {
844842
if !p.isCancun() {

erigon-lib/txpool/pool_test.go

+20-3
Original file line numberDiff line numberDiff line change
@@ -645,26 +645,43 @@ func TestShanghaiValidateTx(t *testing.T) {
645645
expected txpoolcfg.DiscardReason
646646
dataLen int
647647
isShanghai bool
648+
creation bool
648649
}{
649650
"no shanghai": {
650651
expected: txpoolcfg.Success,
651652
dataLen: 32,
652653
isShanghai: false,
654+
creation: true,
653655
},
654656
"shanghai within bounds": {
655657
expected: txpoolcfg.Success,
656658
dataLen: 32,
657659
isShanghai: true,
660+
creation: true,
658661
},
659-
"shanghai exactly on bound": {
662+
"shanghai exactly on bound - create tx": {
660663
expected: txpoolcfg.Success,
661664
dataLen: fixedgas.MaxInitCodeSize,
662665
isShanghai: true,
666+
creation: true,
663667
},
664-
"shanghai one over bound": {
668+
"shanghai one over bound - create tx": {
665669
expected: txpoolcfg.InitCodeTooLarge,
666670
dataLen: fixedgas.MaxInitCodeSize + 1,
667671
isShanghai: true,
672+
creation: true,
673+
},
674+
"shanghai exactly on bound - calldata tx": {
675+
expected: txpoolcfg.Success,
676+
dataLen: fixedgas.MaxInitCodeSize,
677+
isShanghai: true,
678+
creation: false,
679+
},
680+
"shanghai one over bound - calldata tx": {
681+
expected: txpoolcfg.Success,
682+
dataLen: fixedgas.MaxInitCodeSize + 1,
683+
isShanghai: true,
684+
creation: false,
668685
},
669686
}
670687

@@ -700,7 +717,7 @@ func TestShanghaiValidateTx(t *testing.T) {
700717
FeeCap: *uint256.NewInt(21000),
701718
Gas: 500000,
702719
SenderID: 0,
703-
Creation: true,
720+
Creation: test.creation,
704721
}
705722

706723
txns := types.TxSlots{

0 commit comments

Comments
 (0)