mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-13 13:55:45 +00:00
Remove optimistic slot from FinalityUpdate content key (#1810)
This commit is contained in:
parent
43b6014ffe
commit
f72f02c88b
@ -51,12 +51,11 @@ type
|
|||||||
# this causes them also to be included in a request, which makes perhaps less
|
# this causes them also to be included in a request, which makes perhaps less
|
||||||
# sense?
|
# sense?
|
||||||
LightClientFinalityUpdateKey* = object
|
LightClientFinalityUpdateKey* = object
|
||||||
optimisticSlot*: uint64 ## slot of attested header of the update
|
|
||||||
finalizedSlot*: uint64 ## slot of finalized header of the update
|
finalizedSlot*: uint64 ## slot of finalized header of the update
|
||||||
|
|
||||||
# TODO: Same remark as for `LightClientFinalityUpdateKey`
|
# TODO: Same remark as for `LightClientFinalityUpdateKey`
|
||||||
LightClientOptimisticUpdateKey* = object
|
LightClientOptimisticUpdateKey* = object
|
||||||
optimisticSlot*: uint64 ## slot of attested header of the update
|
optimisticSlot*: uint64 ## signature_slot of the update
|
||||||
|
|
||||||
ContentKey* = object
|
ContentKey* = object
|
||||||
case contentType*: ContentType
|
case contentType*: ContentType
|
||||||
@ -159,7 +158,8 @@ func decodeForkedLightClientObject(
|
|||||||
|
|
||||||
withLcDataFork(lcDataForkAtConsensusFork(contextFork)):
|
withLcDataFork(lcDataForkAtConsensusFork(contextFork)):
|
||||||
when lcDataFork > LightClientDataFork.None:
|
when lcDataFork > LightClientDataFork.None:
|
||||||
let res = decodeSsz(data.toOpenArray(4, len(data) - 1), ObjType.Forky(lcDataFork))
|
let res = decodeSsz(
|
||||||
|
data.toOpenArray(4, len(data) - 1), ObjType.Forky(lcDataFork))
|
||||||
if res.isOk:
|
if res.isOk:
|
||||||
# TODO:
|
# TODO:
|
||||||
# How can we verify the Epoch vs fork, e.g. with `consensusForkAtEpoch`?
|
# How can we verify the Epoch vs fork, e.g. with `consensusForkAtEpoch`?
|
||||||
@ -235,12 +235,10 @@ func updateContentKey*(startPeriod: uint64, count: uint64): ContentKey =
|
|||||||
startPeriod: startPeriod, count: count)
|
startPeriod: startPeriod, count: count)
|
||||||
)
|
)
|
||||||
|
|
||||||
func finalityUpdateContentKey*(
|
func finalityUpdateContentKey*(finalizedSlot: uint64): ContentKey =
|
||||||
finalizedSlot: uint64, optimisticSlot: uint64): ContentKey =
|
|
||||||
ContentKey(
|
ContentKey(
|
||||||
contentType: lightClientFinalityUpdate,
|
contentType: lightClientFinalityUpdate,
|
||||||
lightClientFinalityUpdateKey: LightClientFinalityUpdateKey(
|
lightClientFinalityUpdateKey: LightClientFinalityUpdateKey(
|
||||||
optimisticSlot: optimisticSlot,
|
|
||||||
finalizedSlot: finalizedSlot
|
finalizedSlot: finalizedSlot
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -25,9 +25,6 @@ logScope:
|
|||||||
type
|
type
|
||||||
Nothing = object
|
Nothing = object
|
||||||
ResponseError = object of CatchableError
|
ResponseError = object of CatchableError
|
||||||
SlotInfo = object
|
|
||||||
finalizedSlot: Slot
|
|
||||||
optimisticSlot: Slot
|
|
||||||
|
|
||||||
NetRes*[T] = Result[T, void]
|
NetRes*[T] = Result[T, void]
|
||||||
Endpoint[K, V] =
|
Endpoint[K, V] =
|
||||||
@ -39,7 +36,7 @@ type
|
|||||||
tuple[startPeriod: SyncCommitteePeriod, count: uint64],
|
tuple[startPeriod: SyncCommitteePeriod, count: uint64],
|
||||||
ForkedLightClientUpdate]
|
ForkedLightClientUpdate]
|
||||||
FinalityUpdate =
|
FinalityUpdate =
|
||||||
Endpoint[SlotInfo, ForkedLightClientFinalityUpdate]
|
Endpoint[Slot, ForkedLightClientFinalityUpdate]
|
||||||
OptimisticUpdate =
|
OptimisticUpdate =
|
||||||
Endpoint[Slot, ForkedLightClientOptimisticUpdate]
|
Endpoint[Slot, ForkedLightClientOptimisticUpdate]
|
||||||
|
|
||||||
@ -142,11 +139,10 @@ proc doRequest(
|
|||||||
proc doRequest(
|
proc doRequest(
|
||||||
e: typedesc[FinalityUpdate],
|
e: typedesc[FinalityUpdate],
|
||||||
n: LightClientNetwork,
|
n: LightClientNetwork,
|
||||||
slotInfo: SlotInfo
|
finalizedSlot: Slot
|
||||||
): Future[NetRes[ForkedLightClientFinalityUpdate]] =
|
): Future[NetRes[ForkedLightClientFinalityUpdate]] =
|
||||||
n.getLightClientFinalityUpdate(
|
n.getLightClientFinalityUpdate(
|
||||||
distinctBase(slotInfo.finalizedSlot),
|
distinctBase(finalizedSlot)
|
||||||
distinctBase(slotInfo.optimisticSlot)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/light-client/p2p-interface.md#getlightclientoptimisticupdate
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/altair/light-client/p2p-interface.md#getlightclientoptimisticupdate
|
||||||
@ -331,17 +327,8 @@ proc loop(self: LightClientManager) {.async.} =
|
|||||||
await self.query(UpdatesByRange,
|
await self.query(UpdatesByRange,
|
||||||
(startPeriod: syncTask.startPeriod, count: syncTask.count))
|
(startPeriod: syncTask.startPeriod, count: syncTask.count))
|
||||||
of LcSyncKind.FinalityUpdate:
|
of LcSyncKind.FinalityUpdate:
|
||||||
let
|
let finalizedSlot = start_slot(epoch(wallTime.slotOrZero()) - 2)
|
||||||
# TODO: This is tricky. The optimistic slot kinda depends on when
|
await self.query(FinalityUpdate, finalizedSlot)
|
||||||
# the request for the finality update is send?
|
|
||||||
# How to resolve? Don't use the optimistic slot in the content key
|
|
||||||
# to begin with, does it add anything?
|
|
||||||
optimisticSlot = wallTime.slotOrZero() - 1
|
|
||||||
finalizedSlot = start_slot(epoch(wallTime.slotOrZero()) - 2)
|
|
||||||
await self.query(FinalityUpdate, SlotInfo(
|
|
||||||
finalizedSlot: finalizedSlot,
|
|
||||||
optimisticSlot: optimisticSlot
|
|
||||||
))
|
|
||||||
of LcSyncKind.OptimisticUpdate:
|
of LcSyncKind.OptimisticUpdate:
|
||||||
let optimisticSlot = wallTime.slotOrZero() - 1
|
let optimisticSlot = wallTime.slotOrZero() - 1
|
||||||
await self.query(OptimisticUpdate, optimisticSlot)
|
await self.query(OptimisticUpdate, optimisticSlot)
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
import
|
import
|
||||||
std/[options, tables],
|
|
||||||
stew/results, chronos, chronicles,
|
stew/results, chronos, chronicles,
|
||||||
eth/p2p/discoveryv5/[protocol, enr],
|
eth/p2p/discoveryv5/[protocol, enr],
|
||||||
beacon_chain/spec/forks,
|
beacon_chain/spec/forks,
|
||||||
@ -38,38 +37,44 @@ type
|
|||||||
func toContentIdHandler(contentKey: ByteList): results.Opt[ContentId] =
|
func toContentIdHandler(contentKey: ByteList): results.Opt[ContentId] =
|
||||||
ok(toContentId(contentKey))
|
ok(toContentId(contentKey))
|
||||||
|
|
||||||
|
proc getContent(
|
||||||
|
n: LightClientNetwork, contentKey: ContentKey):
|
||||||
|
Future[results.Opt[seq[byte]]] {.async.} =
|
||||||
|
let
|
||||||
|
contentKeyEncoded = encode(contentKey)
|
||||||
|
contentId = toContentId(contentKeyEncoded)
|
||||||
|
contentRes = await n.portalProtocol.contentLookup(
|
||||||
|
contentKeyEncoded, contentId)
|
||||||
|
|
||||||
|
if contentRes.isNone():
|
||||||
|
warn "Failed fetching content from the beacon chain network",
|
||||||
|
contentKey = contentKeyEncoded
|
||||||
|
return Opt.none(seq[byte])
|
||||||
|
else:
|
||||||
|
return Opt.some(contentRes.value().content)
|
||||||
|
|
||||||
proc getLightClientBootstrap*(
|
proc getLightClientBootstrap*(
|
||||||
n: LightClientNetwork,
|
n: LightClientNetwork,
|
||||||
trustedRoot: Digest):
|
trustedRoot: Digest):
|
||||||
Future[results.Opt[ForkedLightClientBootstrap]] {.async.} =
|
Future[results.Opt[ForkedLightClientBootstrap]] {.async.} =
|
||||||
let
|
let
|
||||||
bk = LightClientBootstrapKey(blockHash: trustedRoot)
|
contentKey = bootstrapContentKey(trustedRoot)
|
||||||
ck = ContentKey(
|
contentResult = await n.getContent(contentKey)
|
||||||
contentType: lightClientBootstrap,
|
|
||||||
lightClientBootstrapKey: bk
|
|
||||||
)
|
|
||||||
keyEncoded = encode(ck)
|
|
||||||
contentID = toContentId(keyEncoded)
|
|
||||||
|
|
||||||
let bootstrapContentLookup =
|
if contentResult.isNone():
|
||||||
await n.portalProtocol.contentLookup(keyEncoded, contentId)
|
return Opt.none(ForkedLightClientBootstrap)
|
||||||
|
|
||||||
if bootstrapContentLookup.isNone():
|
|
||||||
warn "Failed fetching LightClientBootstrap from the network",
|
|
||||||
trustedRoot, contentKey = keyEncoded
|
|
||||||
return Opt.none(ForkedLightClientBootstrap)
|
|
||||||
|
|
||||||
let
|
let
|
||||||
bootstrap = bootstrapContentLookup.unsafeGet()
|
bootstrap = contentResult.value()
|
||||||
decodingResult = decodeLightClientBootstrapForked(
|
decodingResult = decodeLightClientBootstrapForked(
|
||||||
n.forkDigests, bootstrap.content)
|
n.forkDigests, bootstrap)
|
||||||
|
|
||||||
if decodingResult.isErr:
|
if decodingResult.isErr():
|
||||||
return Opt.none(ForkedLightClientBootstrap)
|
return Opt.none(ForkedLightClientBootstrap)
|
||||||
else:
|
else:
|
||||||
# TODO Not doing validation for now, as probably it should be done by layer
|
# TODO Not doing validation for now, as probably it should be done by layer
|
||||||
# above
|
# above
|
||||||
return Opt.some(decodingResult.get())
|
return Opt.some(decodingResult.value())
|
||||||
|
|
||||||
proc getLightClientUpdatesByRange*(
|
proc getLightClientUpdatesByRange*(
|
||||||
n: LightClientNetwork,
|
n: LightClientNetwork,
|
||||||
@ -77,96 +82,66 @@ proc getLightClientUpdatesByRange*(
|
|||||||
count: uint64):
|
count: uint64):
|
||||||
Future[results.Opt[ForkedLightClientUpdateList]] {.async.} =
|
Future[results.Opt[ForkedLightClientUpdateList]] {.async.} =
|
||||||
let
|
let
|
||||||
bk = LightClientUpdateKey(
|
contentKey = updateContentKey(distinctBase(startPeriod), count)
|
||||||
startPeriod: distinctBase(startPeriod), count: count)
|
contentResult = await n.getContent(contentKey)
|
||||||
ck = ContentKey(
|
|
||||||
contentType: lightClientUpdate,
|
|
||||||
lightClientUpdateKey: bk
|
|
||||||
)
|
|
||||||
keyEncoded = encode(ck)
|
|
||||||
contentID = toContentId(keyEncoded)
|
|
||||||
|
|
||||||
let updatesResult =
|
if contentResult.isNone():
|
||||||
await n.portalProtocol.contentLookup(keyEncoded, contentId)
|
return Opt.none(ForkedLightClientUpdateList)
|
||||||
|
|
||||||
if updatesResult.isNone():
|
|
||||||
warn "Failed fetching updates network", contentKey = keyEncoded
|
|
||||||
return Opt.none(ForkedLightClientUpdateList)
|
|
||||||
|
|
||||||
let
|
let
|
||||||
updates = updatesResult.unsafeGet()
|
updates = contentResult.value()
|
||||||
decodingResult = decodeLightClientUpdatesByRange(
|
decodingResult = decodeLightClientUpdatesByRange(
|
||||||
n.forkDigests, updates.content)
|
n.forkDigests, updates)
|
||||||
|
|
||||||
if decodingResult.isErr:
|
if decodingResult.isErr():
|
||||||
return Opt.none(ForkedLightClientUpdateList)
|
return Opt.none(ForkedLightClientUpdateList)
|
||||||
else:
|
else:
|
||||||
# TODO Not doing validation for now, as probably it should be done by layer
|
# TODO Not doing validation for now, as probably it should be done by layer
|
||||||
# above
|
# above
|
||||||
return Opt.some(decodingResult.get())
|
return Opt.some(decodingResult.value())
|
||||||
|
|
||||||
proc getUpdate(
|
|
||||||
n: LightClientNetwork, ck: ContentKey):
|
|
||||||
Future[results.Opt[seq[byte]]] {.async.} =
|
|
||||||
let
|
|
||||||
keyEncoded = encode(ck)
|
|
||||||
contentID = toContentId(keyEncoded)
|
|
||||||
updateLookup = await n.portalProtocol.contentLookup(keyEncoded, contentId)
|
|
||||||
|
|
||||||
if updateLookup.isNone():
|
|
||||||
warn "Failed fetching update from the network", contentKey = keyEncoded
|
|
||||||
return Opt.none(seq[byte])
|
|
||||||
|
|
||||||
return ok(updateLookup.get().content)
|
|
||||||
|
|
||||||
# TODO:
|
|
||||||
# Currently both getLightClientFinalityUpdate and getLightClientOptimisticUpdate
|
|
||||||
# are implemented in naive way as finding first peer with any of those updates
|
|
||||||
# and treating it as latest. This will probably need to get improved.
|
|
||||||
proc getLightClientFinalityUpdate*(
|
proc getLightClientFinalityUpdate*(
|
||||||
n: LightClientNetwork,
|
n: LightClientNetwork,
|
||||||
currentFinalSlot: uint64,
|
finalizedSlot: uint64
|
||||||
currentOptimisticSlot: uint64
|
|
||||||
): Future[results.Opt[ForkedLightClientFinalityUpdate]] {.async.} =
|
): Future[results.Opt[ForkedLightClientFinalityUpdate]] {.async.} =
|
||||||
|
|
||||||
let
|
let
|
||||||
ck = finalityUpdateContentKey(currentFinalSlot, currentOptimisticSlot)
|
contentKey = finalityUpdateContentKey(finalizedSlot)
|
||||||
lookupResult = await n.getUpdate(ck)
|
contentResult = await n.getContent(contentKey)
|
||||||
|
|
||||||
if lookupResult.isErr:
|
if contentResult.isNone():
|
||||||
return Opt.none(ForkedLightClientFinalityUpdate)
|
return Opt.none(ForkedLightClientFinalityUpdate)
|
||||||
|
|
||||||
let
|
let
|
||||||
finalityUpdate = lookupResult.get()
|
finalityUpdate = contentResult.value()
|
||||||
decodingResult = decodeLightClientFinalityUpdateForked(
|
decodingResult = decodeLightClientFinalityUpdateForked(
|
||||||
n.forkDigests, finalityUpdate)
|
n.forkDigests, finalityUpdate)
|
||||||
|
|
||||||
if decodingResult.isErr:
|
if decodingResult.isErr():
|
||||||
return Opt.none(ForkedLightClientFinalityUpdate)
|
return Opt.none(ForkedLightClientFinalityUpdate)
|
||||||
else:
|
else:
|
||||||
return Opt.some(decodingResult.get())
|
return Opt.some(decodingResult.value())
|
||||||
|
|
||||||
proc getLightClientOptimisticUpdate*(
|
proc getLightClientOptimisticUpdate*(
|
||||||
n: LightClientNetwork,
|
n: LightClientNetwork,
|
||||||
currentOptimisticSlot: uint64
|
optimisticSlot: uint64
|
||||||
): Future[results.Opt[ForkedLightClientOptimisticUpdate]] {.async.} =
|
): Future[results.Opt[ForkedLightClientOptimisticUpdate]] {.async.} =
|
||||||
|
|
||||||
let
|
let
|
||||||
ck = optimisticUpdateContentKey(currentOptimisticSlot)
|
contentKey = optimisticUpdateContentKey(optimisticSlot)
|
||||||
lookupResult = await n.getUpdate(ck)
|
contentResult = await n.getContent(contentKey)
|
||||||
|
|
||||||
if lookupResult.isErr:
|
if contentResult.isNone():
|
||||||
return Opt.none(ForkedLightClientOptimisticUpdate)
|
return Opt.none(ForkedLightClientOptimisticUpdate)
|
||||||
|
|
||||||
let
|
let
|
||||||
optimisticUpdate = lookupResult.get()
|
optimisticUpdate = contentResult.value()
|
||||||
decodingResult = decodeLightClientOptimisticUpdateForked(
|
decodingResult = decodeLightClientOptimisticUpdateForked(
|
||||||
n.forkDigests, optimisticUpdate)
|
n.forkDigests, optimisticUpdate)
|
||||||
|
|
||||||
if decodingResult.isErr:
|
if decodingResult.isErr():
|
||||||
return Opt.none(ForkedLightClientOptimisticUpdate)
|
return Opt.none(ForkedLightClientOptimisticUpdate)
|
||||||
else:
|
else:
|
||||||
return Opt.some(decodingResult.get())
|
return Opt.some(decodingResult.value())
|
||||||
|
|
||||||
proc new*(
|
proc new*(
|
||||||
T: type LightClientNetwork,
|
T: type LightClientNetwork,
|
||||||
@ -306,7 +281,7 @@ proc processContentLoop(n: LightClientNetwork) {.async.} =
|
|||||||
trace "processContentLoop canceled"
|
trace "processContentLoop canceled"
|
||||||
|
|
||||||
proc start*(n: LightClientNetwork) =
|
proc start*(n: LightClientNetwork) =
|
||||||
info "Starting portal light client network"
|
info "Starting portal beacon chain network"
|
||||||
n.portalProtocol.start()
|
n.portalProtocol.start()
|
||||||
n.processContentLoop = processContentLoop(n)
|
n.processContentLoop = processContentLoop(n)
|
||||||
|
|
||||||
|
@ -136,12 +136,8 @@ suite "Beacon Light Client Content Encodings - Mainnet":
|
|||||||
let key = contentKey.value()
|
let key = contentKey.value()
|
||||||
withForkyObject(update):
|
withForkyObject(update):
|
||||||
when lcDataFork > LightClientDataFork.None:
|
when lcDataFork > LightClientDataFork.None:
|
||||||
let attestedSlot = forkyObject.attested_header.beacon.slot
|
check forkyObject.finalized_header.beacon.slot ==
|
||||||
let finalizedSlot = forkyObject.finalized_header.beacon.slot
|
key.lightClientFinalityUpdateKey.finalizedSlot
|
||||||
|
|
||||||
check:
|
|
||||||
attestedSlot == key.lightClientFinalityUpdateKey.optimisticSlot
|
|
||||||
finalizedSlot == key.lightClientFinalityUpdateKey.finalizedSlot
|
|
||||||
|
|
||||||
# re-encode content and content key
|
# re-encode content and content key
|
||||||
let encoded = encodeForkedLightClientObject(update, forkDigests.capella)
|
let encoded = encodeForkedLightClientObject(update, forkDigests.capella)
|
||||||
@ -174,10 +170,8 @@ suite "Beacon Light Client Content Encodings - Mainnet":
|
|||||||
let key = contentKey.value()
|
let key = contentKey.value()
|
||||||
withForkyObject(update):
|
withForkyObject(update):
|
||||||
when lcDataFork > LightClientDataFork.None:
|
when lcDataFork > LightClientDataFork.None:
|
||||||
let attestedSlot = forkyObject.attested_header.beacon.slot
|
check forkyObject.attested_header.beacon.slot ==
|
||||||
|
key.lightClientOptimisticUpdateKey.optimisticSlot
|
||||||
check:
|
|
||||||
attestedSlot == key.lightClientOptimisticUpdateKey.optimisticSlot
|
|
||||||
|
|
||||||
# re-encode content and content key
|
# re-encode content and content key
|
||||||
let encoded = encodeForkedLightClientObject(update, forkDigests.capella)
|
let encoded = encodeForkedLightClientObject(update, forkDigests.capella)
|
||||||
|
@ -93,8 +93,7 @@ procSuite "Beacon Light Client Content Network":
|
|||||||
optimisticHeaderSlot = optimisticUpdateData.attested_header.beacon.slot
|
optimisticHeaderSlot = optimisticUpdateData.attested_header.beacon.slot
|
||||||
|
|
||||||
finalityUpdateKey = finalityUpdateContentKey(
|
finalityUpdateKey = finalityUpdateContentKey(
|
||||||
distinctBase(finalizedHeaderSlot),
|
distinctBase(finalizedHeaderSlot)
|
||||||
distinctBase(finalizedOptimisticHeaderSlot)
|
|
||||||
)
|
)
|
||||||
finalityKeyEnc = encode(finalityUpdateKey)
|
finalityKeyEnc = encode(finalityUpdateKey)
|
||||||
finalityUpdateId = toContentId(finalityKeyEnc)
|
finalityUpdateId = toContentId(finalityKeyEnc)
|
||||||
@ -123,7 +122,6 @@ procSuite "Beacon Light Client Content Network":
|
|||||||
finalityResult =
|
finalityResult =
|
||||||
await lcNode1.lightClientNetwork.getLightClientFinalityUpdate(
|
await lcNode1.lightClientNetwork.getLightClientFinalityUpdate(
|
||||||
distinctBase(finalizedHeaderSlot),
|
distinctBase(finalizedHeaderSlot),
|
||||||
distinctBase(finalizedOptimisticHeaderSlot)
|
|
||||||
)
|
)
|
||||||
optimisticResult =
|
optimisticResult =
|
||||||
await lcNode1.lightClientNetwork.getLightClientOptimisticUpdate(
|
await lcNode1.lightClientNetwork.getLightClientOptimisticUpdate(
|
||||||
|
@ -182,9 +182,7 @@ proc gossipLCFinalityUpdate*(
|
|||||||
when lcDataFork > LightClientDataFork.None:
|
when lcDataFork > LightClientDataFork.None:
|
||||||
let
|
let
|
||||||
finalizedSlot = forkyObject.finalized_header.beacon.slot
|
finalizedSlot = forkyObject.finalized_header.beacon.slot
|
||||||
optimisticSlot = forkyObject.attested_header.beacon.slot
|
contentKey = encode(finalityUpdateContentKey(finalizedSlot.uint64))
|
||||||
contentKey = encode(finalityUpdateContentKey(
|
|
||||||
finalizedSlot.uint64, optimisticSlot.uint64))
|
|
||||||
forkDigest = forkDigestAtEpoch(
|
forkDigest = forkDigestAtEpoch(
|
||||||
forkDigests[], epoch(forkyObject.attested_header.beacon.slot), cfg)
|
forkDigests[], epoch(forkyObject.attested_header.beacon.slot), cfg)
|
||||||
content = encodeFinalityUpdateForked(
|
content = encodeFinalityUpdateForked(
|
||||||
@ -200,7 +198,7 @@ proc gossipLCFinalityUpdate*(
|
|||||||
contentKeyHex,
|
contentKeyHex,
|
||||||
content.toHex())
|
content.toHex())
|
||||||
info "Beacon LC finality update gossiped", peers,
|
info "Beacon LC finality update gossiped", peers,
|
||||||
contentKey = contentKeyHex, finalizedSlot, optimisticSlot
|
contentKey = contentKeyHex, finalizedSlot
|
||||||
return ok()
|
return ok()
|
||||||
except CatchableError as e:
|
except CatchableError as e:
|
||||||
return err("JSON-RPC error: " & $e.msg)
|
return err("JSON-RPC error: " & $e.msg)
|
||||||
|
@ -650,9 +650,7 @@ proc run(config: BeaconBridgeConf) {.raises: [CatchableError].} =
|
|||||||
update, slot = forkyObject.attested_header.beacon.slot
|
update, slot = forkyObject.attested_header.beacon.slot
|
||||||
let
|
let
|
||||||
finalizedSlot = forkyObject.finalized_header.beacon.slot
|
finalizedSlot = forkyObject.finalized_header.beacon.slot
|
||||||
optimisticSlot = forkyObject.attested_header.beacon.slot
|
contentKey = encode(finalityUpdateContentKey(finalizedSlot.uint64))
|
||||||
contentKey = encode(finalityUpdateContentKey(
|
|
||||||
finalizedSlot.uint64, optimisticSlot.uint64))
|
|
||||||
contentId = beacon_light_client_content.toContentId(contentKey)
|
contentId = beacon_light_client_content.toContentId(contentKey)
|
||||||
forkDigest = forkDigestAtEpoch(
|
forkDigest = forkDigestAtEpoch(
|
||||||
forkDigests[], epoch(forkyObject.attested_header.beacon.slot), cfg)
|
forkDigests[], epoch(forkyObject.attested_header.beacon.slot), cfg)
|
||||||
|
@ -208,9 +208,7 @@ proc exportLCFinalityUpdate*(
|
|||||||
when lcDataFork > LightClientDataFork.None:
|
when lcDataFork > LightClientDataFork.None:
|
||||||
let
|
let
|
||||||
finalizedSlot = forkyObject.finalized_header.beacon.slot
|
finalizedSlot = forkyObject.finalized_header.beacon.slot
|
||||||
optimisticSlot = forkyObject.attested_header.beacon.slot
|
contentKey = encode(finalityUpdateContentKey(finalizedSlot.uint64))
|
||||||
contentKey = encode(finalityUpdateContentKey(
|
|
||||||
finalizedSlot.uint64, optimisticSlot.uint64))
|
|
||||||
contentId = beacon_light_client_content.toContentId(contentKey)
|
contentId = beacon_light_client_content.toContentId(contentKey)
|
||||||
forkDigest = forkDigestAtEpoch(
|
forkDigest = forkDigestAtEpoch(
|
||||||
forkDigests[], epoch(forkyObject.attested_header.beacon.slot), cfg)
|
forkDigests[], epoch(forkyObject.attested_header.beacon.slot), cfg)
|
||||||
@ -225,7 +223,7 @@ proc exportLCFinalityUpdate*(
|
|||||||
)
|
)
|
||||||
|
|
||||||
var contentTable: JsonPortalContentTable
|
var contentTable: JsonPortalContentTable
|
||||||
contentTable[$optimisticSlot] = portalContent
|
contentTable[$finalizedSlot] = portalContent
|
||||||
|
|
||||||
writePortalContentToJson(fh, contentTable)
|
writePortalContentToJson(fh, contentTable)
|
||||||
|
|
||||||
|
2
vendor/portal-spec-tests
vendored
2
vendor/portal-spec-tests
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 529764e1df46f99899127b75097d5162e9ed7ed0
|
Subproject commit 26edde52b942020ef38aba3795400d713072cf21
|
Loading…
x
Reference in New Issue
Block a user