Skip to content

Commit

Permalink
Revert "Adopt latest changes to requests hash computation" (#2892)
Browse files Browse the repository at this point in the history
* Revert "Adopt latest changes to requests hash computation (#2862)"

This reverts commit 1721435.

* Fix test vector requestHash

---------

Co-authored-by: jangko <jangko128@gmail.com>
  • Loading branch information
tersec and jangko authored Nov 29, 2024
1 parent 6142183 commit b2a4373
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 957 deletions.
2 changes: 1 addition & 1 deletion nimbus/common/chain_config_hash.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nimbus
# Copyright (c) 2024 Status Research & Development GmbH
# Copyright (c) 2021-2024 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
Expand Down
5 changes: 0 additions & 5 deletions nimbus/common/genesis.nim
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import
eth/common/[hashes, accounts, headers, addresses],
../db/[ledger, core_db],
../constants,
../utils/utils,
./chain_config

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

if fork >= Prague:
const EmptyRequestsHash = calcRequestsHash()
result.requestsHash = Opt.some(EmptyRequestsHash)

proc toGenesisHeader*(
genesis: Genesis;
fork: HardFork;
Expand Down
3 changes: 1 addition & 2 deletions nimbus/utils/utils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ func calcRequestsHash*(requests: varargs[seq[byte]]): Hash32 =
var ctx: sha256
ctx.init()
for i, data in requests:
if data.len > 0:
ctx.update(calcHash(i.byte, data).data)
ctx.update(calcHash(i.byte, data).data)
ctx.finish(result.data)
ctx.clear()

Expand Down
Loading

0 comments on commit b2a4373

Please sign in to comment.