Migrate to v0.7

This document provides instructions on migrating from FHEVM v0.6 to v0.7.

From 0.6.x

Package and library

The package is now @fhevm/solidity instead of fhevm and the library name has changed from TFHE to FHE

import { FHE } from "@fhevm/solidity";

Configuration

Configuration has been renamed from SepoliaZamaConfig to SepoliaConfig.

import { SepoliaConfig } from "@fhevm/solidity/config/ZamaConfig.sol";

Also, the function to define manually the Coprocessor has been renamed from setFHEVM to setCoprocessor, and the function to define the oracle has been changed to setDecryptionOracle.

constructor () {
  FHE.setCoprocessor(0x848B0066793BcC60346Da1F49049357399B8D595);
  FHE.setDecryptionOracle(0xa02Cda4Ca3a71D7C46997716F4283aa851C28812);
}

You can read more about Configuration on the dedicated page.

Decryption Oracle

Previously, an abstract contract GatewayCaller was used to request decryption. It has been replaced by FHE.requestDecryption:

function requestBoolInfinite() public {
  bytes32[] memory cts = new bytes32[](1);
  cts[0] = FHE.toBytes32(myEncryptedValue);
  FHE.requestDecryption(cts, this.myCallback.selector);
}

You can read more about Decryption Oracle on the dedicated page.

Deprecation of ebytes

ebytes has been deprecated and removed from FHEVM.

Block gas limit

Block gas limit has been removed in favor of HCU (Homomorphic Complexity Unit) limit. FHEVM 0.7.0 includes two limits:

  • Sequential homomorphic operations depth limit per transaction: Controls HCU usage for operations that must be processed in order. This limit is set to 5,000,000 HCU.

  • Global homomorphic operations complexity per transaction: Controls HCU usage for operations that can be processed in parallel. This limit is set to 20,000,000 HCU.

You can read more about HCU on the dedicated page.

Last updated