Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

txpool: EIP-3860 should only apply to create transactions #10609

Merged
merged 2 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions erigon-lib/txpool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -835,10 +835,8 @@ func toBlobs(_blobs [][]byte) []gokzg4844.Blob {

func (p *TxPool) validateTx(txn *types.TxSlot, isLocal bool, stateCache kvcache.CacheView) txpoolcfg.DiscardReason {
isShanghai := p.isShanghai() || p.isAgra()
if isShanghai {
if txn.DataLen > fixedgas.MaxInitCodeSize {
return txpoolcfg.InitCodeTooLarge
}
if isShanghai && txn.Creation && txn.DataLen > fixedgas.MaxInitCodeSize {
return txpoolcfg.InitCodeTooLarge // EIP-3860
}
if txn.Type == types.BlobTxType {
if !p.isCancun() {
Expand Down
23 changes: 20 additions & 3 deletions erigon-lib/txpool/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,26 +645,43 @@ func TestShanghaiValidateTx(t *testing.T) {
expected txpoolcfg.DiscardReason
dataLen int
isShanghai bool
creation bool
}{
"no shanghai": {
expected: txpoolcfg.Success,
dataLen: 32,
isShanghai: false,
creation: true,
},
"shanghai within bounds": {
expected: txpoolcfg.Success,
dataLen: 32,
isShanghai: true,
creation: true,
},
"shanghai exactly on bound": {
"shanghai exactly on bound - create tx": {
expected: txpoolcfg.Success,
dataLen: fixedgas.MaxInitCodeSize,
isShanghai: true,
creation: true,
},
"shanghai one over bound": {
"shanghai one over bound - create tx": {
expected: txpoolcfg.InitCodeTooLarge,
dataLen: fixedgas.MaxInitCodeSize + 1,
isShanghai: true,
creation: true,
},
"shanghai exactly on bound - calldata tx": {
expected: txpoolcfg.Success,
dataLen: fixedgas.MaxInitCodeSize,
isShanghai: true,
creation: false,
},
"shanghai one over bound - calldata tx": {
expected: txpoolcfg.Success,
dataLen: fixedgas.MaxInitCodeSize + 1,
isShanghai: true,
creation: false,
},
}

Expand Down Expand Up @@ -700,7 +717,7 @@ func TestShanghaiValidateTx(t *testing.T) {
FeeCap: *uint256.NewInt(21000),
Gas: 500000,
SenderID: 0,
Creation: true,
Creation: test.creation,
}

txns := types.TxSlots{
Expand Down
Loading