update references for LC related Nim issues (#6389)
Addresses feedback from #6375 that is applicable to pre-existing code moreso than to the new PR.
This commit is contained in:
parent
288540e794
commit
3da85e593f
|
@ -684,7 +684,7 @@ func shortLog*(v: LightClientUpdate): auto =
|
||||||
(
|
(
|
||||||
attested: shortLog(v.attested_header),
|
attested: shortLog(v.attested_header),
|
||||||
has_next_sync_committee:
|
has_next_sync_committee:
|
||||||
v.next_sync_committee != default(typeof(v.next_sync_committee)),
|
v.next_sync_committee != static(default(typeof(v.next_sync_committee))),
|
||||||
finalized: shortLog(v.finalized_header),
|
finalized: shortLog(v.finalized_header),
|
||||||
num_active_participants: v.sync_aggregate.num_active_participants,
|
num_active_participants: v.sync_aggregate.num_active_participants,
|
||||||
signature_slot: v.signature_slot
|
signature_slot: v.signature_slot
|
||||||
|
|
|
@ -674,8 +674,8 @@ func is_valid_light_client_header*(
|
||||||
|
|
||||||
if epoch < cfg.CAPELLA_FORK_EPOCH:
|
if epoch < cfg.CAPELLA_FORK_EPOCH:
|
||||||
return
|
return
|
||||||
header.execution == default(ExecutionPayloadHeader) and
|
header.execution == static(default(ExecutionPayloadHeader)) and
|
||||||
header.execution_branch == default(ExecutionBranch)
|
header.execution_branch == static(default(ExecutionBranch))
|
||||||
|
|
||||||
is_valid_merkle_branch(
|
is_valid_merkle_branch(
|
||||||
get_lc_execution_root(header, cfg),
|
get_lc_execution_root(header, cfg),
|
||||||
|
@ -745,7 +745,7 @@ func shortLog*(v: LightClientUpdate): auto =
|
||||||
(
|
(
|
||||||
attested: shortLog(v.attested_header),
|
attested: shortLog(v.attested_header),
|
||||||
has_next_sync_committee:
|
has_next_sync_committee:
|
||||||
v.next_sync_committee != default(typeof(v.next_sync_committee)),
|
v.next_sync_committee != static(default(typeof(v.next_sync_committee))),
|
||||||
finalized: shortLog(v.finalized_header),
|
finalized: shortLog(v.finalized_header),
|
||||||
num_active_participants: v.sync_aggregate.num_active_participants,
|
num_active_participants: v.sync_aggregate.num_active_participants,
|
||||||
signature_slot: v.signature_slot
|
signature_slot: v.signature_slot
|
||||||
|
|
|
@ -667,8 +667,8 @@ func is_valid_light_client_header*(
|
||||||
|
|
||||||
if epoch < cfg.CAPELLA_FORK_EPOCH:
|
if epoch < cfg.CAPELLA_FORK_EPOCH:
|
||||||
return
|
return
|
||||||
header.execution == default(ExecutionPayloadHeader) and
|
header.execution == static(default(ExecutionPayloadHeader)) and
|
||||||
header.execution_branch == default(ExecutionBranch)
|
header.execution_branch == static(default(ExecutionBranch))
|
||||||
|
|
||||||
is_valid_merkle_branch(
|
is_valid_merkle_branch(
|
||||||
get_lc_execution_root(header, cfg),
|
get_lc_execution_root(header, cfg),
|
||||||
|
@ -757,7 +757,7 @@ func shortLog*(v: LightClientUpdate): auto =
|
||||||
(
|
(
|
||||||
attested: shortLog(v.attested_header),
|
attested: shortLog(v.attested_header),
|
||||||
has_next_sync_committee:
|
has_next_sync_committee:
|
||||||
v.next_sync_committee != default(typeof(v.next_sync_committee)),
|
v.next_sync_committee != static(default(typeof(v.next_sync_committee))),
|
||||||
finalized: shortLog(v.finalized_header),
|
finalized: shortLog(v.finalized_header),
|
||||||
num_active_participants: v.sync_aggregate.num_active_participants,
|
num_active_participants: v.sync_aggregate.num_active_participants,
|
||||||
signature_slot: v.signature_slot
|
signature_slot: v.signature_slot
|
||||||
|
|
|
@ -159,7 +159,8 @@ func lcDataForkAtEpoch*(
|
||||||
LightClientDataFork.None
|
LightClientDataFork.None
|
||||||
|
|
||||||
template kind*(
|
template kind*(
|
||||||
x: typedesc[ # `SomeLightClientObject` doesn't work here (Nim 1.6)
|
# `SomeLightClientObject`: https://github.com/nim-lang/Nim/issues/18095
|
||||||
|
x: typedesc[
|
||||||
altair.LightClientHeader |
|
altair.LightClientHeader |
|
||||||
altair.LightClientBootstrap |
|
altair.LightClientBootstrap |
|
||||||
altair.LightClientUpdate |
|
altair.LightClientUpdate |
|
||||||
|
@ -169,7 +170,8 @@ template kind*(
|
||||||
LightClientDataFork.Altair
|
LightClientDataFork.Altair
|
||||||
|
|
||||||
template kind*(
|
template kind*(
|
||||||
x: typedesc[ # `SomeLightClientObject` doesn't work here (Nim 1.6)
|
# `SomeLightClientObject`: https://github.com/nim-lang/Nim/issues/18095
|
||||||
|
x: typedesc[
|
||||||
capella.LightClientHeader |
|
capella.LightClientHeader |
|
||||||
capella.LightClientBootstrap |
|
capella.LightClientBootstrap |
|
||||||
capella.LightClientUpdate |
|
capella.LightClientUpdate |
|
||||||
|
@ -179,7 +181,8 @@ template kind*(
|
||||||
LightClientDataFork.Capella
|
LightClientDataFork.Capella
|
||||||
|
|
||||||
template kind*(
|
template kind*(
|
||||||
x: typedesc[ # `SomeLightClientObject` doesn't work here (Nim 1.6)
|
# `SomeLightClientObject`: https://github.com/nim-lang/Nim/issues/18095
|
||||||
|
x: typedesc[
|
||||||
deneb.LightClientHeader |
|
deneb.LightClientHeader |
|
||||||
deneb.LightClientBootstrap |
|
deneb.LightClientBootstrap |
|
||||||
deneb.LightClientUpdate |
|
deneb.LightClientUpdate |
|
||||||
|
@ -831,7 +834,8 @@ func migratingToDataFork*[
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/altair/light-client/full-node.md#block_to_light_client_header
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/altair/light-client/full-node.md#block_to_light_client_header
|
||||||
func toAltairLightClientHeader(
|
func toAltairLightClientHeader(
|
||||||
blck: # `SomeSignedBeaconBlock` doesn't work here (Nim 1.6)
|
# `SomeSignedBeaconBlock`: https://github.com/nim-lang/Nim/issues/18095
|
||||||
|
blck:
|
||||||
phase0.SignedBeaconBlock | phase0.TrustedSignedBeaconBlock |
|
phase0.SignedBeaconBlock | phase0.TrustedSignedBeaconBlock |
|
||||||
altair.SignedBeaconBlock | altair.TrustedSignedBeaconBlock |
|
altair.SignedBeaconBlock | altair.TrustedSignedBeaconBlock |
|
||||||
bellatrix.SignedBeaconBlock | bellatrix.TrustedSignedBeaconBlock
|
bellatrix.SignedBeaconBlock | bellatrix.TrustedSignedBeaconBlock
|
||||||
|
@ -841,7 +845,8 @@ func toAltairLightClientHeader(
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/capella/light-client/full-node.md#modified-block_to_light_client_header
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/capella/light-client/full-node.md#modified-block_to_light_client_header
|
||||||
func toCapellaLightClientHeader(
|
func toCapellaLightClientHeader(
|
||||||
blck: # `SomeSignedBeaconBlock` doesn't work here (Nim 1.6)
|
# `SomeSignedBeaconBlock`: https://github.com/nim-lang/Nim/issues/18095
|
||||||
|
blck:
|
||||||
phase0.SignedBeaconBlock | phase0.TrustedSignedBeaconBlock |
|
phase0.SignedBeaconBlock | phase0.TrustedSignedBeaconBlock |
|
||||||
altair.SignedBeaconBlock | altair.TrustedSignedBeaconBlock |
|
altair.SignedBeaconBlock | altair.TrustedSignedBeaconBlock |
|
||||||
bellatrix.SignedBeaconBlock | bellatrix.TrustedSignedBeaconBlock
|
bellatrix.SignedBeaconBlock | bellatrix.TrustedSignedBeaconBlock
|
||||||
|
@ -856,7 +861,8 @@ func toCapellaLightClientHeader(
|
||||||
beacon: blck.message.toBeaconBlockHeader())
|
beacon: blck.message.toBeaconBlockHeader())
|
||||||
|
|
||||||
func toCapellaLightClientHeader(
|
func toCapellaLightClientHeader(
|
||||||
blck: # `SomeSignedBeaconBlock` doesn't work here (Nim 1.6)
|
# `SomeSignedBeaconBlock`: https://github.com/nim-lang/Nim/issues/18095
|
||||||
|
blck:
|
||||||
capella.SignedBeaconBlock | capella.TrustedSignedBeaconBlock
|
capella.SignedBeaconBlock | capella.TrustedSignedBeaconBlock
|
||||||
): capella.LightClientHeader =
|
): capella.LightClientHeader =
|
||||||
template payload: untyped = blck.message.body.execution_payload
|
template payload: untyped = blck.message.body.execution_payload
|
||||||
|
@ -883,7 +889,8 @@ func toCapellaLightClientHeader(
|
||||||
|
|
||||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.0/specs/deneb/light-client/full-node.md#modified-block_to_light_client_header
|
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.0/specs/deneb/light-client/full-node.md#modified-block_to_light_client_header
|
||||||
func toDenebLightClientHeader(
|
func toDenebLightClientHeader(
|
||||||
blck: # `SomeSignedBeaconBlock` doesn't work here (Nim 1.6)
|
# `SomeSignedBeaconBlock`: https://github.com/nim-lang/Nim/issues/18095
|
||||||
|
blck:
|
||||||
phase0.SignedBeaconBlock | phase0.TrustedSignedBeaconBlock |
|
phase0.SignedBeaconBlock | phase0.TrustedSignedBeaconBlock |
|
||||||
altair.SignedBeaconBlock | altair.TrustedSignedBeaconBlock |
|
altair.SignedBeaconBlock | altair.TrustedSignedBeaconBlock |
|
||||||
bellatrix.SignedBeaconBlock | bellatrix.TrustedSignedBeaconBlock
|
bellatrix.SignedBeaconBlock | bellatrix.TrustedSignedBeaconBlock
|
||||||
|
@ -898,7 +905,8 @@ func toDenebLightClientHeader(
|
||||||
beacon: blck.message.toBeaconBlockHeader())
|
beacon: blck.message.toBeaconBlockHeader())
|
||||||
|
|
||||||
func toDenebLightClientHeader(
|
func toDenebLightClientHeader(
|
||||||
blck: # `SomeSignedBeaconBlock` doesn't work here (Nim 1.6)
|
# `SomeSignedBeaconBlock`: https://github.com/nim-lang/Nim/issues/18095
|
||||||
|
blck:
|
||||||
capella.SignedBeaconBlock | capella.TrustedSignedBeaconBlock
|
capella.SignedBeaconBlock | capella.TrustedSignedBeaconBlock
|
||||||
): deneb.LightClientHeader =
|
): deneb.LightClientHeader =
|
||||||
template payload: untyped = blck.message.body.execution_payload
|
template payload: untyped = blck.message.body.execution_payload
|
||||||
|
@ -924,7 +932,8 @@ func toDenebLightClientHeader(
|
||||||
capella.EXECUTION_PAYLOAD_GINDEX).get)
|
capella.EXECUTION_PAYLOAD_GINDEX).get)
|
||||||
|
|
||||||
func toDenebLightClientHeader(
|
func toDenebLightClientHeader(
|
||||||
blck: # `SomeSignedBeaconBlock` doesn't work here (Nim 1.6)
|
# `SomeSignedBeaconBlock`: https://github.com/nim-lang/Nim/issues/18095
|
||||||
|
blck:
|
||||||
deneb.SignedBeaconBlock | deneb.TrustedSignedBeaconBlock
|
deneb.SignedBeaconBlock | deneb.TrustedSignedBeaconBlock
|
||||||
): deneb.LightClientHeader =
|
): deneb.LightClientHeader =
|
||||||
template payload: untyped = blck.message.body.execution_payload
|
template payload: untyped = blck.message.body.execution_payload
|
||||||
|
@ -952,7 +961,8 @@ func toDenebLightClientHeader(
|
||||||
capella.EXECUTION_PAYLOAD_GINDEX).get)
|
capella.EXECUTION_PAYLOAD_GINDEX).get)
|
||||||
|
|
||||||
func toLightClientHeader*(
|
func toLightClientHeader*(
|
||||||
blck: # `SomeSignedBeaconBlock` doesn't work here (Nim 1.6)
|
# `SomeSignedBeaconBlock`: https://github.com/nim-lang/Nim/issues/18095
|
||||||
|
blck:
|
||||||
phase0.SignedBeaconBlock | phase0.TrustedSignedBeaconBlock |
|
phase0.SignedBeaconBlock | phase0.TrustedSignedBeaconBlock |
|
||||||
altair.SignedBeaconBlock | altair.TrustedSignedBeaconBlock |
|
altair.SignedBeaconBlock | altair.TrustedSignedBeaconBlock |
|
||||||
bellatrix.SignedBeaconBlock | bellatrix.TrustedSignedBeaconBlock |
|
bellatrix.SignedBeaconBlock | bellatrix.TrustedSignedBeaconBlock |
|
||||||
|
@ -991,7 +1001,7 @@ func shortLog*[
|
||||||
of LightClientDataFork.Deneb:
|
of LightClientDataFork.Deneb:
|
||||||
denebData: typeof(x.denebData.shortLog())
|
denebData: typeof(x.denebData.shortLog())
|
||||||
|
|
||||||
let xKind = x.kind # Nim 1.6.12: Using `kind: x.kind` inside case is broken
|
let xKind = x.kind # Nim 2.0.6: Using `kind: x.kind` inside case is broken
|
||||||
case xKind
|
case xKind
|
||||||
of LightClientDataFork.Deneb:
|
of LightClientDataFork.Deneb:
|
||||||
ResultType(kind: xKind, denebData: x.denebData.shortLog())
|
ResultType(kind: xKind, denebData: x.denebData.shortLog())
|
||||||
|
|
Loading…
Reference in New Issue