Skip to content

Commit

Permalink
Merge pull request #244 from zama-ai/updated-solidity-and-oz-versions
Browse files Browse the repository at this point in the history
Updated Solidity version to ^0.8.20 and OpenZeppelin Contracts to ^5.0.1
  • Loading branch information
jatZama authored Jan 9, 2024
2 parents bd6eb1c + 535b055 commit 96de5da
Show file tree
Hide file tree
Showing 33 changed files with 251 additions and 283 deletions.
2 changes: 1 addition & 1 deletion abstracts/EIP712WithModifier.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear

pragma solidity 0.8.19;
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
Expand Down
2 changes: 1 addition & 1 deletion abstracts/Reencrypt.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear

pragma solidity 0.8.19;
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
Expand Down
6 changes: 3 additions & 3 deletions codegen/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function implSol(ctx: CodegenContext, operators: Operator[]): string {
res.push(`
// SPDX-License-Identifier: BSD-3-Clause-Clear
pragma solidity 0.8.19;
pragma solidity ^0.8.20;
${fheLibInterface}
Expand Down Expand Up @@ -148,7 +148,7 @@ export function tfheSol(

res.push(`// SPDX-License-Identifier: BSD-3-Clause-Clear
pragma solidity 0.8.19;
pragma solidity ^0.8.20;
${commonSolLib()}
Expand Down Expand Up @@ -790,7 +790,7 @@ export function implSolMock(ctx: CodegenContext, operators: Operator[]): string
res.push(`
// SPDX-License-Identifier: BSD-3-Clause-Clear
pragma solidity 0.8.19;
pragma solidity ^0.8.20;
library Impl {
function add(uint256 lhs, uint256 rhs, bool scalar) internal pure returns (uint256 result) {
Expand Down
2 changes: 1 addition & 1 deletion codegen/testgen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export function generateSmartContract(os: OverloadShard): string {

res.push(`
// SPDX-License-Identifier: BSD-3-Clause-Clear
pragma solidity 0.8.19;
pragma solidity ^0.8.20;
import "../../lib/TFHE.sol";
contract TFHETestSuite${os.shardNumber} {
Expand Down
2 changes: 1 addition & 1 deletion docs/howto/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The `TFHE` library defines the following operations with FHE ciphertexts:
> **_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.
Overloaded operators `+`, `-`, `*`, `&`, ... on encrypted integers are supported ([using for](https://docs.soliditylang.org/en/v0.8.22/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](../api/functions.md) page or in the [TFHE-rs docs](https://docs.zama.ai/tfhe-rs/getting-started/operations#arithmetic-operations.).

Expand Down
2 changes: 0 additions & 2 deletions docs/howto/write_contract/hardhat.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Using Hardhat

> Our library TFHE requires Solidity version **0.8.19** specifically, as we rely on features exclusive to this version and do not currently provide support for versions beyond it.
The best way to start writing smart contracts with fhEVM is to use our [Hardhat template](https://github.com/zama-ai/fhevm-hardhat-template).

It allows you to start a fhEVM docker image and run your smart contract on it. Read the [README](https://github.com/zama-ai/fhevm-hardhat-template/blob/main/README.md) for more information.
Expand Down
2 changes: 0 additions & 2 deletions docs/howto/write_contract/remix.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Using Remix

> Our library TFHE requires Solidity version **0.8.19** specifically, as we rely on features exclusive to this version and do not currently provide support for versions beyond it.
You can use Remix to interact with a blockchain using fhEVM. If you want to send an encrypted input, you need to encrypt it with [fhevmjs CLI tool](https://docs.zama.ai/fhevm/client/getting_started/cli) for example. It becomes more complex if you want to reencrypt a value directly in Remix.

To avoid this problem, we developed a [version of Remix IDE](https://github.com/zama-ai/remix-project) with these two missing features:
Expand Down
2 changes: 1 addition & 1 deletion examples/BlindAuction.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear

pragma solidity 0.8.19;
pragma solidity ^0.8.20;

import "../lib/TFHE.sol";

Expand Down
2 changes: 1 addition & 1 deletion examples/CMUX.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear

pragma solidity 0.8.19;
pragma solidity ^0.8.20;

import "../abstracts/Reencrypt.sol";
import "../lib/TFHE.sol";
Expand Down
2 changes: 1 addition & 1 deletion examples/Counter.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear
pragma solidity 0.8.19;
pragma solidity ^0.8.20;

// dummy contract for dummy transactions just to advance blocks
contract Counter {
Expand Down
2 changes: 1 addition & 1 deletion examples/EIP712.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear

pragma solidity 0.8.19;
pragma solidity ^0.8.20;

import "../abstracts/EIP712WithModifier.sol";

Expand Down
2 changes: 1 addition & 1 deletion examples/EncryptedERC20.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear

pragma solidity 0.8.19;
pragma solidity ^0.8.20;

import "../abstracts/Reencrypt.sol";

Expand Down
2 changes: 1 addition & 1 deletion examples/GasEstimation.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.19;
pragma solidity ^0.8.20;

import "../lib/TFHE.sol";

Expand Down
2 changes: 1 addition & 1 deletion examples/Governor/Comp.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.19;
pragma solidity ^0.8.20;

import "../../abstracts/Reencrypt.sol";

Expand Down
2 changes: 1 addition & 1 deletion examples/Governor/GovernorZama.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.19;
pragma solidity ^0.8.20;

import "../../lib/TFHE.sol";

Expand Down
2 changes: 1 addition & 1 deletion examples/Identity/AbstractCompliantERC20.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear

pragma solidity 0.8.19;
pragma solidity ^0.8.20;

import "../../abstracts/Reencrypt.sol";
import "./ERC20Rules.sol";
Expand Down
2 changes: 1 addition & 1 deletion examples/Identity/CompliantERC20.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear

pragma solidity 0.8.19;
pragma solidity ^0.8.20;

import "../../lib/TFHE.sol";
import "./AbstractCompliantERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion examples/Identity/ERC20Rules.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear

pragma solidity 0.8.19;
pragma solidity ^0.8.20;

import "../../lib/TFHE.sol";
import "./IdentityRegistry.sol";
Expand Down
6 changes: 2 additions & 4 deletions examples/Identity/IdentityRegistry.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear

pragma solidity 0.8.19;
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
Expand Down Expand Up @@ -28,9 +28,7 @@ contract IdentityRegistry is Reencrypt, Ownable {
event NewDid(address wallet);
event RemoveDid(address wallet);

constructor() Ownable() {
_transferOwnership(msg.sender);
}
constructor() Ownable(msg.sender) {}

function addRegistrar(address wallet, uint registrarId) public onlyOwner {
require(registrarId > 0, "registrarId needs to be > 0");
Expand Down
2 changes: 1 addition & 1 deletion examples/OptimisticRequire.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear

pragma solidity 0.8.19;
pragma solidity ^0.8.20;

import "../lib/TFHE.sol";

Expand Down
2 changes: 1 addition & 1 deletion examples/Rand.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear

pragma solidity 0.8.19;
pragma solidity ^0.8.20;

import "../lib/TFHE.sol";

Expand Down
2 changes: 1 addition & 1 deletion examples/tests/TFHEManualTestSuite.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear
pragma solidity 0.8.19;
pragma solidity ^0.8.20;

import "../../lib/TFHE.sol";

Expand Down
2 changes: 1 addition & 1 deletion examples/tests/TFHETestSuite1.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear
pragma solidity 0.8.19;
pragma solidity ^0.8.20;

import "../../lib/TFHE.sol";

Expand Down
2 changes: 1 addition & 1 deletion examples/tests/TFHETestSuite2.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear
pragma solidity 0.8.19;
pragma solidity ^0.8.20;

import "../../lib/TFHE.sol";

Expand Down
2 changes: 1 addition & 1 deletion examples/tests/TFHETestSuite3.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear
pragma solidity 0.8.19;
pragma solidity ^0.8.20;

import "../../lib/TFHE.sol";

Expand Down
3 changes: 2 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ const config: HardhatUserConfig = {
tests: './test',
},
solidity: {
version: '0.8.19',
version: '0.8.22',
settings: {
metadata: {
// Not including the metadata hash
Expand All @@ -162,6 +162,7 @@ const config: HardhatUserConfig = {
enabled: true,
runs: 800,
},
evmVersion: 'paris',
},
},
typechain: {
Expand Down
2 changes: 1 addition & 1 deletion lib/Impl.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear

pragma solidity 0.8.19;
pragma solidity ^0.8.20;

interface FhevmLib {
function fheAdd(uint256 lhs, uint256 rhs, bytes1 scalarByte) external pure returns (uint256 result);
Expand Down
2 changes: 1 addition & 1 deletion lib/TFHE.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear

pragma solidity 0.8.19;
pragma solidity ^0.8.20;

type ebool is uint256;
type euint8 is uint256;
Expand Down
2 changes: 1 addition & 1 deletion mocks/Impl.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear

pragma solidity 0.8.19;
pragma solidity ^0.8.20;

library Impl {
function add(uint256 lhs, uint256 rhs, bool scalar) internal pure returns (uint256 result) {
Expand Down
2 changes: 1 addition & 1 deletion mocks/TFHE.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear

pragma solidity 0.8.19;
pragma solidity ^0.8.20;

type ebool is uint256;
type euint8 is uint256;
Expand Down
Loading

0 comments on commit 96de5da

Please sign in to comment.