diff --git a/contracts/cosmos/verifier/verifier-constantine/lib/nim/verify/verify.nim b/contracts/cosmos/verifier/verifier-constantine/lib/nim/verify/verify.nim index c6d4a9165..31c080d81 100644 --- a/contracts/cosmos/verifier/verifier-constantine/lib/nim/verify/verify.nim +++ b/contracts/cosmos/verifier/verifier-constantine/lib/nim/verify/verify.nim @@ -53,7 +53,7 @@ proc makePairsAndVerify*(vk: VerificationKey, let sha256ofHashes = hashHeaders(currentHeaderHash, newOptimisticHeader, newFinalizedHeader, newExecutionStateRoot, zerosSlotBuffer, reverseSlot, domain) - let header = headerFromSeq(@sha256ofHashes) + let header = headerFromArr(sha256ofHashes) var preparedInputs:Input var ic0Prj: ECP_ShortW_Prj[Fp[BN254_Snarks], G1] diff --git a/contracts/cosmos/verifier/verifier-constantine/lib/nim/verify/verify_helpers.nim b/contracts/cosmos/verifier/verifier-constantine/lib/nim/verify/verify_helpers.nim index 92594c001..ab349e41c 100644 --- a/contracts/cosmos/verifier/verifier-constantine/lib/nim/verify/verify_helpers.nim +++ b/contracts/cosmos/verifier/verifier-constantine/lib/nim/verify/verify_helpers.nim @@ -16,7 +16,7 @@ type head*: Fr[BN254_Snarks] tail*: Fr[BN254_Snarks] -proc headerFromSeq*(bigNum: seq): Header = +proc headerFromArr*(bigNum: array[32, byte]): Header = var firstNumInBits: array[256, int] for i in 0..2: firstNumInBits[i] = 0 @@ -62,8 +62,7 @@ proc headerFromSeq*(bigNum: seq): Header = var head: Fr[BN254_Snarks] tail: Fr[BN254_Snarks] - head.fromHex(toHex(firstNumInBytes)) - tail.fromHex(toHex(secondNumInBytes)) - + head.fromBig(BigInt[254].unmarshal(firstNumInBytes, bigEndian)) + tail.fromBig(BigInt[254].unmarshal(secondNumInBytes, bigEndian)) Header(head: head, tail: tail) diff --git a/libs/nim/verify-utils/verify_given_proof_constantine.nim b/libs/nim/verify-utils/verify_given_proof_constantine.nim index 53ec7db40..ade6d5600 100644 --- a/libs/nim/verify-utils/verify_given_proof_constantine.nim +++ b/libs/nim/verify-utils/verify_given_proof_constantine.nim @@ -106,7 +106,7 @@ proc createHeader*(pathCurrentHeader: string, updatePath: string, domain: string currentSlot, domain) - headerFromSeq(@sha256ofHashes) + headerFromArr(sha256ofHashes) proc makePairsAndVerify*(vk: VerificationKey, prf: Proof,