Skip to content

Commit 27a3830

Browse files
authored
Improve oversized block handling (#315)
* improve oversized block handling * bump version
1 parent c913b3e commit 27a3830

File tree

3 files changed

+37
-27
lines changed

3 files changed

+37
-27
lines changed

miner/worker.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,8 @@ func (w *worker) commitTransactions(txs *types.TransactionsByPriceAndNonce, coin
837837
}
838838
if !w.chainConfig.Scroll.IsValidBlockSize(w.current.blockSize + tx.Size()) {
839839
log.Trace("Block size limit reached", "have", w.current.blockSize, "want", w.chainConfig.Scroll.MaxTxPayloadBytesPerBlock, "tx", tx.Size())
840-
break
840+
txs.Pop() // skip transactions from this account
841+
continue
841842
}
842843
// Error may be ignored here. The error has already been checked
843844
// during transaction acceptance is the transaction pool.

params/config.go

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,12 @@ var (
296296
// adding flags to the config to also have to set these fields.
297297
AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil,
298298
ScrollConfig{
299-
UseZktrie: false,
300-
FeeVaultAddress: nil,
301-
EnableEIP2718: true,
302-
EnableEIP1559: true,
303-
MaxTxPerBlock: nil,
299+
UseZktrie: false,
300+
FeeVaultAddress: nil,
301+
EnableEIP2718: true,
302+
EnableEIP1559: true,
303+
MaxTxPerBlock: nil,
304+
MaxTxPayloadBytesPerBlock: nil,
304305
}}
305306

306307
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
@@ -310,30 +311,33 @@ var (
310311
// adding flags to the config to also have to set these fields.
311312
AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, &CliqueConfig{Period: 0, Epoch: 30000},
312313
ScrollConfig{
313-
UseZktrie: false,
314-
FeeVaultAddress: nil,
315-
EnableEIP2718: true,
316-
EnableEIP1559: true,
317-
MaxTxPerBlock: nil,
314+
UseZktrie: false,
315+
FeeVaultAddress: nil,
316+
EnableEIP2718: true,
317+
EnableEIP1559: true,
318+
MaxTxPerBlock: nil,
319+
MaxTxPayloadBytesPerBlock: nil,
318320
}}
319321

320322
TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil,
321323
ScrollConfig{
322-
UseZktrie: false,
323-
FeeVaultAddress: &common.Address{123},
324-
EnableEIP2718: true,
325-
EnableEIP1559: true,
326-
MaxTxPerBlock: nil,
324+
UseZktrie: false,
325+
FeeVaultAddress: &common.Address{123},
326+
EnableEIP2718: true,
327+
EnableEIP1559: true,
328+
MaxTxPerBlock: nil,
329+
MaxTxPayloadBytesPerBlock: nil,
327330
}}
328331
TestRules = TestChainConfig.Rules(new(big.Int))
329332

330333
TestNoL1feeChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil,
331334
ScrollConfig{
332-
UseZktrie: false,
333-
FeeVaultAddress: nil,
334-
EnableEIP2718: true,
335-
EnableEIP1559: true,
336-
MaxTxPerBlock: nil,
335+
UseZktrie: false,
336+
FeeVaultAddress: nil,
337+
EnableEIP2718: true,
338+
EnableEIP1559: true,
339+
MaxTxPerBlock: nil,
340+
MaxTxPayloadBytesPerBlock: nil,
337341
}}
338342
)
339343

@@ -459,13 +463,18 @@ func (s ScrollConfig) ZktrieEnabled() bool {
459463
}
460464

461465
func (s ScrollConfig) String() string {
462-
if s.MaxTxPerBlock == nil {
463-
return fmt.Sprintf("{useZktrie: %v, maxTxPerBlock: <nil>, feeVaultAddress: %v, enableEIP2718:%v, enableEIP1559:%v}",
464-
s.UseZktrie, s.FeeVaultAddress, s.EnableEIP2718, s.EnableEIP1559)
466+
maxTxPerBlock := "<nil>"
467+
if s.MaxTxPerBlock != nil {
468+
maxTxPerBlock = fmt.Sprintf("%v", *s.MaxTxPerBlock)
465469
}
466470

467-
return fmt.Sprintf("{useZktrie: %v, maxTxPerBlock: %v, feeVaultAddress: %v, enableEIP2718:%v, enableEIP1559:%v}",
468-
s.UseZktrie, *s.MaxTxPerBlock, s.FeeVaultAddress, s.EnableEIP2718, s.EnableEIP1559)
471+
maxTxPayloadBytesPerBlock := "<nil>"
472+
if s.MaxTxPayloadBytesPerBlock != nil {
473+
maxTxPayloadBytesPerBlock = fmt.Sprintf("%v", *s.MaxTxPayloadBytesPerBlock)
474+
}
475+
476+
return fmt.Sprintf("{useZktrie: %v, maxTxPerBlock: %v, MaxTxPayloadBytesPerBlock: %v, feeVaultAddress: %v, enableEIP2718:%v, enableEIP1559:%v}",
477+
s.UseZktrie, maxTxPerBlock, maxTxPayloadBytesPerBlock, s.FeeVaultAddress, s.EnableEIP2718, s.EnableEIP1559)
469478
}
470479

471480
// IsValidTxCount returns whether the given block's transaction count is below the limit.

params/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
const (
2525
VersionMajor = 3 // Major version component of the current release
2626
VersionMinor = 1 // Minor version component of the current release
27-
VersionPatch = 11 // Patch version component of the current release
27+
VersionPatch = 12 // Patch version component of the current release
2828
VersionMeta = "alpha" // Version metadata to append to the version string
2929
)
3030

0 commit comments

Comments
 (0)