mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-22 12:30:08 +00:00
use isomorphicCast between beacon block types (#2698)
This commit is contained in:
parent
38a5bc8de3
commit
ac7f719382
@ -43,39 +43,25 @@ template asSigVerified(x: phase0.SignedBeaconBlock):
|
|||||||
phase0.SigVerifiedSignedBeaconBlock =
|
phase0.SigVerifiedSignedBeaconBlock =
|
||||||
## This converts a signed beacon block to a sig verified beacon clock.
|
## This converts a signed beacon block to a sig verified beacon clock.
|
||||||
## This assumes that their bytes representation is the same.
|
## This assumes that their bytes representation is the same.
|
||||||
static: # TODO See isomorphicCast
|
isomorphicCast[phase0.SigVerifiedSignedBeaconBlock](signedBlock)
|
||||||
doAssert sizeof(phase0.SignedBeaconBlock) ==
|
|
||||||
sizeof(phase0.SigVerifiedSignedBeaconBlock)
|
|
||||||
|
|
||||||
cast[ptr phase0.SigVerifiedSignedBeaconBlock](signedBlock.unsafeAddr)[]
|
|
||||||
|
|
||||||
template asSigVerified(x: altair.SignedBeaconBlock):
|
template asSigVerified(x: altair.SignedBeaconBlock):
|
||||||
altair.SigVerifiedSignedBeaconBlock =
|
altair.SigVerifiedSignedBeaconBlock =
|
||||||
## This converts a signed beacon block to a sig verified beacon clock.
|
## This converts a signed beacon block to a sig verified beacon clock.
|
||||||
## This assumes that their bytes representation is the same.
|
## This assumes that their bytes representation is the same.
|
||||||
static: # TODO See isomorphicCast
|
isomorphicCast[altair.SigVerifiedSignedBeaconBlock](signedBlock)
|
||||||
doAssert sizeof(altair.SignedBeaconBlock) ==
|
|
||||||
sizeof(altair.SigVerifiedSignedBeaconBlock)
|
|
||||||
|
|
||||||
cast[ptr altair.SigVerifiedSignedBeaconBlock](signedBlock.unsafeAddr)[]
|
|
||||||
|
|
||||||
template asTrusted(x: phase0.SignedBeaconBlock or phase0.SigVerifiedBeaconBlock):
|
template asTrusted(x: phase0.SignedBeaconBlock or phase0.SigVerifiedBeaconBlock):
|
||||||
phase0.TrustedSignedBeaconBlock =
|
phase0.TrustedSignedBeaconBlock =
|
||||||
## This converts a sigverified beacon block to a trusted beacon clock.
|
## This converts a sigverified beacon block to a trusted beacon clock.
|
||||||
## This assumes that their bytes representation is the same.
|
## This assumes that their bytes representation is the same.
|
||||||
static: # TODO See isomorphicCast
|
isomorphicCast[phase0.TrustedSignedBeaconBlock](signedBlock)
|
||||||
doAssert sizeof(x) == sizeof(phase0.TrustedSignedBeaconBlock)
|
|
||||||
|
|
||||||
cast[ptr phase0.TrustedSignedBeaconBlock](signedBlock.unsafeAddr)[]
|
|
||||||
|
|
||||||
template asTrusted(x: altair.SignedBeaconBlock or altair.SigVerifiedBeaconBlock):
|
template asTrusted(x: altair.SignedBeaconBlock or altair.SigVerifiedBeaconBlock):
|
||||||
altair.TrustedSignedBeaconBlock =
|
altair.TrustedSignedBeaconBlock =
|
||||||
## This converts a sigverified beacon block to a trusted beacon clock.
|
## This converts a sigverified beacon block to a trusted beacon clock.
|
||||||
## This assumes that their bytes representation is the same.
|
## This assumes that their bytes representation is the same.
|
||||||
static: # TODO See isomorphicCast
|
isomorphicCast[altair.TrustedSignedBeaconBlock](signedBlock)
|
||||||
doAssert sizeof(x) == sizeof(altair.TrustedSignedBeaconBlock)
|
|
||||||
|
|
||||||
cast[ptr altair.TrustedSignedBeaconBlock](signedBlock.unsafeAddr)[]
|
|
||||||
|
|
||||||
func batchVerify(quarantine: QuarantineRef, sigs: openArray[SignatureSet]): bool =
|
func batchVerify(quarantine: QuarantineRef, sigs: openArray[SignatureSet]): bool =
|
||||||
var secureRandomBytes: array[32, byte]
|
var secureRandomBytes: array[32, byte]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user