From 13d6e5fa3d366aa3ae15bb5dfa01a9c2ffef04ec Mon Sep 17 00:00:00 2001
From: Beka Barbakadze <beka.barbakadze@zama.ai>
Date: Wed, 18 Dec 2024 15:31:04 +0400
Subject: [PATCH] fix(gpu): fix noise level calculation in full propagation

---
 tfhe/src/integer/gpu/server_key/radix/mod.rs | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/tfhe/src/integer/gpu/server_key/radix/mod.rs b/tfhe/src/integer/gpu/server_key/radix/mod.rs
index 0ea12c791d..508d0e5aa7 100644
--- a/tfhe/src/integer/gpu/server_key/radix/mod.rs
+++ b/tfhe/src/integer/gpu/server_key/radix/mod.rs
@@ -427,11 +427,14 @@ impl CudaServerKey {
                 );
             }
         };
-        ciphertext
-            .info
-            .blocks
-            .iter_mut()
-            .for_each(|b| b.degree = Degree::new(b.message_modulus.0 - 1));
+        ciphertext.info.blocks.iter_mut().for_each(|b| {
+            b.degree = Degree::new(b.message_modulus.0 - 1);
+            b.noise_level = if b.noise_level == NoiseLevel::ZERO {
+                NoiseLevel::ZERO
+            } else {
+                NoiseLevel::NOMINAL
+            };
+        });
     }
 
     /// Prepend trivial zero LSB blocks to an existing [`CudaUnsignedRadixCiphertext`] or