rename `execution(Block|Payload)Root` > `executionBlockHash` (#4809)

Note: `execution_payload_root` is _actually_ `htr(payload)`.
Only `executionPayloadRoot` was used as `executionBlockHash`.
This commit is contained in:
Etan Kissling 2023-04-12 01:31:47 +02:00 committed by GitHub
parent dc22244b3e
commit 56986c08d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 11 deletions

View File

@ -34,7 +34,7 @@ type
bid*: BlockId ##\ bid*: BlockId ##\
## Root that can be used to retrieve block data from database ## Root that can be used to retrieve block data from database
executionBlockRoot*: Opt[Eth2Digest] executionBlockHash*: Opt[Eth2Digest]
parent*: BlockRef ##\ parent*: BlockRef ##\
## Not nil, except for the finalized head ## Not nil, except for the finalized head
@ -54,10 +54,10 @@ template slot*(blck: BlockRef): Slot = blck.bid.slot
func init*( func init*(
T: type BlockRef, root: Eth2Digest, T: type BlockRef, root: Eth2Digest,
executionPayloadRoot: Opt[Eth2Digest], slot: Slot): BlockRef = executionBlockHash: Opt[Eth2Digest], slot: Slot): BlockRef =
BlockRef( BlockRef(
bid: BlockId(root: root, slot: slot), bid: BlockId(root: root, slot: slot),
executionBlockRoot: executionPayloadRoot) executionBlockHash: executionBlockHash)
func init*( func init*(
T: type BlockRef, root: Eth2Digest, T: type BlockRef, root: Eth2Digest,

View File

@ -1978,9 +1978,9 @@ proc loadExecutionBlockHash*(dag: ChainDAGRef, bid: BlockId): Eth2Digest =
ZERO_HASH ZERO_HASH
proc loadExecutionBlockHash*(dag: ChainDAGRef, blck: BlockRef): Eth2Digest = proc loadExecutionBlockHash*(dag: ChainDAGRef, blck: BlockRef): Eth2Digest =
if blck.executionBlockRoot.isNone: if blck.executionBlockHash.isNone:
blck.executionBlockRoot = Opt.some dag.loadExecutionBlockHash(blck.bid) blck.executionBlockHash = Opt.some dag.loadExecutionBlockHash(blck.bid)
blck.executionBlockRoot.unsafeGet blck.executionBlockHash.unsafeGet
from std/packedsets import PackedSet, incl, items from std/packedsets import PackedSet, incl, items

View File

@ -51,19 +51,19 @@ proc getEarliestInvalidBlockRoot*(
# Only allow this special case outside loop; it's when the LVH is the direct # Only allow this special case outside loop; it's when the LVH is the direct
# parent of the reported invalid block # parent of the reported invalid block
if curBlck.executionBlockRoot.isSome and if curBlck.executionBlockHash.isSome and
curBlck.executionBlockRoot.get == latestValidHash: curBlck.executionBlockHash.get == latestValidHash:
return defaultEarliestInvalidBlockRoot return defaultEarliestInvalidBlockRoot
while true: while true:
# This was supposed to have been either caught by the pre-loop check or the # This was supposed to have been either caught by the pre-loop check or the
# parent check. # parent check.
if curBlck.executionBlockRoot.isSome and if curBlck.executionBlockHash.isSome and
curBlck.executionBlockRoot.get == latestValidHash: curBlck.executionBlockHash.get == latestValidHash:
doAssert false, "getEarliestInvalidBlockRoot: unexpected LVH in loop body" doAssert false, "getEarliestInvalidBlockRoot: unexpected LVH in loop body"
if (curBlck.parent.isNil) or if (curBlck.parent.isNil) or
curBlck.parent.executionBlockRoot.get(latestValidHash) == curBlck.parent.executionBlockHash.get(latestValidHash) ==
latestValidHash: latestValidHash:
break break
curBlck = curBlck.parent curBlck = curBlck.parent