Skip to content

Commit

Permalink
Merge pull request #5 from KyryloKilin/main
Browse files Browse the repository at this point in the history
Rectifying spelling errors
  • Loading branch information
Cashmaney authored Jan 30, 2024
2 parents d379de3 + 49427fc commit dd92e92
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions docs/devdocs/Encryption and Privacy/Permits-Access-Control.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ In the context of Fhenix and blockchain, a permit refers to a signed JSON object

#### How to Generate a Permit

Permits are generated using the `getPermit` method. This method requires a the following parameter:
Permits are generated using the `getPermit` method. This method requires the following parameter:

* `contractAddress` (required, string): The address of the contract.
* `provider` (required): Note that if you want to unseal data using your wallet's encryption key you can't use "JsonRpcProvider" you will need to use a provider that can sign.
Expand All @@ -55,7 +55,7 @@ In the context of Fhenix, a permission is the part of a permit that supplies the
const permission = client.extractPermitPermissions(permit);
```

#### Using an Permission
#### Using a Permission

Once generated, you can use the permission and send it to the contract. You can also unseal the outputs of "sealoutput" assuming it was sealed using your permission.

Expand All @@ -70,4 +70,4 @@ const permission = client.extractPemitPermissions(permit);
client.storePermit(permit); // Stores a permit for a specific contract address.
const response = await contract.connect(owner).getValue(permission); // Calling "getValue" which is a view function in "contract"
const plaintext = await client.unseal(contractAddress, response);
```
```
9 changes: 6 additions & 3 deletions docs/devdocs/Tips/Useful-Tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,20 @@ You can assume now that `FHE.asEuint*(0)`is used quite often - Luckily we realiz
To explain this tip we will use an example. Let's assume we want to develop a confidential voting and let's say we have 4 candidates.
Assuming that on each vote we increase (cryptographically with FHE.add) the tally, one can just monitor the key in the DB that represents this specific tally and once the key was changes he will know who we voted for.
An ideal solution for this issue is to change all keys no matter who we voted for, but how?!

In order to understand how we will first need to understand that FHE encryption is a non-deterministic encryption means that encrypting (non-trivial encryption) a number twice will result with 2 different encrypted outputs.

Now that we know that, we can add 0 (cryptographically with FHE.add) to all of those tallies that shouldn't be changed and they will be changed in the DB!

#### FHE.req() in TXs

All of the operations are supported both in TXs and in Queries. That being said we strongly advice to think twice before you use those operations inside a TX. FHE.req() is actually exposing the value of your encrypted data. Assuming we will send the transaction and monitor the gas usage we can probably identify whether the FHE.req() condition met or not and understand a lot about what the encrypted values represent
All of the operations are supported both in TXs and in Queries. That being said we strongly advise to think twice before you use those operations inside a TX. FHE.req() is actually exposing the value of your encrypted data. Assuming we will send the transaction and monitor the gas usage we can probably identify whether the FHE.req() condition met or not and understand a lot about what the encrypted values represent.

#### Performance and Gas Usage

Currently, we are supporting a lot of FHE operations. Some of them might take a lot of time to compute, some good examples are: Div (5 seconds for euint32), Mul, Rem, and the time will grow depends on the value types you are using.
Currently we support many FHE operations. Some of them might take a lot of time to compute, some good examples are: Div (5 seconds for euint32), Mul, Rem, and the time will grow depends on the value types you are using.

When writing FHE code we encourage you to use the operations wisely and choose what operation should be used.
Example: Instead of `FHE.mul(ENCRYPTED_UINT_32, FHE.asEuint32(2))` you can use `FHE.shl(ENCRYPTED_UINT_32, FHE.asEuint32(1))` in some cases `FHE.div(ENCRYPTED_UINT_32, FHE.asEuint32(2))` can be replaced by `FHE.shr(ENCRYPTED_UINT_32, FHE.asEuint32(1))`

For more detailed banchmarks please refer to: TBD
For more detailed benchmarks please refer to: TBD
2 changes: 1 addition & 1 deletion docs/tutorial/Basic/Deploying.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Now that we have our completed WrappingERC20 token, the next step is to see if o
To do this, we'll be writing tests in typescript using hardhat, and deploying them on our [LocalFhenix ](../../devdocs/Setting%20Up%20Your%20Environment/Hardhat.md) environment which we set up earlier

:::tip[Note]
At this stage, using hardhat network is not supported, as Fhenix uses extentions to the EVM that enable FHE operations
At this stage, using hardhat network is not supported, as Fhenix uses extensions to the EVM that enable FHE operations
:::

### Compiling the Contract
Expand Down

0 comments on commit dd92e92

Please sign in to comment.