2023-11-01 03:32:09 +00:00
|
|
|
# Nimbus
|
|
|
|
# Copyright (c) 2023 Status Research & Development GmbH
|
|
|
|
# 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.
|
|
|
|
|
2022-04-11 10:00:39 +00:00
|
|
|
import
|
2023-10-31 03:18:37 +00:00
|
|
|
eth/[common, rlp],
|
2023-11-03 02:24:51 +00:00
|
|
|
chronicles,
|
2023-12-08 09:35:50 +00:00
|
|
|
web3/execution_types,
|
2023-11-03 02:24:51 +00:00
|
|
|
../../../nimbus/beacon/web3_eth_conv,
|
|
|
|
./engine_client,
|
|
|
|
./types
|
2023-03-09 23:40:55 +00:00
|
|
|
|
2023-08-27 01:23:45 +00:00
|
|
|
proc txInPayload*(payload: ExecutionPayload, txHash: common.Hash256): bool =
|
2022-06-27 05:26:03 +00:00
|
|
|
for txBytes in payload.transactions:
|
2023-01-27 14:57:48 +00:00
|
|
|
let currTx = rlp.decode(common.Blob txBytes, Transaction)
|
2022-06-27 05:26:03 +00:00
|
|
|
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 = UInt256.fromBytesBE(expectedPrevRandao.data)
|
|
|
|
r.expectStorageEqual(expected)
|
|
|
|
return true
|