make OnFooBlockAdded callback types generic (#5134)
This commit is contained in:
parent
657f115210
commit
bf575aac57
|
@ -279,43 +279,14 @@ type
|
||||||
# balances, as used in fork choice
|
# balances, as used in fork choice
|
||||||
effective_balances_bytes*: seq[byte]
|
effective_balances_bytes*: seq[byte]
|
||||||
|
|
||||||
# TODO when Nim 1.2 support is dropped, make these generic. 1.2 generates
|
OnBlockAdded[T] = proc(
|
||||||
# invalid C code, which gcc refuses to compile. Example test case:
|
blckRef: BlockRef, blck: T, epochRef: EpochRef,
|
||||||
# type
|
|
||||||
# OnBlockAdded[T] = proc(x: T)
|
|
||||||
# OnPhase0BlockAdded = OnBlockAdded[int]
|
|
||||||
# proc f(x: OnPhase0BlockAdded) = discard
|
|
||||||
# const nilCallback = OnPhase0BlockAdded(nil)
|
|
||||||
# f(nilCallback)
|
|
||||||
OnPhase0BlockAdded* = proc(
|
|
||||||
blckRef: BlockRef,
|
|
||||||
blck: phase0.TrustedSignedBeaconBlock,
|
|
||||||
epochRef: EpochRef,
|
|
||||||
unrealized: FinalityCheckpoints) {.gcsafe, raises: [Defect].}
|
|
||||||
|
|
||||||
OnAltairBlockAdded* = proc(
|
|
||||||
blckRef: BlockRef,
|
|
||||||
blck: altair.TrustedSignedBeaconBlock,
|
|
||||||
epochRef: EpochRef,
|
|
||||||
unrealized: FinalityCheckpoints) {.gcsafe, raises: [Defect].}
|
|
||||||
|
|
||||||
OnBellatrixBlockAdded* = proc(
|
|
||||||
blckRef: BlockRef,
|
|
||||||
blck: bellatrix.TrustedSignedBeaconBlock,
|
|
||||||
epochRef: EpochRef,
|
|
||||||
unrealized: FinalityCheckpoints) {.gcsafe, raises: [Defect].}
|
|
||||||
|
|
||||||
OnCapellaBlockAdded* = proc(
|
|
||||||
blckRef: BlockRef,
|
|
||||||
blck: capella.TrustedSignedBeaconBlock,
|
|
||||||
epochRef: EpochRef,
|
|
||||||
unrealized: FinalityCheckpoints) {.gcsafe, raises: [Defect].}
|
|
||||||
|
|
||||||
OnDenebBlockAdded* = proc(
|
|
||||||
blckRef: BlockRef,
|
|
||||||
blck: deneb.TrustedSignedBeaconBlock,
|
|
||||||
epochRef: EpochRef,
|
|
||||||
unrealized: FinalityCheckpoints) {.gcsafe, raises: [Defect].}
|
unrealized: FinalityCheckpoints) {.gcsafe, raises: [Defect].}
|
||||||
|
OnPhase0BlockAdded* = OnBlockAdded[phase0.TrustedSignedBeaconBlock]
|
||||||
|
OnAltairBlockAdded* = OnBlockAdded[altair.TrustedSignedBeaconBlock]
|
||||||
|
OnBellatrixBlockAdded* = OnBlockAdded[bellatrix.TrustedSignedBeaconBlock]
|
||||||
|
OnCapellaBlockAdded* = OnBlockAdded[capella.TrustedSignedBeaconBlock]
|
||||||
|
OnDenebBlockAdded* = OnBlockAdded[deneb.TrustedSignedBeaconBlock]
|
||||||
|
|
||||||
OnForkyBlockAdded* =
|
OnForkyBlockAdded* =
|
||||||
OnPhase0BlockAdded | OnAltairBlockAdded | OnBellatrixBlockAdded |
|
OnPhase0BlockAdded | OnAltairBlockAdded | OnBellatrixBlockAdded |
|
||||||
|
|
Loading…
Reference in New Issue