diff --git a/miner/worker.go b/miner/worker.go index df09e9fb75..6c5c9dfe67 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -979,7 +979,7 @@ loop: "got", tx.AsL1MessageTx().QueueIndex, ) } - if !w.chainConfig.Scroll.IsValidBlockSize(w.current.blockSize + tx.Size()) { + if !tx.IsL1MessageTx() && !w.chainConfig.Scroll.IsValidBlockSize(w.current.blockSize+tx.Size()) { log.Trace("Block size limit reached", "have", w.current.blockSize, "want", w.chainConfig.Scroll.MaxTxPayloadBytesPerBlock, "tx", tx.Size()) txs.Pop() // skip transactions from this account continue diff --git a/miner/worker_test.go b/miner/worker_test.go index 533ce02218..a28e9b5313 100644 --- a/miner/worker_test.go +++ b/miner/worker_test.go @@ -743,6 +743,9 @@ func l1MessageTest(t *testing.T, msgs []types.L1MessageTx, callback func(i int, chainConfig = params.AllCliqueProtocolChanges chainConfig.Clique = ¶ms.CliqueConfig{Period: 1, Epoch: 30000} engine = clique.New(chainConfig.Clique, db) + + maxPayload := 1024 + chainConfig.Scroll.MaxTxPayloadBytesPerBlock = &maxPayload chainConfig.Scroll.L1Config = ¶ms.L1Config{ NumL1MessagesPerBlock: 3, } @@ -862,3 +865,33 @@ func TestL1CombinedMessagesOverGasLimit(t *testing.T) { } }) } + +func TestLargeL1MessageSkipPayloadCheck(t *testing.T) { + assert := assert.New(t) + + // message #0 is over the L2 block payload size limit + msgs := []types.L1MessageTx{ + {QueueIndex: 0, Gas: 25100, To: &common.Address{1}, Data: make([]byte, 1025), Sender: common.Address{2}}, + {QueueIndex: 1, Gas: 21016, To: &common.Address{1}, Data: []byte{0x01}, Sender: common.Address{2}}, // same sender + {QueueIndex: 2, Gas: 21016, To: &common.Address{1}, Data: []byte{0x01}, Sender: common.Address{3}}, // different sender + } + + l1MessageTest(t, msgs, func(blockNum int, block *types.Block, db ethdb.Database) bool { + // include #0, #1 and #2 + assert.Equal(3, len(block.Transactions())) + + assert.True(block.Transactions()[0].IsL1MessageTx()) + assert.Equal(uint64(0), block.Transactions()[0].AsL1MessageTx().QueueIndex) + assert.True(block.Transactions()[1].IsL1MessageTx()) + assert.Equal(uint64(1), block.Transactions()[1].AsL1MessageTx().QueueIndex) + assert.True(block.Transactions()[2].IsL1MessageTx()) + assert.Equal(uint64(2), block.Transactions()[2].AsL1MessageTx().QueueIndex) + + // db is updated correctly + queueIndex := rawdb.ReadFirstQueueIndexNotInL2Block(db, block.Hash()) + assert.NotNil(queueIndex) + assert.Equal(uint64(3), *queueIndex) + + return true + }) +} diff --git a/params/version.go b/params/version.go index 31e70d0312..cd821bc192 100644 --- a/params/version.go +++ b/params/version.go @@ -24,7 +24,7 @@ import ( const ( VersionMajor = 4 // Major version component of the current release VersionMinor = 3 // Minor version component of the current release - VersionPatch = 31 // Patch version component of the current release + VersionPatch = 32 // Patch version component of the current release VersionMeta = "sepolia" // Version metadata to append to the version string )