mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-28 15:46:43 +00:00
parent
ba4feee9ff
commit
5017dcb92a
2 changed files with 30 additions and 13 deletions
|
|
@ -82,12 +82,13 @@ const (
|
|||
type environment struct {
|
||||
signer types.Signer
|
||||
|
||||
state *state.StateDB // apply state changes here
|
||||
ancestors mapset.Set // ancestor set (used for checking uncle parent validity)
|
||||
family mapset.Set // family set (used for checking uncle invalidity)
|
||||
uncles mapset.Set // uncle set
|
||||
tcount int // tx count in cycle
|
||||
gasPool *core.GasPool // available gas used to pack transactions
|
||||
state *state.StateDB // apply state changes here
|
||||
ancestors mapset.Set // ancestor set (used for checking uncle parent validity)
|
||||
family mapset.Set // family set (used for checking uncle invalidity)
|
||||
uncles mapset.Set // uncle set
|
||||
tcount int // tx count in cycle
|
||||
blockSize common.StorageSize // approximate size of tx payload in bytes
|
||||
gasPool *core.GasPool // available gas used to pack transactions
|
||||
|
||||
header *types.Header
|
||||
txs []*types.Transaction
|
||||
|
|
@ -707,6 +708,7 @@ func (w *worker) makeCurrent(parent *types.Block, header *types.Header) error {
|
|||
}
|
||||
// Keep track of transactions which return errors so they can be removed
|
||||
env.tcount = 0
|
||||
env.blockSize = 0
|
||||
|
||||
// Swap out the old work with the new one, terminating any leftover prefetcher
|
||||
// processes in the mean time and starting a new one.
|
||||
|
|
@ -833,6 +835,10 @@ func (w *worker) commitTransactions(txs *types.TransactionsByPriceAndNonce, coin
|
|||
if tx == nil {
|
||||
break
|
||||
}
|
||||
if !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())
|
||||
break
|
||||
}
|
||||
// Error may be ignored here. The error has already been checked
|
||||
// during transaction acceptance is the transaction pool.
|
||||
//
|
||||
|
|
@ -870,6 +876,7 @@ func (w *worker) commitTransactions(txs *types.TransactionsByPriceAndNonce, coin
|
|||
// Everything ok, collect the logs and shift in the next transaction from the same account
|
||||
coalescedLogs = append(coalescedLogs, logs...)
|
||||
w.current.tcount++
|
||||
w.current.blockSize += tx.Size()
|
||||
txs.Shift()
|
||||
|
||||
case errors.Is(err, core.ErrTxTypeNotSupported):
|
||||
|
|
|
|||
|
|
@ -255,8 +255,9 @@ var (
|
|||
}
|
||||
|
||||
// ScrollAlphaChainConfig contains the chain parameters to run a node on the Scroll Alpha test network.
|
||||
ScrollFeeVaultAddress = common.HexToAddress("0x5300000000000000000000000000000000000005")
|
||||
ScrollMaxTxPerBlock = 44
|
||||
ScrollFeeVaultAddress = common.HexToAddress("0x5300000000000000000000000000000000000005")
|
||||
ScrollMaxTxPerBlock = 44
|
||||
ScrollMaxTxPayloadBytesPerBlock = 120 * 1024
|
||||
|
||||
ScrollAlphaChainConfig = &ChainConfig{
|
||||
ChainID: big.NewInt(534353),
|
||||
|
|
@ -279,11 +280,12 @@ var (
|
|||
Epoch: 30000,
|
||||
},
|
||||
Scroll: ScrollConfig{
|
||||
UseZktrie: true,
|
||||
MaxTxPerBlock: &ScrollMaxTxPerBlock,
|
||||
FeeVaultAddress: &ScrollFeeVaultAddress,
|
||||
EnableEIP2718: false,
|
||||
EnableEIP1559: false,
|
||||
UseZktrie: true,
|
||||
MaxTxPerBlock: &ScrollMaxTxPerBlock,
|
||||
MaxTxPayloadBytesPerBlock: &ScrollMaxTxPayloadBytesPerBlock,
|
||||
FeeVaultAddress: &ScrollFeeVaultAddress,
|
||||
EnableEIP2718: false,
|
||||
EnableEIP1559: false,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -431,6 +433,9 @@ type ScrollConfig struct {
|
|||
// Maximum number of transactions per block [optional]
|
||||
MaxTxPerBlock *int `json:"maxTxPerBlock,omitempty"`
|
||||
|
||||
// Maximum tx payload size of blocks that we produce [optional]
|
||||
MaxTxPayloadBytesPerBlock *int `json:"maxTxPayloadBytesPerBlock,omitempty"`
|
||||
|
||||
// Transaction fee vault address [optional]
|
||||
FeeVaultAddress *common.Address `json:"feeVaultAddress,omitempty"`
|
||||
|
||||
|
|
@ -468,6 +473,11 @@ func (s ScrollConfig) IsValidTxCount(count int) bool {
|
|||
return s.MaxTxPerBlock == nil || count <= *s.MaxTxPerBlock
|
||||
}
|
||||
|
||||
// IsValidBlockSize returns whether the given block's transaction payload size is below the limit.
|
||||
func (s ScrollConfig) IsValidBlockSize(size common.StorageSize) bool {
|
||||
return s.MaxTxPayloadBytesPerBlock == nil || size <= common.StorageSize(*s.MaxTxPayloadBytesPerBlock)
|
||||
}
|
||||
|
||||
// EthashConfig is the consensus engine configs for proof-of-work based sealing.
|
||||
type EthashConfig struct{}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue