rename `loadExecutionBlockRoot` > `loadExecutionBlockHash` (#4807)

There are still some `executionBlockRoot` after this, separate rename.
This commit is contained in:
Etan Kissling 2023-04-11 18:56:29 +02:00 committed by GitHub
parent d1318fbe96
commit c3d043c0e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 16 deletions

View File

@ -774,7 +774,7 @@ proc getBeaconHead*(
pool: AttestationPool, headBlock: BlockRef): BeaconHead =
let
finalizedExecutionPayloadHash =
pool.dag.loadExecutionBlockRoot(pool.dag.finalizedHead.blck)
pool.dag.loadExecutionBlockHash(pool.dag.finalizedHead.blck)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.5/fork_choice/safe-block.md#get_safe_execution_payload_hash
safeBlockRoot = pool.forkChoice.get_safe_beacon_block_root()
@ -789,7 +789,7 @@ proc getBeaconHead*(
# let's just report the finalized execution payload hash instead.
finalizedExecutionPayloadHash
else:
pool.dag.loadExecutionBlockRoot(safeBlock.get)
pool.dag.loadExecutionBlockHash(safeBlock.get)
BeaconHead(
blck: headBlock,

View File

@ -1964,7 +1964,7 @@ proc pruneHistory*(dag: ChainDAGRef, startup = false) =
for fork in ConsensusFork.Phase0..<blockFork:
dag.db.clearBlocks(fork)
proc loadExecutionBlockRoot*(dag: ChainDAGRef, bid: BlockId): Eth2Digest =
proc loadExecutionBlockHash*(dag: ChainDAGRef, bid: BlockId): Eth2Digest =
if dag.cfg.consensusForkAtEpoch(bid.slot.epoch) < ConsensusFork.Bellatrix:
return ZERO_HASH
@ -1977,9 +1977,9 @@ proc loadExecutionBlockRoot*(dag: ChainDAGRef, bid: BlockId): Eth2Digest =
else:
ZERO_HASH
proc loadExecutionBlockRoot*(dag: ChainDAGRef, blck: BlockRef): Eth2Digest =
proc loadExecutionBlockHash*(dag: ChainDAGRef, blck: BlockRef): Eth2Digest =
if blck.executionBlockRoot.isNone:
blck.executionBlockRoot = Opt.some dag.loadExecutionBlockRoot(blck.bid)
blck.executionBlockRoot = Opt.some dag.loadExecutionBlockHash(blck.bid)
blck.executionBlockRoot.unsafeGet
from std/packedsets import PackedSet, incl, items
@ -2199,8 +2199,8 @@ proc updateHead*(
dag.db.updateFinalizedBlocks(newFinalized)
if dag.loadExecutionBlockRoot(oldFinalizedHead.blck).isZero and
not dag.loadExecutionBlockRoot(dag.finalizedHead.blck).isZero and
if dag.loadExecutionBlockHash(oldFinalizedHead.blck).isZero and
not dag.loadExecutionBlockHash(dag.finalizedHead.blck).isZero and
dag.vanityLogs.onFinalizedMergeTransitionBlock != nil:
dag.vanityLogs.onFinalizedMergeTransitionBlock()

View File

@ -157,7 +157,7 @@ func setOptimisticHead*(
proc updateExecutionClientHead(self: ref ConsensusManager,
newHead: BeaconHead): Future[Opt[void]] {.async.} =
let headExecutionPayloadHash = self.dag.loadExecutionBlockRoot(newHead.blck)
let headExecutionPayloadHash = self.dag.loadExecutionBlockHash(newHead.blck)
if headExecutionPayloadHash.isZero:
# Blocks without execution payloads can't be optimistic.
@ -229,7 +229,7 @@ proc updateHead*(self: var ConsensusManager, wallSlot: Slot) =
head = shortLog(self.dag.head), wallSlot
return
if self.dag.loadExecutionBlockRoot(newHead.blck).isZero:
if self.dag.loadExecutionBlockHash(newHead.blck).isZero:
# Blocks without execution payloads can't be optimistic.
self.dag.markBlockVerified(self.quarantine[], newHead.blck.root)
@ -335,7 +335,7 @@ proc runProposalForkchoiceUpdated*(
else:
Opt.none(seq[Withdrawal])
beaconHead = self.attestationPool[].getBeaconHead(self.dag.head)
headBlockHash = self.dag.loadExecutionBlockRoot(beaconHead.blck)
headBlockHash = self.dag.loadExecutionBlockHash(beaconHead.blck)
if headBlockHash.isZero:
return

View File

@ -255,7 +255,7 @@ proc expectValidForkchoiceUpdated(
from ../consensus_object_pools/attestation_pool import
addForkChoice, selectOptimisticHead, BeaconHead
from ../consensus_object_pools/blockchain_dag import
is_optimistic, loadExecutionBlockRoot, markBlockVerified
is_optimistic, loadExecutionBlockHash, markBlockVerified
from ../consensus_object_pools/spec_cache import get_attesting_indices
from ../spec/datatypes/phase0 import TrustedSignedBeaconBlock
from ../spec/datatypes/altair import SignedBeaconBlock
@ -516,7 +516,7 @@ proc storeBlock*(
else:
let
headExecutionPayloadHash =
self.consensusManager.dag.loadExecutionBlockRoot(newHead.get.blck)
self.consensusManager.dag.loadExecutionBlockHash(newHead.get.blck)
wallSlot = self.getBeaconTime().slotOrZero
if headExecutionPayloadHash.isZero or
NewPayloadStatus.noResponse == payloadStatus:

View File

@ -199,7 +199,7 @@ template validateBeaconBlockBellatrix(
# exactly equivalent to whether that block's execution payload is default or
# not, so test cached block information rather than reconstructing a state.
if signed_beacon_block.message.is_execution_block or
not dag.loadExecutionBlockRoot(parent).isZero:
not dag.loadExecutionBlockHash(parent).isZero:
# [REJECT] The block's execution payload timestamp is correct with respect
# to the slot -- i.e. execution_payload.timestamp ==
# compute_timestamp_at_slot(state, block.slot).
@ -376,7 +376,7 @@ proc validateBeaconBlock*(
# `is_execution_enabled(state, block.body)` check, but unlike in
# validateBeaconBlockBellatrix() don't have parent BlockRef.
if signed_beacon_block.message.is_execution_block or
not dag.loadExecutionBlockRoot(dag.finalizedHead.blck).isZero:
not dag.loadExecutionBlockHash(dag.finalizedHead.blck).isZero:
# Blocks with execution enabled will be permitted to propagate
# regardless of the validity of the execution payload. This prevents
# network segregation between optimistic and non-optimistic nodes.

View File

@ -153,7 +153,7 @@ proc installDebugApiHandlers*(router: var RestRouter, node: BeaconNode) =
NodeValidity.optimistic
else:
NodeValidity.valid,
execution_block_hash: node.dag.loadExecutionBlockRoot(item.bid),
execution_block_hash: node.dag.loadExecutionBlockHash(item.bid),
extra_data: some NodeExtraData(
justified_root: item.checkpoints.justified.root,
finalized_root: item.checkpoints.finalized.root,

View File

@ -620,7 +620,7 @@ proc getBlindedBlockParts[EPH: ForkyExecutionPayloadHeader](
graffiti: GraffitiBytes): Future[Result[(EPH, UInt256, ForkedBeaconBlock), string]]
{.async.} =
let
executionBlockRoot = node.dag.loadExecutionBlockRoot(head)
executionBlockRoot = node.dag.loadExecutionBlockHash(head)
executionPayloadHeader =
try:
awaitWithTimeout(