Commit Graph

78 Commits

Author SHA1 Message Date
Clément 'birdy' Danjou
faad51a6ea feat: introduce select in place of cmux 2024-03-08 11:31:53 +01:00
Clément 'birdy' Danjou
756e4e6dae refactor: remove deprecated optReq 2024-03-08 03:34:30 +01:00
Joseph-André Turk
c95296d2b6 fix: updated mocked mode to be compatible with new types 2024-03-05 16:31:16 +01:00
Clément 'birdy' Danjou
9386803f0c fix: convert bool to euint8 for optReq 2024-02-28 20:23:37 +01:00
Clément 'birdy' Danjou
b511101b1b feat: add 4bits 2024-02-28 14:03:52 +01:00
Clément 'birdy' Danjou
71ddad9a77 fix: fix ebool_t 2024-02-28 01:55:48 +01:00
Clément 'birdy' Danjou
31dbeced23 fix: update Lib for new ebool type 2024-02-28 01:37:11 +01:00
Joseph-André Turk
3da0ab9e8a feat: added TFHE.isInitialized function for ebool type
fix: fixed package.json

fix: fixed prettier
2024-02-20 11:42:42 +01:00
Clément 'birdy' Danjou
dc18f050e0 feat: add 64bits support 2024-02-09 10:04:55 +01:00
Petar Ivanov
fe1e97065e feat: add upper bound for encrypted random integers
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.
2024-01-09 17:17:40 +02:00
Joseph-André Turk
535b055fc8 Updated Solidity version to ^0.8.20 and OpenZeppelin Contracts to ^5.0.1
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
2024-01-09 11:05:38 +01:00
Clément 'birdy' Danjou
616f99823b feat() use new cmux 2024-01-08 15:35:51 +01:00
Joseph-André Turk
bc6649def1 made shl and shr more consistent with cleartext shift operators by restraining second operand to 8 bits
reset signers.ts

made shl and shr more consistent with cleartext shift operators by restraining second operand to 8 bits
2023-12-21 10:36:21 +01:00
David
edd0e11ecf Fix ebool not + tests for ebool ops 2023-11-27 11:44:22 +08:00
Clément 'birdy' Danjou
444b57f962 feat() Add xor operator for ebool 2023-11-13 12:59:31 +01:00
Clément Danjou
089e0d3d9a Merge pull request #211 from zama-ai/ebool-method-and-cmux-not
feat() Add method for ebool (not,and,or,cmux)
2023-10-28 00:51:14 +02:00
Clément 'birdy' Danjou
8c7b475ad2 fix() update comment 2023-10-27 15:15:43 +02:00
Clément 'birdy' Danjou
ea2a0385ce feat() Add method for ebool (not,and,or,cmux) 2023-10-26 10:58:13 +02:00
David
bd581422e5 Add network1 development support 2023-10-24 10:56:15 +08:00
youben11
d35e512aa0 feat(lib): add support for the remainder operation 2023-10-10 14:58:18 +01:00
David
0b1eca810e Add stateful opt req test 2023-10-09 12:41:31 +08:00
David
ba72900223 Fix optimistic requires 2023-10-06 11:19:18 +08:00
David
e68a07fc4e Add explicit casting from ebool to euint16/euint32 2023-10-02 12:35:19 +08:00
Clément 'birdy' Danjou
cb1b8a27f1 fix() force 0.8.19 2023-09-25 16:37:13 +02:00
Clément 'birdy' Danjou
59f3480e3f fix() force 0.8.19 version for everything 2023-09-25 16:03:23 +02:00
David
3484393b75 Remove Precompiles.sol 2023-09-21 11:53:30 +03:00
David
3d133c6951 Implement operator overloading
following operators are supported:
+, - (unary and binary), *, &, |, ^, ~ (unary)
2023-09-21 10:16:47 +03:00
David
f9a7ee72bf Use fheLib precompile for all internal functions 2023-09-19 14:29:01 +03:00
Petar Ivanov
6e35f79e87 Fix input type for the fheRand precompile
Change from bytes32[1] to bytes1[1] as we only send 1 byte for the int
type.

Fix compiler warning in GovernorZama.sol.
2023-09-14 15:06:36 +03:00
David
5393f61a50 Changes after codegen 2023-09-14 14:44:11 +03:00
Petar Ivanov
323b991765 Add support for the FHE rand precompile
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`.
2023-09-07 15:18:52 +02:00
Louis Tremblay Thibault
7079aa15ad Remove TFHE.req (#121)
* fix(lib): remove requires

* fix(contracts): remove use of `TFHE.req`
2023-09-06 16:19:10 +02:00
David
9884ed36bb Address Petar's comments 2023-09-01 08:19:17 +03:00
David
d5d8c6221d Add binary operator tests in solidity
Operator changes:
- remove scalar div operator where scalar is left
- perform trivial encryption in scalar for sub/shl/shr operators
2023-08-31 09:57:45 +03:00
David
a7457ac73f Remove codegen sorting code 2023-08-28 11:51:43 +03:00
David
880278284e Finish codegen rewrite
- TFHE.sol regenerated
- codegen.py deleted
- original order kept
2023-08-28 10:09:33 +03:00
David
13c41043f3 Rewrite codegen first stab 2023-08-24 11:34:50 +03:00
David
9c24c582ef Add div scalar function 2023-08-11 09:24:37 +03:00
Petar Ivanov
8bf0e4cf5d Add support for TFHE.decrypt() (#89)
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.
2023-08-01 11:13:28 +03:00
Clément 'birdy' Danjou
fedd2f952c chore: update prettier conf and update code style 2023-07-28 16:31:23 +02:00
Louis Tremblay Thibault
682edf7773 Hot fix to enable correct CMUX on euint16 and euint32 (#90)
* :)

* 0.1.6
2023-07-22 13:07:11 +02:00
Louis Tremblay Thibault
35d94658a3 feat(tfhe): add support for ebool type (#86)
* 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
2023-07-14 11:43:47 +02:00
Petar Ivanov
05a9e3cb60 Add method documentation in TFHE.sol (#85)
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.
2023-07-12 15:54:32 +03:00
Louis Tremblay Thibault
1ed0f52fd9 fix(auction): remove use of euint32.wrap(0) (#84) 2023-07-12 14:38:40 +02:00
Louis Tremblay Thibault
57ec39f716 fix(tfhe): make optimistic requires 8-bit (#82) 2023-07-11 18:48:55 +02:00
Louis Tremblay Thibault
f03245ae89 fix(tfhe): add neg and not overloads (#76) 2023-07-11 10:31:13 +02:00
Louis Tremblay Thibault
1ae6cdc592 fix(lib): make solc max version 0.8.19 (#81)
* fix(lib): make solc max version 0.8.19

* fix(tfhe): delete Trivial.sol
2023-07-11 10:30:59 +02:00
Louis Tremblay Thibault
e2cf0a4835 fix(tfhe): add automatic initialization for cts (#72) 2023-07-07 12:15:13 +02:00
Louis Tremblay Thibault
70887890f7 fix(tfhe): add missing overloads (#70) 2023-06-30 15:44:38 +02:00
Clément Danjou
67131a0d8f Merge pull request #66 from zama-ai/feature/default-value
Feature/default value
2023-06-30 11:40:57 +02:00