mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-22 04:24:05 +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 =
|
||||
## This converts a signed beacon block to a sig verified beacon clock.
|
||||
## This assumes that their bytes representation is the same.
|
||||
static: # TODO See isomorphicCast
|
||||
doAssert sizeof(phase0.SignedBeaconBlock) ==
|
||||
sizeof(phase0.SigVerifiedSignedBeaconBlock)
|
||||
|
||||
cast[ptr phase0.SigVerifiedSignedBeaconBlock](signedBlock.unsafeAddr)[]
|
||||
isomorphicCast[phase0.SigVerifiedSignedBeaconBlock](signedBlock)
|
||||
|
||||
template asSigVerified(x: altair.SignedBeaconBlock):
|
||||
altair.SigVerifiedSignedBeaconBlock =
|
||||
## This converts a signed beacon block to a sig verified beacon clock.
|
||||
## This assumes that their bytes representation is the same.
|
||||
static: # TODO See isomorphicCast
|
||||
doAssert sizeof(altair.SignedBeaconBlock) ==
|
||||
sizeof(altair.SigVerifiedSignedBeaconBlock)
|
||||
|
||||
cast[ptr altair.SigVerifiedSignedBeaconBlock](signedBlock.unsafeAddr)[]
|
||||
isomorphicCast[altair.SigVerifiedSignedBeaconBlock](signedBlock)
|
||||
|
||||
template asTrusted(x: phase0.SignedBeaconBlock or phase0.SigVerifiedBeaconBlock):
|
||||
phase0.TrustedSignedBeaconBlock =
|
||||
## This converts a sigverified beacon block to a trusted beacon clock.
|
||||
## This assumes that their bytes representation is the same.
|
||||
static: # TODO See isomorphicCast
|
||||
doAssert sizeof(x) == sizeof(phase0.TrustedSignedBeaconBlock)
|
||||
|
||||
cast[ptr phase0.TrustedSignedBeaconBlock](signedBlock.unsafeAddr)[]
|
||||
isomorphicCast[phase0.TrustedSignedBeaconBlock](signedBlock)
|
||||
|
||||
template asTrusted(x: altair.SignedBeaconBlock or altair.SigVerifiedBeaconBlock):
|
||||
altair.TrustedSignedBeaconBlock =
|
||||
## This converts a sigverified beacon block to a trusted beacon clock.
|
||||
## This assumes that their bytes representation is the same.
|
||||
static: # TODO See isomorphicCast
|
||||
doAssert sizeof(x) == sizeof(altair.TrustedSignedBeaconBlock)
|
||||
|
||||
cast[ptr altair.TrustedSignedBeaconBlock](signedBlock.unsafeAddr)[]
|
||||
isomorphicCast[altair.TrustedSignedBeaconBlock](signedBlock)
|
||||
|
||||
func batchVerify(quarantine: QuarantineRef, sigs: openArray[SignatureSet]): bool =
|
||||
var secureRandomBytes: array[32, byte]
|
||||
|
Loading…
x
Reference in New Issue
Block a user