The current devnet has a gas limit of 10,000,000. If you send a transaction exceeding this limit, it won't be executed. Consequently, your wallet won't be able to emit a new transaction. To address this, emit a new transaction with the same nonce but the correct gas limit. In Metamask, you can enforce the use of a specific nonce by enabling the feature in 'Advanced Settings'.
When you include a require statement in a transaction like require(TFHE.decrypt(ebool), "It didn't work");
, the revert message will not be returned if ebool
is false.
When you invoke the gas estimation method, fhEVM may not provide an accurate estimation if your code includes TFHE.decrypt
because it is unable to determine the actual value. In such cases, the gas estimation assumes that TFHE.decrypt()
returns 1
. Depending on your code, this assumption may lead to a deviation from the actual gas usage. To mitigate this, consider adding a 20% buffer to the gas estimation or more. However, be cautious not to exceed 10,000,000 as the upper limit. We've written a method, available in the hardhat template, to tackle this issue. Feel free to use it.
First, to understand the issue, you need to know that a euint32
or a ebool
are uint256
under the hood: they are a 256bits hash of the actual ciphertext. So if you set your properties directly in the contract as follows:
The TFHE.asEuint32(42)
will be executed during compilation to evaluate your property MY_CONSTANT
, because the compiler expect to have an actual value. Since you're not calling the precompiles which would return a trivial encryption of 42
, you get a 0
value.
In the contract, obtaining the bytes of the ciphertext is not possible. As outlined in our whitepaper, you manipulate the hash of the ciphertext in the EVM; the actual ciphertext is only utilized when interacting with the precompiles (TFHE.decrypt
, TFHE.add
, ...).
This error occurs when you haven't yet published any contracts on the blockchain. To resolve this, simply deploy a contract on the blockchain.
You can listen for events using WebSocket on port 8546
of your local Docker image. Alternatively, if you prefer to do it on Zama's devnet, you can use the WebSocket server available at wss://devnet.ws.zama.ai/
.