From 680b2d2e5468feec98bacd1bd087011b63edd164 Mon Sep 17 00:00:00 2001 From: thomaslavaur Date: Wed, 28 Aug 2024 15:37:51 +0200 Subject: [PATCH] fix VRF order for risc0 proof and not Circom --- cryptarchia/cryptarchia.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cryptarchia/cryptarchia.py b/cryptarchia/cryptarchia.py index 0ca9ff5..a5fcf20 100644 --- a/cryptarchia/cryptarchia.py +++ b/cryptarchia/cryptarchia.py @@ -668,7 +668,7 @@ def phi(f: float, alpha: float) -> float: class LEADER_VRF: """NOT SECURE: A mock VRF function""" - ORDER = 2**253 + ORDER = 2**256 @classmethod def vrf(cls, coin: Coin, epoch_nonce: bytes, slot: Slot) -> int: @@ -679,7 +679,7 @@ class LEADER_VRF: h.update(coin.encode_sk()) h.update(coin.nonce) - return int(int.from_bytes(h.digest()) >> 3) + return int.from_bytes(h.digest()) @classmethod def verify(cls, r, pk, nonce, slot):