mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
params, miner: rename constants
This commit is contained in:
parent
319fd95ab5
commit
11f1b1f1da
3 changed files with 9 additions and 9 deletions
|
|
@ -50,7 +50,7 @@ func NewBlockValidator(config *params.ChainConfig, blockchain *BlockChain) *Bloc
|
|||
// validated at this point.
|
||||
func (v *BlockValidator) ValidateBody(block *types.Block) error {
|
||||
// check EIP 7934 RLP-encoded block size cap
|
||||
if v.config.IsOsaka(block.Number(), block.Time()) && block.Size() > params.BlockRLPSizeCap {
|
||||
if v.config.IsOsaka(block.Number(), block.Time()) && block.Size() > params.MaxBlockSize {
|
||||
return ErrBlockOversized
|
||||
}
|
||||
// Check whether the block is already imported.
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ type environment struct {
|
|||
|
||||
// txFits reports whether the transaction fits into the block size limit.
|
||||
func (env *environment) txFitsSize(tx *types.Transaction) bool {
|
||||
return env.size+tx.Size() < params.BlockRLPSizeCap-blockRLPSizeCapBuffer
|
||||
return env.size+tx.Size() < params.MaxBlockSize-maxBlockSizeBufferZone
|
||||
}
|
||||
|
||||
const (
|
||||
|
|
@ -74,13 +74,13 @@ const (
|
|||
commitInterruptNewHead
|
||||
commitInterruptResubmit
|
||||
commitInterruptTimeout
|
||||
|
||||
// cap the size of blocks we will produce below the max allowed by
|
||||
// EIP-7934. This gives us buffer room if the estimated size of the
|
||||
// block we are building is off from the actual encoded size.
|
||||
blockRLPSizeCapBuffer = 1_000_000
|
||||
)
|
||||
|
||||
// Block size is capped by the protocol at params.MaxBlockSize. When producing blocks, we
|
||||
// try to say below the size including a buffer zone, this is to avoid going over the
|
||||
// maximum size with auxilary data added into the block.
|
||||
const maxBlockSizeBufferZone = 1_000_000
|
||||
|
||||
// newPayloadResult is the result of payload generation.
|
||||
type newPayloadResult struct {
|
||||
err error
|
||||
|
|
@ -115,7 +115,7 @@ func (miner *Miner) generateWork(genParam *generateParams, witness bool) *newPay
|
|||
// Check withdrawals fit max block size.
|
||||
// Due to the cap on withdrawal count, this can actually never happen, but we still need to
|
||||
// check to ensure the CL notices there's a problem if the withdrawal cap is ever lifted.
|
||||
maxBlockSize := params.BlockRLPSizeCap - blockRLPSizeCapBuffer
|
||||
maxBlockSize := params.MaxBlockSize - maxBlockSizeBufferZone
|
||||
if genParam.withdrawals.Size() > maxBlockSize {
|
||||
return &newPayloadResult{err: errors.New("withdrawals exceed max block size")}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ const (
|
|||
|
||||
HistoryServeWindow = 8192 // Number of blocks to serve historical block hashes for, EIP-2935.
|
||||
|
||||
BlockRLPSizeCap = 8_388_608 // maximum size of an RLP-encoded block
|
||||
MaxBlockSize = 8_388_608 // maximum size of an RLP-encoded block
|
||||
)
|
||||
|
||||
// Bls12381G1MultiExpDiscountTable is the gas discount table for BLS12-381 G1 multi exponentiation operation
|
||||
|
|
|
|||
Loading…
Reference in a new issue