Use signature slot instead of attested header slot (#1811)

Use signature slot instead of attested header slot in the
OptimisticUpdate content key.
This commit is contained in:
Kim De Mey 2023-10-06 17:42:34 +02:00 committed by GitHub
parent f72f02c88b
commit 7b313ec1ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 7 additions and 7 deletions

View File

@ -330,7 +330,7 @@ proc loop(self: LightClientManager) {.async.} =
let finalizedSlot = start_slot(epoch(wallTime.slotOrZero()) - 2)
await self.query(FinalityUpdate, finalizedSlot)
of LcSyncKind.OptimisticUpdate:
let optimisticSlot = wallTime.slotOrZero() - 1
let optimisticSlot = wallTime.slotOrZero()
await self.query(OptimisticUpdate, optimisticSlot)
nextSyncTaskTime = wallTime + self.rng.nextLcSyncTaskDelay(

View File

@ -170,7 +170,7 @@ suite "Beacon Light Client Content Encodings - Mainnet":
let key = contentKey.value()
withForkyObject(update):
when lcDataFork > LightClientDataFork.None:
check forkyObject.attested_header.beacon.slot ==
check forkyObject.signature_slot ==
key.lightClientOptimisticUpdateKey.optimisticSlot
# re-encode content and content key

View File

@ -90,7 +90,7 @@ procSuite "Beacon Light Client Content Network":
lightClientOptimisticUpdateBytes, altair.LightClientOptimisticUpdate)
optimisticUpdate = ForkedLightClientOptimisticUpdate(
kind: LightClientDataFork.Altair, altairData: optimisticUpdateData)
optimisticHeaderSlot = optimisticUpdateData.attested_header.beacon.slot
optimisticHeaderSlot = optimisticUpdateData.signature_slot
finalityUpdateKey = finalityUpdateContentKey(
distinctBase(finalizedHeaderSlot)

View File

@ -231,7 +231,7 @@ proc gossipLCOptimisticUpdate*(
withForkyObject(update):
when lcDataFork > LightClientDataFork.None:
let
slot = forkyObject.attested_header.beacon.slot
slot = forkyObject.signature_slot
contentKey = encode(optimisticUpdateContentKey(slot.uint64))
forkDigest = forkDigestAtEpoch(
forkDigests[], epoch(forkyObject.attested_header.beacon.slot), cfg)

View File

@ -615,7 +615,7 @@ proc run(config: BeaconBridgeConf) {.raises: [CatchableError].} =
update, slot = forkyObject.attested_header.beacon.slot
let
slot = forkyObject.attested_header.beacon.slot
slot = forkyObject.signature_slot
contentKey = encode(optimisticUpdateContentKey(slot.uint64))
contentId = beacon_light_client_content.toContentId(contentKey)
forkDigest = forkDigestAtEpoch(

View File

@ -264,7 +264,7 @@ proc exportLCOptimisticUpdate*(
withForkyObject(update):
when lcDataFork > LightClientDataFork.None:
let
slot = forkyObject.attested_header.beacon.slot
slot = forkyObject.signature_slot
contentKey = encode(optimisticUpdateContentKey(slot.uint64))
contentId = beacon_light_client_content.toContentId(contentKey)
forkDigest = forkDigestAtEpoch(

@ -1 +1 @@
Subproject commit 26edde52b942020ef38aba3795400d713072cf21
Subproject commit cecc8767654e0b19d2bc55ae3a693d428774565c