Skip to content

Commit 79c495b

Browse files
committed
Adopt latest changes to requests hash computation
1 parent a241050 commit 79c495b

File tree

8 files changed

+955
-6
lines changed

8 files changed

+955
-6
lines changed

nimbus/common/chain_config_hash.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Nimbus
2-
# Copyright (c) 2021-2024 Status Research & Development GmbH
2+
# Copyright (c) 2024 Status Research & Development GmbH
33
# Licensed under either of
44
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
55
# * MIT license ([LICENSE-MIT](LICENSE-MIT))

nimbus/common/genesis.nim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import
1616
eth/common/[hashes, accounts, headers, addresses],
1717
../db/[ledger, core_db],
1818
../constants,
19+
../utils/utils,
1920
./chain_config
2021

2122
# ------------------------------------------------------------------------------
@@ -78,6 +79,10 @@ proc toGenesisHeader*(
7879
result.excessBlobGas = Opt.some g.excessBlobGas.get(0'u64)
7980
result.parentBeaconBlockRoot = Opt.some g.parentBeaconBlockRoot.get(default(Hash32))
8081

82+
if fork >= Prague:
83+
const EmptyRequestsHash = calcRequestsHash()
84+
result.requestsHash = Opt.some(EmptyRequestsHash)
85+
8186
proc toGenesisHeader*(
8287
genesis: Genesis;
8388
fork: HardFork;

nimbus/utils/utils.nim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ func calcRequestsHash*(requests: varargs[seq[byte]]): Hash32 =
4040
var ctx: sha256
4141
ctx.init()
4242
for i, data in requests:
43-
ctx.update(calcHash(i.byte, data).data)
43+
if data.len > 0:
44+
ctx.update(calcHash(i.byte, data).data)
4445
ctx.finish(result.data)
4546
ctx.clear()
4647

0 commit comments

Comments
 (0)