nimbus-eth1/hive_integration/nodocker/engine/helper.nim

31 lines
1.1 KiB
Nim
Raw Normal View History

2023-11-01 03:32:09 +00:00
# Nimbus
# Copyright (c) 2023-2024 Status Research & Development GmbH
2023-11-01 03:32:09 +00:00
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0)
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or
# http://opensource.org/licenses/MIT)
# at your option. This file may not be copied, modified, or distributed except
# according to those terms.
import
2023-10-31 03:18:37 +00:00
eth/[common, rlp],
2023-11-03 02:24:51 +00:00
chronicles,
web3/execution_types,
2023-11-03 02:24:51 +00:00
../../../nimbus/beacon/web3_eth_conv,
./engine_client,
./types
proc txInPayload*(payload: ExecutionPayload, txHash: common.Hash256): bool =
for txBytes in payload.transactions:
let currTx = rlp.decode(common.Blob txBytes, Transaction)
if rlpHash(currTx) == txHash:
return true
2023-11-03 02:24:51 +00:00
proc checkPrevRandaoValue*(client: RpcClient, expectedPrevRandao: common.Hash256, blockNumber: uint64): bool =
let storageKey = blockNumber.u256
let r = client.storageAt(prevRandaoContractAddr, storageKey)
let expected = FixedBytes[32](expectedPrevRandao.data)
2023-11-03 02:24:51 +00:00
r.expectStorageEqual(expected)
return true