From 3f12e9c2791df637b06851d1ee1de80f3d0a8643 Mon Sep 17 00:00:00 2001 From: thomaslavaur Date: Tue, 2 Sep 2025 10:33:02 +0200 Subject: [PATCH] use euclidean division to match the rust implementation (the difference is negligible as it would make you lose 1 block every 10^16 blocks that you should have win --- circom_circuits/Blend/generate_inputs_for_poq.py | 4 ++-- circom_circuits/Mantle/generate_inputs_for_pol.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/circom_circuits/Blend/generate_inputs_for_poq.py b/circom_circuits/Blend/generate_inputs_for_poq.py index 7be2740..5c2e881 100644 --- a/circom_circuits/Blend/generate_inputs_for_poq.py +++ b/circom_circuits/Blend/generate_inputs_for_poq.py @@ -242,8 +242,8 @@ total_stake = F(5000) t0_constant = F(0x27b6fe27507ca57ca369280400c79b5d2f58ff94d87cb0fbfc8294eb69eb1ea) t1_constant = F(0x104bfd09ebdd0a57772289d0973489b62662a4dc6f09da8b4af3c5cfb1dcdd) -t0 = F(int(t0_constant) / total_stake) -t1 = F(p- (int(t1_constant) / total_stake**2)) +t0 = F(int(t0_constant) // total_stake) +t1 = F(p- (int(t1_constant) // total_stake**2)) value = F(total_stake / 100) threshold = (t0 + t1 * value) * value diff --git a/circom_circuits/Mantle/generate_inputs_for_pol.py b/circom_circuits/Mantle/generate_inputs_for_pol.py index 7a38f65..3899005 100755 --- a/circom_circuits/Mantle/generate_inputs_for_pol.py +++ b/circom_circuits/Mantle/generate_inputs_for_pol.py @@ -222,8 +222,8 @@ if total_stake >= p: t0_constant = F(0x27b6fe27507ca57ca369280400c79b5d2f58ff94d87cb0fbfc8294eb69eb1ea) t1_constant = F(0x104bfd09ebdd0a57772289d0973489b62662a4dc6f09da8b4af3c5cfb1dcdd) -t0 = F(int(t0_constant) / total_stake) -t1 = F(p- (int(t1_constant) / total_stake**2)) +t0 = F(int(t0_constant) // total_stake) +t1 = F(p- (int(t1_constant) // total_stake**2)) value = F(total_stake / 100)