Hello,
In my class Test, I’ve written two contract functions, f1()
and isF2()
. However, I am encountering a problem where the parameter var1
in the isF2()
function is causing a failure when calling the function due to an authorization issue.
Here is a simplified version of the code I’m working with:
contract Test {
function f1() public returns (bool) {
euint16 var1 = _fa(_to);
TFHE.allowTransient(var1 , msg.sender);
TFHE.allow(var1 , address(this));
require(
TFHE.isAllowed(var1 , address(this)),
"The caller is not authorized to access this encrypted element." // is okay
);
ebool isTested = isF2(var1);
TFHE.allowTransient(isTested, msg.sender);
return isTested;
}
function isF2(euint16 var1) public returns (ebool) {
require(
TFHE.isAllowed(var1, address(this)),
"isF2: The caller is not authorized to access this encrypted element." // not okay
);
....
}
}
When calling isF2(var1)
from within f1()
, the require
statement inside isF2()
fails, meaning that the caller does not have the necessary permission (is not allowed) to access the encrypted element (var1
).
Error: "isF2: The caller is not authorized to access this encrypted element."
Why is the parameter var1
failing the requirement in isF2()
even though access has been granted in f1.
How can I modify the code so that the var1
parameter is allowed in isF2()
without failing the authorization check ?