chore: eq-neq bool support and bitwise scalar support
chore: overloads for fheEq and fheNe
fix: reverts onchain when rhs is 0 in fheDiv-fheRem
feat: added support for scalar and,or,xor
chore: cleanup codegen
feat: adds euint128 and euint256 types
chore: removes ebool fheRandBounded and adds manual tests
feat: adds new types for fheRand
feat: adds trivialEncrypt for ebytesXXX
feat: adds fheEq fheNe ifThenElse for new types
chore: rename asyncDecrypt() to initGateway()
Purpose of this commit is to establish a baseline for a working fhEVM
using the ACL and TFHEExecutor contracts. More tests and a rewrite of
examples will come in a future commit.
The ACL contract manages ciphertext permissions, removing the need for
privileged storage and memory in fhEVM.
The TFHEExecutor contract checks ciphertext permissions in the ACL
contract. Only TFHEExecutor is allowed to call FHE precompiles in the
fhEVM.
Not all tests are passing at that point. Only the Rand and the
EncryptedERC20 ones work.
Tests don't use the KMS for decryption. Instead, we load the secret FHE
key and pass it to fhevmjs for decryption.
Update to fhevmjs 0.5.0-1 and tfhe-rs 0.6.1
Add overloads of TFHE.randEuint() methods that accept an upper bound,
e.g. TFHE.randEuint32(uint32 upperBound). The returned integer will be
in the [0, upperBound) range. Moreover, upperBound must be a power of
2 - that is a design choice for performance reasons.
Note that, as of now, the random numbers are generated in the plain and
are completely public and predictable. An FHE version is coming soon.
Add tests to cover above functionality.
updated to ethermint node
updated node dev version
removed parallel flag from hardhat test
reput inband test for ci
setup evm version to Paris to avoid PUSH0 error and updated hardhat version
removed utils.ts.new file
synced package.json and package-lock.json
prettier
At the moment, the underlying implementation is using a plaintext
PRNG. Because of that, we put a warning for users to be aware of.
Support generation of 8, 16 and 32-bit unsigned integers. Users call it
by `TFHE.randEuint32()` and so on for other types. Can only be called in
transactions - calling it in view functions will fail.
Add tests.
Finally, update the `fhevmjs` dependency to `~0.2.0`.
The decrypt() function decrypts the given euint value.
There are a few considerations when doing decryption:
* if a transaction is reverted due to a failed TFHE.optimisticReq(),
then any decryptions would leak information as they would already
have been decrypted when the txn is reverted at the end (due to the
nature of TFHE.optimisticReq()). To avoid that, we decrypt all optimistic
requires accumulated up to the decrypt call.
* gas estimation might be more imprecise, because control flow can now
depend on decrypted values (that gas estimation doesn't know of as it
always uses 0)
Remove req/optReq uint overloads.
* feat(tfhe): add support for `ebool` type
* fix(auction): use `ebool` adequately
* fix(cmux): fix CMUX example
* fix(lib): rename variables to be consistent
* fix(lib): fix comments
Add documentation for methods that didn't have any. Move doc that was
in Impl.sol to TFHE.sol (e.g. cmux, optReq).
Also, fix neg() and not() in TFHE.sol such that they return a result.