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