Skip to content

fix the bug when calculating l2TxCount. #479

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

Merged
merged 2 commits into from
Aug 23, 2023
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
14 changes: 9 additions & 5 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down