avoid `ProveField` warning in `keyGen` (#5067)

Assigning to fields of `var` case objects emits `ProveField` warnings.
We disable them in `make` based builds but they may pop up when building
manually with `nim c`. Suppress them for the `keyGen` function, as we
assign to `result.value` separately from `result.ok` to avoid copying.
This commit is contained in:
Etan Kissling 2023-06-13 18:45:00 +02:00 committed by GitHub
parent 788cdb7133
commit 20d6b4751e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -490,6 +490,7 @@ func infinity*(T: type ValidatorSig): T =
func burnMem*(key: var ValidatorPrivKey) =
burnMem(addr key, sizeof(ValidatorPrivKey))
{.push warning[ProveField]:off.} # https://github.com/nim-lang/Nim/issues/22060
proc keyGen(rng: var HmacDrbgContext): BlsResult[blscurve.SecretKey] =
var
pubkey: blscurve.PublicKey
@ -497,6 +498,7 @@ proc keyGen(rng: var HmacDrbgContext): BlsResult[blscurve.SecretKey] =
result.ok default(blscurve.SecretKey)
if not keyGen(bytes, pubkey, result.value):
return err "key generation failed"
{.pop.}
proc secretShareId(x: uint32) : blscurve.ID =
let bytes: array[8, uint32] = [uint32 x, 0, 0, 0, 0, 0, 0, 0]