Skip to content

Commit

Permalink
Merge pull request #194 from zama-ai/docs/clear-roadmap
Browse files Browse the repository at this point in the history
docs() clarify roadmap section
  • Loading branch information
immortal-tofu authored Oct 6, 2023
2 parents 275b5c9 + 899a34e commit a96e751
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 34 deletions.
1 change: 1 addition & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- [Condition](solidity/condition.md)
- [Decryption and reencryption](solidity/decrypt.md)
- [Function specifications](solidity/functions.md)
- [Roadmap](solidity/roadmap.md)
- [Examples](solidity/examples.md)

## Client
Expand Down
63 changes: 29 additions & 34 deletions docs/solidity/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,38 @@

The `TFHE` library defines the following operations with FHE ciphertexts:

| name | function name | symbol | type | supported |
| --------------------- | ------------------- | ------ | ------------------ | -------------------------------------- |
| Add | `TFHE.add` | `+` | Binary | yes |
| Add w/ overflow Check | `TFHE.safeAdd` | | Binary, Decryption | no, coming soon (1) |
| Sub | `TFHE.sub` | `-` | Binary | yes |
| Sub w/ overflow Check | `TFHE.safeSub` | | Binary, Decryption | no, coming soon (1) |
| Mul | `TFHE.mul` | `*` | Binary | yes |
| Mul w/ overflow Check | `TFHE.safeMul` | | Binary, Decryption | no, coming soon (1) |
| Div | `TFHE.div` | | Binary | yes, for plaintext divisors |
| Rem | `TFHE.rem` | `%` | Binary | no, coming soon for plaintext divisors |
| BitAnd | `TFHE.and` | `&` | Binary | yes |
| BitOr | `TFHE.or` | `\|` | Binary | yes |
| BitXor | `TFHE.xor` | `^` | Binary | yes |
| Shift Right | `TFHE.shr` | | Binary | yes |
| Shift Left | `TFHE.shl` | | Binary | yes |
| Equal | `TFHE.eq` | | Binary | yes |
| Not equal | `TFHE.ne` | | Binary | yes |
| Greater than or equal | `TFHE.ge` | | Binary | yes |
| Greater than | `TFHE.gt` | | Binary | yes |
| Less than or equal | `TFHE.le` | | Binary | yes |
| Less than | `TFHE.lt` | | Binary | yes |
| Min | `TFHE.min` | | Binary | yes |
| Max | `TFHE.max` | | Binary | yes |
| Neg | `TFHE.neg` | `-` | Unary | yes |
| Not | `TFHE.not` | `~` | Unary | yes |
| Cmux | `TFHE.cmux` | | Ternary | yes |
| Decrypt | `TFHE.decrypt()` | | Decryption | yes |
| Reencrypt | `TFHE.reencrypt()` | | Reencryption | yes |
| Optimistic Require | `TFHE.optReq()` | | Decryption | yes |
| Random unsigned int | `TFHE.randEuintX()` | | Random | yes, as a mockup (2) |
| Random signed int | `TFHE.randEintX()` | | Random | no, coming soon as a mockup (2) |
| name | function name | symbol | type |
| ---------------------------- | ------------------- | ------ | ------------ |
| Add | `TFHE.add` | `+` | Binary |
| Sub | `TFHE.sub` | `-` | Binary |
| Mul | `TFHE.mul` | `*` | Binary |
| Div | `TFHE.div` | | Binary |
| BitAnd | `TFHE.and` | `&` | Binary |
| BitOr | `TFHE.or` | `\|` | Binary |
| BitXor | `TFHE.xor` | `^` | Binary |
| Shift Right | `TFHE.shr` | | Binary |
| Shift Left | `TFHE.shl` | | Binary |
| Equal | `TFHE.eq` | | Binary |
| Not equal | `TFHE.ne` | | Binary |
| Greater than or equal | `TFHE.ge` | | Binary |
| Greater than | `TFHE.gt` | | Binary |
| Less than or equal | `TFHE.le` | | Binary |
| Less than | `TFHE.lt` | | Binary |
| Min | `TFHE.min` | | Binary |
| Max | `TFHE.max` | | Binary |
| Neg | `TFHE.neg` | `-` | Unary |
| Not | `TFHE.not` | `~` | Unary |
| Cmux | `TFHE.cmux` | | Ternary |
| Decrypt | `TFHE.decrypt()` | | Decryption |
| Reencrypt | `TFHE.reencrypt()` | | Reencryption |
| Optimistic Require | `TFHE.optReq()` | | Decryption |
| Random unsigned int (mockup) | `TFHE.randEuintX()` | | Random |

> **_NOTE 1:_** Methods prefixed with `safe` will do an overflow check by decrypting an overflow bit and revert if that bit is true.
> **_NOTE 2:_** Random encrypted integers that are generated fully on-chain. Currently, implemented as a mockup by using a PRNG in the plain.
> **_NOTE 1:_** Random encrypted integers that are generated fully on-chain. Currently, implemented as a mockup by using a PRNG in the plain.
> Not for use in production!
Overloaded operators `+`, `-`, `*`, `&`, ... on encrypted integers are supported ([using for](https://docs.soliditylang.org/en/v0.8.19/contracts.html#using-for)). As of now, overloaded operators will call the versions without an overflow check.

More information about the supported operations can be found in the [function specifications](functions.md) page or in the [TFHE-rs docs](https://docs.zama.ai/tfhe-rs/getting-started/operations#arithmetic-operations.).

If you find yourself in search of a missing feature, we encourage you to [consult our roadmap](roadmap.md) for upcoming developments. Alternatively, don't hesitate to reach out to us on Discord or visit our community forum.
18 changes: 18 additions & 0 deletions docs/solidity/roadmap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Roadmap

## Operations

| name | function name | type | ETA |
| --------------------- | ------------------- | ------------------ | ---------------------------------- |
| Add w/ overflow check | `TFHE.safeAdd` | Binary, Decryption | Coming soon (1) |
| Sub w/ overflow check | `TFHE.safeSub` | Binary, Decryption | Coming soon (1) |
| Mul w/ overflow check | `TFHE.safeMul` | Binary, Decryption | Coming soon (1) |
| Div | `TFHE.div` | Binary | - |
| Rem | `TFHE.rem` | Binary | Coming soon for plaintext divisors |
| Random unsigned int | `TFHE.randEuintX()` | Random | - |
| Random signed int | `TFHE.randEintX()` | Random | - |

> **_NOTE 1:_** Methods prefixed with `safe` will do an overflow check by decrypting an overflow bit and revert if that bit is true.
> **_NOTE 2:_** Random encrypted integers that are generated fully on-chain. Currently, implemented as a mockup by using a PRNG in the plain.
> Not for use in production!

0 comments on commit a96e751

Please sign in to comment.