Skip to content

Commit 836b50a

Browse files
committed
clients/go-ethereum, clients/nethermind: pin gas-limit target via HIVE_TARGET_GAS_LIMIT
Without an explicit target, geth and Nethermind use different default gas-limit policies under the engine API: geth's CalcGasLimit moves the parent gas limit toward miner.gaslimit (default 60M) by 1/1024 per block, while Nethermind keeps the parent gas limit unchanged unless Blocks.TargetBlockGasLimit is set. With the rpc-compat chain head sitting at ~75M, the two clients diverge from block 1 onward, so blocks produced by testing_buildBlockV1 / testing_commitBlockV1 in rpc-compat replay get different hashes between clients and the strict-match tests fail on Nethermind. Wiring a new HIVE_TARGET_GAS_LIMIT env var through geth.sh (--miner.gaslimit) and Nethermind's mkconfig.jq (Blocks.TargetBlockGasLimit) makes both clients target the same ceiling. With the value set to 60000000 in execution-apis/tools/chain/forkenv.json, CalcGasLimit produces the same gas limit at every step on both clients, so the recorded rpc-compat fixtures replay byte-exact on both. Spec and cross-client fixtures: ethereum/execution-apis#801
1 parent 31cb70b commit 836b50a

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

clients/go-ethereum/geth.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ fi
136136
if [ "$HIVE_MINER_EXTRA" != "" ]; then
137137
FLAGS="$FLAGS --miner.extradata $HIVE_MINER_EXTRA"
138138
fi
139+
if [ "$HIVE_TARGET_GAS_LIMIT" != "" ]; then
140+
FLAGS="$FLAGS --miner.gaslimit $HIVE_TARGET_GAS_LIMIT"
141+
fi
139142

140143
# Configure RPC.
141144
FLAGS="$FLAGS --http --http.addr=0.0.0.0 --http.port=8545 --http.api=admin,debug,eth,miner,net,txpool,web3,testing"

clients/nethermind/mkconfig.jq

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ def json_rpc_config:
4646
{
4747
"JsonRpc": {
4848
"JwtSecretFile": "/jwt.secret",
49-
"EnabledModules": ["Debug", "Eth", "Subscribe", "Trace", "TxPool", "Web3", "Personal", "Proof", "Net", "Parity", "Health", "Admin"],
49+
"EnabledModules": ["Debug", "Eth", "Subscribe", "Trace", "TxPool", "Web3", "Personal", "Proof", "Net", "Parity", "Health", "Admin", "Testing"],
5050
"AdditionalRpcUrls": ["http://0.0.0.0:8550|http;ws|debug;net;eth;subscribe;engine;web3;client;admin|no-auth", "http://0.0.0.0:8551|http;ws|debug;net;eth;subscribe;engine;web3;client;admin"]
5151
}
5252
}
5353
else
5454
{
5555
"JsonRpc": {
56-
"EnabledModules": ["Debug", "Eth", "Subscribe", "Trace", "TxPool", "Web3", "Personal", "Proof", "Net", "Parity", "Health", "Admin"]
56+
"EnabledModules": ["Debug", "Eth", "Subscribe", "Trace", "TxPool", "Web3", "Personal", "Proof", "Net", "Parity", "Health", "Admin", "Testing"]
5757
}
5858
}
5959
end
@@ -79,6 +79,18 @@ def txpool_config:
7979
end
8080
;
8181

82+
def blocks_config:
83+
if env.HIVE_TARGET_GAS_LIMIT != null then
84+
{
85+
"Blocks": {
86+
"TargetBlockGasLimit": (env.HIVE_TARGET_GAS_LIMIT | tonumber)
87+
}
88+
}
89+
else
90+
{}
91+
end
92+
;
93+
8294
def base_config:
8395
{
8496
"Init": {
@@ -116,4 +128,4 @@ def base_config:
116128
;
117129

118130
# This is the main expression that outputs the config.
119-
base_config * keystore_config * merge_config * json_rpc_config * sync_config * txpool_config
131+
base_config * keystore_config * merge_config * json_rpc_config * sync_config * txpool_config * blocks_config

0 commit comments

Comments
 (0)