mirror of https://github.com/status-im/nim-eth.git
prevRandao -> Bytes32 (#740)
This one is a bit of a mess because it has different names and types across specs :/
This commit is contained in:
parent
70b7519f02
commit
5ce3c4557f
|
@ -29,7 +29,9 @@ type
|
|||
gasUsed*: GasInt
|
||||
timestamp*: EthTime
|
||||
extraData*: seq[byte]
|
||||
mixHash*: Hash32
|
||||
mixHash*: Bytes32
|
||||
## AKA mix_digest in some specs - Hash32 in the eth API but Bytes32 in
|
||||
## the execution API and spec!
|
||||
nonce*: Bytes8
|
||||
baseFeePerGas*: Opt[UInt256] # EIP-1559
|
||||
withdrawalsRoot*: Opt[Hash32] # EIP-4895
|
||||
|
@ -39,10 +41,10 @@ type
|
|||
requestsRoot*: Opt[Hash32] # EIP-7685
|
||||
|
||||
# starting from EIP-4399, `mixDigest` field is called `prevRandao`
|
||||
template prevRandao*(h: Header): Hash32 =
|
||||
template prevRandao*(h: Header): Bytes32 =
|
||||
h.mixHash
|
||||
|
||||
template `prevRandao=`*(h: Header, hash: Hash32) =
|
||||
template `prevRandao=`*(h: Header, hash: Bytes32) =
|
||||
h.mixHash = hash
|
||||
|
||||
template txRoot*(h: Header): Root = h.transactionsRoot
|
||||
|
|
|
@ -60,9 +60,9 @@ suite "BlockHashOrNumber":
|
|||
suite "Block encodings":
|
||||
test "EIP-4399 prevRandao field":
|
||||
var blk: BlockHeader
|
||||
blk.prevRandao = testHash
|
||||
blk.prevRandao = Bytes32 testHash
|
||||
let res = blk.prevRandao
|
||||
check testHash == res
|
||||
check Bytes32(testHash) == res
|
||||
|
||||
test "EIP-4788 parentBeaconBlockRoot field":
|
||||
let header = BlockHeader(
|
||||
|
|
Loading…
Reference in New Issue