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:
andri lim 2024-12-13 10:47:35 +07:00 committed by GitHub
parent a12a73c41a
commit 1d5a48e153
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 23 additions and 6 deletions

View File

@ -95,7 +95,10 @@ type
## Must not not set for a full node, might go away some time
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
@ -181,6 +184,7 @@ proc init(com : CommonRef,
com.pruneHistory= pruneHistory
com.pos = CasperRef.new
com.extraData = ShortClientId
com.gasLimit = DEFAULT_GAS_LIMIT
# com.forkIdCalculator and com.genesisHash are set
# by setForkId
@ -419,6 +423,9 @@ func syncState*(com: CommonRef): SyncState =
func extraData*(com: CommonRef): string =
com.extraData
func gasLimit*(com: CommonRef): uint64 =
com.gasLimit
# ------------------------------------------------------------------------------
# Setters
# ------------------------------------------------------------------------------
@ -460,6 +467,9 @@ func `notifyBadBlock=`*(com: CommonRef; cb: NotifyBadBlockCB) =
func `extraData=`*(com: CommonRef, val: string) =
com.extraData = val
func `gasLimit=`*(com: CommonRef, val: uint64) =
com.gasLimit = val
# ------------------------------------------------------------------------------
# End
# ------------------------------------------------------------------------------

View File

@ -179,11 +179,18 @@ type
name: "trusted-setup-file" .}: Option[string]
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
defaultValueDesc: $ShortClientId
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 {.
separator: "\pETHEREUM NETWORK OPTIONS:"
desc: "Name or id number of Ethereum network(mainnet(1), sepolia(11155111), holesky(17000), other=custom)"

View File

@ -49,7 +49,7 @@ const
GENESIS_EXTRA_DATA* = ""
GAS_LIMIT_MINIMUM* = 5000
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"

View File

@ -100,13 +100,13 @@ proc gasLimitsGet(com: CommonRef; parent: Header): GasInt =
if not com.isLondonOrLater(parent.number):
# Bump by 2x
parentGasLimit = parent.gasLimit * EIP1559_ELASTICITY_MULTIPLIER
calcGasLimit1559(parentGasLimit, desiredLimit = DEFAULT_GAS_LIMIT)
calcGasLimit1559(parentGasLimit, desiredLimit = com.gasLimit)
else:
computeGasLimit(
parent.gasUsed,
parent.gasLimit,
gasFloor = DEFAULT_GAS_LIMIT,
gasCeil = DEFAULT_GAS_LIMIT)
gasFloor = com.gasLimit,
gasCeil = com.gasLimit)
proc setupVMState(com: CommonRef; parent: Header): BaseVMState =
# do hardfork transition before