mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-24 05:22:03 +00:00
avoid sending redundant LC finality updates (#4546)
When the epoch boundary block is missed, we incorrectly assume that the next couple blocks improve finality, leading to repeated pushes of the same light client finality update and incorrectly ignoring some gossip.
This commit is contained in:
parent
fe1a57c220
commit
efbd4e395a
@ -559,15 +559,24 @@ proc createLightClientUpdates(
|
||||
if is_later and latest.assign_attested_header_with_migration(attested_bid):
|
||||
template forkyLatest: untyped = latest.forky(data_fork)
|
||||
load_attested_data(attested_bid)
|
||||
let finalized_slot = attested_data.finalized_slot
|
||||
var finalized_slot = attested_data.finalized_slot
|
||||
if finalized_slot == forkyLatest.finalized_header.beacon.slot:
|
||||
forkyLatest.finality_branch = attested_data.finality_branch
|
||||
elif finalized_slot < dag.tail.slot or
|
||||
not load_finalized_bid(finalized_slot):
|
||||
forkyLatest.finalized_header.reset()
|
||||
forkyLatest.finality_branch.reset()
|
||||
else:
|
||||
if finalized_bid.slot != finalized_slot:
|
||||
finalized_slot = finalized_bid.slot
|
||||
attested_data.finalized_slot = finalized_slot
|
||||
dag.lcDataStore.cache.data[attested_bid] = attested_data
|
||||
if finalized_slot == forkyLatest.finalized_header.beacon.slot:
|
||||
forkyLatest.finality_branch = attested_data.finality_branch
|
||||
elif finalized_slot == GENESIS_SLOT:
|
||||
forkyLatest.finalized_header.reset()
|
||||
forkyLatest.finality_branch = attested_data.finality_branch
|
||||
elif finalized_slot >= dag.tail.slot and
|
||||
load_finalized_bid(finalized_slot) and
|
||||
forkyLatest.assign_finalized_header(finalized_bid):
|
||||
elif forkyLatest.assign_finalized_header(finalized_bid):
|
||||
forkyLatest.finality_branch = attested_data.finality_branch
|
||||
newFinality = true
|
||||
else:
|
||||
|
@ -295,8 +295,7 @@ template withReportedProgress(
|
||||
obj: SomeForkedLightClientObject | Nothing, body: untyped): bool =
|
||||
block:
|
||||
let
|
||||
oldIsInitialized =
|
||||
self.store[].kind != LightClientDataFork.None
|
||||
oldIsInitialized = self.store[].kind > LightClientDataFork.None
|
||||
oldNextCommitteeKnown = withForkyStore(self.store[]):
|
||||
when lcDataFork > LightClientDataFork.None:
|
||||
forkyStore.is_next_sync_committee_known
|
||||
@ -324,7 +323,7 @@ template withReportedProgress(
|
||||
didProgress = false
|
||||
didSignificantProgress = false
|
||||
|
||||
let newIsInitialized = self.store[].kind != LightClientDataFork.None
|
||||
let newIsInitialized = self.store[].kind > LightClientDataFork.None
|
||||
if newIsInitialized > oldIsInitialized:
|
||||
didProgress = true
|
||||
didSignificantProgress = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user