# Unexpected Behaviors with auto scaling techniques in BFV Scheme

**URL:** https://openfhe.discourse.group/t/unexpected-behaviors-with-auto-scaling-techniques-in-bfv-scheme/1121
**Category:** Library Questions
**Tags:** questions, bugs
**Created:** [March 11, 2024, 5:19pm UTC](https://openfhe.discourse.group/t/unexpected-behaviors-with-auto-scaling-techniques-in-bfv-scheme/1121 "2024-03-11T17:19:08Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Maokami](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/maokami/32/180_2.png) [@Maokami](https://openfhe.discourse.group/u/Maokami)
#### Post date: [March 11, 2024, 5:19pm UTC](https://openfhe.discourse.group/t/unexpected-behaviors-with-auto-scaling-techniques-in-bfv-scheme/1121/1 "2024-03-11T17:19:08Z")

</div>

Hello OpenFHE Team,

I apologize for posting frequently, but I’ve encountered another issue that I believe is worth reporting.

Below is a minimal snippet of the code that reproduces the issue:

```auto
#include "openfhe.h"

using namespace lbcrypto;
using namespace std;

int main(void)
{
  CCParams<CryptoContextBFVRNS> parameters;
  parameters.SetPlaintextModulus(65537);
  parameters.SetScalingTechnique(FIXEDAUTO); // or, FLEXIBLEAUTO, FLEXIBLEAUTOEXT

  CryptoContext<DCRTPoly> cc = GenCryptoContext(parameters);
  cc->Enable(PKE);
  cc->Enable(KEYSWITCH);
  cc->Enable(LEVELEDSHE);
  KeyPair<DCRTPoly> keyPair;
  keyPair = cc->KeyGen();

  Plaintext tmp;
  Ciphertext<DCRTPoly> x, y;

  tmp = cc->MakePackedPlaintext({1});
  x = cc->Encrypt(keyPair.publicKey, tmp);
  y = cc->Encrypt(keyPair.publicKey, tmp);
  x = cc->EvalAdd(x, y);
  return 0;
}

```

When executed on the latest version (v1.1.4), this code throws an exception with a quite ambiguous message:

```auto
terminate called after throwing an instance of 'lbcrypto::OpenFHEException'
  what(): OpenFHE-v1.1.4/src/pke/include/schemebase/base-leveledshe.h:l.764:AdjustLevelsAndDepthInPlace(): Mutable Operations are not supported for this scheme

```

Upon inspecting the OpenFHE codes a bit, it seems to me that the BFV scheme is supposed to use either the FIXEDMANUAL or NORESCALE technique. Is this understanding correct? If so, I would like to suggest, for clarity and to prevent future errors, maybe prohibiting the use of automatic scaling techniques in the BFV scheme could be considered.

Thank you!

---

<div class="post-metadata">

### Author: ![andreea.alexandru](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/andreea.alexandru/32/378_2.png) [@andreea.alexandru](https://openfhe.discourse.group/u/andreea.alexandru)
#### Post date: [March 12, 2024, 6:10pm UTC](https://openfhe.discourse.group/t/unexpected-behaviors-with-auto-scaling-techniques-in-bfv-scheme/1121/2 "2024-03-12T18:10:40Z")

</div>

Thank you for pointing this out. For BFV, only the NORESCALE scaling method should be used. BFV supports different multiplication techniques, specified in the OpenFHE design document [https://eprint.iacr.org/2022/915.pdf](https://eprint.iacr.org/2022/915.pdf) page 6. Currently, cryptocontext parameters do not check which scheme they are called for. I opened an issue [Check that the parameters input to the cryptocontext are scheme-specific · Issue #713 · openfheorg/openfhe-development · GitHub](https://github.com/openfheorg/openfhe-development/issues/713).
