fix the bug when calculating l2TxCount. (#479)

* fix bug when calculate l2 tx count

* Update version
This commit is contained in:
maskpp 2023-08-23 19:46:28 +08:00 committed by GitHub
parent ef893170bc
commit b65f42b41a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View file

@ -970,11 +970,6 @@ loop:
}
return atomic.LoadInt32(interrupt) == commitInterruptNewHead, circuitCapacityReached
}
// If we have collected enough transactions then we're done
if !w.chainConfig.Scroll.IsValidL2TxCount(w.current.tcount - w.current.l1TxCount + 1) {
log.Trace("Transaction count limit reached", "have", w.current.tcount-w.current.l1TxCount, "want", w.chainConfig.Scroll.MaxTxPerBlock)
break
}
// If we don't have enough gas for any further transactions then we're done
if w.current.gasPool.Gas() < params.TxGas {
log.Trace("Not enough gas for further transactions", "have", w.current.gasPool, "want", params.TxGas)
@ -985,6 +980,15 @@ loop:
if tx == nil {
break
}
// If we have collected enough transactions then we're done
l2TxCount := w.current.tcount - w.current.l1TxCount
if !tx.IsL1MessageTx() { // If the next tx is not L1MessageTx type then +1.
l2TxCount++
}
if !w.chainConfig.Scroll.IsValidL2TxCount(l2TxCount) {
log.Trace("Transaction count limit reached", "have", w.current.tcount-w.current.l1TxCount, "want", w.chainConfig.Scroll.MaxTxPerBlock)
break
}
if tx.IsL1MessageTx() && tx.AsL1MessageTx().QueueIndex != w.current.nextL1MsgIndex {
log.Error(
"Unexpected L1 message queue index in worker",

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 = 45 // Patch version component of the current release
VersionPatch = 46 // Patch version component of the current release
VersionMeta = "sepolia" // Version metadata to append to the version string
)