Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: size-efficient list-based ciphertext inputs
Add support for list-based ciphertext inputs. Two types are supported: * CompactFheUint160List * CompactFheUint2048List No other input types are supported. Instead, the `fhevmjs` library encodes any type other than the FheUint2048 type as FheUint160. In fhevm-go during ciphertext verification, we cast it homomorphically to the requested data type. FheUint2048 values are expanded as is, without any casts. The API of the verifyCiphertext precompile changes such that now it accepts two inputs (through TFHE.asEuintXX() library function in fhevm): * bytes32 Handle * serialized compact FHE list Handle format changes and is no longer the hash of the expanded ciphertext. Instead, input handles have the following format: * byte 0 to 28: first 29 bytes of keccak256(serialized compact FHE list) * byte 29: index in the serialized compact FHE list (0-indexed) * byte 30: type of the ciphertext * byte 31: version Non-input handles have the following format: * byte 0 to 29: first 30 bytes of keccak256(serialized compact FHE list) * byte 30: type of the ciphertext * byte 31: version Above allows us to pack multiple inputs in one or more CompactFheUint160Lists. Add support for equality and non-equality of FheUint2048 values. Cleanup should be done in a future commit in order to remove unused code, duplication and to simplify the implementation and the tests, especially around tfhe-rs handling.
- Loading branch information