Additional level for Bootstrapping ciphertexts

Hi everyone,
I’m trying to perform bootstrapping of ciphertexts and I’m not sure I understood how the multiplicative depth must be set.
In particular, my system bootstraps the ciphertexts when their level is equal to the multiplicative depth that I set. The multiplicative depth is set summing the number of available levels I need after bootstrapping to the value returned by GetBootstrapDepth() + 1, as I read that the returned value in the release 1.1.2 is off by 1.
For example, if the number of levels I need after bootstrapping is equal to 3, the resulting multiplicative depth is 25, because GetBootstrapDepth() returns 21.
The result is that the system, after having bootstrapped a ciphertext, is able to perform 3 multiplications involving it and its results, but then the following bootstrap call return the following error:
what(): Removing last element of DCRTPoly object renders it invalid!
In the same example, the ciphertext’s level before trying to perform bootstrap is 25.
It makes me think that for being able to perform bootstrap the ciphertext must be at a level that consents to perform at least another multiplication, as it is in the related examples, so that I need to increase the multiplicative depth by 1. Is my guess correct?
Thanks in advance

What version are you using? I wonder if this is related to this issue.

Thank you for your response,
I’m using the 1.1.2 version. In fact I sum 1 to the value returned by GetBootstrapDepth(), after having read the issue you linked. But the error is still raised by the EvalBootstrap() API.
Instead, If I sum 2 to the value returned by GetBootstrapDepth(), the bootstrapping procedure is executed successfully.

The fix @narger mentioned (the code changes can be seen from the PR: Fixed GetBootstrapDepth by yspolyakov · Pull Request #626 · openfheorg/openfhe-development · GitHub) has not been pushed to the main branch (we push to main when there is a new release). The fix is in the dev branch (current version for v1.1.3). You can try it from dev or simply add 1 for now if you use main.