Error before bootstrapping

Hello there, here I am again :smiley:

I am getting this error before launching the simple 1-iteration bootstrap function:

[鈥/dcrtpoly.cpp:385 DCRTPolyImpl鈥檚 towers are not initialized.

But I also noticed that, if I don鈥檛 run a multiplication before, the bootstrapping runs fine. I was wondering what kind of error is that and how can I interpret it? (I am at the last level of the circuit with that mult, could that be the problem?)

Please share a minimal reproducible example

I鈥檓 pretty sure that this happens when you try to bootstrap a ciphertext that is on the last level.

Ctxt value = HEController::encrypt_repeated(1);
cout << "Depth: " << depth
cout << "Level: " << value->GetLevel() << endl;
for (int i = 0; i < depth - 1; i++) {
     value = HEController::mult(value, value);
}
cout << "Level: " << value->GetLevel() << endl;
HEController::bootstrap(value);
HEController::print_slotted(value, 1, 1);
cout << "Done";

I am using HEController class for convenience. This code runs fine:

Depth: 30
Level: 0
Level: 28

However, if I run the for loop one time more, it gives the error:

Ctxt value = HEController::encrypt_repeated(1);
cout << "Depth: " << depth
cout << "Level: " << value->GetLevel() << endl;
for (int i = 0; i < depth; i++) {
     value = HEController::mult(value, value);
}
cout << "Level: " << value->GetLevel() << endl;
HEController::bootstrap(value);
HEController::print_slotted(value, 1, 1);
cout << "Done";

The output:

Depth: 30
Level: 0
Level: 29
libc++abi: terminating with uncaught exception of type lbcrypto::config_error: /Users/narger/Documents/Universit脿/openfhe-development/src/core/lib/lattice/hal/default/dcrtpoly.cpp:385 DCRTPolyImpl's towers are not initialized.

The decryption works fine though. I think this could be the right behavior, I just don鈥檛 know how to interpret the error, that鈥檚 it! Telling the user that (s)he can not perform the bootstrap because of the level could be a more useful message, but I am a newbie, just playing here and there :smiley:

Yes, this is the correct behavior, but the error message is confusing. We added an issue for it: Exception message in bootstrapping 路 Issue #351 路 openfheorg/openfhe-development 路 GitHub

Ok, good! Thanks for the quick support!