Skip to content

Commit 313a35d

Browse files
committed
lvh -> latestValidHash and only invalidate one specific block"
1 parent bdad06b commit 313a35d

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

beacon_chain/consensus_object_pools/blockchain_dag.nim

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,8 +1899,9 @@ proc updateHead*(
18991899
dag.onFinHappened(dag, data)
19001900

19011901
proc getEarliestInvalidRoot*(
1902-
dag: ChainDAGRef, initialSearchRoot: Eth2Digest, lvh: Eth2Digest,
1903-
defaultEarliestInvalidRoot: Eth2Digest): Eth2Digest =
1902+
dag: ChainDAGRef, initialSearchRoot: Eth2Digest,
1903+
latestValidHash: Eth2Digest, defaultEarliestInvalidRoot: Eth2Digest):
1904+
Eth2Digest =
19041905
# Earliest within a chain/fork in question, per LVH definition. Intended to
19051906
# be called with `initialRoot` as the parent of the block regarding which a
19061907
# newPayload or forkchoiceUpdated execution_status has been received as the
@@ -1918,18 +1919,19 @@ proc getEarliestInvalidRoot*(
19181919
# Only allow this special case outside loop; it's when the LVH is the direct
19191920
# parent of the reported invalid block
19201921
if curBlck.executionBlockRoot.isSome and
1921-
curBlck.executionBlockRoot.get == lvh:
1922+
curBlck.executionBlockRoot.get == latestValidHash:
19221923
return defaultEarliestInvalidRoot
19231924

19241925
while true:
19251926
# This was supposed to have been either caught by the pre-loop check or the
19261927
# parent check.
19271928
if curBlck.executionBlockRoot.isSome and
1928-
curBlck.executionBlockRoot.get == lvh:
1929+
curBlck.executionBlockRoot.get == latestValidHash:
19291930
doAssert false, "getEarliestInvalidRoot: unexpected LVH in loop body"
19301931

19311932
if (curBlck.parent.isNil) or
1932-
curBlck.parent.executionBlockRoot.get(lvh) == lvh:
1933+
curBlck.parent.executionBlockRoot.get(latestValidHash) ==
1934+
latestValidHash:
19331935
break
19341936
curBlck = curBlck.parent
19351937

beacon_chain/consensus_object_pools/consensus_manager.nim

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,9 @@ proc updateExecutionClientHead(
247247
else:
248248
newHead.blck.root
249249

250-
self.attestationPool[].forkChoice.mark_root_invalid(
251-
earliestKnownInvalidRoot)
250+
self.attestationPool[].forkChoice.mark_root_invalid(newHead.blck.root)
252251
self.dag.markBlockInvalid(newHead.blck.root)
253-
self.dag.markBlockInvalid(earliestKnownInvalidRoot)
254252
self.quarantine[].addUnviable(newHead.blck.root)
255-
self.quarantine[].addUnviable(earliestKnownInvalidRoot)
256253
return Opt.none(void)
257254
of PayloadExecutionStatus.accepted, PayloadExecutionStatus.syncing:
258255
self.dag.optimisticRoots.incl newHead.blck.root

0 commit comments

Comments
 (0)