Feature: configurable gas limit when building execution payload (#2931)
* Feature: configurable gas limit when building execution payload * Raise default gas limit to 30M
This commit is contained in:
parent
a12a73c41a
commit
1d5a48e153
|
@ -95,7 +95,10 @@ type
|
||||||
## Must not not set for a full node, might go away some time
|
## Must not not set for a full node, might go away some time
|
||||||
|
|
||||||
extraData: string
|
extraData: string
|
||||||
## Value of extraData field when building block
|
## Value of extraData field when building a block
|
||||||
|
|
||||||
|
gasLimit: uint64
|
||||||
|
## Desired gas limit when building a block
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Forward declarations
|
# Forward declarations
|
||||||
|
@ -181,6 +184,7 @@ proc init(com : CommonRef,
|
||||||
com.pruneHistory= pruneHistory
|
com.pruneHistory= pruneHistory
|
||||||
com.pos = CasperRef.new
|
com.pos = CasperRef.new
|
||||||
com.extraData = ShortClientId
|
com.extraData = ShortClientId
|
||||||
|
com.gasLimit = DEFAULT_GAS_LIMIT
|
||||||
|
|
||||||
# com.forkIdCalculator and com.genesisHash are set
|
# com.forkIdCalculator and com.genesisHash are set
|
||||||
# by setForkId
|
# by setForkId
|
||||||
|
@ -419,6 +423,9 @@ func syncState*(com: CommonRef): SyncState =
|
||||||
func extraData*(com: CommonRef): string =
|
func extraData*(com: CommonRef): string =
|
||||||
com.extraData
|
com.extraData
|
||||||
|
|
||||||
|
func gasLimit*(com: CommonRef): uint64 =
|
||||||
|
com.gasLimit
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Setters
|
# Setters
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
@ -460,6 +467,9 @@ func `notifyBadBlock=`*(com: CommonRef; cb: NotifyBadBlockCB) =
|
||||||
func `extraData=`*(com: CommonRef, val: string) =
|
func `extraData=`*(com: CommonRef, val: string) =
|
||||||
com.extraData = val
|
com.extraData = val
|
||||||
|
|
||||||
|
func `gasLimit=`*(com: CommonRef, val: uint64) =
|
||||||
|
com.gasLimit = val
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# End
|
# End
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
|
@ -179,11 +179,18 @@ type
|
||||||
name: "trusted-setup-file" .}: Option[string]
|
name: "trusted-setup-file" .}: Option[string]
|
||||||
|
|
||||||
extraData* {.
|
extraData* {.
|
||||||
desc: "Value of extraData field when assemble a block(max 32 bytes)"
|
separator: "\pPAYLOAD BUILDING OPTIONS:"
|
||||||
|
desc: "Value of extraData field when building an execution payload(max 32 bytes)"
|
||||||
defaultValue: ShortClientId
|
defaultValue: ShortClientId
|
||||||
defaultValueDesc: $ShortClientId
|
defaultValueDesc: $ShortClientId
|
||||||
name: "extra-data" .}: string
|
name: "extra-data" .}: string
|
||||||
|
|
||||||
|
gasLimit* {.
|
||||||
|
desc: "Desired gas limit when building an execution payload"
|
||||||
|
defaultValue: DEFAULT_GAS_LIMIT
|
||||||
|
defaultValueDesc: $DEFAULT_GAS_LIMIT
|
||||||
|
name: "gas-limit" .}: uint64
|
||||||
|
|
||||||
network {.
|
network {.
|
||||||
separator: "\pETHEREUM NETWORK OPTIONS:"
|
separator: "\pETHEREUM NETWORK OPTIONS:"
|
||||||
desc: "Name or id number of Ethereum network(mainnet(1), sepolia(11155111), holesky(17000), other=custom)"
|
desc: "Name or id number of Ethereum network(mainnet(1), sepolia(11155111), holesky(17000), other=custom)"
|
||||||
|
|
|
@ -49,7 +49,7 @@ const
|
||||||
GENESIS_EXTRA_DATA* = ""
|
GENESIS_EXTRA_DATA* = ""
|
||||||
GAS_LIMIT_MINIMUM* = 5000
|
GAS_LIMIT_MINIMUM* = 5000
|
||||||
GAS_LIMIT_MAXIMUM* = int64.high.GasInt # Maximum the gas limit (2^63-1).
|
GAS_LIMIT_MAXIMUM* = int64.high.GasInt # Maximum the gas limit (2^63-1).
|
||||||
DEFAULT_GAS_LIMIT* = 8_000_000
|
DEFAULT_GAS_LIMIT* = 30_000_000
|
||||||
|
|
||||||
EMPTY_SHA3* = hash32"c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
|
EMPTY_SHA3* = hash32"c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
|
||||||
|
|
||||||
|
|
|
@ -100,13 +100,13 @@ proc gasLimitsGet(com: CommonRef; parent: Header): GasInt =
|
||||||
if not com.isLondonOrLater(parent.number):
|
if not com.isLondonOrLater(parent.number):
|
||||||
# Bump by 2x
|
# Bump by 2x
|
||||||
parentGasLimit = parent.gasLimit * EIP1559_ELASTICITY_MULTIPLIER
|
parentGasLimit = parent.gasLimit * EIP1559_ELASTICITY_MULTIPLIER
|
||||||
calcGasLimit1559(parentGasLimit, desiredLimit = DEFAULT_GAS_LIMIT)
|
calcGasLimit1559(parentGasLimit, desiredLimit = com.gasLimit)
|
||||||
else:
|
else:
|
||||||
computeGasLimit(
|
computeGasLimit(
|
||||||
parent.gasUsed,
|
parent.gasUsed,
|
||||||
parent.gasLimit,
|
parent.gasLimit,
|
||||||
gasFloor = DEFAULT_GAS_LIMIT,
|
gasFloor = com.gasLimit,
|
||||||
gasCeil = DEFAULT_GAS_LIMIT)
|
gasCeil = com.gasLimit)
|
||||||
|
|
||||||
proc setupVMState(com: CommonRef; parent: Header): BaseVMState =
|
proc setupVMState(com: CommonRef; parent: Header): BaseVMState =
|
||||||
# do hardfork transition before
|
# do hardfork transition before
|
||||||
|
|
Loading…
Reference in New Issue