mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-18 17:37:33 +00:00
rename loadExecutionBlockRoot
> loadExecutionBlockHash
(#4807)
There are still some `executionBlockRoot` after this, separate rename.
This commit is contained in:
parent
d1318fbe96
commit
c3d043c0e1
@ -774,7 +774,7 @@ proc getBeaconHead*(
|
|||||||
pool: AttestationPool, headBlock: BlockRef): BeaconHead =
|
pool: AttestationPool, headBlock: BlockRef): BeaconHead =
|
||||||
let
|
let
|
||||||
finalizedExecutionPayloadHash =
|
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
|
# 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()
|
safeBlockRoot = pool.forkChoice.get_safe_beacon_block_root()
|
||||||
@ -789,7 +789,7 @@ proc getBeaconHead*(
|
|||||||
# let's just report the finalized execution payload hash instead.
|
# let's just report the finalized execution payload hash instead.
|
||||||
finalizedExecutionPayloadHash
|
finalizedExecutionPayloadHash
|
||||||
else:
|
else:
|
||||||
pool.dag.loadExecutionBlockRoot(safeBlock.get)
|
pool.dag.loadExecutionBlockHash(safeBlock.get)
|
||||||
|
|
||||||
BeaconHead(
|
BeaconHead(
|
||||||
blck: headBlock,
|
blck: headBlock,
|
||||||
|
@ -1964,7 +1964,7 @@ proc pruneHistory*(dag: ChainDAGRef, startup = false) =
|
|||||||
for fork in ConsensusFork.Phase0..<blockFork:
|
for fork in ConsensusFork.Phase0..<blockFork:
|
||||||
dag.db.clearBlocks(fork)
|
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:
|
if dag.cfg.consensusForkAtEpoch(bid.slot.epoch) < ConsensusFork.Bellatrix:
|
||||||
return ZERO_HASH
|
return ZERO_HASH
|
||||||
|
|
||||||
@ -1977,9 +1977,9 @@ proc loadExecutionBlockRoot*(dag: ChainDAGRef, bid: BlockId): Eth2Digest =
|
|||||||
else:
|
else:
|
||||||
ZERO_HASH
|
ZERO_HASH
|
||||||
|
|
||||||
proc loadExecutionBlockRoot*(dag: ChainDAGRef, blck: BlockRef): Eth2Digest =
|
proc loadExecutionBlockHash*(dag: ChainDAGRef, blck: BlockRef): Eth2Digest =
|
||||||
if blck.executionBlockRoot.isNone:
|
if blck.executionBlockRoot.isNone:
|
||||||
blck.executionBlockRoot = Opt.some dag.loadExecutionBlockRoot(blck.bid)
|
blck.executionBlockRoot = Opt.some dag.loadExecutionBlockHash(blck.bid)
|
||||||
blck.executionBlockRoot.unsafeGet
|
blck.executionBlockRoot.unsafeGet
|
||||||
|
|
||||||
from std/packedsets import PackedSet, incl, items
|
from std/packedsets import PackedSet, incl, items
|
||||||
@ -2199,8 +2199,8 @@ proc updateHead*(
|
|||||||
|
|
||||||
dag.db.updateFinalizedBlocks(newFinalized)
|
dag.db.updateFinalizedBlocks(newFinalized)
|
||||||
|
|
||||||
if dag.loadExecutionBlockRoot(oldFinalizedHead.blck).isZero and
|
if dag.loadExecutionBlockHash(oldFinalizedHead.blck).isZero and
|
||||||
not dag.loadExecutionBlockRoot(dag.finalizedHead.blck).isZero and
|
not dag.loadExecutionBlockHash(dag.finalizedHead.blck).isZero and
|
||||||
dag.vanityLogs.onFinalizedMergeTransitionBlock != nil:
|
dag.vanityLogs.onFinalizedMergeTransitionBlock != nil:
|
||||||
dag.vanityLogs.onFinalizedMergeTransitionBlock()
|
dag.vanityLogs.onFinalizedMergeTransitionBlock()
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ func setOptimisticHead*(
|
|||||||
|
|
||||||
proc updateExecutionClientHead(self: ref ConsensusManager,
|
proc updateExecutionClientHead(self: ref ConsensusManager,
|
||||||
newHead: BeaconHead): Future[Opt[void]] {.async.} =
|
newHead: BeaconHead): Future[Opt[void]] {.async.} =
|
||||||
let headExecutionPayloadHash = self.dag.loadExecutionBlockRoot(newHead.blck)
|
let headExecutionPayloadHash = self.dag.loadExecutionBlockHash(newHead.blck)
|
||||||
|
|
||||||
if headExecutionPayloadHash.isZero:
|
if headExecutionPayloadHash.isZero:
|
||||||
# Blocks without execution payloads can't be optimistic.
|
# 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
|
head = shortLog(self.dag.head), wallSlot
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.dag.loadExecutionBlockRoot(newHead.blck).isZero:
|
if self.dag.loadExecutionBlockHash(newHead.blck).isZero:
|
||||||
# Blocks without execution payloads can't be optimistic.
|
# Blocks without execution payloads can't be optimistic.
|
||||||
self.dag.markBlockVerified(self.quarantine[], newHead.blck.root)
|
self.dag.markBlockVerified(self.quarantine[], newHead.blck.root)
|
||||||
|
|
||||||
@ -335,7 +335,7 @@ proc runProposalForkchoiceUpdated*(
|
|||||||
else:
|
else:
|
||||||
Opt.none(seq[Withdrawal])
|
Opt.none(seq[Withdrawal])
|
||||||
beaconHead = self.attestationPool[].getBeaconHead(self.dag.head)
|
beaconHead = self.attestationPool[].getBeaconHead(self.dag.head)
|
||||||
headBlockHash = self.dag.loadExecutionBlockRoot(beaconHead.blck)
|
headBlockHash = self.dag.loadExecutionBlockHash(beaconHead.blck)
|
||||||
|
|
||||||
if headBlockHash.isZero:
|
if headBlockHash.isZero:
|
||||||
return
|
return
|
||||||
|
@ -255,7 +255,7 @@ proc expectValidForkchoiceUpdated(
|
|||||||
from ../consensus_object_pools/attestation_pool import
|
from ../consensus_object_pools/attestation_pool import
|
||||||
addForkChoice, selectOptimisticHead, BeaconHead
|
addForkChoice, selectOptimisticHead, BeaconHead
|
||||||
from ../consensus_object_pools/blockchain_dag import
|
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 ../consensus_object_pools/spec_cache import get_attesting_indices
|
||||||
from ../spec/datatypes/phase0 import TrustedSignedBeaconBlock
|
from ../spec/datatypes/phase0 import TrustedSignedBeaconBlock
|
||||||
from ../spec/datatypes/altair import SignedBeaconBlock
|
from ../spec/datatypes/altair import SignedBeaconBlock
|
||||||
@ -516,7 +516,7 @@ proc storeBlock*(
|
|||||||
else:
|
else:
|
||||||
let
|
let
|
||||||
headExecutionPayloadHash =
|
headExecutionPayloadHash =
|
||||||
self.consensusManager.dag.loadExecutionBlockRoot(newHead.get.blck)
|
self.consensusManager.dag.loadExecutionBlockHash(newHead.get.blck)
|
||||||
wallSlot = self.getBeaconTime().slotOrZero
|
wallSlot = self.getBeaconTime().slotOrZero
|
||||||
if headExecutionPayloadHash.isZero or
|
if headExecutionPayloadHash.isZero or
|
||||||
NewPayloadStatus.noResponse == payloadStatus:
|
NewPayloadStatus.noResponse == payloadStatus:
|
||||||
|
@ -199,7 +199,7 @@ template validateBeaconBlockBellatrix(
|
|||||||
# exactly equivalent to whether that block's execution payload is default or
|
# exactly equivalent to whether that block's execution payload is default or
|
||||||
# not, so test cached block information rather than reconstructing a state.
|
# not, so test cached block information rather than reconstructing a state.
|
||||||
if signed_beacon_block.message.is_execution_block or
|
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
|
# [REJECT] The block's execution payload timestamp is correct with respect
|
||||||
# to the slot -- i.e. execution_payload.timestamp ==
|
# to the slot -- i.e. execution_payload.timestamp ==
|
||||||
# compute_timestamp_at_slot(state, block.slot).
|
# compute_timestamp_at_slot(state, block.slot).
|
||||||
@ -376,7 +376,7 @@ proc validateBeaconBlock*(
|
|||||||
# `is_execution_enabled(state, block.body)` check, but unlike in
|
# `is_execution_enabled(state, block.body)` check, but unlike in
|
||||||
# validateBeaconBlockBellatrix() don't have parent BlockRef.
|
# validateBeaconBlockBellatrix() don't have parent BlockRef.
|
||||||
if signed_beacon_block.message.is_execution_block or
|
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
|
# Blocks with execution enabled will be permitted to propagate
|
||||||
# regardless of the validity of the execution payload. This prevents
|
# regardless of the validity of the execution payload. This prevents
|
||||||
# network segregation between optimistic and non-optimistic nodes.
|
# network segregation between optimistic and non-optimistic nodes.
|
||||||
|
@ -153,7 +153,7 @@ proc installDebugApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
|||||||
NodeValidity.optimistic
|
NodeValidity.optimistic
|
||||||
else:
|
else:
|
||||||
NodeValidity.valid,
|
NodeValidity.valid,
|
||||||
execution_block_hash: node.dag.loadExecutionBlockRoot(item.bid),
|
execution_block_hash: node.dag.loadExecutionBlockHash(item.bid),
|
||||||
extra_data: some NodeExtraData(
|
extra_data: some NodeExtraData(
|
||||||
justified_root: item.checkpoints.justified.root,
|
justified_root: item.checkpoints.justified.root,
|
||||||
finalized_root: item.checkpoints.finalized.root,
|
finalized_root: item.checkpoints.finalized.root,
|
||||||
|
@ -620,7 +620,7 @@ proc getBlindedBlockParts[EPH: ForkyExecutionPayloadHeader](
|
|||||||
graffiti: GraffitiBytes): Future[Result[(EPH, UInt256, ForkedBeaconBlock), string]]
|
graffiti: GraffitiBytes): Future[Result[(EPH, UInt256, ForkedBeaconBlock), string]]
|
||||||
{.async.} =
|
{.async.} =
|
||||||
let
|
let
|
||||||
executionBlockRoot = node.dag.loadExecutionBlockRoot(head)
|
executionBlockRoot = node.dag.loadExecutionBlockHash(head)
|
||||||
executionPayloadHeader =
|
executionPayloadHeader =
|
||||||
try:
|
try:
|
||||||
awaitWithTimeout(
|
awaitWithTimeout(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user