fix: skip payload size check for L1 messages (#457)

This commit is contained in:
Péter Garamvölgyi 2023-08-08 05:50:45 +02:00 committed by GitHub
parent edaf59bf06
commit 4175f65734
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 2 deletions

View file

@ -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

View file

@ -743,6 +743,9 @@ func l1MessageTest(t *testing.T, msgs []types.L1MessageTx, callback func(i int,
chainConfig = params.AllCliqueProtocolChanges
chainConfig.Clique = &params.CliqueConfig{Period: 1, Epoch: 30000}
engine = clique.New(chainConfig.Clique, db)
maxPayload := 1024
chainConfig.Scroll.MaxTxPayloadBytesPerBlock = &maxPayload
chainConfig.Scroll.L1Config = &params.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
})
}

View file

@ -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
)