mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-14 07:53:47 +00:00
fix: skip payload size check for L1 messages (#457)
This commit is contained in:
parent
edaf59bf06
commit
4175f65734
3 changed files with 35 additions and 2 deletions
|
|
@ -979,7 +979,7 @@ loop:
|
||||||
"got", tx.AsL1MessageTx().QueueIndex,
|
"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())
|
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
|
txs.Pop() // skip transactions from this account
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
|
|
@ -743,6 +743,9 @@ func l1MessageTest(t *testing.T, msgs []types.L1MessageTx, callback func(i int,
|
||||||
chainConfig = params.AllCliqueProtocolChanges
|
chainConfig = params.AllCliqueProtocolChanges
|
||||||
chainConfig.Clique = ¶ms.CliqueConfig{Period: 1, Epoch: 30000}
|
chainConfig.Clique = ¶ms.CliqueConfig{Period: 1, Epoch: 30000}
|
||||||
engine = clique.New(chainConfig.Clique, db)
|
engine = clique.New(chainConfig.Clique, db)
|
||||||
|
|
||||||
|
maxPayload := 1024
|
||||||
|
chainConfig.Scroll.MaxTxPayloadBytesPerBlock = &maxPayload
|
||||||
chainConfig.Scroll.L1Config = ¶ms.L1Config{
|
chainConfig.Scroll.L1Config = ¶ms.L1Config{
|
||||||
NumL1MessagesPerBlock: 3,
|
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
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import (
|
||||||
const (
|
const (
|
||||||
VersionMajor = 4 // Major version component of the current release
|
VersionMajor = 4 // Major version component of the current release
|
||||||
VersionMinor = 3 // Minor 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
|
VersionMeta = "sepolia" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue