work around some CastSizes warnings and fix unreachable code warnings (#5149)

This commit is contained in:
tersec 2023-06-30 19:34:04 +00:00 committed by GitHub
parent 0be95571a7
commit 583eb4db17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 16 deletions

View File

@ -968,22 +968,22 @@ proc validateBlsToExecutionChange*(
if res.isErr: if res.isErr:
return pool.checkedReject(res.error) return pool.checkedReject(res.error)
# BLS to execution change signatures are batch-verified # BLS to execution change signatures are batch-verified
let deferredCrypto = batchCrypto.scheduleBlsToExecutionChangeCheck( let deferredCrypto = batchCrypto.scheduleBlsToExecutionChangeCheck(
pool.dag.cfg.genesisFork, signed_address_change) pool.dag.cfg.genesisFork, signed_address_change)
if deferredCrypto.isErr(): if deferredCrypto.isErr():
return pool.checkedReject(deferredCrypto.error) return pool.checkedReject(deferredCrypto.error)
let (cryptoFut, sig) = deferredCrypto.get() let (cryptoFut, sig) = deferredCrypto.get()
case await cryptoFut case await cryptoFut
of BatchResult.Invalid: of BatchResult.Invalid:
return pool.checkedReject( return pool.checkedReject(
"SignedBLSToExecutionChange: invalid signature") "SignedBLSToExecutionChange: invalid signature")
of BatchResult.Timeout: of BatchResult.Timeout:
return errIgnore( return errIgnore(
"SignedBLSToExecutionChange: timeout checking signature") "SignedBLSToExecutionChange: timeout checking signature")
of BatchResult.Valid: of BatchResult.Valid:
discard # keep going only in this case discard # keep going only in this case
return ok() return ok()

View File

@ -650,7 +650,8 @@ proc readValue*(
raiseUnexpectedValue(reader, "Hex string of 4 bytes expected") raiseUnexpectedValue(reader, "Hex string of 4 bytes expected")
func `$`*(x: JustificationBits): string = func `$`*(x: JustificationBits): string =
"0x" & toHex(uint8(x)) # TODO, works around https://github.com/nim-lang/Nim/issues/22191
"0x" & toHex(uint64(uint8(x)))
proc readValue*(reader: var JsonReader, value: var JustificationBits) proc readValue*(reader: var JsonReader, value: var JustificationBits)
{.raises: [IOError, SerializationError, Defect].} = {.raises: [IOError, SerializationError, Defect].} =