I’m testing Zama’s FHE Solidity library on Sepolia.
When I call FHE.requestDecryption
with a single ciphertext, my callback is triggered as expected:
function requestNumber() external {
euint32 enc = FHE.asEuint32(42);
encryptedNumber1 = enc;
FHE.allowThis(encryptedNumber1);
FHE.allow(encryptedNumber1, msg.sender);
bytes32[] memory cts = new bytes32[](1);
cts[0] = FHE.toBytes32(encryptedNumber1);
uint256 reqId = FHE.requestDecryption(cts, this.onDecryption.selector);
}
function onDecryption(uint256 requestId, uint32 value, bytes[] memory signatures) public returns (bool success) {
decryptedNumber1 = value;
return true;
}
But when I try with two ciphertexts, the callback never fires:
function requestNumber() external {
euint32 enc = FHE.asEuint32(42);
encryptedNumber1 = enc;
FHE.allowThis(encryptedNumber1);
FHE.allow(encryptedNumber1, msg.sender);
euint32 enc1 = FHE.asEuint32(100);
encryptedNumber2 = enc1;
FHE.allowThis(encryptedNumber2);
FHE.allow(encryptedNumber2, msg.sender);
bytes32[] memory cts = new bytes32[](2);
cts[0] = FHE.toBytes32(encryptedNumber1);
cts[1] = FHE.toBytes32(encryptedNumber2);
uint256 reqId = FHE.requestDecryption(cts, this.onDecryption.selector);
}
function onDecryption(uint256 requestId, uint32[] memory values, bytes[] memory signatures) public returns (bool success) {
decryptedNumber1 = values[0];
decryptedNumber2 = values[1];
return true;
}
Questions:
- Does
requestDecryption
currently only support one ciphertext? - Or am I using the wrong callback signature for arrays?
- What’s the correct way to handle multiple ciphertext decryptions in one request?